Skip to content

Commit

Permalink
Adjust HAProxy's existance to log for console masters (#11433)
Browse files Browse the repository at this point in the history
  • Loading branch information
Codixer authored Sep 27, 2024
1 parent 20ec622 commit 627cc64
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 9 deletions.
17 changes: 15 additions & 2 deletions patches/server/0701-Add-support-for-Proxy-Protocol.patch
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,23 @@ index 688e901b75e95941e0101cc7d0c4effa7993cf3f..9de7a09c5f1b23754a2823978fa3ff21
implementation("org.apache.logging.log4j:log4j-iostreams:2.22.1") // Paper - remove exclusion
implementation("org.ow2.asm:asm-commons:9.7")
diff --git a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java
index c63c194c44646e6bc1a59426552787011fc2ced5..96355e1da8feb6687ea0069dda4a82fcd7e25e8a 100644
index c63c194c44646e6bc1a59426552787011fc2ced5..c62df32af11636ad408b584fcc590590ce4fb0d0 100644
--- a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java
+++ b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java
@@ -123,6 +123,29 @@ public class ServerConnectionListener {
@@ -104,6 +104,12 @@ public class ServerConnectionListener {
ServerConnectionListener.LOGGER.info("Using default channel type");
}

+ // Paper start - Warn people with console access that HAProxy is in use.
+ if (io.papermc.paper.configuration.GlobalConfiguration.get().proxies.proxyProtocol) {
+ ServerConnectionListener.LOGGER.warn("Using HAProxy, please ensure the server port is adequately firewalled.");
+ }
+ // Paper end - Warn people with console access that HAProxy is in use.
+
this.channels.add(((ServerBootstrap) ((ServerBootstrap) (new ServerBootstrap()).channel(oclass)).childHandler(new ChannelInitializer<Channel>() {
protected void initChannel(Channel channel) {
try {
@@ -123,6 +129,29 @@ public class ServerConnectionListener {
Connection object = j > 0 ? new RateKickingConnection(j) : new Connection(PacketFlow.SERVERBOUND); // CraftBukkit - decompile error

//ServerConnectionListener.this.connections.add(object); // Paper
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ index ea16dfa718b526d6520d7fcfc21d28f972f1f2bf..4b9da6e2140b14f1e56056f5e9e94b21
public Connection(PacketFlow side) {
this.receiving = side;
diff --git a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java
index 96355e1da8feb6687ea0069dda4a82fcd7e25e8a..1f696644b958538e9f5d568a2e4bba69d74a191e 100644
index c62df32af11636ad408b584fcc590590ce4fb0d0..baed0bb80d44973f9323bbe536551182979caff2 100644
--- a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java
+++ b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java
@@ -138,6 +138,13 @@ public class ServerConnectionListener {
@@ -144,6 +144,13 @@ public class ServerConnectionListener {

Connection connection = (Connection) channel.pipeline().get("packet_handler");
connection.address = socketaddr;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ index 82fc12ffbd1585b4a8d09a025914830af77b0f8d..c9d283b7fc9ede79dc6cbc39dfc9e7ae
+ // Paper end
}
diff --git a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java
index 1f696644b958538e9f5d568a2e4bba69d74a191e..2929d9a2efa9669781b6773161db7c5f968c2544 100644
index baed0bb80d44973f9323bbe536551182979caff2..4abe4f75956e4c16f8b4e0b2f77ad64d7914aa65 100644
--- a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java
+++ b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java
@@ -63,10 +63,12 @@ public class ServerConnectionListener {
Expand All @@ -385,7 +385,7 @@ index 1f696644b958538e9f5d568a2e4bba69d74a191e..2929d9a2efa9669781b6773161db7c5f
}
}
// Paper end - prevent blocking on adding a new connection while the server is ticking
@@ -112,6 +114,7 @@ public class ServerConnectionListener {
@@ -118,6 +120,7 @@ public class ServerConnectionListener {
;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -336,12 +336,12 @@ index 7dc7aeb1d94d26cf54bd4e4ab13972a3a60c1f98..90a2c61c42cba7e38f167eccdd7a951a
this.channel.pipeline().fireUserEventTriggered(io.papermc.paper.network.ConnectionEvent.COMPRESSION_THRESHOLD_SET); // Paper - Add Channel initialization listeners
} else {
diff --git a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java
index 2929d9a2efa9669781b6773161db7c5f968c2544..8aff5129f85ab5729b3da2e465871be62d15bdf2 100644
index 4abe4f75956e4c16f8b4e0b2f77ad64d7914aa65..3a9e25b436f366fffe08c3b0c1fce11ed42ee646 100644
--- a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java
+++ b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java
@@ -106,6 +106,11 @@ public class ServerConnectionListener {
ServerConnectionListener.LOGGER.info("Using default channel type");
@@ -112,6 +112,11 @@ public class ServerConnectionListener {
}
// Paper end - Warn people with console access that HAProxy is in use.

+ // Paper start - Use Velocity cipher
+ ServerConnectionListener.LOGGER.info("Paper: Using " + com.velocitypowered.natives.util.Natives.compress.getLoadedVariant() + " compression from Velocity.");
Expand Down

0 comments on commit 627cc64

Please sign in to comment.