Move haproxy handling to cloudburst network#6390
Conversation
904d0c6 to
9bebd25
Compare
There was a problem hiding this comment.
Pull request overview
This PR aims to move HAProxy/forwarded-address handling out of Geyser’s Netty pipeline and into the Cloudburst networking layer by removing Geyser’s custom proxy-protocol decoder/peer/address-mapping code and related rate-limit adjustments.
Changes:
- Removes Geyser’s HAProxy proxy-protocol decoding pipeline and proxied-address tracking.
- Refactors upstream address access away from
GeyserBedrockPeerand removes Waterdog/HAProxy address propagation paths (currently with TODO stubs). - Updates build configuration to use a local Cloudburst RakNet transport JAR and enables
mavenLocal()for build-logic resolution.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| core/src/main/java/org/geysermc/geyser/util/LoginEncryptionUtils.java | Changes WaterdogPE forwarding to call a now-stubbed upstream address setter (port currently hardcoded to 0). |
| core/src/main/java/org/geysermc/geyser/session/UpstreamSession.java | Switches address source to session.getSocketAddress() and leaves setInetAddress unimplemented (TODO). |
| core/src/main/java/org/geysermc/geyser/session/SessionManager.java | Removes per-IP connection limiting helpers but still maintains per-address counters. |
| core/src/main/java/org/geysermc/geyser/network/UpstreamPacketHandler.java | Removes the max-connections-per-address login gate. |
| core/src/main/java/org/geysermc/geyser/network/netty/proxy/ProxyServerHandler.java | Deleted (previous HAProxy PROXY header handler). |
| core/src/main/java/org/geysermc/geyser/network/netty/proxy/ProxyProtocolDecoder.java | Deleted (previous HAProxy PROXY header decoder). |
| core/src/main/java/org/geysermc/geyser/network/netty/handler/RakGeyserRateLimiter.java | Deleted (previous per-IP scaling rate limiter). |
| core/src/main/java/org/geysermc/geyser/network/netty/GeyserServer.java | Removes proxied-address map usage, disables proxy handler insertion (TODO), and changes rate limiter behavior/event fields. |
| core/src/main/java/org/geysermc/geyser/network/GeyserServerInitializer.java | Removes custom peer creation and proxied-address injection. |
| core/src/main/java/org/geysermc/geyser/network/GeyserBedrockPeer.java | Deleted (previous peer wrapper to override “real” vs proxied address). |
| core/build.gradle.kts | Replaces RakNet dependency with an absolute local JAR path. |
| build-logic/build.gradle.kts | Adds mavenLocal() to build-logic repositories. |
Comments suppressed due to low confidence (1)
core/build.gradle.kts:56
- core/build.gradle.kts now depends on a local absolute-path JAR under /home/valaphee/... which will not exist in CI or for other contributors, breaking the build and releases. Replace this with a published Maven coordinate (snapshot repo if needed) or a composite build/includedBuild, and keep the dependency in the version catalog instead of a developer-local file path.
exclude("net.raphimc", "MinecraftAuth")
}
implementation(files("/home/valaphee/Documents/CloudburstMC-Network/transport-raknet/build/libs/transport-raknet-1.0.0.CR3-SNAPSHOT.jar"))
// Network dependencies we are updating ourselves
api(libs.netty.handler)
implementation(libs.netty.codec.haproxy)
api(libs.netty.transport.native.epoll) { artifact { classifier = "linux-x86_64" } }
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
f963ccf to
94fc29a
Compare
94fc29a to
3abfe29
Compare
4704039 to
4268c53
Compare
4268c53 to
e013151
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
Comments suppressed due to low confidence (1)
core/src/main/java/org/geysermc/geyser/network/netty/GeyserServer.java:231
rakRateLimitingDisabled ? null : new DefaultRakServerThrottle(...)passesnullintoServerBootstrap.option(...). NettyChannelOptionvalues are generally validated as non-null, so this can throw at bootstrap/bind time. Prefer conditionally omitting theRAK_THROTTLEoption when rate limiting is disabled (or supplying an explicit no-op throttle implementation if the RakNet API provides one).
.option(RakChannelOption.RAK_PACKET_LIMIT, rakRateLimitingDisabled ? 0 : rakPacketLimit)
.option(RakChannelOption.RAK_GLOBAL_PACKET_LIMIT, rakGlobalPacketLimit)
.option(RakChannelOption.RAK_SERVER_COOKIE_MODE, rakSendCookie ? RakServerCookieMode.ACTIVE : RakServerCookieMode.INVALID)
.option(RakChannelOption.RAK_PROXY_PROTOCOL, this.geyser.config().advanced().bedrock().useHaproxyProtocol())
.option(RakChannelOption.RAK_THROTTLE, rakRateLimitingDisabled ? null : new DefaultRakServerThrottle(maxConnectionsPerAddress, 4_000, 3))
.childHandler(serverInitializer);
|
tested again with TCPShield and ProxyPass with PROXY Protocol Header, worked as expected |
After GeyserMC#6390 moved HAProxy handling into cloudburst-netty, RakServerChannel#getClientAddress can return null when no PROXY header has been cached for a sender. This happens on the first packet from a new sender, an expired session-cache entry, a malformed header, or a PROXY v2 LOCAL frame (which the upstream RakProxyServerHandler currently mishandles by passing null source addresses into InetSocketAddress). Geyser passed that null straight through to onConnectionRequest, where clientAddress.toString() threw NullPointerException and the connection was dropped with a noisy stack trace, leaving operators without a useful diagnostic. This change: - Adds an early null check in onConnectionRequest that rejects the connection cleanly and logs a WARN per occurrence when use-haproxy-protocol is enabled, pointing operators at the most likely upstream-proxy misconfiguration. RakNet's existing per-IP and global packet rate limiting (RAK_PACKET_LIMIT, DefaultRakServerThrottle) caps the realistic log rate. - Drops pings silently in RakPingHandler when no client address is resolved, so the server visibly appears offline instead of leaking the proxy's address to ping passthrough.
See CloudburstMC/Network#71