Skip to content

Conversation

@MarcoLvr
Copy link

@MarcoLvr MarcoLvr commented Sep 22, 2025

What's this?
With this edit every server can use a different forwarding mode to obtain and forward player info. For instance, if you are running a 1.12 (or lower version) server on a velocity proxy with MODERN player info forwarding the server doesn't support MODERN forwarding. So you can set LEGACY forwarding mode for that server and velocity will use ONLY FOR THAT SERVER the legacy forwarding mode. The default mode is "INHERIT" which uses the player info forwarding mode set in the config.

Note: the INHERIT mode doesn't physically exists. Just set the server forwarding mode to NULL or avoid valuing it in the config

The main configuration now supports two syntaxes for describing a server:

classic syntax (INHERIT mode): server = "address:port"
new syntax: server = {address = "address:port", forwarding-mode = "MODE"}

all servers created without defining a forwarding mode will use the INHERIT mode.

Example of use
Imagine a simple network with a lobby, a 1.8 game mode (like bedwars) and maybe a Fabric 1.21 server.
Fabric needs MODERN forwarding but the 1.8 server cannot use it. So you have two choices:

  1. Set the main forwarding mode to legacy (allow <1.13 players to join) and set MODERN mode only for the fabric server.
[...]
player-info-forwarding-mode = "legacy"
[...]
[servers]
try = ["lobby"]
lobby = "localhost:25566" //we leave this in INHERIT mode because in this case the lobby could be a 1.8 server too
bedwars = "localhost:25567" //we leave this in INHERIT mode because the main mode is legacy
modded =  { address = "localhost:25568", forwarding-mode = "MODERN" } //fabric needs MODERN forwarding
[...]
  1. Set the main forwarding mode to MODERN and set LEGACY mode only for the 1.8 server.
[...]
player-info-forwarding-mode = "modern"
[...]
[servers]
try = ["lobby"]
lobby = "localhost:25566" //we leave this in INHERIT mode because in this case the lobby could be a >1.13 server
bedwars = { address = "localhost:25567", forwarding-mode = "LEGACY" }  //bedwars (1.8 server) needs legacy mode
modded =  "localhost:25568" //we leave this in INHERIT mode because the main mode is modern
[...]

This system could be very useful for these types of situations!

What's this?
Every server can use a different forwarding mode to obtain and forward player info.
For instance, if you are running a 1.12 (or lower version) server on a velocity proxy with MODERN player info forwarding the server doesn't support MODERN forwarding. So you need to set LEGACY forwarding mode for that server and velocity will use ONLY FOR THAT SERVER the legacy forwarding mode. The default mode is "FOLLOWUP" mode which uses the player info forwarding mode set in the config.

The main configuration now supports two syntaxes for describing a server:

classic syntax (FOLLOWUP mode): server = "address:port"
new syntax: server = {address = "address:port", forwarding-mode = "MODE"}

all servers created without defining a forwarding mode will use the FOLLOWUP mode.
@4drian3d 4drian3d added the type: feature New feature or request label Sep 22, 2025
…Servers() method to avoid breaking compatibility with current versions.

ServerInfoForwardingMode.java: added a javadoc for the FOLLOWUP mode and added the NONE mode

VelocityConfiguration.java: made "mode" field optional for the new server syntax. Restored old forwarding secret check.

VelocityRegisteredServer.java: added the forwarding secret check if forwarding mode is MODERN or BUNGEEGUARD

ServerForwardingModeUtil.java: mapped NONE mode to NONE mode in PlayerInfoForwarding.java
@MarcoLvr MarcoLvr requested a review from 4drian3d September 22, 2025 23:21
…guration#validate

added requiresNonNull checks on BackendServerConfigImpl
@MarcoLvr MarcoLvr requested a review from 4drian3d September 23, 2025 00:14
…rverConfig. Made address and forwardingMode final in its implementation class.

deprecated getServers() in favor of getBackendServers()

Fixed proxy option syntax for "add-server". Now the syntax is: <name>:<host>:[port]:[forwardingmode]

moved ServerInfoForwardingMode conversion from util package to VelocityRegisteredServer#getConfiguredPlayerInfoForwarding
@MarcoLvr MarcoLvr requested a review from Emilxyz September 23, 2025 12:53
@MarcoLvr
Copy link
Author

did everything! Let me know if there's any other change to do

…mentation class in the proxy module.

Modified comment in ProxyConfig#getServers
@MarcoLvr MarcoLvr requested a review from 4drian3d September 23, 2025 23:04
Copy link
Contributor

@4drian3d 4drian3d left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@4drian3d 4drian3d linked an issue Sep 24, 2025 that may be closed by this pull request
@MarcoLvr
Copy link
Author

@Emilxyz we are waiting for you :)

Copy link
Contributor

@Emilxyz Emilxyz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we are waiting for you

I'm not a team member, just sharing my thoughts, so my approval is not actually required. Also a friendly reminder that everyone is doing this on their free time, so it's not really needed to bump a review request after only a day.

I gave this another look and it basically lgtm other than these minor things in review comments.

Another thought I had (but I would wait with doing any changes) is that maybe we can just use ServerInfo for this instead of adding a new type, they basically share the same fields and probably will continue to do so in the future as well.

Also there is the issue of the planned config api switch which is holding up other things already that would make changes to the config, so be prepared for this pr to also be affected by this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Per-server forwarding mode

4 participants