mirror of
https://gitee.com/wujiawei1207537021/wu-lazy-cloud-network.git
synced 2025-06-06 13:27:55 +08:00
【fix】添加虚拟路由管理
This commit is contained in:
parent
965142793c
commit
96929044fa
@ -352,12 +352,20 @@ public class ClientAutoConfiguration {
|
|||||||
public ClientHandleDistributeHttpClientProxyServerServerRouteTypeAdvanced clientHandleDistributeHttpClientProxyServerServerRouteTypeAdvanced() {
|
public ClientHandleDistributeHttpClientProxyServerServerRouteTypeAdvanced clientHandleDistributeHttpClientProxyServerServerRouteTypeAdvanced() {
|
||||||
return new ClientHandleDistributeHttpClientProxyServerServerRouteTypeAdvanced();
|
return new ClientHandleDistributeHttpClientProxyServerServerRouteTypeAdvanced();
|
||||||
}
|
}
|
||||||
|
@Bean
|
||||||
|
public ClientHandleDistributeHttpClientProxyServerServerRouteCloseTypeAdvanced clientHandleDistributeHttpClientProxyServerServerRouteCloseTypeAdvanced(){
|
||||||
|
return new ClientHandleDistributeHttpClientProxyServerServerRouteCloseTypeAdvanced();
|
||||||
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public ClientHandleDistributeHttpClientProxyServerClientRouteTypeAdvanced clientHandleDistributeHttpClientProxyServerClientRouteTypeAdvanced() {
|
public ClientHandleDistributeHttpClientProxyServerClientRouteTypeAdvanced clientHandleDistributeHttpClientProxyServerClientRouteTypeAdvanced() {
|
||||||
return new ClientHandleDistributeHttpClientProxyServerClientRouteTypeAdvanced();
|
return new ClientHandleDistributeHttpClientProxyServerClientRouteTypeAdvanced();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public ClientHandleDistributeHttpClientProxyServerClientRouteCloseTypeAdvanced clientHandleDistributeHttpClientProxyServerClientRouteCloseTypeAdvanced(){
|
||||||
|
return new ClientHandleDistributeHttpClientProxyServerClientRouteCloseTypeAdvanced();
|
||||||
|
}
|
||||||
@Bean
|
@Bean
|
||||||
public ClientHandleDistributeHttpClientProxyClientConnectionTransferSuccessfulAdvanced clientHandleDistributeHttpClientProxyClientConnectionTransferSuccessfulAdvanced() {
|
public ClientHandleDistributeHttpClientProxyClientConnectionTransferSuccessfulAdvanced clientHandleDistributeHttpClientProxyClientConnectionTransferSuccessfulAdvanced() {
|
||||||
return new ClientHandleDistributeHttpClientProxyClientConnectionTransferSuccessfulAdvanced();
|
return new ClientHandleDistributeHttpClientProxyClientConnectionTransferSuccessfulAdvanced();
|
||||||
|
@ -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);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -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);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -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();
|
||||||
|
}
|
||||||
|
}
|
@ -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();
|
||||||
|
}
|
||||||
|
}
|
@ -253,6 +253,13 @@ public class ProxyMessageType {
|
|||||||
* @see AbstractHandleHttpDistributeClientProxyServerServerRouteTypeAdvanced
|
* @see AbstractHandleHttpDistributeClientProxyServerServerRouteTypeAdvanced
|
||||||
*/
|
*/
|
||||||
public static final byte HTTP_DISTRIBUTE_CLIENT_PROXY_SERVER_SERVER_ROUTE_ = HTTP_DISTRIBUTE_PROXY - 1;
|
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 ProxyMessageTypeEnums#HTTP_DISTRIBUTE_CLIENT_PROXY_SERVER_CLIENT_ROUTE_
|
||||||
* @see AbstractHandleHttpDistributeClientProxyServerClientRouteTypeAdvanced
|
* @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 ProxyMessageTypeEnums#HTTP_DISTRIBUTE_SERVER_PROXY_CLIENT_CONNECTION_SUCCESSFUL_
|
||||||
* @see AbstractHandleHttpDistributeServerProxyClientConnectionSuccessfulTypeAdvanced
|
* @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 下发数据到另一个客户端
|
* http 下发数据到另一个客户端
|
||||||
|
@ -58,12 +58,26 @@ public enum ProxyMessageTypeEnums {
|
|||||||
* @see AbstractHandleHttpDistributeClientProxyServerServerRouteTypeAdvanced
|
* @see AbstractHandleHttpDistributeClientProxyServerServerRouteTypeAdvanced
|
||||||
*/
|
*/
|
||||||
HTTP_DISTRIBUTE_CLIENT_PROXY_SERVER_SERVER_ROUTE_(ProxyMessageType.HTTP_DISTRIBUTE_CLIENT_PROXY_SERVER_SERVER_ROUTE_, "http下发服务端路由"),
|
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 下发客户端路由
|
* http 下发客户端路由
|
||||||
*
|
*
|
||||||
* @see AbstractHandleHttpDistributeClientProxyServerClientRouteTypeAdvanced
|
* @see AbstractHandleHttpDistributeClientProxyServerClientRouteTypeAdvanced
|
||||||
*/
|
*/
|
||||||
HTTP_DISTRIBUTE_CLIENT_PROXY_SERVER_CLIENT_ROUTE_(ProxyMessageType.HTTP_DISTRIBUTE_CLIENT_PROXY_SERVER_CLIENT_ROUTE_, "http下发客户端路由"),
|
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 客户端远程客户端代理传输连接
|
* http 客户端远程客户端代理传输连接
|
||||||
*
|
*
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package org.framework.lazy.cloud.network.heartbeat.protocol.route;
|
package org.framework.lazy.cloud.network.heartbeat.protocol.route;
|
||||||
|
|
||||||
|
import org.wu.framework.core.NormalUsedString;
|
||||||
|
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -12,11 +14,16 @@ public class RouteContext {
|
|||||||
private static final ConcurrentHashMap<String, ProxyRoute> m = new ConcurrentHashMap<>();
|
private static final ConcurrentHashMap<String, ProxyRoute> m = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置路由
|
||||||
|
*
|
||||||
|
* @param route 路由
|
||||||
|
*/
|
||||||
public static void setRoute(ProxyRoute route) {
|
public static void setRoute(ProxyRoute route) {
|
||||||
RouteType routeType = route.getRouteType();
|
RouteType routeType = route.getRouteType();
|
||||||
String virtualIp = route.getVirtualIp();
|
String virtualIp = route.getVirtualIp();
|
||||||
String virtualPort = route.getVirtualPort();
|
String virtualPort = route.getVirtualPort();
|
||||||
String key = virtualIp + ":" + virtualPort + routeType;
|
String key = virtualIp + ":" + virtualPort + "_" + routeType;
|
||||||
if (m.containsKey(key)) {
|
if (m.containsKey(key)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -24,12 +31,32 @@ public class RouteContext {
|
|||||||
m.put(key, route);
|
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()
|
ProxyRoute p = m.values()
|
||||||
.stream()
|
.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()
|
.findFirst()
|
||||||
.orElse(null);
|
.orElse(null);
|
||||||
return p;
|
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);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -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.*;
|
||||||
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.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.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.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.command.lazy.netty.client.virtual.route.LazyNettyClientVirtualRouteQueryListCommand;
|
||||||
import org.framework.lazy.cloud.network.heartbeat.server.standalone.application.dto.LazyClientPermeateClientMappingDTO;
|
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.LazyClientPermeateServerMappingDTO;
|
import org.framework.lazy.cloud.network.heartbeat.server.standalone.application.dto.*;
|
||||||
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.domain.model.lazy.netty.client.blacklist.LazyNettyClientBlacklist;
|
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.beans.factory.config.BeanDefinition;
|
||||||
import org.springframework.context.annotation.Role;
|
import org.springframework.context.annotation.Role;
|
||||||
@ -50,20 +47,20 @@ public class ServerHandleTcpClientConnectSuccessTypeAdvanced extends AbstractHan
|
|||||||
private final LazyClientPermeateServerMappingApplication lazyClientPermeateServerMappingApplication;
|
private final LazyClientPermeateServerMappingApplication lazyClientPermeateServerMappingApplication;
|
||||||
private final LazyClientPermeateClientMappingApplication lazyClientPermeateClientMappingApplication;
|
private final LazyClientPermeateClientMappingApplication lazyClientPermeateClientMappingApplication;
|
||||||
|
|
||||||
private final LazyNettyServerRouteApplication lazyNettyServerRouteApplication;
|
private final LazyNettyServerVirtualRouteApplication lazyNettyServerVirtualRouteApplication;
|
||||||
private final LazyNettyClientRouteApplication lazyNettyClientRouteApplication;
|
private final LazyNettyClientVirtualRouteApplication lazyNettyClientVirtualRouteApplication;
|
||||||
private final LazyNettyClientTokenBucketApplication lazyNettyClientTokenBucketApplication;
|
private final LazyNettyClientTokenBucketApplication lazyNettyClientTokenBucketApplication;
|
||||||
|
|
||||||
private final ServerNodeProperties serverNodeProperties;
|
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.lazyClientStatsChangeApplication = lazyClientStatsChangeApplication;
|
||||||
this.lazyNettyClientBlacklistApplication = lazyNettyClientBlacklistApplication;
|
this.lazyNettyClientBlacklistApplication = lazyNettyClientBlacklistApplication;
|
||||||
this.lazyServerPermeateClientMappingApplication = lazyServerPermeateClientMappingApplication;
|
this.lazyServerPermeateClientMappingApplication = lazyServerPermeateClientMappingApplication;
|
||||||
this.lazyClientPermeateServerMappingApplication = lazyClientPermeateServerMappingApplication;
|
this.lazyClientPermeateServerMappingApplication = lazyClientPermeateServerMappingApplication;
|
||||||
this.lazyClientPermeateClientMappingApplication = lazyClientPermeateClientMappingApplication;
|
this.lazyClientPermeateClientMappingApplication = lazyClientPermeateClientMappingApplication;
|
||||||
this.lazyNettyServerRouteApplication = lazyNettyServerRouteApplication;
|
this.lazyNettyServerVirtualRouteApplication = lazyNettyServerVirtualRouteApplication;
|
||||||
this.lazyNettyClientRouteApplication = lazyNettyClientRouteApplication;
|
this.lazyNettyClientVirtualRouteApplication = lazyNettyClientVirtualRouteApplication;
|
||||||
this.lazyNettyClientTokenBucketApplication = lazyNettyClientTokenBucketApplication;
|
this.lazyNettyClientTokenBucketApplication = lazyNettyClientTokenBucketApplication;
|
||||||
this.serverNodeProperties = serverNodeProperties;
|
this.serverNodeProperties = serverNodeProperties;
|
||||||
}
|
}
|
||||||
@ -190,17 +187,21 @@ public class ServerHandleTcpClientConnectSuccessTypeAdvanced extends AbstractHan
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
// 下发服务端路由
|
// 下发服务端路由
|
||||||
LazyNettyServerRouteQueryListCommand lazyNettyServerRouteQueryListCommand = new LazyNettyServerRouteQueryListCommand();
|
LazyNettyServerVirtualRouteQueryListCommand lazyNettyServerVirtualRouteQueryListCommand = new LazyNettyServerVirtualRouteQueryListCommand();
|
||||||
lazyNettyServerRouteQueryListCommand.setIsDeleted(false);
|
lazyNettyServerVirtualRouteQueryListCommand.setIsDeleted(false);
|
||||||
lazyNettyServerRouteApplication.findList(lazyNettyServerRouteQueryListCommand)
|
lazyNettyServerVirtualRouteApplication.findList(lazyNettyServerVirtualRouteQueryListCommand)
|
||||||
.accept(lazyNettyServerRouteDTOS -> {
|
.accept(lazyNettyServerVirtualRouteDTOS -> {
|
||||||
for (LazyNettyServerRouteDTO lazyNettyServerRouteDTO : lazyNettyServerRouteDTOS) {
|
for (LazyNettyServerVirtualRouteDTO lazyNettyServerVirtualRouteDTO : lazyNettyServerVirtualRouteDTOS) {
|
||||||
String routeIp = lazyNettyServerRouteDTO.getRouteIp();
|
String virtualIp = lazyNettyServerVirtualRouteDTO.getVirtualIp();
|
||||||
String routePort = lazyNettyServerRouteDTO.getRoutePort();
|
String virtualPort = lazyNettyServerVirtualRouteDTO.getVirtualPort();
|
||||||
|
String targetIp = lazyNettyServerVirtualRouteDTO.getTargetIp();
|
||||||
|
String targetPort = lazyNettyServerVirtualRouteDTO.getTargetPort();
|
||||||
ServerProxyRoute serverProxyRoute = new ServerProxyRoute();
|
ServerProxyRoute serverProxyRoute = new ServerProxyRoute();
|
||||||
serverProxyRoute.setServerIp("default");
|
serverProxyRoute.setServerIp("default");
|
||||||
serverProxyRoute.setAllowIp(routeIp);
|
serverProxyRoute.setVirtualIp(virtualIp);
|
||||||
serverProxyRoute.setAllowPort(routePort);
|
serverProxyRoute.setVirtualPort(virtualPort);
|
||||||
|
serverProxyRoute.setTargetIp(targetIp);
|
||||||
|
serverProxyRoute.setTargetPort(targetPort);
|
||||||
serverProxyRoute.setRouteType(RouteType.CLIENT_PROXY_SEVER);
|
serverProxyRoute.setRouteType(RouteType.CLIENT_PROXY_SEVER);
|
||||||
NettyProxyMsg nettyMsg = new NettyProxyMsg();
|
NettyProxyMsg nettyMsg = new NettyProxyMsg();
|
||||||
nettyMsg.setType(ProxyMessageType.HTTP_DISTRIBUTE_CLIENT_PROXY_SERVER_SERVER_ROUTE_);
|
nettyMsg.setType(ProxyMessageType.HTTP_DISTRIBUTE_CLIENT_PROXY_SERVER_SERVER_ROUTE_);
|
||||||
@ -212,18 +213,26 @@ public class ServerHandleTcpClientConnectSuccessTypeAdvanced extends AbstractHan
|
|||||||
|
|
||||||
|
|
||||||
// 下发客户端路由
|
// 下发客户端路由
|
||||||
LazyNettyClientRouteQueryListCommand lazyNettyClientRouteQueryListCommand = new LazyNettyClientRouteQueryListCommand();
|
LazyNettyClientVirtualRouteQueryListCommand lazyNettyClientVirtualRouteQueryListCommand =
|
||||||
lazyNettyClientRouteQueryListCommand.setIsDeleted(false);
|
new LazyNettyClientVirtualRouteQueryListCommand();
|
||||||
lazyNettyClientRouteApplication.findList(lazyNettyClientRouteQueryListCommand)
|
lazyNettyClientVirtualRouteQueryListCommand.setIsDeleted(false);
|
||||||
.accept(lazyNettyClientRouteDTOList -> {
|
lazyNettyClientVirtualRouteApplication.findList(lazyNettyClientVirtualRouteQueryListCommand)
|
||||||
for (LazyNettyClientRouteDTO lazyNettyClientRouteDTO : lazyNettyClientRouteDTOList) {
|
.accept(lazyNettyClientVirtualRouteDTOList -> {
|
||||||
String routeIp = lazyNettyClientRouteDTO.getRouteIp();
|
for (LazyNettyClientVirtualRouteDTO lazyNettyClientRouteDTO : lazyNettyClientVirtualRouteDTOList) {
|
||||||
String routePort = lazyNettyClientRouteDTO.getRoutePort();
|
String virtualIp = lazyNettyClientRouteDTO.getVirtualIp();
|
||||||
String routeClientId = lazyNettyClientRouteDTO.getClientId();
|
String virtualPort = lazyNettyClientRouteDTO.getVirtualPort();
|
||||||
|
String targetClientId = lazyNettyClientRouteDTO
|
||||||
|
.getTargetClientId();
|
||||||
|
String targetIp = lazyNettyClientRouteDTO.getTargetIp();
|
||||||
|
String targetPort = lazyNettyClientRouteDTO.getTargetPort();
|
||||||
|
|
||||||
ClientProxyRoute clientProxyRoute = new ClientProxyRoute();
|
ClientProxyRoute clientProxyRoute = new ClientProxyRoute();
|
||||||
clientProxyRoute.setClientId(routeClientId);
|
|
||||||
clientProxyRoute.setAllowIp(routeIp);
|
clientProxyRoute.setVirtualIp(virtualIp);
|
||||||
clientProxyRoute.setAllowPort(routePort);
|
clientProxyRoute.setVirtualPort(virtualPort);
|
||||||
|
clientProxyRoute.setTargetClientId(targetClientId);
|
||||||
|
clientProxyRoute.setTargetIp(targetIp);
|
||||||
|
clientProxyRoute.setTargetPort(targetPort);
|
||||||
clientProxyRoute.setRouteType(RouteType.CLIENT_PROXY_CLIENT);
|
clientProxyRoute.setRouteType(RouteType.CLIENT_PROXY_CLIENT);
|
||||||
NettyProxyMsg nettyMsg = new NettyProxyMsg();
|
NettyProxyMsg nettyMsg = new NettyProxyMsg();
|
||||||
nettyMsg.setType(ProxyMessageType.HTTP_DISTRIBUTE_CLIENT_PROXY_SERVER_CLIENT_ROUTE_);
|
nettyMsg.setType(ProxyMessageType.HTTP_DISTRIBUTE_CLIENT_PROXY_SERVER_CLIENT_ROUTE_);
|
||||||
|
@ -62,12 +62,6 @@ public class LazyNettyClientRouteQueryListCommand {
|
|||||||
@Schema(description ="路由IP",name ="routeIp",example = "")
|
@Schema(description ="路由IP",name ="routeIp",example = "")
|
||||||
private String routeIp;
|
private String routeIp;
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* 路由端口:默认ALL
|
|
||||||
*/
|
|
||||||
@Schema(description ="路由端口:默认ALL",name ="routePort",example = "")
|
|
||||||
private String routePort;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -62,12 +62,6 @@ public class LazyNettyClientRouteQueryOneCommand {
|
|||||||
@Schema(description ="路由IP",name ="routeIp",example = "")
|
@Schema(description ="路由IP",name ="routeIp",example = "")
|
||||||
private String routeIp;
|
private String routeIp;
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* 路由端口:默认ALL
|
|
||||||
*/
|
|
||||||
@Schema(description ="路由端口:默认ALL",name ="routePort",example = "")
|
|
||||||
private String routePort;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -62,12 +62,6 @@ public class LazyNettyClientRouteRemoveCommand {
|
|||||||
@Schema(description ="路由IP",name ="routeIp",example = "")
|
@Schema(description ="路由IP",name ="routeIp",example = "")
|
||||||
private String routeIp;
|
private String routeIp;
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* 路由端口:默认ALL
|
|
||||||
*/
|
|
||||||
@Schema(description ="路由端口:默认ALL",name ="routePort",example = "")
|
|
||||||
private String routePort;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -54,13 +54,6 @@ public class LazyNettyClientRouteStoryCommand {
|
|||||||
@Schema(description ="路由IP",name ="routeIp",example = "")
|
@Schema(description ="路由IP",name ="routeIp",example = "")
|
||||||
private String routeIp;
|
private String routeIp;
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* 路由端口:默认ALL
|
|
||||||
*/
|
|
||||||
@Schema(description ="路由端口:默认ALL",name ="routePort",example = "")
|
|
||||||
private String routePort;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* 更新时间
|
* 更新时间
|
||||||
|
@ -62,13 +62,6 @@ public class LazyNettyClientRouteUpdateCommand {
|
|||||||
@Schema(description ="路由IP",name ="routeIp",example = "")
|
@Schema(description ="路由IP",name ="routeIp",example = "")
|
||||||
private String routeIp;
|
private String routeIp;
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* 路由端口:默认ALL
|
|
||||||
*/
|
|
||||||
@Schema(description ="路由端口:默认ALL",name ="routePort",example = "")
|
|
||||||
private String routePort;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* 更新时间
|
* 更新时间
|
||||||
|
@ -84,4 +84,10 @@ public class LazyNettyClientVirtualRouteQueryListCommand {
|
|||||||
@Schema(description ="客户端虚拟路由端口:默认ALL",name ="virtualPort",example = "")
|
@Schema(description ="客户端虚拟路由端口:默认ALL",name ="virtualPort",example = "")
|
||||||
private String virtualPort;
|
private String virtualPort;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 是否删除
|
||||||
|
*/
|
||||||
|
@Schema(description ="是否删除",name ="isDeleted",example = "")
|
||||||
|
private Boolean isDeleted;
|
||||||
}
|
}
|
@ -55,12 +55,6 @@ public class LazyNettyServerRouteQueryListCommand {
|
|||||||
@Schema(description ="路由IP",name ="routeIp",example = "")
|
@Schema(description ="路由IP",name ="routeIp",example = "")
|
||||||
private String routeIp;
|
private String routeIp;
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* 路由端口:默认ALL
|
|
||||||
*/
|
|
||||||
@Schema(description ="路由端口:默认ALL",name ="routePort",example = "")
|
|
||||||
private String routePort;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -55,12 +55,6 @@ public class LazyNettyServerRouteQueryOneCommand {
|
|||||||
@Schema(description ="路由IP",name ="routeIp",example = "")
|
@Schema(description ="路由IP",name ="routeIp",example = "")
|
||||||
private String routeIp;
|
private String routeIp;
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* 路由端口:默认ALL
|
|
||||||
*/
|
|
||||||
@Schema(description ="路由端口:默认ALL",name ="routePort",example = "")
|
|
||||||
private String routePort;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -55,12 +55,6 @@ public class LazyNettyServerRouteRemoveCommand {
|
|||||||
@Schema(description ="路由IP",name ="routeIp",example = "")
|
@Schema(description ="路由IP",name ="routeIp",example = "")
|
||||||
private String routeIp;
|
private String routeIp;
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* 路由端口:默认ALL
|
|
||||||
*/
|
|
||||||
@Schema(description ="路由端口:默认ALL",name ="routePort",example = "")
|
|
||||||
private String routePort;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -49,12 +49,6 @@ public class LazyNettyServerRouteStoryCommand {
|
|||||||
@Schema(description ="路由IP",name ="routeIp",example = "")
|
@Schema(description ="路由IP",name ="routeIp",example = "")
|
||||||
private String routeIp;
|
private String routeIp;
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* 路由端口:默认ALL
|
|
||||||
*/
|
|
||||||
@Schema(description ="路由端口:默认ALL",name ="routePort",example = "")
|
|
||||||
private String routePort;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -55,12 +55,6 @@ public class LazyNettyServerRouteUpdateCommand {
|
|||||||
@Schema(description ="路由IP",name ="routeIp",example = "")
|
@Schema(description ="路由IP",name ="routeIp",example = "")
|
||||||
private String routeIp;
|
private String routeIp;
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* 路由端口:默认ALL
|
|
||||||
*/
|
|
||||||
@Schema(description ="路由端口:默认ALL",name ="routePort",example = "")
|
|
||||||
private String routePort;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -76,5 +76,11 @@ public class LazyNettyServerVirtualRouteQueryListCommand {
|
|||||||
*/
|
*/
|
||||||
@Schema(description ="虚拟服务端路由端口:默认ALL",name ="virtualPort",example = "")
|
@Schema(description ="虚拟服务端路由端口:默认ALL",name ="virtualPort",example = "")
|
||||||
private String virtualPort;
|
private String virtualPort;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 是否删除
|
||||||
|
*/
|
||||||
|
@Schema(description ="是否删除",name ="isDeleted",example = "")
|
||||||
|
private Boolean isDeleted;
|
||||||
|
|
||||||
}
|
}
|
@ -62,12 +62,6 @@ public class LazyNettyClientRouteDTO {
|
|||||||
@Schema(description ="路由IP",name ="routeIp",example = "")
|
@Schema(description ="路由IP",name ="routeIp",example = "")
|
||||||
private String routeIp;
|
private String routeIp;
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* 路由端口:默认ALL
|
|
||||||
*/
|
|
||||||
@Schema(description ="路由端口:默认ALL",name ="routePort",example = "")
|
|
||||||
private String routePort;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -55,12 +55,6 @@ public class LazyNettyServerRouteDTO {
|
|||||||
@Schema(description ="路由IP",name ="routeIp",example = "")
|
@Schema(description ="路由IP",name ="routeIp",example = "")
|
||||||
private String routeIp;
|
private String routeIp;
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* 路由端口:默认ALL
|
|
||||||
*/
|
|
||||||
@Schema(description ="路由端口:默认ALL",name ="routePort",example = "")
|
|
||||||
private String routePort;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -62,13 +62,6 @@ public class LazyNettyClientRoute {
|
|||||||
@Schema(description ="路由IP",name ="routeIp",example = "")
|
@Schema(description ="路由IP",name ="routeIp",example = "")
|
||||||
private String routeIp;
|
private String routeIp;
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* 路由端口:默认ALL
|
|
||||||
*/
|
|
||||||
@Schema(description ="路由端口:默认ALL",name ="routePort",example = "")
|
|
||||||
private String routePort;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* 更新时间
|
* 更新时间
|
||||||
|
@ -55,12 +55,6 @@ public class LazyNettyServerRoute {
|
|||||||
@Schema(description ="路由IP",name ="routeIp",example = "")
|
@Schema(description ="路由IP",name ="routeIp",example = "")
|
||||||
private String routeIp;
|
private String routeIp;
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* 路由端口:默认ALL
|
|
||||||
*/
|
|
||||||
@Schema(description ="路由端口:默认ALL",name ="routePort",example = "")
|
|
||||||
private String routePort;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -77,13 +77,6 @@ public class LazyNettyClientRouteDO {
|
|||||||
@LazyTableField(name="route_ip",comment="路由IP",notNull=true,columnType="varchar(255)")
|
@LazyTableField(name="route_ip",comment="路由IP",notNull=true,columnType="varchar(255)")
|
||||||
private String routeIp;
|
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;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -69,13 +69,6 @@ public class LazyNettyServerRouteDO {
|
|||||||
@LazyTableField(name="route_ip",comment="路由IP",notNull=true,columnType="varchar(255)")
|
@LazyTableField(name="route_ip",comment="路由IP",notNull=true,columnType="varchar(255)")
|
||||||
private String routeIp;
|
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;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -17,6 +17,7 @@ import org.springframework.stereotype.Repository;
|
|||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.stream.Collectors;
|
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.LazyUpdateSetValueWrappers;
|
||||||
import org.wu.framework.lazy.orm.database.lambda.stream.wrapper.LazyWrappers;
|
import org.wu.framework.lazy.orm.database.lambda.stream.wrapper.LazyWrappers;
|
||||||
import org.wu.framework.web.response.Result;
|
import org.wu.framework.web.response.Result;
|
||||||
@ -55,9 +56,9 @@ public class LazyNettyClientRouteRepositoryImpl implements LazyNettyClientRout
|
|||||||
lazyLambdaStream.upsert(lazyNettyClientRouteDO);
|
lazyLambdaStream.upsert(lazyNettyClientRouteDO);
|
||||||
|
|
||||||
String routeIp = lazyNettyClientRoute.getRouteIp();
|
String routeIp = lazyNettyClientRoute.getRouteIp();
|
||||||
String routePort = lazyNettyClientRoute.getRoutePort();
|
|
||||||
String clientId = lazyNettyClientRoute.getClientId();
|
String clientId = lazyNettyClientRoute.getClientId();
|
||||||
|
|
||||||
|
String routePort = NormalUsedString.ASTERISK;
|
||||||
// 新增虚拟ip映射
|
// 新增虚拟ip映射
|
||||||
LazyNettyClientVirtualRouteDO lazyNettyClientVirtualRouteDO = new LazyNettyClientVirtualRouteDO();
|
LazyNettyClientVirtualRouteDO lazyNettyClientVirtualRouteDO = new LazyNettyClientVirtualRouteDO();
|
||||||
lazyNettyClientVirtualRouteDO.setIsDeleted(false);
|
lazyNettyClientVirtualRouteDO.setIsDeleted(false);
|
||||||
@ -185,7 +186,6 @@ public class LazyNettyClientRouteRepositoryImpl implements LazyNettyClientRout
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Result<LazyNettyClientRoute> remove(LazyNettyClientRoute lazyNettyClientRoute) {
|
public Result<LazyNettyClientRoute> remove(LazyNettyClientRoute lazyNettyClientRoute) {
|
||||||
LazyNettyClientRouteDO lazyNettyClientRouteDO = LazyNettyClientRouteConverter.INSTANCE.fromLazyNettyClientRoute(lazyNettyClientRoute);
|
|
||||||
lazyLambdaStream.update(LazyUpdateSetValueWrappers.<LazyNettyClientRouteDO>lambdaWrapper()
|
lazyLambdaStream.update(LazyUpdateSetValueWrappers.<LazyNettyClientRouteDO>lambdaWrapper()
|
||||||
.set(LazyNettyClientRouteDO::getIsDeleted, true),
|
.set(LazyNettyClientRouteDO::getIsDeleted, true),
|
||||||
LazyWrappers
|
LazyWrappers
|
||||||
@ -193,6 +193,33 @@ public class LazyNettyClientRouteRepositoryImpl implements LazyNettyClientRout
|
|||||||
.eq(LazyNettyClientRouteDO::getId, lazyNettyClientRoute.getId())
|
.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();
|
return ResultFactory.successOf();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -180,6 +180,37 @@ public class LazyNettyClientVirtualRouteRepositoryImpl implements LazyNettyClien
|
|||||||
.eq(LazyNettyClientVirtualRouteDO::getId, lazyNettyClientVirtualRouteDO.getId())
|
.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();
|
return ResultFactory.successOf();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@ import org.springframework.stereotype.Repository;
|
|||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.stream.Collectors;
|
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.LazyUpdateSetValueWrappers;
|
||||||
import org.wu.framework.lazy.orm.database.lambda.stream.wrapper.LazyWrappers;
|
import org.wu.framework.lazy.orm.database.lambda.stream.wrapper.LazyWrappers;
|
||||||
import org.wu.framework.web.response.Result;
|
import org.wu.framework.web.response.Result;
|
||||||
@ -54,7 +55,7 @@ public class LazyNettyServerRouteRepositoryImpl implements LazyNettyServerRout
|
|||||||
LazyNettyServerRouteDO lazyNettyServerRouteDO = LazyNettyServerRouteConverter.INSTANCE.fromLazyNettyServerRoute(lazyNettyServerRoute);
|
LazyNettyServerRouteDO lazyNettyServerRouteDO = LazyNettyServerRouteConverter.INSTANCE.fromLazyNettyServerRoute(lazyNettyServerRoute);
|
||||||
lazyLambdaStream.upsert(lazyNettyServerRouteDO);
|
lazyLambdaStream.upsert(lazyNettyServerRouteDO);
|
||||||
String routeIp = lazyNettyServerRoute.getRouteIp();
|
String routeIp = lazyNettyServerRoute.getRouteIp();
|
||||||
String routePort = lazyNettyServerRoute.getRoutePort();
|
String routePort = NormalUsedString.ASTERISK;
|
||||||
// 新增虚拟ip映射
|
// 新增虚拟ip映射
|
||||||
LazyNettyServerVirtualRouteDO lazyNettyServerVirtualRouteDO = new LazyNettyServerVirtualRouteDO();
|
LazyNettyServerVirtualRouteDO lazyNettyServerVirtualRouteDO = new LazyNettyServerVirtualRouteDO();
|
||||||
lazyNettyServerVirtualRouteDO.setIsDeleted(false);
|
lazyNettyServerVirtualRouteDO.setIsDeleted(false);
|
||||||
@ -180,7 +181,6 @@ public class LazyNettyServerRouteRepositoryImpl implements LazyNettyServerRout
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Result<LazyNettyServerRoute> remove(LazyNettyServerRoute lazyNettyServerRoute) {
|
public Result<LazyNettyServerRoute> remove(LazyNettyServerRoute lazyNettyServerRoute) {
|
||||||
LazyNettyServerRouteDO lazyNettyServerRouteDO = LazyNettyServerRouteConverter.INSTANCE.fromLazyNettyServerRoute(lazyNettyServerRoute);
|
|
||||||
lazyLambdaStream.update(LazyUpdateSetValueWrappers.<LazyNettyServerRouteDO>lambdaWrapper()
|
lazyLambdaStream.update(LazyUpdateSetValueWrappers.<LazyNettyServerRouteDO>lambdaWrapper()
|
||||||
.set(LazyNettyServerRouteDO::getIsDeleted, true),
|
.set(LazyNettyServerRouteDO::getIsDeleted, true),
|
||||||
LazyWrappers
|
LazyWrappers
|
||||||
@ -188,6 +188,32 @@ public class LazyNettyServerRouteRepositoryImpl implements LazyNettyServerRout
|
|||||||
.eq(LazyNettyServerRouteDO::getId, lazyNettyServerRoute.getId())
|
.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();
|
return ResultFactory.successOf();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -179,6 +179,36 @@ public class LazyNettyServerVirtualRouteRepositoryImpl implements LazyNettyServe
|
|||||||
.eq(LazyNettyServerVirtualRouteDO::getId, lazyNettyServerVirtualRouteDO.getId())
|
.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();
|
return ResultFactory.successOf();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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
@ -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
|
|
||||||
**/
|
|
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user