[fix] 添加客户端渗透客户端流量记录

This commit is contained in:
wujiawei
2024-11-09 20:03:53 +08:00
parent dab6e580e4
commit 8952d2277f
9 changed files with 75 additions and 16 deletions

View File

@ -150,6 +150,8 @@ public class NettyClientPermeateClientRealSocket {
ChannelAttributeKeyUtils.buildVisitorId(transferChannel, visitorId);
ChannelAttributeKeyUtils.buildClientId(transferChannel, clientId);
ChannelAttributeKeyUtils.buildVisitorPort(transferChannel, visitorPort);
} else {

View File

@ -14,6 +14,7 @@ import org.framework.lazy.cloud.network.heartbeat.common.NettyVisitorPortContext
import org.framework.lazy.cloud.network.heartbeat.common.adapter.ChannelFlowAdapter;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.HandleChannelTypeAdvanced;
import org.framework.lazy.cloud.network.heartbeat.common.socket.PermeateVisitorSocket;
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
import java.util.List;
@ -72,9 +73,11 @@ public class NettyClientPermeateClientVisitorSocket implements PermeateVisitorSo
try {
bootstrap.bind(visitorPort).sync().addListener((ChannelFutureListener) future -> {
if (future.isSuccess()) {
Channel channel = future.channel();
ChannelAttributeKeyUtils.buildVisitorPort(channel,visitorPort);
// 这里时异步处理
log.info("客户端:[{}]访客端口:[{}] 开启", clientId, visitorPort);
NettyVisitorPortContext.pushVisitorChannel(visitorPort, future.channel());
NettyVisitorPortContext.pushVisitorChannel(visitorPort, channel);
} else {
log.error("客户端:[{}]访客端口:[{}]绑定失败", clientId, visitorPort);

View File

@ -13,6 +13,7 @@ import org.framework.lazy.cloud.network.heartbeat.common.NettyClientVisitorConte
import org.framework.lazy.cloud.network.heartbeat.common.NettyVisitorPortContext;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.HandleChannelTypeAdvanced;
import org.framework.lazy.cloud.network.heartbeat.common.socket.PermeateVisitorSocket;
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
import java.util.List;
@ -73,7 +74,8 @@ public class NettyClientPermeateServerVisitorSocket implements PermeateVisitorSo
if (future.isSuccess()) {
// 这里时异步处理
log.info("客户端:[{}]访客端口:[{}] 开启", clientId, visitorPort);
Channel channel = future.channel();
ChannelAttributeKeyUtils.buildVisitorPort(channel,visitorPort);
} else {
log.error("客户端:[{}]访客端口:[{}]绑定失败", clientId, visitorPort);
}