【fix】客户端渗透客户端编码

This commit is contained in:
wujiawei 2024-09-20 21:55:04 +08:00
parent a0d246a0bf
commit 238b2906a0
24 changed files with 789 additions and 60 deletions

View File

@ -64,6 +64,21 @@ public class HeartbeatClientConfiguration {
public ClientHandleDistributeClientTransferClientPermeateChannelConnectionSuccessfulTypeAdvanced clientHandleDistributeClientTransferClientPermeateChannelConnectionSuccessfulTypeAdvanced() {
return new ClientHandleDistributeClientTransferClientPermeateChannelConnectionSuccessfulTypeAdvanced();
}
@Bean
public ClientHandleDistributeClientTransferClientPermeateChannelInitSuccessfulTypeAdvanced clientHandleDistributeClientTransferClientPermeateChannelInitSuccessfulTypeAdvanced() {
return new ClientHandleDistributeClientTransferClientPermeateChannelInitSuccessfulTypeAdvanced();
}
@Bean
public ClientHandleDistributeClientTransferClientTypeAdvanced clientHandleDistributeClientTransferClientTypeAdvanced() {
return new ClientHandleDistributeClientTransferClientTypeAdvanced();
}
@Bean
public ClientHandleDistributeClientTransferClientResponseTypeAdvanced clientHandleDistributeClientTransferClientResponseTypeAdvanced() {
return new ClientHandleDistributeClientTransferClientResponseTypeAdvanced();
}
@Bean
public ClientHandleDistributeSingleClientRealCloseVisitorTypeAdvanced handleDistributeSingleClientRealCloseVisitorTypeAdvanced() {
return new ClientHandleDistributeSingleClientRealCloseVisitorTypeAdvanced();

View File

@ -1,9 +1,7 @@
package org.framework.lazy.cloud.network.heartbeat.client.netty;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.framework.lazy.cloud.network.heartbeat.client.config.NettyClientProperties;
import org.framework.lazy.cloud.network.heartbeat.common.InternalNetworkPermeate;
import org.framework.lazy.cloud.network.heartbeat.common.adapter.ChannelFlowAdapter;

View File

@ -4,15 +4,21 @@ package org.framework.lazy.cloud.network.heartbeat.client.netty.advanced;
import io.netty.channel.Channel;
import io.netty.channel.ChannelOption;
import lombok.extern.slf4j.Slf4j;
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.NettyClientTransferServerSocket;
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.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.utils.ChannelAttributeKeyUtils;
import org.wu.framework.spring.utils.SpringContextHolder;
import java.util.List;
import java.util.stream.Collectors;
/**
@ -24,8 +30,6 @@ import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeK
@Slf4j
public class ClientHandleDistributeClientTransferClientPermeateChannelConnectionSuccessfulTypeAdvanced extends AbstractHandleDistributeClientTransferClientPermeateChannelConnectionSuccessfulTypeAdvanced<NettyProxyMsg> {
/**
* 处理当前数据
*
@ -34,7 +38,6 @@ public class ClientHandleDistributeClientTransferClientPermeateChannelConnection
*/
@Override
public void doHandler(Channel channel, NettyProxyMsg nettyProxyMsg) {
// 连接成功 开启自动读取写
// 创建connect 然后发送创建成功
byte[] msgClientId = nettyProxyMsg.getClientId();
byte[] msgClientTargetIp = nettyProxyMsg.getClientTargetIp();
@ -42,7 +45,22 @@ public class ClientHandleDistributeClientTransferClientPermeateChannelConnection
byte[] msgVisitorId = nettyProxyMsg.getVisitorId();
byte[] msgVisitorPort = nettyProxyMsg.getVisitorPort();
NettyClientPermeateClientRealSocket.buildRealServer();
String clientId=new String(msgClientId);
String clientTargetIp=new String(msgClientTargetIp);
Integer clientTargetPort=Integer.parseInt(new String(msgClientTargetPort));
String visitorId=new String(msgVisitorId);
Integer visitorPort=Integer.parseInt(new String(msgVisitorPort));
NettyClientProperties nettyClientProperties = SpringContextHolder.getBean(NettyClientProperties.class);
List<HandleChannelTypeAdvanced> handleChannelTypeAdvancedList = SpringContextHolder.getApplicationContext().getBeansOfType(HandleChannelTypeAdvanced.class).values().stream().collect(Collectors.toList());
NettyClientPermeateClientRealSocket.buildRealServer(
clientId,
clientTargetIp,
clientTargetPort,
visitorPort,
visitorId,
nettyClientProperties,
handleChannelTypeAdvancedList
);
}

View File

@ -0,0 +1,46 @@
package org.framework.lazy.cloud.network.heartbeat.client.netty.advanced;
import io.netty.channel.Channel;
import io.netty.channel.ChannelOption;
import lombok.extern.slf4j.Slf4j;
import org.framework.lazy.cloud.network.heartbeat.client.netty.socket.NettyClientPermeateClientRealSocket;
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.client.AbstractHandleDistributeClientTransferClientPermeateChannelConnectionSuccessfulTypeAdvanced;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.client.AbstractHandleDistributeClientTransferClientPermeateChannelInitSuccessfulTypeAdvanced;
import org.framework.lazy.cloud.network.heartbeat.common.enums.MessageTypeEnums;
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
/**
* 下发 客户端渗透客户端数据传输通道init 成功
*
*
* @see MessageTypeEnums#DISTRIBUTE_CLIENT_TRANSFER_CLIENT_PERMEATE_CHANNEL_CONNECTION_SUCCESSFUL
*/
@Slf4j
public class ClientHandleDistributeClientTransferClientPermeateChannelInitSuccessfulTypeAdvanced extends AbstractHandleDistributeClientTransferClientPermeateChannelInitSuccessfulTypeAdvanced<NettyProxyMsg> {
/**
* 处理当前数据
*
* @param channel 当前通道
* @param nettyProxyMsg 通道数据
*/
@Override
public void doHandler(Channel channel, NettyProxyMsg nettyProxyMsg) {
// 连接成功 开启自动读取写
byte[] msgClientId = nettyProxyMsg.getClientId();
byte[] msgClientTargetIp = nettyProxyMsg.getClientTargetIp();
byte[] msgClientTargetPort = nettyProxyMsg.getClientTargetPort();
byte[] msgVisitorId = nettyProxyMsg.getVisitorId();
byte[] msgVisitorPort = nettyProxyMsg.getVisitorPort();
Channel nextChannel = ChannelAttributeKeyUtils.getNextChannel(channel);
nextChannel.config().setOption(ChannelOption.AUTO_READ, true);
}
}

View File

@ -0,0 +1,42 @@
package org.framework.lazy.cloud.network.heartbeat.client.netty.advanced;
import io.netty.buffer.ByteBuf;
import io.netty.channel.Channel;
import lombok.extern.slf4j.Slf4j;
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.client.AbstractHandleDistributeClientTransferClientResponseTypeAdvanced;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.client.AbstractHandleDistributeClientTransferClientTypeAdvanced;
import org.framework.lazy.cloud.network.heartbeat.common.enums.MessageTypeEnums;
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
/**
* 下发客户端渗透客户端数据传输响应
*
*
* @see MessageTypeEnums#DISTRIBUTE_CLIENT_TRANSFER_CLIENT_RESPONSE
*/
@Slf4j
public class ClientHandleDistributeClientTransferClientResponseTypeAdvanced extends AbstractHandleDistributeClientTransferClientResponseTypeAdvanced<NettyProxyMsg> {
/**
* 处理当前数据
*
* @param channel 当前通道
* @param nettyProxyMsg 通道数据
*/
@Override
public void doHandler(Channel channel, NettyProxyMsg nettyProxyMsg) {
Channel nextChannel = ChannelAttributeKeyUtils.getNextChannel(channel);
// 把数据转到真实服务
ByteBuf buf = channel.config().getAllocator().buffer(nettyProxyMsg.getData().length);
buf.writeBytes(nettyProxyMsg.getData());
nextChannel.writeAndFlush(buf);
}
}

View File

@ -0,0 +1,41 @@
package org.framework.lazy.cloud.network.heartbeat.client.netty.advanced;
import io.netty.buffer.ByteBuf;
import io.netty.channel.Channel;
import lombok.extern.slf4j.Slf4j;
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.client.AbstractHandleDistributeClientTransferClientTypeAdvanced;
import org.framework.lazy.cloud.network.heartbeat.common.enums.MessageTypeEnums;
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
/**
* 下发客户端渗透客户端数据传输
*
*
* @see MessageTypeEnums#DISTRIBUTE_CLIENT_TRANSFER_CLIENT_REQUEST
*/
@Slf4j
public class ClientHandleDistributeClientTransferClientTypeAdvanced extends AbstractHandleDistributeClientTransferClientTypeAdvanced<NettyProxyMsg> {
/**
* 处理当前数据
*
* @param channel 当前通道
* @param nettyProxyMsg 通道数据
*/
@Override
public void doHandler(Channel channel, NettyProxyMsg nettyProxyMsg) {
Channel nextChannel = ChannelAttributeKeyUtils.getNextChannel(channel);
// 把数据转到真实服务
ByteBuf buf = channel.config().getAllocator().buffer(nettyProxyMsg.getData().length);
buf.writeBytes(nettyProxyMsg.getData());
nextChannel.writeAndFlush(buf);
}
}

View File

@ -32,7 +32,7 @@ public class NettyClientPermeateClientRealHandler extends SimpleChannelInboundHa
// 访客通信通道 上报服务端代理完成
Channel visitorChannel = NettyCommunicationIdContext.getVisitor(visitorId);
NettyProxyMsg returnMessage = new NettyProxyMsg();
returnMessage.setType(MessageType.REPORT_CLIENT_TRANSFER);
returnMessage.setType(MessageType.REPORT_CLIENT_TRANSFER_CLIENT_RESPONSE);
returnMessage.setVisitorId(visitorId);
returnMessage.setClientId(clientId);
returnMessage.setVisitorPort(visitorPort);
@ -66,17 +66,6 @@ public class NettyClientPermeateClientRealHandler extends SimpleChannelInboundHa
@Override
public void channelWritabilityChanged(ChannelHandlerContext ctx) throws Exception {
// String vid = ctx.channel().attr(Constant.VID).get();
// if (StringUtil.isNullOrEmpty(vid)) {
// super.channelWritabilityChanged(ctx);
// return;
// }
// Channel proxyChannel = Constant.vpc.get(vid);
// if (proxyChannel != null) {
// proxyChannel.config().setOption(ChannelOption.AUTO_READ, ctx.channel().isWritable());
// }
// 获取访客的传输通道
String visitorId = ChannelAttributeKeyUtils.getVisitorId(ctx.channel());
if(ObjectUtils.isEmpty(visitorId)) {

View File

@ -76,20 +76,11 @@ public class NettyClientPermeateClientVisitorHandler extends SimpleChannelInboun
// 使用访客的通信通道
Integer visitorPort = internalNetworkPermeateServerVisitor.getVisitorPort();
NettyProxyMsg nettyProxyMsg = new NettyProxyMsg();
nettyProxyMsg.setType(MessageType.REPORT_CLIENT_TRANSFER);
nettyProxyMsg.setType(MessageType.REPORT_CLIENT_TRANSFER_CLIENT_REQUEST);
nettyProxyMsg.setVisitorId(visitorId);
nettyProxyMsg.setVisitorPort(visitorPort);
nettyProxyMsg.setData(bytes);
nextChannel.writeAndFlush(nettyProxyMsg);
// 处理访客流量
// ServerChannelFlow serverChannelFlow = ServerChannelFlow
// .builder()
// .channelFlowEnum(ChannelFlowEnum.IN_FLOW)
// .port(visitorPort)
// .clientId(clientId)
// .flow(bytes.length)
// .build();
// channelFlowAdapter.asyncHandler(visitorChannel, serverChannelFlow);
log.debug("【客户端渗透服务端】访客端口成功发送数据了");
}

View File

@ -9,7 +9,6 @@ import lombok.extern.slf4j.Slf4j;
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.NettyClientVisitorRealFilter;
import org.framework.lazy.cloud.network.heartbeat.client.netty.filter.NettyServerPermeateClientRealFilter;
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.advanced.HandleChannelTypeAdvanced;
@ -26,19 +25,16 @@ public class NettyClientPermeateClientRealSocket {
static EventLoopGroup eventLoopGroup = new NioEventLoopGroup();
/**
* @param internalNetworkPenetrationRealClient 访客信息
* @param nettyClientProperties 服务端地址信息
*/
public static void buildRealServer(InternalNetworkPenetrationRealClient internalNetworkPenetrationRealClient,
NettyClientProperties nettyClientProperties,
List<HandleChannelTypeAdvanced> handleChannelTypeAdvancedList) {
public static void buildRealServer(String clientId,
String clientTargetIp,
Integer clientTargetPort,
Integer visitorPort,
String visitorId,
NettyClientProperties nettyClientProperties,
List<HandleChannelTypeAdvanced> handleChannelTypeAdvancedList) {
try {
String clientId = internalNetworkPenetrationRealClient.getClientId();
String clientTargetIp = internalNetworkPenetrationRealClient.getClientTargetIp();
Integer clientTargetPort = internalNetworkPenetrationRealClient.getClientTargetPort();
Integer visitorPort = internalNetworkPenetrationRealClient.getVisitorPort();
String visitorId = internalNetworkPenetrationRealClient.getVisitorId();
Bootstrap bootstrap = new Bootstrap();
bootstrap.group(eventLoopGroup).channel(NioSocketChannel.class)
// 设置读缓冲区为2M
@ -68,13 +64,16 @@ public class NettyClientPermeateClientRealSocket {
ChannelAttributeKeyUtils.buildVisitorId(realChannel, visitorId);
ChannelAttributeKeyUtils.buildClientId(realChannel, clientId);
ChannelAttributeKeyUtils.buildVisitorPort(realChannel, visitorPort);
// 通知服务端访客连接成功
// 连接服务端 然后绑定通道
// 新建一个通道处理
newVisitorConnect2Server(clientId,
clientTargetIp,
clientTargetPort,
visitorPort,
visitorId,realChannel, nettyClientProperties, handleChannelTypeAdvancedList);
// 是否等 服务端相应访客通道已经可以自动读写
// realChannel.config().setOption(ChannelOption.AUTO_READ, true);
} else {
log.error("客户:【{}】,无法连接当前网络内的目标IP【{}】,目标端口:【{}】", clientId, clientTargetIp, clientTargetPort);
}
@ -84,6 +83,94 @@ public class NettyClientPermeateClientRealSocket {
}
}
/**
* 创建访客连接服务端
*
* @param nettyClientProperties 服务端配置信息
* @param handleChannelTypeAdvancedList 处理器适配器
* @throws InterruptedException 异常
*/
protected static void newVisitorConnect2Server(String clientId,
String clientTargetIp,
Integer clientTargetPort,
Integer visitorPort,
String visitorId,
Channel realChannel,
NettyClientProperties nettyClientProperties,
List<HandleChannelTypeAdvanced> handleChannelTypeAdvancedList) throws InterruptedException {
Bootstrap bootstrap = new Bootstrap();
bootstrap.group(eventLoopGroup)
.channel(NioSocketChannel.class)
.option(ChannelOption.SO_KEEPALIVE, true)
// 设置读缓冲区为2M
.option(ChannelOption.SO_RCVBUF, 2048 * 1024)
// 设置写缓冲区为1M
.option(ChannelOption.SO_SNDBUF, 1024 * 1024)
// .option(ChannelOption.TCP_NODELAY, false)
.option(ChannelOption.CONNECT_TIMEOUT_MILLIS, 1000 * 60)//连接超时时间设置为 60
// .option(ChannelOption.SO_BACKLOG, 256)//务端接受连接的队列长度 默认128
// .option(ChannelOption.RCVBUF_ALLOCATOR, new NettyRecvByteBufAllocator(1024 * 1024))//用于Channel分配接受Buffer的分配器 默认AdaptiveRecvByteBufAllocator.DEFAULT
.option(ChannelOption.WRITE_BUFFER_WATER_MARK, new WriteBufferWaterMark(1024 * 1024, 1024 * 1024 * 2))
.handler(new NettyClientVisitorRealFilter(new ChannelTypeAdapter(handleChannelTypeAdvancedList)))
;
String inetHost = nettyClientProperties.getInetHost();
int inetPort = nettyClientProperties.getInetPort();
// local client id
// String clientId = nettyClientProperties.getClientId();
// 客户端新建访客通道 连接服务端IP:{},连接服务端端口:{}
log.info("Client creates a new visitor channel to connect to server IP: {}, connecting to server port: {}", inetHost, inetPort);
ChannelFuture future = bootstrap.connect(inetHost, inetPort);
// 使用的客户端ID:{}
log.info("Client ID used: {}", visitorId);
future.addListener((ChannelFutureListener) futureListener -> {
Channel visitorChannel = futureListener.channel();
if (futureListener.isSuccess()) {
// 通知服务端访客连接成功
NettyProxyMsg nettyProxyMsg = new NettyProxyMsg();
nettyProxyMsg.setVisitorId(visitorId);
nettyProxyMsg.setClientId(clientId);
nettyProxyMsg.setClientTargetIp(clientTargetIp);
nettyProxyMsg.setClientTargetPort(clientTargetPort);
nettyProxyMsg.setVisitorPort(visitorPort);
nettyProxyMsg.setType(MessageType.REPORT_CLIENT_TRANSFER_CLIENT_PERMEATE_CHANNEL_INIT_SUCCESSFUL);
visitorChannel.writeAndFlush(nettyProxyMsg);
ChannelAttributeKeyUtils.buildNextChannel(visitorChannel, realChannel);
ChannelAttributeKeyUtils.buildNextChannel(realChannel, visitorChannel);
// 绑定客户端真实通信通道
NettyCommunicationIdContext.pushVisitor(visitorChannel, visitorId);
ChannelAttributeKeyUtils.buildVisitorId(visitorChannel, visitorId);
ChannelAttributeKeyUtils.buildClientId(visitorChannel, visitorId);
} else {
log.info("每隔2s重连....");
// 离线
visitorChannel.eventLoop().schedule(() -> {
try {
newVisitorConnect2Server(clientId,
clientTargetIp,
clientTargetPort,
visitorPort,
visitorId,realChannel, nettyClientProperties, handleChannelTypeAdvancedList);
} catch (InterruptedException e) {
e.printStackTrace();
}
}, 2, TimeUnit.SECONDS);
}
});
}
}

View File

@ -126,6 +126,34 @@ public class MessageType {
* @see MessageType#DISTRIBUTE_CLIENT_TRANSFER_CLIENT_PERMEATE_CHANNEL_CONNECTION_SUCCESSFUL
*/
public static final byte REPORT_CLIENT_TRANSFER_CLIENT_PERMEATE_CHANNEL_CONNECTION_SUCCESSFUL = 0X15;
/**
* 上报 客户端渗透客户端数据传输通道init 成功
*
* @see MessageTypeEnums#REPORT_CLIENT_TRANSFER_CLIENT_PERMEATE_CHANNEL_INIT_SUCCESSFUL
* @see AbstractHandleReportClientTransferClientPermeateChannelInitSuccessfulTypeAdvanced
* @see MessageType#DISTRIBUTE_CLIENT_TRANSFER_CLIENT_PERMEATE_CHANNEL_INIT_SUCCESSFUL
*/
public static final byte REPORT_CLIENT_TRANSFER_CLIENT_PERMEATE_CHANNEL_INIT_SUCCESSFUL = 0X16;
/**
* 上报客户端渗透客户端数据传输请求
*
* @see MessageTypeEnums#REPORT_CLIENT_TRANSFER_CLIENT_REQUEST
* @see AbstractHandleReportClientTransferClientTypeAdvanced
* @see MessageType#DISTRIBUTE_CLIENT_TRANSFER_CLIENT_REQUEST
*/
public static final byte REPORT_CLIENT_TRANSFER_CLIENT_REQUEST = 0X17;
/**
* 上报客户端渗透客户端数据传输结果
*
* @see MessageTypeEnums#REPORT_CLIENT_TRANSFER_CLIENT_RESPONSE
* @see AbstractHandleReportClientTransferClientResponseTypeAdvanced
* @see MessageType#DISTRIBUTE_CLIENT_TRANSFER_CLIENT_RESPONSE
*/
public static final byte REPORT_CLIENT_TRANSFER_CLIENT_RESPONSE = 0X18;
/**
* 下发 客户端接收连接成功通知
*
@ -243,4 +271,31 @@ public class MessageType {
* @see MessageType#REPORT_CLIENT_TRANSFER_CLIENT_PERMEATE_CHANNEL_CONNECTION_SUCCESSFUL
*/
public static final byte DISTRIBUTE_CLIENT_TRANSFER_CLIENT_PERMEATE_CHANNEL_CONNECTION_SUCCESSFUL = -0X15;
/**
* 下发 客户端渗透客户端数据传输通道init 成功
*
* @see MessageTypeEnums#DISTRIBUTE_CLIENT_TRANSFER_CLIENT_PERMEATE_CHANNEL_INIT_SUCCESSFUL
* @see AbstractHandleDistributeClientTransferClientPermeateChannelInitSuccessfulTypeAdvanced
* @see MessageType#DISTRIBUTE_CLIENT_TRANSFER_CLIENT_PERMEATE_CHANNEL_INIT_SUCCESSFUL
*/
public static final byte DISTRIBUTE_CLIENT_TRANSFER_CLIENT_PERMEATE_CHANNEL_INIT_SUCCESSFUL = -0X16;
/**
* 下发 客户端渗透客户端数据传输请求
*
* @see MessageTypeEnums#DISTRIBUTE_CLIENT_TRANSFER_CLIENT_REQUEST
* @see AbstractHandleDistributeClientTransferClientTypeAdvanced
* @see MessageType#REPORT_CLIENT_TRANSFER_CLIENT_REQUEST
*/
public static final byte DISTRIBUTE_CLIENT_TRANSFER_CLIENT_REQUEST = -0X17;
/**
* 下发客户端渗透客户端数据传输响应
*
* @see MessageTypeEnums#DISTRIBUTE_CLIENT_TRANSFER_CLIENT_RESPONSE
* @see AbstractHandleDistributeClientTransferClientResponseTypeAdvanced
* @see MessageType#REPORT_CLIENT_TRANSFER_CLIENT_RESPONSE
*/
public static final byte DISTRIBUTE_CLIENT_TRANSFER_CLIENT_RESPONSE = -0X18;
}

View File

@ -0,0 +1,78 @@
package org.framework.lazy.cloud.network.heartbeat.common;
import io.netty.channel.Channel;
import java.util.concurrent.ConcurrentHashMap;
/**
* 访客通信通道上下文服务端客户端 通信
*/
public class NettyTransferChannelContext {
protected static final ConcurrentHashMap<String, Channel> VISITOR_ID = new ConcurrentHashMap<>();
/**
* 添加访客
*
* @param visitorId 访客id
* @param visitor 访客
*/
public static void pushVisitor(Channel visitor, String visitorId) {
VISITOR_ID.put(visitorId, visitor);
}
/**
* 添加访客
*
* @param visitorId 访客id
* @param visitor 访客
*/
public static void pushVisitor(Channel visitor, byte[] visitorId) {
VISITOR_ID.put(new String(visitorId), visitor);
}
/**
* 通过访客端口获取访客
*
* @param visitorId 访客id
* @return 访客
*/
public static Channel getVisitor(String visitorId) {
return VISITOR_ID.get(visitorId);
}
/**
* 通过访客端口获取访客
*
* @param visitorId 访客id
* @param <T> 访客范型
* @return 访客
*/
public static Channel getVisitor(byte[] visitorId) {
return getVisitor(new String(visitorId));
}
/**
* 移除访客
*
* @param visitorId 访客ID
*/
public static void clear(String visitorId) {
Channel visitor = getVisitor(visitorId);
if (visitor != null) {
VISITOR_ID.remove(visitorId);
visitor.close();
}
}
/**
* 移除访客
*
* @param visitorId 访客ID
*/
public static void clear(byte[] visitorId) {
clear(new String(visitorId));
}
}

View File

@ -7,10 +7,9 @@ import java.util.concurrent.ConcurrentHashMap;
/**
* 访客通信通道上下文服务端客户端 通信
*/
@Deprecated
public class NettyVisitorIdContext {
public class NettyVisitorIdChannelContext {
protected static final ConcurrentHashMap<String, Object> VISITOR_ID = new ConcurrentHashMap<>();
protected static final ConcurrentHashMap<String, Channel> VISITOR_ID = new ConcurrentHashMap<>();
/**
@ -19,7 +18,7 @@ public class NettyVisitorIdContext {
* @param visitorId 访客id
* @param visitor 访客
*/
public static <T> void pushVisitor(T visitor, String visitorId) {
public static void pushVisitor(Channel visitor, String visitorId) {
VISITOR_ID.put(visitorId, visitor);
}
@ -28,11 +27,10 @@ public class NettyVisitorIdContext {
* 通过访客端口获取访客
*
* @param visitorId 访客id
* @param <T> 访客范型
* @return 访客
*/
public static <T> T getVisitor(String visitorId) {
return (T) VISITOR_ID.get(visitorId);
public static Channel getVisitor(String visitorId) {
return VISITOR_ID.get(visitorId);
}
/**
@ -42,7 +40,7 @@ public class NettyVisitorIdContext {
* @param <T> 访客范型
* @return 访客
*/
public static <T> T getVisitor(byte[] visitorId) {
public static Channel getVisitor(byte[] visitorId) {
return getVisitor(new String(visitorId));
}

View File

@ -0,0 +1,28 @@
package org.framework.lazy.cloud.network.heartbeat.common.advanced.client;
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.AbstractHandleChannelTypeAdvanced;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.HandleChannelTypeAdvanced;
import org.framework.lazy.cloud.network.heartbeat.common.enums.MessageTypeEnums;
/**
* 下发 客户端渗透客户端数据传输通道init 成功
*
* @see MessageTypeEnums#DISTRIBUTE_CLIENT_TRANSFER_CLIENT_PERMEATE_CHANNEL_CONNECTION_SUCCESSFUL
*/
public abstract class AbstractHandleDistributeClientTransferClientPermeateChannelInitSuccessfulTypeAdvanced<MSG> extends AbstractHandleChannelTypeAdvanced<NettyProxyMsg> implements HandleChannelTypeAdvanced {
/**
* 是否支持当前类型
*
* @param msg 通道数据
* @return 布尔类型
*/
@Override
public boolean doSupport(NettyProxyMsg msg) {
return MessageTypeEnums.DISTRIBUTE_CLIENT_TRANSFER_CLIENT_PERMEATE_CHANNEL_INIT_SUCCESSFUL.getTypeByte() == msg.getType();
}
}

View File

@ -0,0 +1,28 @@
package org.framework.lazy.cloud.network.heartbeat.common.advanced.client;
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.AbstractHandleChannelTypeAdvanced;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.HandleChannelTypeAdvanced;
import org.framework.lazy.cloud.network.heartbeat.common.enums.MessageTypeEnums;
/**
* 下发客户端渗透客户端数据传输响应
*
* @see MessageTypeEnums#DISTRIBUTE_CLIENT_TRANSFER_CLIENT_RESPONSE
*/
public abstract class AbstractHandleDistributeClientTransferClientResponseTypeAdvanced<MSG> extends AbstractHandleChannelTypeAdvanced<NettyProxyMsg> implements HandleChannelTypeAdvanced {
/**
* 是否支持当前类型
*
* @param msg 通道数据
* @return 布尔类型
*/
@Override
public boolean doSupport(NettyProxyMsg msg) {
return MessageTypeEnums.DISTRIBUTE_CLIENT_TRANSFER_CLIENT_RESPONSE.getTypeByte() == msg.getType();
}
}

View File

@ -0,0 +1,28 @@
package org.framework.lazy.cloud.network.heartbeat.common.advanced.client;
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.AbstractHandleChannelTypeAdvanced;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.HandleChannelTypeAdvanced;
import org.framework.lazy.cloud.network.heartbeat.common.enums.MessageTypeEnums;
/**
* 下发客户端渗透客户端数据传输
*
* @see MessageTypeEnums#DISTRIBUTE_CLIENT_TRANSFER_CLIENT_REQUEST
*/
public abstract class AbstractHandleDistributeClientTransferClientTypeAdvanced<MSG> extends AbstractHandleChannelTypeAdvanced<NettyProxyMsg> implements HandleChannelTypeAdvanced {
/**
* 是否支持当前类型
*
* @param msg 通道数据
* @return 布尔类型
*/
@Override
public boolean doSupport(NettyProxyMsg msg) {
return MessageTypeEnums.DISTRIBUTE_CLIENT_TRANSFER_CLIENT_REQUEST.getTypeByte() == msg.getType();
}
}

View File

@ -0,0 +1,27 @@
package org.framework.lazy.cloud.network.heartbeat.common.advanced.server;
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.AbstractHandleChannelTypeAdvanced;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.HandleChannelTypeAdvanced;
import org.framework.lazy.cloud.network.heartbeat.common.enums.MessageTypeEnums;
/**
* 上报 客户端渗透客户端数据传输通道init
* REPORT_CLIENT_TRANSFER_CLIENT_PERMEATE_CHANNEL_INIT_SUCCESSFUL
*/
public abstract class AbstractHandleReportClientTransferClientPermeateChannelInitSuccessfulTypeAdvanced<MSG> extends AbstractHandleChannelTypeAdvanced<NettyProxyMsg> implements HandleChannelTypeAdvanced {
/**
* 是否支持当前类型
*
* @param msg 通道数据
* @return 布尔类型
*/
@Override
public boolean doSupport(NettyProxyMsg msg) {
return MessageTypeEnums.REPORT_CLIENT_TRANSFER_CLIENT_PERMEATE_CHANNEL_INIT_SUCCESSFUL.getTypeByte() == msg.getType();
}
}

View File

@ -0,0 +1,27 @@
package org.framework.lazy.cloud.network.heartbeat.common.advanced.server;
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.AbstractHandleChannelTypeAdvanced;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.HandleChannelTypeAdvanced;
import org.framework.lazy.cloud.network.heartbeat.common.enums.MessageTypeEnums;
/**
* 上报客户端渗透客户端数据传输结果
* REPORT_CLIENT_TRANSFER_CLIENT_RESPONSE
*/
public abstract class AbstractHandleReportClientTransferClientResponseTypeAdvanced<MSG> extends AbstractHandleChannelTypeAdvanced<NettyProxyMsg> implements HandleChannelTypeAdvanced {
/**
* 是否支持当前类型
*
* @param msg 通道数据
* @return 布尔类型
*/
@Override
public boolean doSupport(NettyProxyMsg msg) {
return MessageTypeEnums.REPORT_CLIENT_TRANSFER_CLIENT_RESPONSE.getTypeByte() == msg.getType();
}
}

View File

@ -0,0 +1,27 @@
package org.framework.lazy.cloud.network.heartbeat.common.advanced.server;
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.AbstractHandleChannelTypeAdvanced;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.HandleChannelTypeAdvanced;
import org.framework.lazy.cloud.network.heartbeat.common.enums.MessageTypeEnums;
/**
* 上报客户端渗透客户端数据传输
* REPORT_CLIENT_TRANSFER_CLIENT_REQUEST
*/
public abstract class AbstractHandleReportClientTransferClientTypeAdvanced<MSG> extends AbstractHandleChannelTypeAdvanced<NettyProxyMsg> implements HandleChannelTypeAdvanced {
/**
* 是否支持当前类型
*
* @param msg 通道数据
* @return 布尔类型
*/
@Override
public boolean doSupport(NettyProxyMsg msg) {
return MessageTypeEnums.REPORT_CLIENT_TRANSFER_CLIENT_REQUEST.getTypeByte() == msg.getType();
}
}

View File

@ -76,6 +76,22 @@ public enum MessageTypeEnums {
* @see AbstractHandleReportClientTransferClientPermeateChannelConnectionSuccessfulTypeAdvanced
*/
REPORT_CLIENT_TRANSFER_CLIENT_PERMEATE_CHANNEL_CONNECTION_SUCCESSFUL(MessageType.REPORT_CLIENT_TRANSFER_CLIENT_PERMEATE_CHANNEL_CONNECTION_SUCCESSFUL, "上报 客户端渗透客户端数据传输通道连接成功"),
/**
* 上报 客户端渗透客户端数据传输通道init 成功
* @see AbstractHandleReportClientTransferClientPermeateChannelInitSuccessfulTypeAdvanced
*/
REPORT_CLIENT_TRANSFER_CLIENT_PERMEATE_CHANNEL_INIT_SUCCESSFUL(MessageType.REPORT_CLIENT_TRANSFER_CLIENT_PERMEATE_CHANNEL_INIT_SUCCESSFUL, "上报 客户端渗透客户端数据传输通道init成功"),
/**
* 上报 上报客户端渗透客户端数据传输
* @see AbstractHandleReportClientTransferClientTypeAdvanced
*/
REPORT_CLIENT_TRANSFER_CLIENT_REQUEST(MessageType.REPORT_CLIENT_TRANSFER_CLIENT_REQUEST, "上报客户端渗透客户端数据传输"),
/**
* 上报客户端渗透客户端数据传输结果
* @see AbstractHandleReportClientTransferClientResponseTypeAdvanced
*/
REPORT_CLIENT_TRANSFER_CLIENT_RESPONSE(MessageType.REPORT_CLIENT_TRANSFER_CLIENT_RESPONSE, "上报客户端渗透客户端数据传输结果"),
/**
* @see AbstractHandleDistributeConnectSuccessNotificationTypeAdvancedHandle
*/
@ -140,6 +156,21 @@ public enum MessageTypeEnums {
* @see AbstractHandleDistributeClientTransferClientPermeateChannelConnectionSuccessfulTypeAdvanced
*/
DISTRIBUTE_CLIENT_TRANSFER_CLIENT_PERMEATE_CHANNEL_CONNECTION_SUCCESSFUL(MessageType.DISTRIBUTE_CLIENT_TRANSFER_CLIENT_PERMEATE_CHANNEL_CONNECTION_SUCCESSFUL, "下发 客户端渗透客户端数据传输通道连接成功"),
/**
* 下发 客户端渗透客户端数据传输通道init 成功
* @see AbstractHandleDistributeClientTransferClientPermeateChannelInitSuccessfulTypeAdvanced
*/
DISTRIBUTE_CLIENT_TRANSFER_CLIENT_PERMEATE_CHANNEL_INIT_SUCCESSFUL(MessageType.DISTRIBUTE_CLIENT_TRANSFER_CLIENT_PERMEATE_CHANNEL_INIT_SUCCESSFUL, "下发 客户端渗透客户端数据传输通道init 成功"),
/**
* 下发客户端渗透客户端数据传输
* @see AbstractHandleDistributeClientTransferClientTypeAdvanced
*/
DISTRIBUTE_CLIENT_TRANSFER_CLIENT_REQUEST(MessageType.DISTRIBUTE_CLIENT_TRANSFER_CLIENT_REQUEST, "下发客户端渗透客户端数据传输"),
/**
* 下发客户端渗透客户端数据传输响应
* @see AbstractHandleDistributeClientTransferClientResponseTypeAdvanced
*/
DISTRIBUTE_CLIENT_TRANSFER_CLIENT_RESPONSE(MessageType.DISTRIBUTE_CLIENT_TRANSFER_CLIENT_RESPONSE, "下发客户端渗透客户端数据传输响应"),
;
private final byte typeByte;

View File

@ -15,6 +15,7 @@ public class ChannelAttributeKeyUtils {
private static final AttributeKey<Integer> IN_FLOW = AttributeKey.newInstance("inFlow");
private static final AttributeKey<Channel> NEXT_CHANNEL = AttributeKey.newInstance("nextChannel");
private static final AttributeKey<Channel> TRANSFER_NEXT_CHANNEL = AttributeKey.newInstance("transferNextChannel");
/**
@ -154,4 +155,23 @@ public class ChannelAttributeKeyUtils {
public static Channel getNextChannel(Channel channel) {
return channel.attr(NEXT_CHANNEL).get();
}
/**
* 为通道绑定 下一个通道
*
* @param channel 通道
* @param nextChannel 下一个通道
*/
public static void buildTransferNextChannel(Channel channel, Channel nextChannel) {
channel.attr(TRANSFER_NEXT_CHANNEL).set(nextChannel);
}
/**
* 获取 通道中下一个通道
*
* @param channel 通道
*/
public static Channel getTransferNextChannel(Channel channel) {
return channel.attr(TRANSFER_NEXT_CHANNEL).get();
}
}

View File

@ -1,12 +1,8 @@
package org.framework.lazy.cloud.network.heartbeat.server.netty.advanced;
import io.netty.channel.Channel;
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.*;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.server.AbstractHandleReportClientTransferClientPermeateChannelConnectionSuccessfulTypeAdvanced;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.server.AbstractHandleReportClientTransferServerPermeateChannelConnectionSuccessfulTypeAdvanced;
import org.framework.lazy.cloud.network.heartbeat.server.netty.socket.NettyClientPermeateServerConnectRealSocket;
import org.springframework.stereotype.Component;
/**
@ -27,8 +23,9 @@ public class ServerHandleReportClientTransferClientPermeateChannelConnectionSucc
byte[] msgVisitorPort = nettyProxyMsg.getVisitorPort();
byte[] msgClientTargetIp = nettyProxyMsg.getClientTargetIp();
byte[] msgClientTargetPort = nettyProxyMsg.getClientTargetPort();
byte[] clientId = nettyProxyMsg.getClientId();
//
byte[] clientId = nettyProxyMsg.getClientId();// 目标客户端ID
// 绑定访客通道
NettyTransferChannelContext.pushVisitor(channel,msgVisitorId);
ChannelContext.ClientChannel clientChannel = ChannelContext.get(clientId);
NettyProxyMsg clientConnectTagetNettyProxyMsg = new NettyProxyMsg();

View File

@ -0,0 +1,59 @@
package org.framework.lazy.cloud.network.heartbeat.server.netty.advanced;
import io.netty.channel.Channel;
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.NettyTransferChannelContext;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.server.AbstractHandleReportClientTransferClientPermeateChannelConnectionSuccessfulTypeAdvanced;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.server.AbstractHandleReportClientTransferClientPermeateChannelInitSuccessfulTypeAdvanced;
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
import org.springframework.stereotype.Component;
/**
* 上报 客户端渗透客户端数据传输通道init
*/
@Slf4j
@Component
public class ServerHandleReportClientTransferClientPermeateChannelInitSuccessfulTypeAdvanced extends AbstractHandleReportClientTransferClientPermeateChannelInitSuccessfulTypeAdvanced<NettyProxyMsg> {
/**
* 处理当前数据
*
* @param channel 当前通道
* @param nettyProxyMsg 通道数据
*/
@Override
protected void doHandler(Channel channel, NettyProxyMsg nettyProxyMsg) {
// 创建目标地址连接
byte[] msgVisitorId = nettyProxyMsg.getVisitorId();
byte[] msgVisitorPort = nettyProxyMsg.getVisitorPort();
byte[] msgClientTargetIp = nettyProxyMsg.getClientTargetIp();
byte[] msgClientTargetPort = nettyProxyMsg.getClientTargetPort();
byte[] clientId = nettyProxyMsg.getClientId();
// next translation
Channel nextTransferChannel = NettyTransferChannelContext.getVisitor(msgVisitorId);
ChannelAttributeKeyUtils.buildTransferNextChannel(nextTransferChannel,channel);
ChannelAttributeKeyUtils.buildTransferNextChannel(channel,nextTransferChannel);
Channel nextChannel = ChannelAttributeKeyUtils.getTransferNextChannel(channel);
NettyProxyMsg clientConnectTagetNettyProxyMsg = new NettyProxyMsg();
clientConnectTagetNettyProxyMsg.setVisitorId(msgVisitorId);
clientConnectTagetNettyProxyMsg.setVisitorPort(msgVisitorPort);
clientConnectTagetNettyProxyMsg.setClientTargetIp(msgClientTargetIp);
clientConnectTagetNettyProxyMsg.setClientTargetPort(msgClientTargetPort);
clientConnectTagetNettyProxyMsg.setClientId(clientId);
clientConnectTagetNettyProxyMsg.setType(MessageType.DISTRIBUTE_CLIENT_TRANSFER_CLIENT_PERMEATE_CHANNEL_INIT_SUCCESSFUL);
if (nextChannel != null) {
nextChannel.writeAndFlush(clientConnectTagetNettyProxyMsg);
}else {
log.error("error");
}
}
}

View File

@ -0,0 +1,48 @@
package org.framework.lazy.cloud.network.heartbeat.server.netty.advanced;
import io.netty.channel.Channel;
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.advanced.server.AbstractHandleReportClientTransferClientPermeateChannelInitSuccessfulTypeAdvanced;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.server.AbstractHandleReportClientTransferClientResponseTypeAdvanced;
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
import org.springframework.stereotype.Component;
/**
* 上报客户端渗透客户端数据传输结果
*/
@Component
public class ServerHandleReportClientTransferClientResponseTypeAdvanced extends AbstractHandleReportClientTransferClientResponseTypeAdvanced<NettyProxyMsg> {
/**
* 处理当前数据
*
* @param channel 当前通道
* @param nettyProxyMsg 通道数据
*/
@Override
protected void doHandler(Channel channel, NettyProxyMsg nettyProxyMsg) {
// 创建目标地址连接
byte[] msgVisitorId = nettyProxyMsg.getVisitorId();
byte[] msgVisitorPort = nettyProxyMsg.getVisitorPort();
byte[] msgClientTargetIp = nettyProxyMsg.getClientTargetIp();
byte[] msgClientTargetPort = nettyProxyMsg.getClientTargetPort();
byte[] clientId = nettyProxyMsg.getClientId();
// 下发客户端初始化成功
Channel nextChannel = ChannelAttributeKeyUtils.getNextChannel(channel);
NettyProxyMsg clientConnectTagetNettyProxyMsg = new NettyProxyMsg();
clientConnectTagetNettyProxyMsg.setVisitorId(msgVisitorId);
clientConnectTagetNettyProxyMsg.setVisitorPort(msgVisitorPort);
clientConnectTagetNettyProxyMsg.setClientTargetIp(msgClientTargetIp);
clientConnectTagetNettyProxyMsg.setClientTargetPort(msgClientTargetPort);
clientConnectTagetNettyProxyMsg.setClientId(clientId);
clientConnectTagetNettyProxyMsg.setType(MessageType.DISTRIBUTE_CLIENT_TRANSFER_CLIENT_RESPONSE);
if (nextChannel != null) {
nextChannel.writeAndFlush(clientConnectTagetNettyProxyMsg);
}
}
}

View File

@ -0,0 +1,51 @@
package org.framework.lazy.cloud.network.heartbeat.server.netty.advanced;
import io.netty.channel.Channel;
import lombok.extern.slf4j.Slf4j;
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.advanced.server.AbstractHandleReportClientTransferClientTypeAdvanced;
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
import org.springframework.stereotype.Component;
/**
* 上报客户端渗透客户端数据传输
*/
@Slf4j
@Component
public class ServerHandleReportClientTransferClientTypeAdvanced extends AbstractHandleReportClientTransferClientTypeAdvanced<NettyProxyMsg> {
/**
* 处理当前数据
*
* @param channel 当前通道
* @param nettyProxyMsg 通道数据
*/
@Override
protected void doHandler(Channel channel, NettyProxyMsg nettyProxyMsg) {
// 创建目标地址连接
byte[] msgVisitorId = nettyProxyMsg.getVisitorId();
byte[] msgVisitorPort = nettyProxyMsg.getVisitorPort();
byte[] msgClientTargetIp = nettyProxyMsg.getClientTargetIp();
byte[] msgClientTargetPort = nettyProxyMsg.getClientTargetPort();
byte[] clientId = nettyProxyMsg.getClientId();
// 下发客户端初始化成功
Channel nextChannel = ChannelAttributeKeyUtils.getTransferNextChannel(channel);
NettyProxyMsg clientConnectTagetNettyProxyMsg = new NettyProxyMsg();
clientConnectTagetNettyProxyMsg.setVisitorId(msgVisitorId);
clientConnectTagetNettyProxyMsg.setVisitorPort(msgVisitorPort);
clientConnectTagetNettyProxyMsg.setClientTargetIp(msgClientTargetIp);
clientConnectTagetNettyProxyMsg.setClientTargetPort(msgClientTargetPort);
clientConnectTagetNettyProxyMsg.setClientId(clientId);
clientConnectTagetNettyProxyMsg.setType(MessageType.DISTRIBUTE_CLIENT_TRANSFER_CLIENT_REQUEST);
if (nextChannel != null) {
nextChannel.writeAndFlush(clientConnectTagetNettyProxyMsg);
}else {
log.error("eeeee");
}
}
}