mirror of
https://gitee.com/wujiawei1207537021/wu-lazy-cloud-network.git
synced 2026-02-04 23:15:52 +08:00
[fix] 优化端口映射问题
This commit is contained in:
@@ -4,6 +4,11 @@ import io.netty.channel.Channel;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.flow.permeate.ChannelFlow;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.flow.permeate.HandleChannelFlowAdvanced;
|
||||
import org.framework.wu.framework.queue.Message;
|
||||
import org.framework.wu.framework.queue.MessageQueue;
|
||||
import org.framework.wu.framework.queue.MessageQueueFactory;
|
||||
import org.springframework.boot.CommandLineRunner;
|
||||
import org.wu.framework.core.utils.ObjectUtils;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.LinkedBlockingDeque;
|
||||
@@ -16,16 +21,16 @@ import java.util.concurrent.TimeUnit;
|
||||
* @see HandleChannelFlowAdvanced
|
||||
*/
|
||||
@Slf4j
|
||||
public class ChannelFlowAdapter {
|
||||
|
||||
public class ChannelFlowAdapter implements CommandLineRunner {
|
||||
|
||||
private static final String QUEUE_NAME = "channel_permeate_flow";
|
||||
ThreadPoolExecutor CHANNEL_FLOW_ADAPTER_EXECUTOR =
|
||||
new ThreadPoolExecutor(20, 200, 3L, TimeUnit.MINUTES,
|
||||
new LinkedBlockingDeque<>(500),new ThreadPoolExecutor.AbortPolicy());
|
||||
new ThreadPoolExecutor(10, 20, 3L, TimeUnit.MINUTES,
|
||||
new LinkedBlockingDeque<>(50), new ThreadPoolExecutor.AbortPolicy());
|
||||
// 线程使用完后使用主线程执行
|
||||
|
||||
|
||||
|
||||
MessageQueue queue = MessageQueueFactory.getQueue(QUEUE_NAME);
|
||||
protected final List<HandleChannelFlowAdvanced> handleChannelFlowAdvancedList;
|
||||
|
||||
public ChannelFlowAdapter(List<HandleChannelFlowAdvanced> handleChannelFlowAdvancedList) {
|
||||
@@ -56,8 +61,25 @@ public class ChannelFlowAdapter {
|
||||
* @param channelFlow 通道数据
|
||||
*/
|
||||
public void asyncHandler(Channel channel, ChannelFlow channelFlow) {
|
||||
// TODO 流量并发异常
|
||||
CHANNEL_FLOW_ADAPTER_EXECUTOR.submit(() -> handler(channel, channelFlow));
|
||||
// TODO 流量并发异常
|
||||
Message message = new Message("channel_permeate_flow_topic", channelFlow);
|
||||
// 消息发送到队列
|
||||
queue.send(message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(String... args) throws Exception {
|
||||
// 创建监听线程
|
||||
Thread thread = new Thread(() -> {
|
||||
while (true) {
|
||||
Message receive = queue.receive();
|
||||
if (ObjectUtils.isNotEmpty(receive)) {
|
||||
Object body = receive.getBody();
|
||||
handler(null, (ChannelFlow) body);
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
CHANNEL_FLOW_ADAPTER_EXECUTOR.submit(thread::start);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,8 +4,8 @@ import org.framework.lazy.cloud.network.heartbeat.common.adapter.ChannelFlowAdap
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.adapter.ChannelProxyFlowAdapter;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.flow.permeate.HandleChannelFlowAdvanced;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.flow.proxy.HandleChannelProxyFlowAdvanced;
|
||||
import org.framework.lazy.cloud.network.heartbeat.server.netty.flow.ServerHandlerInFlowHandler;
|
||||
import org.framework.lazy.cloud.network.heartbeat.server.netty.flow.ServerHandlerOutFlowHandler;
|
||||
import org.framework.lazy.cloud.network.heartbeat.server.netty.flow.permeate.ServerHandlerInPermeateFlowHandler;
|
||||
import org.framework.lazy.cloud.network.heartbeat.server.netty.flow.permeate.ServerHandlerOutPermeateFlowHandler;
|
||||
import org.framework.lazy.cloud.network.heartbeat.server.netty.flow.proxy.ServerHandlerInProxyFlowHandler;
|
||||
import org.framework.lazy.cloud.network.heartbeat.server.netty.flow.proxy.ServerHandlerOutProxyFlowHandler;
|
||||
import org.framework.lazy.cloud.network.heartbeat.server.properties.ServerNodeProperties;
|
||||
@@ -27,23 +27,23 @@ public class ServerFlowConfiguration {
|
||||
/**
|
||||
* 进口数据处理
|
||||
*
|
||||
* @return ServerHandlerInFlowHandler
|
||||
* @return ServerHandlerInPermeateFlowHandler
|
||||
*/
|
||||
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
|
||||
@Bean
|
||||
public ServerHandlerInFlowHandler serverHandlerInFlowHandler(LazyVisitorPortFlowApplication lazyVisitorPortFlowApplication, ServerNodeProperties serverNodeProperties) {
|
||||
return new ServerHandlerInFlowHandler(lazyVisitorPortFlowApplication, serverNodeProperties);
|
||||
public ServerHandlerInPermeateFlowHandler serverHandlerInFlowHandler(LazyVisitorPortFlowApplication lazyVisitorPortFlowApplication, ServerNodeProperties serverNodeProperties) {
|
||||
return new ServerHandlerInPermeateFlowHandler(lazyVisitorPortFlowApplication, serverNodeProperties);
|
||||
}
|
||||
|
||||
/**
|
||||
* 出口数据处理
|
||||
*
|
||||
* @return ServerHandlerOutFlowHandler
|
||||
* @return ServerHandlerOutPermeateFlowHandler
|
||||
*/
|
||||
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
|
||||
@Bean
|
||||
public ServerHandlerOutFlowHandler serverHandlerOutFlowHandler(LazyVisitorPortFlowApplication lazyVisitorPortFlowApplication, ServerNodeProperties serverNodeProperties) {
|
||||
return new ServerHandlerOutFlowHandler(lazyVisitorPortFlowApplication, serverNodeProperties);
|
||||
public ServerHandlerOutPermeateFlowHandler serverHandlerOutFlowHandler(LazyVisitorPortFlowApplication lazyVisitorPortFlowApplication, ServerNodeProperties serverNodeProperties) {
|
||||
return new ServerHandlerOutPermeateFlowHandler(lazyVisitorPortFlowApplication, serverNodeProperties);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.framework.lazy.cloud.network.heartbeat.server.netty.flow;
|
||||
package org.framework.lazy.cloud.network.heartbeat.server.netty.flow.permeate;
|
||||
|
||||
import io.netty.channel.Channel;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.flow.permeate.AbstractHandleChannelFlowAdvanced;
|
||||
@@ -11,11 +11,11 @@ import org.framework.lazy.cloud.network.heartbeat.server.standalone.application.
|
||||
/**
|
||||
* 进口流量处理
|
||||
*/
|
||||
public class ServerHandlerInFlowHandler extends AbstractHandleChannelFlowAdvanced {
|
||||
public class ServerHandlerInPermeateFlowHandler extends AbstractHandleChannelFlowAdvanced {
|
||||
private final LazyVisitorPortFlowApplication lazyVisitorPortFlowApplication;
|
||||
private final ServerNodeProperties serverNodeProperties;
|
||||
|
||||
public ServerHandlerInFlowHandler(LazyVisitorPortFlowApplication lazyVisitorPortFlowApplication, ServerNodeProperties serverNodeProperties) {
|
||||
public ServerHandlerInPermeateFlowHandler(LazyVisitorPortFlowApplication lazyVisitorPortFlowApplication, ServerNodeProperties serverNodeProperties) {
|
||||
this.lazyVisitorPortFlowApplication = lazyVisitorPortFlowApplication;
|
||||
this.serverNodeProperties = serverNodeProperties;
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.framework.lazy.cloud.network.heartbeat.server.netty.flow;
|
||||
package org.framework.lazy.cloud.network.heartbeat.server.netty.flow.permeate;
|
||||
|
||||
import io.netty.channel.Channel;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.flow.permeate.AbstractHandleChannelFlowAdvanced;
|
||||
@@ -11,11 +11,11 @@ import org.framework.lazy.cloud.network.heartbeat.server.standalone.application.
|
||||
/**
|
||||
* 出口流量处理
|
||||
*/
|
||||
public class ServerHandlerOutFlowHandler extends AbstractHandleChannelFlowAdvanced {
|
||||
public class ServerHandlerOutPermeateFlowHandler extends AbstractHandleChannelFlowAdvanced {
|
||||
private final LazyVisitorPortFlowApplication lazyVisitorPortFlowApplication;
|
||||
private final ServerNodeProperties serverNodeProperties;
|
||||
|
||||
public ServerHandlerOutFlowHandler(LazyVisitorPortFlowApplication lazyVisitorPortFlowApplication, ServerNodeProperties serverNodeProperties) {
|
||||
public ServerHandlerOutPermeateFlowHandler(LazyVisitorPortFlowApplication lazyVisitorPortFlowApplication, ServerNodeProperties serverNodeProperties) {
|
||||
this.lazyVisitorPortFlowApplication = lazyVisitorPortFlowApplication;
|
||||
this.serverNodeProperties = serverNodeProperties;
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.framework.lazy.cloud.network.heartbeat.server.netty.flow;
|
||||
package org.framework.lazy.cloud.network.heartbeat.server.netty.flow.permeate;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
@@ -7,7 +7,7 @@ import org.framework.lazy.cloud.network.heartbeat.common.enums.ChannelFlowEnum;
|
||||
|
||||
@Builder
|
||||
@Data
|
||||
public class ServerChannelFlow implements ChannelFlow {
|
||||
public class ServerPermeateChannelFlow implements ChannelFlow {
|
||||
private String clientId;
|
||||
private Integer port;
|
||||
private ChannelFlowEnum channelFlowEnum;
|
||||
@@ -10,7 +10,7 @@ import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyP
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.permeate.tcp.server.AbstractHandleTcpReportClientPermeateServerTransferTypeAdvanced;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.enums.ChannelFlowEnum;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
|
||||
import org.framework.lazy.cloud.network.heartbeat.server.netty.flow.ServerChannelFlow;
|
||||
import org.framework.lazy.cloud.network.heartbeat.server.netty.flow.permeate.ServerPermeateChannelFlow;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.context.annotation.Role;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -53,14 +53,14 @@ public class ServerHandleTcpReportClientPermeateServerTransferTypeAdvanced exten
|
||||
boolean success = channelFuture.isSuccess();
|
||||
log.debug("visitor writerAndFlush status: {}", success);
|
||||
// 记录进口数据
|
||||
ServerChannelFlow serverChannelFlow = ServerChannelFlow
|
||||
ServerPermeateChannelFlow serverPermeateChannelFlow = ServerPermeateChannelFlow
|
||||
.builder()
|
||||
.channelFlowEnum(ChannelFlowEnum.IN_FLOW)
|
||||
.port(visitorPort)
|
||||
.clientId(clientId)
|
||||
.flow(msg.getData().length)
|
||||
.build();
|
||||
channelFlowAdapter.asyncHandler(channel, serverChannelFlow);
|
||||
channelFlowAdapter.asyncHandler(channel, serverPermeateChannelFlow);
|
||||
}
|
||||
log.debug("客户端渗透服务端】访客ID:【{}】接收到客户端:[{}] 传输真实数据成功", new String(visitorId), clientId);
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import org.framework.lazy.cloud.network.heartbeat.common.advanced.permeate.tcp.s
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.constant.TcpMessageType;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.enums.ChannelFlowEnum;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
|
||||
import org.framework.lazy.cloud.network.heartbeat.server.netty.flow.ServerChannelFlow;
|
||||
import org.framework.lazy.cloud.network.heartbeat.server.netty.flow.permeate.ServerPermeateChannelFlow;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.context.annotation.Role;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -54,7 +54,7 @@ public class ServerHandleTcpReportClientTransferClientResponseTypeAdvanced exten
|
||||
|
||||
//记录出口流量
|
||||
ChannelFlowAdapter channelFlowAdapter = SpringContextHolder.getBean(ChannelFlowAdapter.class);
|
||||
ServerChannelFlow serverChannelFlow = ServerChannelFlow
|
||||
ServerPermeateChannelFlow serverPermeateChannelFlow = ServerPermeateChannelFlow
|
||||
.builder()
|
||||
.channelFlowEnum(ChannelFlowEnum.OUT_FLOW)
|
||||
.port(Integer.parseInt(new String(msgVisitorPort)))
|
||||
@@ -62,7 +62,7 @@ public class ServerHandleTcpReportClientTransferClientResponseTypeAdvanced exten
|
||||
.flow(clientConnectTagetNettyProxyMsg.getData().length)
|
||||
.build();
|
||||
|
||||
channelFlowAdapter.asyncHandler(channel, serverChannelFlow);
|
||||
channelFlowAdapter.asyncHandler(channel, serverPermeateChannelFlow);
|
||||
} else {
|
||||
log.error("can not find the client:【{}】 channel", clientId);
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import org.framework.lazy.cloud.network.heartbeat.common.advanced.permeate.tcp.s
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.constant.TcpMessageType;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.enums.ChannelFlowEnum;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
|
||||
import org.framework.lazy.cloud.network.heartbeat.server.netty.flow.ServerChannelFlow;
|
||||
import org.framework.lazy.cloud.network.heartbeat.server.netty.flow.permeate.ServerPermeateChannelFlow;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.context.annotation.Role;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -54,14 +54,14 @@ public class ServerHandleTcpReportClientTransferClientTypeAdvanced extends Abstr
|
||||
nextChannel.writeAndFlush(clientConnectTagetNettyProxyMsg);
|
||||
// 记录进口数据
|
||||
ChannelFlowAdapter channelFlowAdapter = SpringContextHolder.getBean(ChannelFlowAdapter.class);
|
||||
ServerChannelFlow serverChannelFlow = ServerChannelFlow
|
||||
ServerPermeateChannelFlow serverPermeateChannelFlow = ServerPermeateChannelFlow
|
||||
.builder()
|
||||
.channelFlowEnum(ChannelFlowEnum.IN_FLOW)
|
||||
.port(visitorPort)
|
||||
.clientId(clientId)
|
||||
.flow(clientConnectTagetNettyProxyMsg.getData().length)
|
||||
.build();
|
||||
channelFlowAdapter.asyncHandler(channel, serverChannelFlow);
|
||||
channelFlowAdapter.asyncHandler(channel, serverPermeateChannelFlow);
|
||||
} else {
|
||||
log.error("can not find the client:【{}】 channel", clientId);
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyP
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.permeate.tcp.server.AbstractHandleTcpReportServicePermeateClientTransferTypeAdvanced;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.enums.ChannelFlowEnum;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
|
||||
import org.framework.lazy.cloud.network.heartbeat.server.netty.flow.ServerChannelFlow;
|
||||
import org.framework.lazy.cloud.network.heartbeat.server.netty.flow.permeate.ServerPermeateChannelFlow;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.context.annotation.Role;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -57,14 +57,14 @@ public class ServerHandleTcpReportServicePermeateClientTransferTypeAdvanced exte
|
||||
boolean success = channelFuture.isSuccess();
|
||||
log.debug("visitor writerAndFlush status: {}", success);
|
||||
// 记录出口数据
|
||||
ServerChannelFlow serverChannelFlow = ServerChannelFlow
|
||||
ServerPermeateChannelFlow serverPermeateChannelFlow = ServerPermeateChannelFlow
|
||||
.builder()
|
||||
.channelFlowEnum(ChannelFlowEnum.OUT_FLOW)
|
||||
.port(visitorPort)
|
||||
.clientId(clientId)
|
||||
.flow(msg.getData().length)
|
||||
.build();
|
||||
channelFlowAdapter.asyncHandler(channel, serverChannelFlow);
|
||||
channelFlowAdapter.asyncHandler(channel, serverPermeateChannelFlow);
|
||||
}
|
||||
log.debug("访客ID:【{}】接收到客户端:[{}] 发送真实数据成功", new String(visitorId), clientId);
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyP
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.constant.TcpMessageType;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.enums.ChannelFlowEnum;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
|
||||
import org.framework.lazy.cloud.network.heartbeat.server.netty.flow.ServerChannelFlow;
|
||||
import org.framework.lazy.cloud.network.heartbeat.server.netty.flow.permeate.ServerPermeateChannelFlow;
|
||||
import org.wu.framework.spring.utils.SpringContextHolder;
|
||||
|
||||
/**
|
||||
@@ -53,14 +53,14 @@ public class NettyTcpClientPermeateServerRealHandler extends SimpleChannelInboun
|
||||
nextChannel.writeAndFlush(nettyMsg);
|
||||
ChannelFlowAdapter channelFlowAdapter = SpringContextHolder.getBean(ChannelFlowAdapter.class);
|
||||
// 记录出口数据
|
||||
ServerChannelFlow serverChannelFlow = ServerChannelFlow
|
||||
ServerPermeateChannelFlow serverPermeateChannelFlow = ServerPermeateChannelFlow
|
||||
.builder()
|
||||
.channelFlowEnum(ChannelFlowEnum.OUT_FLOW)
|
||||
.port(visitorPort)
|
||||
.clientId(clientId)
|
||||
.flow(nettyMsg.getData().length)
|
||||
.build();
|
||||
channelFlowAdapter.asyncHandler(channel, serverChannelFlow);
|
||||
channelFlowAdapter.asyncHandler(channel, serverPermeateChannelFlow);
|
||||
} else {
|
||||
log.error("we can not find next channel for transfer with client permeate server user client_id:{} ", clientId);
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyP
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.constant.TcpMessageType;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.enums.ChannelFlowEnum;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
|
||||
import org.framework.lazy.cloud.network.heartbeat.server.netty.flow.ServerChannelFlow;
|
||||
import org.framework.lazy.cloud.network.heartbeat.server.netty.flow.permeate.ServerPermeateChannelFlow;
|
||||
import org.wu.framework.core.utils.ObjectUtils;
|
||||
|
||||
import java.util.UUID;
|
||||
@@ -115,14 +115,14 @@ public class NettyTcpServerPermeateClientVisitorHandler extends SimpleChannelInb
|
||||
nettyProxyMsg.setData(bytes);
|
||||
nextChannel.writeAndFlush(nettyProxyMsg);
|
||||
// 处理访客流量
|
||||
ServerChannelFlow serverChannelFlow = ServerChannelFlow
|
||||
ServerPermeateChannelFlow serverPermeateChannelFlow = ServerPermeateChannelFlow
|
||||
.builder()
|
||||
.channelFlowEnum(ChannelFlowEnum.IN_FLOW)
|
||||
.port(visitorPort)
|
||||
.clientId(clientId)
|
||||
.flow(bytes.length)
|
||||
.build();
|
||||
channelFlowAdapter.asyncHandler(visitorChannel, serverChannelFlow);
|
||||
channelFlowAdapter.asyncHandler(visitorChannel, serverPermeateChannelFlow);
|
||||
log.debug("服务端访客端口成功发送数据了");
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ import org.framework.lazy.cloud.network.heartbeat.common.InternalNetworkServerPe
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.adapter.ChannelFlowAdapter;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.enums.ChannelFlowEnum;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
|
||||
import org.framework.lazy.cloud.network.heartbeat.server.netty.flow.ServerChannelFlow;
|
||||
import org.framework.lazy.cloud.network.heartbeat.server.netty.flow.permeate.ServerPermeateChannelFlow;
|
||||
import org.framework.lazy.cloud.network.heartbeat.server.netty.permeate.tcp.socket.NettyTcpServerPermeateServerConnectRealSocket;
|
||||
|
||||
import java.util.UUID;
|
||||
@@ -79,14 +79,14 @@ public class NettyTcpServerPermeateServerVisitorHandler extends SimpleChannelInb
|
||||
nextChannel.writeAndFlush(visitorBuf);
|
||||
|
||||
// 处理访客流量
|
||||
ServerChannelFlow serverChannelFlow = ServerChannelFlow
|
||||
ServerPermeateChannelFlow serverPermeateChannelFlow = ServerPermeateChannelFlow
|
||||
.builder()
|
||||
.clientId("server_id")
|
||||
.channelFlowEnum(ChannelFlowEnum.IN_FLOW)
|
||||
.port(visitorPort)
|
||||
.flow(bytes.length)
|
||||
.build();
|
||||
channelFlowAdapter.asyncHandler(visitorChannel, serverChannelFlow);
|
||||
channelFlowAdapter.asyncHandler(visitorChannel, serverPermeateChannelFlow);
|
||||
log.debug("服务端访客端口成功发送数据了");
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyP
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.permeate.udp.server.AbstractHandleUdpReportClientPermeateServerTransferTypeAdvanced;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.enums.ChannelFlowEnum;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
|
||||
import org.framework.lazy.cloud.network.heartbeat.server.netty.flow.ServerChannelFlow;
|
||||
import org.framework.lazy.cloud.network.heartbeat.server.netty.flow.permeate.ServerPermeateChannelFlow;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.context.annotation.Role;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -53,14 +53,14 @@ public class ServerHandleUdpReportClientPermeateServerTransferTypeAdvanced exten
|
||||
boolean success = channelFuture.isSuccess();
|
||||
log.debug("visitor writerAndFlush status: {}", success);
|
||||
// 记录进口数据
|
||||
ServerChannelFlow serverChannelFlow = ServerChannelFlow
|
||||
ServerPermeateChannelFlow serverPermeateChannelFlow = ServerPermeateChannelFlow
|
||||
.builder()
|
||||
.channelFlowEnum(ChannelFlowEnum.IN_FLOW)
|
||||
.port(visitorPort)
|
||||
.clientId(clientId)
|
||||
.flow(msg.getData().length)
|
||||
.build();
|
||||
channelFlowAdapter.asyncHandler(channel, serverChannelFlow);
|
||||
channelFlowAdapter.asyncHandler(channel, serverPermeateChannelFlow);
|
||||
}
|
||||
log.debug("客户端渗透服务端】访客ID:【{}】接收到客户端:[{}] 传输真实数据成功", new String(visitorId), clientId);
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import org.framework.lazy.cloud.network.heartbeat.common.advanced.permeate.udp.s
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.constant.TcpMessageType;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.enums.ChannelFlowEnum;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
|
||||
import org.framework.lazy.cloud.network.heartbeat.server.netty.flow.ServerChannelFlow;
|
||||
import org.framework.lazy.cloud.network.heartbeat.server.netty.flow.permeate.ServerPermeateChannelFlow;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.context.annotation.Role;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -56,7 +56,7 @@ public class ServerHandleUdpReportClientTransferClientResponseTypeAdvanced exten
|
||||
|
||||
//记录出口流量
|
||||
ChannelFlowAdapter channelFlowAdapter = SpringContextHolder.getBean(ChannelFlowAdapter.class);
|
||||
ServerChannelFlow serverChannelFlow = ServerChannelFlow
|
||||
ServerPermeateChannelFlow serverPermeateChannelFlow = ServerPermeateChannelFlow
|
||||
.builder()
|
||||
.channelFlowEnum(ChannelFlowEnum.OUT_FLOW)
|
||||
.port(Integer.parseInt(new String(msgVisitorPort)))
|
||||
@@ -64,7 +64,7 @@ public class ServerHandleUdpReportClientTransferClientResponseTypeAdvanced exten
|
||||
.flow(clientConnectTagetNettyProxyMsg.getData().length)
|
||||
.build();
|
||||
|
||||
channelFlowAdapter.asyncHandler(channel, serverChannelFlow);
|
||||
channelFlowAdapter.asyncHandler(channel, serverPermeateChannelFlow);
|
||||
} else {
|
||||
log.error("can not find the client:【{}】 nettyChannelContext", clientId);
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import org.framework.lazy.cloud.network.heartbeat.common.advanced.permeate.udp.s
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.constant.TcpMessageType;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.enums.ChannelFlowEnum;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
|
||||
import org.framework.lazy.cloud.network.heartbeat.server.netty.flow.ServerChannelFlow;
|
||||
import org.framework.lazy.cloud.network.heartbeat.server.netty.flow.permeate.ServerPermeateChannelFlow;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.context.annotation.Role;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -54,14 +54,14 @@ public class ServerHandleUdpReportClientTransferClientTypeAdvanced extends Abstr
|
||||
nextChannel.writeAndFlush(clientConnectTagetNettyProxyMsg);
|
||||
// 记录进口数据
|
||||
ChannelFlowAdapter channelFlowAdapter = SpringContextHolder.getBean(ChannelFlowAdapter.class);
|
||||
ServerChannelFlow serverChannelFlow = ServerChannelFlow
|
||||
ServerPermeateChannelFlow serverPermeateChannelFlow = ServerPermeateChannelFlow
|
||||
.builder()
|
||||
.channelFlowEnum(ChannelFlowEnum.IN_FLOW)
|
||||
.port(visitorPort)
|
||||
.clientId(clientId)
|
||||
.flow(clientConnectTagetNettyProxyMsg.getData().length)
|
||||
.build();
|
||||
channelFlowAdapter.asyncHandler(channel, serverChannelFlow);
|
||||
channelFlowAdapter.asyncHandler(channel, serverPermeateChannelFlow);
|
||||
} else {
|
||||
log.error("can not find the client:【{}】 nettyChannelContext", clientId);
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyP
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.permeate.udp.server.AbstractHandleUdpReportServicePermeateClientTransferTypeAdvanced;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.enums.ChannelFlowEnum;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
|
||||
import org.framework.lazy.cloud.network.heartbeat.server.netty.flow.ServerChannelFlow;
|
||||
import org.framework.lazy.cloud.network.heartbeat.server.netty.flow.permeate.ServerPermeateChannelFlow;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.context.annotation.Role;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -57,14 +57,14 @@ public class ServerHandleUdpReportServicePermeateClientTransferTypeAdvanced exte
|
||||
boolean success = channelFuture.isSuccess();
|
||||
log.debug("visitor writerAndFlush status: {}", success);
|
||||
// 记录出口数据
|
||||
ServerChannelFlow serverChannelFlow = ServerChannelFlow
|
||||
ServerPermeateChannelFlow serverPermeateChannelFlow = ServerPermeateChannelFlow
|
||||
.builder()
|
||||
.channelFlowEnum(ChannelFlowEnum.OUT_FLOW)
|
||||
.port(visitorPort)
|
||||
.clientId(clientId)
|
||||
.flow(msg.getData().length)
|
||||
.build();
|
||||
channelFlowAdapter.asyncHandler(channel, serverChannelFlow);
|
||||
channelFlowAdapter.asyncHandler(channel, serverPermeateChannelFlow);
|
||||
}
|
||||
log.debug("访客ID:【{}】接收到客户端:[{}] 发送真实数据成功", new String(visitorId), clientId);
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyP
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.constant.TcpMessageType;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.enums.ChannelFlowEnum;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
|
||||
import org.framework.lazy.cloud.network.heartbeat.server.netty.flow.ServerChannelFlow;
|
||||
import org.framework.lazy.cloud.network.heartbeat.server.netty.flow.permeate.ServerPermeateChannelFlow;
|
||||
import org.wu.framework.spring.utils.SpringContextHolder;
|
||||
|
||||
/**
|
||||
@@ -53,14 +53,14 @@ public class NettyUdpClientPermeateServerRealHandler extends SimpleChannelInboun
|
||||
nextChannel.writeAndFlush(nettyMsg);
|
||||
ChannelFlowAdapter channelFlowAdapter = SpringContextHolder.getBean(ChannelFlowAdapter.class);
|
||||
// 记录出口数据
|
||||
ServerChannelFlow serverChannelFlow = ServerChannelFlow
|
||||
ServerPermeateChannelFlow serverPermeateChannelFlow = ServerPermeateChannelFlow
|
||||
.builder()
|
||||
.channelFlowEnum(ChannelFlowEnum.OUT_FLOW)
|
||||
.port(visitorPort)
|
||||
.clientId(clientId)
|
||||
.flow(nettyMsg.getData().length)
|
||||
.build();
|
||||
channelFlowAdapter.asyncHandler(channel, serverChannelFlow);
|
||||
channelFlowAdapter.asyncHandler(channel, serverPermeateChannelFlow);
|
||||
} else {
|
||||
log.error("we can not find next channel for transfer with client permeate server user client_id:{} ", clientId);
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyP
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.constant.TcpMessageType;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.enums.ChannelFlowEnum;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
|
||||
import org.framework.lazy.cloud.network.heartbeat.server.netty.flow.ServerChannelFlow;
|
||||
import org.framework.lazy.cloud.network.heartbeat.server.netty.flow.permeate.ServerPermeateChannelFlow;
|
||||
import org.wu.framework.core.utils.ObjectUtils;
|
||||
|
||||
import java.util.UUID;
|
||||
@@ -113,14 +113,14 @@ public class NettyUdpServerPermeateClientVisitorHandler extends SimpleChannelInb
|
||||
nettyProxyMsg.setData(bytes);
|
||||
nextChannel.writeAndFlush(nettyProxyMsg);
|
||||
// 处理访客流量
|
||||
ServerChannelFlow serverChannelFlow = ServerChannelFlow
|
||||
ServerPermeateChannelFlow serverPermeateChannelFlow = ServerPermeateChannelFlow
|
||||
.builder()
|
||||
.channelFlowEnum(ChannelFlowEnum.IN_FLOW)
|
||||
.port(visitorPort)
|
||||
.clientId(clientId)
|
||||
.flow(bytes.length)
|
||||
.build();
|
||||
channelFlowAdapter.asyncHandler(visitorChannel, serverChannelFlow);
|
||||
channelFlowAdapter.asyncHandler(visitorChannel, serverPermeateChannelFlow);
|
||||
log.debug("服务端访客端口成功发送数据了");
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ import org.framework.lazy.cloud.network.heartbeat.common.InternalNetworkServerPe
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.adapter.ChannelFlowAdapter;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.enums.ChannelFlowEnum;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
|
||||
import org.framework.lazy.cloud.network.heartbeat.server.netty.flow.ServerChannelFlow;
|
||||
import org.framework.lazy.cloud.network.heartbeat.server.netty.flow.permeate.ServerPermeateChannelFlow;
|
||||
import org.framework.lazy.cloud.network.heartbeat.server.netty.permeate.udp.socket.NettyUdpServerPermeateServerConnectRealSocket;
|
||||
|
||||
import java.util.UUID;
|
||||
@@ -79,14 +79,14 @@ public class NettyUdpServerPermeateServerVisitorHandler extends SimpleChannelInb
|
||||
nextChannel.writeAndFlush(visitorBuf);
|
||||
|
||||
// 处理访客流量
|
||||
ServerChannelFlow serverChannelFlow = ServerChannelFlow
|
||||
ServerPermeateChannelFlow serverPermeateChannelFlow = ServerPermeateChannelFlow
|
||||
.builder()
|
||||
.clientId("server_id")
|
||||
.channelFlowEnum(ChannelFlowEnum.IN_FLOW)
|
||||
.port(visitorPort)
|
||||
.flow(bytes.length)
|
||||
.build();
|
||||
channelFlowAdapter.asyncHandler(visitorChannel, serverChannelFlow);
|
||||
channelFlowAdapter.asyncHandler(visitorChannel, serverPermeateChannelFlow);
|
||||
log.debug("服务端访客端口成功发送数据了");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user