mirror of
https://gitee.com/wujiawei1207537021/wu-lazy-cloud-network.git
synced 2026-02-04 15:05:54 +08:00
Compare commits
2 Commits
7c640816aa
...
32eaace9c1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
32eaace9c1 | ||
|
|
21136284c7 |
@@ -63,6 +63,8 @@ public class NettySocksServerProxyClientTransferHandler extends SimpleChannelInb
|
||||
|
||||
@Override
|
||||
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
|
||||
cause.printStackTrace();
|
||||
log.error(cause.getMessage());
|
||||
super.exceptionCaught(ctx, cause);
|
||||
}
|
||||
}
|
||||
@@ -128,6 +128,14 @@ public class NettySocksServerProxyClientRealSocket {
|
||||
Channel transferChannel = futureListener.channel();
|
||||
if (futureListener.isSuccess()) {
|
||||
log.info("服务端代理客户端socks,客户端连接服务端传输通道成功");
|
||||
// 绑定下一个通道
|
||||
ChannelAttributeKeyUtils.buildNextChannel(transferChannel, realChannel);
|
||||
ChannelAttributeKeyUtils.buildNextChannel(realChannel, transferChannel);
|
||||
|
||||
// 绑定客户端真实通信通道
|
||||
ChannelAttributeKeyUtils.buildVisitorId(transferChannel, visitorId);
|
||||
ChannelAttributeKeyUtils.buildClientId(transferChannel, clientId);
|
||||
// 开始读取数据
|
||||
realChannel.config().setOption(ChannelOption.AUTO_READ, true);
|
||||
// 通知服务端访客连接成功
|
||||
NettyProxyMsg nettyProxyMsg = new NettyProxyMsg();
|
||||
@@ -137,15 +145,6 @@ public class NettySocksServerProxyClientRealSocket {
|
||||
nettyProxyMsg.setTargetPort(targetPort);
|
||||
nettyProxyMsg.setType(ProxyMessageType.SOCKS_REPORT_SERVER_PROXY_CLIENT_CONNECTION_SUCCESS_);
|
||||
transferChannel.writeAndFlush(nettyProxyMsg);
|
||||
|
||||
ChannelAttributeKeyUtils.buildNextChannel(transferChannel, realChannel);
|
||||
ChannelAttributeKeyUtils.buildNextChannel(realChannel, transferChannel);
|
||||
|
||||
// 绑定客户端真实通信通道
|
||||
ChannelAttributeKeyUtils.buildVisitorId(transferChannel, visitorId);
|
||||
ChannelAttributeKeyUtils.buildClientId(transferChannel, clientId);
|
||||
|
||||
|
||||
} else {
|
||||
log.info("无法连接到服务端....");
|
||||
eventLoopGroup.schedule(() -> {
|
||||
|
||||
Reference in New Issue
Block a user