Skip to content
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

Allow setting forwarding mode separately for different servers #1357

Open
wants to merge 6 commits into
base: dev/3.0.0
Choose a base branch
from

Conversation

wafarm
Copy link

@wafarm wafarm commented Jun 16, 2024

Fix #304

It is quite common to have a setup which includes both servers newer than 1.12 and older than 1.12. By allowing setting forwarding modes separately, we don't need to use the legacy forwarding mode all the time. Especially it is discontinued for newer fabric versions.

This PR is fully compatible with old config files and no changes to API are made.

You can find builds with this change included here: https://github.com/wafarm/Velocity/releases

@paulzzh
Copy link

paulzzh commented Jun 28, 2024

Incompatible with Ambassador 1.4.4

[10:51:32 ERROR]: [server connection] Paulzzh -> SU: exception encountered in com.velocitypowered.proxy.connection.backend.LoginSessionHandler@5eb9676e
io.netty.handler.codec.EncoderException: java.lang.NoSuchMethodError: 'com.velocitypowered.proxy.config.PlayerInfoForwarding com.velocitypowered.proxy.config
.VelocityConfiguration.getPlayerInfoForwardingMode()'
Caused by: java.lang.NoSuchMethodError: 'com.velocitypowered.proxy.config.PlayerInfoForwarding com.velocitypowered.proxy.config.VelocityConfiguration.getPlayerInfoForwardingMode()'
        at org.adde0109.ambassador.velocity.backend.FMLMarkerAdder.encode(FMLMarkerAdder.java:32) ~[?:?]
        at org.adde0109.ambassador.velocity.backend.FMLMarkerAdder.encode(FMLMarkerAdder.java:19) ~[?:?]
        at io.netty.handler.codec.MessageToMessageEncoder.write(MessageToMessageEncoder.java:90) ~[velocity-3.3.0-SNAPSHOT-400.jar:3.3.0-SNAPSHOT (git-bb3d3b07)]
        ... 26 more

@wafarm
Copy link
Author

wafarm commented Jun 29, 2024

Ambassador used getPlayerInfoForwardingMode, which is not part of velocity api and is renamed in this PR.

@powercasgamer
Copy link
Contributor

Ambassador used getPlayerInfoForwardingMode, which is not part of velocity api and is renamed in this PR.

Don’t really see how that’s relevant? As you’ve already stated it’s not part of the API and thus subject to breaking changes.

@wafarm
Copy link
Author

wafarm commented Jun 29, 2024

If a mod only uses com.velocitypowered:velocity-api as the dependency, it won't be affected. But Ambassador uses com.velocitypowered:velocity-proxy as well, and therefore it breaks due to the renamed method.

@powercasgamer
Copy link
Contributor

If a mod only uses com.velocitypowered:velocity-api as the dependency, it won't be affected. But Ambassador uses com.velocitypowered:velocity-proxy as well, and therefore it breaks due to the renamed method.

Yes, but I don’t really see how that’s relevant? Using internals is not supported

@wafarm
Copy link
Author

wafarm commented Jun 29, 2024

Yes, but I don’t really see how that’s relevant? Using internals is not supported

Yes, I'm just explaining why it's incompatible since he posted.

wafarm and others added 2 commits July 5, 2024 19:21
# Conflicts:
#	proxy/src/main/java/com/velocitypowered/proxy/connection/backend/LoginSessionHandler.java
@Rattlyy
Copy link

Rattlyy commented Jul 19, 2024

bump?

@Timongcraft
Copy link
Contributor

Shouldn't this be paired with a pull request to update the docs?

@Nacioszeczek
Copy link
Member

Shouldn't this be paired with a pull request to update the docs?

Yes, but the docs might as well be changed after this is merged. You're free to open a PR if you want to though.

Timongcraft added a commit to Timongcraft/papermc-docs that referenced this pull request Jul 22, 2024
@liorsl
Copy link

liorsl commented Jul 23, 2024

Just a note here: should we consider also allowing to have forwarding secret configured for each server / each connection?

@wafarm
Copy link
Author

wafarm commented Jul 24, 2024

Just a note here: should we consider also allowing to have forwarding secret configured for each server / each connection?

It would be possible, but I wonder what the use case is, i.e. why do you need to have different forwarding secrets for different servers?

@liorsl
Copy link

liorsl commented Jul 24, 2024

Just a note here: should we consider also allowing to have forwarding secret configured for each server / each connection?

It would be possible, but I wonder what the use case is, i.e. why do you need to have different forwarding secrets for different servers?

It might not be the most common one but I think its there, it will mainly make the secrets harder to get because there are multiple ones, so at the end it improves security

@wafarm
Copy link
Author

wafarm commented Jul 24, 2024

It might not be the most common one but I think its there, it will mainly make the secrets harder to get because there are multiple ones, so at the end it improves security

I agree but I think configuring the firewall to reject direct WAN connections to your proxied servers may be a simpler and safer solution. I will put this on hold for now.

@Smart123s
Copy link

This PR breaks LimboAPI at https://github.com/Elytrium/LimboAPI/blob/e632cff20bd80f78b75a6634b7016464b650938a/plugin/src/main/java/net/elytrium/limboapi/injection/login/LoginListener.java#L223.

I have fixed it for myself with patch 0f4bef9.

@Smart123s
Copy link

Smart123s commented Nov 9, 2024

Also, if player-info-forwarding-mode is set to MODERN, then it will kick players saying that the client must be on 1.13 or above, even if the server is on 1.8 (with BUNGEEGUARD forwarding) for example.

@theminecoder
Copy link
Contributor

I think you should move the storage of the forwarding mode override to ServerInfo. Having it being in the config class means that it ends up being really annoying to use this from the api (which is needed for dynamic server registrations)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Playerdata forwarding
10 participants