【fix】添加虚拟路由管理

This commit is contained in:
wujiawei 2025-05-07 11:09:19 +08:00
parent 965142793c
commit 96929044fa
37 changed files with 356 additions and 157 deletions

View File

@ -352,12 +352,20 @@ public class ClientAutoConfiguration {
public ClientHandleDistributeHttpClientProxyServerServerRouteTypeAdvanced clientHandleDistributeHttpClientProxyServerServerRouteTypeAdvanced() {
return new ClientHandleDistributeHttpClientProxyServerServerRouteTypeAdvanced();
}
@Bean
public ClientHandleDistributeHttpClientProxyServerServerRouteCloseTypeAdvanced clientHandleDistributeHttpClientProxyServerServerRouteCloseTypeAdvanced(){
return new ClientHandleDistributeHttpClientProxyServerServerRouteCloseTypeAdvanced();
}
@Bean
public ClientHandleDistributeHttpClientProxyServerClientRouteTypeAdvanced clientHandleDistributeHttpClientProxyServerClientRouteTypeAdvanced() {
return new ClientHandleDistributeHttpClientProxyServerClientRouteTypeAdvanced();
}
@Bean
public ClientHandleDistributeHttpClientProxyServerClientRouteCloseTypeAdvanced clientHandleDistributeHttpClientProxyServerClientRouteCloseTypeAdvanced(){
return new ClientHandleDistributeHttpClientProxyServerClientRouteCloseTypeAdvanced();
}
@Bean
public ClientHandleDistributeHttpClientProxyClientConnectionTransferSuccessfulAdvanced clientHandleDistributeHttpClientProxyClientConnectionTransferSuccessfulAdvanced() {
return new ClientHandleDistributeHttpClientProxyClientConnectionTransferSuccessfulAdvanced();

View File

@ -0,0 +1,37 @@
package org.framework.lazy.cloud.network.heartbeat.client.netty.proxy.http.advanced;
import com.alibaba.fastjson.JSON;
import lombok.extern.slf4j.Slf4j;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyChannelContext;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.proxy.http.client.AbstractHandleHttpDistributeClientProxyServerClientRouteCloseTypeAdvanced;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.proxy.http.client.AbstractHandleHttpDistributeClientProxyServerClientRouteTypeAdvanced;
import org.framework.lazy.cloud.network.heartbeat.protocol.route.ClientProxyRoute;
import org.framework.lazy.cloud.network.heartbeat.protocol.route.RouteContext;
import org.framework.lazy.cloud.network.heartbeat.protocol.route.RouteType;
@Slf4j
public class ClientHandleDistributeHttpClientProxyServerClientRouteCloseTypeAdvanced extends
AbstractHandleHttpDistributeClientProxyServerClientRouteCloseTypeAdvanced<NettyProxyMsg> {
/**
* 处理当前数据
*
* @param nettyChannelContext 当前通道
* @param nettyProxyMsg 通道数据
*/
@Override
protected void doHandler(NettyChannelContext nettyChannelContext, NettyProxyMsg nettyProxyMsg) {
byte[] data = nettyProxyMsg.getData();
ClientProxyRoute clientProxyRoute = JSON.parseObject(data, ClientProxyRoute.class);
RouteType routeType = clientProxyRoute.getRouteType();
String virtualIp = clientProxyRoute.getVirtualIp();
String virtualPort = clientProxyRoute.getVirtualPort();
RouteContext.removeRoute(virtualIp,virtualPort,routeType);
}
}

View File

@ -0,0 +1,37 @@
package org.framework.lazy.cloud.network.heartbeat.client.netty.proxy.http.advanced;
import com.alibaba.fastjson.JSON;
import lombok.extern.slf4j.Slf4j;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyChannelContext;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.proxy.http.client.AbstractHandleHttpDistributeClientProxyServerServerRouteCloseTypeAdvanced;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.proxy.http.client.AbstractHandleHttpDistributeClientProxyServerServerRouteTypeAdvanced;
import org.framework.lazy.cloud.network.heartbeat.protocol.route.RouteContext;
import org.framework.lazy.cloud.network.heartbeat.protocol.route.RouteType;
import org.framework.lazy.cloud.network.heartbeat.protocol.route.ServerProxyRoute;
@Slf4j
public class ClientHandleDistributeHttpClientProxyServerServerRouteCloseTypeAdvanced extends
AbstractHandleHttpDistributeClientProxyServerServerRouteCloseTypeAdvanced<NettyProxyMsg> {
/**
* 处理当前数据
*
* @param nettyChannelContext 当前通道
* @param nettyProxyMsg 通道数据
*/
@Override
protected void doHandler(NettyChannelContext nettyChannelContext, NettyProxyMsg nettyProxyMsg) {
byte[] data = nettyProxyMsg.getData();
ServerProxyRoute serverProxyRoute = JSON.parseObject(data, ServerProxyRoute.class);
RouteType routeType = serverProxyRoute.getRouteType();
String virtualIp = serverProxyRoute.getVirtualIp();
String virtualPort = serverProxyRoute.getVirtualPort();
RouteContext.removeRoute(virtualIp,virtualPort,routeType);
}
}

View File

@ -0,0 +1,21 @@
package org.framework.lazy.cloud.network.heartbeat.common.advanced.proxy.http.client;
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.advanced.payload.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.enums.ProxyMessageTypeEnums;
public abstract class AbstractHandleHttpDistributeClientProxyServerClientRouteCloseTypeAdvanced<MSG> extends AbstractHandleChannelTypeAdvanced<NettyProxyMsg> implements HandleChannelTypeAdvanced {
/**
* 是否支持当前类型
*
* @param nettyProxyMsg 通道数据
* @return 布尔类型
*/
@Override
protected boolean doSupport(NettyProxyMsg nettyProxyMsg) {
return ProxyMessageTypeEnums.HTTP_DISTRIBUTE_CLIENT_PROXY_SERVER_CLIENT_ROUTE_.getTypeByte() == nettyProxyMsg.getType();
}
}

View File

@ -0,0 +1,21 @@
package org.framework.lazy.cloud.network.heartbeat.common.advanced.proxy.http.client;
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.advanced.payload.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.enums.ProxyMessageTypeEnums;
public abstract class AbstractHandleHttpDistributeClientProxyServerServerRouteCloseTypeAdvanced<MSG> extends AbstractHandleChannelTypeAdvanced<NettyProxyMsg> implements HandleChannelTypeAdvanced {
/**
* 是否支持当前类型
*
* @param nettyProxyMsg 通道数据
* @return 布尔类型
*/
@Override
protected boolean doSupport(NettyProxyMsg nettyProxyMsg) {
return ProxyMessageTypeEnums.HTTP_DISTRIBUTE_CLIENT_PROXY_SERVER_SERVER_ROUTE_.getTypeByte() == nettyProxyMsg.getType();
}
}

View File

@ -253,6 +253,13 @@ public class ProxyMessageType {
* @see AbstractHandleHttpDistributeClientProxyServerServerRouteTypeAdvanced
*/
public static final byte HTTP_DISTRIBUTE_CLIENT_PROXY_SERVER_SERVER_ROUTE_ = HTTP_DISTRIBUTE_PROXY - 1;
/**
* 下发服务端路由关闭
*
* @see ProxyMessageTypeEnums#HTTP_DISTRIBUTE_CLIENT_PROXY_SERVER_SERVER_ROUTE_CLOSE_
* @see AbstractHandleHttpDistributeClientProxyServerServerRouteCloseTypeAdvanced
*/
public static final byte HTTP_DISTRIBUTE_CLIENT_PROXY_SERVER_SERVER_ROUTE_CLOSE_ = HTTP_DISTRIBUTE_CLIENT_PROXY_SERVER_SERVER_ROUTE_ - 1;
/**
@ -261,7 +268,15 @@ public class ProxyMessageType {
* @see ProxyMessageTypeEnums#HTTP_DISTRIBUTE_CLIENT_PROXY_SERVER_CLIENT_ROUTE_
* @see AbstractHandleHttpDistributeClientProxyServerClientRouteTypeAdvanced
*/
public static final byte HTTP_DISTRIBUTE_CLIENT_PROXY_SERVER_CLIENT_ROUTE_ = HTTP_DISTRIBUTE_CLIENT_PROXY_SERVER_SERVER_ROUTE_ - 1;
public static final byte HTTP_DISTRIBUTE_CLIENT_PROXY_SERVER_CLIENT_ROUTE_ = HTTP_DISTRIBUTE_CLIENT_PROXY_SERVER_SERVER_ROUTE_CLOSE_ - 1;
/**
* 下发客户端路由关闭
*
* @see ProxyMessageTypeEnums#HTTP_DISTRIBUTE_CLIENT_PROXY_SERVER_CLIENT_ROUTE_CLOSE_
* @see AbstractHandleHttpDistributeClientProxyServerClientRouteCloseTypeAdvanced
*/
public static final byte HTTP_DISTRIBUTE_CLIENT_PROXY_SERVER_CLIENT_ROUTE_CLOSE_ = HTTP_DISTRIBUTE_CLIENT_PROXY_SERVER_CLIENT_ROUTE_ - 1;
/**
@ -270,7 +285,7 @@ public class ProxyMessageType {
* @see ProxyMessageTypeEnums#HTTP_DISTRIBUTE_SERVER_PROXY_CLIENT_CONNECTION_SUCCESSFUL_
* @see AbstractHandleHttpDistributeServerProxyClientConnectionSuccessfulTypeAdvanced
*/
public static final byte HTTP_DISTRIBUTE_SERVER_PROXY_CLIENT_CONNECTION_SUCCESSFUL_ = HTTP_DISTRIBUTE_CLIENT_PROXY_SERVER_CLIENT_ROUTE_ - 1;
public static final byte HTTP_DISTRIBUTE_SERVER_PROXY_CLIENT_CONNECTION_SUCCESSFUL_ = HTTP_DISTRIBUTE_CLIENT_PROXY_SERVER_CLIENT_ROUTE_CLOSE_ - 1;
/**
* http 下发数据到另一个客户端

View File

@ -58,12 +58,26 @@ public enum ProxyMessageTypeEnums {
* @see AbstractHandleHttpDistributeClientProxyServerServerRouteTypeAdvanced
*/
HTTP_DISTRIBUTE_CLIENT_PROXY_SERVER_SERVER_ROUTE_(ProxyMessageType.HTTP_DISTRIBUTE_CLIENT_PROXY_SERVER_SERVER_ROUTE_, "http下发服务端路由"),
/**
* 下发服务端路由关闭
*
* @see ProxyMessageTypeEnums#HTTP_DISTRIBUTE_CLIENT_PROXY_SERVER_SERVER_ROUTE_CLOSE_
* @see AbstractHandleHttpDistributeClientProxyServerServerRouteCloseTypeAdvanced
*/
HTTP_DISTRIBUTE_CLIENT_PROXY_SERVER_SERVER_ROUTE_CLOSE_(ProxyMessageType.HTTP_DISTRIBUTE_CLIENT_PROXY_SERVER_SERVER_ROUTE_CLOSE_, "下发服务端路由关闭"),
/**
* http 下发客户端路由
*
* @see AbstractHandleHttpDistributeClientProxyServerClientRouteTypeAdvanced
*/
HTTP_DISTRIBUTE_CLIENT_PROXY_SERVER_CLIENT_ROUTE_(ProxyMessageType.HTTP_DISTRIBUTE_CLIENT_PROXY_SERVER_CLIENT_ROUTE_, "http下发客户端路由"),
/**
* 下发客户端路由关闭
*
* @see ProxyMessageTypeEnums#HTTP_DISTRIBUTE_CLIENT_PROXY_SERVER_CLIENT_ROUTE_CLOSE_
* @see AbstractHandleHttpDistributeClientProxyServerClientRouteCloseTypeAdvanced
*/
HTTP_DISTRIBUTE_CLIENT_PROXY_SERVER_CLIENT_ROUTE_CLOSE_(ProxyMessageType.HTTP_DISTRIBUTE_CLIENT_PROXY_SERVER_CLIENT_ROUTE_CLOSE_, "下发客户端路由关闭"),
/**
* http 客户端远程客户端代理传输连接
*

View File

@ -1,5 +1,7 @@
package org.framework.lazy.cloud.network.heartbeat.protocol.route;
import org.wu.framework.core.NormalUsedString;
import java.util.concurrent.ConcurrentHashMap;
/**
@ -12,11 +14,16 @@ public class RouteContext {
private static final ConcurrentHashMap<String, ProxyRoute> m = new ConcurrentHashMap<>();
/**
* 设置路由
*
* @param route 路由
*/
public static void setRoute(ProxyRoute route) {
RouteType routeType = route.getRouteType();
String virtualIp = route.getVirtualIp();
String virtualPort = route.getVirtualPort();
String key = virtualIp + ":" + virtualPort + routeType;
String key = virtualIp + ":" + virtualPort + "_" + routeType;
if (m.containsKey(key)) {
return;
}
@ -24,12 +31,32 @@ public class RouteContext {
m.put(key, route);
}
public static ProxyRoute getRoute(String ip, String port) {
/**
* 获取路由
*
* @param virtualIp 原始ip
* @param virtualPort 原始端口
*/
public static ProxyRoute getRoute(String virtualIp, String virtualPort) {
ProxyRoute p = m.values()
.stream()
.filter(route -> route.getVirtualIp().equals(ip) && (route.getVirtualPort().equals(port) || route.getVirtualPort().equals("ALL")))
.filter(route -> route.getVirtualIp().equals(virtualIp)
&&
(route.getVirtualPort().equals(virtualPort) || route.getVirtualPort().equals(NormalUsedString.ASTERISK)))
.findFirst()
.orElse(null);
return p;
}
/**
* 删除路由
*
* @param virtualIp 原始ip
* @param virtualPort 原始端口
*/
public static void removeRoute(String virtualIp, String virtualPort, RouteType routeType) {
String key = virtualIp + ":" + virtualPort + "_" + routeType;
m.remove(key);
}
}

View File

@ -18,13 +18,10 @@ import org.framework.lazy.cloud.network.heartbeat.server.properties.ServerNodePr
import org.framework.lazy.cloud.network.heartbeat.server.standalone.application.*;
import org.framework.lazy.cloud.network.heartbeat.server.standalone.application.command.lazy.netty.client.permeate.client.mapping.LazyClientPermeateClientMappingQueryListCommand;
import org.framework.lazy.cloud.network.heartbeat.server.standalone.application.command.lazy.netty.client.permeate.server.mapping.LazyClientPermeateServerMappingQueryListCommand;
import org.framework.lazy.cloud.network.heartbeat.server.standalone.application.command.lazy.netty.client.route.LazyNettyClientRouteQueryListCommand;
import org.framework.lazy.cloud.network.heartbeat.server.standalone.application.command.lazy.netty.client.state.LazyNettyClientLoginCommand;
import org.framework.lazy.cloud.network.heartbeat.server.standalone.application.command.lazy.netty.server.route.LazyNettyServerRouteQueryListCommand;
import org.framework.lazy.cloud.network.heartbeat.server.standalone.application.dto.LazyClientPermeateClientMappingDTO;
import org.framework.lazy.cloud.network.heartbeat.server.standalone.application.dto.LazyClientPermeateServerMappingDTO;
import org.framework.lazy.cloud.network.heartbeat.server.standalone.application.dto.LazyNettyClientRouteDTO;
import org.framework.lazy.cloud.network.heartbeat.server.standalone.application.dto.LazyNettyServerRouteDTO;
import org.framework.lazy.cloud.network.heartbeat.server.standalone.application.command.lazy.netty.client.virtual.route.LazyNettyClientVirtualRouteQueryListCommand;
import org.framework.lazy.cloud.network.heartbeat.server.standalone.application.command.lazy.netty.server.virtual.route.LazyNettyServerVirtualRouteQueryListCommand;
import org.framework.lazy.cloud.network.heartbeat.server.standalone.application.dto.*;
import org.framework.lazy.cloud.network.heartbeat.server.standalone.domain.model.lazy.netty.client.blacklist.LazyNettyClientBlacklist;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.Role;
@ -50,20 +47,20 @@ public class ServerHandleTcpClientConnectSuccessTypeAdvanced extends AbstractHan
private final LazyClientPermeateServerMappingApplication lazyClientPermeateServerMappingApplication;
private final LazyClientPermeateClientMappingApplication lazyClientPermeateClientMappingApplication;
private final LazyNettyServerRouteApplication lazyNettyServerRouteApplication;
private final LazyNettyClientRouteApplication lazyNettyClientRouteApplication;
private final LazyNettyServerVirtualRouteApplication lazyNettyServerVirtualRouteApplication;
private final LazyNettyClientVirtualRouteApplication lazyNettyClientVirtualRouteApplication;
private final LazyNettyClientTokenBucketApplication lazyNettyClientTokenBucketApplication;
private final ServerNodeProperties serverNodeProperties;
public ServerHandleTcpClientConnectSuccessTypeAdvanced(LazyClientStatsChangeApplication lazyClientStatsChangeApplication, LazyNettyClientBlacklistApplication lazyNettyClientBlacklistApplication, LazyServerPermeateClientMappingApplication lazyServerPermeateClientMappingApplication, LazyClientPermeateServerMappingApplication lazyClientPermeateServerMappingApplication, LazyClientPermeateClientMappingApplication lazyClientPermeateClientMappingApplication, LazyNettyServerRouteApplication lazyNettyServerRouteApplication, LazyNettyClientRouteApplication lazyNettyClientRouteApplication, LazyNettyClientTokenBucketApplication lazyNettyClientTokenBucketApplication, ServerNodeProperties serverNodeProperties) {
public ServerHandleTcpClientConnectSuccessTypeAdvanced(LazyClientStatsChangeApplication lazyClientStatsChangeApplication, LazyNettyClientBlacklistApplication lazyNettyClientBlacklistApplication, LazyServerPermeateClientMappingApplication lazyServerPermeateClientMappingApplication, LazyClientPermeateServerMappingApplication lazyClientPermeateServerMappingApplication, LazyClientPermeateClientMappingApplication lazyClientPermeateClientMappingApplication, LazyNettyServerVirtualRouteApplication lazyNettyServerVirtualRouteApplication, LazyNettyClientVirtualRouteApplication lazyNettyClientVirtualRouteApplication, LazyNettyClientTokenBucketApplication lazyNettyClientTokenBucketApplication, ServerNodeProperties serverNodeProperties) {
this.lazyClientStatsChangeApplication = lazyClientStatsChangeApplication;
this.lazyNettyClientBlacklistApplication = lazyNettyClientBlacklistApplication;
this.lazyServerPermeateClientMappingApplication = lazyServerPermeateClientMappingApplication;
this.lazyClientPermeateServerMappingApplication = lazyClientPermeateServerMappingApplication;
this.lazyClientPermeateClientMappingApplication = lazyClientPermeateClientMappingApplication;
this.lazyNettyServerRouteApplication = lazyNettyServerRouteApplication;
this.lazyNettyClientRouteApplication = lazyNettyClientRouteApplication;
this.lazyNettyServerVirtualRouteApplication = lazyNettyServerVirtualRouteApplication;
this.lazyNettyClientVirtualRouteApplication = lazyNettyClientVirtualRouteApplication;
this.lazyNettyClientTokenBucketApplication = lazyNettyClientTokenBucketApplication;
this.serverNodeProperties = serverNodeProperties;
}
@ -190,17 +187,21 @@ public class ServerHandleTcpClientConnectSuccessTypeAdvanced extends AbstractHan
}
});
// 下发服务端路由
LazyNettyServerRouteQueryListCommand lazyNettyServerRouteQueryListCommand = new LazyNettyServerRouteQueryListCommand();
lazyNettyServerRouteQueryListCommand.setIsDeleted(false);
lazyNettyServerRouteApplication.findList(lazyNettyServerRouteQueryListCommand)
.accept(lazyNettyServerRouteDTOS -> {
for (LazyNettyServerRouteDTO lazyNettyServerRouteDTO : lazyNettyServerRouteDTOS) {
String routeIp = lazyNettyServerRouteDTO.getRouteIp();
String routePort = lazyNettyServerRouteDTO.getRoutePort();
LazyNettyServerVirtualRouteQueryListCommand lazyNettyServerVirtualRouteQueryListCommand = new LazyNettyServerVirtualRouteQueryListCommand();
lazyNettyServerVirtualRouteQueryListCommand.setIsDeleted(false);
lazyNettyServerVirtualRouteApplication.findList(lazyNettyServerVirtualRouteQueryListCommand)
.accept(lazyNettyServerVirtualRouteDTOS -> {
for (LazyNettyServerVirtualRouteDTO lazyNettyServerVirtualRouteDTO : lazyNettyServerVirtualRouteDTOS) {
String virtualIp = lazyNettyServerVirtualRouteDTO.getVirtualIp();
String virtualPort = lazyNettyServerVirtualRouteDTO.getVirtualPort();
String targetIp = lazyNettyServerVirtualRouteDTO.getTargetIp();
String targetPort = lazyNettyServerVirtualRouteDTO.getTargetPort();
ServerProxyRoute serverProxyRoute = new ServerProxyRoute();
serverProxyRoute.setServerIp("default");
serverProxyRoute.setAllowIp(routeIp);
serverProxyRoute.setAllowPort(routePort);
serverProxyRoute.setVirtualIp(virtualIp);
serverProxyRoute.setVirtualPort(virtualPort);
serverProxyRoute.setTargetIp(targetIp);
serverProxyRoute.setTargetPort(targetPort);
serverProxyRoute.setRouteType(RouteType.CLIENT_PROXY_SEVER);
NettyProxyMsg nettyMsg = new NettyProxyMsg();
nettyMsg.setType(ProxyMessageType.HTTP_DISTRIBUTE_CLIENT_PROXY_SERVER_SERVER_ROUTE_);
@ -212,18 +213,26 @@ public class ServerHandleTcpClientConnectSuccessTypeAdvanced extends AbstractHan
// 下发客户端路由
LazyNettyClientRouteQueryListCommand lazyNettyClientRouteQueryListCommand = new LazyNettyClientRouteQueryListCommand();
lazyNettyClientRouteQueryListCommand.setIsDeleted(false);
lazyNettyClientRouteApplication.findList(lazyNettyClientRouteQueryListCommand)
.accept(lazyNettyClientRouteDTOList -> {
for (LazyNettyClientRouteDTO lazyNettyClientRouteDTO : lazyNettyClientRouteDTOList) {
String routeIp = lazyNettyClientRouteDTO.getRouteIp();
String routePort = lazyNettyClientRouteDTO.getRoutePort();
String routeClientId = lazyNettyClientRouteDTO.getClientId();
LazyNettyClientVirtualRouteQueryListCommand lazyNettyClientVirtualRouteQueryListCommand =
new LazyNettyClientVirtualRouteQueryListCommand();
lazyNettyClientVirtualRouteQueryListCommand.setIsDeleted(false);
lazyNettyClientVirtualRouteApplication.findList(lazyNettyClientVirtualRouteQueryListCommand)
.accept(lazyNettyClientVirtualRouteDTOList -> {
for (LazyNettyClientVirtualRouteDTO lazyNettyClientRouteDTO : lazyNettyClientVirtualRouteDTOList) {
String virtualIp = lazyNettyClientRouteDTO.getVirtualIp();
String virtualPort = lazyNettyClientRouteDTO.getVirtualPort();
String targetClientId = lazyNettyClientRouteDTO
.getTargetClientId();
String targetIp = lazyNettyClientRouteDTO.getTargetIp();
String targetPort = lazyNettyClientRouteDTO.getTargetPort();
ClientProxyRoute clientProxyRoute = new ClientProxyRoute();
clientProxyRoute.setClientId(routeClientId);
clientProxyRoute.setAllowIp(routeIp);
clientProxyRoute.setAllowPort(routePort);
clientProxyRoute.setVirtualIp(virtualIp);
clientProxyRoute.setVirtualPort(virtualPort);
clientProxyRoute.setTargetClientId(targetClientId);
clientProxyRoute.setTargetIp(targetIp);
clientProxyRoute.setTargetPort(targetPort);
clientProxyRoute.setRouteType(RouteType.CLIENT_PROXY_CLIENT);
NettyProxyMsg nettyMsg = new NettyProxyMsg();
nettyMsg.setType(ProxyMessageType.HTTP_DISTRIBUTE_CLIENT_PROXY_SERVER_CLIENT_ROUTE_);

View File

@ -62,12 +62,6 @@ public class LazyNettyClientRouteQueryListCommand {
@Schema(description ="路由IP",name ="routeIp",example = "")
private String routeIp;
/**
*
* 路由端口默认ALL
*/
@Schema(description ="路由端口默认ALL",name ="routePort",example = "")
private String routePort;
/**
*

View File

@ -62,12 +62,6 @@ public class LazyNettyClientRouteQueryOneCommand {
@Schema(description ="路由IP",name ="routeIp",example = "")
private String routeIp;
/**
*
* 路由端口默认ALL
*/
@Schema(description ="路由端口默认ALL",name ="routePort",example = "")
private String routePort;
/**
*

View File

@ -62,12 +62,6 @@ public class LazyNettyClientRouteRemoveCommand {
@Schema(description ="路由IP",name ="routeIp",example = "")
private String routeIp;
/**
*
* 路由端口默认ALL
*/
@Schema(description ="路由端口默认ALL",name ="routePort",example = "")
private String routePort;
/**
*

View File

@ -54,13 +54,6 @@ public class LazyNettyClientRouteStoryCommand {
@Schema(description ="路由IP",name ="routeIp",example = "")
private String routeIp;
/**
*
* 路由端口默认ALL
*/
@Schema(description ="路由端口默认ALL",name ="routePort",example = "")
private String routePort;
/**
*
* 更新时间

View File

@ -62,13 +62,6 @@ public class LazyNettyClientRouteUpdateCommand {
@Schema(description ="路由IP",name ="routeIp",example = "")
private String routeIp;
/**
*
* 路由端口默认ALL
*/
@Schema(description ="路由端口默认ALL",name ="routePort",example = "")
private String routePort;
/**
*
* 更新时间

View File

@ -84,4 +84,10 @@ public class LazyNettyClientVirtualRouteQueryListCommand {
@Schema(description ="客户端虚拟路由端口默认ALL",name ="virtualPort",example = "")
private String virtualPort;
/**
*
* 是否删除
*/
@Schema(description ="是否删除",name ="isDeleted",example = "")
private Boolean isDeleted;
}

View File

@ -55,12 +55,6 @@ public class LazyNettyServerRouteQueryListCommand {
@Schema(description ="路由IP",name ="routeIp",example = "")
private String routeIp;
/**
*
* 路由端口默认ALL
*/
@Schema(description ="路由端口默认ALL",name ="routePort",example = "")
private String routePort;
/**
*

View File

@ -55,12 +55,6 @@ public class LazyNettyServerRouteQueryOneCommand {
@Schema(description ="路由IP",name ="routeIp",example = "")
private String routeIp;
/**
*
* 路由端口默认ALL
*/
@Schema(description ="路由端口默认ALL",name ="routePort",example = "")
private String routePort;
/**
*

View File

@ -55,12 +55,6 @@ public class LazyNettyServerRouteRemoveCommand {
@Schema(description ="路由IP",name ="routeIp",example = "")
private String routeIp;
/**
*
* 路由端口默认ALL
*/
@Schema(description ="路由端口默认ALL",name ="routePort",example = "")
private String routePort;
/**
*

View File

@ -49,12 +49,6 @@ public class LazyNettyServerRouteStoryCommand {
@Schema(description ="路由IP",name ="routeIp",example = "")
private String routeIp;
/**
*
* 路由端口默认ALL
*/
@Schema(description ="路由端口默认ALL",name ="routePort",example = "")
private String routePort;
/**
*

View File

@ -55,12 +55,6 @@ public class LazyNettyServerRouteUpdateCommand {
@Schema(description ="路由IP",name ="routeIp",example = "")
private String routeIp;
/**
*
* 路由端口默认ALL
*/
@Schema(description ="路由端口默认ALL",name ="routePort",example = "")
private String routePort;
/**
*

View File

@ -76,5 +76,11 @@ public class LazyNettyServerVirtualRouteQueryListCommand {
*/
@Schema(description ="虚拟服务端路由端口默认ALL",name ="virtualPort",example = "")
private String virtualPort;
/**
*
* 是否删除
*/
@Schema(description ="是否删除",name ="isDeleted",example = "")
private Boolean isDeleted;
}

View File

@ -62,12 +62,6 @@ public class LazyNettyClientRouteDTO {
@Schema(description ="路由IP",name ="routeIp",example = "")
private String routeIp;
/**
*
* 路由端口默认ALL
*/
@Schema(description ="路由端口默认ALL",name ="routePort",example = "")
private String routePort;
/**
*

View File

@ -55,12 +55,6 @@ public class LazyNettyServerRouteDTO {
@Schema(description ="路由IP",name ="routeIp",example = "")
private String routeIp;
/**
*
* 路由端口默认ALL
*/
@Schema(description ="路由端口默认ALL",name ="routePort",example = "")
private String routePort;
/**
*

View File

@ -62,13 +62,6 @@ public class LazyNettyClientRoute {
@Schema(description ="路由IP",name ="routeIp",example = "")
private String routeIp;
/**
*
* 路由端口默认ALL
*/
@Schema(description ="路由端口默认ALL",name ="routePort",example = "")
private String routePort;
/**
*
* 更新时间

View File

@ -55,12 +55,6 @@ public class LazyNettyServerRoute {
@Schema(description ="路由IP",name ="routeIp",example = "")
private String routeIp;
/**
*
* 路由端口默认ALL
*/
@Schema(description ="路由端口默认ALL",name ="routePort",example = "")
private String routePort;
/**
*

View File

@ -77,13 +77,6 @@ public class LazyNettyClientRouteDO {
@LazyTableField(name="route_ip",comment="路由IP",notNull=true,columnType="varchar(255)")
private String routeIp;
/**
*
* 路由端口默认ALL
*/
@Schema(description ="路由端口默认ALL",name ="routePort",example = "")
@LazyTableField(name="route_port",comment="路由端口默认ALL",notNull=true,defaultValue="'ALL'",upsertStrategy = LazyFieldStrategy.NEVER,columnType="varchar(255)")
private String routePort;
/**
*

View File

@ -69,13 +69,6 @@ public class LazyNettyServerRouteDO {
@LazyTableField(name="route_ip",comment="路由IP",notNull=true,columnType="varchar(255)")
private String routeIp;
/**
*
* 路由端口默认ALL
*/
@Schema(description ="路由端口默认ALL",name ="routePort",example = "")
@LazyTableField(name="route_port",comment="路由端口默认ALL",notNull=true,defaultValue="'ALL'",upsertStrategy = LazyFieldStrategy.NEVER,columnType="varchar(255)")
private String routePort;
/**
*

View File

@ -17,6 +17,7 @@ import org.springframework.stereotype.Repository;
import java.nio.charset.StandardCharsets;
import java.util.stream.Collectors;
import org.wu.framework.core.NormalUsedString;
import org.wu.framework.lazy.orm.database.lambda.stream.wrapper.LazyUpdateSetValueWrappers;
import org.wu.framework.lazy.orm.database.lambda.stream.wrapper.LazyWrappers;
import org.wu.framework.web.response.Result;
@ -55,9 +56,9 @@ public class LazyNettyClientRouteRepositoryImpl implements LazyNettyClientRout
lazyLambdaStream.upsert(lazyNettyClientRouteDO);
String routeIp = lazyNettyClientRoute.getRouteIp();
String routePort = lazyNettyClientRoute.getRoutePort();
String clientId = lazyNettyClientRoute.getClientId();
String routePort = NormalUsedString.ASTERISK;
// 新增虚拟ip映射
LazyNettyClientVirtualRouteDO lazyNettyClientVirtualRouteDO = new LazyNettyClientVirtualRouteDO();
lazyNettyClientVirtualRouteDO.setIsDeleted(false);
@ -185,7 +186,6 @@ public class LazyNettyClientRouteRepositoryImpl implements LazyNettyClientRout
@Override
public Result<LazyNettyClientRoute> remove(LazyNettyClientRoute lazyNettyClientRoute) {
LazyNettyClientRouteDO lazyNettyClientRouteDO = LazyNettyClientRouteConverter.INSTANCE.fromLazyNettyClientRoute(lazyNettyClientRoute);
lazyLambdaStream.update(LazyUpdateSetValueWrappers.<LazyNettyClientRouteDO>lambdaWrapper()
.set(LazyNettyClientRouteDO::getIsDeleted, true),
LazyWrappers
@ -193,6 +193,33 @@ public class LazyNettyClientRouteRepositoryImpl implements LazyNettyClientRout
.eq(LazyNettyClientRouteDO::getId, lazyNettyClientRoute.getId())
);
LazyNettyClientRouteDO clientRouteDO = lazyLambdaStream.selectOne(
LazyWrappers
.<LazyNettyClientRouteDO>lambdaWrapper()
.eq(LazyNettyClientRouteDO::getId, lazyNettyClientRoute.getId())
);
String routeIp = clientRouteDO.getRouteIp();
String clientId = clientRouteDO.getClientId();
String routePort=NormalUsedString.ASTERISK;
ClientProxyRoute clientProxyRoute = new ClientProxyRoute();
clientProxyRoute.setTargetClientId(clientId);
clientProxyRoute.setVirtualIp(routeIp);
clientProxyRoute.setVirtualPort(routePort);
clientProxyRoute.setTargetIp(routeIp);
clientProxyRoute.setTargetPort(routePort);
clientProxyRoute.setRouteType(RouteType.CLIENT_PROXY_CLIENT);
// 发送所有客户端本地路由刷新
ChannelContext.getChannels().forEach((channelClientId, channels) -> {
NettyProxyMsg nettyMsg = new NettyProxyMsg();
nettyMsg.setType(ProxyMessageType.HTTP_DISTRIBUTE_CLIENT_PROXY_SERVER_CLIENT_ROUTE_CLOSE_);
nettyMsg.setData((JSON.toJSONString(clientProxyRoute)
.getBytes(StandardCharsets.UTF_8)));
// 发送所有客户端ID
for (Channel channel : channels) {
channel.writeAndFlush(nettyMsg);
}
});
return ResultFactory.successOf();
}

View File

@ -180,6 +180,37 @@ public class LazyNettyClientVirtualRouteRepositoryImpl implements LazyNettyClien
.eq(LazyNettyClientVirtualRouteDO::getId, lazyNettyClientVirtualRouteDO.getId())
);
LazyNettyClientVirtualRouteDO clientVirtualRouteDO = lazyLambdaStream.selectOne(
LazyWrappers
.<LazyNettyClientVirtualRouteDO>lambdaWrapper()
.eq(LazyNettyClientVirtualRouteDO::getId, lazyNettyClientVirtualRouteDO.getId())
);
String virtualIp = clientVirtualRouteDO.getVirtualIp();
String virtualPort = clientVirtualRouteDO.getVirtualPort();
String targetIp = clientVirtualRouteDO.getTargetIp();
String targetPort = clientVirtualRouteDO.getTargetPort();
String targetClientId = clientVirtualRouteDO.getTargetClientId();
ClientProxyRoute clientProxyRoute = new ClientProxyRoute();
clientProxyRoute.setTargetClientId(targetClientId);
clientProxyRoute.setVirtualIp(virtualIp);
clientProxyRoute.setVirtualPort(virtualPort);
clientProxyRoute.setTargetIp(targetIp);
clientProxyRoute.setTargetPort(targetPort);
clientProxyRoute.setRouteType(RouteType.CLIENT_PROXY_CLIENT);
// 发送所有客户端本地路由刷新
ChannelContext.getChannels().forEach((channelClientId, channels) -> {
NettyProxyMsg nettyMsg = new NettyProxyMsg();
nettyMsg.setType(ProxyMessageType.HTTP_DISTRIBUTE_CLIENT_PROXY_SERVER_CLIENT_ROUTE_CLOSE_);
nettyMsg.setData((JSON.toJSONString(clientProxyRoute)
.getBytes(StandardCharsets.UTF_8)));
// 发送所有客户端ID
for (Channel channel : channels) {
channel.writeAndFlush(nettyMsg);
}
});
return ResultFactory.successOf();
}

View File

@ -17,6 +17,7 @@ import org.springframework.stereotype.Repository;
import java.nio.charset.StandardCharsets;
import java.util.stream.Collectors;
import org.wu.framework.core.NormalUsedString;
import org.wu.framework.lazy.orm.database.lambda.stream.wrapper.LazyUpdateSetValueWrappers;
import org.wu.framework.lazy.orm.database.lambda.stream.wrapper.LazyWrappers;
import org.wu.framework.web.response.Result;
@ -54,7 +55,7 @@ public class LazyNettyServerRouteRepositoryImpl implements LazyNettyServerRout
LazyNettyServerRouteDO lazyNettyServerRouteDO = LazyNettyServerRouteConverter.INSTANCE.fromLazyNettyServerRoute(lazyNettyServerRoute);
lazyLambdaStream.upsert(lazyNettyServerRouteDO);
String routeIp = lazyNettyServerRoute.getRouteIp();
String routePort = lazyNettyServerRoute.getRoutePort();
String routePort = NormalUsedString.ASTERISK;
// 新增虚拟ip映射
LazyNettyServerVirtualRouteDO lazyNettyServerVirtualRouteDO = new LazyNettyServerVirtualRouteDO();
lazyNettyServerVirtualRouteDO.setIsDeleted(false);
@ -180,7 +181,6 @@ public class LazyNettyServerRouteRepositoryImpl implements LazyNettyServerRout
@Override
public Result<LazyNettyServerRoute> remove(LazyNettyServerRoute lazyNettyServerRoute) {
LazyNettyServerRouteDO lazyNettyServerRouteDO = LazyNettyServerRouteConverter.INSTANCE.fromLazyNettyServerRoute(lazyNettyServerRoute);
lazyLambdaStream.update(LazyUpdateSetValueWrappers.<LazyNettyServerRouteDO>lambdaWrapper()
.set(LazyNettyServerRouteDO::getIsDeleted, true),
LazyWrappers
@ -188,6 +188,32 @@ public class LazyNettyServerRouteRepositoryImpl implements LazyNettyServerRout
.eq(LazyNettyServerRouteDO::getId, lazyNettyServerRoute.getId())
);
LazyNettyServerRouteDO serverRouteDO = lazyLambdaStream.selectOne(
LazyWrappers.<LazyNettyServerRouteDO>lambdaWrapper()
.eq(LazyNettyServerRouteDO::getId, lazyNettyServerRoute.getId())
);
String routeIp = serverRouteDO.getRouteIp();
String routePort = NormalUsedString.ASTERISK;
ServerProxyRoute clientProxyServerRoute = new ServerProxyRoute();
clientProxyServerRoute.setServerIp("default");
clientProxyServerRoute.setVirtualIp(routeIp);
clientProxyServerRoute.setVirtualPort(routePort);
clientProxyServerRoute.setTargetIp(routeIp);
clientProxyServerRoute.setTargetPort(routePort);
clientProxyServerRoute.setRouteType(RouteType.CLIENT_PROXY_SEVER);
// 发送所有客户端本地路由刷新
ChannelContext.getChannels().forEach((clientId, channels) -> {
NettyProxyMsg nettyMsg = new NettyProxyMsg();
nettyMsg.setType(ProxyMessageType.HTTP_DISTRIBUTE_CLIENT_PROXY_SERVER_SERVER_ROUTE_CLOSE_);
nettyMsg.setData((JSON.toJSONString(clientProxyServerRoute)
.getBytes(StandardCharsets.UTF_8)));
// 发送所有客户端ID
for (Channel channel : channels) {
channel.writeAndFlush(nettyMsg);
}
});
return ResultFactory.successOf();
}

View File

@ -179,6 +179,36 @@ public class LazyNettyServerVirtualRouteRepositoryImpl implements LazyNettyServe
.eq(LazyNettyServerVirtualRouteDO::getId, lazyNettyServerVirtualRouteDO.getId())
);
LazyNettyServerVirtualRouteDO virtualRouteDO = lazyLambdaStream.selectOne(
LazyWrappers.<LazyNettyServerVirtualRouteDO>lambdaWrapper()
.eq(LazyNettyServerVirtualRouteDO::getId, lazyNettyServerVirtualRouteDO.getId())
);
String virtualIp = virtualRouteDO.getVirtualIp();
String virtualPort = virtualRouteDO.getVirtualPort();
String targetIp = virtualRouteDO.getTargetIp();
String targetPort = virtualRouteDO.getTargetPort();
ServerProxyRoute clientProxyServerRoute = new ServerProxyRoute();
clientProxyServerRoute.setServerIp("default");
clientProxyServerRoute.setVirtualIp(virtualIp);
clientProxyServerRoute.setVirtualPort(virtualPort);
clientProxyServerRoute.setTargetIp(targetIp);
clientProxyServerRoute.setTargetPort(targetPort);
clientProxyServerRoute.setRouteType(RouteType.CLIENT_PROXY_SEVER);
// 发送所有客户端本地路由刷新
ChannelContext.getChannels().forEach((clientId, channels) -> {
NettyProxyMsg nettyMsg = new NettyProxyMsg();
nettyMsg.setType(ProxyMessageType.HTTP_DISTRIBUTE_CLIENT_PROXY_SERVER_SERVER_ROUTE_CLOSE_);
nettyMsg.setData((JSON.toJSONString(clientProxyServerRoute)
.getBytes(StandardCharsets.UTF_8)));
// 发送所有客户端ID
for (Channel channel : channels) {
channel.writeAndFlush(nettyMsg);
}
});
return ResultFactory.successOf();
}

View File

@ -1 +1 @@
<!doctype html><html lang="zh-cn"><head><meta charset="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><link rel="icon" href="favicon.png"/><title>网络渗透</title><script defer="defer" src="js/chunk-elementPlusIcon.898bd1ec.js"></script><script defer="defer" src="js/chunk-elementPlus.020d8d3c.js"></script><script defer="defer" src="js/chunk-mockjs.fcd22ec7.js"></script><script defer="defer" src="js/chunk-vendors.7205badc.js"></script><script defer="defer" src="js/app.e32824bf.js"></script><link href="css/chunk-elementPlus.f2db5e15.css" rel="stylesheet"><link href="css/app.a3bfec27.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but wu-vue-zone-ecology-net doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div></body></html>
<!doctype html><html lang="zh-cn"><head><meta charset="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><link rel="icon" href="favicon.png"/><title>网络渗透</title><script defer="defer" src="js/chunk-elementPlusIcon.898bd1ec.js"></script><script defer="defer" src="js/chunk-elementPlus.020d8d3c.js"></script><script defer="defer" src="js/chunk-mockjs.fcd22ec7.js"></script><script defer="defer" src="js/chunk-vendors.7205badc.js"></script><script defer="defer" src="js/app.ffac0530.js"></script><link href="css/chunk-elementPlus.f2db5e15.css" rel="stylesheet"><link href="css/app.a3bfec27.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but wu-vue-zone-ecology-net doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div></body></html>

File diff suppressed because one or more lines are too long

View File

@ -1,12 +0,0 @@
/*!
* clipboard.js v2.0.11
* https://clipboardjs.com/
*
* Licensed MIT © Zeno Rocha
*/
/**
* vue v3.5.6
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/

File diff suppressed because one or more lines are too long