【fix】log

This commit is contained in:
wujiawei 2024-09-21 02:22:18 +08:00
parent 26b72fc540
commit 647b1b5f4b
13 changed files with 146 additions and 44 deletions

View File

@ -2,19 +2,13 @@ package org.framework.lazy.cloud.network.heartbeat.client.netty.advanced;
import io.netty.channel.Channel; import io.netty.channel.Channel;
import io.netty.channel.ChannelOption;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.framework.lazy.cloud.network.heartbeat.client.config.NettyClientProperties; import org.framework.lazy.cloud.network.heartbeat.client.config.NettyClientProperties;
import org.framework.lazy.cloud.network.heartbeat.client.netty.handler.NettyClientPermeateServerVisitorHandler;
import org.framework.lazy.cloud.network.heartbeat.client.netty.socket.NettyClientPermeateClientRealSocket; import org.framework.lazy.cloud.network.heartbeat.client.netty.socket.NettyClientPermeateClientRealSocket;
import org.framework.lazy.cloud.network.heartbeat.client.netty.socket.NettyClientTransferServerSocket;
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg; import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.NettyRealIdContext;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.HandleChannelTypeAdvanced; import org.framework.lazy.cloud.network.heartbeat.common.advanced.HandleChannelTypeAdvanced;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.client.AbstractHandleDistributeClientTransferClientPermeateChannelConnectionSuccessfulTypeAdvanced; import org.framework.lazy.cloud.network.heartbeat.common.advanced.client.AbstractHandleDistributeClientTransferClientPermeateChannelConnectionSuccessfulTypeAdvanced;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.client.AbstractHandleDistributeClientTransferServerPermeateChannelConnectionSuccessfulTypeAdvanced;
import org.framework.lazy.cloud.network.heartbeat.common.enums.MessageTypeEnums; import org.framework.lazy.cloud.network.heartbeat.common.enums.MessageTypeEnums;
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
import org.wu.framework.spring.utils.SpringContextHolder; import org.wu.framework.spring.utils.SpringContextHolder;
import java.util.List; import java.util.List;

View File

@ -5,7 +5,7 @@ import io.netty.channel.Channel;
import io.netty.channel.ChannelOption; import io.netty.channel.ChannelOption;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.framework.lazy.cloud.network.heartbeat.client.netty.handler.NettyClientPermeateServerVisitorHandler; import org.framework.lazy.cloud.network.heartbeat.client.netty.handler.NettyClientPermeateServerVisitorHandler;
import org.framework.lazy.cloud.network.heartbeat.client.netty.socket.NettyClientTransferServerSocket; import org.framework.lazy.cloud.network.heartbeat.client.netty.socket.NettyClientPermeateServerVisitorTransferSocket;
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg; import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.NettyRealIdContext; import org.framework.lazy.cloud.network.heartbeat.common.NettyRealIdContext;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.client.AbstractHandleDistributeClientTransferServerPermeateChannelConnectionSuccessfulTypeAdvanced; import org.framework.lazy.cloud.network.heartbeat.common.advanced.client.AbstractHandleDistributeClientTransferServerPermeateChannelConnectionSuccessfulTypeAdvanced;
@ -15,7 +15,7 @@ import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeK
/** /**
* 客户端渗透服务端数据传输通道连接成功 * 客户端渗透服务端数据传输通道连接成功
* @see NettyClientTransferServerSocket * @see NettyClientPermeateServerVisitorTransferSocket
* @see NettyClientPermeateServerVisitorHandler * @see NettyClientPermeateServerVisitorHandler
* *
* @see MessageTypeEnums#DISTRIBUTE_CLIENT_TRANSFER_SERVER_PERMEATE_CHANNEL_CONNECTION_SUCCESSFUL * @see MessageTypeEnums#DISTRIBUTE_CLIENT_TRANSFER_SERVER_PERMEATE_CHANNEL_CONNECTION_SUCCESSFUL

View File

@ -0,0 +1,43 @@
package org.framework.lazy.cloud.network.heartbeat.client.netty.filter;
import io.netty.channel.Channel;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.socket.SocketChannel;
import org.framework.lazy.cloud.network.heartbeat.client.netty.handler.NettyClientPermeateClientTransferHandler;
import org.framework.lazy.cloud.network.heartbeat.client.netty.handler.NettyServerPermeateClientTransferHandler;
import org.framework.lazy.cloud.network.heartbeat.common.adapter.ChannelTypeAdapter;
import org.framework.lazy.cloud.network.heartbeat.common.decoder.NettyProxyMsgDecoder;
import org.framework.lazy.cloud.network.heartbeat.common.encoder.NettyProxyMsgEncoder;
import org.framework.lazy.cloud.network.heartbeat.common.filter.DebugChannelInitializer;
/**
* netty 客户端连接真实服服务端访客拦截器
*/
public class NettyClientPermeateClientTransferFilter extends DebugChannelInitializer<SocketChannel> {
private final ChannelTypeAdapter channelTypeAdapter;
public NettyClientPermeateClientTransferFilter(ChannelTypeAdapter channelTypeAdapter) {
this.channelTypeAdapter = channelTypeAdapter;
}
/**
* This method will be called once the {@link Channel} was registered. After the method returns this instance
* will be removed from the {@link ChannelPipeline} of the {@link Channel}.
*
* @param ch the {@link Channel} which was registered.
* @throws Exception is thrown if an error occurs. In that case it will be handled by
* {@link #exceptionCaught(ChannelHandlerContext, Throwable)} which will by default connectionClose
* the {@link Channel}.
*/
@Override
protected void initChannel0(SocketChannel ch) throws Exception {
ChannelPipeline pipeline = ch.pipeline();
// // 解码编码
// pipeline.addLast(new NettyProxyMsgDecoder(Integer.MAX_VALUE, 0, 4, -4, 0));
// pipeline.addLast(new NettMsgEncoder());
pipeline.addLast(new NettyProxyMsgDecoder(Integer.MAX_VALUE, 0, 4, -4, 0));
pipeline.addLast(new NettyProxyMsgEncoder());
pipeline.addLast(new NettyClientPermeateClientTransferHandler(channelTypeAdapter));
}
}

View File

@ -5,7 +5,6 @@ import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelPipeline; import io.netty.channel.ChannelPipeline;
import io.netty.channel.socket.SocketChannel; import io.netty.channel.socket.SocketChannel;
import org.framework.lazy.cloud.network.heartbeat.client.netty.handler.NettyClientPermeateTransferHandler; import org.framework.lazy.cloud.network.heartbeat.client.netty.handler.NettyClientPermeateTransferHandler;
import org.framework.lazy.cloud.network.heartbeat.client.netty.handler.NettyClientVisitorRealHandler;
import org.framework.lazy.cloud.network.heartbeat.common.adapter.ChannelTypeAdapter; import org.framework.lazy.cloud.network.heartbeat.common.adapter.ChannelTypeAdapter;
import org.framework.lazy.cloud.network.heartbeat.common.decoder.NettyProxyMsgDecoder; import org.framework.lazy.cloud.network.heartbeat.common.decoder.NettyProxyMsgDecoder;
import org.framework.lazy.cloud.network.heartbeat.common.encoder.NettyProxyMsgEncoder; import org.framework.lazy.cloud.network.heartbeat.common.encoder.NettyProxyMsgEncoder;

View File

@ -2,10 +2,9 @@ package org.framework.lazy.cloud.network.heartbeat.client.netty.filter;
import io.netty.channel.Channel; import io.netty.channel.Channel;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline; import io.netty.channel.ChannelPipeline;
import io.netty.channel.socket.SocketChannel; import io.netty.channel.socket.SocketChannel;
import org.framework.lazy.cloud.network.heartbeat.client.netty.handler.NettyClientVisitorRealHandler; import org.framework.lazy.cloud.network.heartbeat.client.netty.handler.NettyServerPermeateClientTransferHandler;
import org.framework.lazy.cloud.network.heartbeat.common.adapter.ChannelTypeAdapter; import org.framework.lazy.cloud.network.heartbeat.common.adapter.ChannelTypeAdapter;
import org.framework.lazy.cloud.network.heartbeat.common.decoder.NettyProxyMsgDecoder; import org.framework.lazy.cloud.network.heartbeat.common.decoder.NettyProxyMsgDecoder;
import org.framework.lazy.cloud.network.heartbeat.common.encoder.NettyProxyMsgEncoder; import org.framework.lazy.cloud.network.heartbeat.common.encoder.NettyProxyMsgEncoder;
@ -14,10 +13,10 @@ import org.framework.lazy.cloud.network.heartbeat.common.filter.DebugChannelInit
/** /**
* netty 客户端连接真实服服务端访客拦截器 * netty 客户端连接真实服服务端访客拦截器
*/ */
public class NettyClientVisitorRealFilter extends DebugChannelInitializer<SocketChannel> { public class NettyServerPermeateClientTransferFilter extends DebugChannelInitializer<SocketChannel> {
private final ChannelTypeAdapter channelTypeAdapter; private final ChannelTypeAdapter channelTypeAdapter;
public NettyClientVisitorRealFilter(ChannelTypeAdapter channelTypeAdapter) { public NettyServerPermeateClientTransferFilter(ChannelTypeAdapter channelTypeAdapter) {
this.channelTypeAdapter = channelTypeAdapter; this.channelTypeAdapter = channelTypeAdapter;
} }
@ -38,6 +37,6 @@ public class NettyClientVisitorRealFilter extends DebugChannelInitializer<Socket
// pipeline.addLast(new NettMsgEncoder()); // pipeline.addLast(new NettMsgEncoder());
pipeline.addLast(new NettyProxyMsgDecoder(Integer.MAX_VALUE, 0, 4, -4, 0)); pipeline.addLast(new NettyProxyMsgDecoder(Integer.MAX_VALUE, 0, 4, -4, 0));
pipeline.addLast(new NettyProxyMsgEncoder()); pipeline.addLast(new NettyProxyMsgEncoder());
pipeline.addLast(new NettyClientVisitorRealHandler(channelTypeAdapter)); pipeline.addLast(new NettyServerPermeateClientTransferHandler(channelTypeAdapter));
} }
} }

View File

@ -0,0 +1,79 @@
package org.framework.lazy.cloud.network.heartbeat.client.netty.handler;
import io.netty.channel.Channel;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelOption;
import io.netty.channel.SimpleChannelInboundHandler;
import lombok.extern.slf4j.Slf4j;
import org.framework.lazy.cloud.network.heartbeat.common.ChannelContext;
import org.framework.lazy.cloud.network.heartbeat.common.MessageType;
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.NettyRealIdContext;
import org.framework.lazy.cloud.network.heartbeat.common.adapter.ChannelTypeAdapter;
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
import org.wu.framework.core.utils.ObjectUtils;
/**
* 客户端访客通信通道 处理器
*/
@Slf4j
public class NettyClientPermeateClientTransferHandler extends SimpleChannelInboundHandler<NettyProxyMsg> {
private final ChannelTypeAdapter channelTypeAdapter;
public NettyClientPermeateClientTransferHandler(ChannelTypeAdapter channelTypeAdapter) {
this.channelTypeAdapter = channelTypeAdapter;
}
@Override
public void channelActive(ChannelHandlerContext ctx) throws Exception {
super.channelActive(ctx);
}
@Override
public void channelRead0(ChannelHandlerContext ctx, NettyProxyMsg nettyProxyMsg) throws Exception {
Channel channel = ctx.channel();
channelTypeAdapter.handler(channel, nettyProxyMsg);
}
@Override
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
String clientId = ChannelAttributeKeyUtils.getClientId(ctx.channel());
String visitorId = ChannelAttributeKeyUtils.getVisitorId(ctx.channel());
// 关闭访客
ChannelContext.ClientChannel clientChannel = ChannelContext.get(clientId);
if (clientChannel != null) {
Channel channel = clientChannel.getChannel();
// 上报关闭这个客户端的访客通道
NettyProxyMsg closeVisitorMsg = new NettyProxyMsg();
closeVisitorMsg.setType(MessageType.REPORT_CLIENT_PERMEATE_CLIENT_CLOSE);
closeVisitorMsg.setVisitorId(visitorId);
channel.writeAndFlush(closeVisitorMsg);
}
super.channelInactive(ctx);
}
@Override
public void channelWritabilityChanged(ChannelHandlerContext ctx) throws Exception {
// 处理客户端本地真实通道问题
String visitorId = ChannelAttributeKeyUtils.getVisitorId(ctx.channel());
if(ObjectUtils.isEmpty(visitorId)) {
super.channelWritabilityChanged(ctx);
return;
}
Channel realChannel = NettyRealIdContext.getReal(visitorId);
if (realChannel != null) {
log.debug("visitorId:{} transfer AUTO_READ:{} ",visitorId,ctx.channel().isWritable());
realChannel.config().setOption(ChannelOption.AUTO_READ, ctx.channel().isWritable());
}
}
@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
super.exceptionCaught(ctx, cause);
}
}

View File

@ -10,8 +10,8 @@ import io.netty.util.internal.StringUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.framework.lazy.cloud.network.heartbeat.client.netty.InternalNetworkClientPermeateClientVisitor; import org.framework.lazy.cloud.network.heartbeat.client.netty.InternalNetworkClientPermeateClientVisitor;
import org.framework.lazy.cloud.network.heartbeat.client.netty.advanced.ClientHandleDistributeClientTransferServerPermeateChannelConnectionSuccessfulTypeAdvanced; import org.framework.lazy.cloud.network.heartbeat.client.netty.advanced.ClientHandleDistributeClientTransferServerPermeateChannelConnectionSuccessfulTypeAdvanced;
import org.framework.lazy.cloud.network.heartbeat.client.netty.socket.NettyClientTransferClientSocket; import org.framework.lazy.cloud.network.heartbeat.client.netty.socket.NettyClientPermeateClientVisitorTransferSocket;
import org.framework.lazy.cloud.network.heartbeat.client.netty.socket.NettyClientTransferServerSocket; import org.framework.lazy.cloud.network.heartbeat.client.netty.socket.NettyClientPermeateServerVisitorTransferSocket;
import org.framework.lazy.cloud.network.heartbeat.common.MessageType; import org.framework.lazy.cloud.network.heartbeat.common.MessageType;
import org.framework.lazy.cloud.network.heartbeat.common.NettyCommunicationIdContext; import org.framework.lazy.cloud.network.heartbeat.common.NettyCommunicationIdContext;
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg; import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
@ -33,7 +33,7 @@ public class NettyClientPermeateClientVisitorHandler extends SimpleChannelInboun
/** /**
* @param ctx * @param ctx
* @throws Exception * @throws Exception
* @see NettyClientTransferServerSocket * @see NettyClientPermeateServerVisitorTransferSocket
* @see ClientHandleDistributeClientTransferServerPermeateChannelConnectionSuccessfulTypeAdvanced * @see ClientHandleDistributeClientTransferServerPermeateChannelConnectionSuccessfulTypeAdvanced
*/ */
@Override @Override
@ -55,7 +55,7 @@ public class NettyClientPermeateClientVisitorHandler extends SimpleChannelInboun
// 判断是否有可用的通道 如果没有创建新的通道 // 判断是否有可用的通道 如果没有创建新的通道
// Channel transferChannel = nettyChannelPool.availableChannel(visitorId); // Channel transferChannel = nettyChannelPool.availableChannel(visitorId);
// 创建访客连接客户端通道 // 创建访客连接客户端通道
NettyClientTransferClientSocket.buildTransferServer(internalNetworkClientPermeateClientVisitor); NettyClientPermeateClientVisitorTransferSocket.buildTransferServer(internalNetworkClientPermeateClientVisitor);
log.info("客户端渗透客户端访客端口连接成功了"); log.info("客户端渗透客户端访客端口连接成功了");
super.channelActive(ctx); super.channelActive(ctx);
} }

View File

@ -10,7 +10,7 @@ import io.netty.util.internal.StringUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.framework.lazy.cloud.network.heartbeat.client.netty.InternalNetworkPermeateServerVisitor; import org.framework.lazy.cloud.network.heartbeat.client.netty.InternalNetworkPermeateServerVisitor;
import org.framework.lazy.cloud.network.heartbeat.client.netty.advanced.ClientHandleDistributeClientTransferServerPermeateChannelConnectionSuccessfulTypeAdvanced; import org.framework.lazy.cloud.network.heartbeat.client.netty.advanced.ClientHandleDistributeClientTransferServerPermeateChannelConnectionSuccessfulTypeAdvanced;
import org.framework.lazy.cloud.network.heartbeat.client.netty.socket.NettyClientTransferServerSocket; import org.framework.lazy.cloud.network.heartbeat.client.netty.socket.NettyClientPermeateServerVisitorTransferSocket;
import org.framework.lazy.cloud.network.heartbeat.common.MessageType; import org.framework.lazy.cloud.network.heartbeat.common.MessageType;
import org.framework.lazy.cloud.network.heartbeat.common.NettyCommunicationIdContext; import org.framework.lazy.cloud.network.heartbeat.common.NettyCommunicationIdContext;
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg; import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
@ -32,7 +32,7 @@ public class NettyClientPermeateServerVisitorHandler extends SimpleChannelInboun
/** /**
* @param ctx * @param ctx
* @throws Exception * @throws Exception
* @see NettyClientTransferServerSocket * @see NettyClientPermeateServerVisitorTransferSocket
* @see ClientHandleDistributeClientTransferServerPermeateChannelConnectionSuccessfulTypeAdvanced * @see ClientHandleDistributeClientTransferServerPermeateChannelConnectionSuccessfulTypeAdvanced
*/ */
@Override @Override
@ -54,7 +54,7 @@ public class NettyClientPermeateServerVisitorHandler extends SimpleChannelInboun
// 判断是否有可用的通道 如果没有创建新的通道 // 判断是否有可用的通道 如果没有创建新的通道
// Channel transferChannel = nettyChannelPool.availableChannel(visitorId); // Channel transferChannel = nettyChannelPool.availableChannel(visitorId);
// 创建访客连接服务端通道 // 创建访客连接服务端通道
NettyClientTransferServerSocket.buildTransferServer(internalNetworkPermeateServerVisitor); NettyClientPermeateServerVisitorTransferSocket.buildTransferServer(internalNetworkPermeateServerVisitor);
log.info("客户端渗透服务端访客端口连接成功了"); log.info("客户端渗透服务端访客端口连接成功了");
super.channelActive(ctx); super.channelActive(ctx);
} }

View File

@ -15,10 +15,10 @@ import org.wu.framework.core.utils.ObjectUtils;
* 客户端访客通信通道 处理器 * 客户端访客通信通道 处理器
*/ */
@Slf4j @Slf4j
public class NettyClientVisitorRealHandler extends SimpleChannelInboundHandler<NettyProxyMsg> { public class NettyServerPermeateClientTransferHandler extends SimpleChannelInboundHandler<NettyProxyMsg> {
private final ChannelTypeAdapter channelTypeAdapter; private final ChannelTypeAdapter channelTypeAdapter;
public NettyClientVisitorRealHandler(ChannelTypeAdapter channelTypeAdapter) { public NettyServerPermeateClientTransferHandler(ChannelTypeAdapter channelTypeAdapter) {
this.channelTypeAdapter = channelTypeAdapter; this.channelTypeAdapter = channelTypeAdapter;
} }

View File

@ -8,14 +8,14 @@ import io.netty.channel.socket.nio.NioSocketChannel;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.framework.lazy.cloud.network.heartbeat.client.config.NettyClientProperties; import org.framework.lazy.cloud.network.heartbeat.client.config.NettyClientProperties;
import org.framework.lazy.cloud.network.heartbeat.client.netty.filter.NettyClientPermeateClientRealFilter; import org.framework.lazy.cloud.network.heartbeat.client.netty.filter.NettyClientPermeateClientRealFilter;
import org.framework.lazy.cloud.network.heartbeat.client.netty.filter.NettyClientVisitorRealFilter; import org.framework.lazy.cloud.network.heartbeat.client.netty.filter.NettyClientPermeateClientTransferFilter;
import org.framework.lazy.cloud.network.heartbeat.client.netty.filter.NettyServerPermeateClientTransferFilter;
import org.framework.lazy.cloud.network.heartbeat.common.*; import org.framework.lazy.cloud.network.heartbeat.common.*;
import org.framework.lazy.cloud.network.heartbeat.common.adapter.ChannelTypeAdapter; import org.framework.lazy.cloud.network.heartbeat.common.adapter.ChannelTypeAdapter;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.HandleChannelTypeAdvanced; import org.framework.lazy.cloud.network.heartbeat.common.advanced.HandleChannelTypeAdvanced;
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils; import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
import java.util.List; import java.util.List;
import java.util.concurrent.TimeUnit;
/** /**
* 客户端连接真实服务 * 客户端连接真实服务
@ -113,7 +113,7 @@ public class NettyClientPermeateClientRealSocket {
.option(ChannelOption.WRITE_BUFFER_WATER_MARK, new WriteBufferWaterMark(1024 * 1024, 1024 * 1024 * 2)) .option(ChannelOption.WRITE_BUFFER_WATER_MARK, new WriteBufferWaterMark(1024 * 1024, 1024 * 1024 * 2))
.handler(new NettyClientVisitorRealFilter(new ChannelTypeAdapter(handleChannelTypeAdvancedList))) .handler(new NettyClientPermeateClientTransferFilter(new ChannelTypeAdapter(handleChannelTypeAdvancedList)))
; ;
String inetHost = nettyClientProperties.getInetHost(); String inetHost = nettyClientProperties.getInetHost();
@ -130,7 +130,7 @@ public class NettyClientPermeateClientRealSocket {
ChannelFuture future = bootstrap.connect(inetHost, inetPort); ChannelFuture future = bootstrap.connect(inetHost, inetPort);
// 使用的客户端ID:{} // 使用的客户端ID:{}
log.info("Client ID used: {}", visitorId); log.info("Client ID used: {}", clientId);
future.addListener((ChannelFutureListener) futureListener -> { future.addListener((ChannelFutureListener) futureListener -> {
Channel visitorChannel = futureListener.channel(); Channel visitorChannel = futureListener.channel();
if (futureListener.isSuccess()) { if (futureListener.isSuccess()) {
@ -156,19 +156,7 @@ public class NettyClientPermeateClientRealSocket {
} else { } else {
log.info("每隔2s重连...."); log.info("无法连接到服务端....");
// 离线
visitorChannel.eventLoop().schedule(() -> {
try {
newVisitorConnect2Server(clientId,
clientTargetIp,
clientTargetPort,
visitorPort,
visitorId,realChannel, nettyClientProperties, handleChannelTypeAdvancedList);
} catch (InterruptedException e) {
e.printStackTrace();
}
}, 2, TimeUnit.SECONDS);
} }
}); });
} }

View File

@ -22,7 +22,7 @@ import java.util.concurrent.TimeUnit;
* 客户端渗透服务端传输通道 * 客户端渗透服务端传输通道
*/ */
@Slf4j @Slf4j
public class NettyClientTransferClientSocket { public class NettyClientPermeateClientVisitorTransferSocket {
static EventLoopGroup eventLoopGroup = new NioEventLoopGroup(); static EventLoopGroup eventLoopGroup = new NioEventLoopGroup();
/** /**

View File

@ -22,7 +22,7 @@ import java.util.concurrent.TimeUnit;
* 客户端渗透服务端传输通道 * 客户端渗透服务端传输通道
*/ */
@Slf4j @Slf4j
public class NettyClientTransferServerSocket { public class NettyClientPermeateServerVisitorTransferSocket {
static EventLoopGroup eventLoopGroup = new NioEventLoopGroup(); static EventLoopGroup eventLoopGroup = new NioEventLoopGroup();
/** /**

View File

@ -8,7 +8,7 @@ import io.netty.channel.socket.nio.NioSocketChannel;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.framework.lazy.cloud.network.heartbeat.client.config.NettyClientProperties; import org.framework.lazy.cloud.network.heartbeat.client.config.NettyClientProperties;
import org.framework.lazy.cloud.network.heartbeat.client.netty.filter.NettyServerPermeateClientRealFilter; import org.framework.lazy.cloud.network.heartbeat.client.netty.filter.NettyServerPermeateClientRealFilter;
import org.framework.lazy.cloud.network.heartbeat.client.netty.filter.NettyClientVisitorRealFilter; import org.framework.lazy.cloud.network.heartbeat.client.netty.filter.NettyServerPermeateClientTransferFilter;
import org.framework.lazy.cloud.network.heartbeat.common.*; import org.framework.lazy.cloud.network.heartbeat.common.*;
import org.framework.lazy.cloud.network.heartbeat.common.adapter.ChannelTypeAdapter; import org.framework.lazy.cloud.network.heartbeat.common.adapter.ChannelTypeAdapter;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.HandleChannelTypeAdvanced; import org.framework.lazy.cloud.network.heartbeat.common.advanced.HandleChannelTypeAdvanced;
@ -148,7 +148,7 @@ public class NettyServerPermeateClientRealSocket {
.option(ChannelOption.WRITE_BUFFER_WATER_MARK, new WriteBufferWaterMark(1024 * 1024, 1024 * 1024 * 2)) .option(ChannelOption.WRITE_BUFFER_WATER_MARK, new WriteBufferWaterMark(1024 * 1024, 1024 * 1024 * 2))
.handler(new NettyClientVisitorRealFilter(new ChannelTypeAdapter(handleChannelTypeAdvancedList))) .handler(new NettyServerPermeateClientTransferFilter(new ChannelTypeAdapter(handleChannelTypeAdvancedList)))
; ;
String inetHost = nettyClientProperties.getInetHost(); String inetHost = nettyClientProperties.getInetHost();