mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-16 14:33:09 +01:00
Check HAProxyMessage type is PROXY (#7864)
This commit is contained in:
parent
62f8950e86
commit
a063840a0e
1 changed files with 7 additions and 5 deletions
|
@ -46,13 +46,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ @Override
|
+ @Override
|
||||||
+ public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
|
+ public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
|
||||||
+ if (msg instanceof io.netty.handler.codec.haproxy.HAProxyMessage message) {
|
+ if (msg instanceof io.netty.handler.codec.haproxy.HAProxyMessage message) {
|
||||||
+ String realaddress = message.sourceAddress();
|
+ if (message.command() == io.netty.handler.codec.haproxy.HAProxyCommand.PROXY) {
|
||||||
+ int realport = message.sourcePort();
|
+ String realaddress = message.sourceAddress();
|
||||||
|
+ int realport = message.sourcePort();
|
||||||
+
|
+
|
||||||
+ SocketAddress socketaddr = new java.net.InetSocketAddress(realaddress, realport);
|
+ SocketAddress socketaddr = new java.net.InetSocketAddress(realaddress, realport);
|
||||||
+
|
+
|
||||||
+ Connection connection = (Connection) channel.pipeline().get("packet_handler");
|
+ Connection connection = (Connection) channel.pipeline().get("packet_handler");
|
||||||
+ connection.address = socketaddr;
|
+ connection.address = socketaddr;
|
||||||
|
+ }
|
||||||
+ } else {
|
+ } else {
|
||||||
+ super.channelRead(ctx, msg);
|
+ super.channelRead(ctx, msg);
|
||||||
+ }
|
+ }
|
||||||
|
|
Loading…
Reference in a new issue