mirror of
https://gitee.com/wujiawei1207537021/wu-lazy-cloud-network.git
synced 2025-06-16 18:35:05 +08:00
[fix] change
This commit is contained in:
84
wu-lazy-cloud-heartbeat-server/pom.xml
Normal file
84
wu-lazy-cloud-heartbeat-server/pom.xml
Normal file
@ -0,0 +1,84 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<groupId>top.wu2020</groupId>
|
||||
<artifactId>wu-smart-agent-network</artifactId>
|
||||
<version>1.2.6-JDK17-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>wu-lazy-cloud-heartbeat-server</artifactId>
|
||||
<description>云上心跳服务端</description>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>top.wu2020</groupId>
|
||||
<artifactId>wu-framework-web</artifactId>
|
||||
</dependency>
|
||||
<!-- 通用心跳包 -->
|
||||
<dependency>
|
||||
<groupId>top.wu2020</groupId>
|
||||
<artifactId>wu-lazy-cloud-heartbeat-common</artifactId>
|
||||
</dependency>
|
||||
<!-- 数据库 -->
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>8.0.33</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>top.wu2020</groupId>
|
||||
<artifactId>wu-database-lazy-plus-starter</artifactId>
|
||||
</dependency>
|
||||
<!-- 授权平台 -->
|
||||
<dependency>
|
||||
<groupId>top.wu2020</groupId>
|
||||
<artifactId>wu-authorization-server-platform-starter</artifactId>
|
||||
</dependency>
|
||||
<!-- jvm -->
|
||||
<dependency>
|
||||
<groupId>top.wu2020</groupId>
|
||||
<artifactId>wu-jvm-server-platform-starter</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
<version>2.0.50</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.swagger.core.v3</groupId>
|
||||
<artifactId>swagger-annotations-jakarta</artifactId>
|
||||
<version>2.2.21</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>top.wu2020</groupId>
|
||||
<artifactId>wu-framework-lazy-orm-spring-starter</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>top.wu2020</groupId>
|
||||
<artifactId>wu-log-server-platform-starter</artifactId>
|
||||
</dependency>
|
||||
<!-- 内网穿透客户端 -->
|
||||
<dependency>
|
||||
<groupId>top.wu2020</groupId>
|
||||
<artifactId>wu-lazy-cloud-heartbeat-client</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>maven_central</id>
|
||||
<name>Maven Central</name>
|
||||
<url>https://repo.maven.apache.org/maven2/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
</project>
|
@ -0,0 +1,12 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server;
|
||||
|
||||
import org.wu.framework.lazy.orm.core.stereotype.LazyScan;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
|
||||
@LazyScan(scanBasePackages = {
|
||||
"org.framework.smart.agent.network.heartbeat.server.standalone.infrastructure.entity",
|
||||
"org.framework.smart.agent.network.heartbeat.server.cluster.infrastructure.entity"
|
||||
})
|
||||
@ComponentScan(basePackages = "org.framework.smart.agent.network.heartbeat.server")
|
||||
public class EnableHeartbeatServerAutoConfiguration {
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server;
|
||||
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
|
||||
|
||||
@ComponentScan(basePackages = {"org.framework.smart.agent.network.heartbeat.server.cluster"})
|
||||
public class EnableHeartbeatServerClusterAutoConfiguration {
|
||||
}
|
@ -0,0 +1,128 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.cluster.application;
|
||||
|
||||
import org.framework.smart.agent.network.heartbeat.server.cluster.domain.model.cluster.node.LazyNettyClusterNode;
|
||||
import org.wu.framework.web.response.Result;
|
||||
import org.framework.smart.agent.network.heartbeat.server.cluster.application.command.lazy.netty.cluster.node.LazyNettyClusterNodeRemoveCommand;
|
||||
import org.framework.smart.agent.network.heartbeat.server.cluster.application.command.lazy.netty.cluster.node.LazyNettyClusterNodeStoryCommand;
|
||||
import org.framework.smart.agent.network.heartbeat.server.cluster.application.command.lazy.netty.cluster.node.LazyNettyClusterNodeUpdateCommand;
|
||||
import org.framework.smart.agent.network.heartbeat.server.cluster.application.command.lazy.netty.cluster.node.LazyNettyClusterNodeQueryListCommand;
|
||||
import org.framework.smart.agent.network.heartbeat.server.cluster.application.command.lazy.netty.cluster.node.LazyNettyClusterNodeQueryOneCommand;
|
||||
import org.framework.smart.agent.network.heartbeat.server.cluster.application.dto.LazyNettyClusterNodeDTO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.wu.framework.lazy.orm.database.lambda.domain.LazyPage;
|
||||
|
||||
/**
|
||||
* describe 集群配置信息
|
||||
*
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/04/12 02:16 下午
|
||||
* @see org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyApplication
|
||||
**/
|
||||
|
||||
public interface LazyNettyClusterNodeApplication {
|
||||
|
||||
|
||||
/**
|
||||
* describe 新增集群配置信息
|
||||
*
|
||||
* @param lazyNettyClusterNodeStoryCommand 新增集群配置信息
|
||||
* @return {@link Result< LazyNettyClusterNode >} 集群配置信息新增后领域对象
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/04/12 02:16 下午
|
||||
**/
|
||||
|
||||
Result<LazyNettyClusterNode> story(LazyNettyClusterNodeStoryCommand lazyNettyClusterNodeStoryCommand);
|
||||
|
||||
/**
|
||||
* describe 批量新增集群配置信息
|
||||
*
|
||||
* @param lazyNettyClusterNodeStoryCommandList 批量新增集群配置信息
|
||||
* @return {@link Result<List<LazyNettyClusterNode>>} 集群配置信息新增后领域对象集合
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/04/12 02:16 下午
|
||||
**/
|
||||
|
||||
Result<List<LazyNettyClusterNode>> batchStory(List<LazyNettyClusterNodeStoryCommand> lazyNettyClusterNodeStoryCommandList);
|
||||
|
||||
/**
|
||||
* describe 更新集群配置信息
|
||||
*
|
||||
* @param lazyNettyClusterNodeUpdateCommand 更新集群配置信息
|
||||
* @return {@link Result<LazyNettyClusterNode>} 集群配置信息领域对象
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/04/12 02:16 下午
|
||||
**/
|
||||
|
||||
Result<LazyNettyClusterNode> updateOne(LazyNettyClusterNodeUpdateCommand lazyNettyClusterNodeUpdateCommand);
|
||||
|
||||
/**
|
||||
* describe 查询单个集群配置信息
|
||||
*
|
||||
* @param lazyNettyClusterNodeQueryOneCommand 查询单个集群配置信息
|
||||
* @return {@link Result<LazyNettyClusterNodeDTO>} 集群配置信息DTO对象
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/04/12 02:16 下午
|
||||
**/
|
||||
|
||||
Result<LazyNettyClusterNodeDTO> findOne(LazyNettyClusterNodeQueryOneCommand lazyNettyClusterNodeQueryOneCommand);
|
||||
|
||||
/**
|
||||
* describe 查询多个集群配置信息
|
||||
*
|
||||
* @param lazyNettyClusterNodeQueryListCommand 查询多个集群配置信息
|
||||
* @return {@link Result <List<LazyNettyClusterNodeDTO>>} 集群配置信息DTO对象
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/04/12 02:16 下午
|
||||
**/
|
||||
|
||||
Result<List<LazyNettyClusterNodeDTO>> findList(LazyNettyClusterNodeQueryListCommand lazyNettyClusterNodeQueryListCommand);
|
||||
|
||||
/**
|
||||
* describe 分页查询多个集群配置信息
|
||||
*
|
||||
* @param lazyNettyClusterNodeQueryListCommand 分页查询多个集群配置信息
|
||||
* @return {@link Result <LazyPage<LazyNettyClusterNodeDTO>>} 分页集群配置信息DTO对象
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/04/12 02:16 下午
|
||||
**/
|
||||
|
||||
Result<LazyPage<LazyNettyClusterNodeDTO>> findPage(int size, int current, LazyNettyClusterNodeQueryListCommand lazyNettyClusterNodeQueryListCommand);
|
||||
|
||||
/**
|
||||
* describe 删除集群配置信息
|
||||
*
|
||||
* @param lazyNettyClusterNodeRemoveCommand 删除集群配置信息
|
||||
* @return {@link Result<LazyNettyClusterNode>} 集群配置信息
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/04/12 02:16 下午
|
||||
**/
|
||||
|
||||
Result<LazyNettyClusterNode> remove(LazyNettyClusterNodeRemoveCommand lazyNettyClusterNodeRemoveCommand);
|
||||
|
||||
/**
|
||||
* 启动 集群节点
|
||||
*
|
||||
* @param lazyNettyClusterNode 配置
|
||||
*/
|
||||
void starterOneClusterNode(LazyNettyClusterNode lazyNettyClusterNode);
|
||||
|
||||
/**
|
||||
* 启动集群所有节点
|
||||
*/
|
||||
void starterClusterNodes();
|
||||
|
||||
/**
|
||||
* 关闭 集群节点
|
||||
*
|
||||
* @param needCloseLazyNettyClusterNode 配置
|
||||
*/
|
||||
void destroyOneClusterNode(LazyNettyClusterNode needCloseLazyNettyClusterNode);
|
||||
|
||||
/**
|
||||
* 关闭 集群上所有节点
|
||||
*/
|
||||
void destroyClusterNodes();
|
||||
|
||||
}
|
@ -0,0 +1,93 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.cluster.application.assembler;
|
||||
|
||||
import org.framework.smart.agent.network.heartbeat.server.cluster.domain.model.cluster.node.LazyNettyClusterNode;
|
||||
import org.framework.smart.agent.network.heartbeat.server.cluster.application.command.lazy.netty.cluster.node.LazyNettyClusterNodeRemoveCommand;
|
||||
import org.framework.smart.agent.network.heartbeat.server.cluster.application.command.lazy.netty.cluster.node.LazyNettyClusterNodeStoryCommand;
|
||||
import org.framework.smart.agent.network.heartbeat.server.cluster.application.command.lazy.netty.cluster.node.LazyNettyClusterNodeUpdateCommand;
|
||||
import org.framework.smart.agent.network.heartbeat.server.cluster.application.command.lazy.netty.cluster.node.LazyNettyClusterNodeQueryListCommand;
|
||||
import org.framework.smart.agent.network.heartbeat.server.cluster.application.command.lazy.netty.cluster.node.LazyNettyClusterNodeQueryOneCommand;
|
||||
import org.framework.smart.agent.network.heartbeat.server.cluster.application.dto.LazyNettyClusterNodeDTO;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
import org.mapstruct.Mapper;
|
||||
/**
|
||||
* describe 集群配置信息
|
||||
*
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/04/12 02:16 下午
|
||||
* @see org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyAssembler
|
||||
**/
|
||||
@Mapper
|
||||
public interface LazyNettyClusterNodeDTOAssembler {
|
||||
|
||||
|
||||
/**
|
||||
* describe MapStruct 创建的代理对象
|
||||
*
|
||||
|
||||
|
||||
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/04/12 02:16 下午
|
||||
**/
|
||||
LazyNettyClusterNodeDTOAssembler INSTANCE = Mappers.getMapper(LazyNettyClusterNodeDTOAssembler.class);
|
||||
/**
|
||||
* describe 应用层存储入参转换成 领域对象
|
||||
*
|
||||
* @param lazyNettyClusterNodeStoryCommand 保存集群配置信息对象
|
||||
* @return {@link LazyNettyClusterNode} 集群配置信息领域对象
|
||||
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/04/12 02:16 下午
|
||||
**/
|
||||
LazyNettyClusterNode toLazyNettyClusterNode(LazyNettyClusterNodeStoryCommand lazyNettyClusterNodeStoryCommand);
|
||||
/**
|
||||
* describe 应用层更新入参转换成 领域对象
|
||||
*
|
||||
* @param lazyNettyClusterNodeUpdateCommand 更新集群配置信息对象
|
||||
* @return {@link LazyNettyClusterNode} 集群配置信息领域对象
|
||||
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/04/12 02:16 下午
|
||||
**/
|
||||
LazyNettyClusterNode toLazyNettyClusterNode(LazyNettyClusterNodeUpdateCommand lazyNettyClusterNodeUpdateCommand);
|
||||
/**
|
||||
* describe 应用层查询入参转换成 领域对象
|
||||
*
|
||||
* @param lazyNettyClusterNodeQueryOneCommand 查询单个集群配置信息对象参数
|
||||
* @return {@link LazyNettyClusterNode} 集群配置信息领域对象
|
||||
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/04/12 02:16 下午
|
||||
**/
|
||||
LazyNettyClusterNode toLazyNettyClusterNode(LazyNettyClusterNodeQueryOneCommand lazyNettyClusterNodeQueryOneCommand);
|
||||
/**
|
||||
* describe 应用层查询入参转换成 领域对象
|
||||
*
|
||||
* @param lazyNettyClusterNodeQueryListCommand 查询集合集群配置信息对象参数
|
||||
* @return {@link LazyNettyClusterNode} 集群配置信息领域对象
|
||||
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/04/12 02:16 下午
|
||||
**/
|
||||
LazyNettyClusterNode toLazyNettyClusterNode(LazyNettyClusterNodeQueryListCommand lazyNettyClusterNodeQueryListCommand);
|
||||
/**
|
||||
* describe 应用层删除入参转换成 领域对象
|
||||
*
|
||||
* @param lazyNettyClusterNodeRemoveCommand 删除集群配置信息对象参数
|
||||
* @return {@link LazyNettyClusterNode} 集群配置信息领域对象
|
||||
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/04/12 02:16 下午
|
||||
**/
|
||||
LazyNettyClusterNode toLazyNettyClusterNode(LazyNettyClusterNodeRemoveCommand lazyNettyClusterNodeRemoveCommand);
|
||||
/**
|
||||
* describe 持久层领域对象转换成DTO对象
|
||||
*
|
||||
* @param lazyNettyClusterNode 集群配置信息领域对象
|
||||
* @return {@link LazyNettyClusterNodeDTO} 集群配置信息DTO对象
|
||||
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/04/12 02:16 下午
|
||||
**/
|
||||
LazyNettyClusterNodeDTO fromLazyNettyClusterNode(LazyNettyClusterNode lazyNettyClusterNode);
|
||||
}
|
@ -0,0 +1,78 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.cluster.application.command.lazy.netty.cluster.node;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import org.framework.smart.agent.network.heartbeat.common.enums.NettyClientStatus;
|
||||
|
||||
import java.lang.String;
|
||||
import java.lang.Integer;
|
||||
import java.time.LocalDateTime;
|
||||
import java.lang.Boolean;
|
||||
/**
|
||||
* describe 集群配置信息
|
||||
*
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/04/12 02:16 下午
|
||||
* @see org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyQueryListCommand
|
||||
**/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Schema(title = "lazy_netty_cluster_node_query_List_command",description = "集群配置信息")
|
||||
public class LazyNettyClusterNodeQueryListCommand {
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* 集群节点host
|
||||
*/
|
||||
@Schema(description ="集群节点host",name ="clusterNodeHost",example = "")
|
||||
private String clusterNodeHost;
|
||||
|
||||
/**
|
||||
*
|
||||
* 集群节点ID
|
||||
*/
|
||||
@Schema(description ="集群节点ID",name ="clusterNodeId",example = "")
|
||||
private String clusterNodeId;
|
||||
|
||||
/**
|
||||
*
|
||||
* 集群节点端口
|
||||
*/
|
||||
@Schema(description ="集群节点端口",name ="clusterNodePort",example = "")
|
||||
private Integer clusterNodePort;
|
||||
|
||||
/**
|
||||
*
|
||||
* 创建时间
|
||||
*/
|
||||
@Schema(description ="创建时间",name ="createTime",example = "")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
*
|
||||
* 是否删除
|
||||
*/
|
||||
@Schema(description ="是否删除",name ="isDeleted",example = "")
|
||||
private Boolean isDeleted;
|
||||
|
||||
/**
|
||||
*
|
||||
* 角色
|
||||
*/
|
||||
@Schema(description ="角色",name ="role",example = "")
|
||||
private String role;
|
||||
|
||||
/**
|
||||
*
|
||||
* 更新时间
|
||||
*/
|
||||
@Schema(description ="更新时间",name ="updateTime",example = "")
|
||||
private LocalDateTime updateTime;
|
||||
/**
|
||||
* 在线状态(true在线,false离线)
|
||||
*/
|
||||
@Schema(description = "在线状态(true在线,false离线)", name = "clusterNodeStatus", example = "")
|
||||
private NettyClientStatus clusterNodeStatus;
|
||||
}
|
@ -0,0 +1,79 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.cluster.application.command.lazy.netty.cluster.node;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import org.framework.smart.agent.network.heartbeat.common.enums.NettyClientStatus;
|
||||
|
||||
import java.lang.String;
|
||||
import java.lang.Integer;
|
||||
import java.time.LocalDateTime;
|
||||
import java.lang.Boolean;
|
||||
/**
|
||||
* describe 集群配置信息
|
||||
*
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/04/12 02:16 下午
|
||||
* @see org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyQueryOneCommand
|
||||
**/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Schema(title = "lazy_netty_cluster_node_query_one_command",description = "集群配置信息")
|
||||
public class LazyNettyClusterNodeQueryOneCommand {
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* 集群节点host
|
||||
*/
|
||||
@Schema(description ="集群节点host",name ="clusterNodeHost",example = "")
|
||||
private String clusterNodeHost;
|
||||
|
||||
/**
|
||||
*
|
||||
* 集群节点ID
|
||||
*/
|
||||
@Schema(description ="集群节点ID",name ="clusterNodeId",example = "")
|
||||
private String clusterNodeId;
|
||||
|
||||
/**
|
||||
*
|
||||
* 集群节点端口
|
||||
*/
|
||||
@Schema(description ="集群节点端口",name ="clusterNodePort",example = "")
|
||||
private Integer clusterNodePort;
|
||||
|
||||
/**
|
||||
*
|
||||
* 创建时间
|
||||
*/
|
||||
@Schema(description ="创建时间",name ="createTime",example = "")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
*
|
||||
* 是否删除
|
||||
*/
|
||||
@Schema(description ="是否删除",name ="isDeleted",example = "")
|
||||
private Boolean isDeleted;
|
||||
|
||||
/**
|
||||
*
|
||||
* 角色
|
||||
*/
|
||||
@Schema(description ="角色",name ="role",example = "")
|
||||
private String role;
|
||||
|
||||
/**
|
||||
*
|
||||
* 更新时间
|
||||
*/
|
||||
@Schema(description ="更新时间",name ="updateTime",example = "")
|
||||
private LocalDateTime updateTime;
|
||||
/**
|
||||
* 在线状态(true在线,false离线)
|
||||
*/
|
||||
@Schema(description = "在线状态(true在线,false离线)", name = "clusterNodeStatus", example = "")
|
||||
private NettyClientStatus clusterNodeStatus;
|
||||
|
||||
}
|
@ -0,0 +1,79 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.cluster.application.command.lazy.netty.cluster.node;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import org.framework.smart.agent.network.heartbeat.common.enums.NettyClientStatus;
|
||||
|
||||
import java.lang.String;
|
||||
import java.lang.Integer;
|
||||
import java.time.LocalDateTime;
|
||||
import java.lang.Boolean;
|
||||
/**
|
||||
* describe 集群配置信息
|
||||
*
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/04/12 02:16 下午
|
||||
* @see org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyRemoveCommand
|
||||
**/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Schema(title = "lazy_netty_cluster_node_remove_command",description = "集群配置信息")
|
||||
public class LazyNettyClusterNodeRemoveCommand {
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* 集群节点host
|
||||
*/
|
||||
@Schema(description ="集群节点host",name ="clusterNodeHost",example = "")
|
||||
private String clusterNodeHost;
|
||||
|
||||
/**
|
||||
*
|
||||
* 集群节点ID
|
||||
*/
|
||||
@Schema(description ="集群节点ID",name ="clusterNodeId",example = "")
|
||||
private String clusterNodeId;
|
||||
|
||||
/**
|
||||
*
|
||||
* 集群节点端口
|
||||
*/
|
||||
@Schema(description ="集群节点端口",name ="clusterNodePort",example = "")
|
||||
private Integer clusterNodePort;
|
||||
|
||||
/**
|
||||
*
|
||||
* 创建时间
|
||||
*/
|
||||
@Schema(description ="创建时间",name ="createTime",example = "")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
*
|
||||
* 是否删除
|
||||
*/
|
||||
@Schema(description ="是否删除",name ="isDeleted",example = "")
|
||||
private Boolean isDeleted;
|
||||
|
||||
/**
|
||||
*
|
||||
* 角色
|
||||
*/
|
||||
@Schema(description ="角色",name ="role",example = "")
|
||||
private String role;
|
||||
|
||||
/**
|
||||
*
|
||||
* 更新时间
|
||||
*/
|
||||
@Schema(description ="更新时间",name ="updateTime",example = "")
|
||||
private LocalDateTime updateTime;
|
||||
/**
|
||||
* 在线状态(true在线,false离线)
|
||||
*/
|
||||
@Schema(description = "在线状态(true在线,false离线)", name = "clusterNodeStatus", example = "")
|
||||
private NettyClientStatus clusterNodeStatus;
|
||||
|
||||
}
|
@ -0,0 +1,79 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.cluster.application.command.lazy.netty.cluster.node;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import org.framework.smart.agent.network.heartbeat.common.enums.NettyClientStatus;
|
||||
|
||||
import java.lang.String;
|
||||
import java.lang.Integer;
|
||||
import java.time.LocalDateTime;
|
||||
import java.lang.Boolean;
|
||||
/**
|
||||
* describe 集群配置信息
|
||||
*
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/04/12 02:16 下午
|
||||
* @see org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyStoryCommand
|
||||
**/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Schema(title = "lazy_netty_cluster_node_story_command",description = "集群配置信息")
|
||||
public class LazyNettyClusterNodeStoryCommand {
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* 集群节点host
|
||||
*/
|
||||
@Schema(description ="集群节点host",name ="clusterNodeHost",example = "")
|
||||
private String clusterNodeHost;
|
||||
|
||||
/**
|
||||
*
|
||||
* 集群节点ID
|
||||
*/
|
||||
@Schema(description ="集群节点ID",name ="clusterNodeId",example = "")
|
||||
private String clusterNodeId;
|
||||
|
||||
/**
|
||||
*
|
||||
* 集群节点端口
|
||||
*/
|
||||
@Schema(description ="集群节点端口",name ="clusterNodePort",example = "")
|
||||
private Integer clusterNodePort;
|
||||
|
||||
/**
|
||||
*
|
||||
* 创建时间
|
||||
*/
|
||||
@Schema(description ="创建时间",name ="createTime",example = "")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
*
|
||||
* 是否删除
|
||||
*/
|
||||
@Schema(description ="是否删除",name ="isDeleted",example = "")
|
||||
private Boolean isDeleted;
|
||||
|
||||
/**
|
||||
*
|
||||
* 角色
|
||||
*/
|
||||
@Schema(description ="角色",name ="role",example = "")
|
||||
private String role;
|
||||
|
||||
/**
|
||||
*
|
||||
* 更新时间
|
||||
*/
|
||||
@Schema(description ="更新时间",name ="updateTime",example = "")
|
||||
private LocalDateTime updateTime;
|
||||
/**
|
||||
* 在线状态(true在线,false离线)
|
||||
*/
|
||||
@Schema(description = "在线状态(true在线,false离线)", name = "clusterNodeStatus", example = "")
|
||||
private NettyClientStatus clusterNodeStatus;
|
||||
|
||||
}
|
@ -0,0 +1,79 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.cluster.application.command.lazy.netty.cluster.node;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import org.framework.smart.agent.network.heartbeat.common.enums.NettyClientStatus;
|
||||
|
||||
import java.lang.String;
|
||||
import java.lang.Integer;
|
||||
import java.time.LocalDateTime;
|
||||
import java.lang.Boolean;
|
||||
/**
|
||||
* describe 集群配置信息
|
||||
*
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/04/12 02:16 下午
|
||||
* @see org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyUpdateCommand
|
||||
**/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Schema(title = "lazy_netty_cluster_node_update_command",description = "集群配置信息")
|
||||
public class LazyNettyClusterNodeUpdateCommand {
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* 集群节点host
|
||||
*/
|
||||
@Schema(description ="集群节点host",name ="clusterNodeHost",example = "")
|
||||
private String clusterNodeHost;
|
||||
|
||||
/**
|
||||
*
|
||||
* 集群节点ID
|
||||
*/
|
||||
@Schema(description ="集群节点ID",name ="clusterNodeId",example = "")
|
||||
private String clusterNodeId;
|
||||
|
||||
/**
|
||||
*
|
||||
* 集群节点端口
|
||||
*/
|
||||
@Schema(description ="集群节点端口",name ="clusterNodePort",example = "")
|
||||
private Integer clusterNodePort;
|
||||
|
||||
/**
|
||||
*
|
||||
* 创建时间
|
||||
*/
|
||||
@Schema(description ="创建时间",name ="createTime",example = "")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
*
|
||||
* 是否删除
|
||||
*/
|
||||
@Schema(description ="是否删除",name ="isDeleted",example = "")
|
||||
private Boolean isDeleted;
|
||||
|
||||
/**
|
||||
*
|
||||
* 角色
|
||||
*/
|
||||
@Schema(description ="角色",name ="role",example = "")
|
||||
private String role;
|
||||
|
||||
/**
|
||||
*
|
||||
* 更新时间
|
||||
*/
|
||||
@Schema(description ="更新时间",name ="updateTime",example = "")
|
||||
private LocalDateTime updateTime;
|
||||
/**
|
||||
* 在线状态(true在线,false离线)
|
||||
*/
|
||||
@Schema(description = "在线状态(true在线,false离线)", name = "clusterNodeStatus", example = "")
|
||||
private NettyClientStatus clusterNodeStatus;
|
||||
|
||||
}
|
@ -0,0 +1,76 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.cluster.application.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import org.framework.smart.agent.network.heartbeat.common.enums.NettyClientStatus;
|
||||
|
||||
import java.lang.String;
|
||||
import java.lang.Integer;
|
||||
import java.time.LocalDateTime;
|
||||
import java.lang.Boolean;
|
||||
|
||||
/**
|
||||
* describe 集群配置信息
|
||||
*
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/04/12 02:16 下午
|
||||
* @see org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyDTO
|
||||
**/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Schema(title = "lazy_netty_cluster_node_command_dto", description = "集群配置信息")
|
||||
public class LazyNettyClusterNodeDTO {
|
||||
|
||||
|
||||
/**
|
||||
* 集群节点host
|
||||
*/
|
||||
@Schema(description = "集群节点host", name = "clusterNodeHost", example = "")
|
||||
private String clusterNodeHost;
|
||||
|
||||
/**
|
||||
* 集群节点ID
|
||||
*/
|
||||
@Schema(description = "集群节点ID", name = "clusterNodeId", example = "")
|
||||
private String clusterNodeId;
|
||||
|
||||
/**
|
||||
* 集群节点端口
|
||||
*/
|
||||
@Schema(description = "集群节点端口", name = "clusterNodePort", example = "")
|
||||
private Integer clusterNodePort;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
@Schema(description = "创建时间", name = "createTime", example = "")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
@Schema(description = "是否删除", name = "isDeleted", example = "")
|
||||
private Boolean isDeleted;
|
||||
|
||||
/**
|
||||
* 角色
|
||||
*/
|
||||
@Schema(description = "角色", name = "role", example = "")
|
||||
private String role;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
@Schema(description = "更新时间", name = "updateTime", example = "")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 在线状态(true在线,false离线)
|
||||
*/
|
||||
@Schema(description = "在线状态(true在线,false离线)", name = "clusterNodeStatus", example = "")
|
||||
private NettyClientStatus clusterNodeStatus;
|
||||
}
|
@ -0,0 +1,272 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.cluster.application.impl;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.framework.smart.agent.network.heartbeat.client.netty.event.ClientChangeEvent;
|
||||
import org.framework.smart.agent.network.heartbeat.client.netty.socket.NettyClientSocket;
|
||||
import org.framework.smart.agent.network.heartbeat.common.advanced.HandleChannelTypeAdvanced;
|
||||
import org.framework.smart.agent.network.heartbeat.server.cluster.domain.model.cluster.node.LazyNettyClusterNode;
|
||||
import org.framework.smart.agent.network.heartbeat.server.properties.ServerNodeProperties;
|
||||
import org.wu.framework.database.lazy.web.plus.stereotype.LazyApplication;
|
||||
import org.framework.smart.agent.network.heartbeat.server.cluster.application.LazyNettyClusterNodeApplication;
|
||||
import org.wu.framework.web.response.Result;
|
||||
import org.framework.smart.agent.network.heartbeat.server.cluster.application.command.lazy.netty.cluster.node.LazyNettyClusterNodeRemoveCommand;
|
||||
import org.framework.smart.agent.network.heartbeat.server.cluster.application.command.lazy.netty.cluster.node.LazyNettyClusterNodeStoryCommand;
|
||||
import org.framework.smart.agent.network.heartbeat.server.cluster.application.command.lazy.netty.cluster.node.LazyNettyClusterNodeUpdateCommand;
|
||||
import org.framework.smart.agent.network.heartbeat.server.cluster.application.command.lazy.netty.cluster.node.LazyNettyClusterNodeQueryListCommand;
|
||||
import org.framework.smart.agent.network.heartbeat.server.cluster.application.command.lazy.netty.cluster.node.LazyNettyClusterNodeQueryOneCommand;
|
||||
import org.framework.smart.agent.network.heartbeat.server.cluster.application.assembler.LazyNettyClusterNodeDTOAssembler;
|
||||
import org.framework.smart.agent.network.heartbeat.server.cluster.application.dto.LazyNettyClusterNodeDTO;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.ArrayBlockingQueue;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
import org.framework.smart.agent.network.heartbeat.server.cluster.domain.model.cluster.node.LazyNettyClusterNodeRepository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.wu.framework.lazy.orm.database.lambda.domain.LazyPage;
|
||||
|
||||
/**
|
||||
* describe 集群配置信息
|
||||
*
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/04/12 02:16 下午
|
||||
* @see org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyApplicationImpl
|
||||
**/
|
||||
@Slf4j
|
||||
@LazyApplication
|
||||
public class LazyNettyClusterNodeApplicationImpl implements LazyNettyClusterNodeApplication {
|
||||
|
||||
@Resource
|
||||
LazyNettyClusterNodeRepository lazyNettyClusterNodeRepository;
|
||||
|
||||
@Resource
|
||||
ClientChangeEvent clientChangeEvent;
|
||||
|
||||
@Resource
|
||||
List<HandleChannelTypeAdvanced> handleChannelTypeAdvancedList; // 处理服务端发送过来的数据类型
|
||||
|
||||
@Resource
|
||||
ServerNodeProperties serverNodeProperties;
|
||||
|
||||
// 缓存连接集群 socket
|
||||
private final ConcurrentHashMap<LazyNettyClusterNode, NettyClientSocket> cacheClusterNettyClientSocketMap = new ConcurrentHashMap<>();
|
||||
|
||||
public static final ThreadPoolExecutor NETTY_CLUSTER_CLIENT_EXECUTOR =
|
||||
new ThreadPoolExecutor(20, 50, 200, TimeUnit.MILLISECONDS,
|
||||
new ArrayBlockingQueue<>(1));
|
||||
|
||||
/**
|
||||
* describe 新增集群配置信息
|
||||
*
|
||||
* @param lazyNettyClusterNodeStoryCommand 新增集群配置信息
|
||||
* @return {@link Result<LazyNettyClusterNode>} 集群配置信息新增后领域对象
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/04/12 02:16 下午
|
||||
**/
|
||||
|
||||
@Override
|
||||
public Result<LazyNettyClusterNode> story(LazyNettyClusterNodeStoryCommand lazyNettyClusterNodeStoryCommand) {
|
||||
LazyNettyClusterNode lazyNettyClusterNode = LazyNettyClusterNodeDTOAssembler.INSTANCE.toLazyNettyClusterNode(lazyNettyClusterNodeStoryCommand);
|
||||
return lazyNettyClusterNodeRepository.story(lazyNettyClusterNode);
|
||||
}
|
||||
|
||||
/**
|
||||
* describe 批量新增集群配置信息
|
||||
*
|
||||
* @param lazyNettyClusterNodeStoryCommandList 批量新增集群配置信息
|
||||
* @return {@link Result<List<LazyNettyClusterNode>>} 集群配置信息新增后领域对象集合
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/04/12 02:16 下午
|
||||
**/
|
||||
|
||||
@Override
|
||||
public Result<List<LazyNettyClusterNode>> batchStory(List<LazyNettyClusterNodeStoryCommand> lazyNettyClusterNodeStoryCommandList) {
|
||||
List<LazyNettyClusterNode> lazyNettyClusterNodeList = lazyNettyClusterNodeStoryCommandList.stream().map(LazyNettyClusterNodeDTOAssembler.INSTANCE::toLazyNettyClusterNode).collect(Collectors.toList());
|
||||
return lazyNettyClusterNodeRepository.batchStory(lazyNettyClusterNodeList);
|
||||
}
|
||||
|
||||
/**
|
||||
* describe 更新集群配置信息
|
||||
*
|
||||
* @param lazyNettyClusterNodeUpdateCommand 更新集群配置信息
|
||||
* @return {@link Result<LazyNettyClusterNode>} 集群配置信息领域对象
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/04/12 02:16 下午
|
||||
**/
|
||||
|
||||
@Override
|
||||
public Result<LazyNettyClusterNode> updateOne(LazyNettyClusterNodeUpdateCommand lazyNettyClusterNodeUpdateCommand) {
|
||||
LazyNettyClusterNode lazyNettyClusterNode = LazyNettyClusterNodeDTOAssembler.INSTANCE.toLazyNettyClusterNode(lazyNettyClusterNodeUpdateCommand);
|
||||
return lazyNettyClusterNodeRepository.story(lazyNettyClusterNode);
|
||||
}
|
||||
|
||||
/**
|
||||
* describe 查询单个集群配置信息
|
||||
*
|
||||
* @param lazyNettyClusterNodeQueryOneCommand 查询单个集群配置信息
|
||||
* @return {@link Result<LazyNettyClusterNodeDTO>} 集群配置信息DTO对象
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/04/12 02:16 下午
|
||||
**/
|
||||
|
||||
@Override
|
||||
public Result<LazyNettyClusterNodeDTO> findOne(LazyNettyClusterNodeQueryOneCommand lazyNettyClusterNodeQueryOneCommand) {
|
||||
LazyNettyClusterNode lazyNettyClusterNode = LazyNettyClusterNodeDTOAssembler.INSTANCE.toLazyNettyClusterNode(lazyNettyClusterNodeQueryOneCommand);
|
||||
return lazyNettyClusterNodeRepository.findOne(lazyNettyClusterNode).convert(LazyNettyClusterNodeDTOAssembler.INSTANCE::fromLazyNettyClusterNode);
|
||||
}
|
||||
|
||||
/**
|
||||
* describe 查询多个集群配置信息
|
||||
*
|
||||
* @param lazyNettyClusterNodeQueryListCommand 查询多个集群配置信息
|
||||
* @return {@link Result<List<LazyNettyClusterNodeDTO>>} 集群配置信息DTO对象
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/04/12 02:16 下午
|
||||
**/
|
||||
|
||||
@Override
|
||||
public Result<List<LazyNettyClusterNodeDTO>> findList(LazyNettyClusterNodeQueryListCommand lazyNettyClusterNodeQueryListCommand) {
|
||||
LazyNettyClusterNode lazyNettyClusterNode = LazyNettyClusterNodeDTOAssembler.INSTANCE.toLazyNettyClusterNode(lazyNettyClusterNodeQueryListCommand);
|
||||
return lazyNettyClusterNodeRepository.findList(lazyNettyClusterNode).convert(lazyNettyClusterNodes -> lazyNettyClusterNodes.stream().map(LazyNettyClusterNodeDTOAssembler.INSTANCE::fromLazyNettyClusterNode).collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
/**
|
||||
* describe 分页查询多个集群配置信息
|
||||
*
|
||||
* @param lazyNettyClusterNodeQueryListCommand 分页查询多个集群配置信息
|
||||
* @return {@link Result<LazyPage<LazyNettyClusterNodeDTO>>} 分页集群配置信息DTO对象
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/04/12 02:16 下午
|
||||
**/
|
||||
|
||||
@Override
|
||||
public Result<LazyPage<LazyNettyClusterNodeDTO>> findPage(int size, int current, LazyNettyClusterNodeQueryListCommand lazyNettyClusterNodeQueryListCommand) {
|
||||
LazyNettyClusterNode lazyNettyClusterNode = LazyNettyClusterNodeDTOAssembler.INSTANCE.toLazyNettyClusterNode(lazyNettyClusterNodeQueryListCommand);
|
||||
return lazyNettyClusterNodeRepository.findPage(size, current, lazyNettyClusterNode).convert(page -> page.convert(LazyNettyClusterNodeDTOAssembler.INSTANCE::fromLazyNettyClusterNode));
|
||||
}
|
||||
|
||||
/**
|
||||
* describe 删除集群配置信息
|
||||
*
|
||||
* @param lazyNettyClusterNodeRemoveCommand 删除集群配置信息
|
||||
* @return {@link Result<LazyNettyClusterNode>} 集群配置信息
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/04/12 02:16 下午
|
||||
**/
|
||||
|
||||
@Override
|
||||
public Result<LazyNettyClusterNode> remove(LazyNettyClusterNodeRemoveCommand lazyNettyClusterNodeRemoveCommand) {
|
||||
LazyNettyClusterNode lazyNettyClusterNode = LazyNettyClusterNodeDTOAssembler.INSTANCE.toLazyNettyClusterNode(lazyNettyClusterNodeRemoveCommand);
|
||||
return lazyNettyClusterNodeRepository.remove(lazyNettyClusterNode);
|
||||
}
|
||||
|
||||
/**
|
||||
* 启动 集群节点
|
||||
*
|
||||
* @param lazyNettyClusterNode 配置
|
||||
*/
|
||||
@Override
|
||||
public void starterOneClusterNode(LazyNettyClusterNode lazyNettyClusterNode) {
|
||||
|
||||
String inetHost = lazyNettyClusterNode.getClusterNodeHost();
|
||||
Integer inetPort = lazyNettyClusterNode.getClusterNodePort();
|
||||
String clusterNodeId = lazyNettyClusterNode.getClusterNodeId();
|
||||
// 当前节点ID
|
||||
String clusterNodeClientId = serverNodeProperties.getNodeId();
|
||||
|
||||
NettyClientSocket nettyClientSocket = new
|
||||
NettyClientSocket(inetHost, inetPort, clusterNodeClientId,
|
||||
clusterNodeId,
|
||||
clientChangeEvent, handleChannelTypeAdvancedList);
|
||||
// 过滤已经存在的
|
||||
boolean anyMatch = cacheClusterNettyClientSocketMap
|
||||
.keySet().stream()
|
||||
.anyMatch(cacheClusterLazyNettyClusterNode -> clusterNodeId.equals(cacheClusterLazyNettyClusterNode.getClusterNodeId()));
|
||||
if (anyMatch) {
|
||||
log.warn("当前节点注册:{} 已经存在", lazyNettyClusterNode);
|
||||
return;
|
||||
}
|
||||
cacheClusterNettyClientSocketMap.put(lazyNettyClusterNode, nettyClientSocket);
|
||||
|
||||
Thread thread = new Thread(() -> {
|
||||
try {
|
||||
nettyClientSocket.newConnect2Server();
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
});
|
||||
// 当前服务连接Netty客户端:{},Netty端口:{}
|
||||
log.info("Current service connection Netty client: {}, Netty port: {}", inetHost, inetPort);
|
||||
NETTY_CLUSTER_CLIENT_EXECUTOR.execute(thread);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 启动集群所有节点
|
||||
*/
|
||||
@Override
|
||||
public void starterClusterNodes() {
|
||||
// 查询所有配置
|
||||
LazyNettyClusterNode queryLazyNettyClusterNode = new LazyNettyClusterNode();
|
||||
queryLazyNettyClusterNode.setIsDeleted(false);
|
||||
|
||||
lazyNettyClusterNodeRepository.findList(queryLazyNettyClusterNode).accept(lazyNettyClusterNodeList -> {
|
||||
|
||||
for (LazyNettyClusterNode lazyNettyClusterNode : lazyNettyClusterNodeList) {
|
||||
starterOneClusterNode(lazyNettyClusterNode);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭 集群节点
|
||||
*
|
||||
* @param needCloseLazyNettyClusterNode 配置
|
||||
*/
|
||||
@Override
|
||||
public void destroyOneClusterNode(LazyNettyClusterNode needCloseLazyNettyClusterNode) {
|
||||
// 当前节点ID
|
||||
String clusterNodeId = serverNodeProperties.getNodeId();
|
||||
// 关闭指定socket
|
||||
cacheClusterNettyClientSocketMap.forEach(((lazyNettyClusterNode, nettyClientSocket) -> {
|
||||
String inetHost = lazyNettyClusterNode.getClusterNodeHost();
|
||||
Integer inetPort = lazyNettyClusterNode.getClusterNodePort();
|
||||
String needCloseInetHost = needCloseLazyNettyClusterNode.getClusterNodeHost();
|
||||
Integer needCloseInetPort = needCloseLazyNettyClusterNode.getClusterNodePort();
|
||||
String needCloseClientId = needCloseLazyNettyClusterNode.getClusterNodeId();
|
||||
if (Objects.equals(clusterNodeId, needCloseClientId)
|
||||
&& Objects.equals(inetPort, needCloseInetPort)
|
||||
&& Objects.equals(inetHost, needCloseInetHost)) {
|
||||
nettyClientSocket.shutdown();
|
||||
// 关闭客户端:{}与服务端连接:{}:{}
|
||||
log.warn("Close client: {} Connect to server: {}: {}", clusterNodeId, inetHost, inetPort);
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭 集群上所有节点
|
||||
*/
|
||||
@Override
|
||||
public void destroyClusterNodes() {
|
||||
// 关闭socket
|
||||
cacheClusterNettyClientSocketMap.forEach(((lazyNettyClusterNode, nettyClientSocket) -> {
|
||||
nettyClientSocket.shutdown();
|
||||
String clientId = lazyNettyClusterNode.getClusterNodeId();
|
||||
String inetHost = lazyNettyClusterNode.getClusterNodeHost();
|
||||
Integer inetPort = lazyNettyClusterNode.getClusterNodePort();
|
||||
// 关闭客户端:{}与服务端连接:{}:{}
|
||||
log.warn("Close client: {} Connect to server: {}: {}", clientId, inetHost, inetPort);
|
||||
}));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,142 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.cluster.controller;
|
||||
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import org.wu.framework.web.spring.EasyController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.wu.framework.web.response.Result;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.framework.smart.agent.network.heartbeat.server.cluster.domain.model.cluster.node.LazyNettyClusterNode;
|
||||
import org.framework.smart.agent.network.heartbeat.server.cluster.application.command.lazy.netty.cluster.node.LazyNettyClusterNodeRemoveCommand;
|
||||
import org.framework.smart.agent.network.heartbeat.server.cluster.application.command.lazy.netty.cluster.node.LazyNettyClusterNodeStoryCommand;
|
||||
import org.framework.smart.agent.network.heartbeat.server.cluster.application.command.lazy.netty.cluster.node.LazyNettyClusterNodeUpdateCommand;
|
||||
import org.framework.smart.agent.network.heartbeat.server.cluster.application.command.lazy.netty.cluster.node.LazyNettyClusterNodeQueryListCommand;
|
||||
import org.framework.smart.agent.network.heartbeat.server.cluster.application.command.lazy.netty.cluster.node.LazyNettyClusterNodeQueryOneCommand;
|
||||
import org.framework.smart.agent.network.heartbeat.server.cluster.application.LazyNettyClusterNodeApplication;
|
||||
import org.framework.smart.agent.network.heartbeat.server.cluster.application.dto.LazyNettyClusterNodeDTO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.wu.framework.lazy.orm.database.lambda.domain.LazyPage;
|
||||
|
||||
/**
|
||||
* describe 集群配置信息
|
||||
*
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/04/12 02:16 下午
|
||||
* @see org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyController
|
||||
**/
|
||||
@Tag(name = "集群配置信息提供者")
|
||||
@EasyController("/lazy/netty/cluster/node")
|
||||
public class LazyNettyClusterNodeProvider {
|
||||
|
||||
@Resource
|
||||
private LazyNettyClusterNodeApplication lazyNettyClusterNodeApplication;
|
||||
|
||||
/**
|
||||
* describe 新增集群配置信息
|
||||
*
|
||||
* @param lazyNettyClusterNodeStoryCommand 新增集群配置信息
|
||||
* @return {@link Result<LazyNettyClusterNode>} 集群配置信息新增后领域对象
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/04/12 02:16 下午
|
||||
**/
|
||||
|
||||
@Operation(summary = "新增集群配置信息")
|
||||
@PostMapping("/story")
|
||||
public Result<LazyNettyClusterNode> story(@RequestBody LazyNettyClusterNodeStoryCommand lazyNettyClusterNodeStoryCommand) {
|
||||
return lazyNettyClusterNodeApplication.story(lazyNettyClusterNodeStoryCommand);
|
||||
}
|
||||
|
||||
/**
|
||||
* describe 批量新增集群配置信息
|
||||
*
|
||||
* @param lazyNettyClusterNodeStoryCommandList 批量新增集群配置信息
|
||||
* @return {@link Result<List<LazyNettyClusterNode>>} 集群配置信息新增后领域对象集合
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/04/12 02:16 下午
|
||||
**/
|
||||
|
||||
@Operation(summary = "批量新增集群配置信息")
|
||||
@PostMapping("/batchStory")
|
||||
public Result<List<LazyNettyClusterNode>> batchStory(@RequestBody List<LazyNettyClusterNodeStoryCommand> lazyNettyClusterNodeStoryCommandList) {
|
||||
return lazyNettyClusterNodeApplication.batchStory(lazyNettyClusterNodeStoryCommandList);
|
||||
}
|
||||
|
||||
/**
|
||||
* describe 更新集群配置信息
|
||||
*
|
||||
* @param lazyNettyClusterNodeUpdateCommand 更新集群配置信息
|
||||
* @return {@link Result<LazyNettyClusterNode>} 集群配置信息领域对象
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/04/12 02:16 下午
|
||||
**/
|
||||
|
||||
@Operation(summary = "更新集群配置信息")
|
||||
@PutMapping("/updateOne")
|
||||
public Result<LazyNettyClusterNode> updateOne(@RequestBody LazyNettyClusterNodeUpdateCommand lazyNettyClusterNodeUpdateCommand) {
|
||||
return lazyNettyClusterNodeApplication.updateOne(lazyNettyClusterNodeUpdateCommand);
|
||||
}
|
||||
|
||||
/**
|
||||
* describe 查询单个集群配置信息
|
||||
*
|
||||
* @param lazyNettyClusterNodeQueryOneCommand 查询单个集群配置信息
|
||||
* @return {@link Result<LazyNettyClusterNodeDTO>} 集群配置信息DTO对象
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/04/12 02:16 下午
|
||||
**/
|
||||
|
||||
@Operation(summary = "查询单个集群配置信息")
|
||||
@GetMapping("/findOne")
|
||||
public Result<LazyNettyClusterNodeDTO> findOne(@ModelAttribute LazyNettyClusterNodeQueryOneCommand lazyNettyClusterNodeQueryOneCommand) {
|
||||
return lazyNettyClusterNodeApplication.findOne(lazyNettyClusterNodeQueryOneCommand);
|
||||
}
|
||||
|
||||
/**
|
||||
* describe 查询多个集群配置信息
|
||||
*
|
||||
* @param lazyNettyClusterNodeQueryListCommand 查询多个集群配置信息
|
||||
* @return {@link Result<List<LazyNettyClusterNodeDTO>>} 集群配置信息DTO对象
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/04/12 02:16 下午
|
||||
**/
|
||||
|
||||
@Operation(summary = "查询多个集群配置信息")
|
||||
@GetMapping("/findList")
|
||||
public Result<List<LazyNettyClusterNodeDTO>> findList(@ModelAttribute LazyNettyClusterNodeQueryListCommand lazyNettyClusterNodeQueryListCommand) {
|
||||
return lazyNettyClusterNodeApplication.findList(lazyNettyClusterNodeQueryListCommand);
|
||||
}
|
||||
|
||||
/**
|
||||
* describe 分页查询多个集群配置信息
|
||||
*
|
||||
* @param lazyNettyClusterNodeQueryListCommand 分页查询多个集群配置信息
|
||||
* @return {@link Result<LazyPage<LazyNettyClusterNodeDTO>>} 分页集群配置信息DTO对象
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/04/12 02:16 下午
|
||||
**/
|
||||
|
||||
@Operation(summary = "分页查询多个集群配置信息")
|
||||
@GetMapping("/findPage")
|
||||
public Result<LazyPage<LazyNettyClusterNodeDTO>> findPage(@Parameter(description = "分页大小") @RequestParam(defaultValue = "10", value = "size") int size,
|
||||
@Parameter(description = "当前页数") @RequestParam(defaultValue = "1", value = "current") int current, @ModelAttribute LazyNettyClusterNodeQueryListCommand lazyNettyClusterNodeQueryListCommand) {
|
||||
return lazyNettyClusterNodeApplication.findPage(size, current, lazyNettyClusterNodeQueryListCommand);
|
||||
}
|
||||
|
||||
/**
|
||||
* describe 删除集群配置信息
|
||||
*
|
||||
* @param lazyNettyClusterNodeRemoveCommand 删除集群配置信息
|
||||
* @return {@link Result<LazyNettyClusterNode>} 集群配置信息
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/04/12 02:16 下午
|
||||
**/
|
||||
|
||||
@Operation(summary = "删除集群配置信息")
|
||||
@DeleteMapping("/remove")
|
||||
public Result<LazyNettyClusterNode> remove(@ModelAttribute LazyNettyClusterNodeRemoveCommand lazyNettyClusterNodeRemoveCommand) {
|
||||
return lazyNettyClusterNodeApplication.remove(lazyNettyClusterNodeRemoveCommand);
|
||||
}
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.cluster.domain.model.cluster;
|
||||
|
||||
public class Node {
|
||||
}
|
@ -0,0 +1,81 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.cluster.domain.model.cluster.node;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import org.framework.smart.agent.network.heartbeat.common.enums.NettyClientStatus;
|
||||
import org.wu.framework.lazy.orm.core.stereotype.LazyTableField;
|
||||
|
||||
import java.lang.String;
|
||||
import java.lang.Integer;
|
||||
import java.time.LocalDateTime;
|
||||
import java.lang.Boolean;
|
||||
/**
|
||||
* describe 集群配置信息
|
||||
*
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/04/12 02:16 下午
|
||||
* @see org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyDomain
|
||||
**/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Schema(title = "lazy_netty_cluster_node",description = "集群配置信息")
|
||||
public class LazyNettyClusterNode {
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* 集群节点host
|
||||
*/
|
||||
@Schema(description ="集群节点host",name ="clusterNodeHost",example = "")
|
||||
private String clusterNodeHost;
|
||||
|
||||
/**
|
||||
*
|
||||
* 集群节点ID
|
||||
*/
|
||||
@Schema(description ="集群节点ID",name ="clusterNodeId",example = "")
|
||||
private String clusterNodeId;
|
||||
|
||||
/**
|
||||
*
|
||||
* 集群节点端口
|
||||
*/
|
||||
@Schema(description ="集群节点端口",name ="clusterNodePort",example = "")
|
||||
private Integer clusterNodePort;
|
||||
|
||||
/**
|
||||
*
|
||||
* 创建时间
|
||||
*/
|
||||
@Schema(description ="创建时间",name ="createTime",example = "")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
*
|
||||
* 是否删除
|
||||
*/
|
||||
@Schema(description ="是否删除",name ="isDeleted",example = "")
|
||||
private Boolean isDeleted;
|
||||
|
||||
/**
|
||||
*
|
||||
* 角色
|
||||
*/
|
||||
@Schema(description ="角色",name ="role",example = "")
|
||||
private String role;
|
||||
|
||||
/**
|
||||
*
|
||||
* 更新时间
|
||||
*/
|
||||
@Schema(description ="更新时间",name ="updateTime",example = "")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 在线状态(true在线,false离线)
|
||||
*/
|
||||
@Schema(description = "在线状态(true在线,false离线)", name = "clusterNodeStatus", example = "")
|
||||
private NettyClientStatus clusterNodeStatus;
|
||||
|
||||
}
|
@ -0,0 +1,104 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.cluster.domain.model.cluster.node;
|
||||
|
||||
import org.wu.framework.web.response.Result;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.wu.framework.lazy.orm.database.lambda.domain.LazyPage;
|
||||
|
||||
/**
|
||||
* describe 集群配置信息
|
||||
*
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/04/12 02:16 下午
|
||||
* @see org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyDomainRepository
|
||||
**/
|
||||
|
||||
public interface LazyNettyClusterNodeRepository {
|
||||
|
||||
|
||||
/**
|
||||
* describe 新增集群配置信息
|
||||
*
|
||||
* @param lazyNettyClusterNode 新增集群配置信息
|
||||
* @return {@link Result<LazyNettyClusterNode>} 集群配置信息新增后领域对象
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/04/12 02:16 下午
|
||||
**/
|
||||
|
||||
Result<LazyNettyClusterNode> story(LazyNettyClusterNode lazyNettyClusterNode);
|
||||
|
||||
/**
|
||||
* describe 批量新增集群配置信息
|
||||
*
|
||||
* @param lazyNettyClusterNodeList 批量新增集群配置信息
|
||||
* @return {@link Result<List<LazyNettyClusterNode>>} 集群配置信息新增后领域对象集合
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/04/12 02:16 下午
|
||||
**/
|
||||
|
||||
Result<List<LazyNettyClusterNode>> batchStory(List<LazyNettyClusterNode> lazyNettyClusterNodeList);
|
||||
|
||||
/**
|
||||
* describe 查询单个集群配置信息
|
||||
*
|
||||
* @param lazyNettyClusterNode 查询单个集群配置信息
|
||||
* @return {@link Result<LazyNettyClusterNode>} 集群配置信息DTO对象
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/04/12 02:16 下午
|
||||
**/
|
||||
|
||||
Result<LazyNettyClusterNode> findOne(LazyNettyClusterNode lazyNettyClusterNode);
|
||||
|
||||
/**
|
||||
* describe 查询多个集群配置信息
|
||||
*
|
||||
* @param lazyNettyClusterNode 查询多个集群配置信息
|
||||
* @return {@link Result<List<LazyNettyClusterNode>>} 集群配置信息DTO对象
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/04/12 02:16 下午
|
||||
**/
|
||||
|
||||
Result<List<LazyNettyClusterNode>> findList(LazyNettyClusterNode lazyNettyClusterNode);
|
||||
|
||||
/**
|
||||
* describe 分页查询多个集群配置信息
|
||||
*
|
||||
* @param size 当前页数
|
||||
* @param current 当前页
|
||||
* @param lazyNettyClusterNode 分页查询多个集群配置信息
|
||||
* @return {@link Result<LazyPage<LazyNettyClusterNode>>} 分页集群配置信息领域对象
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/04/12 02:16 下午
|
||||
**/
|
||||
|
||||
Result<LazyPage<LazyNettyClusterNode>> findPage(int size, int current, LazyNettyClusterNode lazyNettyClusterNode);
|
||||
|
||||
/**
|
||||
* describe 删除集群配置信息
|
||||
*
|
||||
* @param lazyNettyClusterNode 删除集群配置信息
|
||||
* @return {@link Result<LazyNettyClusterNode>} 集群配置信息
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/04/12 02:16 下午
|
||||
**/
|
||||
|
||||
Result<LazyNettyClusterNode> remove(LazyNettyClusterNode lazyNettyClusterNode);
|
||||
|
||||
/**
|
||||
* describe 是否存在集群配置信息
|
||||
*
|
||||
* @param lazyNettyClusterNode 是否存在集群配置信息
|
||||
* @return {@link Result<Boolean>} 集群配置信息是否存在
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/04/12 02:16 下午
|
||||
**/
|
||||
|
||||
Result<Boolean> exists(LazyNettyClusterNode lazyNettyClusterNode);
|
||||
|
||||
/**
|
||||
* 修改节点状态
|
||||
* @param clusterNodeId 节点ID
|
||||
*/
|
||||
void updateNodeStatus(String clusterNodeId);
|
||||
}
|
@ -0,0 +1,169 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.cluster.event;
|
||||
|
||||
|
||||
import io.netty.channel.Channel;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.framework.smart.agent.network.heartbeat.client.domain.model.lazy.netty.server.properties.LazyNettyServerProperties;
|
||||
import org.framework.smart.agent.network.heartbeat.client.domain.model.lazy.netty.server.properties.LazyNettyServerPropertiesRepository;
|
||||
import org.framework.smart.agent.network.heartbeat.client.netty.event.ClientChangeEvent;
|
||||
import org.framework.smart.agent.network.heartbeat.common.MessageType;
|
||||
import org.framework.smart.agent.network.heartbeat.common.NettyClientChannel;
|
||||
import org.framework.smart.agent.network.heartbeat.common.NettyProxyMsg;
|
||||
import org.framework.smart.agent.network.heartbeat.common.NettyServerContext;
|
||||
import org.framework.smart.agent.network.heartbeat.common.enums.NettyClientStatus;
|
||||
import org.framework.smart.agent.network.heartbeat.server.cluster.domain.model.cluster.node.LazyNettyClusterNodeRepository;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* node 注册 变更事件
|
||||
*/
|
||||
@Primary
|
||||
@Slf4j
|
||||
@Component
|
||||
public class ClusterNodeChangeEventImpl implements ClientChangeEvent {
|
||||
|
||||
|
||||
@Resource
|
||||
private LazyNettyServerPropertiesRepository lazyNettyServerPropertiesRepository;
|
||||
|
||||
@Resource
|
||||
private LazyNettyClusterNodeRepository lazyNettyClusterNodeRepository;
|
||||
|
||||
|
||||
// private final StringRedisTemplate stringRedisTemplate;
|
||||
// private final RedisProviderTemplate redisProviderTemplate;
|
||||
//
|
||||
// public DefaultClientChangeEvent1Impl(StringRedisTemplate stringRedisTemplate, RedisProviderTemplate redisProviderTemplate) {
|
||||
// this.stringRedisTemplate = stringRedisTemplate;
|
||||
// this.redisProviderTemplate = redisProviderTemplate;
|
||||
// }
|
||||
|
||||
|
||||
/**
|
||||
* 推送客户端在线
|
||||
*/
|
||||
@Override
|
||||
public void clientOnLine(String clientId) {
|
||||
// // 获取当前客户端ID
|
||||
// if (ObjectUtils.isEmpty(clientId)) {
|
||||
// clientId = stringRedisTemplate.opsForValue().get(ClientConfigKeyUtils.CLIENT_ID_KEY);
|
||||
// }
|
||||
// String clientStatusKey = ClientConfigKeyUtils.getClientStatusKey(clientId);
|
||||
// // 如果可以已经在线状态不推送
|
||||
// stringRedisTemplate.opsForValue().set(clientStatusKey, NettyClientStatus.ON_LINE.name());
|
||||
// ClientOnLineState clientOnLineState = new ClientOnLineState();
|
||||
// clientOnLineState.setClientId(clientId);
|
||||
// clientOnLineState.setOnLineState(NettyClientStatus.ON_LINE.name());
|
||||
// // 暂存扫描触发
|
||||
// redisProviderTemplate.send(RedisChannelConstant.REDIS_CLIENT_ONLINE_OR_OFFLINE_CHANNEL,clientOnLineState);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 推送客户端在线
|
||||
*
|
||||
* @param inetHost 服务端ip
|
||||
* @param inetPort 服务端端口
|
||||
* @param serverId 服务端ID
|
||||
* @param clientId 客户端
|
||||
*/
|
||||
@Override
|
||||
public void clientOnLine(String inetHost, int inetPort, String serverId, String clientId) {
|
||||
LazyNettyServerProperties lazyNettyServerProperties = new LazyNettyServerProperties();
|
||||
lazyNettyServerProperties.setClientId(clientId);
|
||||
lazyNettyServerProperties.setInetHost(inetHost);
|
||||
lazyNettyServerProperties.setInetPort(inetPort);
|
||||
lazyNettyServerProperties.setConnectStatus(NettyClientStatus.ON_LINE);
|
||||
lazyNettyServerPropertiesRepository.onLine(lazyNettyServerProperties);
|
||||
// 更改状态在线
|
||||
clientOnLine(clientId);
|
||||
|
||||
List<NettyClientChannel> serverEndpointChannels = NettyServerContext.getServerEndpointChannels();
|
||||
for (NettyClientChannel serverEndpointChannel : serverEndpointChannels) {
|
||||
Channel serverEndpointChannelChannel = serverEndpointChannel.getChannel();
|
||||
if (serverEndpointChannelChannel != null && serverEndpointChannelChannel.isActive()) {
|
||||
// 客户端本地获取所有 已经连接的服务端的channel 通知他们 扫描数据库node信息,重新初始化
|
||||
NettyProxyMsg nettyMsg = new NettyProxyMsg();
|
||||
nettyMsg.setType(MessageType.REPORT_CLUSTER_NODE_REGISTER_MESSAGE);
|
||||
nettyMsg.setClientId(clientId);
|
||||
nettyMsg.setData((clientId).getBytes());
|
||||
serverEndpointChannelChannel.writeAndFlush(nettyMsg);
|
||||
}
|
||||
}
|
||||
|
||||
// 修改节点状态
|
||||
lazyNettyClusterNodeRepository.updateNodeStatus(serverId);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 推送客户端离线
|
||||
*/
|
||||
@Override
|
||||
public void clientOffLine(String clientId) {
|
||||
// if (ObjectUtils.isEmpty(clientId)) {
|
||||
// clientId = stringRedisTemplate.opsForValue().get(ClientConfigKeyUtils.CLIENT_ID_KEY);
|
||||
// }
|
||||
// String clientStatusKey = ClientConfigKeyUtils.getClientStatusKey(clientId);
|
||||
// // 离线状态
|
||||
// stringRedisTemplate.opsForValue().set(clientStatusKey, NettyClientStatus.OFF_LINE.name());
|
||||
// // 暂存状态
|
||||
// stagingOpen(clientId);
|
||||
// // 暂存扫描触发
|
||||
// ClientOnLineState clientOnLineState = new ClientOnLineState();
|
||||
// clientOnLineState.setClientId(clientId);
|
||||
// clientOnLineState.setOnLineState(NettyClientStatus.OFF_LINE.name());
|
||||
// redisProviderTemplate.send(RedisChannelConstant.REDIS_CLIENT_ONLINE_OR_OFFLINE_CHANNEL,clientOnLineState);
|
||||
}
|
||||
|
||||
/**
|
||||
* 推送客户端离线
|
||||
*
|
||||
* @param inetHost 服务端ip
|
||||
* @param inetPort 服务端端口
|
||||
* @param serverId
|
||||
* @param clientId 客户端
|
||||
*/
|
||||
@Override
|
||||
public void clientOffLine(String inetHost, int inetPort, String serverId, String clientId) {
|
||||
LazyNettyServerProperties lazyNettyServerProperties = new LazyNettyServerProperties();
|
||||
lazyNettyServerProperties.setClientId(clientId);
|
||||
lazyNettyServerProperties.setInetHost(inetHost);
|
||||
lazyNettyServerProperties.setInetPort(inetPort);
|
||||
lazyNettyServerProperties.setConnectStatus(NettyClientStatus.OFF_LINE);
|
||||
lazyNettyServerPropertiesRepository.offLine(lazyNettyServerProperties);
|
||||
clientOffLine(clientId);
|
||||
// 修改节点状态
|
||||
lazyNettyClusterNodeRepository.updateNodeStatus(serverId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stagingOpen(String clientId) {
|
||||
// String stagingStatusKey = StagingConfigKeyConstant.getStagingStatusKey(clientId);
|
||||
// stringRedisTemplate.opsForValue().set(stagingStatusKey, StagingStatus.OPENED.name());
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 暂存关闭
|
||||
*
|
||||
* @param clientId 租户ID
|
||||
*/
|
||||
@Override
|
||||
public void stagingClose(String clientId) {
|
||||
// if (clientId == null) {
|
||||
// clientId = stringRedisTemplate.opsForValue().get(ClientConfigKeyUtils.CLIENT_ID_KEY);
|
||||
// }
|
||||
// String stagingStatusKey = StagingConfigKeyConstant.getStagingStatusKey(clientId);
|
||||
// stringRedisTemplate.opsForValue().set(stagingStatusKey, StagingStatus.CLOSED.name());
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.cluster.infrastructure.converter;
|
||||
|
||||
import org.framework.smart.agent.network.heartbeat.server.cluster.domain.model.cluster.node.LazyNettyClusterNode;
|
||||
import org.framework.smart.agent.network.heartbeat.server.cluster.infrastructure.entity.LazyNettyClusterNodeDO;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
import org.mapstruct.Mapper;
|
||||
/**
|
||||
* describe 集群配置信息
|
||||
*
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/04/12 02:16 下午
|
||||
* @see org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyInfrastructureConverter
|
||||
**/
|
||||
@Mapper
|
||||
public interface LazyNettyClusterNodeConverter {
|
||||
|
||||
|
||||
/**
|
||||
* describe MapStruct 创建的代理对象
|
||||
*
|
||||
|
||||
|
||||
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/04/12 02:16 下午
|
||||
**/
|
||||
LazyNettyClusterNodeConverter INSTANCE = Mappers.getMapper(LazyNettyClusterNodeConverter.class);
|
||||
/**
|
||||
* describe 实体对象 转换成领域对象
|
||||
*
|
||||
* @param lazyNettyClusterNodeDO 集群配置信息实体对象
|
||||
* @return {@link LazyNettyClusterNode} 集群配置信息领域对象
|
||||
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/04/12 02:16 下午
|
||||
**/
|
||||
LazyNettyClusterNode toLazyNettyClusterNode(LazyNettyClusterNodeDO lazyNettyClusterNodeDO);
|
||||
/**
|
||||
* describe 领域对象 转换成实体对象
|
||||
*
|
||||
* @param lazyNettyClusterNode 集群配置信息领域对象
|
||||
* @return {@link LazyNettyClusterNodeDO} 集群配置信息实体对象
|
||||
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/04/12 02:16 下午
|
||||
**/
|
||||
LazyNettyClusterNodeDO fromLazyNettyClusterNode(LazyNettyClusterNode lazyNettyClusterNode);
|
||||
}
|
@ -0,0 +1,90 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.cluster.infrastructure.entity;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.framework.smart.agent.network.heartbeat.common.enums.NettyClientStatus;
|
||||
import org.wu.framework.lazy.orm.core.stereotype.LazyTableIndex;
|
||||
import org.wu.framework.core.stereotype.LayerField;
|
||||
import org.wu.framework.core.stereotype.LayerField.LayerFieldType;
|
||||
import org.wu.framework.lazy.orm.core.stereotype.LazyTable;
|
||||
import org.wu.framework.lazy.orm.core.stereotype.LazyTableField;
|
||||
import org.wu.framework.lazy.orm.core.stereotype.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import java.lang.String;
|
||||
import java.lang.Integer;
|
||||
import java.time.LocalDateTime;
|
||||
import java.lang.Boolean;
|
||||
|
||||
/**
|
||||
* describe 集群配置信息
|
||||
*
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/04/12 02:16 下午
|
||||
* @see org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyInfrastructureEntity
|
||||
**/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@LazyTable(tableName = "lazy_netty_cluster_node", comment = "集群配置信息")
|
||||
@Schema(title = "lazy_netty_cluster_node", description = "集群配置信息")
|
||||
public class LazyNettyClusterNodeDO {
|
||||
|
||||
|
||||
/**
|
||||
* 集群节点host
|
||||
*/
|
||||
@Schema(description = "集群节点host", name = "clusterNodeHost", example = "")
|
||||
@LazyTableField(name = "cluster_node_host", comment = "集群节点host", columnType = "varchar(255)", notNull = true)
|
||||
private String clusterNodeHost;
|
||||
|
||||
/**
|
||||
* 集群节点ID
|
||||
*/
|
||||
@Schema(description = "集群节点ID", name = "clusterNodeId", example = "")
|
||||
@LazyTableFieldUnique(name = "cluster_node_id", comment = "集群节点ID", columnType = "varchar(255)", notNull = true)
|
||||
private String clusterNodeId;
|
||||
|
||||
/**
|
||||
* 集群节点端口
|
||||
*/
|
||||
@Schema(description = "集群节点端口", name = "clusterNodePort", example = "")
|
||||
@LazyTableField(name = "cluster_node_port", comment = "集群节点端口", columnType = "int", notNull = true)
|
||||
private Integer clusterNodePort;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Schema(description = "创建时间", name = "createTime", example = "")
|
||||
@LazyTableField(name = "create_time", comment = "创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
@Schema(description = "是否删除", name = "isDeleted", example = "")
|
||||
@LazyTableField(name = "is_deleted", comment = "是否删除")
|
||||
private Boolean isDeleted;
|
||||
|
||||
/**
|
||||
* 角色
|
||||
*/
|
||||
@Schema(description = "角色", name = "role", example = "")
|
||||
@LazyTableField(name = "role", comment = "角色", defaultValue = "'node'", upsertStrategy = LazyFieldStrategy.NEVER, columnType = "varchar(255)")
|
||||
private String role;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@Schema(description = "更新时间", name = "updateTime", example = "")
|
||||
@LazyTableField(name = "update_time", comment = "更新时间")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 在线状态(true在线,false离线)
|
||||
*/
|
||||
@Schema(description = "在线状态(true在线,false离线)", name = "clusterNodeStatus", example = "")
|
||||
@LazyTableField(name = "cluster_node_status", comment = "在线状态(true在线,false离线)", columnType = "varchar(255)")
|
||||
private NettyClientStatus clusterNodeStatus;
|
||||
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.cluster.infrastructure.mapper;
|
||||
|
||||
/**
|
||||
* describe 集群配置信息
|
||||
*
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/04/12 02:16 下午
|
||||
* @see org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyInfrastructureMapper
|
||||
**/
|
||||
|
||||
public interface LazyNettyClusterNodeMapper {
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,189 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.cluster.infrastructure.persistence;
|
||||
|
||||
import org.framework.smart.agent.network.heartbeat.common.enums.NettyClientStatus;
|
||||
import org.framework.smart.agent.network.heartbeat.server.cluster.infrastructure.entity.LazyNettyClusterNodeDO;
|
||||
import org.framework.smart.agent.network.heartbeat.server.cluster.infrastructure.converter.LazyNettyClusterNodeConverter;
|
||||
import org.framework.smart.agent.network.heartbeat.server.cluster.domain.model.cluster.node.LazyNettyClusterNodeRepository;
|
||||
import org.framework.smart.agent.network.heartbeat.server.standalone.infrastructure.entity.LazyNettyClientStateDO;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.wu.framework.lazy.orm.database.lambda.stream.wrapper.LazyWrappers;
|
||||
import org.wu.framework.web.response.Result;
|
||||
import org.wu.framework.web.response.ResultFactory;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.framework.smart.agent.network.heartbeat.server.cluster.domain.model.cluster.node.LazyNettyClusterNode;
|
||||
import org.wu.framework.lazy.orm.database.lambda.stream.lambda.LazyLambdaStream;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.wu.framework.lazy.orm.database.lambda.domain.LazyPage;
|
||||
|
||||
/**
|
||||
* describe 集群配置信息
|
||||
*
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/04/12 02:16 下午
|
||||
* @see org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyInfrastructurePersistence
|
||||
**/
|
||||
@Repository
|
||||
public class LazyNettyClusterNodeRepositoryImpl implements LazyNettyClusterNodeRepository {
|
||||
|
||||
@Resource
|
||||
LazyLambdaStream lazyLambdaStream;
|
||||
|
||||
/**
|
||||
* describe 新增集群配置信息
|
||||
*
|
||||
* @param lazyNettyClusterNode 新增集群配置信息
|
||||
* @return {@link Result<LazyNettyClusterNode>} 集群配置信息新增后领域对象
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/04/12 02:16 下午
|
||||
**/
|
||||
|
||||
@Override
|
||||
public Result<LazyNettyClusterNode> story(LazyNettyClusterNode lazyNettyClusterNode) {
|
||||
LazyNettyClusterNodeDO lazyNettyClusterNodeDO = LazyNettyClusterNodeConverter.INSTANCE.fromLazyNettyClusterNode(lazyNettyClusterNode);
|
||||
lazyLambdaStream.upsert(lazyNettyClusterNodeDO);
|
||||
return ResultFactory.successOf();
|
||||
}
|
||||
|
||||
/**
|
||||
* describe 批量新增集群配置信息
|
||||
*
|
||||
* @param lazyNettyClusterNodeList 批量新增集群配置信息
|
||||
* @return {@link Result<List<LazyNettyClusterNode>>} 集群配置信息新增后领域对象集合
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/04/12 02:16 下午
|
||||
**/
|
||||
|
||||
@Override
|
||||
public Result<List<LazyNettyClusterNode>> batchStory(List<LazyNettyClusterNode> lazyNettyClusterNodeList) {
|
||||
List<LazyNettyClusterNodeDO> lazyNettyClusterNodeDOList = lazyNettyClusterNodeList.stream().map(LazyNettyClusterNodeConverter.INSTANCE::fromLazyNettyClusterNode).collect(Collectors.toList());
|
||||
lazyLambdaStream.upsert(lazyNettyClusterNodeDOList);
|
||||
return ResultFactory.successOf();
|
||||
}
|
||||
|
||||
/**
|
||||
* describe 查询单个集群配置信息
|
||||
*
|
||||
* @param lazyNettyClusterNode 查询单个集群配置信息
|
||||
* @return {@link Result<LazyNettyClusterNode>} 集群配置信息领域对象
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/04/12 02:16 下午
|
||||
**/
|
||||
|
||||
@Override
|
||||
public Result<LazyNettyClusterNode> findOne(LazyNettyClusterNode lazyNettyClusterNode) {
|
||||
LazyNettyClusterNodeDO lazyNettyClusterNodeDO = LazyNettyClusterNodeConverter.INSTANCE.fromLazyNettyClusterNode(lazyNettyClusterNode);
|
||||
LazyNettyClusterNode lazyNettyClusterNodeOne = lazyLambdaStream.selectOne(LazyWrappers.lambdaWrapperBean(lazyNettyClusterNodeDO), LazyNettyClusterNode.class);
|
||||
return ResultFactory.successOf(lazyNettyClusterNodeOne);
|
||||
}
|
||||
|
||||
/**
|
||||
* describe 查询多个集群配置信息
|
||||
*
|
||||
* @param lazyNettyClusterNode 查询多个集群配置信息
|
||||
* @return {@link Result<List<LazyNettyClusterNode>>} 集群配置信息领域对象
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/04/12 02:16 下午
|
||||
**/
|
||||
|
||||
@Override
|
||||
public Result<List<LazyNettyClusterNode>> findList(LazyNettyClusterNode lazyNettyClusterNode) {
|
||||
LazyNettyClusterNodeDO lazyNettyClusterNodeDO = LazyNettyClusterNodeConverter.INSTANCE.fromLazyNettyClusterNode(lazyNettyClusterNode);
|
||||
List<LazyNettyClusterNode> lazyNettyClusterNodeList = lazyLambdaStream.selectList(LazyWrappers.lambdaWrapperBean(lazyNettyClusterNodeDO), LazyNettyClusterNode.class);
|
||||
return ResultFactory.successOf(lazyNettyClusterNodeList);
|
||||
}
|
||||
|
||||
/**
|
||||
* describe 分页查询多个集群配置信息
|
||||
*
|
||||
* @param size 当前页数
|
||||
* @param current 当前页
|
||||
* @param lazyNettyClusterNode 分页查询多个集群配置信息
|
||||
* @return {@link Result<LazyPage<LazyNettyClusterNode>>} 分页集群配置信息领域对象
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/04/12 02:16 下午
|
||||
**/
|
||||
|
||||
@Override
|
||||
public Result<LazyPage<LazyNettyClusterNode>> findPage(int size, int current, LazyNettyClusterNode lazyNettyClusterNode) {
|
||||
LazyNettyClusterNodeDO lazyNettyClusterNodeDO = LazyNettyClusterNodeConverter.INSTANCE.fromLazyNettyClusterNode(lazyNettyClusterNode);
|
||||
LazyPage<LazyNettyClusterNode> lazyPage = new LazyPage<>(current, size);
|
||||
LazyPage<LazyNettyClusterNode> lazyNettyClusterNodeLazyPage = lazyLambdaStream.selectPage(LazyWrappers.lambdaWrapperBean(lazyNettyClusterNodeDO), lazyPage, LazyNettyClusterNode.class);
|
||||
return ResultFactory.successOf(lazyNettyClusterNodeLazyPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* describe 删除集群配置信息
|
||||
*
|
||||
* @param lazyNettyClusterNode 删除集群配置信息
|
||||
* @return {@link Result<LazyNettyClusterNode>} 集群配置信息
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/04/12 02:16 下午
|
||||
**/
|
||||
|
||||
@Override
|
||||
public Result<LazyNettyClusterNode> remove(LazyNettyClusterNode lazyNettyClusterNode) {
|
||||
LazyNettyClusterNodeDO lazyNettyClusterNodeDO = LazyNettyClusterNodeConverter.INSTANCE.fromLazyNettyClusterNode(lazyNettyClusterNode);
|
||||
// lazyLambdaStream.delete(LazyWrappers.lambdaWrapperBean(lazyNettyClusterNodeDO));
|
||||
return ResultFactory.successOf();
|
||||
}
|
||||
|
||||
/**
|
||||
* describe 是否存在集群配置信息
|
||||
*
|
||||
* @param lazyNettyClusterNode 集群配置信息领域对象
|
||||
* @return {@link Result<Boolean>} 是否存在 true 存在,false 不存在
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/04/12 02:16 下午
|
||||
**/
|
||||
|
||||
@Override
|
||||
public Result<Boolean> exists(LazyNettyClusterNode lazyNettyClusterNode) {
|
||||
LazyNettyClusterNodeDO lazyNettyClusterNodeDO = LazyNettyClusterNodeConverter.INSTANCE.fromLazyNettyClusterNode(lazyNettyClusterNode);
|
||||
Boolean exists = lazyLambdaStream.exists(LazyWrappers.lambdaWrapperBean(lazyNettyClusterNodeDO));
|
||||
return ResultFactory.successOf(exists);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改节点状态
|
||||
*
|
||||
* @param clusterNodeId 节点ID
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void updateNodeStatus(String clusterNodeId) {
|
||||
// 查询这个节点下客户端注册是否正常
|
||||
List<LazyNettyClientStateDO> lazyNettyClientStateDOList = lazyLambdaStream.selectList(
|
||||
LazyWrappers.<LazyNettyClientStateDO>lambdaWrapper()
|
||||
.eq(LazyNettyClientStateDO::getServerId, clusterNodeId)
|
||||
);
|
||||
boolean anyMatch = lazyNettyClientStateDOList.stream()
|
||||
.anyMatch(lazyNettyClientStateDO ->
|
||||
NettyClientStatus.OFF_LINE.equals(lazyNettyClientStateDO.getOnLineState())
|
||||
);
|
||||
|
||||
LazyNettyClusterNodeDO lazyNettyClusterNodeDO = new LazyNettyClusterNodeDO();
|
||||
lazyNettyClusterNodeDO.setClusterNodeId(clusterNodeId);
|
||||
lazyNettyClusterNodeDO.setUpdateTime(LocalDateTime.now());
|
||||
|
||||
// 更新当前节点状态
|
||||
if(anyMatch){
|
||||
// 离线
|
||||
lazyNettyClusterNodeDO.setClusterNodeStatus(NettyClientStatus.OFF_LINE);
|
||||
}else {
|
||||
// 在线
|
||||
lazyNettyClusterNodeDO.setClusterNodeStatus(NettyClientStatus.ON_LINE);
|
||||
}
|
||||
lazyLambdaStream.update(lazyNettyClusterNodeDO,LazyWrappers.<LazyNettyClusterNodeDO>lambdaWrapper()
|
||||
.eq(LazyNettyClusterNodeDO::getClusterNodeId,clusterNodeId));
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.framework.smart.agent.network.heartbeat.server.cluster.infrastructure.mapper.LazyNettyClusterNodeMapper">
|
||||
<resultMap id="BaseResultMap" type="org.framework.smart.agent.network.heartbeat.server.cluster.infrastructure.entity.LazyNettyClusterNodeDO">
|
||||
<result column="cluster_node_host" property="clusterNodeHost" />
|
||||
<result column="cluster_node_id" property="clusterNodeId" />
|
||||
<result column="cluster_node_port" property="clusterNodePort" />
|
||||
<result column="create_time" property="createTime" />
|
||||
<result column="is_deleted" property="isDeleted" />
|
||||
<result column="role" property="role" />
|
||||
<result column="update_time" property="updateTime" />
|
||||
</resultMap>
|
||||
|
||||
</mapper>
|
@ -0,0 +1,93 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.config;
|
||||
|
||||
|
||||
import org.framework.smart.agent.network.heartbeat.server.cluster.application.LazyNettyClusterNodeApplication;
|
||||
import org.framework.smart.agent.network.heartbeat.server.netty.advanced.*;
|
||||
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Role;
|
||||
import org.framework.smart.agent.network.heartbeat.common.adapter.ChannelFlowAdapter;
|
||||
import org.framework.smart.agent.network.heartbeat.server.standalone.application.LazyInternalNetworkPenetrationMappingApplication;
|
||||
import org.framework.smart.agent.network.heartbeat.server.standalone.application.LazyNettyClientBlacklistApplication;
|
||||
import org.framework.smart.agent.network.heartbeat.server.standalone.application.LazyClientStatsChangeApplication;
|
||||
|
||||
|
||||
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
|
||||
public class HeartbeatServerConfiguration {
|
||||
|
||||
/**
|
||||
* 服务端 处理客户端心跳
|
||||
*
|
||||
* @return ServerHandleChannelHeartbeatTypeAdvanced
|
||||
*/
|
||||
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
|
||||
@Bean
|
||||
public ServerHandleChannelHeartbeatTypeAdvanced serverChannelHeartbeatTypeAdvanced() {
|
||||
return new ServerHandleChannelHeartbeatTypeAdvanced();
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理 服务端处理客户端数据传输
|
||||
*
|
||||
* @return ServerHandleReportHandleChannelTransferTypeAdvanced
|
||||
*/
|
||||
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
|
||||
@Bean
|
||||
public ServerHandleReportHandleChannelTransferTypeAdvanced serverReportChannelTransferTypeAdvanced(ChannelFlowAdapter channelFlowAdapter) {
|
||||
return new ServerHandleReportHandleChannelTransferTypeAdvanced(channelFlowAdapter);
|
||||
}
|
||||
|
||||
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
|
||||
@Bean
|
||||
public ServerHandleClientConnectSuccessTypeAdvanced serverReportConnectSuccessTypeAdvanced(
|
||||
LazyClientStatsChangeApplication lazyClientStatsChangeApplication,
|
||||
LazyNettyClientBlacklistApplication lazyNettyClientBlacklistApplication,
|
||||
LazyInternalNetworkPenetrationMappingApplication lazyInternalNetworkPenetrationMappingApplication) {
|
||||
return new ServerHandleClientConnectSuccessTypeAdvanced(lazyClientStatsChangeApplication, lazyNettyClientBlacklistApplication, lazyInternalNetworkPenetrationMappingApplication);
|
||||
}
|
||||
|
||||
/**
|
||||
* 服务端处理集群注册信息
|
||||
*
|
||||
* @param lazyNettyClusterNodeApplication 集群信息获取
|
||||
* @return ServerHandleReportClusterNodeRegisterTypeAdvanced
|
||||
*/
|
||||
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
|
||||
@Bean
|
||||
public ServerHandleReportClusterNodeRegisterTypeAdvanced serverHandleReportClusterNodeRegisterTypeAdvanced() {
|
||||
return new ServerHandleReportClusterNodeRegisterTypeAdvanced();
|
||||
}
|
||||
|
||||
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
|
||||
@Bean
|
||||
public ServerHandleReportDisconnectTypeAdvanced serverReportDisconnectTypeAdvanced(LazyClientStatsChangeApplication lazyClientStatsChangeApplication) {
|
||||
return new ServerHandleReportDisconnectTypeAdvanced(lazyClientStatsChangeApplication);
|
||||
}
|
||||
|
||||
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
|
||||
@Bean
|
||||
public ServerHandleReportSingleClientCloseVisitorTypeAdvanced serverReportSingleClientCloseVisitorTypeAdvanced() {
|
||||
return new ServerHandleReportSingleClientCloseVisitorTypeAdvanced();
|
||||
}
|
||||
|
||||
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
|
||||
@Bean
|
||||
public ServerHandleReportSingleClientRealConnectTypeAdvanced serverReportSingleClientRealConnectTypeAdvanced() {
|
||||
return new ServerHandleReportSingleClientRealConnectTypeAdvanced();
|
||||
}
|
||||
|
||||
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
|
||||
@Bean
|
||||
public ServerHandleReportStagingClosedTypeAdvanced serverReportStagingClosedTypeAdvanced(LazyClientStatsChangeApplication lazyClientStatsChangeApplication) {
|
||||
return new ServerHandleReportStagingClosedTypeAdvanced(lazyClientStatsChangeApplication);
|
||||
}
|
||||
|
||||
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
|
||||
@Bean
|
||||
public ServerHandleReportStagingOpenedTypeAdvanced serverReportStagingOpenedTypeAdvanced(LazyClientStatsChangeApplication lazyClientStatsChangeApplication) {
|
||||
return new ServerHandleReportStagingOpenedTypeAdvanced(lazyClientStatsChangeApplication);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.config;
|
||||
|
||||
import org.framework.smart.agent.network.heartbeat.server.netty.flow.ServerHandlerInFlowHandler;
|
||||
import org.framework.smart.agent.network.heartbeat.server.netty.flow.ServerHandlerOutFlowHandler;
|
||||
import org.framework.smart.agent.network.heartbeat.server.standalone.application.LazyVisitorPortFlowApplication;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Role;
|
||||
import org.framework.smart.agent.network.heartbeat.common.adapter.ChannelFlowAdapter;
|
||||
import org.framework.smart.agent.network.heartbeat.common.advanced.flow.HandleChannelFlowAdvanced;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @see ChannelFlowAdapter
|
||||
* @see HandleChannelFlowAdvanced
|
||||
*/
|
||||
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
|
||||
public class ServerFlowConfiguration {
|
||||
/**
|
||||
* 进口数据处理
|
||||
*
|
||||
* @return ServerHandlerInFlowHandler
|
||||
*/
|
||||
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
|
||||
@Bean
|
||||
public ServerHandlerInFlowHandler serverHandlerInFlowHandler(LazyVisitorPortFlowApplication lazyVisitorPortFlowApplication) {
|
||||
return new ServerHandlerInFlowHandler(lazyVisitorPortFlowApplication);
|
||||
}
|
||||
|
||||
/**
|
||||
* 出口数据处理
|
||||
*
|
||||
* @return ServerHandlerOutFlowHandler
|
||||
*/
|
||||
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
|
||||
@Bean
|
||||
public ServerHandlerOutFlowHandler serverHandlerOutFlowHandler(LazyVisitorPortFlowApplication lazyVisitorPortFlowApplication) {
|
||||
return new ServerHandlerOutFlowHandler(lazyVisitorPortFlowApplication);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 服务端流量适配器
|
||||
*
|
||||
* @param handleChannelFlowAdvancedList 服务端流量适配者
|
||||
* @return 服务端流量适配器
|
||||
*/
|
||||
@ConditionalOnMissingBean(ChannelFlowAdapter.class)
|
||||
@Bean
|
||||
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
|
||||
public ChannelFlowAdapter channelFlowAdapter(List<HandleChannelFlowAdvanced> handleChannelFlowAdvancedList) {
|
||||
return new ChannelFlowAdapter(handleChannelFlowAdvancedList);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,105 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.init;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.framework.smart.agent.network.heartbeat.server.cluster.application.LazyNettyClusterNodeApplication;
|
||||
import org.framework.smart.agent.network.heartbeat.server.cluster.domain.model.cluster.node.LazyNettyClusterNode;
|
||||
import org.framework.smart.agent.network.heartbeat.server.cluster.infrastructure.entity.LazyNettyClusterNodeDO;
|
||||
import org.framework.smart.agent.network.heartbeat.server.properties.ServerNodeProperties;
|
||||
import org.springframework.beans.factory.DisposableBean;
|
||||
import org.springframework.boot.CommandLineRunner;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.wu.framework.core.utils.ObjectUtils;
|
||||
import org.wu.framework.lazy.orm.database.lambda.stream.lambda.LazyLambdaStream;
|
||||
import org.wu.framework.lazy.orm.database.lambda.stream.wrapper.LazyWrappers;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 当配置模式为集群模式 加载
|
||||
*/
|
||||
|
||||
@ConditionalOnProperty(prefix = ServerNodeProperties.prefix, value = "mode", havingValue = "cluster")
|
||||
@Configuration
|
||||
@Slf4j
|
||||
public class InitClusterNode implements CommandLineRunner, DisposableBean {
|
||||
|
||||
private final LazyNettyClusterNodeApplication lazyNettyClusterNodeApplication;
|
||||
|
||||
private final ServerNodeProperties serverNodeProperties;
|
||||
private final LazyLambdaStream lazyLambdaStream;
|
||||
|
||||
public InitClusterNode(LazyNettyClusterNodeApplication lazyNettyClusterNodeApplication,
|
||||
ServerNodeProperties serverNodeProperties,
|
||||
LazyLambdaStream lazyLambdaStream) {
|
||||
this.lazyNettyClusterNodeApplication = lazyNettyClusterNodeApplication;
|
||||
this.serverNodeProperties = serverNodeProperties;
|
||||
this.lazyLambdaStream = lazyLambdaStream;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void run(String... args) throws Exception {
|
||||
log.info("init cluster node....");
|
||||
initNodeConfig2Db();
|
||||
// 连接所有节点
|
||||
|
||||
lazyNettyClusterNodeApplication.starterClusterNodes();
|
||||
|
||||
|
||||
}
|
||||
|
||||
public boolean checkConfig(ServerNodeProperties serverNodeProperties) {
|
||||
|
||||
if (
|
||||
ObjectUtils.isEmpty(serverNodeProperties.getNodeId()) ||
|
||||
ObjectUtils.isEmpty(serverNodeProperties.getNodeHost()) ||
|
||||
ObjectUtils.isEmpty(serverNodeProperties.getNodePort())
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 存储配置到db
|
||||
*/
|
||||
public void initNodeConfig2Db() {
|
||||
|
||||
// 初始化 node 配置信息
|
||||
String clusterNodeId = serverNodeProperties.getNodeId();
|
||||
String clusterNodeHost = serverNodeProperties.getNodeHost();
|
||||
Integer clusterNodePort = serverNodeProperties.getNodePort();
|
||||
|
||||
if (Objects.isNull(clusterNodeId) ||
|
||||
Objects.isNull(clusterNodeHost)) {
|
||||
log.warn("节点信息错误:{}", serverNodeProperties);
|
||||
return;
|
||||
}
|
||||
LazyNettyClusterNode lazyNettyClusterNode = new LazyNettyClusterNode();
|
||||
lazyNettyClusterNode.setClusterNodeHost(clusterNodeHost);
|
||||
lazyNettyClusterNode.setClusterNodePort(clusterNodePort);
|
||||
lazyNettyClusterNode.setClusterNodeId(clusterNodeId);
|
||||
lazyNettyClusterNode.setIsDeleted(false);
|
||||
lazyNettyClusterNode.setCreateTime(LocalDateTime.now());
|
||||
lazyNettyClusterNode.setUpdateTime(LocalDateTime.now());
|
||||
// 根据服务端端口、port 唯一性验证
|
||||
boolean exists = lazyLambdaStream.exists(LazyWrappers.<LazyNettyClusterNodeDO>lambdaWrapper()
|
||||
.eq(LazyNettyClusterNodeDO::getClusterNodeId, clusterNodeId)
|
||||
);
|
||||
if (!exists) {
|
||||
lazyLambdaStream.insert(lazyNettyClusterNode);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 程序关闭后执行
|
||||
*/
|
||||
@Override
|
||||
public void destroy() {
|
||||
lazyNettyClusterNodeApplication.destroyClusterNodes();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,79 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.init;
|
||||
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.framework.smart.agent.network.heartbeat.server.netty.filter.NettyServerFilter;
|
||||
import org.framework.smart.agent.network.heartbeat.server.netty.socket.NettyOnCloudNettyServerSocket;
|
||||
import org.framework.smart.agent.network.heartbeat.server.properties.ServerNodeProperties;
|
||||
import org.springframework.boot.CommandLineRunner;
|
||||
import org.springframework.boot.autoconfigure.web.ServerProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.wu.framework.core.utils.ObjectUtils;
|
||||
|
||||
import java.util.concurrent.ArrayBlockingQueue;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
|
||||
/**
|
||||
* description 初始化服务端
|
||||
*
|
||||
* @author 吴佳伟
|
||||
* @date 2023/09/12 18:22
|
||||
*/
|
||||
@Slf4j
|
||||
@Configuration
|
||||
public class InitServerSocket implements CommandLineRunner {
|
||||
|
||||
private final ServerProperties serverProperties;
|
||||
private final NettyServerFilter nettyServerFilter;
|
||||
private final ServerNodeProperties serverNodeProperties;
|
||||
|
||||
|
||||
ThreadPoolExecutor NETTY_SERVER_EXECUTOR = new ThreadPoolExecutor(1, 1, 200, TimeUnit.MILLISECONDS,
|
||||
new ArrayBlockingQueue<>(1));
|
||||
|
||||
public InitServerSocket(ServerProperties serverProperties,
|
||||
NettyServerFilter nettyServerFilter,
|
||||
ServerNodeProperties serverNodeProperties
|
||||
) {
|
||||
this.serverProperties = serverProperties;
|
||||
this.nettyServerFilter = nettyServerFilter;
|
||||
this.serverNodeProperties = serverNodeProperties;
|
||||
}
|
||||
|
||||
|
||||
@Bean(destroyMethod = "shutdown")
|
||||
public NettyOnCloudNettyServerSocket nettyServerSocket() {
|
||||
return new NettyOnCloudNettyServerSocket(nettyServerFilter);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param args
|
||||
* @throws Exception
|
||||
*/
|
||||
@Override
|
||||
public void run(String... args) throws Exception {
|
||||
|
||||
log.info("Init InitServerSocket ...");
|
||||
NettyOnCloudNettyServerSocket serverSocket = new NettyOnCloudNettyServerSocket(nettyServerFilter);
|
||||
log.info("当前服务启动端口:{}", serverProperties.getPort());
|
||||
int serverPortAdd1000 = serverProperties.getPort() + 1000;
|
||||
if (!ObjectUtils.isEmpty(serverNodeProperties.getNodePort())) {
|
||||
serverPortAdd1000 = serverNodeProperties.getNodePort();
|
||||
}
|
||||
int nettyServerPort = serverPortAdd1000;
|
||||
Thread thread = new Thread(() -> {
|
||||
try {
|
||||
serverSocket.startServer(nettyServerPort);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
});
|
||||
log.info("当前服务启动Netty端口:{}", nettyServerPort);
|
||||
NETTY_SERVER_EXECUTOR.execute(thread);
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.netty.advanced;
|
||||
|
||||
|
||||
import io.netty.channel.Channel;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.framework.smart.agent.network.heartbeat.common.MessageType;
|
||||
import org.framework.smart.agent.network.heartbeat.common.NettyProxyMsg;
|
||||
import org.framework.smart.agent.network.heartbeat.common.advanced.AbstractHandleChannelHeartbeatTypeAdvanced;
|
||||
|
||||
|
||||
/**
|
||||
* 服务端 处理客户端心跳
|
||||
* TYPE_HEARTBEAT
|
||||
*/
|
||||
@Component
|
||||
public class ServerHandleChannelHeartbeatTypeAdvanced extends AbstractHandleChannelHeartbeatTypeAdvanced<NettyProxyMsg> {
|
||||
|
||||
/**
|
||||
* 处理当前数据
|
||||
*
|
||||
* @param channel 当前通道
|
||||
* @param msg 通道数据
|
||||
*/
|
||||
@Override
|
||||
public void doHandler(Channel channel, NettyProxyMsg msg) {
|
||||
NettyProxyMsg hb = new NettyProxyMsg();
|
||||
hb.setType(MessageType.TYPE_HEARTBEAT);
|
||||
channel.writeAndFlush(hb);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,101 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.netty.advanced;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import io.netty.channel.Channel;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.framework.smart.agent.network.heartbeat.common.ChannelContext;
|
||||
import org.framework.smart.agent.network.heartbeat.common.MessageType;
|
||||
import org.framework.smart.agent.network.heartbeat.common.NettyProxyMsg;
|
||||
import org.framework.smart.agent.network.heartbeat.common.advanced.server.AbstractHandleClientConnectSuccessTypeAdvanced;
|
||||
import org.framework.smart.agent.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
|
||||
import org.framework.smart.agent.network.heartbeat.server.standalone.application.LazyInternalNetworkPenetrationMappingApplication;
|
||||
import org.framework.smart.agent.network.heartbeat.server.standalone.application.LazyNettyClientBlacklistApplication;
|
||||
import org.framework.smart.agent.network.heartbeat.server.standalone.application.LazyClientStatsChangeApplication;
|
||||
import org.framework.smart.agent.network.heartbeat.server.standalone.domain.model.netty.client.blacklist.LazyNettyClientBlacklist;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 服务端连接成功处理
|
||||
* REPORT_CLIENT_CONNECT_SUCCESS
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class ServerHandleClientConnectSuccessTypeAdvanced extends AbstractHandleClientConnectSuccessTypeAdvanced<NettyProxyMsg> {
|
||||
|
||||
private final LazyClientStatsChangeApplication lazyClientStatsChangeApplication;
|
||||
private final LazyNettyClientBlacklistApplication lazyNettyClientBlacklistApplication;
|
||||
private final LazyInternalNetworkPenetrationMappingApplication lazyInternalNetworkPenetrationMappingApplication;
|
||||
|
||||
public ServerHandleClientConnectSuccessTypeAdvanced(LazyClientStatsChangeApplication lazyClientStatsChangeApplication, LazyNettyClientBlacklistApplication lazyNettyClientBlacklistApplication, LazyInternalNetworkPenetrationMappingApplication lazyInternalNetworkPenetrationMappingApplication) {
|
||||
this.lazyClientStatsChangeApplication = lazyClientStatsChangeApplication;
|
||||
this.lazyNettyClientBlacklistApplication = lazyNettyClientBlacklistApplication;
|
||||
this.lazyInternalNetworkPenetrationMappingApplication = lazyInternalNetworkPenetrationMappingApplication;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 处理当前数据
|
||||
*
|
||||
* @param newChannel 当前通道
|
||||
* @param msg 通道数据
|
||||
*/
|
||||
@Override
|
||||
public void doHandler(Channel newChannel, NettyProxyMsg msg) {
|
||||
|
||||
|
||||
String clientId = new String(msg.getClientId());
|
||||
ChannelContext.push(newChannel, clientId);
|
||||
|
||||
ChannelAttributeKeyUtils.buildClientId(newChannel, clientId);
|
||||
// 客户端:{},IP:{}连接成功
|
||||
log.info("Client: {}, IP: {} Connection successful", new String(msg.getClientId()), newChannel.remoteAddress().toString());
|
||||
// 验证客户端是否时黑名单
|
||||
LazyNettyClientBlacklist lazyNettyClientBlacklist = new LazyNettyClientBlacklist();
|
||||
lazyNettyClientBlacklist.setClientId(clientId);
|
||||
lazyNettyClientBlacklist.setIsDeleted(false);
|
||||
lazyNettyClientBlacklistApplication.exists(lazyNettyClientBlacklist).accept(exists -> {
|
||||
if (!exists) {
|
||||
// 服务状态在线
|
||||
lazyClientStatsChangeApplication.clientOnLine(clientId);
|
||||
List<ChannelContext.ClientChannel> clientChannels = ChannelContext.get();
|
||||
// 当前在线客户端数量:{}
|
||||
log.info("Current number of online clients: {}", clientChannels.size());
|
||||
// 所有的客户端ID
|
||||
List<String> clientIdList = clientChannels
|
||||
.stream()
|
||||
.map(activeClientChannel -> new String(activeClientChannel.getClientId()))
|
||||
.toList();
|
||||
|
||||
// TODO 多副本本地channel 无法共享问题
|
||||
// 通知所有客户端有人上线了
|
||||
for (ChannelContext.ClientChannel clientChannel : clientChannels) {
|
||||
Channel channel = clientChannel.getChannel();
|
||||
NettyProxyMsg nettyMsg = new NettyProxyMsg();
|
||||
nettyMsg.setType(MessageType.DISTRIBUTE_CLIENT_CONNECTION_SUCCESS_NOTIFICATION);
|
||||
nettyMsg.setData((JSON.toJSONString(clientIdList)
|
||||
.getBytes(StandardCharsets.UTF_8)));
|
||||
// 发送所有客户端ID
|
||||
channel.writeAndFlush(nettyMsg);
|
||||
}
|
||||
// 开始开启客户端:【{}】,端口映射
|
||||
log.info("Start opening client: [{}], port mapping", clientId);
|
||||
// 创建访问者(内网穿透连接创建)
|
||||
lazyInternalNetworkPenetrationMappingApplication.createVisitor(clientId);
|
||||
// 结束开启客户端:【{}】,端口映射
|
||||
log.info("End opening client: [{}], port mapping", clientId);
|
||||
|
||||
} else {
|
||||
// 黑名单客户端
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.netty.advanced;
|
||||
|
||||
import io.netty.channel.Channel;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.framework.smart.agent.network.heartbeat.common.NettyProxyMsg;
|
||||
import org.framework.smart.agent.network.heartbeat.common.advanced.server.AbstractHandleReportClusterNodeRegisterTypeAdvanced;
|
||||
import org.framework.smart.agent.network.heartbeat.server.cluster.application.LazyNettyClusterNodeApplication;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.wu.framework.bean.factory.BeanContext;
|
||||
|
||||
/**
|
||||
* 集群节点注册 服务端本地处理
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class ServerHandleReportClusterNodeRegisterTypeAdvanced extends
|
||||
AbstractHandleReportClusterNodeRegisterTypeAdvanced<NettyProxyMsg> {
|
||||
|
||||
|
||||
public ServerHandleReportClusterNodeRegisterTypeAdvanced() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理当前数据
|
||||
*
|
||||
* @param channel 当前通道
|
||||
* @param nettyProxyMsg 通道数据
|
||||
*/
|
||||
@Override
|
||||
protected void doHandler(Channel channel, NettyProxyMsg nettyProxyMsg) {
|
||||
|
||||
log.info("node register and me start scan node config");
|
||||
// 本地扫描节点配置重新注册
|
||||
LazyNettyClusterNodeApplication lazyNettyClusterNodeApplication = BeanContext.getBean(LazyNettyClusterNodeApplication.class);
|
||||
|
||||
// 循环依赖问题
|
||||
lazyNettyClusterNodeApplication.starterClusterNodes();
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,91 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.netty.advanced;
|
||||
|
||||
|
||||
import io.netty.channel.Channel;
|
||||
import io.netty.channel.ChannelId;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.framework.smart.agent.network.heartbeat.server.netty.socket.NettyVisitorSocket;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.wu.framework.core.utils.ObjectUtils;
|
||||
import org.framework.smart.agent.network.heartbeat.common.ChannelContext;
|
||||
import org.framework.smart.agent.network.heartbeat.common.MessageType;
|
||||
import org.framework.smart.agent.network.heartbeat.common.NettyClientVisitorContext;
|
||||
import org.framework.smart.agent.network.heartbeat.common.NettyProxyMsg;
|
||||
import org.framework.smart.agent.network.heartbeat.common.advanced.server.AbstractHandleReportDisconnectTypeAdvanced;
|
||||
import org.framework.smart.agent.network.heartbeat.server.standalone.application.LazyClientStatsChangeApplication;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 服务端处理客户端断开连接处理
|
||||
* TYPE_DISCONNECT
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class ServerHandleReportDisconnectTypeAdvanced extends AbstractHandleReportDisconnectTypeAdvanced<NettyProxyMsg> {
|
||||
private final LazyClientStatsChangeApplication lazyClientStatsChangeApplication;
|
||||
|
||||
public ServerHandleReportDisconnectTypeAdvanced(LazyClientStatsChangeApplication lazyClientStatsChangeApplication) {
|
||||
this.lazyClientStatsChangeApplication = lazyClientStatsChangeApplication;
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理当前数据
|
||||
*
|
||||
* @param deathChannel 关闭的通道
|
||||
* @param msg 通道数据
|
||||
*/
|
||||
@Override
|
||||
public void doHandler(Channel deathChannel, NettyProxyMsg msg) {
|
||||
// 关闭连接通知
|
||||
byte[] clientIdByte = msg.getClientId();
|
||||
log.warn("close client :{} channel", new String(clientIdByte));
|
||||
ChannelId deathChannelId = deathChannel.id();
|
||||
ChannelContext.ClientChannel deathClientChannelDTO = ChannelContext.get(clientIdByte);
|
||||
|
||||
if (deathClientChannelDTO != null) {
|
||||
byte[] clientId = deathClientChannelDTO.getClientId();
|
||||
// 服务状态离线
|
||||
String tenantId = new String(clientId);
|
||||
lazyClientStatsChangeApplication.clientOffLine(tenantId);
|
||||
ChannelContext.remove(clientIdByte);
|
||||
List<ChannelContext.ClientChannel> clientChannels = ChannelContext.get();
|
||||
|
||||
// 通知其他客户端 channelId 关闭了
|
||||
for (ChannelContext.ClientChannel clientChannel : clientChannels) {
|
||||
Channel channel = clientChannel.getChannel();
|
||||
|
||||
// 离线通知
|
||||
NettyProxyMsg nettyMsg = new NettyProxyMsg();
|
||||
nettyMsg.setType(MessageType.DISTRIBUTE_CLIENT_DISCONNECTION_NOTIFICATION);
|
||||
nettyMsg.setClientId(clientId);
|
||||
nettyMsg.setData(clientId);
|
||||
channel.writeAndFlush(nettyMsg);
|
||||
// 暂存通知
|
||||
NettyProxyMsg stagingNettyProxyMsg = new NettyProxyMsg();
|
||||
stagingNettyProxyMsg.setType(MessageType.DISTRIBUTE_CLIENT_STAGING_OPENED_NOTIFICATION);
|
||||
stagingNettyProxyMsg.setData(clientId);
|
||||
stagingNettyProxyMsg.setClientId(clientId);
|
||||
channel.writeAndFlush(stagingNettyProxyMsg);
|
||||
}
|
||||
// 关闭绑定的访客端口
|
||||
List<NettyVisitorSocket> visitorSockets = NettyClientVisitorContext.getVisitorSockets(new String(clientId));
|
||||
if (!ObjectUtils.isEmpty(visitorSockets)) {
|
||||
for (NettyVisitorSocket visitorSocket : visitorSockets) {
|
||||
int visitorPort = visitorSocket.getVisitorPort();
|
||||
try {
|
||||
visitorSocket.close();
|
||||
log.warn("client :[{}] visitorPort:[{}] close", new String(clientId), visitorPort);
|
||||
} catch (IOException | InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.netty.advanced;
|
||||
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.channel.Channel;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.framework.smart.agent.network.heartbeat.common.NettyProxyMsg;
|
||||
import org.framework.smart.agent.network.heartbeat.common.NettyRealIdContext;
|
||||
import org.framework.smart.agent.network.heartbeat.common.adapter.ChannelFlowAdapter;
|
||||
import org.framework.smart.agent.network.heartbeat.common.advanced.server.AbstractHandleReportHandleChannelTransferTypeAdvanced;
|
||||
import org.framework.smart.agent.network.heartbeat.common.enums.ChannelFlowEnum;
|
||||
import org.framework.smart.agent.network.heartbeat.server.netty.flow.ServerChannelFlow;
|
||||
|
||||
|
||||
/**
|
||||
* 服务端处理客户端数据传输
|
||||
* REPORT_CLIENT_STAGING_CLOSED
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class ServerHandleReportHandleChannelTransferTypeAdvanced extends AbstractHandleReportHandleChannelTransferTypeAdvanced<NettyProxyMsg> {
|
||||
|
||||
private final ChannelFlowAdapter channelFlowAdapter;
|
||||
|
||||
public ServerHandleReportHandleChannelTransferTypeAdvanced(ChannelFlowAdapter channelFlowAdapter) {
|
||||
this.channelFlowAdapter = channelFlowAdapter;
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理当前数据
|
||||
*
|
||||
* @param channel 当前通道
|
||||
* @param msg 通道数据
|
||||
*/
|
||||
@Override
|
||||
public void doHandler(Channel channel, NettyProxyMsg msg) {
|
||||
String clientId = new String(msg.getClientId());
|
||||
Integer visitorPort = Integer.valueOf(new String(msg.getVisitorPort()));
|
||||
log.debug("接收到客户端:[{}]内网穿透返回的数据:[{}]", clientId, new String(msg.getData()));
|
||||
// 将数据转发访客通道
|
||||
byte[] visitorId = msg.getVisitorId();
|
||||
Channel visitor = NettyRealIdContext.getReal(visitorId);
|
||||
if (visitor != null) {
|
||||
ByteBuf buf = visitor.config().getAllocator().buffer(msg.getData().length);
|
||||
buf.writeBytes(msg.getData());
|
||||
visitor.writeAndFlush(buf);
|
||||
|
||||
// 记录出口数据
|
||||
ServerChannelFlow serverChannelFlow = ServerChannelFlow
|
||||
.builder()
|
||||
.channelFlowEnum(ChannelFlowEnum.OUT_FLOW)
|
||||
.port(visitorPort)
|
||||
.clientId(clientId)
|
||||
.flow(msg.getData().length)
|
||||
.build();
|
||||
channelFlowAdapter.handler(channel, serverChannelFlow);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.netty.advanced;
|
||||
|
||||
import io.netty.channel.Channel;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.framework.smart.agent.network.heartbeat.common.NettyCommunicationIdContext;
|
||||
import org.framework.smart.agent.network.heartbeat.common.NettyProxyMsg;
|
||||
import org.framework.smart.agent.network.heartbeat.common.NettyRealIdContext;
|
||||
import org.framework.smart.agent.network.heartbeat.common.advanced.server.AbstractHandleReportSingleClientCloseVisitorTypeAdvanced;
|
||||
|
||||
/**
|
||||
* 服务端处理客户端 关闭一个访客
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class ServerHandleReportSingleClientCloseVisitorTypeAdvanced extends AbstractHandleReportSingleClientCloseVisitorTypeAdvanced<NettyProxyMsg> {
|
||||
|
||||
|
||||
/**
|
||||
* 处理当前数据
|
||||
*
|
||||
* @param channel 当前通道
|
||||
* @param nettyProxyMsg 通道数据
|
||||
*/
|
||||
@Override
|
||||
protected void doHandler(Channel channel, NettyProxyMsg nettyProxyMsg) {
|
||||
// 关闭访客通道
|
||||
byte[] visitorId = nettyProxyMsg.getVisitorId();
|
||||
NettyCommunicationIdContext.clear(visitorId);
|
||||
NettyRealIdContext.clear(visitorId);
|
||||
}
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.netty.advanced;
|
||||
|
||||
import io.netty.channel.Channel;
|
||||
import io.netty.channel.ChannelOption;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.framework.smart.agent.network.heartbeat.common.NettyCommunicationIdContext;
|
||||
import org.framework.smart.agent.network.heartbeat.common.NettyProxyMsg;
|
||||
import org.framework.smart.agent.network.heartbeat.common.NettyRealIdContext;
|
||||
import org.framework.smart.agent.network.heartbeat.common.advanced.server.AbstractHandleReportSingleClientRealConnectTypeAdvanced;
|
||||
import org.framework.smart.agent.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class ServerHandleReportSingleClientRealConnectTypeAdvanced extends AbstractHandleReportSingleClientRealConnectTypeAdvanced<NettyProxyMsg> {
|
||||
|
||||
/**
|
||||
* 处理当前数据
|
||||
*
|
||||
* @param channel 当前通道
|
||||
* @param nettyProxyMsg 通道数据
|
||||
*/
|
||||
@Override
|
||||
protected void doHandler(Channel channel, NettyProxyMsg nettyProxyMsg) {
|
||||
// 客户端绑定端口成功
|
||||
byte[] clientId = nettyProxyMsg.getClientId();
|
||||
byte[] clientTargetIp = nettyProxyMsg.getClientTargetIp();
|
||||
byte[] clientTargetPort = nettyProxyMsg.getClientTargetPort();
|
||||
byte[] visitorPort = nettyProxyMsg.getVisitorPort();
|
||||
byte[] visitorId = nettyProxyMsg.getVisitorId();
|
||||
log.info("客户端:{},绑定真实服务ip:{},port:{},成功", new String(clientId), new String(clientTargetIp), new String(clientTargetPort));
|
||||
// 绑定服务端访客通信通道
|
||||
NettyCommunicationIdContext.pushVisitor(channel, new String(visitorId));
|
||||
ChannelAttributeKeyUtils.buildVisitorId(channel, visitorId);
|
||||
ChannelAttributeKeyUtils.buildClientId(channel, clientId);
|
||||
ChannelAttributeKeyUtils.buildVisitorPort(channel, Integer.valueOf(new String(visitorPort)));
|
||||
// 访客通道开启自动读取
|
||||
Channel visitorRealChannel = NettyRealIdContext.getReal(new String(visitorId));
|
||||
visitorRealChannel.config().setOption(ChannelOption.AUTO_READ, true);
|
||||
|
||||
// 或许此处还应该通知服务端 这个访客绑定的客户端真实通道打开
|
||||
|
||||
// 下发客户端 真实通道自动读写开启
|
||||
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.netty.advanced;
|
||||
|
||||
import io.netty.channel.Channel;
|
||||
import io.netty.channel.ChannelId;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.framework.smart.agent.network.heartbeat.common.ChannelContext;
|
||||
import org.framework.smart.agent.network.heartbeat.common.MessageType;
|
||||
import org.framework.smart.agent.network.heartbeat.common.NettyProxyMsg;
|
||||
import org.framework.smart.agent.network.heartbeat.common.advanced.server.AbstractHandleReportStagingClosedTypeAdvanced;
|
||||
import org.framework.smart.agent.network.heartbeat.server.standalone.application.LazyClientStatsChangeApplication;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 服务端处理上报的暂存关闭
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class ServerHandleReportStagingClosedTypeAdvanced extends AbstractHandleReportStagingClosedTypeAdvanced<NettyProxyMsg> {
|
||||
private final LazyClientStatsChangeApplication lazyClientStatsChangeApplication;
|
||||
|
||||
public ServerHandleReportStagingClosedTypeAdvanced(LazyClientStatsChangeApplication lazyClientStatsChangeApplication) {
|
||||
this.lazyClientStatsChangeApplication = lazyClientStatsChangeApplication;
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理当前数据
|
||||
*
|
||||
* @param stagingClosedChannel 关闭暂存的通道
|
||||
* @param msg 通道数据
|
||||
*/
|
||||
@Override
|
||||
protected void doHandler(Channel stagingClosedChannel, NettyProxyMsg msg) {
|
||||
byte[] clientIdBytes = msg.getClientId();
|
||||
// 获取所有通道
|
||||
List<ChannelContext.ClientChannel> clientChannels = ChannelContext.get();
|
||||
ChannelId stagingClosedChannelId = stagingClosedChannel.id();
|
||||
ChannelContext.ClientChannel stagingOpenedClientChannel = ChannelContext.get(clientIdBytes);
|
||||
if (stagingOpenedClientChannel != null) {
|
||||
String clientId = new String(clientIdBytes);
|
||||
// 存储当前客户端暂存关闭
|
||||
lazyClientStatsChangeApplication.stagingClosed(clientId);
|
||||
for (ChannelContext.ClientChannel clientChannel : clientChannels) {
|
||||
// 告诉他们 当前参数这个通道 暂存关闭了
|
||||
Channel channel = clientChannel.getChannel();
|
||||
NettyProxyMsg nettyMsg = new NettyProxyMsg();
|
||||
nettyMsg.setType(MessageType.DISTRIBUTE_CLIENT_STAGING_CLOSED_NOTIFICATION);
|
||||
nettyMsg.setData((clientId
|
||||
.getBytes(StandardCharsets.UTF_8)));
|
||||
nettyMsg.setClientId((clientId
|
||||
.getBytes(StandardCharsets.UTF_8)));
|
||||
channel.writeAndFlush(nettyMsg);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.netty.advanced;
|
||||
|
||||
import io.netty.channel.Channel;
|
||||
import io.netty.channel.ChannelId;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.framework.smart.agent.network.heartbeat.common.ChannelContext;
|
||||
import org.framework.smart.agent.network.heartbeat.common.MessageType;
|
||||
import org.framework.smart.agent.network.heartbeat.common.NettyProxyMsg;
|
||||
import org.framework.smart.agent.network.heartbeat.common.advanced.server.AbstractHandleReportStagingOpenedTypeAdvanced;
|
||||
import org.framework.smart.agent.network.heartbeat.server.standalone.application.LazyClientStatsChangeApplication;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 服务端处理上报的暂存开启
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class ServerHandleReportStagingOpenedTypeAdvanced extends AbstractHandleReportStagingOpenedTypeAdvanced<NettyProxyMsg> {
|
||||
|
||||
private final LazyClientStatsChangeApplication lazyClientStatsChangeApplication;
|
||||
|
||||
public ServerHandleReportStagingOpenedTypeAdvanced(LazyClientStatsChangeApplication lazyClientStatsChangeApplication) {
|
||||
this.lazyClientStatsChangeApplication = lazyClientStatsChangeApplication;
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理当前数据
|
||||
*
|
||||
* @param stagingOpenedChannel 开启暂存的通道
|
||||
* @param msg 通道数据
|
||||
*/
|
||||
@Override
|
||||
protected void doHandler(Channel stagingOpenedChannel, NettyProxyMsg msg) {
|
||||
// 获取所有通道
|
||||
byte[] clientIdBytes = msg.getClientId();
|
||||
List<ChannelContext.ClientChannel> clientChannels = ChannelContext.get();
|
||||
ChannelId stagingOpenedChannelId = stagingOpenedChannel.id();
|
||||
ChannelContext.ClientChannel stagingOpenedClientChannel = ChannelContext.get(clientIdBytes);
|
||||
if (stagingOpenedClientChannel != null) {
|
||||
for (ChannelContext.ClientChannel clientChannel : clientChannels) {
|
||||
// 存储当前客户端暂存关闭
|
||||
String clientId = new String(clientIdBytes);
|
||||
lazyClientStatsChangeApplication.stagingOpened(clientId);
|
||||
// 告诉他们 当前参数这个通道 暂存开启了
|
||||
Channel channel = clientChannel.getChannel();
|
||||
NettyProxyMsg nettyMsg = new NettyProxyMsg();
|
||||
nettyMsg.setType(MessageType.DISTRIBUTE_CLIENT_STAGING_OPENED_NOTIFICATION);
|
||||
nettyMsg.setData((clientId
|
||||
.getBytes(StandardCharsets.UTF_8)));
|
||||
nettyMsg.setClientId((clientId
|
||||
.getBytes(StandardCharsets.UTF_8)));
|
||||
channel.writeAndFlush(nettyMsg);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.netty.filter;
|
||||
|
||||
import io.netty.channel.ChannelInitializer;
|
||||
import io.netty.channel.ChannelPipeline;
|
||||
import io.netty.channel.socket.SocketChannel;
|
||||
import io.netty.handler.codec.string.StringDecoder;
|
||||
import io.netty.handler.codec.string.StringEncoder;
|
||||
import io.netty.handler.timeout.IdleStateHandler;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.framework.smart.agent.network.heartbeat.common.adapter.ChannelTypeAdapter;
|
||||
import org.framework.smart.agent.network.heartbeat.common.advanced.HandleChannelTypeAdvanced;
|
||||
import org.framework.smart.agent.network.heartbeat.common.decoder.NettyProxyMsgDecoder;
|
||||
import org.framework.smart.agent.network.heartbeat.common.encoder.NettyProxyMsgEncoder;
|
||||
import org.framework.smart.agent.network.heartbeat.server.netty.handler.NettyServerHandler;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* description
|
||||
*
|
||||
* @author 吴佳伟
|
||||
* @date 2023/09/13 10:26
|
||||
*/
|
||||
@Component
|
||||
public class NettyServerFilter extends ChannelInitializer<SocketChannel> {
|
||||
private final List<HandleChannelTypeAdvanced> handleChannelTypeAdvancedList;
|
||||
|
||||
public NettyServerFilter(List<HandleChannelTypeAdvanced> handleChannelTypeAdvancedList) {
|
||||
this.handleChannelTypeAdvancedList = handleChannelTypeAdvancedList;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initChannel(SocketChannel ch) throws Exception {
|
||||
ChannelPipeline pipeline = ch.pipeline();
|
||||
// 以("\n")为结尾分割的 解码器
|
||||
// 解码、编码
|
||||
pipeline.addLast(new NettyProxyMsgDecoder(Integer.MAX_VALUE, 0, 4, -4, 0));
|
||||
pipeline.addLast(new NettyProxyMsgEncoder());
|
||||
// ph.addLast("framer", new DelimiterBasedFrameDecoder(8192, Delimiters.lineDelimiter()));
|
||||
// 解码和编码,应和客户端一致
|
||||
//入参说明: 读超时时间、写超时时间、所有类型的超时时间、时间格式
|
||||
|
||||
pipeline.addLast(new IdleStateHandler(5, 0, 0, TimeUnit.SECONDS));
|
||||
pipeline.addLast("decoder", new StringDecoder());
|
||||
pipeline.addLast("encoder", new StringEncoder());
|
||||
// 类型处理器适配器
|
||||
ChannelTypeAdapter channelTypeAdapter = new ChannelTypeAdapter(handleChannelTypeAdvancedList);
|
||||
pipeline.addLast("doHandler", new NettyServerHandler(channelTypeAdapter));// 服务端业务逻辑
|
||||
}
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.netty.filter;
|
||||
|
||||
import io.netty.channel.*;
|
||||
import io.netty.channel.socket.SocketChannel;
|
||||
import org.framework.smart.agent.network.heartbeat.common.InternalNetworkPenetrationRealClient;
|
||||
import org.framework.smart.agent.network.heartbeat.common.adapter.ChannelFlowAdapter;
|
||||
import org.framework.smart.agent.network.heartbeat.server.netty.handler.VisitorHandler;
|
||||
|
||||
public class VisitorFilter extends ChannelInitializer<SocketChannel> {
|
||||
private final InternalNetworkPenetrationRealClient internalNetworkPenetrationRealClient;
|
||||
private final ChannelFlowAdapter channelFlowAdapter;
|
||||
|
||||
public VisitorFilter(InternalNetworkPenetrationRealClient internalNetworkPenetrationRealClient, ChannelFlowAdapter channelFlowAdapter) {
|
||||
this.internalNetworkPenetrationRealClient = internalNetworkPenetrationRealClient;
|
||||
this.channelFlowAdapter = channelFlowAdapter;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method will be called once the {@link Channel} was registered. After the method returns this instance
|
||||
* will be removed from the {@link ChannelPipeline} of the {@link Channel}.
|
||||
*
|
||||
* @param ch the {@link Channel} which was registered.
|
||||
* @throws Exception is thrown if an error occurs. In that case it will be handled by
|
||||
* {@link #exceptionCaught(ChannelHandlerContext, Throwable)} which will by default connectionClose
|
||||
* the {@link Channel}.
|
||||
*/
|
||||
@Override
|
||||
protected void initChannel(SocketChannel ch) throws Exception {
|
||||
ChannelPipeline pipeline = ch.pipeline();
|
||||
pipeline.addLast(new ChannelDuplexHandler());
|
||||
pipeline.addLast(new VisitorHandler(internalNetworkPenetrationRealClient, channelFlowAdapter));
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.netty.flow;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import org.framework.smart.agent.network.heartbeat.common.advanced.flow.ChannelFlow;
|
||||
import org.framework.smart.agent.network.heartbeat.common.enums.ChannelFlowEnum;
|
||||
|
||||
@Builder
|
||||
@Data
|
||||
public class ServerChannelFlow implements ChannelFlow {
|
||||
private String clientId;
|
||||
private Integer port;
|
||||
private ChannelFlowEnum channelFlowEnum;
|
||||
private Integer flow;
|
||||
|
||||
/**
|
||||
* 通道客户端ID
|
||||
*
|
||||
* @return 通道客户端ID
|
||||
*/
|
||||
@Override
|
||||
public String clientId() {
|
||||
return clientId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通道使用的端口(服务端访客端口、客户端真实端口)
|
||||
*
|
||||
* @return 端口
|
||||
*/
|
||||
@Override
|
||||
public Integer port() {
|
||||
return port;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通道流量类型
|
||||
*
|
||||
* @return ChannelFlowEnum
|
||||
* @see ChannelFlowEnum
|
||||
*/
|
||||
@Override
|
||||
public ChannelFlowEnum channelFlowEnum() {
|
||||
return channelFlowEnum;
|
||||
}
|
||||
|
||||
/**
|
||||
* 流量
|
||||
*
|
||||
* @return 流量
|
||||
*/
|
||||
@Override
|
||||
public Integer flow() {
|
||||
return flow;
|
||||
}
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.netty.flow;
|
||||
|
||||
import io.netty.channel.Channel;
|
||||
import org.framework.smart.agent.network.heartbeat.server.standalone.application.LazyVisitorPortFlowApplication;
|
||||
import org.framework.smart.agent.network.heartbeat.server.standalone.application.command.visitor.flow.LazyVisitorPortFlowStoryCommand;
|
||||
import org.framework.smart.agent.network.heartbeat.common.advanced.flow.AbstractHandleChannelFlowAdvanced;
|
||||
import org.framework.smart.agent.network.heartbeat.common.advanced.flow.ChannelFlow;
|
||||
import org.framework.smart.agent.network.heartbeat.common.enums.ChannelFlowEnum;
|
||||
|
||||
/**
|
||||
* 进口流量处理
|
||||
*/
|
||||
public class ServerHandlerInFlowHandler extends AbstractHandleChannelFlowAdvanced {
|
||||
private final LazyVisitorPortFlowApplication lazyVisitorPortFlowApplication;
|
||||
|
||||
public ServerHandlerInFlowHandler(LazyVisitorPortFlowApplication lazyVisitorPortFlowApplication) {
|
||||
this.lazyVisitorPortFlowApplication = lazyVisitorPortFlowApplication;
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理是否支持这种类型
|
||||
*
|
||||
* @param channelFlow 数据
|
||||
* @return boolean
|
||||
*/
|
||||
@Override
|
||||
protected boolean doSupport(ChannelFlow channelFlow) {
|
||||
return ChannelFlowEnum.IN_FLOW.equals(channelFlow.channelFlowEnum());
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理当前数据
|
||||
*
|
||||
* @param channel 当前通道
|
||||
* @param channelFlow 通道数据
|
||||
*/
|
||||
@Override
|
||||
protected void doHandler(Channel channel, ChannelFlow channelFlow) {
|
||||
String clientId = channelFlow.clientId();
|
||||
Integer port = channelFlow.port();
|
||||
Integer flow = channelFlow.flow();
|
||||
|
||||
// 进口流量处理
|
||||
LazyVisitorPortFlowStoryCommand visitorPortFlow = new LazyVisitorPortFlowStoryCommand();
|
||||
visitorPortFlow.setInFlow(flow);
|
||||
visitorPortFlow.setClientId(clientId);
|
||||
visitorPortFlow.setVisitorPort(port);
|
||||
visitorPortFlow.setIsDeleted(false);
|
||||
lazyVisitorPortFlowApplication.flowIncreaseStory(visitorPortFlow);
|
||||
}
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.netty.flow;
|
||||
|
||||
import io.netty.channel.Channel;
|
||||
import org.framework.smart.agent.network.heartbeat.server.standalone.application.LazyVisitorPortFlowApplication;
|
||||
import org.framework.smart.agent.network.heartbeat.server.standalone.application.command.visitor.flow.LazyVisitorPortFlowStoryCommand;
|
||||
import org.framework.smart.agent.network.heartbeat.common.advanced.flow.AbstractHandleChannelFlowAdvanced;
|
||||
import org.framework.smart.agent.network.heartbeat.common.advanced.flow.ChannelFlow;
|
||||
import org.framework.smart.agent.network.heartbeat.common.enums.ChannelFlowEnum;
|
||||
|
||||
/**
|
||||
* 出口流量处理
|
||||
*/
|
||||
public class ServerHandlerOutFlowHandler extends AbstractHandleChannelFlowAdvanced {
|
||||
private final LazyVisitorPortFlowApplication lazyVisitorPortFlowApplication;
|
||||
|
||||
public ServerHandlerOutFlowHandler(LazyVisitorPortFlowApplication lazyVisitorPortFlowApplication) {
|
||||
this.lazyVisitorPortFlowApplication = lazyVisitorPortFlowApplication;
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理是否支持这种类型
|
||||
*
|
||||
* @param channelFlow 数据
|
||||
* @return boolean
|
||||
*/
|
||||
@Override
|
||||
protected boolean doSupport(ChannelFlow channelFlow) {
|
||||
return ChannelFlowEnum.OUT_FLOW.equals(channelFlow.channelFlowEnum());
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理当前数据
|
||||
*
|
||||
* @param channel 当前通道
|
||||
* @param channelFlow 通道数据
|
||||
*/
|
||||
@Override
|
||||
protected void doHandler(Channel channel, ChannelFlow channelFlow) {
|
||||
String clientId = channelFlow.clientId();
|
||||
Integer port = channelFlow.port();
|
||||
Integer flow = channelFlow.flow();
|
||||
|
||||
// 出口流量处理
|
||||
|
||||
LazyVisitorPortFlowStoryCommand visitorPortFlow = new LazyVisitorPortFlowStoryCommand();
|
||||
visitorPortFlow.setOutFlow(flow);
|
||||
visitorPortFlow.setClientId(clientId);
|
||||
visitorPortFlow.setVisitorPort(port);
|
||||
visitorPortFlow.setIsDeleted(false);
|
||||
lazyVisitorPortFlowApplication.flowIncreaseStory(visitorPortFlow);
|
||||
}
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.netty.handler;
|
||||
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
||||
import io.netty.handler.timeout.IdleState;
|
||||
import io.netty.handler.timeout.IdleStateEvent;
|
||||
import io.netty.util.AttributeKey;
|
||||
|
||||
@Deprecated
|
||||
public class HeartBeatServerHandler extends ChannelInboundHandlerAdapter {
|
||||
|
||||
AttributeKey<String> channelAttributeKeyId = AttributeKey.valueOf("channelAttributeTenantId");
|
||||
private int lossConnectCount = 0;
|
||||
|
||||
@Override
|
||||
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
|
||||
String channelAttributeId = ctx.channel().attr(channelAttributeKeyId).get();
|
||||
System.out.println("channelAttributeTenantId:" + channelAttributeId);
|
||||
System.out.println("已经5秒未收到客户端的消息了!");
|
||||
|
||||
if (evt instanceof IdleStateEvent event) {
|
||||
if (event.state() == IdleState.READER_IDLE) {
|
||||
lossConnectCount++;
|
||||
if (lossConnectCount > 2) {
|
||||
System.out.println("关闭这个不活跃通道!");
|
||||
// ctx.channel().connectionClose();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
super.userEventTriggered(ctx, evt);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
|
||||
lossConnectCount = 0;
|
||||
System.out.println("client says: " + msg.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
|
||||
ctx.close();
|
||||
}
|
||||
}
|
@ -0,0 +1,537 @@
|
||||
/*
|
||||
* Copyright 2012 The Netty Project
|
||||
*
|
||||
* The Netty Project licenses this file to you under the Apache License,
|
||||
* version 2.0 (the "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at:
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.framework.smart.agent.network.heartbeat.server.netty.handler;
|
||||
|
||||
import io.netty.bootstrap.ServerBootstrap;
|
||||
import io.netty.channel.*;
|
||||
import io.netty.handler.timeout.*;
|
||||
import io.netty.util.concurrent.Future;
|
||||
import io.netty.util.internal.ObjectUtil;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* Raises a {@link ReadTimeoutException} when no data was read within a certain
|
||||
* period of time.
|
||||
*
|
||||
* <pre>
|
||||
* // The connection is closed when there is no inbound traffic
|
||||
* // for 30 seconds.
|
||||
*
|
||||
* public class MyChannelInitializer extends {@link ChannelInitializer}<{@link Channel}> {
|
||||
* public void initChannel({@link Channel} channel) {
|
||||
* channel.pipeline().addLast("readTimeoutHandler", new {@link LazyServerIdleStateHandler}(30));
|
||||
* channel.pipeline().addLast("myHandler", new MyHandler());
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* // Handler should handle the {@link ReadTimeoutException}.
|
||||
* public class MyHandler extends {@link ChannelDuplexHandler} {
|
||||
* {@code @Override}
|
||||
* public void exceptionCaught({@link ChannelHandlerContext} ctx, {@link Throwable} cause)
|
||||
* throws {@link Exception} {
|
||||
* if (cause instanceof {@link ReadTimeoutException}) {
|
||||
* // do something
|
||||
* } else {
|
||||
* super.exceptionCaught(ctx, cause);
|
||||
* }
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* {@link ServerBootstrap} bootstrap = ...;
|
||||
* ...
|
||||
* bootstrap.childHandler(new MyChannelInitializer());
|
||||
* ...
|
||||
* </pre>
|
||||
*
|
||||
* @see WriteTimeoutHandler
|
||||
* @see IdleStateHandler
|
||||
*/
|
||||
public class LazyServerIdleStateHandler extends ChannelDuplexHandler {
|
||||
private static final long MIN_TIMEOUT_NANOS = TimeUnit.MILLISECONDS.toNanos(1);
|
||||
private final boolean observeOutput;
|
||||
private final long readerIdleTimeNanos;
|
||||
private final long writerIdleTimeNanos;
|
||||
private final long allIdleTimeNanos;
|
||||
private Future<?> readerIdleTimeout;
|
||||
private long lastReadTime;
|
||||
private boolean firstReaderIdleEvent = true;
|
||||
private Future<?> writerIdleTimeout;
|
||||
private long lastWriteTime;
|
||||
private boolean firstWriterIdleEvent = true;
|
||||
private Future<?> allIdleTimeout;
|
||||
private boolean firstAllIdleEvent = true;
|
||||
// Not create a new ChannelFutureListener per write operation to reduce GC pressure.
|
||||
private final ChannelFutureListener writeListener = new ChannelFutureListener() {
|
||||
@Override
|
||||
public void operationComplete(ChannelFuture future) throws Exception {
|
||||
lastWriteTime = ticksInNanos();
|
||||
firstWriterIdleEvent = firstAllIdleEvent = true;
|
||||
}
|
||||
};
|
||||
private byte state; // 0 - none, 1 - initialized, 2 - destroyed
|
||||
private boolean reading;
|
||||
|
||||
private long lastChangeCheckTimeStamp;
|
||||
private int lastMessageHashCode;
|
||||
private long lastPendingWriteBytes;
|
||||
private long lastFlushProgress;
|
||||
|
||||
/**
|
||||
* Creates a new instance firing {@link IdleStateEvent}s.
|
||||
*
|
||||
* @param readerIdleTimeSeconds an {@link IdleStateEvent} whose state is {@link IdleState#READER_IDLE}
|
||||
* will be triggered when no read was performed for the specified
|
||||
* period of time. Specify {@code 0} to disable.
|
||||
* @param writerIdleTimeSeconds an {@link IdleStateEvent} whose state is {@link IdleState#WRITER_IDLE}
|
||||
* will be triggered when no write was performed for the specified
|
||||
* period of time. Specify {@code 0} to disable.
|
||||
* @param allIdleTimeSeconds an {@link IdleStateEvent} whose state is {@link IdleState#ALL_IDLE}
|
||||
* will be triggered when neither read nor write was performed for
|
||||
* the specified period of time. Specify {@code 0} to disable.
|
||||
*/
|
||||
public LazyServerIdleStateHandler(
|
||||
int readerIdleTimeSeconds,
|
||||
int writerIdleTimeSeconds,
|
||||
int allIdleTimeSeconds) {
|
||||
|
||||
this(readerIdleTimeSeconds, writerIdleTimeSeconds, allIdleTimeSeconds,
|
||||
TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see #LazyServerIdleStateHandler(boolean, long, long, long, TimeUnit)
|
||||
*/
|
||||
public LazyServerIdleStateHandler(
|
||||
long readerIdleTime, long writerIdleTime, long allIdleTime,
|
||||
TimeUnit unit) {
|
||||
this(false, readerIdleTime, writerIdleTime, allIdleTime, unit);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new instance firing {@link IdleStateEvent}s.
|
||||
*
|
||||
* @param observeOutput whether or not the consumption of {@code bytes} should be taken into
|
||||
* consideration when assessing write idleness. The default is {@code false}.
|
||||
* @param readerIdleTime an {@link IdleStateEvent} whose state is {@link IdleState#READER_IDLE}
|
||||
* will be triggered when no read was performed for the specified
|
||||
* period of time. Specify {@code 0} to disable.
|
||||
* @param writerIdleTime an {@link IdleStateEvent} whose state is {@link IdleState#WRITER_IDLE}
|
||||
* will be triggered when no write was performed for the specified
|
||||
* period of time. Specify {@code 0} to disable.
|
||||
* @param allIdleTime an {@link IdleStateEvent} whose state is {@link IdleState#ALL_IDLE}
|
||||
* will be triggered when neither read nor write was performed for
|
||||
* the specified period of time. Specify {@code 0} to disable.
|
||||
* @param unit the {@link TimeUnit} of {@code readerIdleTime},
|
||||
* {@code writeIdleTime}, and {@code allIdleTime}
|
||||
*/
|
||||
public LazyServerIdleStateHandler(boolean observeOutput,
|
||||
long readerIdleTime, long writerIdleTime, long allIdleTime,
|
||||
TimeUnit unit) {
|
||||
ObjectUtil.checkNotNull(unit, "unit");
|
||||
|
||||
this.observeOutput = observeOutput;
|
||||
|
||||
if (readerIdleTime <= 0) {
|
||||
readerIdleTimeNanos = 0;
|
||||
} else {
|
||||
readerIdleTimeNanos = Math.max(unit.toNanos(readerIdleTime), MIN_TIMEOUT_NANOS);
|
||||
}
|
||||
if (writerIdleTime <= 0) {
|
||||
writerIdleTimeNanos = 0;
|
||||
} else {
|
||||
writerIdleTimeNanos = Math.max(unit.toNanos(writerIdleTime), MIN_TIMEOUT_NANOS);
|
||||
}
|
||||
if (allIdleTime <= 0) {
|
||||
allIdleTimeNanos = 0;
|
||||
} else {
|
||||
allIdleTimeNanos = Math.max(unit.toNanos(allIdleTime), MIN_TIMEOUT_NANOS);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the readerIdleTime that was given when instance this class in milliseconds.
|
||||
*/
|
||||
public long getReaderIdleTimeInMillis() {
|
||||
return TimeUnit.NANOSECONDS.toMillis(readerIdleTimeNanos);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the writerIdleTime that was given when instance this class in milliseconds.
|
||||
*/
|
||||
public long getWriterIdleTimeInMillis() {
|
||||
return TimeUnit.NANOSECONDS.toMillis(writerIdleTimeNanos);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the allIdleTime that was given when instance this class in milliseconds.
|
||||
*/
|
||||
public long getAllIdleTimeInMillis() {
|
||||
return TimeUnit.NANOSECONDS.toMillis(allIdleTimeNanos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handlerAdded(ChannelHandlerContext ctx) throws Exception {
|
||||
if (ctx.channel().isActive() && ctx.channel().isRegistered()) {
|
||||
// channelActive() event has been fired already, which means this.channelActive() will
|
||||
// not be invoked. We have to initialize here instead.
|
||||
initialize(ctx);
|
||||
} else {
|
||||
// channelActive() event has not been fired yet. this.channelActive() will be invoked
|
||||
// and initialization will occur there.
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handlerRemoved(ChannelHandlerContext ctx) throws Exception {
|
||||
destroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void channelRegistered(ChannelHandlerContext ctx) throws Exception {
|
||||
// Initialize early if channel is active already.
|
||||
if (ctx.channel().isActive()) {
|
||||
initialize(ctx);
|
||||
}
|
||||
super.channelRegistered(ctx);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void channelActive(ChannelHandlerContext ctx) throws Exception {
|
||||
// This method will be invoked only if this doHandler was added
|
||||
// before channelActive() event is fired. If a user adds this doHandler
|
||||
// after the channelActive() event, initialize() will be called by beforeAdd().
|
||||
initialize(ctx);
|
||||
super.channelActive(ctx);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
|
||||
destroy();
|
||||
super.channelInactive(ctx);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
|
||||
if (readerIdleTimeNanos > 0 || allIdleTimeNanos > 0) {
|
||||
reading = true;
|
||||
firstReaderIdleEvent = firstAllIdleEvent = true;
|
||||
}
|
||||
ctx.fireChannelRead(msg);
|
||||
System.out.println("channelRead");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void channelReadComplete(ChannelHandlerContext ctx) throws Exception {
|
||||
if ((readerIdleTimeNanos > 0 || allIdleTimeNanos > 0) && reading) {
|
||||
lastReadTime = ticksInNanos();
|
||||
reading = false;
|
||||
}
|
||||
ctx.fireChannelReadComplete();
|
||||
System.out.println("channelReadComplete");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception {
|
||||
// Allow writing with void promise if doHandler is only configured for read timeout events.
|
||||
if (writerIdleTimeNanos > 0 || allIdleTimeNanos > 0) {
|
||||
ctx.write(msg, promise.unvoid()).addListener(writeListener);
|
||||
} else {
|
||||
ctx.write(msg, promise);
|
||||
}
|
||||
System.out.println("write");
|
||||
}
|
||||
|
||||
private void initialize(ChannelHandlerContext ctx) {
|
||||
// Avoid the case where destroy() is called before scheduling timeouts.
|
||||
// See: https://github.com/netty/netty/issues/143
|
||||
switch (state) {
|
||||
case 1:
|
||||
case 2:
|
||||
return;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
state = 1;
|
||||
initOutputChanged(ctx);
|
||||
|
||||
lastReadTime = lastWriteTime = ticksInNanos();
|
||||
if (readerIdleTimeNanos > 0) {
|
||||
readerIdleTimeout = schedule(ctx, new ReaderIdleTimeoutTask(ctx),
|
||||
readerIdleTimeNanos, TimeUnit.NANOSECONDS);
|
||||
}
|
||||
if (writerIdleTimeNanos > 0) {
|
||||
writerIdleTimeout = schedule(ctx, new WriterIdleTimeoutTask(ctx),
|
||||
writerIdleTimeNanos, TimeUnit.NANOSECONDS);
|
||||
}
|
||||
if (allIdleTimeNanos > 0) {
|
||||
allIdleTimeout = schedule(ctx, new AllIdleTimeoutTask(ctx),
|
||||
allIdleTimeNanos, TimeUnit.NANOSECONDS);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is visible for testing!
|
||||
*/
|
||||
long ticksInNanos() {
|
||||
return System.nanoTime();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is visible for testing!
|
||||
*/
|
||||
Future<?> schedule(ChannelHandlerContext ctx, Runnable task, long delay, TimeUnit unit) {
|
||||
return ctx.executor().schedule(task, delay, unit);
|
||||
}
|
||||
|
||||
private void destroy() {
|
||||
state = 2;
|
||||
|
||||
if (readerIdleTimeout != null) {
|
||||
readerIdleTimeout.cancel(false);
|
||||
readerIdleTimeout = null;
|
||||
}
|
||||
if (writerIdleTimeout != null) {
|
||||
writerIdleTimeout.cancel(false);
|
||||
writerIdleTimeout = null;
|
||||
}
|
||||
if (allIdleTimeout != null) {
|
||||
allIdleTimeout.cancel(false);
|
||||
allIdleTimeout = null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Is called when an {@link IdleStateEvent} should be fired. This implementation calls
|
||||
* {@link ChannelHandlerContext#fireUserEventTriggered(Object)}.
|
||||
*/
|
||||
protected void channelIdle(ChannelHandlerContext ctx, IdleStateEvent evt) throws Exception {
|
||||
ctx.fireUserEventTriggered(evt);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a {@link IdleStateEvent}.
|
||||
*/
|
||||
protected IdleStateEvent newIdleStateEvent(IdleState state, boolean first) {
|
||||
switch (state) {
|
||||
case ALL_IDLE:
|
||||
return first ? IdleStateEvent.FIRST_ALL_IDLE_STATE_EVENT : IdleStateEvent.ALL_IDLE_STATE_EVENT;
|
||||
case READER_IDLE:
|
||||
return first ? IdleStateEvent.FIRST_READER_IDLE_STATE_EVENT : IdleStateEvent.READER_IDLE_STATE_EVENT;
|
||||
case WRITER_IDLE:
|
||||
return first ? IdleStateEvent.FIRST_WRITER_IDLE_STATE_EVENT : IdleStateEvent.WRITER_IDLE_STATE_EVENT;
|
||||
default:
|
||||
throw new IllegalArgumentException("Unhandled: state=" + state + ", first=" + first);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see #hasOutputChanged(ChannelHandlerContext, boolean)
|
||||
*/
|
||||
private void initOutputChanged(ChannelHandlerContext ctx) {
|
||||
if (observeOutput) {
|
||||
Channel channel = ctx.channel();
|
||||
Channel.Unsafe unsafe = channel.unsafe();
|
||||
ChannelOutboundBuffer buf = unsafe.outboundBuffer();
|
||||
|
||||
if (buf != null) {
|
||||
lastMessageHashCode = System.identityHashCode(buf.current());
|
||||
lastPendingWriteBytes = buf.totalPendingWriteBytes();
|
||||
lastFlushProgress = buf.currentProgress();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns {@code true} if and only if the {@link IdleStateHandler} was constructed
|
||||
* with {@link #observeOutput} enabled and there has been an observed change in the
|
||||
* {@link ChannelOutboundBuffer} between two consecutive calls of this method.
|
||||
* <p>
|
||||
* https://github.com/netty/netty/issues/6150
|
||||
*/
|
||||
private boolean hasOutputChanged(ChannelHandlerContext ctx, boolean first) {
|
||||
if (observeOutput) {
|
||||
|
||||
// We can take this shortcut if the ChannelPromises that got passed into write()
|
||||
// appear to complete. It indicates "change" on message level and we simply assume
|
||||
// that there's change happening on byte level. If the user doesn't observe channel
|
||||
// writability events then they'll eventually OOME and there's clearly a different
|
||||
// problem and idleness is least of their concerns.
|
||||
if (lastChangeCheckTimeStamp != lastWriteTime) {
|
||||
lastChangeCheckTimeStamp = lastWriteTime;
|
||||
|
||||
// But this applies only if it's the non-first call.
|
||||
if (!first) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Channel channel = ctx.channel();
|
||||
Channel.Unsafe unsafe = channel.unsafe();
|
||||
ChannelOutboundBuffer buf = unsafe.outboundBuffer();
|
||||
|
||||
if (buf != null) {
|
||||
int messageHashCode = System.identityHashCode(buf.current());
|
||||
long pendingWriteBytes = buf.totalPendingWriteBytes();
|
||||
|
||||
if (messageHashCode != lastMessageHashCode || pendingWriteBytes != lastPendingWriteBytes) {
|
||||
lastMessageHashCode = messageHashCode;
|
||||
lastPendingWriteBytes = pendingWriteBytes;
|
||||
|
||||
if (!first) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
long flushProgress = buf.currentProgress();
|
||||
if (flushProgress != lastFlushProgress) {
|
||||
lastFlushProgress = flushProgress;
|
||||
return !first;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private abstract static class AbstractIdleTask implements Runnable {
|
||||
|
||||
private final ChannelHandlerContext ctx;
|
||||
|
||||
AbstractIdleTask(ChannelHandlerContext ctx) {
|
||||
this.ctx = ctx;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (!ctx.channel().isOpen()) {
|
||||
return;
|
||||
}
|
||||
|
||||
run(ctx);
|
||||
}
|
||||
|
||||
protected abstract void run(ChannelHandlerContext ctx);
|
||||
}
|
||||
|
||||
private final class ReaderIdleTimeoutTask extends AbstractIdleTask {
|
||||
|
||||
ReaderIdleTimeoutTask(ChannelHandlerContext ctx) {
|
||||
super(ctx);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void run(ChannelHandlerContext ctx) {
|
||||
long nextDelay = readerIdleTimeNanos;
|
||||
if (!reading) {
|
||||
nextDelay -= ticksInNanos() - lastReadTime;
|
||||
}
|
||||
|
||||
if (nextDelay <= 0) {
|
||||
// Reader is idle - set a new timeout and notify the callback.
|
||||
readerIdleTimeout = schedule(ctx, this, readerIdleTimeNanos, TimeUnit.NANOSECONDS);
|
||||
|
||||
boolean first = firstReaderIdleEvent;
|
||||
firstReaderIdleEvent = false;
|
||||
|
||||
try {
|
||||
IdleStateEvent event = newIdleStateEvent(IdleState.READER_IDLE, first);
|
||||
channelIdle(ctx, event);
|
||||
} catch (Throwable t) {
|
||||
ctx.fireExceptionCaught(t);
|
||||
}
|
||||
} else {
|
||||
// Read occurred before the timeout - set a new timeout with shorter delay.
|
||||
readerIdleTimeout = schedule(ctx, this, nextDelay, TimeUnit.NANOSECONDS);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private final class WriterIdleTimeoutTask extends AbstractIdleTask {
|
||||
|
||||
WriterIdleTimeoutTask(ChannelHandlerContext ctx) {
|
||||
super(ctx);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void run(ChannelHandlerContext ctx) {
|
||||
|
||||
long lastWriteTime = LazyServerIdleStateHandler.this.lastWriteTime;
|
||||
long nextDelay = writerIdleTimeNanos - (ticksInNanos() - lastWriteTime);
|
||||
if (nextDelay <= 0) {
|
||||
// Writer is idle - set a new timeout and notify the callback.
|
||||
writerIdleTimeout = schedule(ctx, this, writerIdleTimeNanos, TimeUnit.NANOSECONDS);
|
||||
|
||||
boolean first = firstWriterIdleEvent;
|
||||
firstWriterIdleEvent = false;
|
||||
|
||||
try {
|
||||
if (hasOutputChanged(ctx, first)) {
|
||||
return;
|
||||
}
|
||||
|
||||
IdleStateEvent event = newIdleStateEvent(IdleState.WRITER_IDLE, first);
|
||||
channelIdle(ctx, event);
|
||||
} catch (Throwable t) {
|
||||
ctx.fireExceptionCaught(t);
|
||||
}
|
||||
} else {
|
||||
// Write occurred before the timeout - set a new timeout with shorter delay.
|
||||
writerIdleTimeout = schedule(ctx, this, nextDelay, TimeUnit.NANOSECONDS);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private final class AllIdleTimeoutTask extends AbstractIdleTask {
|
||||
|
||||
AllIdleTimeoutTask(ChannelHandlerContext ctx) {
|
||||
super(ctx);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void run(ChannelHandlerContext ctx) {
|
||||
|
||||
long nextDelay = allIdleTimeNanos;
|
||||
if (!reading) {
|
||||
nextDelay -= ticksInNanos() - Math.max(lastReadTime, lastWriteTime);
|
||||
}
|
||||
if (nextDelay <= 0) {
|
||||
// Both reader and writer are idle - set a new timeout and
|
||||
// notify the callback.
|
||||
allIdleTimeout = schedule(ctx, this, allIdleTimeNanos, TimeUnit.NANOSECONDS);
|
||||
|
||||
boolean first = firstAllIdleEvent;
|
||||
firstAllIdleEvent = false;
|
||||
|
||||
try {
|
||||
if (hasOutputChanged(ctx, first)) {
|
||||
return;
|
||||
}
|
||||
|
||||
IdleStateEvent event = newIdleStateEvent(IdleState.ALL_IDLE, first);
|
||||
channelIdle(ctx, event);
|
||||
} catch (Throwable t) {
|
||||
ctx.fireExceptionCaught(t);
|
||||
}
|
||||
} else {
|
||||
// Either read or write occurred before the timeout - set a new
|
||||
// timeout with shorter delay.
|
||||
allIdleTimeout = schedule(ctx, this, nextDelay, TimeUnit.NANOSECONDS);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,133 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.netty.handler;
|
||||
|
||||
import io.netty.channel.*;
|
||||
import io.netty.handler.timeout.IdleState;
|
||||
import io.netty.handler.timeout.IdleStateEvent;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.wu.framework.core.utils.ObjectUtils;
|
||||
import org.framework.smart.agent.network.heartbeat.common.MessageType;
|
||||
import org.framework.smart.agent.network.heartbeat.common.NettyCommunicationIdContext;
|
||||
import org.framework.smart.agent.network.heartbeat.common.NettyProxyMsg;
|
||||
import org.framework.smart.agent.network.heartbeat.common.NettyRealIdContext;
|
||||
import org.framework.smart.agent.network.heartbeat.common.adapter.ChannelTypeAdapter;
|
||||
import org.framework.smart.agent.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
|
||||
|
||||
/**
|
||||
* description 服务端数据处理器
|
||||
*
|
||||
* @author 吴佳伟
|
||||
* @date 2023/09/13 10:27
|
||||
*/
|
||||
@Slf4j
|
||||
public class NettyServerHandler extends SimpleChannelInboundHandler<NettyProxyMsg> {
|
||||
|
||||
private final ChannelTypeAdapter channelTypeAdapter;
|
||||
/**
|
||||
* 空闲次数
|
||||
*/
|
||||
private int idle_count = 1;
|
||||
|
||||
public NettyServerHandler(ChannelTypeAdapter channelTypeAdapter) {
|
||||
this.channelTypeAdapter = channelTypeAdapter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is called for each message of type {@link I}.
|
||||
*
|
||||
* @param ctx the {@link ChannelHandlerContext} which this {@link SimpleChannelInboundHandler}
|
||||
* belongs to
|
||||
* @param nettyMsg the message to handle
|
||||
* @throws Exception is thrown if an error occurred
|
||||
*/
|
||||
@Override
|
||||
protected void channelRead0(ChannelHandlerContext ctx, NettyProxyMsg nettyMsg) throws Exception {
|
||||
// 客户端读取到代理过来的数据了
|
||||
Channel channel = ctx.channel();
|
||||
byte type = nettyMsg.getType();
|
||||
// byte[] data = nettyMsg.getData();
|
||||
// log.info("客户端发送数据类型:{},发送数据:{}", type, new String(data));
|
||||
channelTypeAdapter.handler(channel, nettyMsg);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 超时处理 * 如果5秒没有接受客户端的心跳,就触发; * 如果超过两次,则直接关闭;
|
||||
*/
|
||||
@Override
|
||||
public void userEventTriggered(ChannelHandlerContext ctx, Object obj) throws Exception {
|
||||
Channel channel = ctx.channel();
|
||||
if (obj instanceof IdleStateEvent event) {
|
||||
if (IdleState.READER_IDLE.equals(event.state())) { //如果读通道处于空闲状态,说明没有接收到心跳命令
|
||||
String clientId = ChannelAttributeKeyUtils.getClientId(channel);
|
||||
String visitorId = ChannelAttributeKeyUtils.getVisitorId(channel);
|
||||
// 已经5秒没有接收到客户端:{}的信息了
|
||||
log.warn("I haven't received any information from client: {} for 5 seconds", clientId);
|
||||
if (idle_count > 2) {
|
||||
|
||||
if (ObjectUtils.isEmpty(visitorId)) {
|
||||
// 关闭这个不活跃的channel client:{}
|
||||
log.warn("Close this inactive channel client: {}", clientId);
|
||||
// 给所有客户端发送 这个客户端离线了
|
||||
NettyProxyMsg nettyMsg = new NettyProxyMsg();
|
||||
nettyMsg.setClientId(clientId);
|
||||
nettyMsg.setType(MessageType.REPORT_CLIENT_DISCONNECTION);
|
||||
channelTypeAdapter.handler(channel, nettyMsg);
|
||||
channel.close();
|
||||
} else {
|
||||
log.warn("Close visitor: [{}]'s connection", visitorId);
|
||||
NettyCommunicationIdContext.clear(visitorId);
|
||||
NettyRealIdContext.clear(visitorId);
|
||||
}
|
||||
|
||||
}
|
||||
idle_count++;
|
||||
}
|
||||
} else {
|
||||
super.userEventTriggered(ctx, obj);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Calls {@link ChannelHandlerContext#fireChannelInactive()} to forward
|
||||
* to the next {@link ChannelInboundHandler} in the {@link ChannelPipeline}.
|
||||
* <p>
|
||||
* Sub-classes may override this method to change behavior.
|
||||
*
|
||||
* @param ctx
|
||||
*/
|
||||
@Override
|
||||
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
|
||||
Channel channel = ctx.channel();
|
||||
boolean open = channel.isOpen();
|
||||
// 下发当前客户端通道断开连接
|
||||
|
||||
String clientId = ChannelAttributeKeyUtils.getClientId(channel);
|
||||
String visitorId = ChannelAttributeKeyUtils.getVisitorId(channel);
|
||||
|
||||
if (!ObjectUtils.isEmpty(visitorId)) {
|
||||
// 客户端:{},断开访客的连接:{}
|
||||
log.warn("Client: {}, disconnect guest: {}", clientId, visitorId);
|
||||
// 访客通道 关闭访客通道
|
||||
NettyCommunicationIdContext.clear(visitorId);
|
||||
super.channelInactive(ctx);
|
||||
} else if (!ObjectUtils.isEmpty(clientId)) {
|
||||
// 断开客户端的连接:{}
|
||||
log.warn("Disconnect client: {}", clientId);
|
||||
NettyProxyMsg nettyMsg = new NettyProxyMsg();
|
||||
nettyMsg.setType(MessageType.REPORT_CLIENT_DISCONNECTION);
|
||||
nettyMsg.setClientId(clientId);
|
||||
channelTypeAdapter.handler(channel, nettyMsg);
|
||||
super.channelInactive(ctx);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
|
||||
// super.exceptionCaught(ctx, cause);
|
||||
Channel channel = ctx.channel();
|
||||
//……
|
||||
if (channel.isActive()) ctx.close();
|
||||
}
|
||||
}
|
@ -0,0 +1,181 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.netty.handler;
|
||||
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.channel.Channel;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import io.netty.channel.ChannelOption;
|
||||
import io.netty.channel.SimpleChannelInboundHandler;
|
||||
import io.netty.util.internal.StringUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.framework.smart.agent.network.heartbeat.common.*;
|
||||
import org.framework.smart.agent.network.heartbeat.common.adapter.ChannelFlowAdapter;
|
||||
import org.framework.smart.agent.network.heartbeat.common.enums.ChannelFlowEnum;
|
||||
import org.framework.smart.agent.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
|
||||
import org.framework.smart.agent.network.heartbeat.server.netty.flow.ServerChannelFlow;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@Slf4j
|
||||
public class VisitorHandler extends SimpleChannelInboundHandler<ByteBuf> {
|
||||
private final InternalNetworkPenetrationRealClient internalNetworkPenetrationRealClient;
|
||||
private final ChannelFlowAdapter channelFlowAdapter;// 流量适配器
|
||||
|
||||
public VisitorHandler(InternalNetworkPenetrationRealClient internalNetworkPenetrationRealClient, ChannelFlowAdapter channelFlowAdapter) {
|
||||
this.internalNetworkPenetrationRealClient = internalNetworkPenetrationRealClient;
|
||||
this.channelFlowAdapter = channelFlowAdapter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void channelActive(ChannelHandlerContext ctx) throws Exception {
|
||||
// 访客连接上代理服务器了
|
||||
Channel visitorChannel = ctx.channel();
|
||||
// 先不读取访客数据
|
||||
visitorChannel.config().setOption(ChannelOption.AUTO_READ, false);
|
||||
|
||||
|
||||
// 生成访客ID
|
||||
String visitorId = UUID.randomUUID().toString();
|
||||
String clientId = internalNetworkPenetrationRealClient.getClientId();
|
||||
Integer visitorPort = internalNetworkPenetrationRealClient.getVisitorPort();
|
||||
String clientTargetIp = internalNetworkPenetrationRealClient.getClientTargetIp();
|
||||
Integer clientTargetPort = internalNetworkPenetrationRealClient.getClientTargetPort();
|
||||
// 绑定访客真实通道
|
||||
NettyRealIdContext.pushReal(visitorChannel, visitorId);
|
||||
// 当前通道绑定访客ID
|
||||
ChannelAttributeKeyUtils.buildVisitorId(visitorChannel, visitorId);
|
||||
ChannelAttributeKeyUtils.buildClientId(visitorChannel, clientId);
|
||||
NettyProxyMsg nettyProxyMsg = new NettyProxyMsg();
|
||||
nettyProxyMsg.setType(MessageType.DISTRIBUTE_SINGLE_CLIENT_REAL_CONNECT);
|
||||
nettyProxyMsg.setClientId(clientId);
|
||||
nettyProxyMsg.setVisitorPort(visitorPort);
|
||||
nettyProxyMsg.setClientTargetIp(clientTargetIp);
|
||||
nettyProxyMsg.setClientTargetPort(clientTargetPort);
|
||||
|
||||
nettyProxyMsg.setVisitorId(visitorId);
|
||||
|
||||
// 客户端心跳通道
|
||||
ChannelContext.ClientChannel clientChannel = ChannelContext.get(clientId);
|
||||
if (clientChannel != null) {
|
||||
log.info("通过客户端:{},获取通道而后创建连接", clientId);
|
||||
Channel channel = clientChannel.getChannel();
|
||||
channel.writeAndFlush(nettyProxyMsg);
|
||||
} else {
|
||||
log.error("无法通过客户端ID获取客户端通道");
|
||||
}
|
||||
|
||||
|
||||
// 等待访客ID传输到客户端后绑定客户端真实服务后开启
|
||||
|
||||
|
||||
log.info("服务端访客端口连接成功了");
|
||||
super.channelActive(ctx);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void channelRead0(ChannelHandlerContext ctx, ByteBuf buf) {
|
||||
|
||||
Channel realChannel = ctx.channel();
|
||||
String clientId = internalNetworkPenetrationRealClient.getClientId();
|
||||
String clientTargetIp = internalNetworkPenetrationRealClient.getClientTargetIp();
|
||||
Integer clientTargetPort = internalNetworkPenetrationRealClient.getClientTargetPort();
|
||||
Integer visitorPort = internalNetworkPenetrationRealClient.getVisitorPort();
|
||||
String visitorId = ChannelAttributeKeyUtils.getVisitorId(realChannel);
|
||||
if (StringUtil.isNullOrEmpty(clientId)) {
|
||||
return;
|
||||
}
|
||||
byte[] bytes = new byte[buf.readableBytes()];
|
||||
buf.readBytes(bytes);
|
||||
// 获取客户端通道,而后进行数据下发
|
||||
log.debug("服务端访客端口成功接收数据:{}", new String(bytes));
|
||||
|
||||
// 使用访客的通信通道
|
||||
Channel visitorCommunicationChannel = NettyCommunicationIdContext.getVisitor(visitorId);
|
||||
// 绑定数据流量
|
||||
ChannelAttributeKeyUtils.buildInFlow(visitorCommunicationChannel, bytes.length);
|
||||
NettyProxyMsg nettyProxyMsg = new NettyProxyMsg();
|
||||
nettyProxyMsg.setType(MessageType.DISTRIBUTE_CLIENT_TRANSFER);
|
||||
nettyProxyMsg.setClientId(clientId);
|
||||
nettyProxyMsg.setClientTargetIp(clientTargetIp);
|
||||
nettyProxyMsg.setClientTargetPort(clientTargetPort);
|
||||
nettyProxyMsg.setVisitorPort(visitorPort);
|
||||
nettyProxyMsg.setVisitorId(visitorId);
|
||||
nettyProxyMsg.setData(bytes);
|
||||
visitorCommunicationChannel.writeAndFlush(nettyProxyMsg);
|
||||
// 处理访客流量
|
||||
ServerChannelFlow serverChannelFlow = ServerChannelFlow
|
||||
.builder()
|
||||
.channelFlowEnum(ChannelFlowEnum.IN_FLOW)
|
||||
.port(visitorPort)
|
||||
.clientId(clientId)
|
||||
.flow(bytes.length)
|
||||
.build();
|
||||
channelFlowAdapter.handler(realChannel, serverChannelFlow);
|
||||
log.debug("服务端访客端口成功发送数据了");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
|
||||
String visitorId = ChannelAttributeKeyUtils.getVisitorId(ctx.channel());
|
||||
String clientId = ChannelAttributeKeyUtils.getClientId(ctx.channel());
|
||||
if (StringUtil.isNullOrEmpty(visitorId)) {
|
||||
super.channelInactive(ctx);
|
||||
return;
|
||||
}
|
||||
// 通信通道自动读写打开 ,然后关闭通信通道
|
||||
Channel visitorChannel = NettyCommunicationIdContext.getVisitor(visitorId);
|
||||
if (visitorChannel != null && visitorChannel.isActive()) {
|
||||
|
||||
visitorChannel.config().setOption(ChannelOption.AUTO_READ, true);
|
||||
|
||||
// 通知服务端 关闭访问通道、真实通道
|
||||
NettyProxyMsg myMsg = new NettyProxyMsg();
|
||||
myMsg.setType(MessageType.DISTRIBUTE_SINGLE_CLIENT_REAL_CLOSE_VISITOR);
|
||||
myMsg.setVisitorId(visitorId);
|
||||
visitorChannel.writeAndFlush(myMsg);
|
||||
}
|
||||
// 关闭 访客通信通道、访客真实通道
|
||||
NettyRealIdContext.clear(visitorId);
|
||||
NettyCommunicationIdContext.clear(visitorId);
|
||||
log.warn("服务端访客端口断开连接");
|
||||
super.channelInactive(ctx);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void channelWritabilityChanged(ChannelHandlerContext ctx) throws Exception {
|
||||
|
||||
// Channel visitorChannel = ctx.channel();
|
||||
// String vid = visitorChannel.attr(Constant.VID).get();
|
||||
// if (StringUtil.isNullOrEmpty(vid)) {
|
||||
// super.channelWritabilityChanged(ctx);
|
||||
// return;
|
||||
// }
|
||||
// Channel clientChannel = Constant.vcc.get(vid);
|
||||
// if (clientChannel != null) {
|
||||
// clientChannel.config().setOption(ChannelOption.AUTO_READ, visitorChannel.isWritable());
|
||||
// }
|
||||
log.info("channelWritabilityChanged");
|
||||
super.channelWritabilityChanged(ctx);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
|
||||
log.error("exceptionCaught");
|
||||
|
||||
Channel channel = ctx.channel();
|
||||
String clientId = ChannelAttributeKeyUtils.getClientId(channel);
|
||||
String visitorId = ChannelAttributeKeyUtils.getVisitorId(channel);
|
||||
// 使用通信通道 下发关闭访客
|
||||
Channel visitorChannel = NettyCommunicationIdContext.getVisitor(visitorId);
|
||||
if (visitorChannel != null) {
|
||||
// 下发关闭访客
|
||||
NettyProxyMsg closeRealClient = new NettyProxyMsg();
|
||||
closeRealClient.setType(MessageType.DISTRIBUTE_SINGLE_CLIENT_REAL_CONNECT_AUTO_READ);
|
||||
closeRealClient.setClientId(clientId);
|
||||
closeRealClient.setVisitorId(visitorId);
|
||||
visitorChannel.writeAndFlush(closeRealClient);
|
||||
}
|
||||
|
||||
ctx.close();
|
||||
}
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.netty.socket;
|
||||
|
||||
|
||||
import io.netty.bootstrap.ServerBootstrap;
|
||||
import io.netty.channel.ChannelFuture;
|
||||
import io.netty.channel.ChannelFutureListener;
|
||||
import io.netty.channel.ChannelOption;
|
||||
import io.netty.channel.EventLoopGroup;
|
||||
import io.netty.channel.nio.NioEventLoopGroup;
|
||||
import io.netty.channel.socket.nio.NioServerSocketChannel;
|
||||
import org.framework.smart.agent.network.heartbeat.server.netty.filter.NettyServerFilter;
|
||||
|
||||
public class NettyOnCloudNettyServerSocket {
|
||||
private final EventLoopGroup bossGroup = new NioEventLoopGroup();
|
||||
private final EventLoopGroup workerGroup = new NioEventLoopGroup();
|
||||
private final NettyServerFilter nettyServerFilter;// 通道业务处理
|
||||
private ChannelFuture channelFuture;
|
||||
|
||||
public NettyOnCloudNettyServerSocket(NettyServerFilter nettyServerFilter) {
|
||||
this.nettyServerFilter = nettyServerFilter;
|
||||
}
|
||||
|
||||
/**
|
||||
* 启动服务端
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public void startServer(int serverPort) throws Exception {
|
||||
try {
|
||||
|
||||
ServerBootstrap b = new ServerBootstrap();
|
||||
b.group(bossGroup, workerGroup).channel(NioServerSocketChannel.class)
|
||||
// 给服务端channel设置属性
|
||||
.option(ChannelOption.SO_BACKLOG, 128)
|
||||
|
||||
.childOption(ChannelOption.SO_KEEPALIVE, true)
|
||||
.childHandler(nettyServerFilter);
|
||||
channelFuture = b.bind(serverPort).sync();
|
||||
|
||||
channelFuture.addListener((ChannelFutureListener) channelFuture -> {
|
||||
// 服务器已启动
|
||||
});
|
||||
channelFuture.channel().closeFuture().sync();
|
||||
} finally {
|
||||
shutdown();
|
||||
// 服务器已关闭
|
||||
}
|
||||
}
|
||||
|
||||
public void shutdown() {
|
||||
if (channelFuture != null) {
|
||||
channelFuture.channel().close().syncUninterruptibly();
|
||||
}
|
||||
if ((bossGroup != null) && (!bossGroup.isShutdown())) {
|
||||
bossGroup.shutdownGracefully();
|
||||
}
|
||||
if ((workerGroup != null) && (!workerGroup.isShutdown())) {
|
||||
workerGroup.shutdownGracefully();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,225 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.netty.socket;
|
||||
|
||||
import io.netty.bootstrap.ServerBootstrap;
|
||||
import io.netty.channel.*;
|
||||
import io.netty.channel.nio.NioEventLoopGroup;
|
||||
import io.netty.channel.socket.nio.NioServerSocketChannel;
|
||||
import lombok.Getter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.framework.smart.agent.network.heartbeat.common.InternalNetworkPenetrationRealClient;
|
||||
import org.framework.smart.agent.network.heartbeat.common.NettyClientVisitorContext;
|
||||
import org.framework.smart.agent.network.heartbeat.common.NettyVisitorPortContext;
|
||||
import org.framework.smart.agent.network.heartbeat.common.adapter.ChannelFlowAdapter;
|
||||
import org.framework.smart.agent.network.heartbeat.server.netty.filter.VisitorFilter;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* 访客链接socket
|
||||
*
|
||||
* @see NettyVisitorPortContext
|
||||
* @see NettyClientVisitorContext
|
||||
*/
|
||||
@Slf4j
|
||||
public class NettyVisitorSocket {
|
||||
private final EventLoopGroup bossGroup = new NioEventLoopGroup();
|
||||
private final EventLoopGroup workerGroup = new NioEventLoopGroup();
|
||||
private final VisitorFilter visitorFilter;
|
||||
@Getter
|
||||
private final String clientId;
|
||||
@Getter
|
||||
private final int visitorPort;
|
||||
|
||||
public NettyVisitorSocket(VisitorFilter visitorFilter, String clientId, int visitorPort) {
|
||||
this.visitorFilter = visitorFilter;
|
||||
this.clientId = clientId;
|
||||
this.visitorPort = visitorPort;
|
||||
}
|
||||
|
||||
/**
|
||||
* 启动服务代理
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public void startServer() throws Exception {
|
||||
|
||||
Channel visitor = NettyVisitorPortContext.getVisitor(visitorPort);
|
||||
if (visitor == null) {
|
||||
ServerBootstrap b = new ServerBootstrap();
|
||||
b
|
||||
.group(bossGroup, workerGroup)
|
||||
.childOption(ChannelOption.SO_KEEPALIVE, true)
|
||||
.channel(NioServerSocketChannel.class)
|
||||
.childHandler(visitorFilter);
|
||||
ChannelFuture sync = b.bind(visitorPort).sync();
|
||||
sync.addListener((ChannelFutureListener) future -> {
|
||||
if (future.isSuccess()) {
|
||||
// 这里时异步处理
|
||||
log.info("客户端:[{}]访客端口:[{}] 开启", clientId, visitorPort);
|
||||
NettyVisitorPortContext.pushVisitor(visitorPort, future.channel());
|
||||
|
||||
} else {
|
||||
log.error("客户端:[{}]访客端口:[{}]绑定失败", clientId, visitorPort);
|
||||
}
|
||||
});
|
||||
NettyClientVisitorContext.pushVisitorSocket(clientId, this);
|
||||
} else {
|
||||
log.warn("客户端:[{}]访客端口:[{}] 重复启动", clientId, visitorPort);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void close() throws IOException, InterruptedException {
|
||||
if (!bossGroup.isShutdown()) {
|
||||
bossGroup.shutdownGracefully();
|
||||
}
|
||||
if (!workerGroup.isShutdown()) {
|
||||
workerGroup.shutdownGracefully();
|
||||
}
|
||||
Channel visitor = NettyVisitorPortContext.getVisitor(visitorPort);
|
||||
if (visitor != null) {
|
||||
|
||||
// close channel
|
||||
visitor.close();
|
||||
// remove visitor
|
||||
NettyVisitorPortContext.removeVisitor(visitorPort);
|
||||
// remove client this
|
||||
NettyClientVisitorContext.removeVisitorSocket(clientId,this);
|
||||
log.warn("关闭客户端 :【{}】 访客户端口:【{}】", clientId, visitorPort);
|
||||
} else {
|
||||
log.warn("关闭访客端口失败 未找到客户端通道 客户端 :【{}】 访客户端口:【{}】", clientId, visitorPort);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static final class NettyVisitorSocketBuilder {
|
||||
|
||||
/**
|
||||
* 客户端ID
|
||||
*/
|
||||
private String clientId;
|
||||
|
||||
/**
|
||||
* 客户端目标地址
|
||||
*/
|
||||
private String clientTargetIp;
|
||||
|
||||
/**
|
||||
* 客户端目标端口
|
||||
*/
|
||||
private Integer clientTargetPort;
|
||||
|
||||
|
||||
/**
|
||||
* 访问端口
|
||||
*/
|
||||
private Integer visitorPort;
|
||||
/**
|
||||
* 访客ID
|
||||
*/
|
||||
private String visitorId;
|
||||
|
||||
/**
|
||||
* 流量适配器
|
||||
*/
|
||||
private ChannelFlowAdapter channelFlowAdapter;
|
||||
|
||||
public static NettyVisitorSocketBuilder builder() {
|
||||
return new NettyVisitorSocketBuilder();
|
||||
}
|
||||
|
||||
/**
|
||||
* 填充客户端
|
||||
*
|
||||
* @param clientId 客户端
|
||||
* @return 返回当前对象
|
||||
*/
|
||||
public NettyVisitorSocketBuilder builderClientId(String clientId) {
|
||||
this.clientId = clientId;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 绑定客户端目标IP
|
||||
*
|
||||
* @param clientTargetIp 客户端目标IP
|
||||
* @return 当前对象
|
||||
*/
|
||||
public NettyVisitorSocketBuilder builderClientTargetIp(String clientTargetIp) {
|
||||
this.clientTargetIp = clientTargetIp;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 绑定客户端目标端口
|
||||
*
|
||||
* @param clientTargetPort 客户端目标端口
|
||||
* @return 当前对象
|
||||
*/
|
||||
public NettyVisitorSocketBuilder builderClientTargetPort(Integer clientTargetPort) {
|
||||
this.clientTargetPort = clientTargetPort;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 绑定访客端口
|
||||
*
|
||||
* @param visitorPort 访客端口
|
||||
* @return 当前对象
|
||||
*/
|
||||
public NettyVisitorSocketBuilder builderVisitorPort(Integer visitorPort) {
|
||||
this.visitorPort = visitorPort;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 绑定流量适配器
|
||||
*
|
||||
* @param channelFlowAdapter 流量适配器
|
||||
* @return 当前对象
|
||||
*/
|
||||
public NettyVisitorSocketBuilder builderChannelFlowAdapter(ChannelFlowAdapter channelFlowAdapter) {
|
||||
this.channelFlowAdapter = channelFlowAdapter;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 绑定访客ID
|
||||
*
|
||||
* @param visitorId 访客ID
|
||||
* @return 当前对象
|
||||
*/
|
||||
public NettyVisitorSocketBuilder builderVisitorId(String visitorId) {
|
||||
this.visitorId = visitorId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public NettyVisitorSocket build() {
|
||||
if (clientId == null) {
|
||||
throw new IllegalArgumentException("clientId must not null");
|
||||
}
|
||||
if (clientTargetIp == null) {
|
||||
throw new IllegalArgumentException("clientTargetIp must not null");
|
||||
}
|
||||
if (clientTargetPort == null) {
|
||||
throw new IllegalArgumentException("clientTargetPort must not null");
|
||||
}
|
||||
if (visitorPort == null) {
|
||||
throw new IllegalArgumentException("visitorPort must not null");
|
||||
}
|
||||
InternalNetworkPenetrationRealClient internalNetworkPenetrationRealClient = InternalNetworkPenetrationRealClient
|
||||
.builder()
|
||||
.clientId(clientId)
|
||||
.clientTargetIp(clientTargetIp)
|
||||
.clientTargetPort(clientTargetPort)
|
||||
.visitorPort(visitorPort)
|
||||
.visitorId(visitorId).build();
|
||||
|
||||
VisitorFilter visitorFilter = new VisitorFilter(internalNetworkPenetrationRealClient, channelFlowAdapter);
|
||||
return new NettyVisitorSocket(visitorFilter, clientId, visitorPort);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.properties;
|
||||
|
||||
import lombok.Data;
|
||||
import org.framework.smart.agent.network.heartbeat.common.enums.NetWorkMode;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* 服务端模式配置
|
||||
*/
|
||||
@Configuration
|
||||
@ConfigurationProperties(prefix = ServerNodeProperties.prefix)
|
||||
@Data
|
||||
public class ServerNodeProperties {
|
||||
public static final String prefix = "spring.lazy.netty.server";
|
||||
|
||||
/**
|
||||
* 模式 默认单机版
|
||||
*/
|
||||
private NetWorkMode mode = NetWorkMode.STANDALONE;
|
||||
|
||||
/**
|
||||
*
|
||||
* 集群节点host
|
||||
*/
|
||||
private String nodeHost;
|
||||
|
||||
/**
|
||||
*
|
||||
* 集群节点ID
|
||||
*/
|
||||
private String nodeId;
|
||||
|
||||
/**
|
||||
*
|
||||
* 集群节点端口
|
||||
*/
|
||||
private Integer nodePort;
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.standalone.application;
|
||||
|
||||
/**
|
||||
* 云下心跳客户端操作 nacos 配置
|
||||
*/
|
||||
public interface LazyClientStatsChangeApplication {
|
||||
|
||||
|
||||
/**
|
||||
* 客户端在线
|
||||
*
|
||||
* @param clientId 客户端ID
|
||||
*/
|
||||
void clientOnLine(String clientId);
|
||||
|
||||
/**
|
||||
* 客户端离线
|
||||
*
|
||||
* @param clientId 客户端ID
|
||||
*/
|
||||
void clientOffLine(String clientId);
|
||||
|
||||
/**
|
||||
* 客户端暂存关闭
|
||||
*
|
||||
* @param clientId 客户端ID
|
||||
*/
|
||||
void stagingClosed(String clientId);
|
||||
|
||||
|
||||
/**
|
||||
* 客户端暂存开启
|
||||
*
|
||||
* @param clientId 客户端ID
|
||||
*/
|
||||
void stagingOpened(String clientId);
|
||||
|
||||
}
|
@ -0,0 +1,107 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.standalone.application;
|
||||
|
||||
|
||||
import org.framework.smart.agent.network.heartbeat.server.standalone.application.command.internal.network.penetration.mapping.*;
|
||||
import org.framework.smart.agent.network.heartbeat.server.standalone.application.dto.LazyInternalNetworkPenetrationMappingDTO;
|
||||
import org.wu.framework.lazy.orm.database.lambda.domain.LazyPage;
|
||||
import org.wu.framework.web.response.Result;
|
||||
import org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyApplication;
|
||||
import org.framework.smart.agent.network.heartbeat.server.standalone.domain.model.internal.network.penetration.mapping.LazyInternalNetworkPenetrationMapping;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* describe 内网穿透映射
|
||||
*
|
||||
* @author Jia wei Wu
|
||||
* @date 2023/12/29 05:21 下午
|
||||
* @see DefaultDDDLazyApplication
|
||||
**/
|
||||
|
||||
public interface LazyInternalNetworkPenetrationMappingApplication {
|
||||
|
||||
|
||||
/**
|
||||
* describe 新增内网穿透映射
|
||||
*
|
||||
* @param lazyInternalNetworkPenetrationMappingStoryCommand 新增内网穿透映射
|
||||
* @return {@link Result< LazyInternalNetworkPenetrationMapping >} 内网穿透映射新增后领域对象
|
||||
* @author Jia wei Wu
|
||||
* @date 2023/12/29 05:21 下午
|
||||
**/
|
||||
|
||||
Result<LazyInternalNetworkPenetrationMapping> story(LazyInternalNetworkPenetrationMappingStoryCommand lazyInternalNetworkPenetrationMappingStoryCommand) ;
|
||||
|
||||
/**
|
||||
* describe 批量新增内网穿透映射
|
||||
*
|
||||
* @param lazyInternalNetworkPenetrationMappingStoryCommandList 批量新增内网穿透映射
|
||||
* @return {@link Result<List< LazyInternalNetworkPenetrationMapping >>} 内网穿透映射新增后领域对象集合
|
||||
* @author Jia wei Wu
|
||||
* @date 2023/12/29 05:21 下午
|
||||
**/
|
||||
|
||||
Result<List<LazyInternalNetworkPenetrationMapping>> batchStory(List<LazyInternalNetworkPenetrationMappingStoryCommand> lazyInternalNetworkPenetrationMappingStoryCommandList);
|
||||
|
||||
/**
|
||||
* describe 更新内网穿透映射
|
||||
*
|
||||
* @param lazyInternalNetworkPenetrationMappingUpdateCommand 更新内网穿透映射
|
||||
* @return {@link Result< LazyInternalNetworkPenetrationMapping >} 内网穿透映射领域对象
|
||||
* @author Jia wei Wu
|
||||
* @date 2023/12/29 05:21 下午
|
||||
**/
|
||||
|
||||
Result<LazyInternalNetworkPenetrationMapping> updateOne(LazyInternalNetworkPenetrationMappingUpdateCommand lazyInternalNetworkPenetrationMappingUpdateCommand) ;
|
||||
|
||||
/**
|
||||
* describe 查询单个内网穿透映射
|
||||
*
|
||||
* @param lazyInternalNetworkPenetrationMappingQueryOneCommand 查询单个内网穿透映射
|
||||
* @return {@link Result< LazyInternalNetworkPenetrationMappingDTO >} 内网穿透映射DTO对象
|
||||
* @author Jia wei Wu
|
||||
* @date 2023/12/29 05:21 下午
|
||||
**/
|
||||
|
||||
Result<LazyInternalNetworkPenetrationMappingDTO> findOne(LazyInternalNetworkPenetrationMappingQueryOneCommand lazyInternalNetworkPenetrationMappingQueryOneCommand);
|
||||
|
||||
/**
|
||||
* describe 查询多个内网穿透映射
|
||||
*
|
||||
* @param lazyInternalNetworkPenetrationMappingQueryListCommand 查询多个内网穿透映射
|
||||
* @return {@link Result <List<LazyInternalNetworkPenetrationMappingDTO>>} 内网穿透映射DTO对象
|
||||
* @author Jia wei Wu
|
||||
* @date 2023/12/29 05:21 下午
|
||||
**/
|
||||
|
||||
Result<List<LazyInternalNetworkPenetrationMappingDTO>> findList(LazyInternalNetworkPenetrationMappingQueryListCommand lazyInternalNetworkPenetrationMappingQueryListCommand);
|
||||
|
||||
/**
|
||||
* describe 分页查询多个内网穿透映射
|
||||
*
|
||||
* @param lazyInternalNetworkPenetrationMappingQueryListCommand 分页查询多个内网穿透映射
|
||||
* @return {@link Result <LazyPage<LazyInternalNetworkPenetrationMappingDTO>>} 分页内网穿透映射DTO对象
|
||||
* @author Jia wei Wu
|
||||
* @date 2023/12/29 05:21 下午
|
||||
**/
|
||||
|
||||
Result<LazyPage<LazyInternalNetworkPenetrationMappingDTO>> findPage(int size, int current, LazyInternalNetworkPenetrationMappingQueryListCommand lazyInternalNetworkPenetrationMappingQueryListCommand);
|
||||
|
||||
/**
|
||||
* describe 删除内网穿透映射
|
||||
*
|
||||
* @param lazyInternalNetworkPenetrationMappingRemoveCommand 删除内网穿透映射
|
||||
* @return {@link Result< LazyInternalNetworkPenetrationMapping >} 内网穿透映射
|
||||
* @author Jia wei Wu
|
||||
* @date 2023/12/29 05:21 下午
|
||||
**/
|
||||
|
||||
Result<LazyInternalNetworkPenetrationMapping> remove(LazyInternalNetworkPenetrationMappingRemoveCommand lazyInternalNetworkPenetrationMappingRemoveCommand);
|
||||
|
||||
/**
|
||||
* 创建客户端的访问者
|
||||
*
|
||||
* @param clientId 客户端ID
|
||||
*/
|
||||
Result<Void> createVisitor(String clientId);
|
||||
}
|
@ -0,0 +1,110 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.standalone.application;
|
||||
|
||||
import org.framework.smart.agent.network.heartbeat.server.standalone.application.dto.LazyNettyClientBlacklistDTO;
|
||||
import org.framework.smart.agent.network.heartbeat.server.standalone.application.command.netty.client.blacklist.*;
|
||||
import org.wu.framework.lazy.orm.database.lambda.domain.LazyPage;
|
||||
import org.wu.framework.web.response.Result;
|
||||
import org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyApplication;
|
||||
import org.framework.smart.agent.network.heartbeat.server.standalone.domain.model.netty.client.blacklist.LazyNettyClientBlacklist;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* describe 客户端黑名单
|
||||
*
|
||||
* @author Jia wei Wu
|
||||
* @date 2023/12/27 03:46 下午
|
||||
* @see DefaultDDDLazyApplication
|
||||
**/
|
||||
|
||||
public interface LazyNettyClientBlacklistApplication {
|
||||
|
||||
|
||||
/**
|
||||
* describe 新增客户端黑名单
|
||||
*
|
||||
* @param lazyNettyClientBlacklistStoryCommand 新增客户端黑名单
|
||||
* @return {@link Result< LazyNettyClientBlacklist >} 客户端黑名单新增后领域对象
|
||||
* @author Jia wei Wu
|
||||
* @date 2023/12/27 03:46 下午
|
||||
**/
|
||||
|
||||
Result<LazyNettyClientBlacklist> story(LazyNettyClientBlacklistStoryCommand lazyNettyClientBlacklistStoryCommand);
|
||||
|
||||
/**
|
||||
* describe 批量新增客户端黑名单
|
||||
*
|
||||
* @param lazyNettyClientBlacklistStoryCommandList 批量新增客户端黑名单
|
||||
* @return {@link Result<List< LazyNettyClientBlacklist >>} 客户端黑名单新增后领域对象集合
|
||||
* @author Jia wei Wu
|
||||
* @date 2023/12/27 03:46 下午
|
||||
**/
|
||||
|
||||
Result<List<LazyNettyClientBlacklist>> batchStory(List<LazyNettyClientBlacklistStoryCommand> lazyNettyClientBlacklistStoryCommandList);
|
||||
|
||||
/**
|
||||
* describe 更新客户端黑名单
|
||||
*
|
||||
* @param lazyNettyClientBlacklistUpdateCommand 更新客户端黑名单
|
||||
* @return {@link Result< LazyNettyClientBlacklist >} 客户端黑名单领域对象
|
||||
* @author Jia wei Wu
|
||||
* @date 2023/12/27 03:46 下午
|
||||
**/
|
||||
|
||||
Result<LazyNettyClientBlacklist> updateOne(LazyNettyClientBlacklistUpdateCommand lazyNettyClientBlacklistUpdateCommand);
|
||||
|
||||
/**
|
||||
* describe 查询单个客户端黑名单
|
||||
*
|
||||
* @param lazyNettyClientBlacklistQueryOneCommand 查询单个客户端黑名单
|
||||
* @return {@link Result< LazyNettyClientBlacklistDTO >} 客户端黑名单DTO对象
|
||||
* @author Jia wei Wu
|
||||
* @date 2023/12/27 03:46 下午
|
||||
**/
|
||||
|
||||
Result<LazyNettyClientBlacklistDTO> findOne(LazyNettyClientBlacklistQueryOneCommand lazyNettyClientBlacklistQueryOneCommand);
|
||||
|
||||
/**
|
||||
* describe 查询多个客户端黑名单
|
||||
*
|
||||
* @param lazyNettyClientBlacklistQueryListCommand 查询多个客户端黑名单
|
||||
* @return {@link Result <List<LazyNettyClientBlacklistDTO>>} 客户端黑名单DTO对象
|
||||
* @author Jia wei Wu
|
||||
* @date 2023/12/27 03:46 下午
|
||||
**/
|
||||
|
||||
Result<List<LazyNettyClientBlacklistDTO>> findList(LazyNettyClientBlacklistQueryListCommand lazyNettyClientBlacklistQueryListCommand);
|
||||
|
||||
/**
|
||||
* describe 分页查询多个客户端黑名单
|
||||
*
|
||||
* @param lazyNettyClientBlacklistQueryListCommand 分页查询多个客户端黑名单
|
||||
* @return {@link Result <LazyPage<LazyNettyClientBlacklistDTO>>} 分页客户端黑名单DTO对象
|
||||
* @author Jia wei Wu
|
||||
* @date 2023/12/27 03:46 下午
|
||||
**/
|
||||
|
||||
Result<LazyPage<LazyNettyClientBlacklistDTO>> findPage(int size, int current, LazyNettyClientBlacklistQueryListCommand lazyNettyClientBlacklistQueryListCommand);
|
||||
|
||||
/**
|
||||
* describe 删除客户端黑名单
|
||||
*
|
||||
* @param lazyNettyClientBlacklistRemoveCommand 删除客户端黑名单
|
||||
* @return {@link Result< LazyNettyClientBlacklist >} 客户端黑名单
|
||||
* @author Jia wei Wu
|
||||
* @date 2023/12/27 03:46 下午
|
||||
**/
|
||||
|
||||
Result<LazyNettyClientBlacklist> remove(LazyNettyClientBlacklistRemoveCommand lazyNettyClientBlacklistRemoveCommand);
|
||||
|
||||
/**
|
||||
* describe 是否存在客户端黑名单
|
||||
*
|
||||
* @param lazyNettyClientBlacklist 是否存在客户端黑名单
|
||||
* @return {@link Result<Boolean>} 客户端黑名单是否存在
|
||||
* @author Jia wei Wu
|
||||
* @date 2023/12/27 03:46 下午
|
||||
**/
|
||||
|
||||
Result<Boolean> exists(LazyNettyClientBlacklist lazyNettyClientBlacklist);
|
||||
}
|
@ -0,0 +1,109 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.standalone.application;
|
||||
|
||||
|
||||
import org.framework.smart.agent.network.heartbeat.server.standalone.application.dto.LazyNettyClientStateDTO;
|
||||
import org.framework.smart.agent.network.heartbeat.server.standalone.application.command.netty.client.state.*;
|
||||
import org.framework.smart.agent.network.heartbeat.server.standalone.domain.model.netty.client.state.LazyNettyClientState;
|
||||
import org.wu.framework.lazy.orm.database.lambda.domain.LazyPage;
|
||||
import org.wu.framework.web.response.Result;
|
||||
import org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyApplication;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* describe 客户端状态
|
||||
*
|
||||
* @author Jia wei Wu
|
||||
* @date 2023/12/27 03:46 下午
|
||||
* @see DefaultDDDLazyApplication
|
||||
**/
|
||||
|
||||
public interface LazyNettyClientStateApplication {
|
||||
|
||||
|
||||
/**
|
||||
* describe 新增客户端状态
|
||||
*
|
||||
* @param lazyNettyClientStateStoryCommand 新增客户端状态
|
||||
* @return {@link Result< LazyNettyClientState >} 客户端状态新增后领域对象
|
||||
* @author Jia wei Wu
|
||||
* @date 2023/12/27 03:46 下午
|
||||
**/
|
||||
|
||||
Result<LazyNettyClientState> story(LazyNettyClientStateStoryCommand lazyNettyClientStateStoryCommand);
|
||||
|
||||
/**
|
||||
* describe 批量新增客户端状态
|
||||
*
|
||||
* @param lazyNettyClientStateStoryCommandList 批量新增客户端状态
|
||||
* @return {@link Result<List< LazyNettyClientState >>} 客户端状态新增后领域对象集合
|
||||
* @author Jia wei Wu
|
||||
* @date 2023/12/27 03:46 下午
|
||||
**/
|
||||
|
||||
Result<List<LazyNettyClientState>> batchStory(List<LazyNettyClientStateStoryCommand> lazyNettyClientStateStoryCommandList);
|
||||
|
||||
/**
|
||||
* describe 更新客户端状态
|
||||
*
|
||||
* @param lazyNettyClientStateUpdateCommand 更新客户端状态
|
||||
* @return {@link Result< LazyNettyClientState >} 客户端状态领域对象
|
||||
* @author Jia wei Wu
|
||||
* @date 2023/12/27 03:46 下午
|
||||
**/
|
||||
|
||||
Result<LazyNettyClientState> updateOne(LazyNettyClientStateUpdateCommand lazyNettyClientStateUpdateCommand);
|
||||
|
||||
/**
|
||||
* describe 查询单个客户端状态
|
||||
*
|
||||
* @param lazyNettyClientStateQueryOneCommand 查询单个客户端状态
|
||||
* @return {@link Result< LazyNettyClientStateDTO >} 客户端状态DTO对象
|
||||
* @author Jia wei Wu
|
||||
* @date 2023/12/27 03:46 下午
|
||||
**/
|
||||
|
||||
Result<LazyNettyClientStateDTO> findOne(LazyNettyClientStateQueryOneCommand lazyNettyClientStateQueryOneCommand);
|
||||
|
||||
/**
|
||||
* describe 查询多个客户端状态
|
||||
*
|
||||
* @param lazyNettyClientStateQueryListCommand 查询多个客户端状态
|
||||
* @return {@link Result <List<LazyNettyClientStateDTO>>} 客户端状态DTO对象
|
||||
* @author Jia wei Wu
|
||||
* @date 2023/12/27 03:46 下午
|
||||
**/
|
||||
|
||||
Result<List<LazyNettyClientStateDTO>> findList(LazyNettyClientStateQueryListCommand lazyNettyClientStateQueryListCommand);
|
||||
|
||||
/**
|
||||
* describe 分页查询多个客户端状态
|
||||
*
|
||||
* @param lazyNettyClientStateQueryListCommand 分页查询多个客户端状态
|
||||
* @return {@link Result <LazyPage<LazyNettyClientStateDTO>>} 分页客户端状态DTO对象
|
||||
* @author Jia wei Wu
|
||||
* @date 2023/12/27 03:46 下午
|
||||
**/
|
||||
|
||||
Result<LazyPage<LazyNettyClientStateDTO>> findPage(int size, int current, LazyNettyClientStateQueryListCommand lazyNettyClientStateQueryListCommand);
|
||||
|
||||
/**
|
||||
* describe 删除客户端状态
|
||||
*
|
||||
* @param lazyNettyClientStateRemoveCommand 删除客户端状态
|
||||
* @return {@link Result< LazyNettyClientState >} 客户端状态
|
||||
* @author Jia wei Wu
|
||||
* @date 2023/12/27 03:46 下午
|
||||
**/
|
||||
|
||||
Result<LazyNettyClientState> remove(LazyNettyClientStateRemoveCommand lazyNettyClientStateRemoveCommand);
|
||||
|
||||
/**
|
||||
* 通过客户端心跳通道发送客户端请求
|
||||
*
|
||||
* @param lazyNettyClientMessageCommand 发送请求到客户端
|
||||
* @return {@link Result<Void>}
|
||||
*/
|
||||
Result<Void> sendMessage2HeartbeatClient(LazyNettyClientMessageCommand lazyNettyClientMessageCommand);
|
||||
}
|
@ -0,0 +1,101 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.standalone.application;
|
||||
|
||||
import org.framework.smart.agent.network.heartbeat.server.standalone.application.command.netty.server.visitor.*;
|
||||
import org.framework.smart.agent.network.heartbeat.server.standalone.application.dto.LazyNettyServerVisitorDTO;
|
||||
import org.wu.framework.lazy.orm.database.lambda.domain.LazyPage;
|
||||
import org.wu.framework.web.response.Result;
|
||||
import org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyApplication;
|
||||
|
||||
import org.framework.smart.agent.network.heartbeat.server.standalone.domain.model.netty.server.visitor.LazyNettyServerVisitor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* describe 服务端提前开放出来的端口
|
||||
*
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/01/16 02:21 下午
|
||||
* @see DefaultDDDLazyApplication
|
||||
**/
|
||||
|
||||
public interface LazyNettyServerVisitorApplication {
|
||||
|
||||
|
||||
/**
|
||||
* describe 新增服务端提前开放出来的端口
|
||||
*
|
||||
* @param lazyNettyServerVisitorStoryCommand 新增服务端提前开放出来的端口
|
||||
* @return {@link Result< LazyNettyServerVisitor >} 服务端提前开放出来的端口新增后领域对象
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/01/16 02:21 下午
|
||||
**/
|
||||
|
||||
Result<LazyNettyServerVisitor> story(LazyNettyServerVisitorStoryCommand lazyNettyServerVisitorStoryCommand);
|
||||
|
||||
/**
|
||||
* describe 批量新增服务端提前开放出来的端口
|
||||
*
|
||||
* @param lazyNettyServerVisitorStoryCommandList 批量新增服务端提前开放出来的端口
|
||||
* @return {@link Result<List< LazyNettyServerVisitor >>} 服务端提前开放出来的端口新增后领域对象集合
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/01/16 02:21 下午
|
||||
**/
|
||||
|
||||
Result<List<LazyNettyServerVisitor>> batchStory(List<LazyNettyServerVisitorStoryCommand> lazyNettyServerVisitorStoryCommandList);
|
||||
|
||||
/**
|
||||
* describe 更新服务端提前开放出来的端口
|
||||
*
|
||||
* @param lazyNettyServerVisitorUpdateCommand 更新服务端提前开放出来的端口
|
||||
* @return {@link Result< LazyNettyServerVisitor >} 服务端提前开放出来的端口领域对象
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/01/16 02:21 下午
|
||||
**/
|
||||
|
||||
Result<LazyNettyServerVisitor> updateOne(LazyNettyServerVisitorUpdateCommand lazyNettyServerVisitorUpdateCommand);
|
||||
|
||||
/**
|
||||
* describe 查询单个服务端提前开放出来的端口
|
||||
*
|
||||
* @param lazyNettyServerVisitorQueryOneCommand 查询单个服务端提前开放出来的端口
|
||||
* @return {@link Result< LazyNettyServerVisitorDTO >} 服务端提前开放出来的端口DTO对象
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/01/16 02:21 下午
|
||||
**/
|
||||
|
||||
Result<LazyNettyServerVisitorDTO> findOne(LazyNettyServerVisitorQueryOneCommand lazyNettyServerVisitorQueryOneCommand);
|
||||
|
||||
/**
|
||||
* describe 查询多个服务端提前开放出来的端口
|
||||
*
|
||||
* @param lazyNettyServerVisitorQueryListCommand 查询多个服务端提前开放出来的端口
|
||||
* @return {@link Result <List<LazyNettyServerVisitorDTO>>} 服务端提前开放出来的端口DTO对象
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/01/16 02:21 下午
|
||||
**/
|
||||
|
||||
Result<List<LazyNettyServerVisitorDTO>> findList(LazyNettyServerVisitorQueryListCommand lazyNettyServerVisitorQueryListCommand);
|
||||
|
||||
/**
|
||||
* describe 分页查询多个服务端提前开放出来的端口
|
||||
*
|
||||
* @param lazyNettyServerVisitorQueryListCommand 分页查询多个服务端提前开放出来的端口
|
||||
* @return {@link Result <LazyPage<LazyNettyServerVisitorDTO>>} 分页服务端提前开放出来的端口DTO对象
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/01/16 02:21 下午
|
||||
**/
|
||||
|
||||
Result<LazyPage<LazyNettyServerVisitorDTO>> findPage(int size, int current, LazyNettyServerVisitorQueryListCommand lazyNettyServerVisitorQueryListCommand);
|
||||
|
||||
/**
|
||||
* describe 删除服务端提前开放出来的端口
|
||||
*
|
||||
* @param lazyNettyServerVisitorRemoveCommand 删除服务端提前开放出来的端口
|
||||
* @return {@link Result< LazyNettyServerVisitor >} 服务端提前开放出来的端口
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/01/16 02:21 下午
|
||||
**/
|
||||
|
||||
Result<LazyNettyServerVisitor> remove(LazyNettyServerVisitorRemoveCommand lazyNettyServerVisitorRemoveCommand);
|
||||
|
||||
}
|
@ -0,0 +1,120 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.standalone.application;
|
||||
|
||||
import org.framework.smart.agent.network.heartbeat.server.standalone.application.dto.LazyVisitorPortFlowDTO;
|
||||
import org.framework.smart.agent.network.heartbeat.server.standalone.application.command.visitor.flow.*;
|
||||
import org.framework.smart.agent.network.heartbeat.server.standalone.application.dto.LazyVisitorFlowDTO;
|
||||
import org.wu.framework.lazy.orm.database.lambda.domain.LazyPage;
|
||||
import org.wu.framework.web.response.Result;
|
||||
import org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyApplication;
|
||||
|
||||
import org.framework.smart.agent.network.heartbeat.server.standalone.domain.model.visitor.flow.LazyVisitorPortFlow;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* describe 访客端流量
|
||||
*
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/01/24 05:19 下午
|
||||
* @see DefaultDDDLazyApplication
|
||||
**/
|
||||
|
||||
public interface LazyVisitorPortFlowApplication {
|
||||
|
||||
|
||||
/**
|
||||
* describe 新增访客端流量
|
||||
*
|
||||
* @param lazyVisitorPortFlowStoryCommand 新增访客端流量
|
||||
* @return {@link Result< LazyVisitorPortFlow >} 访客端流量新增后领域对象
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/01/24 05:19 下午
|
||||
**/
|
||||
|
||||
Result<LazyVisitorPortFlow> story(LazyVisitorPortFlowStoryCommand lazyVisitorPortFlowStoryCommand);
|
||||
|
||||
/**
|
||||
*
|
||||
* 流量增长存储
|
||||
* @param lazyVisitorPortFlowStoryCommand
|
||||
* @return
|
||||
*/
|
||||
Result<LazyVisitorPortFlow> flowIncreaseStory(LazyVisitorPortFlowStoryCommand lazyVisitorPortFlowStoryCommand);
|
||||
|
||||
/**
|
||||
* describe 批量新增访客端流量
|
||||
*
|
||||
* @param lazyVisitorPortFlowStoryCommandList 批量新增访客端流量
|
||||
* @return {@link Result<List< LazyVisitorPortFlow >>} 访客端流量新增后领域对象集合
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/01/24 05:19 下午
|
||||
**/
|
||||
|
||||
Result<List<LazyVisitorPortFlow>> batchStory(List<LazyVisitorPortFlowStoryCommand> lazyVisitorPortFlowStoryCommandList);
|
||||
|
||||
/**
|
||||
* describe 更新访客端流量
|
||||
*
|
||||
* @param lazyVisitorPortFlowUpdateCommand 更新访客端流量
|
||||
* @return {@link Result< LazyVisitorPortFlow >} 访客端流量领域对象
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/01/24 05:19 下午
|
||||
**/
|
||||
|
||||
Result<LazyVisitorPortFlow> updateOne(LazyVisitorPortFlowUpdateCommand lazyVisitorPortFlowUpdateCommand);
|
||||
|
||||
/**
|
||||
* describe 查询单个访客端流量
|
||||
*
|
||||
* @param lazyVisitorPortFlowQueryOneCommand 查询单个访客端流量
|
||||
* @return {@link Result< LazyVisitorPortFlowDTO >} 访客端流量DTO对象
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/01/24 05:19 下午
|
||||
**/
|
||||
|
||||
Result<LazyVisitorPortFlowDTO> findOne(LazyVisitorPortFlowQueryOneCommand lazyVisitorPortFlowQueryOneCommand);
|
||||
|
||||
/**
|
||||
* describe 查询多个访客端流量
|
||||
*
|
||||
* @param lazyVisitorPortFlowQueryListCommand 查询多个访客端流量
|
||||
* @return {@link Result <List<LazyVisitorPortFlowDTO>>} 访客端流量DTO对象
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/01/24 05:19 下午
|
||||
**/
|
||||
|
||||
Result<List<LazyVisitorPortFlowDTO>> findList(LazyVisitorPortFlowQueryListCommand lazyVisitorPortFlowQueryListCommand);
|
||||
|
||||
/**
|
||||
* describe 分页查询多个访客端流量
|
||||
*
|
||||
* @param lazyVisitorPortFlowQueryListCommand 分页查询多个访客端流量
|
||||
* @return {@link Result <LazyPage<LazyVisitorPortFlowDTO>>} 分页访客端流量DTO对象
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/01/24 05:19 下午
|
||||
**/
|
||||
|
||||
Result<LazyPage<LazyVisitorPortFlowDTO>> findPage(int size, int current, LazyVisitorPortFlowQueryListCommand lazyVisitorPortFlowQueryListCommand);
|
||||
|
||||
/**
|
||||
* describe 删除访客端流量
|
||||
*
|
||||
* @param lazyVisitorPortFlowRemoveCommand 删除访客端流量
|
||||
* @return {@link Result< LazyVisitorPortFlow >} 访客端流量
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/01/24 05:19 下午
|
||||
**/
|
||||
|
||||
Result<LazyVisitorPortFlow> remove(LazyVisitorPortFlowRemoveCommand lazyVisitorPortFlowRemoveCommand);
|
||||
|
||||
|
||||
/**
|
||||
* 根据客户端查询流量
|
||||
*
|
||||
* @param size 分页大小
|
||||
* @param current 分页
|
||||
* @param lazyVisitorPortFlowQueryListCommand 查询条件
|
||||
* @return {@link Result<LazyPage< LazyVisitorFlowDTO >>} 分页访客端流量DTO对象
|
||||
*/
|
||||
Result<LazyPage<LazyVisitorFlowDTO>> findClientFlowPage(int size, int current, LazyVisitorPortFlowQueryListCommand lazyVisitorPortFlowQueryListCommand);
|
||||
}
|
@ -0,0 +1,122 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.standalone.application;
|
||||
|
||||
import org.framework.smart.agent.network.heartbeat.server.standalone.application.dto.LazyClientFlowPerDayEchartsDTO;
|
||||
import org.framework.smart.agent.network.heartbeat.server.standalone.application.dto.LazyClientPortFlowPerDayEchartsDTO;
|
||||
import org.framework.smart.agent.network.heartbeat.server.standalone.application.dto.LazyVisitorPortPerDayFlowDTO;
|
||||
import org.wu.framework.web.response.Result;
|
||||
import org.framework.smart.agent.network.heartbeat.server.standalone.domain.model.visitor.port.per.day.flow.LazyVisitorPortPerDayFlow;
|
||||
import org.framework.smart.agent.network.heartbeat.server.standalone.application.command.visitor.port.per.day.flow.LazyVisitorPortPerDayFlowRemoveCommand;
|
||||
import org.framework.smart.agent.network.heartbeat.server.standalone.application.command.visitor.port.per.day.flow.LazyVisitorPortPerDayFlowStoryCommand;
|
||||
import org.framework.smart.agent.network.heartbeat.server.standalone.application.command.visitor.port.per.day.flow.LazyVisitorPortPerDayFlowUpdateCommand;
|
||||
import org.framework.smart.agent.network.heartbeat.server.standalone.application.command.visitor.port.per.day.flow.LazyVisitorPortPerDayFlowQueryListCommand;
|
||||
import org.framework.smart.agent.network.heartbeat.server.standalone.application.command.visitor.port.per.day.flow.LazyVisitorPortPerDayFlowQueryOneCommand;
|
||||
|
||||
import java.util.List;
|
||||
import org.wu.framework.lazy.orm.database.lambda.domain.LazyPage;
|
||||
/**
|
||||
* describe 每日统计流量
|
||||
*
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/03/19 09:53 上午
|
||||
* @see org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyApplication
|
||||
**/
|
||||
|
||||
public interface LazyVisitorPortPerDayFlowApplication {
|
||||
|
||||
|
||||
/**
|
||||
* describe 新增每日统计流量
|
||||
*
|
||||
* @param lazyVisitorPortPerDayFlowStoryCommand 新增每日统计流量
|
||||
* @return {@link Result< LazyVisitorPortPerDayFlow >} 每日统计流量新增后领域对象
|
||||
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/03/19 09:53 上午
|
||||
**/
|
||||
|
||||
Result<LazyVisitorPortPerDayFlow> story(LazyVisitorPortPerDayFlowStoryCommand lazyVisitorPortPerDayFlowStoryCommand);
|
||||
|
||||
/**
|
||||
* describe 批量新增每日统计流量
|
||||
*
|
||||
* @param lazyVisitorPortPerDayFlowStoryCommandList 批量新增每日统计流量
|
||||
* @return {@link Result<List< LazyVisitorPortPerDayFlow >>} 每日统计流量新增后领域对象集合
|
||||
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/03/19 09:53 上午
|
||||
**/
|
||||
|
||||
Result<List<LazyVisitorPortPerDayFlow>> batchStory(List<LazyVisitorPortPerDayFlowStoryCommand> lazyVisitorPortPerDayFlowStoryCommandList);
|
||||
|
||||
/**
|
||||
* describe 更新每日统计流量
|
||||
*
|
||||
* @param lazyVisitorPortPerDayFlowUpdateCommand 更新每日统计流量
|
||||
* @return {@link Result< LazyVisitorPortPerDayFlow >} 每日统计流量领域对象
|
||||
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/03/19 09:53 上午
|
||||
**/
|
||||
|
||||
Result<LazyVisitorPortPerDayFlow> updateOne(LazyVisitorPortPerDayFlowUpdateCommand lazyVisitorPortPerDayFlowUpdateCommand);
|
||||
|
||||
/**
|
||||
* describe 查询单个每日统计流量
|
||||
*
|
||||
* @param lazyVisitorPortPerDayFlowQueryOneCommand 查询单个每日统计流量
|
||||
* @return {@link Result< LazyVisitorPortPerDayFlowDTO >} 每日统计流量DTO对象
|
||||
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/03/19 09:53 上午
|
||||
**/
|
||||
|
||||
Result<LazyVisitorPortPerDayFlowDTO> findOne(LazyVisitorPortPerDayFlowQueryOneCommand lazyVisitorPortPerDayFlowQueryOneCommand);
|
||||
|
||||
/**
|
||||
* describe 查询多个每日统计流量
|
||||
*
|
||||
* @param lazyVisitorPortPerDayFlowQueryListCommand 查询多个每日统计流量
|
||||
* @return {@link Result <List<LazyVisitorPortPerDayFlowDTO>>} 每日统计流量DTO对象
|
||||
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/03/19 09:53 上午
|
||||
**/
|
||||
|
||||
Result <List<LazyVisitorPortPerDayFlowDTO>> findList(LazyVisitorPortPerDayFlowQueryListCommand lazyVisitorPortPerDayFlowQueryListCommand);
|
||||
|
||||
/**
|
||||
* describe 分页查询多个每日统计流量
|
||||
*
|
||||
* @param lazyVisitorPortPerDayFlowQueryListCommand 分页查询多个每日统计流量
|
||||
* @return {@link Result <LazyPage<LazyVisitorPortPerDayFlowDTO>>} 分页每日统计流量DTO对象
|
||||
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/03/19 09:53 上午
|
||||
**/
|
||||
|
||||
Result <LazyPage<LazyVisitorPortPerDayFlowDTO>> findPage(int size, int current, LazyVisitorPortPerDayFlowQueryListCommand lazyVisitorPortPerDayFlowQueryListCommand);
|
||||
|
||||
/**
|
||||
* describe 删除每日统计流量
|
||||
*
|
||||
* @param lazyVisitorPortPerDayFlowRemoveCommand 删除每日统计流量
|
||||
* @return {@link Result< LazyVisitorPortPerDayFlow >} 每日统计流量
|
||||
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/03/19 09:53 上午
|
||||
**/
|
||||
|
||||
Result<LazyVisitorPortPerDayFlow> remove(LazyVisitorPortPerDayFlowRemoveCommand lazyVisitorPortPerDayFlowRemoveCommand);
|
||||
|
||||
/**
|
||||
* 获取客户近七天流量数据
|
||||
* @return
|
||||
*/
|
||||
Result<LazyClientPortFlowPerDayEchartsDTO> findClient7DayFlow();
|
||||
|
||||
/**
|
||||
* 获取客户流量数据
|
||||
* @return
|
||||
*/
|
||||
Result<LazyClientFlowPerDayEchartsDTO> findClientPerDayFlow();
|
||||
}
|
@ -0,0 +1,88 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.standalone.application.assembler;
|
||||
|
||||
import org.framework.smart.agent.network.heartbeat.server.standalone.application.command.internal.network.penetration.mapping.*;
|
||||
import org.framework.smart.agent.network.heartbeat.server.standalone.application.dto.LazyInternalNetworkPenetrationMappingDTO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
import org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyAssembler;
|
||||
import org.framework.smart.agent.network.heartbeat.server.standalone.domain.model.internal.network.penetration.mapping.LazyInternalNetworkPenetrationMapping;
|
||||
|
||||
/**
|
||||
* describe 内网穿透映射
|
||||
*
|
||||
* @author Jia wei Wu
|
||||
* @date 2023/12/29 05:21 下午
|
||||
* @see DefaultDDDLazyAssembler
|
||||
**/
|
||||
@Mapper
|
||||
public interface InternalNetworkPenetrationMappingDTOAssembler {
|
||||
|
||||
|
||||
/**
|
||||
* describe MapStruct 创建的代理对象
|
||||
*
|
||||
* @author Jia wei Wu
|
||||
* @date 2023/12/29 05:21 下午
|
||||
**/
|
||||
InternalNetworkPenetrationMappingDTOAssembler INSTANCE = Mappers.getMapper(InternalNetworkPenetrationMappingDTOAssembler.class);
|
||||
|
||||
/**
|
||||
* describe 应用层存储入参转换成 领域对象
|
||||
*
|
||||
* @param lazyInternalNetworkPenetrationMappingStoryCommand 保存内网穿透映射对象
|
||||
* @return {@link LazyInternalNetworkPenetrationMapping} 内网穿透映射领域对象
|
||||
* @author Jia wei Wu
|
||||
* @date 2023/12/29 05:21 下午
|
||||
**/
|
||||
LazyInternalNetworkPenetrationMapping toInternalNetworkPenetrationMapping(LazyInternalNetworkPenetrationMappingStoryCommand lazyInternalNetworkPenetrationMappingStoryCommand);
|
||||
|
||||
/**
|
||||
* describe 应用层更新入参转换成 领域对象
|
||||
*
|
||||
* @param lazyInternalNetworkPenetrationMappingUpdateCommand 更新内网穿透映射对象
|
||||
* @return {@link LazyInternalNetworkPenetrationMapping} 内网穿透映射领域对象
|
||||
* @author Jia wei Wu
|
||||
* @date 2023/12/29 05:21 下午
|
||||
**/
|
||||
LazyInternalNetworkPenetrationMapping toInternalNetworkPenetrationMapping(LazyInternalNetworkPenetrationMappingUpdateCommand lazyInternalNetworkPenetrationMappingUpdateCommand);
|
||||
|
||||
/**
|
||||
* describe 应用层查询入参转换成 领域对象
|
||||
*
|
||||
* @param lazyInternalNetworkPenetrationMappingQueryOneCommand 查询单个内网穿透映射对象参数
|
||||
* @return {@link LazyInternalNetworkPenetrationMapping} 内网穿透映射领域对象
|
||||
* @author Jia wei Wu
|
||||
* @date 2023/12/29 05:21 下午
|
||||
**/
|
||||
LazyInternalNetworkPenetrationMapping toInternalNetworkPenetrationMapping(LazyInternalNetworkPenetrationMappingQueryOneCommand lazyInternalNetworkPenetrationMappingQueryOneCommand);
|
||||
|
||||
/**
|
||||
* describe 应用层查询入参转换成 领域对象
|
||||
*
|
||||
* @param lazyInternalNetworkPenetrationMappingQueryListCommand 查询集合内网穿透映射对象参数
|
||||
* @return {@link LazyInternalNetworkPenetrationMapping} 内网穿透映射领域对象
|
||||
* @author Jia wei Wu
|
||||
* @date 2023/12/29 05:21 下午
|
||||
**/
|
||||
LazyInternalNetworkPenetrationMapping toInternalNetworkPenetrationMapping(LazyInternalNetworkPenetrationMappingQueryListCommand lazyInternalNetworkPenetrationMappingQueryListCommand);
|
||||
|
||||
/**
|
||||
* describe 应用层删除入参转换成 领域对象
|
||||
*
|
||||
* @param lazyInternalNetworkPenetrationMappingRemoveCommand 删除内网穿透映射对象参数
|
||||
* @return {@link LazyInternalNetworkPenetrationMapping} 内网穿透映射领域对象
|
||||
* @author Jia wei Wu
|
||||
* @date 2023/12/29 05:21 下午
|
||||
**/
|
||||
LazyInternalNetworkPenetrationMapping toInternalNetworkPenetrationMapping(LazyInternalNetworkPenetrationMappingRemoveCommand lazyInternalNetworkPenetrationMappingRemoveCommand);
|
||||
|
||||
/**
|
||||
* describe 持久层领域对象转换成DTO对象
|
||||
*
|
||||
* @param lazyInternalNetworkPenetrationMapping 内网穿透映射领域对象
|
||||
* @return {@link LazyInternalNetworkPenetrationMappingDTO} 内网穿透映射DTO对象
|
||||
* @author Jia wei Wu
|
||||
* @date 2023/12/29 05:21 下午
|
||||
**/
|
||||
LazyInternalNetworkPenetrationMappingDTO fromInternalNetworkPenetrationMapping(LazyInternalNetworkPenetrationMapping lazyInternalNetworkPenetrationMapping);
|
||||
}
|
@ -0,0 +1,89 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.standalone.application.assembler;
|
||||
|
||||
import org.framework.smart.agent.network.heartbeat.server.standalone.application.command.netty.client.blacklist.*;
|
||||
import org.framework.smart.agent.network.heartbeat.server.standalone.application.dto.LazyNettyClientBlacklistDTO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
import org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyAssembler;
|
||||
|
||||
import org.framework.smart.agent.network.heartbeat.server.standalone.domain.model.netty.client.blacklist.LazyNettyClientBlacklist;
|
||||
|
||||
/**
|
||||
* describe 客户端黑名单
|
||||
*
|
||||
* @author Jia wei Wu
|
||||
* @date 2023/12/27 03:46 下午
|
||||
* @see DefaultDDDLazyAssembler
|
||||
**/
|
||||
@Mapper
|
||||
public interface NettyClientBlacklistDTOAssembler {
|
||||
|
||||
|
||||
/**
|
||||
* describe MapStruct 创建的代理对象
|
||||
*
|
||||
* @author Jia wei Wu
|
||||
* @date 2023/12/27 03:46 下午
|
||||
**/
|
||||
NettyClientBlacklistDTOAssembler INSTANCE = Mappers.getMapper(NettyClientBlacklistDTOAssembler.class);
|
||||
|
||||
/**
|
||||
* describe 应用层存储入参转换成 领域对象
|
||||
*
|
||||
* @param lazyNettyClientBlacklistStoryCommand 保存客户端黑名单对象
|
||||
* @return {@link LazyNettyClientBlacklist} 客户端黑名单领域对象
|
||||
* @author Jia wei Wu
|
||||
* @date 2023/12/27 03:46 下午
|
||||
**/
|
||||
LazyNettyClientBlacklist toNettyClientBlacklist(LazyNettyClientBlacklistStoryCommand lazyNettyClientBlacklistStoryCommand);
|
||||
|
||||
/**
|
||||
* describe 应用层更新入参转换成 领域对象
|
||||
*
|
||||
* @param lazyNettyClientBlacklistUpdateCommand 更新客户端黑名单对象
|
||||
* @return {@link LazyNettyClientBlacklist} 客户端黑名单领域对象
|
||||
* @author Jia wei Wu
|
||||
* @date 2023/12/27 03:46 下午
|
||||
**/
|
||||
LazyNettyClientBlacklist toNettyClientBlacklist(LazyNettyClientBlacklistUpdateCommand lazyNettyClientBlacklistUpdateCommand);
|
||||
|
||||
/**
|
||||
* describe 应用层查询入参转换成 领域对象
|
||||
*
|
||||
* @param lazyNettyClientBlacklistQueryOneCommand 查询单个客户端黑名单对象参数
|
||||
* @return {@link LazyNettyClientBlacklist} 客户端黑名单领域对象
|
||||
* @author Jia wei Wu
|
||||
* @date 2023/12/27 03:46 下午
|
||||
**/
|
||||
LazyNettyClientBlacklist toNettyClientBlacklist(LazyNettyClientBlacklistQueryOneCommand lazyNettyClientBlacklistQueryOneCommand);
|
||||
|
||||
/**
|
||||
* describe 应用层查询入参转换成 领域对象
|
||||
*
|
||||
* @param lazyNettyClientBlacklistQueryListCommand 查询集合客户端黑名单对象参数
|
||||
* @return {@link LazyNettyClientBlacklist} 客户端黑名单领域对象
|
||||
* @author Jia wei Wu
|
||||
* @date 2023/12/27 03:46 下午
|
||||
**/
|
||||
LazyNettyClientBlacklist toNettyClientBlacklist(LazyNettyClientBlacklistQueryListCommand lazyNettyClientBlacklistQueryListCommand);
|
||||
|
||||
/**
|
||||
* describe 应用层删除入参转换成 领域对象
|
||||
*
|
||||
* @param lazyNettyClientBlacklistRemoveCommand 删除客户端黑名单对象参数
|
||||
* @return {@link LazyNettyClientBlacklist} 客户端黑名单领域对象
|
||||
* @author Jia wei Wu
|
||||
* @date 2023/12/27 03:46 下午
|
||||
**/
|
||||
LazyNettyClientBlacklist toNettyClientBlacklist(LazyNettyClientBlacklistRemoveCommand lazyNettyClientBlacklistRemoveCommand);
|
||||
|
||||
/**
|
||||
* describe 持久层领域对象转换成DTO对象
|
||||
*
|
||||
* @param lazyNettyClientBlacklist 客户端黑名单领域对象
|
||||
* @return {@link LazyNettyClientBlacklistDTO} 客户端黑名单DTO对象
|
||||
* @author Jia wei Wu
|
||||
* @date 2023/12/27 03:46 下午
|
||||
**/
|
||||
LazyNettyClientBlacklistDTO fromNettyClientBlacklist(LazyNettyClientBlacklist lazyNettyClientBlacklist);
|
||||
}
|
@ -0,0 +1,89 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.standalone.application.assembler;
|
||||
|
||||
import org.framework.smart.agent.network.heartbeat.server.standalone.application.dto.LazyNettyClientStateDTO;
|
||||
import org.framework.smart.agent.network.heartbeat.server.standalone.application.command.netty.client.state.*;
|
||||
import org.framework.smart.agent.network.heartbeat.server.standalone.domain.model.netty.client.state.LazyNettyClientState;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
import org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyAssembler;
|
||||
|
||||
|
||||
/**
|
||||
* describe 客户端状态
|
||||
*
|
||||
* @author Jia wei Wu
|
||||
* @date 2023/12/27 03:46 下午
|
||||
* @see DefaultDDDLazyAssembler
|
||||
**/
|
||||
@Mapper
|
||||
public interface NettyClientStateDTOAssembler {
|
||||
|
||||
|
||||
/**
|
||||
* describe MapStruct 创建的代理对象
|
||||
*
|
||||
* @author Jia wei Wu
|
||||
* @date 2023/12/27 03:46 下午
|
||||
**/
|
||||
NettyClientStateDTOAssembler INSTANCE = Mappers.getMapper(NettyClientStateDTOAssembler.class);
|
||||
|
||||
/**
|
||||
* describe 应用层存储入参转换成 领域对象
|
||||
*
|
||||
* @param lazyNettyClientStateStoryCommand 保存客户端状态对象
|
||||
* @return {@link LazyNettyClientState} 客户端状态领域对象
|
||||
* @author Jia wei Wu
|
||||
* @date 2023/12/27 03:46 下午
|
||||
**/
|
||||
LazyNettyClientState toNettyClientState(LazyNettyClientStateStoryCommand lazyNettyClientStateStoryCommand);
|
||||
|
||||
/**
|
||||
* describe 应用层更新入参转换成 领域对象
|
||||
*
|
||||
* @param lazyNettyClientStateUpdateCommand 更新客户端状态对象
|
||||
* @return {@link LazyNettyClientState} 客户端状态领域对象
|
||||
* @author Jia wei Wu
|
||||
* @date 2023/12/27 03:46 下午
|
||||
**/
|
||||
LazyNettyClientState toNettyClientState(LazyNettyClientStateUpdateCommand lazyNettyClientStateUpdateCommand);
|
||||
|
||||
/**
|
||||
* describe 应用层查询入参转换成 领域对象
|
||||
*
|
||||
* @param lazyNettyClientStateQueryOneCommand 查询单个客户端状态对象参数
|
||||
* @return {@link LazyNettyClientState} 客户端状态领域对象
|
||||
* @author Jia wei Wu
|
||||
* @date 2023/12/27 03:46 下午
|
||||
**/
|
||||
LazyNettyClientState toNettyClientState(LazyNettyClientStateQueryOneCommand lazyNettyClientStateQueryOneCommand);
|
||||
|
||||
/**
|
||||
* describe 应用层查询入参转换成 领域对象
|
||||
*
|
||||
* @param lazyNettyClientStateQueryListCommand 查询集合客户端状态对象参数
|
||||
* @return {@link LazyNettyClientState} 客户端状态领域对象
|
||||
* @author Jia wei Wu
|
||||
* @date 2023/12/27 03:46 下午
|
||||
**/
|
||||
LazyNettyClientState toNettyClientState(LazyNettyClientStateQueryListCommand lazyNettyClientStateQueryListCommand);
|
||||
|
||||
/**
|
||||
* describe 应用层删除入参转换成 领域对象
|
||||
*
|
||||
* @param lazyNettyClientStateRemoveCommand 删除客户端状态对象参数
|
||||
* @return {@link LazyNettyClientState} 客户端状态领域对象
|
||||
* @author Jia wei Wu
|
||||
* @date 2023/12/27 03:46 下午
|
||||
**/
|
||||
LazyNettyClientState toNettyClientState(LazyNettyClientStateRemoveCommand lazyNettyClientStateRemoveCommand);
|
||||
|
||||
/**
|
||||
* describe 持久层领域对象转换成DTO对象
|
||||
*
|
||||
* @param lazyNettyClientState 客户端状态领域对象
|
||||
* @return {@link LazyNettyClientStateDTO} 客户端状态DTO对象
|
||||
* @author Jia wei Wu
|
||||
* @date 2023/12/27 03:46 下午
|
||||
**/
|
||||
LazyNettyClientStateDTO fromNettyClientState(LazyNettyClientState lazyNettyClientState);
|
||||
}
|
@ -0,0 +1,89 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.standalone.application.assembler;
|
||||
|
||||
import org.framework.smart.agent.network.heartbeat.server.standalone.application.command.netty.server.visitor.*;
|
||||
import org.framework.smart.agent.network.heartbeat.server.standalone.application.dto.LazyNettyServerVisitorDTO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
import org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyAssembler;
|
||||
|
||||
import org.framework.smart.agent.network.heartbeat.server.standalone.domain.model.netty.server.visitor.LazyNettyServerVisitor;
|
||||
|
||||
/**
|
||||
* describe 服务端提前开放出来的端口
|
||||
*
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/01/16 02:21 下午
|
||||
* @see DefaultDDDLazyAssembler
|
||||
**/
|
||||
@Mapper
|
||||
public interface NettyServerVisitorDTOAssembler {
|
||||
|
||||
|
||||
/**
|
||||
* describe MapStruct 创建的代理对象
|
||||
*
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/01/16 02:21 下午
|
||||
**/
|
||||
NettyServerVisitorDTOAssembler INSTANCE = Mappers.getMapper(NettyServerVisitorDTOAssembler.class);
|
||||
|
||||
/**
|
||||
* describe 应用层存储入参转换成 领域对象
|
||||
*
|
||||
* @param lazyNettyServerVisitorStoryCommand 保存服务端提前开放出来的端口对象
|
||||
* @return {@link LazyNettyServerVisitor} 服务端提前开放出来的端口领域对象
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/01/16 02:21 下午
|
||||
**/
|
||||
LazyNettyServerVisitor toNettyServerVisitor(LazyNettyServerVisitorStoryCommand lazyNettyServerVisitorStoryCommand);
|
||||
|
||||
/**
|
||||
* describe 应用层更新入参转换成 领域对象
|
||||
*
|
||||
* @param lazyNettyServerVisitorUpdateCommand 更新服务端提前开放出来的端口对象
|
||||
* @return {@link LazyNettyServerVisitor} 服务端提前开放出来的端口领域对象
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/01/16 02:21 下午
|
||||
**/
|
||||
LazyNettyServerVisitor toNettyServerVisitor(LazyNettyServerVisitorUpdateCommand lazyNettyServerVisitorUpdateCommand);
|
||||
|
||||
/**
|
||||
* describe 应用层查询入参转换成 领域对象
|
||||
*
|
||||
* @param lazyNettyServerVisitorQueryOneCommand 查询单个服务端提前开放出来的端口对象参数
|
||||
* @return {@link LazyNettyServerVisitor} 服务端提前开放出来的端口领域对象
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/01/16 02:21 下午
|
||||
**/
|
||||
LazyNettyServerVisitor toNettyServerVisitor(LazyNettyServerVisitorQueryOneCommand lazyNettyServerVisitorQueryOneCommand);
|
||||
|
||||
/**
|
||||
* describe 应用层查询入参转换成 领域对象
|
||||
*
|
||||
* @param lazyNettyServerVisitorQueryListCommand 查询集合服务端提前开放出来的端口对象参数
|
||||
* @return {@link LazyNettyServerVisitor} 服务端提前开放出来的端口领域对象
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/01/16 02:21 下午
|
||||
**/
|
||||
LazyNettyServerVisitor toNettyServerVisitor(LazyNettyServerVisitorQueryListCommand lazyNettyServerVisitorQueryListCommand);
|
||||
|
||||
/**
|
||||
* describe 应用层删除入参转换成 领域对象
|
||||
*
|
||||
* @param lazyNettyServerVisitorRemoveCommand 删除服务端提前开放出来的端口对象参数
|
||||
* @return {@link LazyNettyServerVisitor} 服务端提前开放出来的端口领域对象
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/01/16 02:21 下午
|
||||
**/
|
||||
LazyNettyServerVisitor toNettyServerVisitor(LazyNettyServerVisitorRemoveCommand lazyNettyServerVisitorRemoveCommand);
|
||||
|
||||
/**
|
||||
* describe 持久层领域对象转换成DTO对象
|
||||
*
|
||||
* @param lazyNettyServerVisitor 服务端提前开放出来的端口领域对象
|
||||
* @return {@link LazyNettyServerVisitorDTO} 服务端提前开放出来的端口DTO对象
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/01/16 02:21 下午
|
||||
**/
|
||||
LazyNettyServerVisitorDTO fromNettyServerVisitor(LazyNettyServerVisitor lazyNettyServerVisitor);
|
||||
}
|
@ -0,0 +1,89 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.standalone.application.assembler;
|
||||
|
||||
import org.framework.smart.agent.network.heartbeat.server.standalone.application.command.visitor.flow.*;
|
||||
import org.framework.smart.agent.network.heartbeat.server.standalone.application.dto.LazyVisitorPortFlowDTO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
import org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyAssembler;
|
||||
|
||||
import org.framework.smart.agent.network.heartbeat.server.standalone.domain.model.visitor.flow.LazyVisitorPortFlow;
|
||||
|
||||
/**
|
||||
* describe 访客端流量
|
||||
*
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/01/24 05:19 下午
|
||||
* @see DefaultDDDLazyAssembler
|
||||
**/
|
||||
@Mapper
|
||||
public interface VisitorPortFlowDTOAssembler {
|
||||
|
||||
|
||||
/**
|
||||
* describe MapStruct 创建的代理对象
|
||||
*
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/01/24 05:19 下午
|
||||
**/
|
||||
VisitorPortFlowDTOAssembler INSTANCE = Mappers.getMapper(VisitorPortFlowDTOAssembler.class);
|
||||
|
||||
/**
|
||||
* describe 应用层存储入参转换成 领域对象
|
||||
*
|
||||
* @param lazyVisitorPortFlowStoryCommand 保存访客端流量对象
|
||||
* @return {@link LazyVisitorPortFlow} 访客端流量领域对象
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/01/24 05:19 下午
|
||||
**/
|
||||
LazyVisitorPortFlow toVisitorFlow(LazyVisitorPortFlowStoryCommand lazyVisitorPortFlowStoryCommand);
|
||||
|
||||
/**
|
||||
* describe 应用层更新入参转换成 领域对象
|
||||
*
|
||||
* @param lazyVisitorPortFlowUpdateCommand 更新访客端流量对象
|
||||
* @return {@link LazyVisitorPortFlow} 访客端流量领域对象
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/01/24 05:19 下午
|
||||
**/
|
||||
LazyVisitorPortFlow toVisitorFlow(LazyVisitorPortFlowUpdateCommand lazyVisitorPortFlowUpdateCommand);
|
||||
|
||||
/**
|
||||
* describe 应用层查询入参转换成 领域对象
|
||||
*
|
||||
* @param lazyVisitorPortFlowQueryOneCommand 查询单个访客端流量对象参数
|
||||
* @return {@link LazyVisitorPortFlow} 访客端流量领域对象
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/01/24 05:19 下午
|
||||
**/
|
||||
LazyVisitorPortFlow toVisitorFlow(LazyVisitorPortFlowQueryOneCommand lazyVisitorPortFlowQueryOneCommand);
|
||||
|
||||
/**
|
||||
* describe 应用层查询入参转换成 领域对象
|
||||
*
|
||||
* @param lazyVisitorPortFlowQueryListCommand 查询集合访客端流量对象参数
|
||||
* @return {@link LazyVisitorPortFlow} 访客端流量领域对象
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/01/24 05:19 下午
|
||||
**/
|
||||
LazyVisitorPortFlow toVisitorFlow(LazyVisitorPortFlowQueryListCommand lazyVisitorPortFlowQueryListCommand);
|
||||
|
||||
/**
|
||||
* describe 应用层删除入参转换成 领域对象
|
||||
*
|
||||
* @param lazyVisitorPortFlowRemoveCommand 删除访客端流量对象参数
|
||||
* @return {@link LazyVisitorPortFlow} 访客端流量领域对象
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/01/24 05:19 下午
|
||||
**/
|
||||
LazyVisitorPortFlow toVisitorFlow(LazyVisitorPortFlowRemoveCommand lazyVisitorPortFlowRemoveCommand);
|
||||
|
||||
/**
|
||||
* describe 持久层领域对象转换成DTO对象
|
||||
*
|
||||
* @param lazyVisitorPortFlow 访客端流量领域对象
|
||||
* @return {@link LazyVisitorPortFlowDTO} 访客端流量DTO对象
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/01/24 05:19 下午
|
||||
**/
|
||||
LazyVisitorPortFlowDTO fromVisitorFlow(LazyVisitorPortFlow lazyVisitorPortFlow);
|
||||
}
|
@ -0,0 +1,93 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.standalone.application.assembler;
|
||||
|
||||
import org.framework.smart.agent.network.heartbeat.server.standalone.application.dto.LazyVisitorPortPerDayFlowDTO;
|
||||
import org.framework.smart.agent.network.heartbeat.server.standalone.domain.model.visitor.port.per.day.flow.LazyVisitorPortPerDayFlow;
|
||||
import org.framework.smart.agent.network.heartbeat.server.standalone.application.command.visitor.port.per.day.flow.LazyVisitorPortPerDayFlowRemoveCommand;
|
||||
import org.framework.smart.agent.network.heartbeat.server.standalone.application.command.visitor.port.per.day.flow.LazyVisitorPortPerDayFlowStoryCommand;
|
||||
import org.framework.smart.agent.network.heartbeat.server.standalone.application.command.visitor.port.per.day.flow.LazyVisitorPortPerDayFlowUpdateCommand;
|
||||
import org.framework.smart.agent.network.heartbeat.server.standalone.application.command.visitor.port.per.day.flow.LazyVisitorPortPerDayFlowQueryListCommand;
|
||||
import org.framework.smart.agent.network.heartbeat.server.standalone.application.command.visitor.port.per.day.flow.LazyVisitorPortPerDayFlowQueryOneCommand;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
import org.mapstruct.Mapper;
|
||||
/**
|
||||
* describe 每日统计流量
|
||||
*
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/03/19 09:53 上午
|
||||
* @see org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyAssembler
|
||||
**/
|
||||
@Mapper
|
||||
public interface VisitorPortPerDayFlowDTOAssembler {
|
||||
|
||||
|
||||
/**
|
||||
* describe MapStruct 创建的代理对象
|
||||
*
|
||||
|
||||
|
||||
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/03/19 09:53 上午
|
||||
**/
|
||||
VisitorPortPerDayFlowDTOAssembler INSTANCE = Mappers.getMapper(VisitorPortPerDayFlowDTOAssembler.class);
|
||||
/**
|
||||
* describe 应用层存储入参转换成 领域对象
|
||||
*
|
||||
* @param lazyVisitorPortPerDayFlowStoryCommand 保存每日统计流量对象
|
||||
* @return {@link LazyVisitorPortPerDayFlow} 每日统计流量领域对象
|
||||
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/03/19 09:53 上午
|
||||
**/
|
||||
LazyVisitorPortPerDayFlow toVisitorPortPerDayFlow(LazyVisitorPortPerDayFlowStoryCommand lazyVisitorPortPerDayFlowStoryCommand);
|
||||
/**
|
||||
* describe 应用层更新入参转换成 领域对象
|
||||
*
|
||||
* @param lazyVisitorPortPerDayFlowUpdateCommand 更新每日统计流量对象
|
||||
* @return {@link LazyVisitorPortPerDayFlow} 每日统计流量领域对象
|
||||
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/03/19 09:53 上午
|
||||
**/
|
||||
LazyVisitorPortPerDayFlow toVisitorPortPerDayFlow(LazyVisitorPortPerDayFlowUpdateCommand lazyVisitorPortPerDayFlowUpdateCommand);
|
||||
/**
|
||||
* describe 应用层查询入参转换成 领域对象
|
||||
*
|
||||
* @param lazyVisitorPortPerDayFlowQueryOneCommand 查询单个每日统计流量对象参数
|
||||
* @return {@link LazyVisitorPortPerDayFlow} 每日统计流量领域对象
|
||||
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/03/19 09:53 上午
|
||||
**/
|
||||
LazyVisitorPortPerDayFlow toVisitorPortPerDayFlow(LazyVisitorPortPerDayFlowQueryOneCommand lazyVisitorPortPerDayFlowQueryOneCommand);
|
||||
/**
|
||||
* describe 应用层查询入参转换成 领域对象
|
||||
*
|
||||
* @param lazyVisitorPortPerDayFlowQueryListCommand 查询集合每日统计流量对象参数
|
||||
* @return {@link LazyVisitorPortPerDayFlow} 每日统计流量领域对象
|
||||
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/03/19 09:53 上午
|
||||
**/
|
||||
LazyVisitorPortPerDayFlow toVisitorPortPerDayFlow(LazyVisitorPortPerDayFlowQueryListCommand lazyVisitorPortPerDayFlowQueryListCommand);
|
||||
/**
|
||||
* describe 应用层删除入参转换成 领域对象
|
||||
*
|
||||
* @param lazyVisitorPortPerDayFlowRemoveCommand 删除每日统计流量对象参数
|
||||
* @return {@link LazyVisitorPortPerDayFlow} 每日统计流量领域对象
|
||||
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/03/19 09:53 上午
|
||||
**/
|
||||
LazyVisitorPortPerDayFlow toVisitorPortPerDayFlow(LazyVisitorPortPerDayFlowRemoveCommand lazyVisitorPortPerDayFlowRemoveCommand);
|
||||
/**
|
||||
* describe 持久层领域对象转换成DTO对象
|
||||
*
|
||||
* @param lazyVisitorPortPerDayFlow 每日统计流量领域对象
|
||||
* @return {@link LazyVisitorPortPerDayFlowDTO} 每日统计流量DTO对象
|
||||
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/03/19 09:53 上午
|
||||
**/
|
||||
LazyVisitorPortPerDayFlowDTO fromVisitorPortPerDayFlow(LazyVisitorPortPerDayFlow lazyVisitorPortPerDayFlow);
|
||||
}
|
@ -0,0 +1,74 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.standalone.application.command.internal.network.penetration.mapping;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyQueryListCommand;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* describe 内网穿透映射
|
||||
*
|
||||
* @author Jia wei Wu
|
||||
* @date 2023/12/29 05:21 下午
|
||||
* @see DefaultDDDLazyQueryListCommand
|
||||
**/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Schema(title = "internal_network_penetration_mapping_query_List_command", description = "内网穿透映射")
|
||||
public class LazyInternalNetworkPenetrationMappingQueryListCommand {
|
||||
|
||||
|
||||
/**
|
||||
* 客户端ID
|
||||
*/
|
||||
@Schema(description = "客户端ID", name = "clientId", example = "")
|
||||
private String clientId;
|
||||
|
||||
/**
|
||||
* 客户端目标地址
|
||||
*/
|
||||
@Schema(description = "客户端目标地址", name = "clientTargetIp", example = "")
|
||||
private String clientTargetIp;
|
||||
|
||||
/**
|
||||
* 客户端目标端口
|
||||
*/
|
||||
@Schema(description = "客户端目标端口", name = "clientTargetPort", example = "")
|
||||
private Integer clientTargetPort;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Schema(description = "创建时间", name = "createTime", example = "")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 主键自增
|
||||
*/
|
||||
@Schema(description = "主键自增", name = "id", example = "")
|
||||
private Long id;
|
||||
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@Schema(description = "修改时间", name = "updateTime", example = "")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 访问端口
|
||||
*/
|
||||
@Schema(description = "访问端口", name = "visitorPort", example = "")
|
||||
private Integer visitorPort;
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
@Schema(description = "描述", name = "describe", example = "")
|
||||
private String describe; /**
|
||||
* 服务端ID
|
||||
*/
|
||||
@Schema(description = "服务端ID", name = "serverId", example = "")
|
||||
private String serverId;
|
||||
}
|
@ -0,0 +1,73 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.standalone.application.command.internal.network.penetration.mapping;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyQueryOneCommand;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* describe 内网穿透映射
|
||||
*
|
||||
* @author Jia wei Wu
|
||||
* @date 2023/12/29 05:21 下午
|
||||
* @see DefaultDDDLazyQueryOneCommand
|
||||
**/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Schema(title = "lazy_internal_network_penetration_mapping_query_one_command", description = "内网穿透映射")
|
||||
public class LazyInternalNetworkPenetrationMappingQueryOneCommand {
|
||||
|
||||
|
||||
/**
|
||||
* 客户端ID
|
||||
*/
|
||||
@Schema(description = "客户端ID", name = "clientId", example = "")
|
||||
private String clientId;
|
||||
|
||||
/**
|
||||
* 客户端目标地址
|
||||
*/
|
||||
@Schema(description = "客户端目标地址", name = "clientTargetIp", example = "")
|
||||
private String clientTargetIp;
|
||||
|
||||
/**
|
||||
* 客户端目标端口
|
||||
*/
|
||||
@Schema(description = "客户端目标端口", name = "clientTargetPort", example = "")
|
||||
private Integer clientTargetPort;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Schema(description = "创建时间", name = "createTime", example = "")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 主键自增
|
||||
*/
|
||||
@Schema(description = "主键自增", name = "id", example = "")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@Schema(description = "修改时间", name = "updateTime", example = "")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 访问端口
|
||||
*/
|
||||
@Schema(description = "访问端口", name = "visitorPort", example = "")
|
||||
private Integer visitorPort;
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
@Schema(description = "描述", name = "describe", example = "")
|
||||
private String describe; /**
|
||||
* 服务端ID
|
||||
*/
|
||||
@Schema(description = "服务端ID", name = "serverId", example = "")
|
||||
private String serverId;
|
||||
}
|
@ -0,0 +1,65 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.standalone.application.command.internal.network.penetration.mapping;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyRemoveCommand;
|
||||
import org.wu.framework.web.response.mark.ValidType;
|
||||
|
||||
/**
|
||||
* describe 内网穿透映射
|
||||
*
|
||||
* @author Jia wei Wu
|
||||
* @date 2023/12/29 05:21 下午
|
||||
* @see DefaultDDDLazyRemoveCommand
|
||||
**/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Schema(title = "internal_network_penetration_mapping_remove_command", description = "内网穿透映射")
|
||||
public class LazyInternalNetworkPenetrationMappingRemoveCommand {
|
||||
|
||||
|
||||
/**
|
||||
* 客户端ID
|
||||
*/
|
||||
@NotNull(message = "客户端ID 不能为空", groups = ValidType.Delete.class)
|
||||
@Schema(description = "客户端ID", name = "clientId", example = "")
|
||||
private String clientId;
|
||||
|
||||
/**
|
||||
* 客户端目标地址
|
||||
*/
|
||||
@NotNull(message = "客户端目标地址 不能为空", groups = ValidType.Delete.class)
|
||||
@Schema(description = "客户端目标地址", name = "clientTargetIp", example = "")
|
||||
private String clientTargetIp;
|
||||
|
||||
/**
|
||||
* 客户端目标端口
|
||||
*/
|
||||
@NotNull(message = "客户端目标端口 不能为空", groups = ValidType.Delete.class)
|
||||
@Schema(description = "客户端目标端口", name = "clientTargetPort", example = "")
|
||||
private Integer clientTargetPort;
|
||||
|
||||
/**
|
||||
* 主键自增
|
||||
*/
|
||||
@Schema(description = "主键自增", name = "id", example = "")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 访问端口
|
||||
*/
|
||||
@NotNull(message = "访问端口 不能为空", groups = ValidType.Delete.class)
|
||||
@Schema(description = "访问端口", name = "visitorPort", example = "")
|
||||
private Integer visitorPort;
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
@Schema(description = "描述", name = "describe", example = "")
|
||||
private String describe; /**
|
||||
* 服务端ID
|
||||
*/
|
||||
@Schema(description = "服务端ID", name = "serverId", example = "")
|
||||
private String serverId;
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.standalone.application.command.internal.network.penetration.mapping;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyStoryCommand;
|
||||
|
||||
/**
|
||||
* describe 内网穿透映射
|
||||
*
|
||||
* @author Jia wei Wu
|
||||
* @date 2023/12/29 05:21 下午
|
||||
* @see DefaultDDDLazyStoryCommand
|
||||
**/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Schema(title = "internal_network_penetration_mapping_story_command", description = "内网穿透映射")
|
||||
public class LazyInternalNetworkPenetrationMappingStoryCommand {
|
||||
|
||||
|
||||
/**
|
||||
* 客户端ID
|
||||
*/
|
||||
@Schema(description = "客户端ID", name = "clientId", example = "")
|
||||
private String clientId;
|
||||
|
||||
/**
|
||||
* 客户端目标地址
|
||||
*/
|
||||
@Schema(description = "客户端目标地址", name = "clientTargetIp", example = "")
|
||||
private String clientTargetIp;
|
||||
|
||||
/**
|
||||
* 客户端目标端口
|
||||
*/
|
||||
@Schema(description = "客户端目标端口", name = "clientTargetPort", example = "")
|
||||
private Integer clientTargetPort;
|
||||
|
||||
/**
|
||||
* 主键自增
|
||||
*/
|
||||
@Schema(description = "主键自增", name = "id", example = "")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 访问端口
|
||||
*/
|
||||
@Schema(description = "访问端口", name = "visitorPort", example = "")
|
||||
private Integer visitorPort;
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
@Schema(description = "描述", name = "describe", example = "")
|
||||
private String describe; /**
|
||||
* 服务端ID
|
||||
*/
|
||||
@Schema(description = "服务端ID", name = "serverId", example = "")
|
||||
private String serverId;
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.standalone.application.command.internal.network.penetration.mapping;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyUpdateCommand;
|
||||
import org.wu.framework.web.response.mark.ValidType;
|
||||
|
||||
/**
|
||||
* describe 内网穿透映射
|
||||
*
|
||||
* @author Jia wei Wu
|
||||
* @date 2023/12/29 05:21 下午
|
||||
* @see DefaultDDDLazyUpdateCommand
|
||||
**/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Schema(title = "internal_network_penetration_mapping_update_command", description = "内网穿透映射")
|
||||
public class LazyInternalNetworkPenetrationMappingUpdateCommand {
|
||||
|
||||
/**
|
||||
* 客户端ID
|
||||
*/
|
||||
@NotNull(message = "客户端ID 不能为空", groups = ValidType.Delete.class)
|
||||
@Schema(description = "客户端ID", name = "clientId", example = "")
|
||||
private String clientId;
|
||||
|
||||
/**
|
||||
* 客户端目标地址
|
||||
*/
|
||||
@NotNull(message = "客户端目标地址 不能为空", groups = ValidType.Delete.class)
|
||||
@Schema(description = "客户端目标地址", name = "clientTargetIp", example = "")
|
||||
private String clientTargetIp;
|
||||
|
||||
/**
|
||||
* 客户端目标端口
|
||||
*/
|
||||
@NotNull(message = "客户端目标端口 不能为空", groups = ValidType.Delete.class)
|
||||
@Schema(description = "客户端目标端口", name = "clientTargetPort", example = "")
|
||||
private Integer clientTargetPort;
|
||||
|
||||
/**
|
||||
* 主键自增
|
||||
*/
|
||||
@Schema(description = "主键自增", name = "id", example = "")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 访问端口
|
||||
*/
|
||||
@NotNull(message = "访问端口 不能为空", groups = ValidType.Delete.class)
|
||||
@Schema(description = "访问端口", name = "visitorPort", example = "")
|
||||
private Integer visitorPort;
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
@Schema(description = "描述", name = "describe", example = "")
|
||||
private String describe; /**
|
||||
* 服务端ID
|
||||
*/
|
||||
@Schema(description = "服务端ID", name = "serverId", example = "")
|
||||
private String serverId;
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.standalone.application.command.netty.client.blacklist;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyQueryListCommand;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* describe 客户端黑名单
|
||||
*
|
||||
* @author Jia wei Wu
|
||||
* @date 2023/12/27 03:46 下午
|
||||
* @see DefaultDDDLazyQueryListCommand
|
||||
**/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Schema(title = "lazy_netty_client_blacklist_query_List_command", description = "客户端黑名单")
|
||||
public class LazyNettyClientBlacklistQueryListCommand {
|
||||
|
||||
|
||||
/**
|
||||
* 客户端ID
|
||||
*/
|
||||
@Schema(description = "客户端ID", name = "clientId", example = "")
|
||||
private String clientId;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Schema(description = "创建时间", name = "createTime", example = "")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@Schema(description = "主键", name = "id", example = "")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
@Schema(description = "是否删除", name = "isDeleted", example = "")
|
||||
private Boolean isDeleted;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@Schema(description = "更新时间", name = "updateTime", example = "")
|
||||
private LocalDateTime updateTime;
|
||||
/**
|
||||
* 服务端ID
|
||||
*/
|
||||
@Schema(description = "服务端ID", name = "serverId", example = "")
|
||||
private String serverId;
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.standalone.application.command.netty.client.blacklist;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyQueryOneCommand;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* describe 客户端黑名单
|
||||
*
|
||||
* @author Jia wei Wu
|
||||
* @date 2023/12/27 03:46 下午
|
||||
* @see DefaultDDDLazyQueryOneCommand
|
||||
**/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Schema(title = "lazy_netty_client_blacklist_query_one_command", description = "客户端黑名单")
|
||||
public class LazyNettyClientBlacklistQueryOneCommand {
|
||||
|
||||
|
||||
/**
|
||||
* 客户端ID
|
||||
*/
|
||||
@Schema(description = "客户端ID", name = "clientId", example = "")
|
||||
private String clientId;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Schema(description = "创建时间", name = "createTime", example = "")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@Schema(description = "主键", name = "id", example = "")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
@Schema(description = "是否删除", name = "isDeleted", example = "")
|
||||
private Boolean isDeleted;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@Schema(description = "更新时间", name = "updateTime", example = "")
|
||||
private LocalDateTime updateTime;
|
||||
/**
|
||||
* 服务端ID
|
||||
*/
|
||||
@Schema(description = "服务端ID", name = "serverId", example = "")
|
||||
private String serverId;
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.standalone.application.command.netty.client.blacklist;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyRemoveCommand;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* describe 客户端黑名单
|
||||
*
|
||||
* @author Jia wei Wu
|
||||
* @date 2023/12/27 03:46 下午
|
||||
* @see DefaultDDDLazyRemoveCommand
|
||||
**/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Schema(title = "lazy_netty_client_blacklist_remove_command", description = "客户端黑名单")
|
||||
public class LazyNettyClientBlacklistRemoveCommand {
|
||||
|
||||
|
||||
/**
|
||||
* 客户端ID
|
||||
*/
|
||||
@Schema(description = "客户端ID", name = "clientId", example = "")
|
||||
private String clientId;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Schema(description = "创建时间", name = "createTime", example = "")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@Schema(description = "主键", name = "id", example = "")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
@Schema(description = "是否删除", name = "isDeleted", example = "")
|
||||
private Boolean isDeleted;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@Schema(description = "更新时间", name = "updateTime", example = "")
|
||||
private LocalDateTime updateTime;
|
||||
/**
|
||||
* 服务端ID
|
||||
*/
|
||||
@Schema(description = "服务端ID", name = "serverId", example = "")
|
||||
private String serverId;
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.standalone.application.command.netty.client.blacklist;
|
||||
|
||||
|
||||
import org.wu.framework.web.response.mark.ValidType;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyStoryCommand;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* describe 客户端黑名单
|
||||
*
|
||||
* @author Jia wei Wu
|
||||
* @date 2023/12/27 03:46 下午
|
||||
* @see DefaultDDDLazyStoryCommand
|
||||
**/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Schema(title = "lazy_netty_client_blacklist_story_command", description = "客户端黑名单")
|
||||
public class LazyNettyClientBlacklistStoryCommand {
|
||||
|
||||
|
||||
/**
|
||||
* 客户端ID
|
||||
*/
|
||||
@NotNull(groups = ValidType.Create.class, message = "客户端ID不允许为空")
|
||||
@Schema(description = "客户端ID", name = "clientId", example = "")
|
||||
private String clientId;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Schema(description = "创建时间", name = "createTime", example = "")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@Schema(description = "主键", name = "id", example = "")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
@Schema(description = "是否删除", name = "isDeleted", example = "")
|
||||
private Boolean isDeleted;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@Schema(description = "更新时间", name = "updateTime", example = "")
|
||||
private LocalDateTime updateTime; /**
|
||||
* 服务端ID
|
||||
*/
|
||||
@Schema(description = "服务端ID", name = "serverId", example = "")
|
||||
private String serverId;
|
||||
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.standalone.application.command.netty.client.blacklist;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyUpdateCommand;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* describe 客户端黑名单
|
||||
*
|
||||
* @author Jia wei Wu
|
||||
* @date 2023/12/27 03:46 下午
|
||||
* @see DefaultDDDLazyUpdateCommand
|
||||
**/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Schema(title = "lazy_netty_client_blacklist_update_command", description = "客户端黑名单")
|
||||
public class LazyNettyClientBlacklistUpdateCommand {
|
||||
|
||||
|
||||
/**
|
||||
* 客户端ID
|
||||
*/
|
||||
@Schema(description = "客户端ID", name = "clientId", example = "")
|
||||
private String clientId;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Schema(description = "创建时间", name = "createTime", example = "")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@Schema(description = "主键", name = "id", example = "")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
@Schema(description = "是否删除", name = "isDeleted", example = "")
|
||||
private Boolean isDeleted;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@Schema(description = "更新时间", name = "updateTime", example = "")
|
||||
private LocalDateTime updateTime; /**
|
||||
* 服务端ID
|
||||
*/
|
||||
@Schema(description = "服务端ID", name = "serverId", example = "")
|
||||
private String serverId;
|
||||
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.standalone.application.command.netty.client.state;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyRemoveCommand;
|
||||
|
||||
/**
|
||||
* describe 发送请求到客户端
|
||||
*
|
||||
* @author Jia wei Wu
|
||||
* @date 2023/12/27 03:46 下午
|
||||
* @see DefaultDDDLazyRemoveCommand
|
||||
**/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Schema(title = "netty_client_message_command", description = "客户端状态")
|
||||
public class LazyNettyClientMessageCommand {
|
||||
|
||||
|
||||
/**
|
||||
* 客户端ID
|
||||
*/
|
||||
@Schema(description = "客户端ID", name = "clientId", example = "")
|
||||
private String clientId;
|
||||
|
||||
|
||||
/**
|
||||
* 发送的消息
|
||||
*/
|
||||
@Schema(description = "发送的消息", name = "message", example = "")
|
||||
private String message; /**
|
||||
* 服务端ID
|
||||
*/
|
||||
@Schema(description = "服务端ID", name = "serverId", example = "")
|
||||
private String serverId;
|
||||
|
||||
}
|
@ -0,0 +1,75 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.standalone.application.command.netty.client.state;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyQueryListCommand;
|
||||
import org.framework.smart.agent.network.heartbeat.common.enums.NettyClientStatus;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* describe 客户端状态
|
||||
*
|
||||
* @author Jia wei Wu
|
||||
* @date 2023/12/27 03:46 下午
|
||||
* @see DefaultDDDLazyQueryListCommand
|
||||
**/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Schema(title = "lazy_netty_client_state_query_List_command", description = "客户端状态")
|
||||
public class LazyNettyClientStateQueryListCommand {
|
||||
|
||||
|
||||
/**
|
||||
* 客户端ID
|
||||
*/
|
||||
@Schema(description = "客户端ID", name = "clientId", example = "")
|
||||
private String clientId;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Schema(description = "创建时间", name = "createTime", example = "")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@Schema(description = "主键", name = "id", example = "")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
@Schema(description = "是否删除", name = "isDeleted", example = "")
|
||||
private Boolean isDeleted;
|
||||
|
||||
/**
|
||||
* 在线状态(true在线,false离线)
|
||||
*/
|
||||
@Schema(description = "在线状态(true在线,false离线)", name = "onLineState", example = "")
|
||||
private NettyClientStatus onLineState;
|
||||
|
||||
/**
|
||||
* 暂存状态(开启、关闭)
|
||||
*/
|
||||
@Schema(description = "暂存状态(开启、关闭)", name = "staging", example = "")
|
||||
private String stagingState;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@Schema(description = "修改时间", name = "updateTime", example = "")
|
||||
private LocalDateTime updateTime;
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
@Schema(description = "描述", name = "describe", example = "")
|
||||
private String describe; /**
|
||||
* 服务端ID
|
||||
*/
|
||||
@Schema(description = "服务端ID", name = "serverId", example = "")
|
||||
private String serverId;
|
||||
|
||||
}
|
@ -0,0 +1,75 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.standalone.application.command.netty.client.state;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyQueryOneCommand;
|
||||
import org.framework.smart.agent.network.heartbeat.common.enums.NettyClientStatus;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* describe 客户端状态
|
||||
*
|
||||
* @author Jia wei Wu
|
||||
* @date 2023/12/27 03:46 下午
|
||||
* @see DefaultDDDLazyQueryOneCommand
|
||||
**/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Schema(title = "lazy_netty_client_state_query_one_command", description = "客户端状态")
|
||||
public class LazyNettyClientStateQueryOneCommand {
|
||||
|
||||
|
||||
/**
|
||||
* 客户端ID
|
||||
*/
|
||||
@Schema(description = "客户端ID", name = "clientId", example = "")
|
||||
private String clientId;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Schema(description = "创建时间", name = "createTime", example = "")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@Schema(description = "主键", name = "id", example = "")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
@Schema(description = "是否删除", name = "isDeleted", example = "")
|
||||
private Boolean isDeleted;
|
||||
|
||||
/**
|
||||
* 在线状态(true在线,false离线)
|
||||
*/
|
||||
@Schema(description = "在线状态(true在线,false离线)", name = "onLineState", example = "")
|
||||
private NettyClientStatus onLineState;
|
||||
|
||||
/**
|
||||
* 暂存状态(开启、关闭)
|
||||
*/
|
||||
@Schema(description = "暂存状态(开启、关闭)", name = "staging", example = "")
|
||||
private String stagingState;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@Schema(description = "修改时间", name = "updateTime", example = "")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
@Schema(description = "描述", name = "describe", example = "")
|
||||
private String describe; /**
|
||||
* 服务端ID
|
||||
*/
|
||||
@Schema(description = "服务端ID", name = "serverId", example = "")
|
||||
private String serverId;
|
||||
}
|
@ -0,0 +1,70 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.standalone.application.command.netty.client.state;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyRemoveCommand;
|
||||
import org.framework.smart.agent.network.heartbeat.common.enums.NettyClientStatus;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* describe 客户端状态
|
||||
*
|
||||
* @author Jia wei Wu
|
||||
* @date 2023/12/27 03:46 下午
|
||||
* @see DefaultDDDLazyRemoveCommand
|
||||
**/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Schema(title = "lazy_netty_client_state_remove_command", description = "客户端状态")
|
||||
public class LazyNettyClientStateRemoveCommand {
|
||||
|
||||
|
||||
/**
|
||||
* 客户端ID
|
||||
*/
|
||||
@Schema(description = "客户端ID", name = "clientId", example = "")
|
||||
private String clientId;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Schema(description = "创建时间", name = "createTime", example = "")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@Schema(description = "主键", name = "id", example = "")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
@Schema(description = "是否删除", name = "isDeleted", example = "")
|
||||
private Boolean isDeleted;
|
||||
|
||||
/**
|
||||
* 在线状态(true在线,false离线)
|
||||
*/
|
||||
@Schema(description = "在线状态(true在线,false离线)", name = "onLineState", example = "")
|
||||
private NettyClientStatus onLineState;
|
||||
|
||||
/**
|
||||
* 暂存状态(开启、关闭)
|
||||
*/
|
||||
@Schema(description = "暂存状态(开启、关闭)", name = "staging", example = "")
|
||||
private String stagingState;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@Schema(description = "修改时间", name = "updateTime", example = "")
|
||||
private LocalDateTime updateTime; /**
|
||||
* 服务端ID
|
||||
*/
|
||||
@Schema(description = "服务端ID", name = "serverId", example = "")
|
||||
private String serverId;
|
||||
|
||||
}
|
@ -0,0 +1,75 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.standalone.application.command.netty.client.state;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyStoryCommand;
|
||||
import org.framework.smart.agent.network.heartbeat.common.enums.NettyClientStatus;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* describe 客户端状态
|
||||
*
|
||||
* @author Jia wei Wu
|
||||
* @date 2023/12/27 03:46 下午
|
||||
* @see DefaultDDDLazyStoryCommand
|
||||
**/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Schema(title = "lazy_netty_client_state_story_command", description = "客户端状态")
|
||||
public class LazyNettyClientStateStoryCommand {
|
||||
|
||||
|
||||
/**
|
||||
* 客户端ID
|
||||
*/
|
||||
@Schema(description = "客户端ID", name = "clientId", example = "")
|
||||
private String clientId;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Schema(description = "创建时间", name = "createTime", example = "")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@Schema(description = "主键", name = "id", example = "")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
@Schema(description = "是否删除", name = "isDeleted", example = "")
|
||||
private Boolean isDeleted;
|
||||
|
||||
/**
|
||||
* 在线状态(true在线,false离线)
|
||||
*/
|
||||
@Schema(description = "在线状态(true在线,false离线)", name = "onLineState", example = "")
|
||||
private NettyClientStatus onLineState;
|
||||
|
||||
/**
|
||||
* 暂存状态(开启、关闭)
|
||||
*/
|
||||
@Schema(description = "暂存状态(开启、关闭)", name = "staging", example = "")
|
||||
private String stagingState;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@Schema(description = "修改时间", name = "updateTime", example = "")
|
||||
private LocalDateTime updateTime;
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
@Schema(description = "描述", name = "describe", example = "")
|
||||
private String describe; /**
|
||||
* 服务端ID
|
||||
*/
|
||||
@Schema(description = "服务端ID", name = "serverId", example = "")
|
||||
private String serverId;
|
||||
|
||||
}
|
@ -0,0 +1,74 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.standalone.application.command.netty.client.state;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyUpdateCommand;
|
||||
import org.framework.smart.agent.network.heartbeat.common.enums.NettyClientStatus;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* describe 客户端状态
|
||||
*
|
||||
* @author Jia wei Wu
|
||||
* @date 2023/12/27 03:46 下午
|
||||
* @see DefaultDDDLazyUpdateCommand
|
||||
**/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Schema(title = "lazy_netty_client_state_update_command", description = "客户端状态")
|
||||
public class LazyNettyClientStateUpdateCommand {
|
||||
|
||||
|
||||
/**
|
||||
* 客户端ID
|
||||
*/
|
||||
@Schema(description = "客户端ID", name = "clientId", example = "")
|
||||
private String clientId;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Schema(description = "创建时间", name = "createTime", example = "")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@Schema(description = "主键", name = "id", example = "")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
@Schema(description = "是否删除", name = "isDeleted", example = "")
|
||||
private Boolean isDeleted;
|
||||
|
||||
/**
|
||||
* 在线状态(true在线,false离线)
|
||||
*/
|
||||
@Schema(description = "在线状态(true在线,false离线)", name = "onLineState", example = "")
|
||||
private NettyClientStatus onLineState;
|
||||
|
||||
/**
|
||||
* 暂存状态(开启、关闭)
|
||||
*/
|
||||
@Schema(description = "暂存状态(开启、关闭)", name = "staging", example = "")
|
||||
private String stagingState;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@Schema(description = "修改时间", name = "updateTime", example = "")
|
||||
private LocalDateTime updateTime;
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
@Schema(description = "描述", name = "describe", example = "")
|
||||
private String describe; /**
|
||||
* 服务端ID
|
||||
*/
|
||||
@Schema(description = "服务端ID", name = "serverId", example = "")
|
||||
private String serverId;
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.standalone.application.command.netty.server.visitor;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyQueryListCommand;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* describe 服务端提前开放出来的端口
|
||||
*
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/01/16 02:21 下午
|
||||
* @see DefaultDDDLazyQueryListCommand
|
||||
**/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Schema(title = "lazy_netty_server_visitor_query_List_command", description = "服务端提前开放出来的端口")
|
||||
public class LazyNettyServerVisitorQueryListCommand {
|
||||
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Schema(description = "创建时间", name = "createTime", example = "")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
@Schema(description = "描述", name = "describe", example = "")
|
||||
private String describe;
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
@Schema(description = "用户ID", name = "id", example = "")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
@Schema(description = "是否删除", name = "isDeleted", example = "")
|
||||
private Boolean isDeleted;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@Schema(description = "更新时间", name = "updateTime", example = "")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 访客端口
|
||||
*/
|
||||
@Schema(description = "访客端口", name = "visitorPort", example = "")
|
||||
private Integer visitorPort; /**
|
||||
* 服务端ID
|
||||
*/
|
||||
@Schema(description = "服务端ID", name = "serverId", example = "")
|
||||
private String serverId;
|
||||
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.standalone.application.command.netty.server.visitor;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyQueryOneCommand;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* describe 服务端提前开放出来的端口
|
||||
*
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/01/16 02:21 下午
|
||||
* @see DefaultDDDLazyQueryOneCommand
|
||||
**/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Schema(title = "lazy_netty_server_visitor_query_one_command", description = "服务端提前开放出来的端口")
|
||||
public class LazyNettyServerVisitorQueryOneCommand {
|
||||
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Schema(description = "创建时间", name = "createTime", example = "")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
@Schema(description = "描述", name = "describe", example = "")
|
||||
private String describe;
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
@Schema(description = "用户ID", name = "id", example = "")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
@Schema(description = "是否删除", name = "isDeleted", example = "")
|
||||
private Boolean isDeleted;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@Schema(description = "更新时间", name = "updateTime", example = "")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 访客端口
|
||||
*/
|
||||
@Schema(description = "访客端口", name = "visitorPort", example = "")
|
||||
private Integer visitorPort;
|
||||
/**
|
||||
* 服务端ID
|
||||
*/
|
||||
@Schema(description = "服务端ID", name = "serverId", example = "")
|
||||
private String serverId;
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.standalone.application.command.netty.server.visitor;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyRemoveCommand;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* describe 服务端提前开放出来的端口
|
||||
*
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/01/16 02:21 下午
|
||||
* @see DefaultDDDLazyRemoveCommand
|
||||
**/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Schema(title = "lazy_netty_server_visitor_remove_command", description = "服务端提前开放出来的端口")
|
||||
public class LazyNettyServerVisitorRemoveCommand {
|
||||
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Schema(description = "创建时间", name = "createTime", example = "")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
@Schema(description = "描述", name = "describe", example = "")
|
||||
private String describe;
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
@Schema(description = "用户ID", name = "id", example = "")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
@Schema(description = "是否删除", name = "isDeleted", example = "")
|
||||
private Boolean isDeleted;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@Schema(description = "更新时间", name = "updateTime", example = "")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 访客端口
|
||||
*/
|
||||
@Schema(description = "访客端口", name = "visitorPort", example = "")
|
||||
private Integer visitorPort;
|
||||
/**
|
||||
* 服务端ID
|
||||
*/
|
||||
@Schema(description = "服务端ID", name = "serverId", example = "")
|
||||
private String serverId;
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.standalone.application.command.netty.server.visitor;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyStoryCommand;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* describe 服务端提前开放出来的端口
|
||||
*
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/01/16 02:21 下午
|
||||
* @see DefaultDDDLazyStoryCommand
|
||||
**/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Schema(title = "lazy_netty_server_visitor_story_command", description = "服务端提前开放出来的端口")
|
||||
public class LazyNettyServerVisitorStoryCommand {
|
||||
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Schema(description = "创建时间", name = "createTime", example = "")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
@Schema(description = "描述", name = "describe", example = "")
|
||||
private String describe;
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
@Schema(description = "用户ID", name = "id", example = "")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
@Schema(description = "是否删除", name = "isDeleted", example = "")
|
||||
private Boolean isDeleted;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@Schema(description = "更新时间", name = "updateTime", example = "")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 访客端口
|
||||
*/
|
||||
@Schema(description = "访客端口", name = "visitorPort", example = "")
|
||||
private Integer visitorPort;
|
||||
/**
|
||||
* 服务端ID
|
||||
*/
|
||||
@Schema(description = "服务端ID", name = "serverId", example = "")
|
||||
private String serverId;
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.standalone.application.command.netty.server.visitor;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyUpdateCommand;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* describe 服务端提前开放出来的端口
|
||||
*
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/01/16 02:21 下午
|
||||
* @see DefaultDDDLazyUpdateCommand
|
||||
**/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Schema(title = "lazy_netty_server_visitor_update_command", description = "服务端提前开放出来的端口")
|
||||
public class LazyNettyServerVisitorUpdateCommand {
|
||||
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Schema(description = "创建时间", name = "createTime", example = "")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
@Schema(description = "描述", name = "describe", example = "")
|
||||
private String describe;
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
@Schema(description = "用户ID", name = "id", example = "")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
@Schema(description = "是否删除", name = "isDeleted", example = "")
|
||||
private Boolean isDeleted;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@Schema(description = "更新时间", name = "updateTime", example = "")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 访客端口
|
||||
*/
|
||||
@Schema(description = "访客端口", name = "visitorPort", example = "")
|
||||
private Integer visitorPort;
|
||||
/**
|
||||
* 服务端ID
|
||||
*/
|
||||
@Schema(description = "服务端ID", name = "serverId", example = "")
|
||||
private String serverId;
|
||||
}
|
@ -0,0 +1,75 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.standalone.application.command.visitor.flow;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyQueryListCommand;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* describe 访客端流量
|
||||
*
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/01/24 05:19 下午
|
||||
* @see DefaultDDDLazyQueryListCommand
|
||||
**/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Schema(title = "lazy_visitor_port_flow_query_List_command", description = "访客端流量")
|
||||
public class LazyVisitorPortFlowQueryListCommand {
|
||||
|
||||
|
||||
/**
|
||||
* 客户端ID
|
||||
*/
|
||||
@Schema(description = "客户端ID", name = "clientId", example = "")
|
||||
private String clientId;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Schema(description = "创建时间", name = "createTime", example = "")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@Schema(description = "主键", name = "id", example = "")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 当前访客当前进口流量
|
||||
*/
|
||||
@Schema(description = "当前访客当前进口流量", name = "inFlow", example = "")
|
||||
private Integer inFlow;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
@Schema(description = "是否删除", name = "isDeleted", example = "")
|
||||
private Boolean isDeleted;
|
||||
|
||||
/**
|
||||
* 当前访客出口流量
|
||||
*/
|
||||
@Schema(description = "当前访客出口流量", name = "outFlow", example = "")
|
||||
private Integer outFlow;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@Schema(description = "修改时间", name = "updateTime", example = "")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 访客端口
|
||||
*/
|
||||
@Schema(description = "访客端口", name = "visitorPort", example = "")
|
||||
private Integer visitorPort; /**
|
||||
* 服务端ID
|
||||
*/
|
||||
@Schema(description = "服务端ID", name = "serverId", example = "")
|
||||
private String serverId;
|
||||
|
||||
}
|
@ -0,0 +1,75 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.standalone.application.command.visitor.flow;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyQueryOneCommand;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* describe 访客端流量
|
||||
*
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/01/24 05:19 下午
|
||||
* @see DefaultDDDLazyQueryOneCommand
|
||||
**/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Schema(title = "lazy_visitor_port_flow_query_one_command", description = "访客端流量")
|
||||
public class LazyVisitorPortFlowQueryOneCommand {
|
||||
|
||||
|
||||
/**
|
||||
* 客户端ID
|
||||
*/
|
||||
@Schema(description = "客户端ID", name = "clientId", example = "")
|
||||
private String clientId;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Schema(description = "创建时间", name = "createTime", example = "")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@Schema(description = "主键", name = "id", example = "")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 当前访客当前进口流量
|
||||
*/
|
||||
@Schema(description = "当前访客当前进口流量", name = "inFlow", example = "")
|
||||
private Integer inFlow;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
@Schema(description = "是否删除", name = "isDeleted", example = "")
|
||||
private Boolean isDeleted;
|
||||
|
||||
/**
|
||||
* 当前访客出口流量
|
||||
*/
|
||||
@Schema(description = "当前访客出口流量", name = "outFlow", example = "")
|
||||
private Integer outFlow;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@Schema(description = "修改时间", name = "updateTime", example = "")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 访客端口
|
||||
*/
|
||||
@Schema(description = "访客端口", name = "visitorPort", example = "")
|
||||
private Integer visitorPort;
|
||||
/**
|
||||
* 服务端ID
|
||||
*/
|
||||
@Schema(description = "服务端ID", name = "serverId", example = "")
|
||||
private String serverId;
|
||||
}
|
@ -0,0 +1,75 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.standalone.application.command.visitor.flow;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyRemoveCommand;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* describe 访客端流量
|
||||
*
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/01/24 05:19 下午
|
||||
* @see DefaultDDDLazyRemoveCommand
|
||||
**/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Schema(title = "lazy_visitor_port_flow_remove_command", description = "访客端流量")
|
||||
public class LazyVisitorPortFlowRemoveCommand {
|
||||
|
||||
|
||||
/**
|
||||
* 客户端ID
|
||||
*/
|
||||
@Schema(description = "客户端ID", name = "clientId", example = "")
|
||||
private String clientId;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Schema(description = "创建时间", name = "createTime", example = "")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@Schema(description = "主键", name = "id", example = "")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 当前访客当前进口流量
|
||||
*/
|
||||
@Schema(description = "当前访客当前进口流量", name = "inFlow", example = "")
|
||||
private Integer inFlow;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
@Schema(description = "是否删除", name = "isDeleted", example = "")
|
||||
private Boolean isDeleted;
|
||||
|
||||
/**
|
||||
* 当前访客出口流量
|
||||
*/
|
||||
@Schema(description = "当前访客出口流量", name = "outFlow", example = "")
|
||||
private Integer outFlow;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@Schema(description = "修改时间", name = "updateTime", example = "")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 访客端口
|
||||
*/
|
||||
@Schema(description = "访客端口", name = "visitorPort", example = "")
|
||||
private Integer visitorPort; /**
|
||||
* 服务端ID
|
||||
*/
|
||||
@Schema(description = "服务端ID", name = "serverId", example = "")
|
||||
private String serverId;
|
||||
|
||||
}
|
@ -0,0 +1,75 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.standalone.application.command.visitor.flow;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyStoryCommand;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* describe 访客端流量
|
||||
*
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/01/24 05:19 下午
|
||||
* @see DefaultDDDLazyStoryCommand
|
||||
**/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Schema(title = "lazy_visitor_port_flow_story_command", description = "访客端流量")
|
||||
public class LazyVisitorPortFlowStoryCommand {
|
||||
|
||||
|
||||
/**
|
||||
* 客户端ID
|
||||
*/
|
||||
@Schema(description = "客户端ID", name = "clientId", example = "")
|
||||
private String clientId;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Schema(description = "创建时间", name = "createTime", example = "")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@Schema(description = "主键", name = "id", example = "")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 当前访客当前进口流量
|
||||
*/
|
||||
@Schema(description = "当前访客当前进口流量", name = "inFlow", example = "")
|
||||
private Integer inFlow;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
@Schema(description = "是否删除", name = "isDeleted", example = "")
|
||||
private Boolean isDeleted;
|
||||
|
||||
/**
|
||||
* 当前访客出口流量
|
||||
*/
|
||||
@Schema(description = "当前访客出口流量", name = "outFlow", example = "")
|
||||
private Integer outFlow;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@Schema(description = "修改时间", name = "updateTime", example = "")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 访客端口
|
||||
*/
|
||||
@Schema(description = "访客端口", name = "visitorPort", example = "")
|
||||
private Integer visitorPort; /**
|
||||
* 服务端ID
|
||||
*/
|
||||
@Schema(description = "服务端ID", name = "serverId", example = "")
|
||||
private String serverId;
|
||||
|
||||
}
|
@ -0,0 +1,75 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.standalone.application.command.visitor.flow;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyUpdateCommand;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* describe 访客端流量
|
||||
*
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/01/24 05:19 下午
|
||||
* @see DefaultDDDLazyUpdateCommand
|
||||
**/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Schema(title = "lazy_visitor_port_flow_update_command", description = "访客端流量")
|
||||
public class LazyVisitorPortFlowUpdateCommand {
|
||||
|
||||
|
||||
/**
|
||||
* 客户端ID
|
||||
*/
|
||||
@Schema(description = "客户端ID", name = "clientId", example = "")
|
||||
private String clientId;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Schema(description = "创建时间", name = "createTime", example = "")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@Schema(description = "主键", name = "id", example = "")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 当前访客当前进口流量
|
||||
*/
|
||||
@Schema(description = "当前访客当前进口流量", name = "inFlow", example = "")
|
||||
private Integer inFlow;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
@Schema(description = "是否删除", name = "isDeleted", example = "")
|
||||
private Boolean isDeleted;
|
||||
|
||||
/**
|
||||
* 当前访客出口流量
|
||||
*/
|
||||
@Schema(description = "当前访客出口流量", name = "outFlow", example = "")
|
||||
private Integer outFlow;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@Schema(description = "修改时间", name = "updateTime", example = "")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 访客端口
|
||||
*/
|
||||
@Schema(description = "访客端口", name = "visitorPort", example = "")
|
||||
private Integer visitorPort; /**
|
||||
* 服务端ID
|
||||
*/
|
||||
@Schema(description = "服务端ID", name = "serverId", example = "")
|
||||
private String serverId;
|
||||
|
||||
}
|
@ -0,0 +1,91 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.standalone.application.command.visitor.port.per.day.flow;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import java.lang.String;
|
||||
import java.time.LocalDateTime;
|
||||
import java.lang.Long;
|
||||
import java.lang.Integer;
|
||||
import java.lang.Boolean;
|
||||
/**
|
||||
* describe 每日统计流量
|
||||
*
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/03/19 09:53 上午
|
||||
* @see org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyQueryListCommand
|
||||
**/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Schema(title = "lazy_visitor_port_per_day_flow_query_List_command",description = "每日统计流量")
|
||||
public class LazyVisitorPortPerDayFlowQueryListCommand {
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* 客户端ID
|
||||
*/
|
||||
@Schema(description ="客户端ID",name ="clientId",example = "")
|
||||
private String clientId;
|
||||
|
||||
/**
|
||||
*
|
||||
* 创建时间
|
||||
*/
|
||||
@Schema(description ="创建时间",name ="createTime",example = "")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
*
|
||||
* 日期
|
||||
*/
|
||||
@Schema(description ="日期",name ="day",example = "")
|
||||
private String day;
|
||||
|
||||
/**
|
||||
*
|
||||
* 主键
|
||||
*/
|
||||
@Schema(description ="主键",name ="id",example = "")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
*
|
||||
* 当前访客当前进口流量
|
||||
*/
|
||||
@Schema(description ="当前访客当前进口流量",name ="inFlow",example = "")
|
||||
private Integer inFlow;
|
||||
|
||||
/**
|
||||
*
|
||||
* 是否删除
|
||||
*/
|
||||
@Schema(description ="是否删除",name ="isDeleted",example = "")
|
||||
private Boolean isDeleted;
|
||||
|
||||
/**
|
||||
*
|
||||
* 当前访客出口流量
|
||||
*/
|
||||
@Schema(description ="当前访客出口流量",name ="outFlow",example = "")
|
||||
private Integer outFlow;
|
||||
|
||||
/**
|
||||
*
|
||||
* 修改时间
|
||||
*/
|
||||
@Schema(description ="修改时间",name ="updateTime",example = "")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
*
|
||||
* 访客端口
|
||||
*/
|
||||
@Schema(description ="访客端口",name ="visitorPort",example = "")
|
||||
private Integer visitorPort; /**
|
||||
* 服务端ID
|
||||
*/
|
||||
@Schema(description = "服务端ID", name = "serverId", example = "")
|
||||
private String serverId;
|
||||
|
||||
}
|
@ -0,0 +1,91 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.standalone.application.command.visitor.port.per.day.flow;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import java.lang.String;
|
||||
import java.time.LocalDateTime;
|
||||
import java.lang.Long;
|
||||
import java.lang.Integer;
|
||||
import java.lang.Boolean;
|
||||
/**
|
||||
* describe 每日统计流量
|
||||
*
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/03/19 09:53 上午
|
||||
* @see org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyQueryOneCommand
|
||||
**/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Schema(title = "lazy_visitor_port_per_day_flow_query_one_command",description = "每日统计流量")
|
||||
public class LazyVisitorPortPerDayFlowQueryOneCommand {
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* 客户端ID
|
||||
*/
|
||||
@Schema(description ="客户端ID",name ="clientId",example = "")
|
||||
private String clientId;
|
||||
|
||||
/**
|
||||
*
|
||||
* 创建时间
|
||||
*/
|
||||
@Schema(description ="创建时间",name ="createTime",example = "")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
*
|
||||
* 日期
|
||||
*/
|
||||
@Schema(description ="日期",name ="day",example = "")
|
||||
private String day;
|
||||
|
||||
/**
|
||||
*
|
||||
* 主键
|
||||
*/
|
||||
@Schema(description ="主键",name ="id",example = "")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
*
|
||||
* 当前访客当前进口流量
|
||||
*/
|
||||
@Schema(description ="当前访客当前进口流量",name ="inFlow",example = "")
|
||||
private Integer inFlow;
|
||||
|
||||
/**
|
||||
*
|
||||
* 是否删除
|
||||
*/
|
||||
@Schema(description ="是否删除",name ="isDeleted",example = "")
|
||||
private Boolean isDeleted;
|
||||
|
||||
/**
|
||||
*
|
||||
* 当前访客出口流量
|
||||
*/
|
||||
@Schema(description ="当前访客出口流量",name ="outFlow",example = "")
|
||||
private Integer outFlow;
|
||||
|
||||
/**
|
||||
*
|
||||
* 修改时间
|
||||
*/
|
||||
@Schema(description ="修改时间",name ="updateTime",example = "")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
*
|
||||
* 访客端口
|
||||
*/
|
||||
@Schema(description ="访客端口",name ="visitorPort",example = "")
|
||||
private Integer visitorPort; /**
|
||||
* 服务端ID
|
||||
*/
|
||||
@Schema(description = "服务端ID", name = "serverId", example = "")
|
||||
private String serverId;
|
||||
|
||||
}
|
@ -0,0 +1,91 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.standalone.application.command.visitor.port.per.day.flow;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import java.lang.String;
|
||||
import java.time.LocalDateTime;
|
||||
import java.lang.Long;
|
||||
import java.lang.Integer;
|
||||
import java.lang.Boolean;
|
||||
/**
|
||||
* describe 每日统计流量
|
||||
*
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/03/19 09:53 上午
|
||||
* @see org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyRemoveCommand
|
||||
**/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Schema(title = "lazy_visitor_port_per_day_flow_remove_command",description = "每日统计流量")
|
||||
public class LazyVisitorPortPerDayFlowRemoveCommand {
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* 客户端ID
|
||||
*/
|
||||
@Schema(description ="客户端ID",name ="clientId",example = "")
|
||||
private String clientId;
|
||||
|
||||
/**
|
||||
*
|
||||
* 创建时间
|
||||
*/
|
||||
@Schema(description ="创建时间",name ="createTime",example = "")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
*
|
||||
* 日期
|
||||
*/
|
||||
@Schema(description ="日期",name ="day",example = "")
|
||||
private String day;
|
||||
|
||||
/**
|
||||
*
|
||||
* 主键
|
||||
*/
|
||||
@Schema(description ="主键",name ="id",example = "")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
*
|
||||
* 当前访客当前进口流量
|
||||
*/
|
||||
@Schema(description ="当前访客当前进口流量",name ="inFlow",example = "")
|
||||
private Integer inFlow;
|
||||
|
||||
/**
|
||||
*
|
||||
* 是否删除
|
||||
*/
|
||||
@Schema(description ="是否删除",name ="isDeleted",example = "")
|
||||
private Boolean isDeleted;
|
||||
|
||||
/**
|
||||
*
|
||||
* 当前访客出口流量
|
||||
*/
|
||||
@Schema(description ="当前访客出口流量",name ="outFlow",example = "")
|
||||
private Integer outFlow;
|
||||
|
||||
/**
|
||||
*
|
||||
* 修改时间
|
||||
*/
|
||||
@Schema(description ="修改时间",name ="updateTime",example = "")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
*
|
||||
* 访客端口
|
||||
*/
|
||||
@Schema(description ="访客端口",name ="visitorPort",example = "")
|
||||
private Integer visitorPort; /**
|
||||
* 服务端ID
|
||||
*/
|
||||
@Schema(description = "服务端ID", name = "serverId", example = "")
|
||||
private String serverId;
|
||||
|
||||
}
|
@ -0,0 +1,91 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.standalone.application.command.visitor.port.per.day.flow;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import java.lang.String;
|
||||
import java.time.LocalDateTime;
|
||||
import java.lang.Long;
|
||||
import java.lang.Integer;
|
||||
import java.lang.Boolean;
|
||||
/**
|
||||
* describe 每日统计流量
|
||||
*
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/03/19 09:53 上午
|
||||
* @see org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyStoryCommand
|
||||
**/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Schema(title = "lazy_visitor_port_per_day_flow_story_command",description = "每日统计流量")
|
||||
public class LazyVisitorPortPerDayFlowStoryCommand {
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* 客户端ID
|
||||
*/
|
||||
@Schema(description ="客户端ID",name ="clientId",example = "")
|
||||
private String clientId;
|
||||
|
||||
/**
|
||||
*
|
||||
* 创建时间
|
||||
*/
|
||||
@Schema(description ="创建时间",name ="createTime",example = "")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
*
|
||||
* 日期
|
||||
*/
|
||||
@Schema(description ="日期",name ="day",example = "")
|
||||
private String day;
|
||||
|
||||
/**
|
||||
*
|
||||
* 主键
|
||||
*/
|
||||
@Schema(description ="主键",name ="id",example = "")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
*
|
||||
* 当前访客当前进口流量
|
||||
*/
|
||||
@Schema(description ="当前访客当前进口流量",name ="inFlow",example = "")
|
||||
private Integer inFlow;
|
||||
|
||||
/**
|
||||
*
|
||||
* 是否删除
|
||||
*/
|
||||
@Schema(description ="是否删除",name ="isDeleted",example = "")
|
||||
private Boolean isDeleted;
|
||||
|
||||
/**
|
||||
*
|
||||
* 当前访客出口流量
|
||||
*/
|
||||
@Schema(description ="当前访客出口流量",name ="outFlow",example = "")
|
||||
private Integer outFlow;
|
||||
|
||||
/**
|
||||
*
|
||||
* 修改时间
|
||||
*/
|
||||
@Schema(description ="修改时间",name ="updateTime",example = "")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
*
|
||||
* 访客端口
|
||||
*/
|
||||
@Schema(description ="访客端口",name ="visitorPort",example = "")
|
||||
private Integer visitorPort; /**
|
||||
* 服务端ID
|
||||
*/
|
||||
@Schema(description = "服务端ID", name = "serverId", example = "")
|
||||
private String serverId;
|
||||
|
||||
}
|
@ -0,0 +1,91 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.standalone.application.command.visitor.port.per.day.flow;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import java.lang.String;
|
||||
import java.time.LocalDateTime;
|
||||
import java.lang.Long;
|
||||
import java.lang.Integer;
|
||||
import java.lang.Boolean;
|
||||
/**
|
||||
* describe 每日统计流量
|
||||
*
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/03/19 09:53 上午
|
||||
* @see org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyUpdateCommand
|
||||
**/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Schema(title = "lazy_visitor_port_per_day_flow_update_command",description = "每日统计流量")
|
||||
public class LazyVisitorPortPerDayFlowUpdateCommand {
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* 客户端ID
|
||||
*/
|
||||
@Schema(description ="客户端ID",name ="clientId",example = "")
|
||||
private String clientId;
|
||||
|
||||
/**
|
||||
*
|
||||
* 创建时间
|
||||
*/
|
||||
@Schema(description ="创建时间",name ="createTime",example = "")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
*
|
||||
* 日期
|
||||
*/
|
||||
@Schema(description ="日期",name ="day",example = "")
|
||||
private String day;
|
||||
|
||||
/**
|
||||
*
|
||||
* 主键
|
||||
*/
|
||||
@Schema(description ="主键",name ="id",example = "")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
*
|
||||
* 当前访客当前进口流量
|
||||
*/
|
||||
@Schema(description ="当前访客当前进口流量",name ="inFlow",example = "")
|
||||
private Integer inFlow;
|
||||
|
||||
/**
|
||||
*
|
||||
* 是否删除
|
||||
*/
|
||||
@Schema(description ="是否删除",name ="isDeleted",example = "")
|
||||
private Boolean isDeleted;
|
||||
|
||||
/**
|
||||
*
|
||||
* 当前访客出口流量
|
||||
*/
|
||||
@Schema(description ="当前访客出口流量",name ="outFlow",example = "")
|
||||
private Integer outFlow;
|
||||
|
||||
/**
|
||||
*
|
||||
* 修改时间
|
||||
*/
|
||||
@Schema(description ="修改时间",name ="updateTime",example = "")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
*
|
||||
* 访客端口
|
||||
*/
|
||||
@Schema(description ="访客端口",name ="visitorPort",example = "")
|
||||
private Integer visitorPort; /**
|
||||
* 服务端ID
|
||||
*/
|
||||
@Schema(description = "服务端ID", name = "serverId", example = "")
|
||||
private String serverId;
|
||||
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.standalone.application.dto;
|
||||
|
||||
import io.netty.channel.Channel;
|
||||
import io.netty.channel.ChannelId;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
/**
|
||||
* 客户端通道
|
||||
*/
|
||||
@Data
|
||||
public class LazyClientChannelDTO {
|
||||
/**
|
||||
* 连接信息
|
||||
*/
|
||||
private String clientId;
|
||||
/**
|
||||
* 通道ID
|
||||
*/
|
||||
private ChannelId channelId;
|
||||
/**
|
||||
* 通道
|
||||
*/
|
||||
private Channel channel;
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.standalone.application.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 获取客户使用流量数据
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class LazyClientFlowPerDayEchartsDTO {
|
||||
|
||||
|
||||
/**
|
||||
* 曲线类型
|
||||
*/
|
||||
private List<String> typeList = List.of("进口流量", "出口流量", "总流量");
|
||||
|
||||
/**
|
||||
* 时间
|
||||
*/
|
||||
private List<String> dayList;
|
||||
/**
|
||||
* 客户端入口流量
|
||||
*/
|
||||
|
||||
private List<Integer> clientInFlowList;
|
||||
/**
|
||||
* 出口流量
|
||||
*/
|
||||
private List<Integer> clientOutFlowList;
|
||||
/**
|
||||
* 全部流量
|
||||
*/
|
||||
private List<Integer> clientAllFlowList;
|
||||
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.standalone.application.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 获取客户使用流量数据
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class LazyClientPortFlowPerDayEchartsDTO {
|
||||
|
||||
|
||||
/**
|
||||
* 客户端ID
|
||||
*/
|
||||
private List<String> clientIdList;
|
||||
|
||||
/**
|
||||
* 时间
|
||||
*/
|
||||
private List<String> dayList;
|
||||
/**
|
||||
* 客户端入口流量
|
||||
*/
|
||||
|
||||
private List<ClientFlow> clientInFlowList;
|
||||
/**
|
||||
* 出口流量
|
||||
*/
|
||||
private List<ClientFlow> clientOutFlowList;
|
||||
|
||||
|
||||
@Data
|
||||
public static final class ClientFlow {
|
||||
|
||||
private String clientId;
|
||||
|
||||
private Integer visitorPort;
|
||||
|
||||
private List<Integer> flowList;
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,82 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.standalone.application.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyDTO;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* describe 内网穿透映射
|
||||
*
|
||||
* @author Jia wei Wu
|
||||
* @date 2023/12/29 05:21 下午
|
||||
* @see DefaultDDDLazyDTO
|
||||
**/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Schema(title = "internal_network_penetration_mapping_command_dto", description = "内网穿透映射")
|
||||
public class LazyInternalNetworkPenetrationMappingDTO {
|
||||
|
||||
|
||||
/**
|
||||
* 客户端ID
|
||||
*/
|
||||
@Schema(description = "客户端ID", name = "clientId", example = "")
|
||||
private String clientId;
|
||||
|
||||
/**
|
||||
* 客户端目标地址
|
||||
*/
|
||||
@Schema(description = "客户端目标地址", name = "clientTargetIp", example = "")
|
||||
private String clientTargetIp;
|
||||
|
||||
/**
|
||||
* 客户端目标端口
|
||||
*/
|
||||
@Schema(description = "客户端目标端口", name = "clientTargetPort", example = "")
|
||||
private Integer clientTargetPort;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
@Schema(description = "创建时间", name = "createTime", example = "")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 主键自增
|
||||
*/
|
||||
@Schema(description = "主键自增", name = "id", example = "")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 是否删除 默认否
|
||||
*/
|
||||
@Schema(description = "是否删除 默认否", name = "isDeleted", example = "")
|
||||
private Boolean isDeleted;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
@Schema(description = "修改时间", name = "updateTime", example = "")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 访问端口
|
||||
*/
|
||||
@Schema(description = "访问端口", name = "visitorPort", example = "")
|
||||
private Integer visitorPort;
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
@Schema(description = "描述", name = "describe", example = "")
|
||||
private String describe; /**
|
||||
* 服务端ID
|
||||
*/
|
||||
@Schema(description = "服务端ID", name = "serverId", example = "")
|
||||
private String serverId;
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.standalone.application.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyDTO;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* describe 客户端黑名单
|
||||
*
|
||||
* @author Jia wei Wu
|
||||
* @date 2023/12/27 03:46 下午
|
||||
* @see DefaultDDDLazyDTO
|
||||
**/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Schema(title = "lazy_netty_client_blacklist_command_dto", description = "客户端黑名单")
|
||||
public class LazyNettyClientBlacklistDTO {
|
||||
|
||||
|
||||
/**
|
||||
* 客户端ID
|
||||
*/
|
||||
@Schema(description = "客户端ID", name = "clientId", example = "")
|
||||
private String clientId;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Schema(description = "创建时间", name = "createTime", example = "")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@Schema(description = "主键", name = "id", example = "")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
@Schema(description = "是否删除", name = "isDeleted", example = "")
|
||||
private Boolean isDeleted;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@Schema(description = "更新时间", name = "updateTime", example = "")
|
||||
private LocalDateTime updateTime;
|
||||
/**
|
||||
* 服务端ID
|
||||
*/
|
||||
@Schema(description = "服务端ID", name = "serverId", example = "")
|
||||
private String serverId;
|
||||
}
|
@ -0,0 +1,76 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.standalone.application.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyDTO;
|
||||
import org.framework.smart.agent.network.heartbeat.common.enums.NettyClientStatus;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* describe 客户端状态
|
||||
*
|
||||
* @author Jia wei Wu
|
||||
* @date 2023/12/27 03:46 下午
|
||||
* @see DefaultDDDLazyDTO
|
||||
**/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Schema(title = "lazy_netty_client_state_command_dto", description = "客户端状态")
|
||||
public class LazyNettyClientStateDTO {
|
||||
|
||||
|
||||
/**
|
||||
* 客户端ID
|
||||
*/
|
||||
@Schema(description = "客户端ID", name = "clientId", example = "")
|
||||
private String clientId;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Schema(description = "创建时间", name = "createTime", example = "")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@Schema(description = "主键", name = "id", example = "")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
@Schema(description = "是否删除", name = "isDeleted", example = "")
|
||||
private Boolean isDeleted;
|
||||
|
||||
/**
|
||||
* 在线状态(true在线,false离线)
|
||||
*/
|
||||
@Schema(description = "在线状态(true在线,false离线)", name = "onLineState", example = "")
|
||||
private NettyClientStatus onLineState;
|
||||
|
||||
/**
|
||||
* 暂存状态(开启、关闭)
|
||||
*/
|
||||
@Schema(description = "暂存状态(开启、关闭)", name = "staging", example = "")
|
||||
private String stagingState;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@Schema(description = "修改时间", name = "updateTime", example = "")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
@Schema(description = "描述", name = "describe", example = "")
|
||||
private String describe; /**
|
||||
* 服务端ID
|
||||
*/
|
||||
@Schema(description = "服务端ID", name = "serverId", example = "")
|
||||
private String serverId;
|
||||
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.standalone.application.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyDTO;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* describe 服务端提前开放出来的端口
|
||||
*
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/01/16 02:21 下午
|
||||
* @see DefaultDDDLazyDTO
|
||||
**/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Schema(title = "lazy_netty_server_visitor_command_dto", description = "服务端提前开放出来的端口")
|
||||
public class LazyNettyServerVisitorDTO {
|
||||
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Schema(description = "创建时间", name = "createTime", example = "")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
@Schema(description = "描述", name = "describe", example = "")
|
||||
private String describe;
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
@Schema(description = "用户ID", name = "id", example = "")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
@Schema(description = "是否删除", name = "isDeleted", example = "")
|
||||
private Boolean isDeleted;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@Schema(description = "更新时间", name = "updateTime", example = "")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 访客端口
|
||||
*/
|
||||
@Schema(description = "访客端口", name = "visitorPort", example = "")
|
||||
private Integer visitorPort; /**
|
||||
* 服务端ID
|
||||
*/
|
||||
@Schema(description = "服务端ID", name = "serverId", example = "")
|
||||
private String serverId;
|
||||
|
||||
}
|
@ -0,0 +1,80 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.standalone.application.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.wu.framework.core.utils.ByteSizeUtil;
|
||||
import org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyDTO;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* describe 访客端流量
|
||||
*
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/01/24 05:19 下午
|
||||
* @see DefaultDDDLazyDTO
|
||||
**/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Schema(title = "lazy_visitor_port_flow_command_dto", description = "访客端流量")
|
||||
public class LazyVisitorFlowDTO {
|
||||
|
||||
|
||||
/**
|
||||
* 客户端ID
|
||||
*/
|
||||
@Schema(description = "客户端ID", name = "clientId", example = "")
|
||||
private String clientId;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Schema(description = "创建时间", name = "createTime", example = "")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@Schema(description = "主键", name = "id", example = "")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 当前访客当前进口流量
|
||||
*/
|
||||
@Schema(description = "当前访客当前进口流量", name = "inFlow", example = "")
|
||||
private Integer inFlow;
|
||||
|
||||
|
||||
/**
|
||||
* 当前访客出口流量
|
||||
*/
|
||||
@Schema(description = "当前访客出口流量", name = "outFlow", example = "")
|
||||
private Integer outFlow;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@Schema(description = "修改时间", name = "updateTime", example = "")
|
||||
private LocalDateTime updateTime;
|
||||
/**
|
||||
* 服务端ID
|
||||
*/
|
||||
@Schema(description = "服务端ID", name = "serverId", example = "")
|
||||
private String serverId;
|
||||
/**
|
||||
* 当前访客下所有端口的流量
|
||||
*/
|
||||
@Schema(description = "当前访客下所有端口的流量")
|
||||
private List<LazyVisitorPortFlowDTO> lazyVisitorPortFlowDTOList;
|
||||
|
||||
|
||||
public String getInFlow() {
|
||||
return ByteSizeUtil.convertSize(inFlow);
|
||||
}
|
||||
|
||||
public String getOutFlow() {
|
||||
return ByteSizeUtil.convertSize(outFlow);
|
||||
}
|
||||
}
|
@ -0,0 +1,96 @@
|
||||
package org.framework.smart.agent.network.heartbeat.server.standalone.application.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.wu.framework.core.utils.ByteSizeUtil;
|
||||
import org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyDTO;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* describe 访客端流量
|
||||
*
|
||||
* @author Jia wei Wu
|
||||
* @date 2024/01/24 05:19 下午
|
||||
* @see DefaultDDDLazyDTO
|
||||
**/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Schema(title = "lazy_visitor_port_flow_command_dto", description = "访客端流量")
|
||||
public class LazyVisitorPortFlowDTO {
|
||||
|
||||
|
||||
/**
|
||||
* 客户端ID
|
||||
*/
|
||||
@Schema(description = "客户端ID", name = "clientId", example = "")
|
||||
private String clientId;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Schema(description = "创建时间", name = "createTime", example = "")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@Schema(description = "主键", name = "id", example = "")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 当前访客当前进口流量
|
||||
*/
|
||||
@Schema(description = "当前访客当前进口流量", name = "inFlow", example = "")
|
||||
private Integer inFlow;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
@Schema(description = "是否删除", name = "isDeleted", example = "")
|
||||
private Boolean isDeleted;
|
||||
|
||||
/**
|
||||
* 当前访客出口流量
|
||||
*/
|
||||
@Schema(description = "当前访客出口流量", name = "outFlow", example = "")
|
||||
private Integer outFlow;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@Schema(description = "修改时间", name = "updateTime", example = "")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 访客端口
|
||||
*/
|
||||
@Schema(description = "访客端口", name = "visitorPort", example = "")
|
||||
private Integer visitorPort; /**
|
||||
* 服务端ID
|
||||
*/
|
||||
@Schema(description = "服务端ID", name = "serverId", example = "")
|
||||
private String serverId;
|
||||
|
||||
public Integer getInFlowSize() {
|
||||
if (inFlow == null) return 0;
|
||||
return inFlow;
|
||||
}
|
||||
|
||||
public Integer getOutFlowSize() {
|
||||
if (outFlow == null) return 0;
|
||||
return outFlow;
|
||||
}
|
||||
|
||||
public String getInFlow() {
|
||||
if (inFlow == null) return "0b";
|
||||
return ByteSizeUtil.convertSize(inFlow);
|
||||
}
|
||||
|
||||
public String getOutFlow() {
|
||||
if (outFlow == null) return "0b";
|
||||
return ByteSizeUtil.convertSize(outFlow);
|
||||
}
|
||||
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user