mirror of
https://gitee.com/wujiawei1207537021/wu-lazy-cloud-network.git
synced 2025-06-17 02:45:03 +08:00
【fix】服务端内网渗透
This commit is contained in:
@ -0,0 +1,46 @@
|
||||
package org.framework.lazy.cloud.network.heartbeat.common;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
* 渗透端口对应访客上下文
|
||||
*/
|
||||
public class NettyPermeateVisitorContext {
|
||||
|
||||
protected static final ConcurrentHashMap<Integer/*permeatePort*/, Object/*NettyPermeateVisitorSocket*/> PERMEATE_VISITOR_SOCKET = new ConcurrentHashMap<>();
|
||||
|
||||
|
||||
/**
|
||||
* 添加访客
|
||||
*
|
||||
* @param permeatePort 渗透端口
|
||||
* @param permeateVisitorSocket 渗透访客socket
|
||||
*/
|
||||
public static <T> void pushPermeateVisitorSocket(Integer permeatePort, T permeateVisitorSocket) {
|
||||
PERMEATE_VISITOR_SOCKET.put(permeatePort, permeateVisitorSocket);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通过客户端ID获取客户端使用的访客socket
|
||||
*
|
||||
* @param <T> 渗透访客socket
|
||||
* @param permeatePort 渗透端口
|
||||
* @return 访客
|
||||
*/
|
||||
public static <T> T getPermeateVisitorSocket(Integer permeatePort) {
|
||||
return (T) PERMEATE_VISITOR_SOCKET.getOrDefault(permeatePort, null);
|
||||
}
|
||||
/**
|
||||
* 移除 渗透访客socket
|
||||
*
|
||||
* @param permeatePort 渗透端口
|
||||
*/
|
||||
public static void removePermeateVisitorSockets(Integer permeatePort) {
|
||||
PERMEATE_VISITOR_SOCKET.remove(permeatePort);
|
||||
}
|
||||
|
||||
|
||||
}
|
Reference in New Issue
Block a user