-
-
Notifications
You must be signed in to change notification settings - Fork 626
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Virtualhost support for server list pings #1265
base: dev/3.0.0
Are you sure you want to change the base?
Conversation
I added an additional commit to add support for this to the public API so plugins can use it. |
Although, the public API change I've proposed might not be the best way to go about things. The expected behavior should pretty much always be to use a virtualhost if the player connected with one, but with this method plugin devs have to go out of their way to support it. Shouldn't the easiest way to do things be the correct way? Maybe |
* @param virtualHostString the virtual hostname to pass to the server for the ping | ||
* @return the server ping result from the server | ||
*/ | ||
CompletableFuture<ServerPing> ping(PingOptions pingOptions, String virtualHostString); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of adding another ping method, add a virtual host field to PingOptions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good! Should I make this change for the private internal API as well?
When a player connects to a server through velocity, velocity correctly forwards the virtualhost used to connect. This allows velocity to be run in front of proxy/routing services such as mc-router, and gives the proxying services running behind velocity the information they need to know which final game-server to forward the request to.
However, velocity doesn't forward that information for server list pings, meaning that even with ping passthrough enabled, any proxy/router running behind velocity won't have the information it needs to be able route pings to the correct game-server based on the virtual host. Instead, velocity would just create the ping packet with the host set to whatever was configured in
velocity.toml
. This PR fixes that issue, and makes it so virtualhosts are now forwarded with server list pings as well.I'm not super familiar with the velocity codebase as a whole, so if this PR needs any changes to align with the overall goals or structure of the project, I'd be happy to make any requested modifications.