13
0
geforkt von Mirrors/Velocity
Commit graph

836 Commits

Autor SHA1 Nachricht Datum
Andrew Steinborn
ebad3d1005 Use Integer.MIN_VALUE for the sentinel for readVarIntSafely() 2020-05-25 16:05:36 -04:00
Andrew Steinborn
d7bbe7531a Additional protocol hardening. 2020-05-25 15:58:52 -04:00
Andrew Steinborn
62d3f61a77 Merge branch 'dev/1.1.0' into decode-multiple
# Conflicts:
#	proxy/src/main/java/com/velocitypowered/proxy/connection/client/ConnectedPlayer.java
2020-05-25 13:27:44 -04:00
Andrew Steinborn
abd81a0216 Fix Checkstyle errors. 2020-05-25 13:24:41 -04:00
Andrew Steinborn
0cb4c02107 Run all commands on a separate thread pool. 2020-05-25 13:09:04 -04:00
Andrew Steinborn
ec1fc3944d Make sure this runs on the event loop. 2020-05-25 12:08:24 -04:00
Andrew Steinborn
942e2f2e1a Better generic cleanup. 2020-05-25 11:56:56 -04:00
Andrew Steinborn
74ff56cbc9 Also reset when an exception is thrown. 2020-05-25 11:49:45 -04:00
Andrew Steinborn
64c16e61d2 Reset in-flight connection only if the server disconnects the client. 2020-05-25 11:44:02 -04:00
Andrew Steinborn
b0f1398b45 Further confinement of preconnect checks to event loop. 2020-05-25 10:26:05 -04:00
Andrew Steinborn
fa954ab717 Confine preconnect validation/setup logic to event loop. 2020-05-25 09:38:41 -04:00
Andrew Steinborn
75ddeb062f Confine preconnect validation/setup logic to event loop. 2020-05-25 09:38:22 -04:00
Andrew Steinborn
a98a7dd67e Merge branch 'dev/1.1.0' into decode-multiple 2020-05-24 11:41:17 -04:00
Andrew Steinborn
b3bd773fea Switch out Cloudflare zlib for libdeflate.
libdeflate is significantly faster than vanilla zlib, zlib-ng, and Cloudflare zlib. It is also MIT-licensed (so no licensing concerns). In addition, it simplifies a lot of the native code (something that's been tricky to get right).

While we're at it, I have also taken the time to fine-time compression in Velocity in general. Thanks to this work, native compression only requires one JNI call, an improvement from the more than 2 (sometimes up to 5) that were possible before. This optimization also extends to the existing Java compressors, though they require potentially two JNI calls.
2020-05-24 10:56:26 -04:00
Five (Xer)
38487c5bba
Server-change mechanics update 2020-05-23 13:03:33 +02:00
Five (Xer)
197bc4f288
Make checkstyle happy again 2020-05-23 11:49:27 +02:00
Five (Xer)
fca73bae67
Some minor touch-ups 2020-05-23 11:46:27 +02:00
Five (Xer)
d37b6a361c
Snapshot 20w21a 2020-05-23 00:18:36 +02:00
Andrew Steinborn
91e9769c5a Cap /server list to 50 servers.
Any more, and the server list is arguably useless. Thanks to BXBW for finding this particular issue!
2020-05-17 00:24:00 -04:00
Andrew Steinborn
feb7c2f893 Reject invalid tab complete command requests. 2020-05-08 18:22:21 -04:00
Andrew Steinborn
b42045c050 Reject invalid tab complete command requests. 2020-05-08 18:17:02 -04:00
Andrew Steinborn
10680f16d3 Reject invalid tab complete command requests. 2020-05-08 18:16:40 -04:00
Andrew Steinborn
2418cc271a
Merge pull request #307 from mikroskeem/feature/prevent-proxy-connections
Add prevent-proxy-connections option
2020-05-08 14:57:20 -04:00
Mark Vainomaa
21f03d5d50
Add prevent-proxy-connections option to make sending client IP to Mojang toggleable 2020-05-08 21:16:12 +03:00
Andrew Steinborn
4d62d61485 We're well into 2020, just saying. 2020-05-08 14:04:07 -04:00
Andrew Steinborn
f7e70cff20 We're well into 2020, just saying. 2020-05-08 14:03:57 -04:00
Andrew Steinborn
3bc8323ed5 We're well into 2020, just saying. 2020-05-08 14:03:35 -04:00
Andrew Steinborn
42ad7594ae
Merge pull request #300 from Leymooo/command-event
fix command forwarding to server
2020-04-29 15:26:29 -04:00
Leymooo
aa55af8eb7 fix command forwarding 2020-04-29 22:13:16 +03:00
Andrew Steinborn
e759668f53
Merge pull request #299 from Leymooo/command-event
Add event for commands
2020-04-29 12:51:47 -04:00
Andrew Steinborn
37a1a49fda Allow disabling BungeeCord plugin message channel. 2020-04-28 14:10:54 -04:00
Leymooo
26bf94f08f fix typos, update javadocs 2020-04-27 13:09:04 +03:00
Leymooo
c0b8e9d646 add async methods, also add separate methods which will call event and which will not call event 2020-04-27 01:05:57 +03:00
Leymooo
fb64333813 pass eventLoop to thenApplyAsync 2020-04-27 00:11:49 +03:00
Leymooo
1fb382e0f6 fix logic 2020-04-27 00:09:25 +03:00
Leymooo
6555e0e337 Add CommandExecuteEvent 2020-04-27 00:04:12 +03:00
Andrew Steinborn
1441dec367 Implement brigadier:long argument type, fixes #295 2020-04-23 16:21:44 -04:00
Andrew Steinborn
957c0dd307 Implement brigadier:long argument type, fixes #295 2020-04-23 16:21:22 -04:00
Andrew Steinborn
88641662d8 Implement brigadier:long argument type, fixes #295 2020-04-23 16:19:49 -04:00
Andrew Steinborn
bb129a3d0b Fix rare race condition with transitioning
If the player unexpectedly disconnects after ServerConnectEvent is
fired, but before the connection transitions to the new player, Velocity
would throw an exception thinking the connection was not present. This
is the correct behavior, but the behavior is very surprising. Instead we
will double-check to ensure the connection has not been lost before we
continue with transitioning to the new server.
2020-04-22 10:31:13 -04:00
Andrew Steinborn
81a0cbe3b9 Fix rare race condition with transitioning
If the player unexpectedly disconnects after ServerConnectEvent is
fired, but before the connection transitions to the new player, Velocity
would throw an exception thinking the connection was not present. This
is the correct behavior, but the behavior is very surprising. Instead we
will double-check to ensure the connection has not been lost before we
continue with transitioning to the new server.
2020-04-22 10:31:05 -04:00
Andrew Steinborn
2b84d35798 Fix bug in ConnectOther message
Credits to @Jay113355 for spotting this
2020-04-21 06:23:04 -04:00
Andrew Steinborn
d0cbcf65e9 Fix some tab-complete regressions 2020-04-19 09:07:17 -04:00
Andrew Steinborn
413578f979 Fix rare race condition with transitioning
If the player unexpectedly disconnects after ServerConnectEvent is
fired, but before the connection transitions to the new player, Velocity
would throw an exception thinking the connection was not present. This
is the correct behavior, but the behavior is very surprising. Instead we
will double-check to ensure the connection has not been lost before we
continue with transitioning to the new server.
2020-04-19 03:39:15 -04:00
creeper123123321
9f6d7c2e82 fix name 2020-04-13 11:57:12 -03:00
creeper123123321
e93a510b0f (Implementation) Allow injecting into backend connection 2020-04-13 10:35:26 -03:00
Andrew Steinborn
aae151e3d9 No need to register multiple times 2020-04-12 17:21:00 -04:00
Andrew Steinborn
4ddc55a5b7 No need to register multiple times 2020-04-12 17:20:54 -04:00
Andrew Steinborn
4494033fbe No need to register multiple times 2020-04-12 17:20:38 -04:00
Andrew Steinborn
558c158592 Close one last "proxy crasher" loophole 2020-04-12 17:19:00 -04:00
Andrew Steinborn
49ab2764c4 Close one last "proxy crasher" loophole 2020-04-12 17:18:53 -04:00
Andrew Steinborn
f49d36b719 Close one last "proxy crasher" loophole 2020-04-12 17:05:36 -04:00
Andrew Steinborn
b04b43954f Merge branch 'dev/1.1.0' into decode-multiple 2020-04-11 22:05:43 -04:00
Andrew Steinborn
2e38e0e1cb Properly fix the previous patch 2020-04-11 21:52:01 -04:00
Andrew Steinborn
8df4467392 Upon connection exception, discard all incoming packets instead 2020-04-11 21:24:39 -04:00
Andrew Steinborn
6ed61848e9 Upon connection exception, discard all incoming packets instead 2020-04-11 21:19:54 -04:00
Hugo Manrique
2c2eca3548 Only finish non-repeating tasks 2020-04-11 21:09:15 -04:00
Hugo Manrique
55818ce5eb Remove tasks from lookup map upon completion 2020-04-11 21:09:02 -04:00
Crypnotic
d4e51e2d07 Add cleanServerName to VelocityConfiguration to remove quotes and other unforeseen characters from server names before registration 2020-04-11 21:08:47 -04:00
Andrew Steinborn
c0ef3edcc4
Merge pull request #274 from Crypnotic/bugfix/invalid-server-key
Clean server name keys before attempting to register
2020-04-08 16:45:02 -04:00
Andrew Steinborn
98b03376e5
Merge pull request #281 from Gabik21/tablist-improvement
Don't send ping update twice (1.7)
2020-04-07 13:35:18 -04:00
Gabik21
2217e8a5c9
Fix 1.7 tablist behaving weird with colored names
The 1.7 tablist packet only contains three types of information:

 - Name of the tablist entry (limited to 16 characters including colors)
 - Ping of the entry
 - If this entry needs to be added or removed (client accepts duplicates
 as 'ping update')

The previous logic was trying to preserve parity with
GameProfile#getName returning a stripped down name to have a 'real'
username.
That is fundamentally broken, because entries with duplicate content,
but different colors are very common, especially with custom tablists.

For packets coming from a native 1.7 server we just won't define the
displayname anymore, as there is no such thing as a 'displayname',
because tablist entries are not bound to any player.

Using the Velocity Tablist API to modify existing entries will work, though
the backend server will completely loose control over the entry. Custom
entries added over the Velocity Tablist API will work, but are cut off
by the 16 character limitation.

This commit only fixes the bug, where entries are incorrectly handled
with their stripped name, a lot of the things explained above were
already implemented correctly.
2020-04-07 12:17:02 +02:00
Gabik21
5089da07fc
Don't send ping update twice
VelocityTabListEntry#setLatency calls the update method, which
constructs a new packet and sends it to the client.
The backend packet we are processing also reaches the client, therefore
we are sending the same packet twice.
VelocityTabListEntry#setLatencyInternal is the correct method here.
2020-04-02 17:46:24 +02:00
Hugo Manrique
d722422947
Only finish non-repeating tasks 2020-03-13 18:52:15 +01:00
Hugo Manrique
6ec6beedbd
Remove tasks from lookup map upon completion 2020-03-13 18:17:06 +01:00
Andrew Steinborn
ae7f0143de Do not trim the args for string-based command APIs 2020-02-28 16:54:46 -05:00
Andrew Steinborn
29bedf0943 Do not trim the args for string-based command APIs 2020-02-28 16:54:25 -05:00
Andrew Steinborn
65acb13dca Checkstyle 2020-02-21 18:51:41 -05:00
Andrew Steinborn
3e053d63b4 Allow ping passthrough for descriptions too 2020-02-21 18:36:10 -05:00
Andrew Steinborn
932f3bc2bf Merge branch 'dev/1.1.0' into decode-multiple 2020-02-17 20:52:19 -05:00
Andrew Steinborn
c63bd4cd02 Fix checkstyle error 2020-02-17 20:35:28 -05:00
Andrew Steinborn
8ae7945b9f Upon connection exception, discard all incoming packets instead 2020-02-17 19:34:22 -05:00
Andrew Steinborn
37994449d7 Fix regressions with plugin dependency loading from #272
This is a quick and dirty fix because it's late. I'll need to
commit a better fix later.
2020-02-16 03:19:13 -05:00
Andrew Steinborn
3b6f8e2421 Use more obvious/broken-down test cases for topological sort tests 2020-02-16 00:29:35 -05:00
Andrew Steinborn
5c6163d8cd Use more obvious/broken-down test cases for topological sort tests 2020-02-13 19:20:53 -05:00
Andrew Steinborn
e558b7ca1f Update to new bStats revision 2020-02-13 12:58:24 -05:00
Andrew Steinborn
29168ae549 Update to new bStats revision 2020-02-13 12:57:48 -05:00
Crypnotic
8fba9d7438 Add cleanServerName to VelocityConfiguration to remove quotes and other unforeseen characters from server names before registration 2020-02-09 13:40:15 -06:00
alexstaeding
da8cee2260
Make PluginContainer injectable (#272) 2020-02-07 16:22:47 -05:00
Andrew Steinborn
77526d9bf4
Merge pull request #266 from alex11441/dev/1.1.0
Allow users to specify a reason in the shutdown command
2020-01-24 16:01:23 -05:00
Andrew Steinborn
0c7a995767 Don't attempt to retain the buffer if it goes to a closed connection 2020-01-24 01:22:44 -05:00
Andrew Steinborn
c7bac69290 Don't attempt to retain the buffer if it goes to a closed connection 2020-01-24 01:22:32 -05:00
Andrew Steinborn
53c951bc52 Revert "Another experiment for memory leaks: Create a brand-new buffer for passthrough uncompressed content"
This reverts commit 92571a65db.

It looks like c3fab89bd7 nabbed it at last.
2020-01-24 01:21:50 -05:00
Andrew Steinborn
c3fab89bd7 Don't attempt to retain the buffer if it goes to a closed connection 2020-01-20 17:37:21 -05:00
Andrew Steinborn
92571a65db Another experiment for memory leaks: Create a brand-new buffer for passthrough uncompressed content 2020-01-14 22:18:05 -05:00
Andrew Steinborn
c14ceb315d Return the magic-3 loop again... :( 2020-01-01 10:14:15 -05:00
Andrew Steinborn
a15c8ecc2b Merge branch 'dev/1.1.0' into decode-multiple 2019-12-31 21:43:11 -05:00
Andrew Steinborn
08df080771 Try to diagnose memory leak 2019-12-31 21:43:02 -05:00
Alex
9f340347b6 Allow users to specify a reason in the shutdown command 2019-12-30 23:20:55 -07:00
Alex
941800ce96 Add VelocityServer#shutdown(boolean, TextComponent) 2019-12-30 23:20:25 -07:00
Andrew Steinborn
fb0446f4fc Add DisconnectEvent#disconnectedDuringLogin() 2019-12-24 23:56:39 -05:00
Andrew Steinborn
deede70070 Rename mystery field in JoinGame 2019-12-17 13:57:48 -05:00
Andrew Steinborn
c3068ea26b Rename mystery field in JoinGame 2019-12-14 17:45:54 -05:00
Andrew Steinborn
fa489f6014 Rename mystery field in JoinGame 2019-12-14 17:45:10 -05:00
Andrew Steinborn
b56302b17e Minecraft 1.15 (backport from 1.1.0) 2019-12-10 12:22:24 -05:00
Andrew Steinborn
97da6753b5 Merge branch 'dev/1.1.0' into decode-multiple 2019-12-06 03:10:25 -05:00
Andrew Steinborn
8c3f7e2ecc Optimize DNS resolution logic for AsyncHttpClient 2019-12-01 15:17:17 -05:00
Andrew Steinborn
75359256b3 Introduce velocity.natives-tmpdir property for properly handling noexec /tmp 2019-11-29 14:27:27 -05:00
Andrew Steinborn
e06e2e4cf9 Introduce velocity.natives-tmpdir property for properly handling noexec /tmp 2019-11-29 14:26:59 -05:00
Andrew Steinborn
667610c251 Fix command block tab complete on <=1.12.2 2019-11-28 15:28:02 -05:00
Andrew Steinborn
d137d6ce46 Fix command block tab complete on <=1.12.2 2019-11-28 15:22:26 -05:00
Andrew Steinborn
d1acd5b6d5 Merge branch 'dev/1.1.0' into decode-multiple 2019-11-28 13:23:46 -05:00
Andrew Steinborn
50b50f3cbb Fix 1.13+ tab complete for server commands 2019-11-28 13:12:53 -05:00
Andrew Steinborn
ae82bb21af Merge branch 'dev/1.1.0' into decode-multiple 2019-11-27 01:09:21 -05:00
Andrew Steinborn
68e5372b2e QuietException should be a RuntimeException 2019-11-27 01:04:48 -05:00
Andrew Steinborn
467fe34da3 Provide useful information for "unexpectedly disconnected from server"
Fixes #233
2019-11-27 01:01:50 -05:00
Andrew Steinborn
0c14eabe6b Fix Checkstyle issues 2019-11-26 16:32:50 -05:00
Andrew Steinborn
87ad188f92 Finalize integrated BungeeQuack 2019-11-26 16:27:30 -05:00
Andrew Steinborn
b08f27b5c4 Merge branch 'dev/1.1.0' into bungeequack-integrate 2019-11-26 15:52:53 -05:00
Andrew Steinborn
0b6fc06e67 Initial 1.15-pre2 support 2019-11-26 15:10:22 -05:00
Andrew Steinborn
bfeca40b17 Make sure we only tab-complete commands for which we have access to 2019-11-26 14:08:16 -05:00
Andrew Steinborn
2baa162d91 Make sure we only tab-complete commands for which we have access to 2019-11-26 14:07:55 -05:00
Andrew Steinborn
893391202b Manually backport e29e20b from Velocity 1.1.0 2019-11-26 13:47:58 -05:00
Andrew Steinborn
e29e20b1e8 Fix 1.13+ tab-complete with command but no arguments
As a nice side-effect, this simplifies the tab complete code
a bit.
2019-11-26 13:44:21 -05:00
Andrew Steinborn
ae14eb8ccb Fix potential UDP speculative reflection attack 2019-11-23 01:07:29 -05:00
Andrew Steinborn
da63406ee7 Fix potential UDP speculative reflection attack 2019-11-23 01:06:00 -05:00
Andrew Steinborn
8725178d6d Flush queued packets to the client in case we can't write 2019-11-17 14:52:12 -05:00
Andrew Steinborn
3eeea8e8f8 Add limited flush consolidation, if the remote server supports it. 2019-11-17 11:14:56 -05:00
Andrew Steinborn
d2b8271eb4 Allow running Velocity without any servers.
This is a niche setup, however if your network is 100% dynamically configured, this is a handy feature to have available.

To support this functionality, a new PlayerChooseInitialServerEvent event was added to allow the initial server to connect to be changed as desired.
2019-11-16 23:17:09 -05:00
Andrew Steinborn
e12f970684 Fix fresh 1.1.0 velocity.toml generation. 2019-11-16 22:34:30 -05:00
Andrew Steinborn
010a10f50f Do not try to prevent people from running Velocity behind Velocity.
This commit absolutely does not change our support policy on this: this
is a completely unsupported setup. In any event, there is an existing
forwarding check in Velocity that covers this case quite well.

I am making this change to make the login process less "chatty" for
higher-latency links and 1.13+ servers.
2019-11-15 01:35:44 -05:00
Andrew Steinborn
ba8629ca0e Try to decode multiple packets at once 2019-11-15 00:39:11 -05:00
Andrew Steinborn
d333eb30b8 Always create the length buffer using the best possible native buffer 2019-11-09 22:07:54 -05:00
Andrew Steinborn
8c98f5a4a6 Simplify and harden Netty handlers 2019-11-05 20:07:47 -05:00
Andrew Steinborn
09d33de03e
Merge pull request #256 from Gabik21/previous-server-in-event
Add previous server to ServerConnectedEvent
2019-10-31 19:51:32 -04:00
Gabik21
7c0a402cca
Add previous server to ServerConnectedEvent 2019-10-28 14:45:13 +01:00
Andrew Steinborn
3f321a5219 Indicate plugin loads 2019-10-26 21:10:38 -04:00
Andrew Steinborn
9d5930d96b Integrate BungeeQuack functionality into Velocity 2019-10-20 00:58:55 -04:00
Andrew Steinborn
19e1e05bbc Bring back kqueue transport from the dead
My PR to AsyncHttpClient was accepted and 2.10.4 was released with it
included.
2019-10-20 00:27:31 -04:00
Andrew Steinborn
6ff5cac4d3 Fix issues with decoding and Java fallback native 2019-10-19 23:56:44 -04:00
Joe Hirschfeld
a16684564b Make AES crypto operations use one buffer
All AES implementations being used are 'copy safe', where the source and
destination arrays may be the same. Lets save ourself a copy and reap
the performance wins!
2019-10-19 19:55:02 -07:00
james58899
bd35c6835e
Allow set redirect message 2019-10-17 08:32:50 +08:00
Andrew Steinborn
7747679ee1 Implement optimized compression for Java 11+
Using the fact that the Java Deflater/Inflater API now supports
ByteBuffers as of Java 11, we can provide performance benefits equivalent
to the Velocity 1.0.x native compression on servers running Java 11+ on
non-macOS and non-Linux platforms (such as Windows).
2019-10-04 17:08:14 -04:00
Andrew Steinborn
39e48c9467 Implement #149 to send just one respawn packet 2019-09-28 00:29:51 -04:00
Andrew Steinborn
62cd2c661a Clean up HandshakeSessionHandler 2019-09-27 22:39:16 -04:00
Andrew Steinborn
17e6944dae Clean up HandshakeSessionHandler 2019-09-27 22:37:42 -04:00
Andrew Steinborn
546307b0d6 Suppress invalid protocol spam 2019-09-27 22:24:21 -04:00
Andrew Steinborn
1824c7ad7e Suppress invalid protocol spam 2019-09-27 22:23:40 -04:00
Andrew Steinborn
9b570ff599 Revert this entirely for now. 2019-09-17 09:38:12 -04:00
Andrew Steinborn
8dea7567d8 Correctly handle 0-length packet 2019-09-17 09:33:43 -04:00
Andrew Steinborn
009c9afe09 Decode multiple VarInt-prefixed packets
If the remote server does flush consolidation, Velocity will be able to
frame the packets all at once instead of having to constantly decode
packets. This should provide a modest performance boost for them whilst
not impacting un-optimized servers.
2019-09-16 20:01:38 -04:00
Andrew Steinborn
138a887d73 Fix "all" not appearing in the tab-complete for /server 2019-09-15 19:55:04 -04:00
Andrew Steinborn
aff06164cd Fix "all" not appearing in the tab-complete for /server 2019-09-15 19:54:33 -04:00
Andrew Steinborn
9c9fa1c5ae Remove flush consolidation for now
This is still highly experimental
2019-09-09 00:47:42 -04:00
Andrew Steinborn
63dcc56735 Also sort servers for /glist all 2019-09-07 17:09:36 -04:00
Andrew Steinborn
08173c50ef Refactor and improve ServerCommand
The code has been cleaned up and reorganized. As a small quality of life
change, the server names are now sorted in alphabetical order.
2019-09-07 17:06:10 -04:00
Andrew Steinborn
983f3012a6 Merge branch 'dev/1.1.0' into feature/flush-consolidation-v2 2019-09-07 00:34:08 -04:00
Andrew Steinborn
ecfb14411d Merge remote-tracking branch 'origin/dev/1.1.0' into dev/1.1.0 2019-09-07 00:15:34 -04:00
Andrew Steinborn
35856fec04 Merge branch 'dev/1.1.0' into natives-java-improvements
# Conflicts:
#	native/src/main/java/com/velocitypowered/natives/encryption/JavaVelocityCipher.java
2019-09-07 00:06:13 -04:00
Gabik21
aef0f2ca8c
Fix name mapping not being cleared on switch
This fixes a bug where tablist would be messed up for 1.7 clients due to
an internal misconception.
2019-09-05 12:17:19 +02:00