3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-12-26 16:12:46 +01:00

Fix/proxy protocol missing message (#3898)

* Show proxy protocol ip for debug message

* Make sure that first message that contains proxy protocol also gets sent. This caused issues with serverlists and console players
Dieser Commit ist enthalten in:
DeveloperDragon 2023-06-20 15:28:31 +02:00 committet von GitHub
Ursprung 811aba3339
Commit 50d3945477
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23
2 geänderte Dateien mit 12 neuen und 3 gelöschten Zeilen

Datei anzeigen

@ -187,7 +187,16 @@ public final class GeyserServer {
public BedrockPong onQuery(InetSocketAddress inetSocketAddress) { public BedrockPong onQuery(InetSocketAddress inetSocketAddress) {
if (geyser.getConfig().isDebugMode() && PRINT_DEBUG_PINGS) { if (geyser.getConfig().isDebugMode() && PRINT_DEBUG_PINGS) {
String ip = geyser.getConfig().isLogPlayerIpAddresses() ? inetSocketAddress.toString() : "<IP address withheld>"; String ip;
if (geyser.getConfig().isLogPlayerIpAddresses()) {
if (geyser.getConfig().getBedrock().isEnableProxyProtocol()) {
ip = this.proxiedAddresses.getOrDefault(inetSocketAddress, inetSocketAddress).toString();
} else {
ip = inetSocketAddress.toString();
}
} else {
ip = "<IP address withheld>";
}
geyser.getLogger().debug(GeyserLocale.getLocaleStringLog("geyser.network.pinged", ip)); geyser.getLogger().debug(GeyserLocale.getLocaleStringLog("geyser.network.pinged", ip));
} }

Datei anzeigen

@ -73,10 +73,10 @@ public class ProxyServerHandler extends SimpleChannelInboundHandler<DatagramPack
presentAddress = new InetSocketAddress(decoded.sourceAddress(), decoded.sourcePort()); presentAddress = new InetSocketAddress(decoded.sourceAddress(), decoded.sourcePort());
log.debug("Got PROXY header: (from {}) {}", packet.sender(), presentAddress); log.debug("Got PROXY header: (from {}) {}", packet.sender(), presentAddress);
GeyserImpl.getInstance().getGeyserServer().getProxiedAddresses().put(packet.sender(), presentAddress); GeyserImpl.getInstance().getGeyserServer().getProxiedAddresses().put(packet.sender(), presentAddress);
return; } else {
log.trace("Reusing PROXY header: (from {}) {}", packet.sender(), presentAddress);
} }
log.trace("Reusing PROXY header: (from {}) {}", packet.sender(), presentAddress);
ctx.fireChannelRead(packet.retain()); ctx.fireChannelRead(packet.retain());
} }
} }