mirror of
https://gitee.com/wujiawei1207537021/wu-lazy-cloud-network.git
synced 2025-06-16 10:25:07 +08:00
【fix】添加虚拟路由管理
This commit is contained in:
@ -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_);
|
||||
|
@ -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;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -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;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -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;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -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;
|
||||
|
||||
/**
|
||||
*
|
||||
* 更新时间
|
||||
|
@ -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;
|
||||
|
||||
/**
|
||||
*
|
||||
* 更新时间
|
||||
|
@ -84,4 +84,10 @@ public class LazyNettyClientVirtualRouteQueryListCommand {
|
||||
@Schema(description ="客户端虚拟路由端口:默认ALL",name ="virtualPort",example = "")
|
||||
private String virtualPort;
|
||||
|
||||
/**
|
||||
*
|
||||
* 是否删除
|
||||
*/
|
||||
@Schema(description ="是否删除",name ="isDeleted",example = "")
|
||||
private Boolean isDeleted;
|
||||
}
|
@ -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;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -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;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -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;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -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;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -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;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -76,5 +76,11 @@ public class LazyNettyServerVirtualRouteQueryListCommand {
|
||||
*/
|
||||
@Schema(description ="虚拟服务端路由端口:默认ALL",name ="virtualPort",example = "")
|
||||
private String virtualPort;
|
||||
/**
|
||||
*
|
||||
* 是否删除
|
||||
*/
|
||||
@Schema(description ="是否删除",name ="isDeleted",example = "")
|
||||
private Boolean isDeleted;
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -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;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -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;
|
||||
|
||||
/**
|
||||
*
|
||||
* 更新时间
|
||||
|
@ -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;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -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;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -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;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
@ -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.
Reference in New Issue
Block a user