13
0
geforkt von Mirrors/Paper

Check HAProxyMessage type is PROXY (#7864)

Dieser Commit ist enthalten in:
PureGero 2022-06-02 07:58:22 +10:00
Ursprung 62f8950e86
Commit a063840a0e

Datei anzeigen

@ -46,6 +46,7 @@ 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) {
+ if (message.command() == io.netty.handler.codec.haproxy.HAProxyCommand.PROXY) {
+ String realaddress = message.sourceAddress(); + String realaddress = message.sourceAddress();
+ int realport = message.sourcePort(); + int realport = message.sourcePort();
+ +
@ -53,6 +54,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ +
+ 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);
+ } + }