5454import org .geysermc .geyser .network .GameProtocol ;
5555import org .geysermc .geyser .network .GeyserServerInitializer ;
5656import org .geysermc .geyser .network .netty .handler .RakConnectionRequestHandler ;
57- import org .geysermc .geyser .network .netty .handler .RakGeyserRateLimiter ;
5857import org .geysermc .geyser .network .netty .handler .RakPingHandler ;
59- import org .geysermc .geyser .network .netty .proxy .ProxyServerHandler ;
6058import org .geysermc .geyser .ping .GeyserPingInfo ;
6159import org .geysermc .geyser .ping .IGeyserPingPassthrough ;
6260import org .geysermc .geyser .skin .SkinProvider ;
@@ -107,8 +105,6 @@ public final class GeyserServer {
107105 private final ServerBootstrap bootstrap ;
108106 private EventLoopGroup playerGroup ;
109107
110- @ Getter
111- private final ExpiringMap <InetSocketAddress , InetSocketAddress > proxiedAddresses ;
112108 private int listenCount ;
113109
114110 private ChannelFuture [] bootstrapFutures ;
@@ -136,14 +132,6 @@ public GeyserServer(GeyserImpl geyser, int threadCount) {
136132 this .listenCount = 1 ;
137133 }
138134
139- if (this .geyser .config ().advanced ().bedrock ().useHaproxyProtocol () || this .geyser .config ().advanced ().bedrock ().useWaterdogpeForwarding ()) {
140- this .proxiedAddresses = ExpiringMap .builder ()
141- .expiration (30 + 1 , TimeUnit .MINUTES )
142- .expirationPolicy (ExpirationPolicy .ACCESSED ).build ();
143- } else {
144- this .proxiedAddresses = null ;
145- }
146-
147135 this .broadcastPort = geyser .config ().advanced ().bedrock ().broadcastPort ();
148136 }
149137
@@ -171,19 +159,9 @@ private void modifyHandlers(ChannelFuture future) {
171159 .addFirst (RakConnectionRequestHandler .NAME , new RakConnectionRequestHandler (this ))
172160 .addAfter (RakServerOfflineHandler .NAME , RakPingHandler .NAME , new RakPingHandler (this ));
173161
174- // Add proxy handler
175- boolean isProxyProtocol = this .geyser .config ().advanced ().bedrock ().useHaproxyProtocol ();
176- if (isProxyProtocol ) {
177- channel .pipeline ().addFirst ("proxy-protocol-decoder" , new ProxyServerHandler ());
178- }
179-
180- boolean isWhitelistedProxyProtocol = isProxyProtocol && !this .geyser .config ().advanced ().bedrock ().haproxyProtocolWhitelistedIps ().isEmpty ();
181- if (Boolean .parseBoolean (System .getProperty ("Geyser.RakRateLimitingDisabled" , "false" )) || isWhitelistedProxyProtocol ) {
162+ if (Boolean .parseBoolean (System .getProperty ("Geyser.RakRateLimitingDisabled" , "false" ))) {
182163 // We would already block any non-whitelisted IP addresses in onConnectionRequest so we can remove the rate limiter
183164 channel .pipeline ().remove (RakServerRateLimiter .NAME );
184- } else {
185- // Use our own rate limiter to allow multiple players from the same IP
186- channel .pipeline ().replace (RakServerRateLimiter .NAME , RakGeyserRateLimiter .NAME , new RakGeyserRateLimiter (channel ));
187165 }
188166 });
189167 }
@@ -248,6 +226,7 @@ private ServerBootstrap createBootstrap() {
248226 .option (RakChannelOption .RAK_PACKET_LIMIT , rakPacketLimit )
249227 .option (RakChannelOption .RAK_GLOBAL_PACKET_LIMIT , rakGlobalPacketLimit )
250228 .option (RakChannelOption .RAK_SERVER_COOKIE_MODE , rakSendCookie ? RakServerCookieMode .ACTIVE : RakServerCookieMode .INVALID )
229+ .option (RakChannelOption .PROXY_PROTOCOL , this .geyser .config ().advanced ().bedrock ().useHaproxyProtocol ())
251230 .childHandler (serverInitializer );
252231 }
253232
@@ -268,20 +247,11 @@ public boolean onConnectionRequest(InetSocketAddress inetSocketAddress) {
268247 }
269248 }
270249
271- String ip ;
272- if (geyser .config ().logPlayerIpAddresses ()) {
273- if (this .proxiedAddresses != null ) {
274- ip = this .proxiedAddresses .getOrDefault (inetSocketAddress , inetSocketAddress ).toString ();
275- } else {
276- ip = inetSocketAddress .toString ();
277- }
278- } else {
279- ip = "<IP address withheld>" ;
280- }
250+ String ip = geyser .config ().logPlayerIpAddresses () ? inetSocketAddress .toString () : "<IP address withheld>" ;
281251
282252 ConnectionRequestEvent requestEvent = new ConnectionRequestEvent (
283- inetSocketAddress ,
284- this . proxiedAddresses != null ? this . proxiedAddresses . get ( inetSocketAddress ) : null
253+ inetSocketAddress ,
254+ null // TODO
285255 );
286256 geyser .eventBus ().fire (requestEvent );
287257 if (requestEvent .isCancelled ()) {
@@ -297,16 +267,7 @@ public boolean onConnectionRequest(InetSocketAddress inetSocketAddress) {
297267
298268 public BedrockPong onQuery (Channel channel , InetSocketAddress inetSocketAddress ) {
299269 if (geyser .config ().debugMode () && PRINT_DEBUG_PINGS ) {
300- String ip ;
301- if (geyser .config ().logPlayerIpAddresses ()) {
302- if (this .proxiedAddresses != null ) {
303- ip = this .proxiedAddresses .getOrDefault (inetSocketAddress , inetSocketAddress ).toString ();
304- } else {
305- ip = inetSocketAddress .toString ();
306- }
307- } else {
308- ip = "<IP address withheld>" ;
309- }
270+ String ip = geyser .config ().logPlayerIpAddresses () ? inetSocketAddress .toString () : "<IP address withheld>" ;
310271 geyser .getLogger ().debug (GeyserLocale .getLocaleStringLog ("geyser.network.pinged" , ip ));
311272 }
312273
0 commit comments