mirror of
https://gitee.com/wujiawei1207537021/wu-lazy-cloud-network.git
synced 2025-06-06 21:37:56 +08:00
【fix】init route ip
This commit is contained in:
parent
32a641ce99
commit
7f9cebec8a
@ -6,12 +6,10 @@ import io.netty.handler.codec.socksx.v5.Socks5AddressType;
|
|||||||
import io.netty.handler.codec.socksx.v5.Socks5CommandRequestDecoder;
|
import io.netty.handler.codec.socksx.v5.Socks5CommandRequestDecoder;
|
||||||
import io.netty.handler.codec.socksx.v5.Socks5CommandStatus;
|
import io.netty.handler.codec.socksx.v5.Socks5CommandStatus;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.framework.lazy.cloud.network.heartbeat.client.netty.proxy.socks.handler.NettyClientProxyClientVisitorInboundHandler;
|
import org.framework.lazy.cloud.network.heartbeat.client.netty.proxy.socks.handler.NettySocksClientProxyClientVisitorInboundHandler;
|
||||||
import org.framework.lazy.cloud.network.heartbeat.client.netty.proxy.socks.handler.NettyClientProxyServerVisitorInboundHandler;
|
|
||||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyChannelContext;
|
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyChannelContext;
|
||||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyProxyMsg;
|
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyProxyMsg;
|
||||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.proxy.socks.client.AbstractHandleSocksDistributeClientProxyClientConnectionTransferSuccessTypeAdvanced;
|
import org.framework.lazy.cloud.network.heartbeat.common.advanced.proxy.socks.client.AbstractHandleSocksDistributeClientProxyClientConnectionTransferSuccessTypeAdvanced;
|
||||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.proxy.socks.client.AbstractHandleSocksDistributeClientProxyServerConnectionTransferSuccessTypeAdvanced;
|
|
||||||
import org.framework.lazy.cloud.network.heartbeat.common.decoder.TransferDecoder;
|
import org.framework.lazy.cloud.network.heartbeat.common.decoder.TransferDecoder;
|
||||||
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
|
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
|
||||||
import org.framework.lazy.cloud.network.heartbeat.protocol.handler.NettySocks5CommandRequestHandler;
|
import org.framework.lazy.cloud.network.heartbeat.protocol.handler.NettySocks5CommandRequestHandler;
|
||||||
@ -45,7 +43,7 @@ public class ClientHandleDistributeSocksClientProxyClientConnectionTransferSucce
|
|||||||
// TODO bug fix
|
// TODO bug fix
|
||||||
nextChannel.pipeline().addLast(new TransferDecoder(Integer.MAX_VALUE, 1024 * 1024*10));
|
nextChannel.pipeline().addLast(new TransferDecoder(Integer.MAX_VALUE, 1024 * 1024*10));
|
||||||
// 请求数据开始上报
|
// 请求数据开始上报
|
||||||
nextChannel.pipeline().addLast(new NettyClientProxyClientVisitorInboundHandler());
|
nextChannel.pipeline().addLast(new NettySocksClientProxyClientVisitorInboundHandler());
|
||||||
DefaultSocks5CommandResponse commandResponse =
|
DefaultSocks5CommandResponse commandResponse =
|
||||||
new DefaultSocks5CommandResponse(Socks5CommandStatus.SUCCESS, socks5AddressType);
|
new DefaultSocks5CommandResponse(Socks5CommandStatus.SUCCESS, socks5AddressType);
|
||||||
nextChannel.writeAndFlush(commandResponse);
|
nextChannel.writeAndFlush(commandResponse);
|
||||||
|
@ -6,7 +6,7 @@ import io.netty.handler.codec.socksx.v5.Socks5AddressType;
|
|||||||
import io.netty.handler.codec.socksx.v5.Socks5CommandRequestDecoder;
|
import io.netty.handler.codec.socksx.v5.Socks5CommandRequestDecoder;
|
||||||
import io.netty.handler.codec.socksx.v5.Socks5CommandStatus;
|
import io.netty.handler.codec.socksx.v5.Socks5CommandStatus;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.framework.lazy.cloud.network.heartbeat.client.netty.proxy.socks.handler.NettyClientProxyServerVisitorInboundHandler;
|
import org.framework.lazy.cloud.network.heartbeat.client.netty.proxy.socks.handler.NettySocksClientProxyServerVisitorInboundHandler;
|
||||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyChannelContext;
|
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyChannelContext;
|
||||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyProxyMsg;
|
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyProxyMsg;
|
||||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.proxy.socks.client.AbstractHandleSocksDistributeClientProxyServerConnectionTransferSuccessTypeAdvanced;
|
import org.framework.lazy.cloud.network.heartbeat.common.advanced.proxy.socks.client.AbstractHandleSocksDistributeClientProxyServerConnectionTransferSuccessTypeAdvanced;
|
||||||
@ -43,7 +43,7 @@ public class ClientHandleDistributeSocksClientProxyServerConnectionTransferSucce
|
|||||||
// TODO bug fix
|
// TODO bug fix
|
||||||
nextChannel.pipeline().addLast(new TransferDecoder(Integer.MAX_VALUE, 1024 * 1024*10));
|
nextChannel.pipeline().addLast(new TransferDecoder(Integer.MAX_VALUE, 1024 * 1024*10));
|
||||||
// 请求数据开始上报
|
// 请求数据开始上报
|
||||||
nextChannel.pipeline().addLast(new NettyClientProxyServerVisitorInboundHandler(transferChannel));
|
nextChannel.pipeline().addLast(new NettySocksClientProxyServerVisitorInboundHandler(transferChannel));
|
||||||
DefaultSocks5CommandResponse commandResponse =
|
DefaultSocks5CommandResponse commandResponse =
|
||||||
new DefaultSocks5CommandResponse(Socks5CommandStatus.SUCCESS, socks5AddressType);
|
new DefaultSocks5CommandResponse(Socks5CommandStatus.SUCCESS, socks5AddressType);
|
||||||
nextChannel.writeAndFlush(commandResponse);
|
nextChannel.writeAndFlush(commandResponse);
|
||||||
|
@ -15,7 +15,7 @@ import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeK
|
|||||||
|
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class NettyClientProxyClientVisitorInboundHandler extends SimpleChannelInboundHandler<NettyByteBuf> {
|
public class NettySocksClientProxyClientVisitorInboundHandler extends SimpleChannelInboundHandler<NettyByteBuf> {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -66,7 +66,7 @@ public class NettyClientProxyClientVisitorInboundHandler extends SimpleChannelIn
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
|
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
|
||||||
log.error("【socks】NettyClientProxyServerVisitorInboundHandler exception", cause);
|
log.error("【socks】NettySocksClientProxyServerVisitorInboundHandler exception", cause);
|
||||||
ctx.close();
|
ctx.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -12,11 +12,11 @@ import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeK
|
|||||||
|
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class NettyClientProxyServerVisitorInboundHandler extends SimpleChannelInboundHandler<NettyByteBuf> {
|
public class NettySocksClientProxyServerVisitorInboundHandler extends SimpleChannelInboundHandler<NettyByteBuf> {
|
||||||
|
|
||||||
private final Channel transferChannel;
|
private final Channel transferChannel;
|
||||||
|
|
||||||
public NettyClientProxyServerVisitorInboundHandler(Channel transferChannel) {
|
public NettySocksClientProxyServerVisitorInboundHandler(Channel transferChannel) {
|
||||||
this.transferChannel = transferChannel;
|
this.transferChannel = transferChannel;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,7 +67,7 @@ public class NettyClientProxyServerVisitorInboundHandler extends SimpleChannelIn
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
|
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
|
||||||
log.error("【socks】NettyClientProxyServerVisitorInboundHandler exception", cause);
|
log.error("【socks】NettySocksClientProxyServerVisitorInboundHandler exception", cause);
|
||||||
ctx.close();
|
ctx.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -15,7 +15,7 @@ import org.framework.lazy.cloud.network.heartbeat.common.decoder.TransferDecoder
|
|||||||
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
|
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
|
||||||
import org.framework.lazy.cloud.network.heartbeat.protocol.handler.NettySocks5CommandRequestHandler;
|
import org.framework.lazy.cloud.network.heartbeat.protocol.handler.NettySocks5CommandRequestHandler;
|
||||||
import org.framework.lazy.cloud.network.heartbeat.server.netty.proxy.socks.filter.NettySocksServerProxyClientVisitorFilter;
|
import org.framework.lazy.cloud.network.heartbeat.server.netty.proxy.socks.filter.NettySocksServerProxyClientVisitorFilter;
|
||||||
import org.framework.lazy.cloud.network.heartbeat.server.netty.proxy.socks.handler.NettyServerProxyClientVisitorInboundHandler;
|
import org.framework.lazy.cloud.network.heartbeat.server.netty.proxy.socks.handler.NettySocksServerProxyClientVisitorInboundHandler;
|
||||||
import org.framework.lazy.cloud.network.heartbeat.server.netty.proxy.socks.handler.NettySocksClientProxyServerRealHandler;
|
import org.framework.lazy.cloud.network.heartbeat.server.netty.proxy.socks.handler.NettySocksClientProxyServerRealHandler;
|
||||||
import org.springframework.beans.factory.config.BeanDefinition;
|
import org.springframework.beans.factory.config.BeanDefinition;
|
||||||
import org.springframework.context.annotation.Role;
|
import org.springframework.context.annotation.Role;
|
||||||
@ -56,7 +56,7 @@ public class ServerHandleSocksReportServerProxyClientConnectionSuccessTypeAdvanc
|
|||||||
// TODO bug fix
|
// TODO bug fix
|
||||||
nextChannel.pipeline().addLast(new TransferDecoder(Integer.MAX_VALUE, 1024 * 1024*10));
|
nextChannel.pipeline().addLast(new TransferDecoder(Integer.MAX_VALUE, 1024 * 1024*10));
|
||||||
// 请求数据开始上报
|
// 请求数据开始上报
|
||||||
nextChannel.pipeline().addLast(new NettyServerProxyClientVisitorInboundHandler());
|
nextChannel.pipeline().addLast(new NettySocksServerProxyClientVisitorInboundHandler());
|
||||||
DefaultSocks5CommandResponse commandResponse =
|
DefaultSocks5CommandResponse commandResponse =
|
||||||
new DefaultSocks5CommandResponse(Socks5CommandStatus.SUCCESS, socks5AddressType);
|
new DefaultSocks5CommandResponse(Socks5CommandStatus.SUCCESS, socks5AddressType);
|
||||||
nextChannel.writeAndFlush(commandResponse);
|
nextChannel.writeAndFlush(commandResponse);
|
||||||
|
@ -15,7 +15,7 @@ import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeK
|
|||||||
|
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class NettyServerProxyClientVisitorInboundHandler extends SimpleChannelInboundHandler<NettyByteBuf> {
|
public class NettySocksServerProxyClientVisitorInboundHandler extends SimpleChannelInboundHandler<NettyByteBuf> {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -36,7 +36,7 @@ public class NettyServerProxyClientVisitorInboundHandler extends SimpleChannelIn
|
|||||||
Channel nextChannel = ChannelAttributeKeyUtils.getNextChannel(channel);
|
Channel nextChannel = ChannelAttributeKeyUtils.getNextChannel(channel);
|
||||||
|
|
||||||
if (nextChannel.isActive()) {
|
if (nextChannel.isActive()) {
|
||||||
// 上报数据到服务端
|
// 下发数据到服务端
|
||||||
NettyProxyMsg nettyProxyMsg = new NettyProxyMsg();
|
NettyProxyMsg nettyProxyMsg = new NettyProxyMsg();
|
||||||
nettyProxyMsg.setType(ProxyMessageType.SOCKS_DISTRIBUTE_SERVER_PROXY_CLIENT_TRANSFER_REQUEST_);
|
nettyProxyMsg.setType(ProxyMessageType.SOCKS_DISTRIBUTE_SERVER_PROXY_CLIENT_TRANSFER_REQUEST_);
|
||||||
|
|
||||||
@ -62,11 +62,12 @@ public class NettyServerProxyClientVisitorInboundHandler extends SimpleChannelIn
|
|||||||
ctx.channel().writeAndFlush(Unpooled.EMPTY_BUFFER).addListener(ChannelFutureListener.CLOSE);
|
ctx.channel().writeAndFlush(Unpooled.EMPTY_BUFFER).addListener(ChannelFutureListener.CLOSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
super.channelInactive(ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
|
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
|
||||||
log.error("【socks】NettyServerProxyClientVisitorInboundHandler exception", cause);
|
log.error("【socks】NettySocksServerProxyClientVisitorInboundHandler exception", cause);
|
||||||
ctx.close();
|
ctx.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user