Compare commits
62 Commits
1.2.7-JDK1
...
1.2.9-JDK1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cb4c9c0b41 | ||
|
|
0ceb88bfe3 | ||
|
|
42bc37c712 | ||
|
|
41a81133f1 | ||
|
|
ddaa5568e0 | ||
|
|
9b64c622cc | ||
|
|
f11200cee9 | ||
|
|
0f04f29cd0 | ||
|
|
3568292ac2 | ||
|
|
1924e87c7d | ||
|
|
30e1141ecf | ||
|
|
79b09ecfea | ||
|
|
5a079fcba8 | ||
|
|
20bb29350c | ||
|
|
ea2fb01b7e | ||
|
|
ba960a70ab | ||
|
|
4de7cdb6be | ||
|
|
1c6f56d31e | ||
|
|
8952d2277f | ||
|
|
dab6e580e4 | ||
|
|
9edb6f3d4d | ||
|
|
3740a4f4ea | ||
|
|
3b57ee1c23 | ||
|
|
b76f7a8f62 | ||
|
|
aa056dbe07 | ||
|
|
810579178f | ||
|
|
240de53888 | ||
|
|
2eb6dc2775 | ||
|
|
c665bf687d | ||
|
|
1e2f58b5a3 | ||
|
|
381f8a6960 | ||
|
|
a04499ab4b | ||
|
|
477d8cfaac | ||
|
|
b2cd1eee0a | ||
|
|
b7d571ccc1 | ||
|
|
55ce3ff359 | ||
|
|
42e8e5afec | ||
|
|
4977348113 | ||
|
|
89f9207367 | ||
|
|
70cf9fe3ac | ||
|
|
ecd5288929 | ||
|
|
571fe7893d | ||
|
|
1e89813793 | ||
|
|
0dd5b986a2 | ||
|
|
67c2537823 | ||
|
|
8dc1272109 | ||
|
|
9ae2f162e2 | ||
|
|
c2a4926888 | ||
|
|
a5176c3cf1 | ||
|
|
600706ccc1 | ||
|
|
fb086d6e95 | ||
|
|
98811a18c3 | ||
|
|
0493c1ce5e | ||
|
|
dd6daa5421 | ||
|
|
6c7f6b807f | ||
|
|
97f50d1701 | ||
|
|
5e3216a2a4 | ||
|
|
68d9713cf9 | ||
|
|
2d15abcc9f | ||
|
|
ec4c1cd7e4 | ||
|
|
bab2ce0242 | ||
|
|
6408239029 |
25
ClientPermeateClient.md
Normal file
@@ -0,0 +1,25 @@
|
||||
|
||||
### 背景:国庆期间的问题,如何在老家访问杭州办公室的网络呢
|
||||
#### 实现方案:异地组网
|
||||
#### 实现语言:Java
|
||||
#### 环境:三个网络,一台拥有公网IP的服务器、一台杭州本地机房内服务器、你老家所在网络中的一台电脑(用你自己的就好了)
|
||||
#### 实现原理:
|
||||
|
||||
#### 操作步骤:拥有公网ip的服务器开发6001(web)、7001端口(tcp),然后执行命令启动服务端
|
||||
```shell
|
||||
docker run -d -it -p 6001:6001 -p 7001:7001 -e spring.profiles.active=prod -e MAIN_DB_HOST=localhost:3306 -e MAIN_DB_PASSWORD=root -e MAIN_DB_PASSWORD=root --name wu-lazy-cloud-heartbeat-server-start registry.cn-hangzhou.aliyuncs.com/wu-lazy/wu-lazy-cloud-heartbeat-server-start:1.2.9-JDK17-SNAPSHOT
|
||||
```
|
||||
|
||||
#### 操作步骤:杭州本地机房所在网络服务器启动客户端、你老家所在网络中启动客户端,命令如下
|
||||
```shell
|
||||
docker run -d -it --privileged --name hangzhou-client --restart=always -e spring.lazy.netty.client.inet-host=公网IP -e spring.lazy.netty.client.inet-port=7001 -e spring.lazy.netty.client.client-id="hangzhou-jifang" registry.cn-hangzhou.aliyuncs.com/wu-lazy/wu-lazy-cloud-heartbeat-client-start:1.2.9-JDK17-SNAPSHOT
|
||||
```
|
||||
```shell
|
||||
docker run -d -it --privileged --name my-home-client --restart=always -e spring.lazy.netty.client.inet-host=公网IP -e spring.lazy.netty.client.inet-port=7001 -e spring.lazy.netty.client.client-id="my-home" registry.cn-hangzhou.aliyuncs.com/wu-lazy/wu-lazy-cloud-heartbeat-client-start:1.2.9-JDK17-SNAPSHOT
|
||||
```
|
||||
#### 操作步骤:配置端口
|
||||

|
||||
#### 操作步骤:打开页面配置菜单看到如下界面(from客户端ID:你老家网络中的电脑,to客户端ID)
|
||||

|
||||
|
||||
#### 连接使用:在你老家使用my-home这个客户端所在机器上的ip+13306 即可访问杭州机房内的数据库的服务3306
|
||||
140
NetworkPermeate1.0.puml
Normal file
@@ -0,0 +1,140 @@
|
||||
|
||||
|
||||
@startuml
|
||||
|
||||
title 服务端渗透客户端
|
||||
|
||||
actor 访客 as User
|
||||
|
||||
package "服务端(公网)"{
|
||||
component [服务端开放端口]{
|
||||
[默认UI页面端口:6001]
|
||||
[默认tcp端口:7001] as tcp
|
||||
[开放给客户端访问的端口:13306]
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package "客户端(私有网络)"{
|
||||
|
||||
component [客户端端口]{
|
||||
[默认UI页面端口:6004]
|
||||
}
|
||||
|
||||
database "客户端所在网络中的mysql:3306" as target {
|
||||
}
|
||||
}
|
||||
|
||||
[User] ...right...> [开放给客户端访问的端口:13306]: 发送请求到 http://ip:13306
|
||||
[开放给客户端访问的端口:13306] ...down...> [target]: 发送真实二进制请求到真实服务
|
||||
|
||||
note "无法直接访问" as N2
|
||||
(User) .... N2
|
||||
N2 ... (target)
|
||||
|
||||
@enduml
|
||||
|
||||
|
||||
@startuml
|
||||
|
||||
title 服务端渗透服务端
|
||||
|
||||
actor 访客 as User
|
||||
|
||||
package "服务端(局域网)"{
|
||||
component [服务端开放端口]{
|
||||
[默认UI页面端口:6001]
|
||||
[默认tcp端口:7001] as tcp
|
||||
[开放给服务端访问的端口:13306]
|
||||
}
|
||||
database "服务端所在网络中的mysql:3306" as target {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[User] ...right...> [开放给服务端访问的端口:13306]: 发送请求到 http://ip:13306
|
||||
[开放给服务端访问的端口:13306] ...down...> [target]: 发送真实二进制请求到真实服务
|
||||
|
||||
note "无法直接访问" as N2
|
||||
(User) .. N2
|
||||
N2 .. (target)
|
||||
|
||||
|
||||
@enduml
|
||||
|
||||
@startuml
|
||||
|
||||
title 客户端渗透服务端
|
||||
|
||||
actor 访客 as User
|
||||
|
||||
package "服务端(公网)"{
|
||||
component [服务端开放端口]{
|
||||
[默认UI页面端口:6001]
|
||||
[默认tcp端口:7001] as tcp
|
||||
}
|
||||
|
||||
database "服务端所在网络中的mysql:3306" as target {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
package "客户端(私有网络)"{
|
||||
|
||||
component [客户端端口]{
|
||||
[默认UI页面端口:6004]
|
||||
[客户端开放端口:13306]
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
[User] ...right...> [客户端开放端口:13306]: 发送请求到 http://ip:13306
|
||||
[客户端开放端口:13306] ...up...> [target]: 发送真实二进制请求到真实服务
|
||||
|
||||
note "无法直接访问" as N2
|
||||
(User) ...up... N2
|
||||
N2 ...up.. (target)
|
||||
|
||||
@enduml
|
||||
|
||||
@startuml
|
||||
|
||||
title 客户端渗透客户端
|
||||
|
||||
actor 访客杭州 as User
|
||||
|
||||
package "服务端(公网)" as server{
|
||||
component [服务端开放端口]{
|
||||
[默认UI页面端口:6001]
|
||||
[默认tcp端口:7001] as tcp
|
||||
}
|
||||
}
|
||||
|
||||
package "客户端(私有网络--杭州)" as client_hangzhou{
|
||||
|
||||
component [客户端端口]{
|
||||
[默认UI页面端口:6004]
|
||||
[客户端开放端口:13306]
|
||||
}
|
||||
}
|
||||
|
||||
package "客户端(私有网络--上海)" as client_shanghai{
|
||||
component [上海客户端端口]{
|
||||
[上海默认UI页面端口:6004]
|
||||
}
|
||||
database "服务端所在网络中的mysql:3306" as target {
|
||||
}
|
||||
}
|
||||
|
||||
server ...down...> client_hangzhou
|
||||
server <...right... client_shanghai
|
||||
|
||||
[User] ...right...> [客户端开放端口:13306]: 发送请求到 http://ip:13306
|
||||
[客户端开放端口:13306] ...up...> [target]: 发送真实二进制请求到真实服务
|
||||
|
||||
note "无法直接访问" as N2
|
||||
(User) ...up... N2
|
||||
N2 ...up.. (target)
|
||||
|
||||
@enduml
|
||||
BIN
NetworkPermeateClientPermeateClient.png
Normal file
|
After Width: | Height: | Size: 60 KiB |
BIN
NetworkPermeateClientPermeateServer.png
Normal file
|
After Width: | Height: | Size: 50 KiB |
BIN
NetworkPermeateServerPermeateClient.png
Normal file
|
After Width: | Height: | Size: 48 KiB |
BIN
NetworkPermeateServerPermeateServer.png
Normal file
|
After Width: | Height: | Size: 41 KiB |
68
README.md
@@ -33,8 +33,17 @@
|
||||
|
||||
wu-lazy-cloud-network
|
||||
是一款基于([wu-framework-parent](https://gitee.com/wujiawei1207537021/wu-framework-parent))孵化出的项目,内部使用Lazy
|
||||
ORM操作数据库,主要功能是网络穿透,对于没有公网IP的服务进行公网IP映射
|
||||
使用环境JDK17 Spring Boot 3.0.2
|
||||
ORM操作数据库,使用环境JDK17 Spring Boot 3.0.2。
|
||||
主要功能:
|
||||
- 服务端渗透客户端(网络穿透),对于没有公网IP的服务进行公网IP映射
|
||||
- 
|
||||
- 服务端渗透服务端----本地同局域网内端口映射
|
||||
- 
|
||||
- 客户端渗透服务端----本地端口映射到另一个服务端中的局域网端口
|
||||
- 
|
||||
- 客户端渗透客户端----本地端口映射到另一个局域网端口
|
||||
- 
|
||||
|
||||
|
||||
[UI](https://gitee.com/wujiawei1207537021/wu-lazy-cloud-network-server-ui)
|
||||
|
||||
@@ -199,7 +208,7 @@ public class NettyClientSocket {
|
||||
log.info("连接服务端成功");
|
||||
// 告诉服务端这条连接是client的连接
|
||||
NettyProxyMsg nettyMsg = new NettyProxyMsg();
|
||||
nettyMsg.setType(MessageType.REPORT_CLIENT_CONNECT_SUCCESS);
|
||||
nettyMsg.setType(MessageType.TCP_REPORT_CLIENT_CONNECT_SUCCESS);
|
||||
nettyMsg.setClientId(clientId);
|
||||
nettyMsg.setData((clientId).getBytes());
|
||||
ChannelAttributeKeyUtils.buildClientId(channel, clientId);
|
||||
@@ -249,24 +258,23 @@ public class NettyClientSocket {
|
||||
|
||||
### 项目结构
|
||||
|
||||
| 模块 | 版本 | 描述 |
|
||||
|-----------------------------------------------------------------------------------------------------------------------------------------|----------------------|------------------------------|
|
||||
| [wu-lazy-cloud-heartbeat-common](wu-lazy-cloud-heartbeat-common) | 1.2.7-JDK17-SNAPSHOT | 内网穿透公共模块(声明接口、枚举、常量、适配器、解析器) |
|
||||
| [wu-lazy-cloud-heartbeat-client](wu-lazy-cloud-heartbeat-client) | 1.2.7-JDK17-SNAPSHOT | 客户端(支持二次开发) |
|
||||
| [wu-lazy-cloud-heartbeat-server](wu-lazy-cloud-heartbeat-server) | 1.2.7-JDK17-SNAPSHOT | 服务端(支持二次开发) |
|
||||
| [wu-lazy-cloud-network-ui](wu-lazy-cloud-heartbeat-server-ui) | 1.2.7-JDK17-SNAPSHOT | 服务端页面 |
|
||||
| [wu-lazy-cloud-heartbeat-client-start](wu-lazy-cloud-heartbeat-sample/wu-lazy-cloud-heartbeat-client-sample) | 1.2.7-JDK17-SNAPSHOT | 客户端样例 |
|
||||
| [wu-lazy-cloud-heartbeat-server-start](wu-lazy-cloud-heartbeat-sample/wu-lazy-cloud-heartbeat-server-sample) | 1.2.7-JDK17-SNAPSHOT | 服务端样例 |
|
||||
| 模块 | 版本 | 描述 |
|
||||
|------------------------------------------------------------------------------------------------------------|----------------------|------------------------------|
|
||||
| [wu-lazy-cloud-heartbeat-common](wu-lazy-cloud-heartbeat-common) | 1.2.9-JDK17-SNAPSHOT | 内网穿透公共模块(声明接口、枚举、常量、适配器、解析器) |
|
||||
| [wu-lazy-cloud-heartbeat-client](wu-lazy-cloud-heartbeat-client) | 1.2.9-JDK17-SNAPSHOT | 客户端(支持二次开发) |
|
||||
| [wu-lazy-cloud-heartbeat-server](wu-lazy-cloud-heartbeat-server) | 1.2.9-JDK17-SNAPSHOT | 服务端(支持二次开发) |
|
||||
| [wu-lazy-cloud-heartbeat-client-start](wu-lazy-cloud-heartbeat-start/wu-lazy-cloud-heartbeat-server-start) | 1.2.9-JDK17-SNAPSHOT | 客户端样例 |
|
||||
| [wu-lazy-cloud-heartbeat-server-start](wu-lazy-cloud-heartbeat-start/wu-lazy-cloud-heartbeat-client-start) | 1.2.9-JDK17-SNAPSHOT | 服务端样例 |
|
||||
|
||||
### 使用技术
|
||||
|
||||
| 框架 | 版本 | 描述 |
|
||||
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------|--------------|
|
||||
| spring-boot | 3.0.7 | springboot框架 |
|
||||
| [wu-framework-web](https://gitee.com/wujiawei1207537021/wu-framework-parent/tree/master/wu-framework-web) | 1.2.7-JDK17-SNAPSHOT | web容器 |
|
||||
| [Lazy -ORM](https://gitee.com/wujiawei1207537021/wu-framework-parent/tree/master/wu-inner-intergration/wu-database-parent) | 1.2.7-JDK17-SNAPSHOT | ORM |
|
||||
| [wu-framework-web](https://gitee.com/wujiawei1207537021/wu-framework-parent/tree/master/wu-framework-web) | 1.2.9-JDK17-SNAPSHOT | web容器 |
|
||||
| [Lazy -ORM](https://gitee.com/wujiawei1207537021/wu-framework-parent/tree/master/wu-inner-intergration/wu-database-parent) | 1.2.9-JDK17-SNAPSHOT | ORM |
|
||||
| mysql-connector-j | 8.0.33 | mysql驱动 |
|
||||
| [wu-authorization-server-platform-starter](https://gitee.com/wujiawei1207537021/wu-framework-parent/tree/master/wu-smart-platform/wu-authorization-server-platform-starter) | 1.2.7-JDK17-SNAPSHOT | 用户授权体系 |
|
||||
| [wu-authorization-server-platform-starter](https://gitee.com/wujiawei1207537021/wu-framework-parent/tree/master/wu-smart-platform/wu-authorization-server-platform-starter) | 1.2.9-JDK17-SNAPSHOT | 用户授权体系 |
|
||||
|
||||
### 使用环境
|
||||
|
||||
@@ -279,7 +287,7 @@ public class NettyClientSocket {
|
||||
|
||||
docker启动
|
||||
|
||||
docker run -d -it -p 18080:18080 --name wu-lazy-cloud-heartbeat-server registry.cn-hangzhou.aliyuncs.com/wu-lazy/wu-lazy-cloud-heartbeat-server:1.2.7-JDK17-SNAPSHOT
|
||||
docker run -d -it -p 18080:18080 --name wu-lazy-cloud-heartbeat-server registry.cn-hangzhou.aliyuncs.com/wu-lazy/wu-lazy-cloud-heartbeat-server:1.2.9-JDK17-SNAPSHOT
|
||||
|
||||
http://127.0.0.1:18080/swagger-ui/index.html
|
||||
|
||||
@@ -288,15 +296,15 @@ public class NettyClientSocket {
|
||||
#### 页面操作
|
||||
|
||||
启动项目后打开服务端界面
|
||||

|
||||

|
||||
|
||||
默认账号密码:admin/admin
|
||||

|
||||

|
||||
|
||||
初始化项目
|
||||

|
||||

|
||||
添加角色
|
||||

|
||||

|
||||
为用户授权
|
||||

|
||||
|
||||
@@ -306,12 +314,26 @@ public class NettyClientSocket {
|
||||
客户端管理(客户端会自动注册)
|
||||

|
||||
|
||||
网络映射管理(修改后者新增需要映射的客户端)
|
||||

|
||||
## 服务端渗透
|
||||
- 服务端口池管理(服务器端需要开放的端口)
|
||||

|
||||
|
||||
访客端口池管理(服务器端需要开放的端口)
|
||||

|
||||
- 服务端渗透客户端(内网穿透)(修改后者新增需要映射的客户端)
|
||||

|
||||
|
||||
- 服务端渗透服务端
|
||||

|
||||
|
||||
## 客户端渗透
|
||||
- 客户端渗透端口池管理
|
||||

|
||||
|
||||
- 客户端渗透客户端
|
||||

|
||||
- 客户端渗透服务端
|
||||

|
||||
|
||||
## 报表
|
||||
流量管理(每个客户端使用的流量)
|
||||

|
||||
|
||||
|
||||
BIN
client_permeate_client_mapping.png
Normal file
|
After Width: | Height: | Size: 130 KiB |
BIN
client_permeate_port_pool.png
Normal file
|
After Width: | Height: | Size: 114 KiB |
BIN
client_permeate_server_mapping.png
Normal file
|
After Width: | Height: | Size: 110 KiB |
BIN
cloud_client.png
|
Before Width: | Height: | Size: 113 KiB After Width: | Height: | Size: 86 KiB |
BIN
init_role.png
|
Before Width: | Height: | Size: 124 KiB After Width: | Height: | Size: 100 KiB |
BIN
mapping.png
|
Before Width: | Height: | Size: 148 KiB |
128
pom.xml
@@ -8,12 +8,12 @@
|
||||
<parent>
|
||||
<artifactId>wu-framework-parent</artifactId>
|
||||
<groupId>top.wu2020</groupId>
|
||||
<version>1.2.7-JDK17</version>
|
||||
<version>1.2.9-JDK17-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>wu-lazy-cloud-network</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<version>1.2.7-JDK17</version>
|
||||
<version>1.2.9-JDK17-SNAPSHOT</version>
|
||||
<description>云上云下</description>
|
||||
|
||||
|
||||
@@ -70,19 +70,12 @@
|
||||
<dependency>
|
||||
<groupId>top.wu2020</groupId>
|
||||
<artifactId>wu-framework-dependencies</artifactId>
|
||||
<version>1.2.7-JDK17</version>
|
||||
<version>1.2.9-JDK17-SNAPSHOT</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>maven_central</id>
|
||||
<name>Maven Central</name>
|
||||
<url>https://repo.maven.apache.org/maven2/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
|
||||
<profiles>
|
||||
@@ -182,55 +175,96 @@
|
||||
|
||||
<profile>
|
||||
<id>native</id>
|
||||
<build>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<configuration>
|
||||
<archive>
|
||||
<manifestEntries>
|
||||
<Spring-Boot-Native-Processed>true</Spring-Boot-Native-Processed>
|
||||
</manifestEntries>
|
||||
</archive>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<image>
|
||||
<builder>paketobuildpacks/builder-jammy-tiny:latest</builder>
|
||||
<env>
|
||||
<BP_NATIVE_IMAGE>true</BP_NATIVE_IMAGE>
|
||||
</env>
|
||||
</image>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>process-aot</id>
|
||||
<goals>
|
||||
<goal>process-aot</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.graalvm.buildtools</groupId>
|
||||
<artifactId>native-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<classesDirectory>${project.build.outputDirectory}</classesDirectory>
|
||||
<requiredVersion>22.3</requiredVersion>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>add-reachability-metadata</id>
|
||||
<goals>
|
||||
<goal>add-reachability-metadata</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
</build>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>nativeTest</id>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.junit.platform</groupId>
|
||||
<artifactId>junit-platform-launcher</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>process-test-aot</id>
|
||||
<goals>
|
||||
<goal>process-test-aot</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.graalvm.buildtools</groupId>
|
||||
<artifactId>native-maven-plugin</artifactId>
|
||||
<version>0.9.28</version>
|
||||
<!-- 使用graalvm提供的可达性元数据,很多第三方库就直接可以构建成可执行文件了 -->
|
||||
<configuration>
|
||||
<!-- for agent -->
|
||||
<agent>
|
||||
<defaultMode>Standard</defaultMode>
|
||||
<options>
|
||||
<builtinCallerFilter>true</builtinCallerFilter>
|
||||
<builtinHeuristicFilter>true</builtinHeuristicFilter>
|
||||
<enableExperimentalPredefinedClasses>true
|
||||
</enableExperimentalPredefinedClasses>
|
||||
<enableExperimentalUnsafeAllocationTracing>true
|
||||
</enableExperimentalUnsafeAllocationTracing>
|
||||
<trackReflectionMetadata>true</trackReflectionMetadata>
|
||||
</options>
|
||||
<metadataCopy>
|
||||
<merge>true</merge>
|
||||
</metadataCopy>
|
||||
</agent>
|
||||
<!-- for metadata repository -->
|
||||
<metadataRepository>
|
||||
<enabled>true</enabled>
|
||||
</metadataRepository>
|
||||
<classesDirectory>${project.build.outputDirectory}</classesDirectory>
|
||||
<requiredVersion>22.3</requiredVersion>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>add-reachability-metadata</id>
|
||||
<goals>
|
||||
<goal>add-reachability-metadata</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>test-native</id>
|
||||
<id>native-test</id>
|
||||
<goals>
|
||||
<goal>test</goal>
|
||||
</goals>
|
||||
<phase>test</phase>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>build-native</id>
|
||||
<goals>
|
||||
<goal>compile-no-fork</goal>
|
||||
</goals>
|
||||
<phase>package</phase>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
BIN
server_permeate_client_mapping.png
Normal file
|
After Width: | Height: | Size: 120 KiB |
BIN
server_permeate_port_pool.png
Normal file
|
After Width: | Height: | Size: 95 KiB |
BIN
server_permeate_server_mapping.png
Normal file
|
After Width: | Height: | Size: 104 KiB |
BIN
url_info.png
|
Before Width: | Height: | Size: 428 KiB After Width: | Height: | Size: 398 KiB |
13
version.md
@@ -19,4 +19,15 @@
|
||||
sudo sysctl -w net.core.wmem_default=4194304
|
||||
sudo sysctl -w net.core.wmem_max=4194304
|
||||
[fix] 修复下线客户端、删除映射无法刷新问题
|
||||
#### 下一版本计划内网渗透
|
||||
#### 1.2.8-JDK17-SNAPSHOT
|
||||
[change] 原《内网穿透》更改为服务端渗透客户端
|
||||
[change] 新增服务端渗透服务端----本地同局域网内端口映射
|
||||
[change] 新增客户端渗透服务端----本地端口映射到另一个服务端中的局域网端口
|
||||
[change] 新增客户端渗透客户端----本地端口映射到另一个局域网端口
|
||||
#### 1.2.9-JDK17-SNAPSHOT
|
||||
[change] 添加appkey&appsecret 验证
|
||||
[change] 支持同一个客户端ID多次注册
|
||||
[change] 修复通道关闭导致调度线程池submit异常问题
|
||||
[change] 添加记录客户端IP
|
||||
[change] 1.2.9为大版本,报文中添加数据无法向下兼容,建议服务端与客户端保持版本一致
|
||||
#### 下一版本计划https
|
||||
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>top.wu2020</groupId>
|
||||
<artifactId>wu-lazy-cloud-network</artifactId>
|
||||
<version>1.2.7-JDK17</version>
|
||||
<version>1.2.9-JDK17-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -66,7 +66,17 @@ public class LazyNettyServerPropertiesQueryListCommand {
|
||||
*/
|
||||
@Schema(description ="类型(配置、DB)",name ="type",example = "")
|
||||
private PropertiesType type;
|
||||
/**
|
||||
* 令牌key
|
||||
*/
|
||||
@Schema(description = "令牌key", name = "appKey", example = "")
|
||||
private String appKey;
|
||||
|
||||
/**
|
||||
* 令牌密钥
|
||||
*/
|
||||
@Schema(description = "令牌密钥", name = "appSecret", example = "")
|
||||
private String appSecret;
|
||||
/**
|
||||
*
|
||||
* 更新时间
|
||||
|
||||
@@ -65,7 +65,17 @@ public class LazyNettyServerPropertiesQueryOneCommand {
|
||||
*/
|
||||
@Schema(description ="类型(配置、DB)",name ="type",example = "")
|
||||
private PropertiesType type;
|
||||
/**
|
||||
* 令牌key
|
||||
*/
|
||||
@Schema(description = "令牌key", name = "appKey", example = "")
|
||||
private String appKey;
|
||||
|
||||
/**
|
||||
* 令牌密钥
|
||||
*/
|
||||
@Schema(description = "令牌密钥", name = "appSecret", example = "")
|
||||
private String appSecret;
|
||||
/**
|
||||
*
|
||||
* 更新时间
|
||||
|
||||
@@ -66,7 +66,17 @@ public class LazyNettyServerPropertiesRemoveCommand {
|
||||
*/
|
||||
@Schema(description ="类型(配置、DB)",name ="type",example = "")
|
||||
private PropertiesType type;
|
||||
/**
|
||||
* 令牌key
|
||||
*/
|
||||
@Schema(description = "令牌key", name = "appKey", example = "")
|
||||
private String appKey;
|
||||
|
||||
/**
|
||||
* 令牌密钥
|
||||
*/
|
||||
@Schema(description = "令牌密钥", name = "appSecret", example = "")
|
||||
private String appSecret;
|
||||
/**
|
||||
*
|
||||
* 更新时间
|
||||
|
||||
@@ -65,7 +65,17 @@ public class LazyNettyServerPropertiesStoryCommand {
|
||||
*/
|
||||
@Schema(description ="类型(配置、DB)",name ="type",example = "")
|
||||
private PropertiesType type;
|
||||
/**
|
||||
* 令牌key
|
||||
*/
|
||||
@Schema(description = "令牌key", name = "appKey", example = "")
|
||||
private String appKey;
|
||||
|
||||
/**
|
||||
* 令牌密钥
|
||||
*/
|
||||
@Schema(description = "令牌密钥", name = "appSecret", example = "")
|
||||
private String appSecret;
|
||||
/**
|
||||
*
|
||||
* 更新时间
|
||||
|
||||
@@ -65,7 +65,17 @@ public class LazyNettyServerPropertiesUpdateCommand {
|
||||
*/
|
||||
@Schema(description ="类型(配置、DB)",name ="type",example = "")
|
||||
private PropertiesType type;
|
||||
/**
|
||||
* 令牌key
|
||||
*/
|
||||
@Schema(description = "令牌key", name = "appKey", example = "")
|
||||
private String appKey;
|
||||
|
||||
/**
|
||||
* 令牌密钥
|
||||
*/
|
||||
@Schema(description = "令牌密钥", name = "appSecret", example = "")
|
||||
private String appSecret;
|
||||
/**
|
||||
*
|
||||
* 更新时间
|
||||
|
||||
@@ -65,7 +65,17 @@ public class LazyNettyServerPropertiesDTO {
|
||||
*/
|
||||
@Schema(description ="类型(配置、DB)",name ="type",example = "")
|
||||
private PropertiesType type;
|
||||
/**
|
||||
* 令牌key
|
||||
*/
|
||||
@Schema(description = "令牌key", name = "appKey", example = "")
|
||||
private String appKey;
|
||||
|
||||
/**
|
||||
* 令牌密钥
|
||||
*/
|
||||
@Schema(description = "令牌密钥", name = "appSecret", example = "")
|
||||
private String appSecret;
|
||||
/**
|
||||
*
|
||||
* 更新时间
|
||||
|
||||
@@ -186,10 +186,12 @@ public class LazyNettyServerPropertiesApplicationImpl implements LazyNettyServer
|
||||
String inetHost = lazyNettyServerProperties.getInetHost();
|
||||
Integer inetPort = lazyNettyServerProperties.getInetPort();
|
||||
String clientId = lazyNettyServerProperties.getClientId();
|
||||
String appKey = lazyNettyServerProperties.getAppKey();
|
||||
String appSecret = lazyNettyServerProperties.getAppSecret();
|
||||
|
||||
NettyClientSocket nettyClientSocket = new
|
||||
NettyClientSocket(inetHost, inetPort, clientId,
|
||||
NormalUsedString.DEFAULT,
|
||||
NormalUsedString.DEFAULT,appKey,appSecret,
|
||||
clientChangeEvent, handleChannelTypeAdvancedList);
|
||||
cacheNettyClientSocketMap.put(lazyNettyServerProperties, nettyClientSocket);
|
||||
|
||||
|
||||
@@ -48,7 +48,9 @@ public class ClientAutoConfiguration implements CommandLineRunner {
|
||||
String inetHost = nettyClientProperties.getInetHost();
|
||||
int inetPort = nettyClientProperties.getInetPort();
|
||||
String clientId = nettyClientProperties.getClientId();
|
||||
return new NettyClientSocket(inetHost, inetPort, clientId, NormalUsedString.DEFAULT, clientChangeEvent, handleChannelTypeAdvancedList);
|
||||
String appKey = nettyClientProperties.getAppKey();
|
||||
String appSecret = nettyClientProperties.getAppSecret();
|
||||
return new NettyClientSocket(inetHost, inetPort, clientId, NormalUsedString.DEFAULT, appKey,appSecret,clientChangeEvent, handleChannelTypeAdvancedList);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -62,9 +64,11 @@ public class ClientAutoConfiguration implements CommandLineRunner {
|
||||
String inetHost = nettyClientProperties.getInetHost();
|
||||
int inetPort = nettyClientProperties.getInetPort();
|
||||
String clientId = nettyClientProperties.getClientId();
|
||||
String appKey = nettyClientProperties.getAppKey();
|
||||
String appSecret = nettyClientProperties.getAppSecret();
|
||||
NettyClientSocket nettyClientSocket = new NettyClientSocket(
|
||||
inetHost, inetPort,
|
||||
clientId, NormalUsedString.DEFAULT,
|
||||
clientId, NormalUsedString.DEFAULT,appKey,appSecret,
|
||||
clientChangeEvent, handleChannelTypeAdvancedList);
|
||||
Thread thread = new Thread(() -> {
|
||||
try {
|
||||
|
||||
@@ -18,148 +18,148 @@ public class HeartbeatClientConfiguration {
|
||||
/**
|
||||
* 服务端 处理客户端心跳
|
||||
*
|
||||
* @return ClientHandleChannelHeartbeatTypeAdvanced
|
||||
* @return ClientTcpHandleChannelHeartbeatTypeAdvanced
|
||||
*/
|
||||
@Bean
|
||||
public ClientHandleChannelHeartbeatTypeAdvanced clientChannelHeartbeatTypeAdvanced() {
|
||||
return new ClientHandleChannelHeartbeatTypeAdvanced();
|
||||
public ClientTcpHandleChannelHeartbeatTypeAdvanced clientChannelHeartbeatTypeAdvanced() {
|
||||
return new ClientTcpHandleChannelHeartbeatTypeAdvanced();
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理 客户端代理的真实端口自动读写
|
||||
*
|
||||
* @return ClientHandleDistributeSingleClientRealAutoReadConnectTypeAdvanced
|
||||
* @return ClientHandleTcpDistributeSingleClientRealAutoReadConnectTypeAdvanced
|
||||
*/
|
||||
@Bean
|
||||
public ClientHandleDistributeSingleClientRealAutoReadConnectTypeAdvanced handleDistributeSingleClientRealAutoReadConnectTypeAdvanced() {
|
||||
return new ClientHandleDistributeSingleClientRealAutoReadConnectTypeAdvanced();
|
||||
public ClientHandleTcpDistributeSingleClientRealAutoReadConnectTypeAdvanced handleDistributeSingleClientRealAutoReadConnectTypeAdvanced() {
|
||||
return new ClientHandleTcpDistributeSingleClientRealAutoReadConnectTypeAdvanced();
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理 接收服务端发送过来的聊天信息
|
||||
*
|
||||
* @return ClientHandleDistributeSingleClientMessageTypeAdvanced
|
||||
* @return ClientHandleTcpDistributeSingleClientMessageTypeAdvanced
|
||||
*/
|
||||
@Bean
|
||||
public ClientHandleDistributeSingleClientMessageTypeAdvanced handleDistributeSingleClientMessageTypeAdvanced() {
|
||||
return new ClientHandleDistributeSingleClientMessageTypeAdvanced();
|
||||
public ClientHandleTcpDistributeSingleClientMessageTypeAdvanced handleDistributeSingleClientMessageTypeAdvanced() {
|
||||
return new ClientHandleTcpDistributeSingleClientMessageTypeAdvanced();
|
||||
}
|
||||
/**
|
||||
* 处理 客户端渗透服务端数据传输通道连接成功
|
||||
*
|
||||
* @return ClientHandleDistributeClientTransferServerPermeateChannelConnectionSuccessfulTypeAdvanced
|
||||
* @return ClientHandleTcpDistributeClientTransferServerPermeateChannelConnectionSuccessfulTypeAdvanced
|
||||
*/
|
||||
@Bean
|
||||
public ClientHandleDistributeClientTransferServerPermeateChannelConnectionSuccessfulTypeAdvanced clientHandleDistributeClientTransferServerPermeateChannelConnectionSuccessfulTypeAdvanced() {
|
||||
return new ClientHandleDistributeClientTransferServerPermeateChannelConnectionSuccessfulTypeAdvanced();
|
||||
public ClientHandleTcpDistributeClientTransferServerPermeateChannelConnectionSuccessfulTypeAdvanced clientHandleDistributeClientTransferServerPermeateChannelConnectionSuccessfulTypeAdvanced() {
|
||||
return new ClientHandleTcpDistributeClientTransferServerPermeateChannelConnectionSuccessfulTypeAdvanced();
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理 客户端渗透客户端数据传输通道连接成功
|
||||
*
|
||||
* @return ClientHandleDistributeClientTransferClientPermeateChannelConnectionSuccessfulTypeAdvanced
|
||||
* @return ClientHandleTcpDistributeClientTransferClientPermeateChannelConnectionSuccessfulTypeAdvanced
|
||||
*/
|
||||
@Bean
|
||||
public ClientHandleDistributeClientTransferClientPermeateChannelConnectionSuccessfulTypeAdvanced clientHandleDistributeClientTransferClientPermeateChannelConnectionSuccessfulTypeAdvanced() {
|
||||
return new ClientHandleDistributeClientTransferClientPermeateChannelConnectionSuccessfulTypeAdvanced();
|
||||
public ClientHandleTcpDistributeClientTransferClientPermeateChannelConnectionSuccessfulTypeAdvanced clientHandleDistributeClientTransferClientPermeateChannelConnectionSuccessfulTypeAdvanced() {
|
||||
return new ClientHandleTcpDistributeClientTransferClientPermeateChannelConnectionSuccessfulTypeAdvanced();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ClientHandleDistributeClientTransferClientPermeateChannelInitSuccessfulTypeAdvanced clientHandleDistributeClientTransferClientPermeateChannelInitSuccessfulTypeAdvanced() {
|
||||
return new ClientHandleDistributeClientTransferClientPermeateChannelInitSuccessfulTypeAdvanced();
|
||||
public ClientHandleTcpDistributeClientTransferClientPermeateChannelInitSuccessfulTypeAdvanced clientHandleDistributeClientTransferClientPermeateChannelInitSuccessfulTypeAdvanced() {
|
||||
return new ClientHandleTcpDistributeClientTransferClientPermeateChannelInitSuccessfulTypeAdvanced();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ClientHandleDistributeClientTransferClientRequestTypeAdvanced clientHandleDistributeClientTransferClientTypeAdvanced() {
|
||||
return new ClientHandleDistributeClientTransferClientRequestTypeAdvanced();
|
||||
public ClientHandleTcpDistributeClientTransferClientRequestTypeAdvanced clientHandleDistributeClientTransferClientTypeAdvanced() {
|
||||
return new ClientHandleTcpDistributeClientTransferClientRequestTypeAdvanced();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ClientHandleDistributeServicePermeateClientTransferClientResponseTypeAdvanced clientHandleDistributeClientTransferClientResponseTypeAdvanced() {
|
||||
return new ClientHandleDistributeServicePermeateClientTransferClientResponseTypeAdvanced();
|
||||
public ClientHandleTcpDistributeServicePermeateClientTransferClientResponseTypeAdvanced clientHandleDistributeClientTransferClientResponseTypeAdvanced() {
|
||||
return new ClientHandleTcpDistributeServicePermeateClientTransferClientResponseTypeAdvanced();
|
||||
}
|
||||
@Bean
|
||||
public ClientHandleDistributeSingleClientRealCloseVisitorTypeAdvanced handleDistributeSingleClientRealCloseVisitorTypeAdvanced() {
|
||||
return new ClientHandleDistributeSingleClientRealCloseVisitorTypeAdvanced();
|
||||
public ClientHandleTcpDistributeSingleClientRealCloseVisitorTypeAdvanced handleDistributeSingleClientRealCloseVisitorTypeAdvanced() {
|
||||
return new ClientHandleTcpDistributeSingleClientRealCloseVisitorTypeAdvanced();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ClientHandleChannelTransferTypeAdvancedHandleDistributeDistribute handleChannelTransferTypeAdvancedHandleDistribute(NettyClientProperties nettyClientProperties) {
|
||||
return new ClientHandleChannelTransferTypeAdvancedHandleDistributeDistribute(nettyClientProperties);
|
||||
public ClientHandleChannelTransferTypeAdvancedHandleDistributeTcpDistribute handleChannelTransferTypeAdvancedHandleDistribute(NettyClientProperties nettyClientProperties) {
|
||||
return new ClientHandleChannelTransferTypeAdvancedHandleDistributeTcpDistribute(nettyClientProperties);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public HandleDistributeConnectSuccessNotificationTypeAdvancedHandle handleDistributeConnectSuccessNotificationTypeAdvancedHandle(ClientChangeEvent clientChangeEvent) {
|
||||
return new HandleDistributeConnectSuccessNotificationTypeAdvancedHandle(clientChangeEvent);
|
||||
public HandleTcpDistributeConnectSuccessNotificationTypeAdvancedHandle handleDistributeConnectSuccessNotificationTypeAdvancedHandle(ClientChangeEvent clientChangeEvent) {
|
||||
return new HandleTcpDistributeConnectSuccessNotificationTypeAdvancedHandle(clientChangeEvent);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public HandleClientChannelActiveAdvanced handleClientChannelActiveAdvanced(NettyClientProperties nettyClientProperties) {
|
||||
return new HandleClientChannelActiveAdvanced(nettyClientProperties);
|
||||
public HandleTcpClientChannelActiveAdvanced handleClientChannelActiveAdvanced(NettyClientProperties nettyClientProperties) {
|
||||
return new HandleTcpClientChannelActiveAdvanced(nettyClientProperties);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public HandleDistributeDisconnectTypeAdvancedHandle handleDistributeDisconnectTypeAdvancedHandle(ClientChangeEvent clientChangeEvent) {
|
||||
return new HandleDistributeDisconnectTypeAdvancedHandle(clientChangeEvent);
|
||||
public HandleTcpDistributeDisconnectTypeAdvancedHandle handleDistributeDisconnectTypeAdvancedHandle(ClientChangeEvent clientChangeEvent) {
|
||||
return new HandleTcpDistributeDisconnectTypeAdvancedHandle(clientChangeEvent);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public HandleDistributeStagingClosedTypeAdvanced handleDistributeStagingClosedTypeAdvanced() {
|
||||
return new HandleDistributeStagingClosedTypeAdvanced();
|
||||
public HandleTcpDistributeStagingClosedTypeAdvanced handleDistributeStagingClosedTypeAdvanced() {
|
||||
return new HandleTcpDistributeStagingClosedTypeAdvanced();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public HandleDistributeStagingOpenedTypeAdvanced handleDistributeStagingOpenedTypeAdvanced() {
|
||||
return new HandleDistributeStagingOpenedTypeAdvanced();
|
||||
public HandleTcpDistributeStagingOpenedTypeAdvanced handleDistributeStagingOpenedTypeAdvanced() {
|
||||
return new HandleTcpDistributeStagingOpenedTypeAdvanced();
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理 客户端渗透服务端init信息
|
||||
*
|
||||
* @return ClientHandleDistributeClientPermeateServerInitTypeAdvanced
|
||||
* @return ClientHandleTcpDistributeClientPermeateServerInitTypeAdvanced
|
||||
*/
|
||||
@Bean
|
||||
public ClientHandleDistributeClientPermeateServerInitTypeAdvanced clientHandleDistributeClientPermeateServerInitTypeAdvanced(NettyClientProperties nettyClientProperties) {
|
||||
return new ClientHandleDistributeClientPermeateServerInitTypeAdvanced(nettyClientProperties);
|
||||
public ClientHandleTcpDistributeClientPermeateServerInitTypeAdvanced clientHandleDistributeClientPermeateServerInitTypeAdvanced(NettyClientProperties nettyClientProperties) {
|
||||
return new ClientHandleTcpDistributeClientPermeateServerInitTypeAdvanced(nettyClientProperties);
|
||||
}
|
||||
/**
|
||||
* 处理 客户端渗透服务端init close 信息
|
||||
*
|
||||
* @return ClientHandleDistributeClientPermeateServerCloseTypeAdvanced
|
||||
* @return ClientHandleTcpDistributeClientPermeateServerCloseTypeAdvanced
|
||||
*/
|
||||
@Bean
|
||||
public ClientHandleDistributeClientPermeateServerCloseTypeAdvanced clientHandleDistributeClientPermeateServerCloseTypeAdvanced( ) {
|
||||
return new ClientHandleDistributeClientPermeateServerCloseTypeAdvanced();
|
||||
public ClientHandleTcpDistributeClientPermeateServerCloseTypeAdvanced clientHandleDistributeClientPermeateServerCloseTypeAdvanced( ) {
|
||||
return new ClientHandleTcpDistributeClientPermeateServerCloseTypeAdvanced();
|
||||
}
|
||||
@Bean
|
||||
public ClientHandleDistributeClientPermeateServerTransferTypeAdvanced clientHandleDistributeClientPermeateServerTransferTypeAdvanced( ) {
|
||||
return new ClientHandleDistributeClientPermeateServerTransferTypeAdvanced();
|
||||
public ClientHandleTcpDistributeClientPermeateServerTransferTypeAdvanced clientHandleDistributeClientPermeateServerTransferTypeAdvanced( ) {
|
||||
return new ClientHandleTcpDistributeClientPermeateServerTransferTypeAdvanced();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ClientHandleDistributeClientPermeateClientCloseTypeAdvanced clientHandleDistributeClientPermeateClientCloseTypeAdvanced() {
|
||||
return new ClientHandleDistributeClientPermeateClientCloseTypeAdvanced();
|
||||
public ClientHandleTcpDistributeClientPermeateClientCloseTypeAdvanced clientHandleDistributeClientPermeateClientCloseTypeAdvanced() {
|
||||
return new ClientHandleTcpDistributeClientPermeateClientCloseTypeAdvanced();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ClientHandleDistributeClientPermeateClientInitTypeAdvanced clientHandleDistributeClientPermeateClientInitTypeAdvanced() {
|
||||
return new ClientHandleDistributeClientPermeateClientInitTypeAdvanced();
|
||||
public ClientHandleTcpDistributeClientPermeateClientInitTypeAdvanced clientHandleDistributeClientPermeateClientInitTypeAdvanced() {
|
||||
return new ClientHandleTcpDistributeClientPermeateClientInitTypeAdvanced();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ClientHandleDistributeClientPermeateClientTransferCloseTypeAdvanced clientHandleDistributeClientPermeateClientTransferCloseTypeAdvanced() {
|
||||
return new ClientHandleDistributeClientPermeateClientTransferCloseTypeAdvanced();
|
||||
public ClientHandleTcpDistributeClientPermeateClientTransferCloseTypeAdvanced clientHandleDistributeClientPermeateClientTransferCloseTypeAdvanced() {
|
||||
return new ClientHandleTcpDistributeClientPermeateClientTransferCloseTypeAdvanced();
|
||||
}
|
||||
|
||||
|
||||
@Bean
|
||||
public ClientHandleDistributeServicePermeateClientRealConnectTypeAdvanced clientHandleDistributeSingleClientRealConnectTypeAdvanced(NettyClientProperties nettyClientProperties,
|
||||
List<HandleChannelTypeAdvanced> handleChannelTypeAdvancedList) {
|
||||
return new ClientHandleDistributeServicePermeateClientRealConnectTypeAdvanced(nettyClientProperties, handleChannelTypeAdvancedList);
|
||||
public ClientHandleTcpDistributeServicePermeateClientRealConnectTypeAdvanced clientHandleDistributeSingleClientRealConnectTypeAdvanced(NettyClientProperties nettyClientProperties,
|
||||
List<HandleChannelTypeAdvanced> handleChannelTypeAdvancedList) {
|
||||
return new ClientHandleTcpDistributeServicePermeateClientRealConnectTypeAdvanced(nettyClientProperties, handleChannelTypeAdvancedList);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ClientHandleHandleDistributeClientPermeateServerTransferCloseTypeAdvanced clientHandleHandleDistributeClientPermeateServerTransferCloseTypeAdvanced() {
|
||||
return new ClientHandleHandleDistributeClientPermeateServerTransferCloseTypeAdvanced();
|
||||
public ClientHandleHandleTcpDistributeClientPermeateServerTransferCloseTypeAdvanced clientHandleHandleDistributeClientPermeateServerTransferCloseTypeAdvanced() {
|
||||
return new ClientHandleHandleTcpDistributeClientPermeateServerTransferCloseTypeAdvanced();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,6 +54,8 @@ public class InitConfig implements CommandLineRunner, DisposableBean {
|
||||
String clientId = nettyClientProperties.getClientId();
|
||||
String inetHost = nettyClientProperties.getInetHost();
|
||||
int inetPort = nettyClientProperties.getInetPort();
|
||||
String appKey = nettyClientProperties.getAppKey();
|
||||
String appSecret = nettyClientProperties.getAppSecret();
|
||||
if (Objects.isNull(clientId) ||
|
||||
Objects.isNull(inetHost)) {
|
||||
log.warn("配置信息为空,请通过页面添加配置信息:{}", nettyClientProperties);
|
||||
@@ -65,6 +67,9 @@ public class InitConfig implements CommandLineRunner, DisposableBean {
|
||||
lazyNettyServerPropertiesDO.setInetPort(inetPort);
|
||||
lazyNettyServerPropertiesDO.setType(PropertiesType.CONFIG);
|
||||
lazyNettyServerPropertiesDO.setIsDeleted(false);
|
||||
lazyNettyServerPropertiesDO.setAppKey(appKey);
|
||||
lazyNettyServerPropertiesDO.setAppSecret(appSecret);
|
||||
|
||||
// 根据服务端端口、port 唯一性验证
|
||||
boolean exists = lazyLambdaStream.exists(LazyWrappers.<LazyNettyServerPropertiesDO>lambdaWrapper()
|
||||
.eq(LazyNettyServerPropertiesDO::getInetHost, inetHost)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.framework.lazy.cloud.network.heartbeat.client.config;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
@@ -29,6 +30,19 @@ public class NettyClientProperties {
|
||||
*/
|
||||
private String clientId;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* 令牌key
|
||||
*/
|
||||
private String appKey;
|
||||
|
||||
/**
|
||||
*
|
||||
* 令牌密钥
|
||||
*/
|
||||
private String appSecret;
|
||||
|
||||
/**
|
||||
* 是否开启 默认是
|
||||
*/
|
||||
|
||||
@@ -5,6 +5,7 @@ import lombok.experimental.Accessors;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.enums.NettyClientStatus;
|
||||
import org.framework.lazy.cloud.network.heartbeat.client.config.PropertiesType;
|
||||
import org.wu.framework.lazy.orm.core.stereotype.LazyTableField;
|
||||
|
||||
import java.lang.String;
|
||||
import java.time.LocalDateTime;
|
||||
@@ -65,7 +66,17 @@ public class LazyNettyServerProperties {
|
||||
*/
|
||||
@Schema(description ="类型(配置、DB)",name ="type",example = "")
|
||||
private PropertiesType type;
|
||||
/**
|
||||
* 令牌key
|
||||
*/
|
||||
@Schema(description = "令牌key", name = "appKey", example = "")
|
||||
private String appKey;
|
||||
|
||||
/**
|
||||
* 令牌密钥
|
||||
*/
|
||||
@Schema(description = "令牌密钥", name = "appSecret", example = "")
|
||||
private String appSecret;
|
||||
/**
|
||||
*
|
||||
* 更新时间
|
||||
|
||||
@@ -1,17 +1,15 @@
|
||||
package org.framework.lazy.cloud.network.heartbeat.client.infrastructure.entity;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.enums.NettyClientStatus;
|
||||
import org.framework.lazy.cloud.network.heartbeat.client.config.PropertiesType;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.enums.NettyClientStatus;
|
||||
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 org.wu.framework.lazy.orm.core.stereotype.LazyTableFieldUnique;
|
||||
|
||||
import java.lang.String;
|
||||
import java.time.LocalDateTime;
|
||||
import java.lang.Integer;
|
||||
/**
|
||||
* describe 服务端配置信息
|
||||
*
|
||||
@@ -75,6 +73,20 @@ public class LazyNettyServerPropertiesDO {
|
||||
@LazyTableField(name="is_deleted",comment="是否删除")
|
||||
private Boolean isDeleted;
|
||||
|
||||
|
||||
/**
|
||||
* 令牌key
|
||||
*/
|
||||
@Schema(description = "令牌key", name = "appKey", example = "")
|
||||
@LazyTableField(name = "app_key", comment = "令牌key")
|
||||
private String appKey;
|
||||
|
||||
/**
|
||||
* 令牌密钥
|
||||
*/
|
||||
@Schema(description = "令牌密钥", name = "appSecret", example = "")
|
||||
@LazyTableField(name = "app_secret", comment = "令牌密钥")
|
||||
private String appSecret;
|
||||
/**
|
||||
*
|
||||
* 类型(配置、DB)
|
||||
|
||||
@@ -56,4 +56,9 @@ public class InternalNetworkClientPermeateClientVisitor implements InternalNetwo
|
||||
* 访客ID
|
||||
*/
|
||||
private String visitorId;
|
||||
|
||||
/**
|
||||
* 是否是ssl
|
||||
*/
|
||||
private boolean isSsl;
|
||||
}
|
||||
|
||||
@@ -4,14 +4,13 @@ import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.framework.lazy.cloud.network.heartbeat.client.config.NettyClientProperties;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.InternalNetworkPermeate;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.adapter.ChannelFlowAdapter;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.HandleChannelTypeAdvanced;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
public class InternalNetworkPermeateServerVisitor implements InternalNetworkPermeate {
|
||||
public class InternalNetworkClientPermeateServerVisitor implements InternalNetworkPermeate {
|
||||
|
||||
/**
|
||||
* 目标地址
|
||||
@@ -38,4 +37,10 @@ public class InternalNetworkPermeateServerVisitor implements InternalNetworkPerm
|
||||
*/
|
||||
private List<HandleChannelTypeAdvanced> handleChannelTypeAdvancedList;
|
||||
|
||||
|
||||
/**
|
||||
* 是否是ssl
|
||||
*/
|
||||
private boolean isSsl;
|
||||
|
||||
}
|
||||
@@ -6,7 +6,7 @@ import io.netty.channel.Channel;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.framework.lazy.cloud.network.heartbeat.client.config.NettyClientProperties;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.client.AbstractHandleDistributeServicePermeateClientTransferTypeAdvanced;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.tcp.client.AbstractHandleTcpDistributeServicePermeateClientTransferTypeAdvanced;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.enums.MessageTypeEnums;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
|
||||
|
||||
@@ -14,14 +14,14 @@ import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeK
|
||||
/**
|
||||
* 服务端处理客户端数据传输
|
||||
*
|
||||
* @see MessageTypeEnums#DISTRIBUTE_CLIENT_TRANSFER
|
||||
* @see MessageTypeEnums#TCP_DISTRIBUTE_CLIENT_TRANSFER
|
||||
*/
|
||||
@Slf4j
|
||||
public class ClientHandleChannelTransferTypeAdvancedHandleDistributeDistribute extends AbstractHandleDistributeServicePermeateClientTransferTypeAdvanced<NettyProxyMsg> {
|
||||
public class ClientHandleChannelTransferTypeAdvancedHandleDistributeTcpDistribute extends AbstractHandleTcpDistributeServicePermeateClientTransferTypeAdvanced<NettyProxyMsg> {
|
||||
|
||||
private final NettyClientProperties nettyClientProperties;
|
||||
|
||||
public ClientHandleChannelTransferTypeAdvancedHandleDistributeDistribute(NettyClientProperties nettyClientProperties) {
|
||||
public ClientHandleChannelTransferTypeAdvancedHandleDistributeTcpDistribute(NettyClientProperties nettyClientProperties) {
|
||||
this.nettyClientProperties = nettyClientProperties;
|
||||
}
|
||||
|
||||
@@ -3,9 +3,8 @@ package org.framework.lazy.cloud.network.heartbeat.client.netty.advanced;
|
||||
|
||||
import io.netty.channel.Channel;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.framework.lazy.cloud.network.heartbeat.client.config.NettyClientProperties;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.client.AbstractHandleDistributeClientPermeateServerTransferCloseTypeAdvanced;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.tcp.client.AbstractHandleTcpDistributeClientPermeateServerTransferCloseTypeAdvanced;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.enums.MessageTypeEnums;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
|
||||
|
||||
@@ -13,10 +12,10 @@ import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeK
|
||||
/**
|
||||
* 下发 客户端渗透服务端通信通道关闭
|
||||
*
|
||||
* @see MessageTypeEnums#DISTRIBUTE_CLIENT_PERMEATE_SERVER_TRANSFER_CLOSE
|
||||
* @see MessageTypeEnums#TCP_DISTRIBUTE_CLIENT_PERMEATE_SERVER_TRANSFER_CLOSE
|
||||
*/
|
||||
@Slf4j
|
||||
public class ClientHandleHandleDistributeClientPermeateServerTransferCloseTypeAdvanced extends AbstractHandleDistributeClientPermeateServerTransferCloseTypeAdvanced<NettyProxyMsg> {
|
||||
public class ClientHandleHandleTcpDistributeClientPermeateServerTransferCloseTypeAdvanced extends AbstractHandleTcpDistributeClientPermeateServerTransferCloseTypeAdvanced<NettyProxyMsg> {
|
||||
|
||||
/**
|
||||
* 处理当前数据
|
||||
@@ -5,8 +5,7 @@ import io.netty.channel.Channel;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.NettyVisitorPortContext;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.client.AbstractHandleDistributeClientPermeateClientCloseTypeAdvanced;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.client.AbstractHandleDistributeClientPermeateServerCloseTypeAdvanced;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.tcp.client.AbstractHandleTcpDistributeClientPermeateClientCloseTypeAdvanced;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.enums.MessageTypeEnums;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.socket.PermeateVisitorSocket;
|
||||
|
||||
@@ -14,10 +13,10 @@ import org.framework.lazy.cloud.network.heartbeat.common.socket.PermeateVisitorS
|
||||
/**
|
||||
* 客户端渗透客户端init close 信息
|
||||
*
|
||||
* @see MessageTypeEnums#DISTRIBUTE_CLIENT_PERMEATE_CLIENT_CLOSE
|
||||
* @see MessageTypeEnums#TCP_DISTRIBUTE_CLIENT_PERMEATE_CLIENT_CLOSE
|
||||
*/
|
||||
@Slf4j
|
||||
public class ClientHandleDistributeClientPermeateClientCloseTypeAdvanced extends AbstractHandleDistributeClientPermeateClientCloseTypeAdvanced<NettyProxyMsg> {
|
||||
public class ClientHandleTcpDistributeClientPermeateClientCloseTypeAdvanced extends AbstractHandleTcpDistributeClientPermeateClientCloseTypeAdvanced<NettyProxyMsg> {
|
||||
|
||||
|
||||
/**
|
||||
@@ -7,7 +7,7 @@ import org.framework.lazy.cloud.network.heartbeat.client.config.NettyClientPrope
|
||||
import org.framework.lazy.cloud.network.heartbeat.client.netty.socket.NettyClientPermeateClientVisitorSocket;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.HandleChannelTypeAdvanced;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.client.AbstractHandleDistributeClientPermeateClientInitTypeAdvanced;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.tcp.client.AbstractHandleTcpDistributeClientPermeateClientInitTypeAdvanced;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.enums.MessageTypeEnums;
|
||||
import org.wu.framework.spring.utils.SpringContextHolder;
|
||||
|
||||
@@ -18,10 +18,10 @@ import java.util.List;
|
||||
/**
|
||||
* 客户端渗透客户端init信息
|
||||
*
|
||||
* @see MessageTypeEnums#DISTRIBUTE_CLIENT_PERMEATE_CLIENT_INIT
|
||||
* @see MessageTypeEnums#TCP_DISTRIBUTE_CLIENT_PERMEATE_CLIENT_INIT
|
||||
*/
|
||||
@Slf4j
|
||||
public class ClientHandleDistributeClientPermeateClientInitTypeAdvanced extends AbstractHandleDistributeClientPermeateClientInitTypeAdvanced<NettyProxyMsg> {
|
||||
public class ClientHandleTcpDistributeClientPermeateClientInitTypeAdvanced extends AbstractHandleTcpDistributeClientPermeateClientInitTypeAdvanced<NettyProxyMsg> {
|
||||
|
||||
/**
|
||||
* 处理当前数据
|
||||
@@ -3,26 +3,19 @@ package org.framework.lazy.cloud.network.heartbeat.client.netty.advanced;
|
||||
|
||||
import io.netty.channel.Channel;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.framework.lazy.cloud.network.heartbeat.client.config.NettyClientProperties;
|
||||
import org.framework.lazy.cloud.network.heartbeat.client.netty.socket.NettyClientPermeateClientVisitorSocket;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.HandleChannelTypeAdvanced;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.client.AbstractHandleDistributeClientPermeateClientTransferCloseTypeAdvanced;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.tcp.client.AbstractHandleTcpDistributeClientPermeateClientTransferCloseTypeAdvanced;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.enums.MessageTypeEnums;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
|
||||
import org.wu.framework.spring.utils.SpringContextHolder;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 下发客户端渗透客户端通信通道关闭
|
||||
*
|
||||
* @see MessageTypeEnums#DISTRIBUTE_CLIENT_PERMEATE_CLIENT_TRANSFER_CLOSE
|
||||
* @see MessageTypeEnums#TCP_DISTRIBUTE_CLIENT_PERMEATE_CLIENT_TRANSFER_CLOSE
|
||||
*/
|
||||
@Slf4j
|
||||
public class ClientHandleDistributeClientPermeateClientTransferCloseTypeAdvanced extends AbstractHandleDistributeClientPermeateClientTransferCloseTypeAdvanced<NettyProxyMsg> {
|
||||
public class ClientHandleTcpDistributeClientPermeateClientTransferCloseTypeAdvanced extends AbstractHandleTcpDistributeClientPermeateClientTransferCloseTypeAdvanced<NettyProxyMsg> {
|
||||
|
||||
/**
|
||||
* 处理当前数据
|
||||
@@ -3,10 +3,9 @@ package org.framework.lazy.cloud.network.heartbeat.client.netty.advanced;
|
||||
|
||||
import io.netty.channel.Channel;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.framework.lazy.cloud.network.heartbeat.client.netty.socket.NettyClientPermeateServerVisitorSocket;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.NettyVisitorPortContext;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.client.AbstractHandleDistributeClientPermeateServerCloseTypeAdvanced;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.tcp.client.AbstractHandleTcpDistributeClientPermeateServerCloseTypeAdvanced;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.enums.MessageTypeEnums;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.socket.PermeateVisitorSocket;
|
||||
|
||||
@@ -14,10 +13,10 @@ import org.framework.lazy.cloud.network.heartbeat.common.socket.PermeateVisitorS
|
||||
/**
|
||||
* 客户端渗透服务端init close 信息
|
||||
*
|
||||
* @see MessageTypeEnums#DISTRIBUTE_CLIENT_PERMEATE_SERVER_CLOSE
|
||||
* @see MessageTypeEnums#TCP_DISTRIBUTE_CLIENT_PERMEATE_SERVER_CLOSE
|
||||
*/
|
||||
@Slf4j
|
||||
public class ClientHandleDistributeClientPermeateServerCloseTypeAdvanced extends AbstractHandleDistributeClientPermeateServerCloseTypeAdvanced<NettyProxyMsg> {
|
||||
public class ClientHandleTcpDistributeClientPermeateServerCloseTypeAdvanced extends AbstractHandleTcpDistributeClientPermeateServerCloseTypeAdvanced<NettyProxyMsg> {
|
||||
|
||||
|
||||
/**
|
||||
@@ -6,29 +6,26 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.framework.lazy.cloud.network.heartbeat.client.config.NettyClientProperties;
|
||||
import org.framework.lazy.cloud.network.heartbeat.client.netty.socket.NettyClientPermeateServerVisitorSocket;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.adapter.ChannelFlowAdapter;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.HandleChannelTypeAdvanced;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.client.AbstractHandleDistributeClientPermeateServerInitTypeAdvanced;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.tcp.client.AbstractHandleTcpDistributeClientPermeateServerInitTypeAdvanced;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.enums.MessageTypeEnums;
|
||||
import org.wu.framework.inner.lazy.orm.spring.SpringConnectionHandler;
|
||||
import org.wu.framework.spring.utils.SpringContextHolder;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
/**
|
||||
* 客户端渗透服务端init信息
|
||||
*
|
||||
* @see MessageTypeEnums#DISTRIBUTE_CLIENT_PERMEATE_SERVER_INIT
|
||||
* @see MessageTypeEnums#TCP_DISTRIBUTE_CLIENT_PERMEATE_SERVER_INIT
|
||||
*/
|
||||
@Slf4j
|
||||
public class ClientHandleDistributeClientPermeateServerInitTypeAdvanced extends AbstractHandleDistributeClientPermeateServerInitTypeAdvanced<NettyProxyMsg> {
|
||||
public class ClientHandleTcpDistributeClientPermeateServerInitTypeAdvanced extends AbstractHandleTcpDistributeClientPermeateServerInitTypeAdvanced<NettyProxyMsg> {
|
||||
|
||||
private final NettyClientProperties nettyClientProperties;
|
||||
|
||||
public ClientHandleDistributeClientPermeateServerInitTypeAdvanced(NettyClientProperties nettyClientProperties) {
|
||||
public ClientHandleTcpDistributeClientPermeateServerInitTypeAdvanced(NettyClientProperties nettyClientProperties) {
|
||||
this.nettyClientProperties = nettyClientProperties;
|
||||
}
|
||||
|
||||
@@ -58,6 +55,7 @@ public class ClientHandleDistributeClientPermeateServerInitTypeAdvanced extends
|
||||
try {
|
||||
nettyClientPermeateServerVisitorSocket.start();
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
@@ -4,9 +4,8 @@ package org.framework.lazy.cloud.network.heartbeat.client.netty.advanced;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.channel.Channel;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.framework.lazy.cloud.network.heartbeat.client.config.NettyClientProperties;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.client.AbstractHandleDistributeClientPermeateServerTransferTypeAdvanced;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.tcp.client.AbstractHandleTcpDistributeClientPermeateServerTransferTypeAdvanced;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.enums.MessageTypeEnums;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
|
||||
|
||||
@@ -14,10 +13,10 @@ import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeK
|
||||
/**
|
||||
* 服务端处理客户端数据传输
|
||||
*
|
||||
* @see MessageTypeEnums#DISTRIBUTE_CLIENT_TRANSFER
|
||||
* @see MessageTypeEnums#TCP_DISTRIBUTE_CLIENT_TRANSFER
|
||||
*/
|
||||
@Slf4j
|
||||
public class ClientHandleDistributeClientPermeateServerTransferTypeAdvanced extends AbstractHandleDistributeClientPermeateServerTransferTypeAdvanced<NettyProxyMsg> {
|
||||
public class ClientHandleTcpDistributeClientPermeateServerTransferTypeAdvanced extends AbstractHandleTcpDistributeClientPermeateServerTransferTypeAdvanced<NettyProxyMsg> {
|
||||
|
||||
|
||||
/**
|
||||
@@ -7,23 +7,22 @@ import org.framework.lazy.cloud.network.heartbeat.client.config.NettyClientPrope
|
||||
import org.framework.lazy.cloud.network.heartbeat.client.netty.socket.NettyClientPermeateClientRealSocket;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.HandleChannelTypeAdvanced;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.client.AbstractHandleDistributeClientTransferClientPermeateChannelConnectionSuccessfulTypeAdvanced;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.tcp.client.AbstractHandleTcpDistributeClientTransferClientPermeateChannelConnectionSuccessfulTypeAdvanced;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.enums.MessageTypeEnums;
|
||||
import org.wu.framework.spring.utils.SpringContextHolder;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
/**
|
||||
* 客户端渗透客户端数据传输通道连接成功
|
||||
*
|
||||
*
|
||||
* @see MessageTypeEnums#DISTRIBUTE_CLIENT_TRANSFER_CLIENT_PERMEATE_CHANNEL_CONNECTION_SUCCESSFUL
|
||||
* @see MessageTypeEnums#TCP_DISTRIBUTE_CLIENT_TRANSFER_CLIENT_PERMEATE_CHANNEL_CONNECTION_SUCCESSFUL
|
||||
*/
|
||||
@Slf4j
|
||||
public class ClientHandleDistributeClientTransferClientPermeateChannelConnectionSuccessfulTypeAdvanced extends AbstractHandleDistributeClientTransferClientPermeateChannelConnectionSuccessfulTypeAdvanced<NettyProxyMsg> {
|
||||
public class ClientHandleTcpDistributeClientTransferClientPermeateChannelConnectionSuccessfulTypeAdvanced extends AbstractHandleTcpDistributeClientTransferClientPermeateChannelConnectionSuccessfulTypeAdvanced<NettyProxyMsg> {
|
||||
|
||||
/**
|
||||
* 处理当前数据
|
||||
@@ -4,10 +4,8 @@ package org.framework.lazy.cloud.network.heartbeat.client.netty.advanced;
|
||||
import io.netty.channel.Channel;
|
||||
import io.netty.channel.ChannelOption;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.framework.lazy.cloud.network.heartbeat.client.netty.socket.NettyClientPermeateClientRealSocket;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.client.AbstractHandleDistributeClientTransferClientPermeateChannelConnectionSuccessfulTypeAdvanced;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.client.AbstractHandleDistributeClientTransferClientPermeateChannelInitSuccessfulTypeAdvanced;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.tcp.client.AbstractHandleTcpDistributeClientTransferClientPermeateChannelInitSuccessfulTypeAdvanced;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.enums.MessageTypeEnums;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
|
||||
|
||||
@@ -16,10 +14,10 @@ import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeK
|
||||
* 下发 客户端渗透客户端数据传输通道init 成功
|
||||
*
|
||||
*
|
||||
* @see MessageTypeEnums#DISTRIBUTE_CLIENT_TRANSFER_CLIENT_PERMEATE_CHANNEL_CONNECTION_SUCCESSFUL
|
||||
* @see MessageTypeEnums#TCP_DISTRIBUTE_CLIENT_TRANSFER_CLIENT_PERMEATE_CHANNEL_CONNECTION_SUCCESSFUL
|
||||
*/
|
||||
@Slf4j
|
||||
public class ClientHandleDistributeClientTransferClientPermeateChannelInitSuccessfulTypeAdvanced extends AbstractHandleDistributeClientTransferClientPermeateChannelInitSuccessfulTypeAdvanced<NettyProxyMsg> {
|
||||
public class ClientHandleTcpDistributeClientTransferClientPermeateChannelInitSuccessfulTypeAdvanced extends AbstractHandleTcpDistributeClientTransferClientPermeateChannelInitSuccessfulTypeAdvanced<NettyProxyMsg> {
|
||||
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import io.netty.buffer.ByteBuf;
|
||||
import io.netty.channel.Channel;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.client.AbstractHandleDistributeClientTransferClientRequestTypeAdvanced;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.tcp.client.AbstractHandleTcpDistributeClientTransferClientRequestTypeAdvanced;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.enums.MessageTypeEnums;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
|
||||
|
||||
@@ -14,10 +14,10 @@ import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeK
|
||||
* 下发客户端渗透客户端数据传输
|
||||
*
|
||||
*
|
||||
* @see MessageTypeEnums#DISTRIBUTE_CLIENT_PERMEATE_CLIENT_TRANSFER_REQUEST
|
||||
* @see MessageTypeEnums#TCP_DISTRIBUTE_CLIENT_PERMEATE_CLIENT_TRANSFER_REQUEST
|
||||
*/
|
||||
@Slf4j
|
||||
public class ClientHandleDistributeClientTransferClientRequestTypeAdvanced extends AbstractHandleDistributeClientTransferClientRequestTypeAdvanced<NettyProxyMsg> {
|
||||
public class ClientHandleTcpDistributeClientTransferClientRequestTypeAdvanced extends AbstractHandleTcpDistributeClientTransferClientRequestTypeAdvanced<NettyProxyMsg> {
|
||||
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ public class ClientHandleDistributeClientTransferClientRequestTypeAdvanced exten
|
||||
// 把数据转到真实服务
|
||||
ByteBuf buf = channel.config().getAllocator().buffer(nettyProxyMsg.getData().length);
|
||||
buf.writeBytes(nettyProxyMsg.getData());
|
||||
log.info("client permeate client send request to real socket byte:{} ",new String(nettyProxyMsg.getData()));
|
||||
log.debug("client permeate client send request to real socket byte:{} ",new String(nettyProxyMsg.getData()));
|
||||
nextChannel.writeAndFlush(buf);
|
||||
|
||||
}
|
||||
@@ -7,7 +7,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.framework.lazy.cloud.network.heartbeat.client.netty.handler.NettyClientPermeateServerVisitorHandler;
|
||||
import org.framework.lazy.cloud.network.heartbeat.client.netty.socket.NettyClientPermeateServerVisitorTransferSocket;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.client.AbstractHandleDistributeClientTransferServerPermeateChannelConnectionSuccessfulTypeAdvanced;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.tcp.client.AbstractHandleTcpDistributeClientTransferServerPermeateChannelConnectionSuccessfulTypeAdvanced;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.enums.MessageTypeEnums;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
|
||||
|
||||
@@ -17,10 +17,10 @@ import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeK
|
||||
* @see NettyClientPermeateServerVisitorTransferSocket
|
||||
* @see NettyClientPermeateServerVisitorHandler
|
||||
*
|
||||
* @see MessageTypeEnums#DISTRIBUTE_CLIENT_TRANSFER_SERVER_PERMEATE_CHANNEL_CONNECTION_SUCCESSFUL
|
||||
* @see MessageTypeEnums#TCP_DISTRIBUTE_CLIENT_TRANSFER_SERVER_PERMEATE_CHANNEL_CONNECTION_SUCCESSFUL
|
||||
*/
|
||||
@Slf4j
|
||||
public class ClientHandleDistributeClientTransferServerPermeateChannelConnectionSuccessfulTypeAdvanced extends AbstractHandleDistributeClientTransferServerPermeateChannelConnectionSuccessfulTypeAdvanced<NettyProxyMsg> {
|
||||
public class ClientHandleTcpDistributeClientTransferServerPermeateChannelConnectionSuccessfulTypeAdvanced extends AbstractHandleTcpDistributeClientTransferServerPermeateChannelConnectionSuccessfulTypeAdvanced<NettyProxyMsg> {
|
||||
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import org.framework.lazy.cloud.network.heartbeat.client.netty.socket.NettyServe
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.InternalNetworkPenetrationRealClient;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.HandleChannelTypeAdvanced;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.client.AbstractHandleDistributeServicePermeateClientRealConnectTypeAdvanced;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.tcp.client.AbstractHandleTcpDistributeServicePermeateClientRealConnectTypeAdvanced;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -15,12 +15,12 @@ import java.util.List;
|
||||
* 客户端创建真实代理同奥
|
||||
*/
|
||||
@Slf4j
|
||||
public class ClientHandleDistributeServicePermeateClientRealConnectTypeAdvanced extends AbstractHandleDistributeServicePermeateClientRealConnectTypeAdvanced<NettyProxyMsg> {
|
||||
public class ClientHandleTcpDistributeServicePermeateClientRealConnectTypeAdvanced extends AbstractHandleTcpDistributeServicePermeateClientRealConnectTypeAdvanced<NettyProxyMsg> {
|
||||
|
||||
private final NettyClientProperties nettyClientProperties;// 服务端地址信息
|
||||
private final List<HandleChannelTypeAdvanced> handleChannelTypeAdvancedList;
|
||||
|
||||
public ClientHandleDistributeServicePermeateClientRealConnectTypeAdvanced(NettyClientProperties nettyClientProperties, List<HandleChannelTypeAdvanced> handleChannelTypeAdvancedList) {
|
||||
public ClientHandleTcpDistributeServicePermeateClientRealConnectTypeAdvanced(NettyClientProperties nettyClientProperties, List<HandleChannelTypeAdvanced> handleChannelTypeAdvancedList) {
|
||||
this.nettyClientProperties = nettyClientProperties;
|
||||
this.handleChannelTypeAdvancedList = handleChannelTypeAdvancedList;
|
||||
}
|
||||
@@ -5,7 +5,7 @@ import io.netty.buffer.ByteBuf;
|
||||
import io.netty.channel.Channel;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.client.AbstractHandleDistributeServicePermeateClientTransferClientResponseTypeAdvanced;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.tcp.client.AbstractHandleTcpDistributeServicePermeateClientTransferClientResponseTypeAdvanced;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.enums.MessageTypeEnums;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
|
||||
|
||||
@@ -14,10 +14,10 @@ import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeK
|
||||
* 下发客户端渗透客户端数据传输响应
|
||||
*
|
||||
*
|
||||
* @see MessageTypeEnums#DISTRIBUTE_CLIENT_PERMEATE_CLIENT_TRANSFER_RESPONSE
|
||||
* @see MessageTypeEnums#TCP_DISTRIBUTE_CLIENT_PERMEATE_CLIENT_TRANSFER_RESPONSE
|
||||
*/
|
||||
@Slf4j
|
||||
public class ClientHandleDistributeServicePermeateClientTransferClientResponseTypeAdvanced extends AbstractHandleDistributeServicePermeateClientTransferClientResponseTypeAdvanced<NettyProxyMsg> {
|
||||
public class ClientHandleTcpDistributeServicePermeateClientTransferClientResponseTypeAdvanced extends AbstractHandleTcpDistributeServicePermeateClientTransferClientResponseTypeAdvanced<NettyProxyMsg> {
|
||||
|
||||
|
||||
|
||||
@@ -3,13 +3,13 @@ package org.framework.lazy.cloud.network.heartbeat.client.netty.advanced;
|
||||
import io.netty.channel.Channel;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.client.AbstractHandleDistributeSingleClientMessageTypeAdvanced;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.tcp.client.AbstractHandleTcpDistributeSingleClientMessageTypeAdvanced;
|
||||
|
||||
/**
|
||||
* 接收服务端发送过来的聊天信息
|
||||
*/
|
||||
@Slf4j
|
||||
public class ClientHandleDistributeSingleClientMessageTypeAdvanced extends AbstractHandleDistributeSingleClientMessageTypeAdvanced<NettyProxyMsg> {
|
||||
public class ClientHandleTcpDistributeSingleClientMessageTypeAdvanced extends AbstractHandleTcpDistributeSingleClientMessageTypeAdvanced<NettyProxyMsg> {
|
||||
/**
|
||||
* 处理当前数据
|
||||
*
|
||||
@@ -5,11 +5,11 @@ import io.netty.channel.ChannelOption;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.NettyRealIdContext;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.client.AbstractHandleDistributeSingleClientRealAutoReadConnectTypeAdvanced;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.tcp.client.AbstractHandleTcpDistributeSingleClientRealAutoReadConnectTypeAdvanced;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
|
||||
|
||||
@Slf4j
|
||||
public class ClientHandleDistributeSingleClientRealAutoReadConnectTypeAdvanced extends AbstractHandleDistributeSingleClientRealAutoReadConnectTypeAdvanced<NettyProxyMsg> {
|
||||
public class ClientHandleTcpDistributeSingleClientRealAutoReadConnectTypeAdvanced extends AbstractHandleTcpDistributeSingleClientRealAutoReadConnectTypeAdvanced<NettyProxyMsg> {
|
||||
/**
|
||||
* 处理当前数据
|
||||
*
|
||||
@@ -5,10 +5,10 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.NettyCommunicationIdContext;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.NettyRealIdContext;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.client.AbstractHandleDistributeSingleClientRealCloseVisitorTypeAdvanced;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.tcp.client.AbstractHandleTcpDistributeSingleClientRealCloseVisitorTypeAdvanced;
|
||||
|
||||
@Slf4j
|
||||
public class ClientHandleDistributeSingleClientRealCloseVisitorTypeAdvanced extends AbstractHandleDistributeSingleClientRealCloseVisitorTypeAdvanced<NettyProxyMsg> {
|
||||
public class ClientHandleTcpDistributeSingleClientRealCloseVisitorTypeAdvanced extends AbstractHandleTcpDistributeSingleClientRealCloseVisitorTypeAdvanced<NettyProxyMsg> {
|
||||
/**
|
||||
* 处理当前数据
|
||||
*
|
||||
@@ -4,14 +4,14 @@ package org.framework.lazy.cloud.network.heartbeat.client.netty.advanced;
|
||||
import io.netty.channel.Channel;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.MessageType;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.AbstractHandleChannelHeartbeatTypeAdvanced;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.tcp.AbstractTcpHandleChannelHeartbeatTypeAdvanced;
|
||||
|
||||
|
||||
/**
|
||||
* 服务端 处理客户端心跳
|
||||
* TYPE_HEARTBEAT
|
||||
* TCP_TYPE_HEARTBEAT
|
||||
*/
|
||||
public class ClientHandleChannelHeartbeatTypeAdvanced extends AbstractHandleChannelHeartbeatTypeAdvanced<NettyProxyMsg> {
|
||||
public class ClientTcpHandleChannelHeartbeatTypeAdvanced extends AbstractTcpHandleChannelHeartbeatTypeAdvanced<NettyProxyMsg> {
|
||||
|
||||
/**
|
||||
* 处理当前数据
|
||||
@@ -22,7 +22,7 @@ public class ClientHandleChannelHeartbeatTypeAdvanced extends AbstractHandleChan
|
||||
@Override
|
||||
public void doHandler(Channel channel, NettyProxyMsg msg) {
|
||||
NettyProxyMsg hb = new NettyProxyMsg();
|
||||
hb.setType(MessageType.TYPE_HEARTBEAT);
|
||||
hb.setType(MessageType.TCP_TYPE_HEARTBEAT);
|
||||
// channel.writeAndFlush(hb);
|
||||
}
|
||||
|
||||
@@ -4,16 +4,16 @@ import io.netty.channel.Channel;
|
||||
import org.framework.lazy.cloud.network.heartbeat.client.config.NettyClientProperties;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.ChannelContext;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.client.AbstractHandleClientChannelActiveAdvanced;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.tcp.client.AbstractHandleTcpClientChannelActiveAdvanced;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
|
||||
|
||||
/**
|
||||
* 客户端通道 is active
|
||||
*/
|
||||
public class HandleClientChannelActiveAdvanced extends AbstractHandleClientChannelActiveAdvanced<NettyProxyMsg> {
|
||||
public class HandleTcpClientChannelActiveAdvanced extends AbstractHandleTcpClientChannelActiveAdvanced<NettyProxyMsg> {
|
||||
private final NettyClientProperties nettyClientProperties;
|
||||
|
||||
public HandleClientChannelActiveAdvanced(NettyClientProperties nettyClientProperties) {
|
||||
public HandleTcpClientChannelActiveAdvanced(NettyClientProperties nettyClientProperties) {
|
||||
this.nettyClientProperties = nettyClientProperties;
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import io.netty.channel.Channel;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.framework.lazy.cloud.network.heartbeat.client.netty.event.ClientChangeEvent;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.client.AbstractHandleDistributeConnectSuccessNotificationTypeAdvancedHandle;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.tcp.client.AbstractHandleTcpDistributeConnectSuccessNotificationTypeAdvancedHandle;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -13,12 +13,12 @@ import java.util.List;
|
||||
* 客户端连接成功通知
|
||||
*/
|
||||
@Slf4j
|
||||
public class HandleDistributeConnectSuccessNotificationTypeAdvancedHandle extends AbstractHandleDistributeConnectSuccessNotificationTypeAdvancedHandle<NettyProxyMsg> {
|
||||
public class HandleTcpDistributeConnectSuccessNotificationTypeAdvancedHandle extends AbstractHandleTcpDistributeConnectSuccessNotificationTypeAdvancedHandle<NettyProxyMsg> {
|
||||
|
||||
private final ClientChangeEvent clientChangeEvent;
|
||||
|
||||
|
||||
public HandleDistributeConnectSuccessNotificationTypeAdvancedHandle(ClientChangeEvent clientChangeEvent) {
|
||||
public HandleTcpDistributeConnectSuccessNotificationTypeAdvancedHandle(ClientChangeEvent clientChangeEvent) {
|
||||
this.clientChangeEvent = clientChangeEvent;
|
||||
}
|
||||
|
||||
@@ -36,8 +36,8 @@ public class HandleDistributeConnectSuccessNotificationTypeAdvancedHandle extend
|
||||
|
||||
// 存储其他客户端状态
|
||||
List<String> clientIdList = JSONObject.parseArray(new String(msg.getData()), String.class);
|
||||
for (String tenantId : clientIdList) {
|
||||
clientChangeEvent.clientOnLine(tenantId);
|
||||
for (String clientId : clientIdList) {
|
||||
clientChangeEvent.clientOnLine(clientId);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -5,7 +5,7 @@ import io.netty.channel.Channel;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.framework.lazy.cloud.network.heartbeat.client.netty.event.ClientChangeEvent;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.client.AbstractHandleDistributeDisconnectTypeAdvancedHandle;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.tcp.client.AbstractHandleTcpDistributeDisconnectTypeAdvancedHandle;
|
||||
|
||||
|
||||
/**
|
||||
@@ -13,12 +13,12 @@ import org.framework.lazy.cloud.network.heartbeat.common.advanced.client.Abstrac
|
||||
* TYPE_DISCONNECT
|
||||
*/
|
||||
@Slf4j
|
||||
public class HandleDistributeDisconnectTypeAdvancedHandle extends AbstractHandleDistributeDisconnectTypeAdvancedHandle<NettyProxyMsg> {
|
||||
public class HandleTcpDistributeDisconnectTypeAdvancedHandle extends AbstractHandleTcpDistributeDisconnectTypeAdvancedHandle<NettyProxyMsg> {
|
||||
|
||||
|
||||
private final ClientChangeEvent clientChangeEvent;
|
||||
|
||||
public HandleDistributeDisconnectTypeAdvancedHandle(ClientChangeEvent clientChangeEvent) {
|
||||
public HandleTcpDistributeDisconnectTypeAdvancedHandle(ClientChangeEvent clientChangeEvent) {
|
||||
this.clientChangeEvent = clientChangeEvent;
|
||||
}
|
||||
|
||||
@@ -3,13 +3,13 @@ package org.framework.lazy.cloud.network.heartbeat.client.netty.advanced;
|
||||
import io.netty.channel.Channel;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.client.AbstractHandleDistributeStagingClosedTypeAdvanced;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.tcp.client.AbstractHandleTcpDistributeStagingClosedTypeAdvanced;
|
||||
|
||||
/**
|
||||
* 服务端下发暂存关闭消息处理
|
||||
*/
|
||||
@Slf4j
|
||||
public class HandleDistributeStagingClosedTypeAdvanced extends AbstractHandleDistributeStagingClosedTypeAdvanced<NettyProxyMsg> {
|
||||
public class HandleTcpDistributeStagingClosedTypeAdvanced extends AbstractHandleTcpDistributeStagingClosedTypeAdvanced<NettyProxyMsg> {
|
||||
|
||||
|
||||
/**
|
||||
@@ -3,16 +3,16 @@ package org.framework.lazy.cloud.network.heartbeat.client.netty.advanced;
|
||||
import io.netty.channel.Channel;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.client.AbstractHandleDistributeStagingOpenedTypeAdvanced;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.tcp.client.AbstractHandleTcpDistributeStagingOpenedTypeAdvanced;
|
||||
|
||||
/**
|
||||
* 服务端下发暂存开启消息处理
|
||||
*/
|
||||
@Slf4j
|
||||
public class HandleDistributeStagingOpenedTypeAdvanced extends AbstractHandleDistributeStagingOpenedTypeAdvanced<NettyProxyMsg> {
|
||||
public class HandleTcpDistributeStagingOpenedTypeAdvanced extends AbstractHandleTcpDistributeStagingOpenedTypeAdvanced<NettyProxyMsg> {
|
||||
|
||||
|
||||
public HandleDistributeStagingOpenedTypeAdvanced() {
|
||||
public HandleTcpDistributeStagingOpenedTypeAdvanced() {
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.framework.lazy.cloud.network.heartbeat.client.netty.filter;
|
||||
|
||||
import io.netty.buffer.UnpooledDirectByteBuf;
|
||||
import io.netty.channel.Channel;
|
||||
import io.netty.channel.ChannelPipeline;
|
||||
import io.netty.channel.socket.SocketChannel;
|
||||
|
||||
@@ -4,6 +4,7 @@ import io.netty.channel.Channel;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import io.netty.channel.ChannelPipeline;
|
||||
import io.netty.channel.socket.SocketChannel;
|
||||
import io.netty.handler.timeout.IdleStateHandler;
|
||||
import org.framework.lazy.cloud.network.heartbeat.client.netty.handler.NettyClientPermeateClientTransferHandler;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.adapter.ChannelTypeAdapter;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.decoder.NettyProxyMsgDecoder;
|
||||
@@ -35,6 +36,9 @@ public class NettyClientPermeateClientTransferFilter extends DebugChannelInitial
|
||||
// // 解码、编码
|
||||
// pipeline.addLast(new NettyProxyMsgDecoder(Integer.MAX_VALUE, 0, 4, -4, 0));
|
||||
// pipeline.addLast(new NettMsgEncoder());
|
||||
|
||||
pipeline.addLast(new IdleStateHandler(0, 4, 0));
|
||||
|
||||
pipeline.addLast(new NettyProxyMsgDecoder(Integer.MAX_VALUE, 0, 4, -4, 0));
|
||||
pipeline.addLast(new NettyProxyMsgEncoder());
|
||||
pipeline.addLast(new NettyClientPermeateClientTransferHandler(channelTypeAdapter));
|
||||
|
||||
@@ -4,6 +4,7 @@ import io.netty.channel.Channel;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import io.netty.channel.ChannelPipeline;
|
||||
import io.netty.channel.socket.SocketChannel;
|
||||
import io.netty.handler.timeout.IdleStateHandler;
|
||||
import org.framework.lazy.cloud.network.heartbeat.client.netty.handler.NettyClientPermeateClientTransferRealHandler;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.adapter.ChannelTypeAdapter;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.decoder.NettyProxyMsgDecoder;
|
||||
@@ -35,6 +36,9 @@ public class NettyClientPermeateClientTransferRealFilter extends DebugChannelIni
|
||||
// // 解码、编码
|
||||
// pipeline.addLast(new NettyProxyMsgDecoder(Integer.MAX_VALUE, 0, 4, -4, 0));
|
||||
// pipeline.addLast(new NettMsgEncoder());
|
||||
|
||||
pipeline.addLast(new IdleStateHandler(0, 4, 0));
|
||||
|
||||
pipeline.addLast(new NettyProxyMsgDecoder(Integer.MAX_VALUE, 0, 4, -4, 0));
|
||||
pipeline.addLast(new NettyProxyMsgEncoder());
|
||||
pipeline.addLast(new NettyClientPermeateClientTransferRealHandler(channelTypeAdapter));
|
||||
|
||||
@@ -36,6 +36,7 @@ public class NettyClientPermeateServerTransferFilter extends DebugChannelInitial
|
||||
// // 解码、编码
|
||||
// pipeline.addLast(new NettyProxyMsgDecoder(Integer.MAX_VALUE, 0, 4, -4, 0));
|
||||
// pipeline.addLast(new NettMsgEncoder());
|
||||
pipeline.addLast(new IdleStateHandler(0, 4, 0));
|
||||
pipeline.addLast(new NettyProxyMsgDecoder(Integer.MAX_VALUE, 0, 4, -4, 0));
|
||||
pipeline.addLast(new IdleStateHandler(0, 4, 0));
|
||||
pipeline.addLast(new NettyProxyMsgEncoder());
|
||||
|
||||
@@ -5,16 +5,16 @@ import io.netty.channel.ChannelDuplexHandler;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import io.netty.channel.ChannelPipeline;
|
||||
import io.netty.channel.socket.SocketChannel;
|
||||
import org.framework.lazy.cloud.network.heartbeat.client.netty.InternalNetworkPermeateServerVisitor;
|
||||
import org.framework.lazy.cloud.network.heartbeat.client.netty.InternalNetworkClientPermeateServerVisitor;
|
||||
import org.framework.lazy.cloud.network.heartbeat.client.netty.handler.NettyClientPermeateServerVisitorHandler;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.filter.DebugChannelInitializer;
|
||||
|
||||
public class NettyClientPermeateServerVisitorFilter extends DebugChannelInitializer<SocketChannel> {
|
||||
|
||||
private final InternalNetworkPermeateServerVisitor internalNetworkPermeateServerVisitor;
|
||||
private final InternalNetworkClientPermeateServerVisitor internalNetworkClientPermeateServerVisitor;
|
||||
|
||||
public NettyClientPermeateServerVisitorFilter(InternalNetworkPermeateServerVisitor internalNetworkPermeateServerVisitor) {
|
||||
this.internalNetworkPermeateServerVisitor = internalNetworkPermeateServerVisitor;
|
||||
public NettyClientPermeateServerVisitorFilter(InternalNetworkClientPermeateServerVisitor internalNetworkClientPermeateServerVisitor) {
|
||||
this.internalNetworkClientPermeateServerVisitor = internalNetworkClientPermeateServerVisitor;
|
||||
|
||||
}
|
||||
|
||||
@@ -31,6 +31,6 @@ public class NettyClientPermeateServerVisitorFilter extends DebugChannelInitiali
|
||||
protected void initChannel0(SocketChannel ch) throws Exception {
|
||||
ChannelPipeline pipeline = ch.pipeline();
|
||||
pipeline.addLast(new ChannelDuplexHandler());
|
||||
pipeline.addLast(new NettyClientPermeateServerVisitorHandler(internalNetworkPermeateServerVisitor));
|
||||
pipeline.addLast(new NettyClientPermeateServerVisitorHandler(internalNetworkClientPermeateServerVisitor));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ public class NettyClientHandler extends SimpleChannelInboundHandler<NettyProxyMs
|
||||
// 处理客户端连接成功
|
||||
Channel channel = ctx.channel();
|
||||
NettyProxyMsg nettyMsg = new NettyProxyMsg();
|
||||
nettyMsg.setType(MessageType.CLIENT_CHANNEL_ACTIVE);
|
||||
nettyMsg.setType(MessageType.TCP_CLIENT_CHANNEL_ACTIVE);
|
||||
nettyMsg.setClientId(clientId);
|
||||
channelTypeAdapter.handler(channel, nettyMsg);
|
||||
|
||||
@@ -97,7 +97,7 @@ public class NettyClientHandler extends SimpleChannelInboundHandler<NettyProxyMs
|
||||
if (IdleState.WRITER_IDLE.equals(event.state())) { //如果写通道处于空闲状态,就发送心跳命令
|
||||
String clientId = nettyClientSocket.getClientId();
|
||||
NettyProxyMsg nettyMsg = new NettyProxyMsg();
|
||||
nettyMsg.setType(MessageType.TYPE_HEARTBEAT);
|
||||
nettyMsg.setType(MessageType.TCP_TYPE_HEARTBEAT);
|
||||
nettyMsg.setData(clientId.getBytes(StandardCharsets.UTF_8));
|
||||
nettyMsg.setClientId(clientId.getBytes(StandardCharsets.UTF_8));
|
||||
ctx.writeAndFlush(nettyMsg);// 发送心跳数据
|
||||
@@ -106,7 +106,7 @@ public class NettyClientHandler extends SimpleChannelInboundHandler<NettyProxyMs
|
||||
String clientId = nettyClientSocket.getClientId();
|
||||
Channel channel = ctx.channel();
|
||||
NettyProxyMsg nettyMsg = new NettyProxyMsg();
|
||||
nettyMsg.setType(MessageType.DISTRIBUTE_CLIENT_DISCONNECTION_NOTIFICATION);
|
||||
nettyMsg.setType(MessageType.TCP_DISTRIBUTE_CLIENT_DISCONNECTION_NOTIFICATION);
|
||||
nettyMsg.setClientId(clientId.getBytes(StandardCharsets.UTF_8));
|
||||
channelTypeAdapter.handler(channel, nettyMsg);
|
||||
ctx.close();
|
||||
|
||||
@@ -32,7 +32,7 @@ public class NettyClientPermeateClientRealHandler extends SimpleChannelInboundHa
|
||||
// 访客通信通道 上报服务端代理完成
|
||||
Channel nextChannel = ChannelAttributeKeyUtils.getNextChannel(ctx.channel());
|
||||
NettyProxyMsg returnMessage = new NettyProxyMsg();
|
||||
returnMessage.setType(MessageType.REPORT_CLIENT_TRANSFER_CLIENT_RESPONSE);
|
||||
returnMessage.setType(MessageType.TCP_REPORT_CLIENT_TRANSFER_CLIENT_RESPONSE);
|
||||
returnMessage.setVisitorId(visitorId);
|
||||
returnMessage.setClientId(clientId);
|
||||
returnMessage.setVisitorPort(visitorPort);
|
||||
@@ -55,7 +55,7 @@ public class NettyClientPermeateClientRealHandler extends SimpleChannelInboundHa
|
||||
if (nextChannel != null) {
|
||||
// 上报关闭这个客户端的访客通道
|
||||
NettyProxyMsg closeVisitorMsg = new NettyProxyMsg();
|
||||
closeVisitorMsg.setType(MessageType.REPORT_CLIENT_PERMEATE_CLIENT_TRANSFER_CLOSE);
|
||||
closeVisitorMsg.setType(MessageType.TCP_REPORT_CLIENT_PERMEATE_CLIENT_TRANSFER_CLOSE);
|
||||
closeVisitorMsg.setVisitorId(visitorId);
|
||||
nextChannel.writeAndFlush(closeVisitorMsg);
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ public class NettyClientPermeateClientTransferHandler extends SimpleChannelInbou
|
||||
if (nextChannel != null) {
|
||||
// 上报关闭这个客户端的访客通道
|
||||
NettyProxyMsg closeVisitorMsg = new NettyProxyMsg();
|
||||
closeVisitorMsg.setType(MessageType.REPORT_CLIENT_PERMEATE_CLIENT_TRANSFER_CLOSE);
|
||||
closeVisitorMsg.setType(MessageType.TCP_REPORT_CLIENT_PERMEATE_CLIENT_TRANSFER_CLOSE);
|
||||
closeVisitorMsg.setVisitorId(visitorId);
|
||||
nextChannel.writeAndFlush(closeVisitorMsg);
|
||||
}
|
||||
|
||||
@@ -42,12 +42,13 @@ public class NettyClientPermeateClientTransferRealHandler extends SimpleChannelI
|
||||
String clientId = ChannelAttributeKeyUtils.getClientId(ctx.channel());
|
||||
String visitorId = ChannelAttributeKeyUtils.getVisitorId(ctx.channel());
|
||||
Channel nextChannel = ChannelAttributeKeyUtils.getNextChannel(ctx.channel());
|
||||
log.warn("close client permeate client transfer real clientId:{} visitorId:{}", clientId, visitorId);
|
||||
// 关闭访客
|
||||
if (nextChannel != null) {
|
||||
|
||||
// 上报关闭这个客户端的访客通道
|
||||
NettyProxyMsg closeVisitorMsg = new NettyProxyMsg();
|
||||
closeVisitorMsg.setType(MessageType.REPORT_CLIENT_PERMEATE_CLIENT_TRANSFER_CLOSE);
|
||||
closeVisitorMsg.setType(MessageType.TCP_REPORT_CLIENT_PERMEATE_CLIENT_TRANSFER_CLOSE);
|
||||
closeVisitorMsg.setVisitorId(visitorId);
|
||||
nextChannel.writeAndFlush(closeVisitorMsg);
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import io.netty.channel.SimpleChannelInboundHandler;
|
||||
import io.netty.util.internal.StringUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.framework.lazy.cloud.network.heartbeat.client.netty.InternalNetworkClientPermeateClientVisitor;
|
||||
import org.framework.lazy.cloud.network.heartbeat.client.netty.advanced.ClientHandleDistributeClientTransferServerPermeateChannelConnectionSuccessfulTypeAdvanced;
|
||||
import org.framework.lazy.cloud.network.heartbeat.client.netty.advanced.ClientHandleTcpDistributeClientTransferServerPermeateChannelConnectionSuccessfulTypeAdvanced;
|
||||
import org.framework.lazy.cloud.network.heartbeat.client.netty.socket.NettyClientPermeateClientVisitorTransferSocket;
|
||||
import org.framework.lazy.cloud.network.heartbeat.client.netty.socket.NettyClientPermeateServerVisitorTransferSocket;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.MessageType;
|
||||
@@ -33,7 +33,7 @@ public class NettyClientPermeateClientVisitorHandler extends SimpleChannelInbou
|
||||
* @param ctx
|
||||
* @throws Exception
|
||||
* @see NettyClientPermeateServerVisitorTransferSocket
|
||||
* @see ClientHandleDistributeClientTransferServerPermeateChannelConnectionSuccessfulTypeAdvanced
|
||||
* @see ClientHandleTcpDistributeClientTransferServerPermeateChannelConnectionSuccessfulTypeAdvanced
|
||||
*/
|
||||
@Override
|
||||
public void channelActive(ChannelHandlerContext ctx) throws Exception {
|
||||
@@ -54,7 +54,7 @@ public class NettyClientPermeateClientVisitorHandler extends SimpleChannelInbou
|
||||
// Channel transferChannel = nettyChannelPool.availableChannel(visitorId);
|
||||
// 创建访客连接客户端通道
|
||||
NettyClientPermeateClientVisitorTransferSocket.buildTransferServer(internalNetworkClientPermeateClientVisitor,visitorChannel);
|
||||
log.info("客户端渗透客户端访客端口连接成功了");
|
||||
log.info("客户端渗透客户端访客:【{}】端口连接成功了",visitorId);
|
||||
super.channelActive(ctx);
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ public class NettyClientPermeateClientVisitorHandler extends SimpleChannelInbou
|
||||
Integer visitorPort = internalNetworkClientPermeateClientVisitor.getVisitorPort();
|
||||
String clientId = internalNetworkClientPermeateClientVisitor.getNettyClientProperties().getClientId();
|
||||
NettyProxyMsg nettyProxyMsg = new NettyProxyMsg();
|
||||
nettyProxyMsg.setType(MessageType.REPORT_CLIENT_PERMEATE_CLIENT_TRANSFER_REQUEST);
|
||||
nettyProxyMsg.setType(MessageType.TCP_REPORT_CLIENT_PERMEATE_CLIENT_TRANSFER_REQUEST);
|
||||
nettyProxyMsg.setVisitorId(visitorId);
|
||||
nettyProxyMsg.setClientId(clientId);
|
||||
nettyProxyMsg.setVisitorPort(visitorPort);
|
||||
@@ -102,13 +102,13 @@ public class NettyClientPermeateClientVisitorHandler extends SimpleChannelInbou
|
||||
|
||||
// 通知客户端 关闭访问通道、真实通道
|
||||
NettyProxyMsg myMsg = new NettyProxyMsg();
|
||||
myMsg.setType(MessageType.REPORT_CLIENT_PERMEATE_CLIENT_TRANSFER_CLOSE);
|
||||
myMsg.setType(MessageType.TCP_REPORT_CLIENT_PERMEATE_CLIENT_TRANSFER_CLOSE);
|
||||
nextChannel.writeAndFlush(myMsg);
|
||||
}
|
||||
// 关闭 访客通信通道、访客真实通道
|
||||
NettyRealIdContext.clear(visitorId);
|
||||
NettyCommunicationIdContext.clear(visitorId);
|
||||
log.warn("【客户端渗透客户端】访客端口断开连接");
|
||||
log.warn("【客户端渗透客户端】访客:【{}】端口断开连接",visitorId);
|
||||
super.channelInactive(ctx);
|
||||
}
|
||||
|
||||
@@ -127,6 +127,7 @@ public class NettyClientPermeateClientVisitorHandler extends SimpleChannelInbou
|
||||
|
||||
@Override
|
||||
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
|
||||
cause.printStackTrace();
|
||||
log.error("exceptionCaught");
|
||||
}
|
||||
}
|
||||
@@ -47,7 +47,7 @@ public class NettyClientPermeateServerTransferHandler extends SimpleChannelInbou
|
||||
if (nextChannel != null) {
|
||||
// 上报关闭服务端客户端真实通道
|
||||
NettyProxyMsg closeVisitorMsg = new NettyProxyMsg();
|
||||
closeVisitorMsg.setType(MessageType.REPORT_CLIENT_PERMEATE_SERVER_TRANSFER_CLOSE);
|
||||
closeVisitorMsg.setType(MessageType.TCP_TCP_REPORT_CLIENT_PERMEATE_SERVER_TRANSFER_CLOSE);
|
||||
closeVisitorMsg.setVisitorId(visitorId);
|
||||
nextChannel.writeAndFlush(closeVisitorMsg);
|
||||
}
|
||||
@@ -79,7 +79,7 @@ public class NettyClientPermeateServerTransferHandler extends SimpleChannelInbou
|
||||
if (obj instanceof IdleStateEvent event) {
|
||||
if (IdleState.WRITER_IDLE.equals(event.state())) { //如果写通道处于空闲状态,就发送心跳命令
|
||||
NettyProxyMsg nettyMsg = new NettyProxyMsg();
|
||||
nettyMsg.setType(MessageType.TYPE_HEARTBEAT);
|
||||
nettyMsg.setType(MessageType.TCP_TYPE_HEARTBEAT);
|
||||
ctx.writeAndFlush(nettyMsg);// 发送心跳数据
|
||||
} else if (event.state() == IdleState.WRITER_IDLE) { // 如果检测到写空闲状态,关闭连接
|
||||
// 离线、暂存通知
|
||||
|
||||
@@ -8,8 +8,8 @@ import io.netty.channel.ChannelOption;
|
||||
import io.netty.channel.SimpleChannelInboundHandler;
|
||||
import io.netty.util.internal.StringUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.framework.lazy.cloud.network.heartbeat.client.netty.InternalNetworkPermeateServerVisitor;
|
||||
import org.framework.lazy.cloud.network.heartbeat.client.netty.advanced.ClientHandleDistributeClientTransferServerPermeateChannelConnectionSuccessfulTypeAdvanced;
|
||||
import org.framework.lazy.cloud.network.heartbeat.client.netty.InternalNetworkClientPermeateServerVisitor;
|
||||
import org.framework.lazy.cloud.network.heartbeat.client.netty.advanced.ClientHandleTcpDistributeClientTransferServerPermeateChannelConnectionSuccessfulTypeAdvanced;
|
||||
import org.framework.lazy.cloud.network.heartbeat.client.netty.socket.NettyClientPermeateServerVisitorTransferSocket;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.MessageType;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
|
||||
@@ -19,18 +19,18 @@ import java.util.UUID;
|
||||
|
||||
@Slf4j
|
||||
public class NettyClientPermeateServerVisitorHandler extends SimpleChannelInboundHandler<ByteBuf> {
|
||||
private final InternalNetworkPermeateServerVisitor internalNetworkPermeateServerVisitor;
|
||||
private final InternalNetworkClientPermeateServerVisitor internalNetworkClientPermeateServerVisitor;
|
||||
// private final NettyChannelPool nettyChannelPool = new DefaultNettyChannelPool(10);
|
||||
|
||||
public NettyClientPermeateServerVisitorHandler(InternalNetworkPermeateServerVisitor internalNetworkPermeateServerVisitor) {
|
||||
this.internalNetworkPermeateServerVisitor = internalNetworkPermeateServerVisitor;
|
||||
public NettyClientPermeateServerVisitorHandler(InternalNetworkClientPermeateServerVisitor internalNetworkClientPermeateServerVisitor) {
|
||||
this.internalNetworkClientPermeateServerVisitor = internalNetworkClientPermeateServerVisitor;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ctx
|
||||
* @throws Exception
|
||||
* @see NettyClientPermeateServerVisitorTransferSocket
|
||||
* @see ClientHandleDistributeClientTransferServerPermeateChannelConnectionSuccessfulTypeAdvanced
|
||||
* @see ClientHandleTcpDistributeClientTransferServerPermeateChannelConnectionSuccessfulTypeAdvanced
|
||||
*/
|
||||
@Override
|
||||
public void channelActive(ChannelHandlerContext ctx) throws Exception {
|
||||
@@ -41,15 +41,15 @@ public class NettyClientPermeateServerVisitorHandler extends SimpleChannelInboun
|
||||
|
||||
// 生成访客ID
|
||||
String visitorId = UUID.randomUUID().toString();
|
||||
Integer visitorPort = internalNetworkPermeateServerVisitor.getVisitorPort();
|
||||
Integer visitorPort = internalNetworkClientPermeateServerVisitor.getVisitorPort();
|
||||
|
||||
log.info("this channel with visitor port:{} use visitorId:{}", visitorPort, visitorId);
|
||||
ChannelAttributeKeyUtils.buildVisitorId(visitorChannel, visitorId);
|
||||
// 判断是否有可用的通道 如果没有创建新的通道
|
||||
// Channel transferChannel = nettyChannelPool.availableChannel(visitorId);
|
||||
// 创建访客连接服务端通道
|
||||
NettyClientPermeateServerVisitorTransferSocket.buildTransferServer(internalNetworkPermeateServerVisitor,visitorChannel);
|
||||
log.info("客户端渗透服务端访客端口连接成功了,访客ID:{}", visitorId);
|
||||
NettyClientPermeateServerVisitorTransferSocket.buildTransferServer(internalNetworkClientPermeateServerVisitor,visitorChannel);
|
||||
log.debug("客户端渗透服务端访客端口连接成功了,访客ID:{}", visitorId);
|
||||
super.channelActive(ctx);
|
||||
}
|
||||
|
||||
@@ -67,17 +67,17 @@ public class NettyClientPermeateServerVisitorHandler extends SimpleChannelInboun
|
||||
log.debug("【客户端渗透服务端】访客端口成功接收数据:{}", new String(bytes));
|
||||
|
||||
// 使用访客的通信通道
|
||||
Integer visitorPort = internalNetworkPermeateServerVisitor.getVisitorPort();
|
||||
String clientId = internalNetworkPermeateServerVisitor.getNettyClientProperties().getClientId();
|
||||
Integer visitorPort = internalNetworkClientPermeateServerVisitor.getVisitorPort();
|
||||
String clientId = internalNetworkClientPermeateServerVisitor.getNettyClientProperties().getClientId();
|
||||
NettyProxyMsg nettyProxyMsg = new NettyProxyMsg();
|
||||
nettyProxyMsg.setType(MessageType.REPORT_CLIENT_PERMEATE_SERVER_TRANSFER);
|
||||
nettyProxyMsg.setType(MessageType.TCP_REPORT_CLIENT_PERMEATE_SERVER_TRANSFER);
|
||||
nettyProxyMsg.setVisitorId(visitorId);
|
||||
nettyProxyMsg.setClientId(clientId);
|
||||
nettyProxyMsg.setVisitorPort(visitorPort);
|
||||
nettyProxyMsg.setData(bytes);
|
||||
nextChannel.writeAndFlush(nettyProxyMsg);
|
||||
// 处理访客流量
|
||||
log.info("【客户端渗透服务端】访客端口成功发送数据了 访客ID:{}", visitorId);
|
||||
log.debug("【客户端渗透服务端】访客端口成功发送数据了 访客ID:{}", visitorId);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -95,14 +95,14 @@ public class NettyClientPermeateServerVisitorHandler extends SimpleChannelInboun
|
||||
if (nextChannel != null && nextChannel.isActive()) {
|
||||
// 通知服务端 关闭访问通道、真实通道
|
||||
NettyProxyMsg myMsg = new NettyProxyMsg();
|
||||
myMsg.setType(MessageType.REPORT_CLIENT_PERMEATE_SERVER_TRANSFER_CLOSE);
|
||||
myMsg.setType(MessageType.TCP_TCP_REPORT_CLIENT_PERMEATE_SERVER_TRANSFER_CLOSE);
|
||||
myMsg.setVisitorId(visitorId);
|
||||
nextChannel.writeAndFlush(myMsg);
|
||||
//通信通道
|
||||
nextChannel.close();
|
||||
log.info("关闭访问通道、真实通道 with visitorId:{}", visitorId);
|
||||
log.debug("关闭访问通道、真实通道 with visitorId:{}", visitorId);
|
||||
}else {
|
||||
log.info("channel inactive:{}", nextChannel);
|
||||
log.debug("channel inactive:{}", nextChannel);
|
||||
}
|
||||
// 访客通道关闭
|
||||
channel.close();
|
||||
@@ -136,7 +136,7 @@ public class NettyClientPermeateServerVisitorHandler extends SimpleChannelInboun
|
||||
if (nextChannel != null) {
|
||||
// 下发关闭访客
|
||||
NettyProxyMsg closeRealClient = new NettyProxyMsg();
|
||||
closeRealClient.setType(MessageType.REPORT_CLIENT_PERMEATE_SERVER_TRANSFER_CLOSE);
|
||||
closeRealClient.setType(MessageType.TCP_TCP_REPORT_CLIENT_PERMEATE_SERVER_TRANSFER_CLOSE);
|
||||
closeRealClient.setClientId(clientId);
|
||||
closeRealClient.setVisitorId(visitorId);
|
||||
nextChannel.writeAndFlush(closeRealClient);
|
||||
|
||||
@@ -31,7 +31,7 @@ public class NettyServerPermeateClientRealHandler extends SimpleChannelInboundHa
|
||||
// 访客通信通道 上报服务端代理完成
|
||||
Channel visitor = ChannelAttributeKeyUtils.getNextChannel(ctx.channel());
|
||||
NettyProxyMsg returnMessage = new NettyProxyMsg();
|
||||
returnMessage.setType(MessageType.REPORT_CLIENT_TRANSFER);
|
||||
returnMessage.setType(MessageType.TCP_REPORT_CLIENT_TRANSFER);
|
||||
returnMessage.setVisitorId(visitorId);
|
||||
returnMessage.setClientId(clientId);
|
||||
returnMessage.setVisitorPort(visitorPort);
|
||||
@@ -55,7 +55,7 @@ public class NettyServerPermeateClientRealHandler extends SimpleChannelInboundHa
|
||||
if (visitor != null) {
|
||||
// 上报关闭这个客户端的访客通道
|
||||
NettyProxyMsg closeVisitorMsg = new NettyProxyMsg();
|
||||
closeVisitorMsg.setType(MessageType.REPORT_SERVICE_PERMEATE_CLIENT_CLIENT_CLOSE_VISITOR);
|
||||
closeVisitorMsg.setType(MessageType.TCP_REPORT_SERVICE_PERMEATE_CLIENT_CLIENT_CLOSE_VISITOR);
|
||||
closeVisitorMsg.setVisitorId(visitorId);
|
||||
visitor.writeAndFlush(closeVisitorMsg);
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ public class NettyServerPermeateClientTransferHandler extends SimpleChannelInbou
|
||||
if (nextChannel != null) {
|
||||
// 上报关闭这个客户端的访客通道
|
||||
NettyProxyMsg closeVisitorMsg = new NettyProxyMsg();
|
||||
closeVisitorMsg.setType(MessageType.REPORT_SERVICE_PERMEATE_CLIENT_CLIENT_CLOSE_VISITOR);
|
||||
closeVisitorMsg.setType(MessageType.TCP_REPORT_SERVICE_PERMEATE_CLIENT_CLIENT_CLOSE_VISITOR);
|
||||
closeVisitorMsg.setVisitorId(visitorId);
|
||||
nextChannel.writeAndFlush(closeVisitorMsg);
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ public class NettyClientPermeateClientRealSocket {
|
||||
Channel realChannel = future.channel();
|
||||
realChannel.config().setOption(ChannelOption.AUTO_READ, false);
|
||||
|
||||
log.info("访客通过 客户端:【{}】,绑定本地服务,IP:{},端口:{} 新建通道成功", clientId, clientTargetIp, clientTargetPort);
|
||||
log.info("访客通过 客户端:【{}】,visitorId:{},绑定本地服务,IP:{},端口:{} 新建通道成功", clientId,visitorId, clientTargetIp, clientTargetPort);
|
||||
// 客户端真实通道
|
||||
NettyRealIdContext.pushReal(realChannel, visitorId);
|
||||
// 绑定访客ID到当前真实通道属性
|
||||
@@ -126,11 +126,9 @@ public class NettyClientPermeateClientRealSocket {
|
||||
|
||||
|
||||
// 客户端新建访客通道 连接服务端IP:{},连接服务端端口:{}
|
||||
log.info("Client creates a new visitor channel to connect to server IP: {}, connecting to server port: {}", inetHost, inetPort);
|
||||
log.info("client creates a new visitor channel to connect to server IP: {}, connecting to server port: {} with visitorId:{} & clientId:{}", inetHost, inetPort,visitorId,clientId);
|
||||
ChannelFuture future = bootstrap.connect(inetHost, inetPort);
|
||||
|
||||
// 使用的客户端ID:{}
|
||||
log.info("Client ID used: {}", clientId);
|
||||
future.addListener((ChannelFutureListener) futureListener -> {
|
||||
Channel transferChannel = futureListener.channel();
|
||||
if (futureListener.isSuccess()) {
|
||||
@@ -142,7 +140,7 @@ public class NettyClientPermeateClientRealSocket {
|
||||
nettyProxyMsg.setClientTargetIp(clientTargetIp);
|
||||
nettyProxyMsg.setClientTargetPort(clientTargetPort);
|
||||
nettyProxyMsg.setVisitorPort(visitorPort);
|
||||
nettyProxyMsg.setType(MessageType.REPORT_CLIENT_PERMEATE_CLIENT_TRANSFER_CHANNEL_INIT_SUCCESSFUL);
|
||||
nettyProxyMsg.setType(MessageType.TCP_REPORT_CLIENT_PERMEATE_CLIENT_TRANSFER_CHANNEL_INIT_SUCCESSFUL);
|
||||
transferChannel.writeAndFlush(nettyProxyMsg);
|
||||
|
||||
ChannelAttributeKeyUtils.buildNextChannel(transferChannel, realChannel);
|
||||
@@ -152,11 +150,13 @@ public class NettyClientPermeateClientRealSocket {
|
||||
ChannelAttributeKeyUtils.buildVisitorId(transferChannel, visitorId);
|
||||
ChannelAttributeKeyUtils.buildClientId(transferChannel, clientId);
|
||||
|
||||
ChannelAttributeKeyUtils.buildVisitorPort(transferChannel, visitorPort);
|
||||
|
||||
|
||||
|
||||
} else {
|
||||
log.info("无法连接到服务端....");
|
||||
transferChannel.eventLoop().schedule(() -> {
|
||||
eventLoopGroup.schedule(() -> {
|
||||
try {
|
||||
newVisitorConnect2Server(clientId,
|
||||
clientTargetIp,
|
||||
|
||||
@@ -14,6 +14,7 @@ import org.framework.lazy.cloud.network.heartbeat.common.NettyVisitorPortContext
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.adapter.ChannelFlowAdapter;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.HandleChannelTypeAdvanced;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.socket.PermeateVisitorSocket;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -72,9 +73,11 @@ public class NettyClientPermeateClientVisitorSocket implements PermeateVisitorSo
|
||||
try {
|
||||
bootstrap.bind(visitorPort).sync().addListener((ChannelFutureListener) future -> {
|
||||
if (future.isSuccess()) {
|
||||
Channel channel = future.channel();
|
||||
ChannelAttributeKeyUtils.buildVisitorPort(channel,visitorPort);
|
||||
// 这里时异步处理
|
||||
log.info("客户端:[{}]访客端口:[{}] 开启", clientId, visitorPort);
|
||||
NettyVisitorPortContext.pushVisitorChannel(visitorPort, future.channel());
|
||||
NettyVisitorPortContext.pushVisitorChannel(visitorPort, channel);
|
||||
|
||||
} else {
|
||||
log.error("客户端:[{}]访客端口:[{}]绑定失败", clientId, visitorPort);
|
||||
|
||||
@@ -10,9 +10,7 @@ import org.framework.lazy.cloud.network.heartbeat.client.config.NettyClientPrope
|
||||
import org.framework.lazy.cloud.network.heartbeat.client.netty.InternalNetworkClientPermeateClientVisitor;
|
||||
import org.framework.lazy.cloud.network.heartbeat.client.netty.filter.NettyClientPermeateClientTransferFilter;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.MessageType;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.NettyCommunicationIdContext;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.NettyRealIdContext;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.adapter.ChannelTypeAdapter;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
|
||||
|
||||
@@ -28,7 +26,7 @@ public class NettyClientPermeateClientVisitorTransferSocket {
|
||||
/**
|
||||
* 连接服务端通信通道
|
||||
*/
|
||||
public static void buildTransferServer(InternalNetworkClientPermeateClientVisitor internalNetworkClientPermeateClientVisitor,Channel visitorChannel) {
|
||||
public static void buildTransferServer(InternalNetworkClientPermeateClientVisitor internalNetworkClientPermeateClientVisitor, Channel visitorChannel) {
|
||||
|
||||
|
||||
Bootstrap bootstrap = new Bootstrap();
|
||||
@@ -62,25 +60,24 @@ public class NettyClientPermeateClientVisitorTransferSocket {
|
||||
String toClientId = internalNetworkClientPermeateClientVisitor.getToClientId();
|
||||
|
||||
// 客户端新建访客通道 连接服务端IP:{},连接服务端端口:{}
|
||||
log.info("Client creates a new visitor channel to connect to server IP: {}, connecting to server port: {}", inetHost, inetPort);
|
||||
log.info("Client creates a new visitor channel to connect to server IP: {}, connecting to server port: {} with clientId:【{}】 toClientId:【{}】 & visitorId:【{}】", inetHost, inetPort, clientId, toClientId, visitorId);
|
||||
ChannelFuture future = bootstrap.connect(inetHost, inetPort);
|
||||
|
||||
// 使用的客户端ID:{}
|
||||
log.info("Client ID used: {}", clientId);
|
||||
future.addListener((ChannelFutureListener) futureListener -> {
|
||||
Channel transferChannel = futureListener.channel();
|
||||
if (futureListener.isSuccess()) {
|
||||
|
||||
NettyProxyMsg myMsg = new NettyProxyMsg();
|
||||
myMsg.setType(MessageType.REPORT_CLIENT_TRANSFER_CLIENT_PERMEATE_CHANNEL_CONNECTION_SUCCESSFUL);
|
||||
NettyProxyMsg nettyProxyMsg = new NettyProxyMsg();
|
||||
nettyProxyMsg.setType(MessageType.TCP_REPORT_CLIENT_TRANSFER_CLIENT_PERMEATE_CHANNEL_CONNECTION_SUCCESSFUL);
|
||||
// other clientId
|
||||
myMsg.setClientId(toClientId);
|
||||
myMsg.setVisitorPort(visitorPort);
|
||||
myMsg.setClientTargetIp(targetIp);
|
||||
myMsg.setClientTargetPort(targetPort);
|
||||
nettyProxyMsg.setClientId(toClientId);
|
||||
nettyProxyMsg.setVisitorPort(visitorPort);
|
||||
nettyProxyMsg.setClientTargetIp(targetIp);
|
||||
nettyProxyMsg.setClientTargetPort(targetPort);
|
||||
|
||||
myMsg.setVisitorId(visitorId);
|
||||
transferChannel.writeAndFlush(myMsg);
|
||||
nettyProxyMsg.setVisitorId(visitorId);
|
||||
transferChannel.writeAndFlush(nettyProxyMsg);
|
||||
// 绑定客户端真实通信通道
|
||||
ChannelAttributeKeyUtils.buildVisitorId(transferChannel, visitorId);
|
||||
ChannelAttributeKeyUtils.buildClientId(transferChannel, clientId);
|
||||
@@ -91,9 +88,9 @@ public class NettyClientPermeateClientVisitorTransferSocket {
|
||||
|
||||
} else {
|
||||
log.info("无法连接到服务端....");
|
||||
transferChannel.eventLoop().schedule(() -> {
|
||||
eventLoopGroup.schedule(() -> {
|
||||
try {
|
||||
buildTransferServer(internalNetworkClientPermeateClientVisitor,visitorChannel);
|
||||
buildTransferServer(internalNetworkClientPermeateClientVisitor, visitorChannel);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -7,12 +7,13 @@ import io.netty.channel.socket.nio.NioServerSocketChannel;
|
||||
import lombok.Getter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.framework.lazy.cloud.network.heartbeat.client.config.NettyClientProperties;
|
||||
import org.framework.lazy.cloud.network.heartbeat.client.netty.InternalNetworkPermeateServerVisitor;
|
||||
import org.framework.lazy.cloud.network.heartbeat.client.netty.InternalNetworkClientPermeateServerVisitor;
|
||||
import org.framework.lazy.cloud.network.heartbeat.client.netty.filter.NettyClientPermeateServerVisitorFilter;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.NettyClientVisitorContext;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.NettyVisitorPortContext;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.HandleChannelTypeAdvanced;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.socket.PermeateVisitorSocket;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -73,7 +74,8 @@ public class NettyClientPermeateServerVisitorSocket implements PermeateVisitorSo
|
||||
if (future.isSuccess()) {
|
||||
// 这里时异步处理
|
||||
log.info("客户端:[{}]访客端口:[{}] 开启", clientId, visitorPort);
|
||||
|
||||
Channel channel = future.channel();
|
||||
ChannelAttributeKeyUtils.buildVisitorPort(channel,visitorPort);
|
||||
} else {
|
||||
log.error("客户端:[{}]访客端口:[{}]绑定失败", clientId, visitorPort);
|
||||
}
|
||||
@@ -216,16 +218,16 @@ public class NettyClientPermeateServerVisitorSocket implements PermeateVisitorSo
|
||||
if (visitorPort == null) {
|
||||
throw new IllegalArgumentException("visitorPort must not null");
|
||||
}
|
||||
InternalNetworkPermeateServerVisitor internalNetworkPermeateServerVisitor = new InternalNetworkPermeateServerVisitor();
|
||||
InternalNetworkClientPermeateServerVisitor internalNetworkClientPermeateServerVisitor = new InternalNetworkClientPermeateServerVisitor();
|
||||
|
||||
internalNetworkPermeateServerVisitor.setTargetIp(clientTargetIp);
|
||||
internalNetworkPermeateServerVisitor.setTargetPort(clientTargetPort);
|
||||
internalNetworkPermeateServerVisitor.setVisitorPort(visitorPort);
|
||||
internalNetworkPermeateServerVisitor.setNettyClientProperties(nettyClientProperties);
|
||||
internalNetworkPermeateServerVisitor.setHandleChannelTypeAdvancedList(handleChannelTypeAdvancedList);
|
||||
internalNetworkClientPermeateServerVisitor.setTargetIp(clientTargetIp);
|
||||
internalNetworkClientPermeateServerVisitor.setTargetPort(clientTargetPort);
|
||||
internalNetworkClientPermeateServerVisitor.setVisitorPort(visitorPort);
|
||||
internalNetworkClientPermeateServerVisitor.setNettyClientProperties(nettyClientProperties);
|
||||
internalNetworkClientPermeateServerVisitor.setHandleChannelTypeAdvancedList(handleChannelTypeAdvancedList);
|
||||
|
||||
|
||||
NettyClientPermeateServerVisitorFilter nettyClientPermeateServerVisitorFilter = new NettyClientPermeateServerVisitorFilter(internalNetworkPermeateServerVisitor);
|
||||
NettyClientPermeateServerVisitorFilter nettyClientPermeateServerVisitorFilter = new NettyClientPermeateServerVisitorFilter(internalNetworkClientPermeateServerVisitor);
|
||||
return new NettyClientPermeateServerVisitorSocket(nettyClientPermeateServerVisitorFilter, clientId, visitorPort);
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import io.netty.channel.nio.NioEventLoopGroup;
|
||||
import io.netty.channel.socket.nio.NioSocketChannel;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.framework.lazy.cloud.network.heartbeat.client.config.NettyClientProperties;
|
||||
import org.framework.lazy.cloud.network.heartbeat.client.netty.InternalNetworkPermeateServerVisitor;
|
||||
import org.framework.lazy.cloud.network.heartbeat.client.netty.InternalNetworkClientPermeateServerVisitor;
|
||||
import org.framework.lazy.cloud.network.heartbeat.client.netty.filter.NettyClientPermeateServerTransferFilter;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.MessageType;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
|
||||
@@ -26,9 +26,9 @@ public class NettyClientPermeateServerVisitorTransferSocket {
|
||||
/**
|
||||
* 连接服务端通信通道
|
||||
* <p>
|
||||
* internalNetworkPermeateServerVisitor
|
||||
* internalNetworkClientPermeateServerVisitor
|
||||
*/
|
||||
public static void buildTransferServer(InternalNetworkPermeateServerVisitor internalNetworkPermeateServerVisitor, Channel visitorChannel) {
|
||||
public static void buildTransferServer(InternalNetworkClientPermeateServerVisitor internalNetworkClientPermeateServerVisitor, Channel visitorChannel) {
|
||||
|
||||
Bootstrap bootstrap = new Bootstrap();
|
||||
bootstrap.group(eventLoopGroup)
|
||||
@@ -45,23 +45,23 @@ public class NettyClientPermeateServerVisitorTransferSocket {
|
||||
|
||||
.option(ChannelOption.WRITE_BUFFER_WATER_MARK, new WriteBufferWaterMark(1024 * 1024, 1024 * 1024 * 2))
|
||||
|
||||
.handler(new NettyClientPermeateServerTransferFilter(new ChannelTypeAdapter(internalNetworkPermeateServerVisitor.getHandleChannelTypeAdvancedList())))
|
||||
.handler(new NettyClientPermeateServerTransferFilter(new ChannelTypeAdapter(internalNetworkClientPermeateServerVisitor.getHandleChannelTypeAdvancedList())))
|
||||
;
|
||||
NettyClientProperties nettyClientProperties = internalNetworkPermeateServerVisitor.getNettyClientProperties();
|
||||
NettyClientProperties nettyClientProperties = internalNetworkClientPermeateServerVisitor.getNettyClientProperties();
|
||||
String inetHost = nettyClientProperties.getInetHost();
|
||||
int inetPort = nettyClientProperties.getInetPort();
|
||||
// local client id
|
||||
|
||||
String clientId = nettyClientProperties.getClientId();
|
||||
|
||||
String targetIp = internalNetworkPermeateServerVisitor.getTargetIp();
|
||||
Integer targetPort = internalNetworkPermeateServerVisitor.getTargetPort();
|
||||
String targetIp = internalNetworkClientPermeateServerVisitor.getTargetIp();
|
||||
Integer targetPort = internalNetworkClientPermeateServerVisitor.getTargetPort();
|
||||
|
||||
String visitorId = ChannelAttributeKeyUtils.getVisitorId(visitorChannel);
|
||||
Integer visitorPort = internalNetworkPermeateServerVisitor.getVisitorPort();
|
||||
Integer visitorPort = internalNetworkClientPermeateServerVisitor.getVisitorPort();
|
||||
|
||||
// 客户端新建访客通道 连接服务端IP:{},连接服务端端口:{}
|
||||
log.info("Client creates a new visitor channel to connect to server IP: {}, connecting to server port: {}", inetHost, inetPort);
|
||||
log.debug("Client creates a new visitor channel to connect to server IP: {}, connecting to server port: {}", inetHost, inetPort);
|
||||
ChannelFuture future = bootstrap.connect(inetHost, inetPort);
|
||||
|
||||
// 使用的客户端ID:{}
|
||||
@@ -71,7 +71,7 @@ public class NettyClientPermeateServerVisitorTransferSocket {
|
||||
if (futureListener.isSuccess()) {
|
||||
|
||||
NettyProxyMsg myMsg = new NettyProxyMsg();
|
||||
myMsg.setType(MessageType.REPORT_CLIENT_TRANSFER_SERVER_PERMEATE_CHANNEL_CONNECTION_SUCCESSFUL);
|
||||
myMsg.setType(MessageType.TCP_REPORT_CLIENT_TRANSFER_SERVER_PERMEATE_CHANNEL_CONNECTION_SUCCESSFUL);
|
||||
myMsg.setClientId(clientId);
|
||||
myMsg.setVisitorPort(visitorPort);
|
||||
myMsg.setClientTargetIp(targetIp);
|
||||
@@ -86,10 +86,10 @@ public class NettyClientPermeateServerVisitorTransferSocket {
|
||||
transferChannel.writeAndFlush(myMsg);
|
||||
|
||||
} else {
|
||||
log.info("客户端渗透服务端通信通道中断....");
|
||||
transferChannel.eventLoop().schedule(() -> {
|
||||
log.warn("客户端渗透服务端通信通道中断....");
|
||||
eventLoopGroup.schedule(() -> {
|
||||
try {
|
||||
buildTransferServer(internalNetworkPermeateServerVisitor, visitorChannel);
|
||||
buildTransferServer(internalNetworkClientPermeateServerVisitor, visitorChannel);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -7,8 +7,8 @@ import io.netty.channel.nio.NioEventLoopGroup;
|
||||
import io.netty.channel.socket.nio.NioSocketChannel;
|
||||
import lombok.Getter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.framework.lazy.cloud.network.heartbeat.client.netty.filter.NettyClientFilter;
|
||||
import org.framework.lazy.cloud.network.heartbeat.client.netty.event.ClientChangeEvent;
|
||||
import org.framework.lazy.cloud.network.heartbeat.client.netty.filter.NettyClientFilter;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.MessageType;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.NettyServerContext;
|
||||
@@ -16,6 +16,7 @@ import org.framework.lazy.cloud.network.heartbeat.common.adapter.ChannelTypeAdap
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.HandleChannelTypeAdvanced;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@@ -43,6 +44,8 @@ public class NettyClientSocket {
|
||||
* 当前连接的服务端ID
|
||||
*/
|
||||
private final String serverId;
|
||||
private final String appKey;
|
||||
private final String appSecret;
|
||||
/**
|
||||
* 客户端状态变更事件
|
||||
*/
|
||||
@@ -50,11 +53,20 @@ public class NettyClientSocket {
|
||||
private final ClientChangeEvent clientChangeEvent;
|
||||
private final List<HandleChannelTypeAdvanced> handleChannelTypeAdvancedList; // 处理服务端发送过来的数据类型
|
||||
|
||||
public NettyClientSocket(String inetHost, int inetPort, String clientId, String serverId, ClientChangeEvent clientChangeEvent, List<HandleChannelTypeAdvanced> handleChannelTypeAdvancedList) {
|
||||
public NettyClientSocket(String inetHost,
|
||||
int inetPort,
|
||||
String clientId,
|
||||
String serverId,
|
||||
String appKey,
|
||||
String appSecret,
|
||||
ClientChangeEvent clientChangeEvent,
|
||||
List<HandleChannelTypeAdvanced> handleChannelTypeAdvancedList) {
|
||||
this.inetHost = inetHost;
|
||||
this.inetPort = inetPort;
|
||||
this.clientId = clientId;
|
||||
this.serverId = serverId;
|
||||
this.appKey = appKey;
|
||||
this.appSecret = appSecret;
|
||||
this.clientChangeEvent = clientChangeEvent;
|
||||
this.handleChannelTypeAdvancedList = handleChannelTypeAdvancedList;
|
||||
}
|
||||
@@ -78,7 +90,6 @@ public class NettyClientSocket {
|
||||
.option(ChannelOption.WRITE_BUFFER_WATER_MARK, new WriteBufferWaterMark(1024 * 1024, 1024 * 1024 * 2))
|
||||
.handler(new NettyClientFilter(new ChannelTypeAdapter(handleChannelTypeAdvancedList), this))
|
||||
;
|
||||
|
||||
log.info("use clientId:{} connect to server IP:{},server port :{}", clientId, inetHost, inetPort);
|
||||
ChannelFuture future = bootstrap.connect(inetHost, inetPort);
|
||||
// 客户端连接服务端的channel
|
||||
@@ -90,9 +101,13 @@ public class NettyClientSocket {
|
||||
log.info("clientId:{},connect to server IP:{},server port :{} isSuccess ", clientId, inetHost, inetPort);
|
||||
// 告诉服务端这条连接是client的连接
|
||||
NettyProxyMsg nettyMsg = new NettyProxyMsg();
|
||||
nettyMsg.setType(MessageType.REPORT_CLIENT_CONNECT_SUCCESS);
|
||||
nettyMsg.setType(MessageType.TCP_REPORT_CLIENT_CONNECT_SUCCESS);
|
||||
nettyMsg.setClientId(clientId);
|
||||
String hostAddress = InetAddress.getLocalHost().getHostAddress();
|
||||
nettyMsg.setOriginalIpString(hostAddress);
|
||||
nettyMsg.setData((clientId).getBytes());
|
||||
nettyMsg.setAppKeyString(appKey);
|
||||
nettyMsg.setAppSecretString(appSecret);
|
||||
ChannelAttributeKeyUtils.buildClientId(serviceChannel, clientId);
|
||||
serviceChannel.writeAndFlush(nettyMsg);
|
||||
|
||||
@@ -104,7 +119,7 @@ public class NettyClientSocket {
|
||||
// 离线
|
||||
NettyServerContext.removeServerEndpointChannels(serverId, clientId);
|
||||
clientChangeEvent.clientOffLine(inetHost, inetPort,serverId, clientId);
|
||||
futureListener.channel().eventLoop().schedule(() -> {
|
||||
eventLoopGroup.schedule(() -> {
|
||||
try {
|
||||
newConnect2Server(inetHost, inetPort, clientId, serverId, clientChangeEvent);
|
||||
} catch (InterruptedException e) {
|
||||
|
||||
@@ -176,7 +176,7 @@ public class NettyServerPermeateClientRealSocket {
|
||||
if (futureListener.isSuccess()) {
|
||||
|
||||
NettyProxyMsg myMsg = new NettyProxyMsg();
|
||||
myMsg.setType(MessageType.REPORT_SINGLE_CLIENT_REAL_CONNECT);
|
||||
myMsg.setType(MessageType.TCP_REPORT_SINGLE_CLIENT_REAL_CONNECT);
|
||||
myMsg.setClientId(visitorClientId);
|
||||
myMsg.setVisitorPort(visitorPort);
|
||||
myMsg.setClientTargetIp(clientTargetIp);
|
||||
@@ -201,7 +201,7 @@ public class NettyServerPermeateClientRealSocket {
|
||||
} else {
|
||||
log.info("每隔2s重连....");
|
||||
// 离线
|
||||
transferChannel.eventLoop().schedule(() -> {
|
||||
eventLoopGroup.schedule(() -> {
|
||||
try {
|
||||
newVisitorConnect2Server(internalNetworkPenetrationRealClient, nettyClientProperties, handleChannelTypeAdvancedList,realChannel);
|
||||
} catch (InterruptedException e) {
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
// Channel channel = clientChannel.getChannel();
|
||||
//
|
||||
// NettyProxyMsg nettyMsg = new NettyProxyMsg();
|
||||
// nettyMsg.setType(MessageType.REPORT_CLIENT_STAGING_OPENED);
|
||||
// nettyMsg.setType(MessageType.TCP_REPORT_CLIENT_STAGING_OPENED);
|
||||
// nettyMsg.setData((clientId
|
||||
// .getBytes(StandardCharsets.UTF_8)));
|
||||
// nettyMsg.setClientId((clientId
|
||||
@@ -52,7 +52,7 @@
|
||||
// // 上报 当前通道暂存关闭了
|
||||
// Channel channel = clientChannel.getChannel();
|
||||
// NettyProxyMsg nettyMsg = new NettyProxyMsg();
|
||||
// nettyMsg.setType(MessageType.REPORT_CLIENT_STAGING_CLOSED);
|
||||
// nettyMsg.setType(MessageType.TCP_REPORT_CLIENT_STAGING_CLOSED);
|
||||
// nettyMsg.setData((clientId
|
||||
// .getBytes(StandardCharsets.UTF_8)));
|
||||
// nettyMsg.setClientId((clientId
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<link rel="icon" href="./favicon.ico">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Java 使用 Lazy ORM 网络穿透客户端!</title>
|
||||
<script type="module" crossorigin src="./assets/index-DrGmDmWm.js"></script>
|
||||
<script type="module" crossorigin src="./assets/index-DjZ671Nk.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="./assets/index-BEQZ9T9z.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>top.wu2020</groupId>
|
||||
<artifactId>wu-lazy-cloud-network</artifactId>
|
||||
<version>1.2.7-JDK17</version>
|
||||
<version>1.2.9-JDK17-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>wu-lazy-cloud-heartbeat-common</artifactId>
|
||||
|
||||
@@ -1,14 +1,17 @@
|
||||
package org.framework.lazy.cloud.network.heartbeat.common;
|
||||
|
||||
import io.netty.channel.Channel;
|
||||
import io.netty.channel.ChannelId;
|
||||
import lombok.Data;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
|
||||
import org.wu.framework.core.utils.ObjectUtils;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 通道上下文
|
||||
@@ -16,7 +19,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
@Slf4j
|
||||
public class ChannelContext {
|
||||
|
||||
private final static ConcurrentHashMap<String/*clientId*/, ClientChannelImpl/*通道*/>
|
||||
private final static ConcurrentHashMap<String/*clientId*/, List<Channel>/*通道*/>
|
||||
channelIdClientChannelDTOConcurrentHashMap = new ConcurrentHashMap<>();
|
||||
|
||||
/**
|
||||
@@ -26,17 +29,26 @@ public class ChannelContext {
|
||||
* @param clientId 客户端ID
|
||||
*/
|
||||
public static void push(Channel channel, String clientId) {
|
||||
|
||||
ChannelId channelId = channel.id();
|
||||
ClientChannelImpl clientChannelImpl = new ClientChannelImpl();
|
||||
clientChannelImpl.setChannelId(channelId);
|
||||
clientChannelImpl.setChannel(channel);
|
||||
clientChannelImpl.setClientId(clientId.getBytes(StandardCharsets.UTF_8));
|
||||
// 如果客户端已经存在 移除
|
||||
if (channelIdClientChannelDTOConcurrentHashMap.containsKey(clientId)) {
|
||||
// clear(clientId);
|
||||
List<Channel> existChannelList = new ArrayList<>();
|
||||
List<Channel> oldChannels = channelIdClientChannelDTOConcurrentHashMap.get(clientId);
|
||||
for (Channel existChannel : oldChannels) {
|
||||
if (existChannel != null) {
|
||||
if(existChannel.isActive()){
|
||||
existChannelList.add(existChannel);
|
||||
}else {
|
||||
log.warn("close channel with client:{}", ChannelAttributeKeyUtils.getClientId(existChannel));
|
||||
existChannel.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
existChannelList.add(channel);
|
||||
channelIdClientChannelDTOConcurrentHashMap.put(clientId, existChannelList);
|
||||
}else {
|
||||
channelIdClientChannelDTOConcurrentHashMap.putIfAbsent(clientId, Collections.synchronizedList(new ArrayList<>(List.of(channel))));
|
||||
}
|
||||
channelIdClientChannelDTOConcurrentHashMap.put(clientId, clientChannelImpl);
|
||||
|
||||
}
|
||||
|
||||
@@ -47,14 +59,7 @@ public class ChannelContext {
|
||||
* @param clientId 客户端ID
|
||||
*/
|
||||
public static void push(Channel channel, byte[] clientId) {
|
||||
|
||||
ChannelId channelId = channel.id();
|
||||
ClientChannelImpl clientChannelImpl = new ClientChannelImpl();
|
||||
clientChannelImpl.setChannelId(channelId);
|
||||
clientChannelImpl.setChannel(channel);
|
||||
clientChannelImpl.setClientId(clientId);
|
||||
channelIdClientChannelDTOConcurrentHashMap.put(new String(clientId), clientChannelImpl);
|
||||
|
||||
push(channel,new String(clientId, StandardCharsets.UTF_8));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -62,8 +67,16 @@ public class ChannelContext {
|
||||
*
|
||||
* @return 返回所有通道信息
|
||||
*/
|
||||
public static List<ClientChannel> get() {
|
||||
return new ArrayList<>(channelIdClientChannelDTOConcurrentHashMap.values());
|
||||
public static ConcurrentMap<String/*clientId*/, List<Channel>/*通道*/> getChannels() {
|
||||
return channelIdClientChannelDTOConcurrentHashMap;
|
||||
}
|
||||
/**
|
||||
* 获取所有通道
|
||||
*
|
||||
* @return 返回所有通道信息
|
||||
*/
|
||||
public static List<String> getClientIds() {
|
||||
return new ArrayList<>(channelIdClientChannelDTOConcurrentHashMap.keySet().stream().toList());
|
||||
}
|
||||
|
||||
|
||||
@@ -73,7 +86,7 @@ public class ChannelContext {
|
||||
* @param clientId 客户端ID
|
||||
* @return 通道信息
|
||||
*/
|
||||
public static ClientChannel get(byte[] clientId) {
|
||||
public static List<Channel> get(byte[] clientId) {
|
||||
if (channelIdClientChannelDTOConcurrentHashMap
|
||||
.containsKey(new String(clientId))) {
|
||||
return channelIdClientChannelDTOConcurrentHashMap
|
||||
@@ -91,10 +104,33 @@ public class ChannelContext {
|
||||
* @param clientId 客户端ID
|
||||
* @return 通道信息
|
||||
*/
|
||||
public static ChannelContext.ClientChannel get(String clientId) {
|
||||
public static List<Channel> get(String clientId) {
|
||||
return get(clientId.getBytes(StandardCharsets.UTF_8));
|
||||
}
|
||||
/**
|
||||
* 根据通道ID获取通道信息
|
||||
*
|
||||
* @param clientId 客户端ID
|
||||
* @return 通道信息
|
||||
*/
|
||||
public static Channel getLoadBalance(byte[] clientId) {
|
||||
List<Channel> channels = get(clientId);
|
||||
if(ObjectUtils.isEmpty(channels)){
|
||||
return null;
|
||||
}
|
||||
channels = channels.stream().filter(Channel::isActive).collect(Collectors.toList());
|
||||
return channels.get(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据通道ID获取通道信息
|
||||
*
|
||||
* @param clientId 客户端ID
|
||||
* @return 通道信息
|
||||
*/
|
||||
public static Channel getLoadBalance(String clientId) {
|
||||
return getLoadBalance(clientId.getBytes(StandardCharsets.UTF_8));
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭通道
|
||||
@@ -102,12 +138,13 @@ public class ChannelContext {
|
||||
* @param clientId 客户端ID
|
||||
*/
|
||||
public static void clear(String clientId) {
|
||||
ClientChannel clientChannel = get(clientId);
|
||||
if (clientChannel != null) {
|
||||
List<Channel> channels = get(clientId);
|
||||
if (channels != null) {
|
||||
remove(clientId);
|
||||
Channel channel = clientChannel.getChannel();
|
||||
if (channel != null && channel.isActive()) {
|
||||
channel.close();
|
||||
for (Channel channel : channels) {
|
||||
if (channel != null && channel.isActive()) {
|
||||
channel.close();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// log warm
|
||||
@@ -122,7 +159,7 @@ public class ChannelContext {
|
||||
* @param clientId 客户端ID
|
||||
*/
|
||||
public static void remove(byte[] clientId) {
|
||||
ClientChannel clientChannel = get(clientId);
|
||||
List<Channel> clientChannel = get(clientId);
|
||||
if (clientChannel != null) {
|
||||
channelIdClientChannelDTOConcurrentHashMap.remove(new String(clientId));
|
||||
} else {
|
||||
@@ -137,7 +174,7 @@ public class ChannelContext {
|
||||
* @param clientId 客户端ID
|
||||
*/
|
||||
public static void remove(String clientId) {
|
||||
ClientChannel clientChannel = get(clientId);
|
||||
List<Channel> clientChannel = get(clientId);
|
||||
if (clientChannel != null) {
|
||||
channelIdClientChannelDTOConcurrentHashMap.remove(clientId);
|
||||
} else {
|
||||
@@ -157,10 +194,6 @@ public class ChannelContext {
|
||||
*/
|
||||
byte[] getClientId();
|
||||
|
||||
/**
|
||||
* 通道ID
|
||||
*/
|
||||
ChannelId getChannelId();
|
||||
|
||||
/**
|
||||
* 通道
|
||||
@@ -171,29 +204,3 @@ public class ChannelContext {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 客户端通道信息
|
||||
*/
|
||||
@Data
|
||||
class ClientChannelImpl implements ChannelContext.ClientChannel {
|
||||
/**
|
||||
* 客户端ID
|
||||
*/
|
||||
private byte[] clientId;
|
||||
/**
|
||||
* 通道ID
|
||||
*/
|
||||
private ChannelId channelId;
|
||||
/**
|
||||
* 通道
|
||||
*/
|
||||
private Channel channel;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ClientChannelImpl{" +
|
||||
"clientId=" + new String(clientId) +
|
||||
", channelId=" + channelId.asLongText() +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,5 +51,17 @@ public interface InternalNetworkPermeate {
|
||||
*/
|
||||
void setVisitorPort(Integer visitorPort);
|
||||
|
||||
/**
|
||||
* 是否是ssl
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean isSsl();
|
||||
|
||||
/**
|
||||
* 设置ssl
|
||||
*/
|
||||
void setSsl(boolean ssl);
|
||||
|
||||
|
||||
}
|
||||
@@ -13,7 +13,7 @@ import lombok.experimental.Accessors;
|
||||
@Builder
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class InternalNetworkPermeateRealServer {
|
||||
public class InternalNetworkServerPermeateServerRealServer {
|
||||
|
||||
|
||||
|
||||
@@ -32,4 +32,8 @@ public class InternalNetworkPermeateRealServer {
|
||||
* 访问端口
|
||||
*/
|
||||
private Integer visitorPort;
|
||||
/**
|
||||
* 是否是ssl
|
||||
*/
|
||||
private Boolean isSsl;
|
||||
}
|
||||
@@ -1,101 +1,102 @@
|
||||
package org.framework.lazy.cloud.network.heartbeat.common;
|
||||
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.AbstractHandleChannelHeartbeatTypeAdvanced;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.client.*;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.client.AbstractHandleDistributeServicePermeateClientRealConnectTypeAdvanced;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.client.AbstractHandleDistributeServicePermeateClientTransferTypeAdvanced;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.server.*;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.tcp.AbstractTcpHandleChannelHeartbeatTypeAdvanced;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.tcp.client.*;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.tcp.server.*;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.enums.MessageTypeEnums;
|
||||
|
||||
/**
|
||||
* @see MessageTypeEnums
|
||||
* 数据取值范围 -128~ 127
|
||||
* 当前约束范围 -100~100
|
||||
*
|
||||
* TPC:1~64
|
||||
* UDP: 64~128
|
||||
*/
|
||||
public class MessageType {
|
||||
/**
|
||||
* 心跳
|
||||
*
|
||||
* @see MessageTypeEnums#TYPE_HEARTBEAT
|
||||
* @see AbstractHandleChannelHeartbeatTypeAdvanced
|
||||
* @see MessageTypeEnums#TCP_TYPE_HEARTBEAT
|
||||
* @see AbstractTcpHandleChannelHeartbeatTypeAdvanced
|
||||
*/
|
||||
public static final byte TYPE_HEARTBEAT = 0X00;
|
||||
public static final byte TCP_TYPE_HEARTBEAT = 0X00;
|
||||
|
||||
/**
|
||||
* 客户端上报连接成功
|
||||
*
|
||||
* @see MessageTypeEnums#REPORT_CLIENT_CONNECT_SUCCESS
|
||||
* @see AbstractHandleClientConnectSuccessTypeAdvanced
|
||||
* @see MessageTypeEnums#TCP_REPORT_CLIENT_CONNECT_SUCCESS
|
||||
* @see AbstractHandleTcpClientConnectSuccessTypeAdvanced
|
||||
*/
|
||||
public static final byte REPORT_CLIENT_CONNECT_SUCCESS = 0X01;
|
||||
public static final byte TCP_REPORT_CLIENT_CONNECT_SUCCESS = 0X01;
|
||||
/**
|
||||
* 上报 客户端断开连接
|
||||
*
|
||||
* @see MessageTypeEnums#REPORT_CLIENT_DISCONNECTION
|
||||
* @see AbstractHandleReportDisconnectTypeAdvanced
|
||||
* @see MessageTypeEnums#TCP_REPORT_CLIENT_DISCONNECTION
|
||||
* @see AbstractHandleTcpReportDisconnectTypeAdvanced
|
||||
*/
|
||||
public static final byte REPORT_CLIENT_DISCONNECTION = 0X02;
|
||||
public static final byte TCP_REPORT_CLIENT_DISCONNECTION = 0X02;
|
||||
/**
|
||||
* 客户端上报暂存开启
|
||||
*
|
||||
* @see MessageTypeEnums#REPORT_CLIENT_STAGING_OPENED
|
||||
* @see AbstractHandleReportStagingOpenedTypeAdvanced
|
||||
* @see MessageTypeEnums#TCP_REPORT_CLIENT_STAGING_OPENED
|
||||
* @see AbstractHandleTcpReportStagingOpenedTypeAdvanced
|
||||
*/
|
||||
public static final byte REPORT_CLIENT_STAGING_OPENED = 0X03;
|
||||
public static final byte TCP_REPORT_CLIENT_STAGING_OPENED = 0X03;
|
||||
/**
|
||||
* 客户端上报暂存关闭
|
||||
*
|
||||
* @see MessageTypeEnums#REPORT_CLIENT_STAGING_CLOSED
|
||||
* @see AbstractHandleReportStagingClosedTypeAdvanced
|
||||
* @see MessageTypeEnums#TCP_REPORT_CLIENT_STAGING_CLOSED
|
||||
* @see AbstractHandleTcpReportStagingClosedTypeAdvanced
|
||||
*/
|
||||
public static final byte REPORT_CLIENT_STAGING_CLOSED = 0X04;
|
||||
public static final byte TCP_REPORT_CLIENT_STAGING_CLOSED = 0X04;
|
||||
|
||||
/**
|
||||
* 上报 客户端数据传输(内网穿透数据回传)
|
||||
*
|
||||
* @see MessageTypeEnums#REPORT_CLIENT_TRANSFER
|
||||
* @see AbstractHandleReportServicePermeateClientTransferTypeAdvanced
|
||||
* @see MessageTypeEnums#TCP_REPORT_CLIENT_TRANSFER
|
||||
* @see AbstractHandleTcpReportServicePermeateClientTransferTypeAdvanced
|
||||
*/
|
||||
public static final byte REPORT_CLIENT_TRANSFER = 0X05;
|
||||
public static final byte TCP_REPORT_CLIENT_TRANSFER = 0X05;
|
||||
|
||||
|
||||
/**
|
||||
* 上报 客户端创建需要代理的真实端口成功
|
||||
*
|
||||
* @see MessageTypeEnums#REPORT_SINGLE_CLIENT_REAL_CONNECT
|
||||
* @see AbstractHandleReportServicePermeateClientRealConnectTypeAdvanced
|
||||
* @see MessageTypeEnums#TCP_REPORT_SINGLE_CLIENT_REAL_CONNECT
|
||||
* @see AbstractHandleTcpReportServicePermeateClientRealConnectTypeAdvanced
|
||||
*/
|
||||
public static final byte REPORT_SINGLE_CLIENT_REAL_CONNECT = 0X06;
|
||||
public static final byte TCP_REPORT_SINGLE_CLIENT_REAL_CONNECT = 0X06;
|
||||
/**
|
||||
* 上报 客户端关闭一个访客通道
|
||||
*
|
||||
* @see MessageTypeEnums#REPORT_SINGLE_CLIENT_CLOSE_VISITOR
|
||||
* @see AbstractHandleReportServicePermeateClientCloseVisitorTypeAdvanced
|
||||
* @see MessageTypeEnums#TCP_REPORT_SINGLE_CLIENT_CLOSE_VISITOR
|
||||
* @see AbstractHandleTcpReportServicePermeateClientCloseVisitorTypeAdvanced
|
||||
*/
|
||||
public static final byte REPORT_SERVICE_PERMEATE_CLIENT_CLIENT_CLOSE_VISITOR = 0X08;
|
||||
public static final byte TCP_REPORT_SERVICE_PERMEATE_CLIENT_CLIENT_CLOSE_VISITOR = 0X08;
|
||||
|
||||
/**
|
||||
* 上报 客户端消息到另一个客户端
|
||||
*
|
||||
* @see MessageTypeEnums#REPORT_SINGLE_CLIENT_MESSAGE
|
||||
* @see AbstractHandleReportSingleClientMessage2OtherClientTypeAdvanced
|
||||
* @see MessageTypeEnums#TCP_REPORT_SINGLE_CLIENT_MESSAGE
|
||||
* @see AbstractHandleTcpReportSingleClientMessage2OtherClientTypeAdvanced
|
||||
*/
|
||||
public static final byte REPORT_SINGLE_CLIENT_MESSAGE = 0X09;
|
||||
public static final byte TCP_REPORT_SINGLE_CLIENT_MESSAGE = 0X09;
|
||||
/**
|
||||
* 服务端通道 is active
|
||||
*
|
||||
* @see MessageTypeEnums#SERVER_CHANNEL_ACTIVE
|
||||
* @see AbstractHandleReportServerChannelActiveTypeAdvanced
|
||||
* @see MessageTypeEnums#TCP_SERVER_CHANNEL_ACTIVE
|
||||
* @see AbstractHandleTcpReportServerChannelActiveTypeAdvanced
|
||||
*/
|
||||
public static final byte SERVER_CHANNEL_ACTIVE = 0X10;
|
||||
public static final byte TCP_SERVER_CHANNEL_ACTIVE = 0X10;
|
||||
|
||||
/**
|
||||
* 上报 集群注册
|
||||
*
|
||||
* @see MessageTypeEnums#REPORT_CLUSTER_NODE_REGISTER_MESSAGE
|
||||
* @see AbstractHandleReportClusterNodeRegisterTypeAdvanced
|
||||
* @see MessageTypeEnums#TCP_REPORT_CLUSTER_NODE_REGISTER_MESSAGE
|
||||
* @see AbstractHandleTcpReportClusterNodeRegisterTypeAdvanced
|
||||
*/
|
||||
public static final byte REPORT_CLUSTER_NODE_REGISTER_MESSAGE = 0X11;
|
||||
public static final byte TCP_REPORT_CLUSTER_NODE_REGISTER_MESSAGE = 0X11;
|
||||
|
||||
|
||||
/**
|
||||
@@ -106,40 +107,40 @@ public class MessageType {
|
||||
/**
|
||||
* 上报 客户端渗透服务端数据传输通道连接成功
|
||||
*
|
||||
* @see MessageTypeEnums#REPORT_CLIENT_TRANSFER_SERVER_PERMEATE_CHANNEL_CONNECTION_SUCCESSFUL
|
||||
* @see AbstractHandleReportClientTransferServerPermeateChannelConnectionSuccessfulTypeAdvanced
|
||||
* @see MessageTypeEnums#TCP_REPORT_CLIENT_TRANSFER_SERVER_PERMEATE_CHANNEL_CONNECTION_SUCCESSFUL
|
||||
* @see AbstractHandleTcpReportClientTransferServerPermeateChannelConnectionSuccessfulTypeAdvanced
|
||||
*/
|
||||
public static final byte REPORT_CLIENT_TRANSFER_SERVER_PERMEATE_CHANNEL_CONNECTION_SUCCESSFUL = 0X12;
|
||||
public static final byte TCP_REPORT_CLIENT_TRANSFER_SERVER_PERMEATE_CHANNEL_CONNECTION_SUCCESSFUL = 0X12;
|
||||
|
||||
/**
|
||||
* 上报 客户端渗透服务端init信息
|
||||
*
|
||||
* @see MessageTypeEnums#REPORT_CLIENT_PERMEATE_SERVER_INIT
|
||||
* @see AbstractHandleReportClientPermeateServerInitTypeAdvanced
|
||||
* @see MessageTypeEnums#TCP_REPORT_CLIENT_PERMEATE_SERVER_INIT
|
||||
* @see AbstractHandleTcpReportClientPermeateServerInitTypeAdvanced
|
||||
*/
|
||||
public static final byte REPORT_CLIENT_PERMEATE_SERVER_INIT = 0X13;
|
||||
public static final byte TCP_REPORT_CLIENT_PERMEATE_SERVER_INIT = 0X13;
|
||||
/**
|
||||
* 上报 客户端渗透服务端init close 信息
|
||||
*
|
||||
* @see MessageTypeEnums#REPORT_CLIENT_PERMEATE_SERVER_CLOSE
|
||||
* @see AbstractHandleReportClientPermeateServerCloseTypeAdvanced
|
||||
* @see MessageTypeEnums#TCP_REPORT_CLIENT_PERMEATE_SERVER_CLOSE
|
||||
* @see AbstractHandleTcpReportClientPermeateServerCloseTypeAdvanced
|
||||
*/
|
||||
public static final byte REPORT_CLIENT_PERMEATE_SERVER_CLOSE = 0X14;
|
||||
public static final byte TCP_REPORT_CLIENT_PERMEATE_SERVER_CLOSE = 0X14;
|
||||
/**
|
||||
* 上报 客户端渗透服务端通信通道关闭
|
||||
*
|
||||
* @see MessageTypeEnums#REPORT_CLIENT_PERMEATE_SERVER_TRANSFER_CLOSE
|
||||
* @see AbstractHandleReportClientPermeateServerTransferCloseTypeAdvanced
|
||||
* @see MessageTypeEnums#TCP_TCP_REPORT_CLIENT_PERMEATE_SERVER_TRANSFER_CLOSE
|
||||
* @see AbstractHandleTcpReportClientPermeateServerTransferCloseTypeAdvanced
|
||||
*/
|
||||
public static final byte REPORT_CLIENT_PERMEATE_SERVER_TRANSFER_CLOSE = 0X15;
|
||||
public static final byte TCP_TCP_REPORT_CLIENT_PERMEATE_SERVER_TRANSFER_CLOSE = 0X15;
|
||||
|
||||
/**
|
||||
* 上报 客户端渗透服务端通信传输
|
||||
*
|
||||
* @see MessageTypeEnums#REPORT_CLIENT_PERMEATE_SERVER_TRANSFER
|
||||
* @see AbstractHandleReportClientPermeateServerTransferTypeAdvanced
|
||||
* @see MessageTypeEnums#TCP_REPORT_CLIENT_PERMEATE_SERVER_TRANSFER
|
||||
* @see AbstractHandleTcpReportClientPermeateServerTransferTypeAdvanced
|
||||
*/
|
||||
public static final byte REPORT_CLIENT_PERMEATE_SERVER_TRANSFER = 0X16;
|
||||
public static final byte TCP_REPORT_CLIENT_PERMEATE_SERVER_TRANSFER = 0X16;
|
||||
|
||||
|
||||
|
||||
@@ -153,61 +154,61 @@ public class MessageType {
|
||||
/**
|
||||
* 上报 客户端渗透客户端init信息
|
||||
*
|
||||
* @see MessageTypeEnums#REPORT_CLIENT_PERMEATE_CLIENT_INIT
|
||||
* @see AbstractHandleReportClientPermeateClientInitTypeAdvanced
|
||||
* @see MessageTypeEnums#TCP_REPORT_CLIENT_PERMEATE_CLIENT_INIT
|
||||
* @see AbstractHandleTcpReportClientPermeateClientInitTypeAdvanced
|
||||
*/
|
||||
public static final byte REPORT_CLIENT_PERMEATE_CLIENT_INIT = 0X19;
|
||||
public static final byte TCP_REPORT_CLIENT_PERMEATE_CLIENT_INIT = 0X19;
|
||||
/**
|
||||
* 上报 客户端渗透客户端init close 信息
|
||||
*
|
||||
* @see MessageTypeEnums#REPORT_CLIENT_PERMEATE_CLIENT_CLOSE
|
||||
* @see AbstractHandleReportClientPermeateClientCloseTypeAdvanced
|
||||
* @see MessageTypeEnums#TCP_REPORT_CLIENT_PERMEATE_CLIENT_CLOSE
|
||||
* @see AbstractHandleTcpReportClientPermeateClientCloseTypeAdvanced
|
||||
*/
|
||||
public static final byte REPORT_CLIENT_PERMEATE_CLIENT_CLOSE = 0X20;
|
||||
public static final byte TCP_REPORT_CLIENT_PERMEATE_CLIENT_CLOSE = 0X20;
|
||||
/**
|
||||
* 上报 客户端渗透客户端数据传输通道连接成功
|
||||
*
|
||||
* @see MessageTypeEnums#REPORT_CLIENT_TRANSFER_CLIENT_PERMEATE_CHANNEL_CONNECTION_SUCCESSFUL
|
||||
* @see AbstractHandleReportClientTransferClientPermeateChannelConnectionSuccessfulTypeAdvanced
|
||||
* @see MessageType#DISTRIBUTE_CLIENT_TRANSFER_CLIENT_PERMEATE_CHANNEL_CONNECTION_SUCCESSFUL
|
||||
* @see MessageTypeEnums#TCP_REPORT_CLIENT_TRANSFER_CLIENT_PERMEATE_CHANNEL_CONNECTION_SUCCESSFUL
|
||||
* @see AbstractHandleTcpReportClientTransferClientPermeateChannelConnectionSuccessfulTypeAdvanced
|
||||
* @see MessageType#TCP_DISTRIBUTE_CLIENT_TRANSFER_CLIENT_PERMEATE_CHANNEL_CONNECTION_SUCCESSFUL
|
||||
*/
|
||||
public static final byte REPORT_CLIENT_TRANSFER_CLIENT_PERMEATE_CHANNEL_CONNECTION_SUCCESSFUL = 0X21;
|
||||
public static final byte TCP_REPORT_CLIENT_TRANSFER_CLIENT_PERMEATE_CHANNEL_CONNECTION_SUCCESSFUL = 0X21;
|
||||
|
||||
|
||||
/**
|
||||
* 上报 客户端渗透客户端数据传输通道init 成功
|
||||
*
|
||||
* @see MessageTypeEnums#REPORT_CLIENT_TRANSFER_CLIENT_PERMEATE_CHANNEL_INIT_SUCCESSFUL
|
||||
* @see AbstractHandleReportClientTransferClientPermeateChannelInitSuccessfulTypeAdvanced
|
||||
* @see MessageType#DISTRIBUTE_CLIENT_PERMEATE_CLIENT_TRANSFER_CHANNEL_INIT_SUCCESSFUL
|
||||
* @see MessageTypeEnums#TCP_REPORT_CLIENT_TRANSFER_CLIENT_PERMEATE_CHANNEL_INIT_SUCCESSFUL
|
||||
* @see AbstractHandleTcpReportClientTransferClientPermeateChannelInitSuccessfulTypeAdvanced
|
||||
* @see MessageType#TCP_DISTRIBUTE_CLIENT_PERMEATE_CLIENT_TRANSFER_CHANNEL_INIT_SUCCESSFUL
|
||||
*/
|
||||
public static final byte REPORT_CLIENT_PERMEATE_CLIENT_TRANSFER_CHANNEL_INIT_SUCCESSFUL = 0X22;
|
||||
public static final byte TCP_REPORT_CLIENT_PERMEATE_CLIENT_TRANSFER_CHANNEL_INIT_SUCCESSFUL = 0X22;
|
||||
/**
|
||||
* 上报客户端渗透客户端数据传输请求
|
||||
*
|
||||
* @see MessageTypeEnums#REPORT_CLIENT_TRANSFER_CLIENT_REQUEST
|
||||
* @see AbstractHandleReportClientTransferClientTypeAdvanced
|
||||
* @see MessageType#DISTRIBUTE_CLIENT_PERMEATE_CLIENT_TRANSFER_REQUEST
|
||||
* @see MessageTypeEnums#TCP_REPORT_CLIENT_TRANSFER_CLIENT_REQUEST
|
||||
* @see AbstractHandleTcpReportClientTransferClientTypeAdvanced
|
||||
* @see MessageType#TCP_DISTRIBUTE_CLIENT_PERMEATE_CLIENT_TRANSFER_REQUEST
|
||||
*/
|
||||
public static final byte REPORT_CLIENT_PERMEATE_CLIENT_TRANSFER_REQUEST = 0X23;
|
||||
public static final byte TCP_REPORT_CLIENT_PERMEATE_CLIENT_TRANSFER_REQUEST = 0X23;
|
||||
|
||||
/**
|
||||
* 上报客户端渗透客户端数据传输结果
|
||||
*
|
||||
* @see MessageTypeEnums#REPORT_CLIENT_TRANSFER_CLIENT_RESPONSE
|
||||
* @see AbstractHandleReportClientTransferClientResponseTypeAdvanced
|
||||
* @see MessageType#DISTRIBUTE_CLIENT_PERMEATE_CLIENT_TRANSFER_RESPONSE
|
||||
* @see MessageTypeEnums#TCP_REPORT_CLIENT_TRANSFER_CLIENT_RESPONSE
|
||||
* @see AbstractHandleTcpReportClientTransferClientResponseTypeAdvanced
|
||||
* @see MessageType#TCP_DISTRIBUTE_CLIENT_PERMEATE_CLIENT_TRANSFER_RESPONSE
|
||||
*/
|
||||
public static final byte REPORT_CLIENT_TRANSFER_CLIENT_RESPONSE = 0X24;
|
||||
public static final byte TCP_REPORT_CLIENT_TRANSFER_CLIENT_RESPONSE = 0X24;
|
||||
|
||||
/**
|
||||
* 上报客户端渗透客户端通信通道关闭
|
||||
*
|
||||
* @see MessageTypeEnums#REPORT_CLIENT_PERMEATE_CLIENT_TRANSFER_CLOSE
|
||||
* @see AbstractHandleReportClientPermeateClientTransferCloseTypeAdvanced
|
||||
* @see MessageType#DISTRIBUTE_CLIENT_PERMEATE_CLIENT_TRANSFER_CLOSE
|
||||
* @see MessageTypeEnums#TCP_REPORT_CLIENT_PERMEATE_CLIENT_TRANSFER_CLOSE
|
||||
* @see AbstractHandleTcpReportClientPermeateClientTransferCloseTypeAdvanced
|
||||
* @see MessageType#TCP_DISTRIBUTE_CLIENT_PERMEATE_CLIENT_TRANSFER_CLOSE
|
||||
*/
|
||||
public static final byte REPORT_CLIENT_PERMEATE_CLIENT_TRANSFER_CLOSE = 0X25;
|
||||
public static final byte TCP_REPORT_CLIENT_PERMEATE_CLIENT_TRANSFER_CLOSE = 0X25;
|
||||
|
||||
|
||||
|
||||
@@ -217,189 +218,189 @@ public class MessageType {
|
||||
/**
|
||||
* 下发 客户端接收连接成功通知
|
||||
*
|
||||
* @see MessageTypeEnums#DISTRIBUTE_CLIENT_CONNECTION_SUCCESS_NOTIFICATION
|
||||
* @see AbstractHandleDistributeConnectSuccessNotificationTypeAdvancedHandle
|
||||
* @see MessageTypeEnums#TCP_DISTRIBUTE_CLIENT_CONNECTION_SUCCESS_NOTIFICATION
|
||||
* @see AbstractHandleTcpDistributeConnectSuccessNotificationTypeAdvancedHandle
|
||||
*/
|
||||
public static final byte DISTRIBUTE_CLIENT_CONNECTION_SUCCESS_NOTIFICATION = -0X01;
|
||||
public static final byte TCP_DISTRIBUTE_CLIENT_CONNECTION_SUCCESS_NOTIFICATION = -0X01;
|
||||
/**
|
||||
* 下发 客户端断开连接通知
|
||||
*
|
||||
* @see MessageTypeEnums#DISTRIBUTE_CLIENT_DISCONNECTION_NOTIFICATION
|
||||
* @see AbstractHandleDistributeDisconnectTypeAdvancedHandle
|
||||
* @see MessageTypeEnums#TCP_DISTRIBUTE_CLIENT_DISCONNECTION_NOTIFICATION
|
||||
* @see AbstractHandleTcpDistributeDisconnectTypeAdvancedHandle
|
||||
*/
|
||||
public static final byte DISTRIBUTE_CLIENT_DISCONNECTION_NOTIFICATION = -0X02;
|
||||
public static final byte TCP_DISTRIBUTE_CLIENT_DISCONNECTION_NOTIFICATION = -0X02;
|
||||
/**
|
||||
* 下发 客户端暂存开启通知
|
||||
*
|
||||
* @see MessageTypeEnums#DISTRIBUTE_CLIENT_STAGING_OPENED_NOTIFICATION
|
||||
* @see AbstractHandleDistributeStagingOpenedTypeAdvanced
|
||||
* @see MessageTypeEnums#TCP_DISTRIBUTE_CLIENT_STAGING_OPENED_NOTIFICATION
|
||||
* @see AbstractHandleTcpDistributeStagingOpenedTypeAdvanced
|
||||
*/
|
||||
public static final byte DISTRIBUTE_CLIENT_STAGING_OPENED_NOTIFICATION = -0X03;
|
||||
public static final byte TCP_DISTRIBUTE_CLIENT_STAGING_OPENED_NOTIFICATION = -0X03;
|
||||
|
||||
/**
|
||||
* 下发 客户端暂存关闭通知
|
||||
*
|
||||
* @see MessageTypeEnums#DISTRIBUTE_CLIENT_STAGING_CLOSED_NOTIFICATION
|
||||
* @see AbstractHandleDistributeStagingClosedTypeAdvanced
|
||||
* @see MessageTypeEnums#TCP_DISTRIBUTE_CLIENT_STAGING_CLOSED_NOTIFICATION
|
||||
* @see AbstractHandleTcpDistributeStagingClosedTypeAdvanced
|
||||
*/
|
||||
public static final byte DISTRIBUTE_CLIENT_STAGING_CLOSED_NOTIFICATION = -0X04;
|
||||
public static final byte TCP_DISTRIBUTE_CLIENT_STAGING_CLOSED_NOTIFICATION = -0X04;
|
||||
/**
|
||||
* 下发 客户端数据传输(内网穿透数据发送)
|
||||
*
|
||||
* @see MessageTypeEnums#DISTRIBUTE_CLIENT_TRANSFER
|
||||
* @see AbstractHandleDistributeServicePermeateClientTransferTypeAdvanced
|
||||
* @see MessageTypeEnums#TCP_DISTRIBUTE_CLIENT_TRANSFER
|
||||
* @see AbstractHandleTcpDistributeServicePermeateClientTransferTypeAdvanced
|
||||
*/
|
||||
public static final byte DISTRIBUTE_CLIENT_TRANSFER = -0X05;
|
||||
public static final byte TCP_DISTRIBUTE_CLIENT_TRANSFER = -0X05;
|
||||
/**
|
||||
* 下发 客户端创建需要代理的真实端口
|
||||
*
|
||||
* @see MessageTypeEnums#DISTRIBUTE_SINGLE_CLIENT_REAL_CONNECT
|
||||
* @see AbstractHandleDistributeServicePermeateClientRealConnectTypeAdvanced
|
||||
* @see MessageTypeEnums#TCP_DISTRIBUTE_SINGLE_CLIENT_REAL_CONNECT
|
||||
* @see AbstractHandleTcpDistributeServicePermeateClientRealConnectTypeAdvanced
|
||||
*/
|
||||
public static final byte DISTRIBUTE_SINGLE_CLIENT_REAL_CONNECT = -0X06;
|
||||
public static final byte TCP_DISTRIBUTE_SINGLE_CLIENT_REAL_CONNECT = -0X06;
|
||||
|
||||
/**
|
||||
* 下发 客户端代理的真实端口自动读写
|
||||
*
|
||||
* @see MessageTypeEnums#DISTRIBUTE_SINGLE_CLIENT_REAL_CONNECT_AUTO_READ
|
||||
* @see AbstractHandleDistributeSingleClientRealAutoReadConnectTypeAdvanced
|
||||
* @see MessageTypeEnums#TCP_DISTRIBUTE_SINGLE_CLIENT_REAL_CONNECT_AUTO_READ
|
||||
* @see AbstractHandleTcpDistributeSingleClientRealAutoReadConnectTypeAdvanced
|
||||
*/
|
||||
public static final byte DISTRIBUTE_SINGLE_CLIENT_REAL_CONNECT_AUTO_READ = -0X07;
|
||||
public static final byte TCP_DISTRIBUTE_SINGLE_CLIENT_REAL_CONNECT_AUTO_READ = -0X07;
|
||||
|
||||
/**
|
||||
* 下发 客户端关闭代理服务通道
|
||||
*
|
||||
* @see MessageTypeEnums#DISTRIBUTE_SINGLE_CLIENT_REAL_CLOSE_VISITOR
|
||||
* @see AbstractHandleDistributeSingleClientRealCloseVisitorTypeAdvanced
|
||||
* @see MessageTypeEnums#TCP_DISTRIBUTE_SINGLE_CLIENT_REAL_CLOSE_VISITOR
|
||||
* @see AbstractHandleTcpDistributeSingleClientRealCloseVisitorTypeAdvanced
|
||||
*/
|
||||
public static final byte DISTRIBUTE_SERVER_PERMEATE_CLIENT_REAL_CLOSE_VISITOR = -0X08;
|
||||
public static final byte TCP_DISTRIBUTE_SERVER_PERMEATE_CLIENT_REAL_CLOSE_VISITOR = -0X08;
|
||||
|
||||
/**
|
||||
* 下发 客户端消息
|
||||
*
|
||||
* @see MessageTypeEnums#DISTRIBUTE_SINGLE_CLIENT_MESSAGE
|
||||
* @see AbstractHandleDistributeSingleClientMessageTypeAdvanced
|
||||
* @see MessageTypeEnums#TCP_DISTRIBUTE_SINGLE_CLIENT_MESSAGE
|
||||
* @see AbstractHandleTcpDistributeSingleClientMessageTypeAdvanced
|
||||
*/
|
||||
public static final byte DISTRIBUTE_SINGLE_CLIENT_MESSAGE = -0X09;
|
||||
public static final byte TCP_DISTRIBUTE_SINGLE_CLIENT_MESSAGE = -0X09;
|
||||
|
||||
|
||||
/**
|
||||
* 客户端通道 is active
|
||||
*
|
||||
* @see MessageTypeEnums#CLIENT_CHANNEL_ACTIVE
|
||||
* @see AbstractHandleClientChannelActiveAdvanced
|
||||
* @see MessageTypeEnums#TCP_CLIENT_CHANNEL_ACTIVE
|
||||
* @see AbstractHandleTcpClientChannelActiveAdvanced
|
||||
*/
|
||||
public static final byte CLIENT_CHANNEL_ACTIVE = -0X10;
|
||||
public static final byte TCP_CLIENT_CHANNEL_ACTIVE = -0X10;
|
||||
|
||||
/**
|
||||
* 下发 集群注册
|
||||
*
|
||||
* @see MessageTypeEnums#DISTRIBUTE_CLUSTER_NODE_REGISTER_MESSAGE
|
||||
* @see AbstractHandleDistributeClusterNodeRegisterTypeAdvanced
|
||||
* @see MessageTypeEnums#TCP_DISTRIBUTE_CLUSTER_NODE_REGISTER_MESSAGE
|
||||
* @see AbstractHandleTcpDistributeClusterNodeRegisterTypeAdvanced
|
||||
*/
|
||||
public static final byte DISTRIBUTE_CLUSTER_NODE_REGISTER_MESSAGE = -0X11;
|
||||
public static final byte TCP_DISTRIBUTE_CLUSTER_NODE_REGISTER_MESSAGE = -0X11;
|
||||
|
||||
/**
|
||||
* 下发 客户端渗透服务端数据传输通道连接成功
|
||||
*
|
||||
* @see MessageTypeEnums#DISTRIBUTE_CLIENT_TRANSFER_SERVER_PERMEATE_CHANNEL_CONNECTION_SUCCESSFUL
|
||||
* @see AbstractHandleDistributeClientTransferServerPermeateChannelConnectionSuccessfulTypeAdvanced
|
||||
* @see MessageTypeEnums#TCP_DISTRIBUTE_CLIENT_TRANSFER_SERVER_PERMEATE_CHANNEL_CONNECTION_SUCCESSFUL
|
||||
* @see AbstractHandleTcpDistributeClientTransferServerPermeateChannelConnectionSuccessfulTypeAdvanced
|
||||
*/
|
||||
public static final byte DISTRIBUTE_CLIENT_TRANSFER_SERVER_PERMEATE_CHANNEL_CONNECTION_SUCCESSFUL = -0X12;
|
||||
public static final byte TCP_DISTRIBUTE_CLIENT_TRANSFER_SERVER_PERMEATE_CHANNEL_CONNECTION_SUCCESSFUL = -0X12;
|
||||
|
||||
/**
|
||||
* 下发 客户端渗透服务端init信息
|
||||
*
|
||||
* @see MessageTypeEnums#DISTRIBUTE_CLIENT_PERMEATE_SERVER_INIT
|
||||
* @see AbstractHandleDistributeClientPermeateServerInitTypeAdvanced
|
||||
* @see MessageTypeEnums#TCP_DISTRIBUTE_CLIENT_PERMEATE_SERVER_INIT
|
||||
* @see AbstractHandleTcpDistributeClientPermeateServerInitTypeAdvanced
|
||||
*/
|
||||
public static final byte DISTRIBUTE_CLIENT_PERMEATE_SERVER_INIT = -0X13;
|
||||
public static final byte TCP_DISTRIBUTE_CLIENT_PERMEATE_SERVER_INIT = -0X13;
|
||||
|
||||
/**
|
||||
* 下发 客户端渗透服务端init close信息
|
||||
*
|
||||
* @see MessageTypeEnums#DISTRIBUTE_CLIENT_PERMEATE_SERVER_CLOSE
|
||||
* @see AbstractHandleDistributeClientPermeateServerCloseTypeAdvanced
|
||||
* @see MessageTypeEnums#TCP_DISTRIBUTE_CLIENT_PERMEATE_SERVER_CLOSE
|
||||
* @see AbstractHandleTcpDistributeClientPermeateServerCloseTypeAdvanced
|
||||
*/
|
||||
public static final byte DISTRIBUTE_CLIENT_PERMEATE_SERVER_CLOSE = -0X14;
|
||||
public static final byte TCP_DISTRIBUTE_CLIENT_PERMEATE_SERVER_CLOSE = -0X14;
|
||||
|
||||
|
||||
/**
|
||||
* 下发 客户端渗透服务端通信通道关闭
|
||||
*
|
||||
* @see MessageTypeEnums#DISTRIBUTE_CLIENT_PERMEATE_SERVER_TRANSFER_CLOSE
|
||||
* @see AbstractHandleDistributeClientPermeateServerTransferCloseTypeAdvanced
|
||||
* @see MessageTypeEnums#TCP_DISTRIBUTE_CLIENT_PERMEATE_SERVER_TRANSFER_CLOSE
|
||||
* @see AbstractHandleTcpDistributeClientPermeateServerTransferCloseTypeAdvanced
|
||||
*/
|
||||
public static final byte DISTRIBUTE_CLIENT_PERMEATE_SERVER_TRANSFER_CLOSE = -0X15;
|
||||
public static final byte TCP_DISTRIBUTE_CLIENT_PERMEATE_SERVER_TRANSFER_CLOSE = -0X15;
|
||||
|
||||
/**
|
||||
* 下发 客户端渗透服务端通信传输
|
||||
*
|
||||
* @see MessageTypeEnums#DISTRIBUTE_CLIENT_PERMEATE_SERVER_TRANSFER
|
||||
* @see AbstractHandleDistributeClientPermeateServerTransferTypeAdvanced
|
||||
* @see MessageTypeEnums#TCP_DISTRIBUTE_CLIENT_PERMEATE_SERVER_TRANSFER
|
||||
* @see AbstractHandleTcpDistributeClientPermeateServerTransferTypeAdvanced
|
||||
*/
|
||||
public static final byte DISTRIBUTE_CLIENT_PERMEATE_SERVER_TRANSFER = -0X16;
|
||||
public static final byte TCP_DISTRIBUTE_CLIENT_PERMEATE_SERVER_TRANSFER = -0X16;
|
||||
/**
|
||||
* 下发 客户端渗透客户端init信息
|
||||
*
|
||||
* @see MessageTypeEnums#DISTRIBUTE_CLIENT_PERMEATE_CLIENT_INIT
|
||||
* @see AbstractHandleDistributeClientPermeateClientInitTypeAdvanced
|
||||
* @see MessageTypeEnums#TCP_DISTRIBUTE_CLIENT_PERMEATE_CLIENT_INIT
|
||||
* @see AbstractHandleTcpDistributeClientPermeateClientInitTypeAdvanced
|
||||
*/
|
||||
public static final byte DISTRIBUTE_CLIENT_PERMEATE_CLIENT_INIT = -0X19;
|
||||
public static final byte TCP_DISTRIBUTE_CLIENT_PERMEATE_CLIENT_INIT = -0X19;
|
||||
|
||||
/**
|
||||
* 下发 客户端渗透客户端init close信息
|
||||
*
|
||||
* @see MessageTypeEnums#DISTRIBUTE_CLIENT_PERMEATE_CLIENT_CLOSE
|
||||
* @see AbstractHandleDistributeClientPermeateClientCloseTypeAdvanced
|
||||
* @see MessageTypeEnums#TCP_DISTRIBUTE_CLIENT_PERMEATE_CLIENT_CLOSE
|
||||
* @see AbstractHandleTcpDistributeClientPermeateClientCloseTypeAdvanced
|
||||
*/
|
||||
public static final byte DISTRIBUTE_CLIENT_PERMEATE_CLIENT_CLOSE = -0X20;
|
||||
public static final byte TCP_DISTRIBUTE_CLIENT_PERMEATE_CLIENT_CLOSE = -0X20;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 下发 客户端渗透客户端数据传输通道连接成功
|
||||
*
|
||||
* @see MessageTypeEnums#DISTRIBUTE_CLIENT_TRANSFER_CLIENT_PERMEATE_CHANNEL_CONNECTION_SUCCESSFUL
|
||||
* @see AbstractHandleDistributeClientTransferClientPermeateChannelConnectionSuccessfulTypeAdvanced
|
||||
* @see MessageType#REPORT_CLIENT_TRANSFER_CLIENT_PERMEATE_CHANNEL_CONNECTION_SUCCESSFUL
|
||||
* @see MessageTypeEnums#TCP_DISTRIBUTE_CLIENT_TRANSFER_CLIENT_PERMEATE_CHANNEL_CONNECTION_SUCCESSFUL
|
||||
* @see AbstractHandleTcpDistributeClientTransferClientPermeateChannelConnectionSuccessfulTypeAdvanced
|
||||
* @see MessageType#TCP_REPORT_CLIENT_TRANSFER_CLIENT_PERMEATE_CHANNEL_CONNECTION_SUCCESSFUL
|
||||
*/
|
||||
public static final byte DISTRIBUTE_CLIENT_TRANSFER_CLIENT_PERMEATE_CHANNEL_CONNECTION_SUCCESSFUL = -0X21;
|
||||
public static final byte TCP_DISTRIBUTE_CLIENT_TRANSFER_CLIENT_PERMEATE_CHANNEL_CONNECTION_SUCCESSFUL = -0X21;
|
||||
|
||||
|
||||
/**
|
||||
* 下发 客户端渗透客户端数据传输通道init 成功
|
||||
*
|
||||
* @see MessageTypeEnums#DISTRIBUTE_CLIENT_PERMEATE_CLIENT_TRANSFER_CHANNEL_INIT_SUCCESSFUL
|
||||
* @see AbstractHandleDistributeClientTransferClientPermeateChannelInitSuccessfulTypeAdvanced
|
||||
* @see MessageType#DISTRIBUTE_CLIENT_PERMEATE_CLIENT_TRANSFER_CHANNEL_INIT_SUCCESSFUL
|
||||
* @see MessageTypeEnums#TCP_DISTRIBUTE_CLIENT_PERMEATE_CLIENT_TRANSFER_CHANNEL_INIT_SUCCESSFUL
|
||||
* @see AbstractHandleTcpDistributeClientTransferClientPermeateChannelInitSuccessfulTypeAdvanced
|
||||
* @see MessageType#TCP_DISTRIBUTE_CLIENT_PERMEATE_CLIENT_TRANSFER_CHANNEL_INIT_SUCCESSFUL
|
||||
*/
|
||||
public static final byte DISTRIBUTE_CLIENT_PERMEATE_CLIENT_TRANSFER_CHANNEL_INIT_SUCCESSFUL = -0X22;
|
||||
public static final byte TCP_DISTRIBUTE_CLIENT_PERMEATE_CLIENT_TRANSFER_CHANNEL_INIT_SUCCESSFUL = -0X22;
|
||||
|
||||
/**
|
||||
* 下发 客户端渗透客户端数据传输请求
|
||||
*
|
||||
* @see MessageTypeEnums#DISTRIBUTE_CLIENT_PERMEATE_CLIENT_TRANSFER_REQUEST
|
||||
* @see AbstractHandleDistributeClientTransferClientRequestTypeAdvanced
|
||||
* @see MessageType#REPORT_CLIENT_PERMEATE_CLIENT_TRANSFER_REQUEST
|
||||
* @see MessageTypeEnums#TCP_DISTRIBUTE_CLIENT_PERMEATE_CLIENT_TRANSFER_REQUEST
|
||||
* @see AbstractHandleTcpDistributeClientTransferClientRequestTypeAdvanced
|
||||
* @see MessageType#TCP_REPORT_CLIENT_PERMEATE_CLIENT_TRANSFER_REQUEST
|
||||
*/
|
||||
public static final byte DISTRIBUTE_CLIENT_PERMEATE_CLIENT_TRANSFER_REQUEST = -0X23;
|
||||
public static final byte TCP_DISTRIBUTE_CLIENT_PERMEATE_CLIENT_TRANSFER_REQUEST = -0X23;
|
||||
/**
|
||||
* 下发客户端渗透客户端数据传输响应
|
||||
*
|
||||
* @see MessageTypeEnums#DISTRIBUTE_CLIENT_PERMEATE_CLIENT_TRANSFER_RESPONSE
|
||||
* @see AbstractHandleDistributeServicePermeateClientTransferClientResponseTypeAdvanced
|
||||
* @see MessageType#REPORT_CLIENT_TRANSFER_CLIENT_RESPONSE
|
||||
* @see MessageTypeEnums#TCP_DISTRIBUTE_CLIENT_PERMEATE_CLIENT_TRANSFER_RESPONSE
|
||||
* @see AbstractHandleTcpDistributeServicePermeateClientTransferClientResponseTypeAdvanced
|
||||
* @see MessageType#TCP_REPORT_CLIENT_TRANSFER_CLIENT_RESPONSE
|
||||
*/
|
||||
public static final byte DISTRIBUTE_CLIENT_PERMEATE_CLIENT_TRANSFER_RESPONSE = -0X24;
|
||||
public static final byte TCP_DISTRIBUTE_CLIENT_PERMEATE_CLIENT_TRANSFER_RESPONSE = -0X24;
|
||||
|
||||
|
||||
/**
|
||||
* 下发客户端渗透客户端通信通道关闭
|
||||
*
|
||||
* @see MessageTypeEnums#DISTRIBUTE_CLIENT_PERMEATE_CLIENT_TRANSFER_CLOSE
|
||||
* @see AbstractHandleDistributeClientPermeateClientTransferCloseTypeAdvanced
|
||||
* @see MessageType#REPORT_CLIENT_PERMEATE_CLIENT_TRANSFER_CLOSE
|
||||
* @see MessageTypeEnums#TCP_DISTRIBUTE_CLIENT_PERMEATE_CLIENT_TRANSFER_CLOSE
|
||||
* @see AbstractHandleTcpDistributeClientPermeateClientTransferCloseTypeAdvanced
|
||||
* @see MessageType#TCP_REPORT_CLIENT_PERMEATE_CLIENT_TRANSFER_CLOSE
|
||||
*/
|
||||
public static final byte DISTRIBUTE_CLIENT_PERMEATE_CLIENT_TRANSFER_CLOSE = -0X25;
|
||||
public static final byte TCP_DISTRIBUTE_CLIENT_PERMEATE_CLIENT_TRANSFER_CLOSE = -0X25;
|
||||
}
|
||||
|
||||
@@ -56,7 +56,9 @@ public class NettyClientVisitorContext {
|
||||
public static <T> void removeVisitorSocket(String clientId, T visitorSocket) {
|
||||
List<Object> visitorSocketList = VISITOR_SOCKET.get(clientId);
|
||||
if(!ObjectUtils.isEmpty(visitorSocketList)){
|
||||
visitorSocketList.remove(visitorSocket);
|
||||
while (visitorSocketList.iterator().hasNext() && visitorSocketList.iterator().next().equals(visitorSocket)) {
|
||||
visitorSocketList.iterator().remove();
|
||||
}
|
||||
VISITOR_SOCKET.put(clientId,visitorSocketList);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import lombok.Setter;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
@Deprecated
|
||||
@Setter
|
||||
@Getter
|
||||
public class NettyMsg {
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.framework.lazy.cloud.network.heartbeat.common;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import org.wu.framework.core.utils.ObjectUtils;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
@@ -13,8 +14,8 @@ import java.nio.charset.StandardCharsets;
|
||||
@Setter
|
||||
@Getter
|
||||
public class NettyProxyMsg {
|
||||
// body 长度 type 1 clientId 4 clientTargetIp 4 clientTargetPort 4 visitorPort 4 visitorId 4 data 4
|
||||
public static final int bodyLength = 1 + 4 + 4 + 4 + 4 + 4 + 4;
|
||||
// body 长度 type 1 isSsl 1 appKey 4 appSecret 4 clientId 4 originalIp 4 clientTargetIp 4 clientTargetPort 4 visitorPort 4 visitorId 4 data 4
|
||||
public static final int bodyLength = 1 + 1 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4;
|
||||
|
||||
|
||||
/**
|
||||
@@ -25,6 +26,34 @@ public class NettyProxyMsg {
|
||||
*/
|
||||
private byte type;
|
||||
|
||||
/**
|
||||
* 是否是ssl
|
||||
* byte 长度 1
|
||||
* 1 true
|
||||
* 0 false
|
||||
* @since 1.2.8
|
||||
*/
|
||||
private byte isSsl = 0;
|
||||
/**
|
||||
* 令牌key
|
||||
* byte[] 长度 4
|
||||
* @since 1.2.8
|
||||
*/
|
||||
private byte[] appKey;
|
||||
/**
|
||||
* 令牌密钥
|
||||
* byte[] 长度 4
|
||||
*
|
||||
* @since 1.2.9
|
||||
*/
|
||||
private byte[] appSecret;
|
||||
/**
|
||||
* 原始IP
|
||||
* byte[] 长度 4
|
||||
*
|
||||
* @since 1.2.9
|
||||
*/
|
||||
private byte[] originalIp;
|
||||
/**
|
||||
* 客户端ID
|
||||
* byte[] 长度 4
|
||||
@@ -77,6 +106,78 @@ public class NettyProxyMsg {
|
||||
}
|
||||
|
||||
|
||||
public void setAppKeyString(String appKey) {
|
||||
if (ObjectUtils.isEmpty(appKey)) {
|
||||
this.appKey = null;
|
||||
} else {
|
||||
this.appKey = appKey.getBytes(StandardCharsets.UTF_8);
|
||||
}
|
||||
}
|
||||
|
||||
public void setAppSecretString(String appSecret) {
|
||||
if (ObjectUtils.isEmpty(appSecret)) {
|
||||
this.appSecret = null;
|
||||
} else {
|
||||
this.appSecret = appSecret.getBytes(StandardCharsets.UTF_8);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置原始IP
|
||||
*
|
||||
* @param originalIp 原始IP
|
||||
*/
|
||||
public void setOriginalIpString(String originalIp) {
|
||||
if (ObjectUtils.isEmpty(originalIp)) {
|
||||
this.originalIp = null;
|
||||
} else {
|
||||
this.originalIp = originalIp.getBytes(StandardCharsets.UTF_8);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取应用密钥
|
||||
*
|
||||
* @return 应用密钥
|
||||
*/
|
||||
public String getAppSecretString() {
|
||||
if (ObjectUtils.isEmpty(appSecret)) {
|
||||
return null;
|
||||
}
|
||||
return new String(appSecret, StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取应用key
|
||||
*
|
||||
* @return 应用key
|
||||
*/
|
||||
public String getAppKeyString() {
|
||||
if (ObjectUtils.isEmpty(appKey)) {
|
||||
return null;
|
||||
}
|
||||
return new String(appKey, StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取原始IP字符串
|
||||
*
|
||||
* @return 原始IP字符串
|
||||
*/
|
||||
public String getOriginalIpString() {
|
||||
if (ObjectUtils.isEmpty(originalIp)) {
|
||||
return null;
|
||||
}
|
||||
return new String(originalIp, StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
public String getClientIdString() {
|
||||
if (ObjectUtils.isEmpty(clientId)) {
|
||||
return null;
|
||||
}
|
||||
return new String(clientId, StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
public void setClientTargetIp(byte[] clientTargetIp) {
|
||||
this.clientTargetIp = clientTargetIp;
|
||||
}
|
||||
@@ -110,4 +211,23 @@ public class NettyProxyMsg {
|
||||
}
|
||||
|
||||
|
||||
public Boolean isSsl() {
|
||||
return isSsl == 1;
|
||||
}
|
||||
|
||||
public void isSsl(Boolean isSsl) {
|
||||
if (isSsl) {
|
||||
this.isSsl = 1;
|
||||
} else {
|
||||
this.isSsl = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public byte getIsSsl() {
|
||||
return isSsl;
|
||||
}
|
||||
|
||||
public void setIsSsl(byte isSsl) {
|
||||
this.isSsl = isSsl;
|
||||
}
|
||||
}
|
||||
@@ -1,15 +1,13 @@
|
||||
package org.framework.lazy.cloud.network.heartbeat.common;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
* 渗透端口对应访客上下文
|
||||
*/
|
||||
public class NettyPermeateVisitorContext {
|
||||
public class NettyServerPermeateServerVisitorContext {
|
||||
|
||||
protected static final ConcurrentHashMap<Integer/*permeatePort*/, Object/*NettyPermeateVisitorSocket*/> PERMEATE_VISITOR_SOCKET = new ConcurrentHashMap<>();
|
||||
protected static final ConcurrentHashMap<Integer/*permeatePort*/, Object/*NettyServerPermeateServerVisitorSocket*/> PERMEATE_VISITOR_SOCKET = new ConcurrentHashMap<>();
|
||||
|
||||
|
||||
/**
|
||||
@@ -18,7 +16,7 @@ public class NettyPermeateVisitorContext {
|
||||
* @param permeatePort 渗透端口
|
||||
* @param permeateVisitorSocket 渗透访客socket
|
||||
*/
|
||||
public static <T> void pushPermeateVisitorSocket(Integer permeatePort, T permeateVisitorSocket) {
|
||||
public static <T> void pushServerPermeateServerVisitorSocket(Integer permeatePort, T permeateVisitorSocket) {
|
||||
PERMEATE_VISITOR_SOCKET.put(permeatePort, permeateVisitorSocket);
|
||||
}
|
||||
|
||||
@@ -30,7 +28,7 @@ public class NettyPermeateVisitorContext {
|
||||
* @param permeatePort 渗透端口
|
||||
* @return 访客
|
||||
*/
|
||||
public static <T> T getPermeateVisitorSocket(Integer permeatePort) {
|
||||
public static <T> T getServerPermeateServerVisitorSocket(Integer permeatePort) {
|
||||
return (T) PERMEATE_VISITOR_SOCKET.getOrDefault(permeatePort, null);
|
||||
}
|
||||
/**
|
||||
@@ -38,7 +36,7 @@ public class NettyPermeateVisitorContext {
|
||||
*
|
||||
* @param permeatePort 渗透端口
|
||||
*/
|
||||
public static void removePermeateVisitorSockets(Integer permeatePort) {
|
||||
public static void removeServerPermeateServerVisitorSockets(Integer permeatePort) {
|
||||
PERMEATE_VISITOR_SOCKET.remove(permeatePort);
|
||||
}
|
||||
|
||||
@@ -57,17 +57,16 @@ public class NettyVisitorPortContext {
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除访客
|
||||
* 删除访客
|
||||
*
|
||||
* @param visitorPort 访客通道
|
||||
* @return 删除的访客通道
|
||||
* @param <T> 访客通道范型
|
||||
* @param <T> 访客通道范型
|
||||
*/
|
||||
public static Channel removeVisitorChannel(Integer visitorPort) {
|
||||
public static void removeVisitorChannel(Integer visitorPort) {
|
||||
Channel visitor = getVisitorChannel(visitorPort);
|
||||
if(visitor!=null){
|
||||
VISITOR_PORT_CHANNEL.remove(visitorPort);
|
||||
}
|
||||
return visitor;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -75,14 +74,12 @@ public class NettyVisitorPortContext {
|
||||
*
|
||||
* @param visitorPort 访客通道
|
||||
* @param <T> 访客通道范型
|
||||
* @return 删除的访客通道
|
||||
*/
|
||||
public static PermeateVisitorSocket removeVisitorSocket(Integer visitorPort) {
|
||||
public static void removeVisitorSocket(Integer visitorPort) {
|
||||
PermeateVisitorSocket visitor = getVisitorSocket(visitorPort);
|
||||
if (visitor != null) {
|
||||
VISITOR_PORT_SOCKET.remove(visitorPort);
|
||||
}
|
||||
return visitor;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,403 @@
|
||||
package org.framework.lazy.cloud.network.heartbeat.common;
|
||||
|
||||
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.udp.client.*;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.udp.server.*;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.enums.MessageTypeEnums;
|
||||
|
||||
/**
|
||||
* @see MessageTypeEnums
|
||||
* 数据取值范围 -128~ 127
|
||||
* 当前约束范围 -100~100
|
||||
*
|
||||
* TPC:1~64
|
||||
* UDP: 64~128
|
||||
*/
|
||||
public class UdpMessageType {
|
||||
/**
|
||||
* 客户端UDP 上报连接成功
|
||||
*
|
||||
* @see MessageTypeEnums#UDP_REPORT_CLIENT_CONNECT_SUCCESS
|
||||
* @see AbstractHandleUdpClientConnectSuccessTypeAdvanced
|
||||
*/
|
||||
public static final byte UDP_REPORT_CLIENT_CONNECT_SUCCESS = 64;
|
||||
/**
|
||||
* UDP 上报 客户端断开连接
|
||||
*
|
||||
* @see MessageTypeEnums#UDP_REPORT_CLIENT_DISCONNECTION
|
||||
* @see AbstractHandleUdpReportDisconnectTypeAdvanced
|
||||
*/
|
||||
public static final byte UDP_REPORT_CLIENT_DISCONNECTION = UDP_REPORT_CLIENT_CONNECT_SUCCESS+1;
|
||||
/**
|
||||
* 客户端UDP 上报暂存开启
|
||||
*
|
||||
* @see MessageTypeEnums#UDP_REPORT_CLIENT_STAGING_OPENED
|
||||
* @see AbstractHandleUdpReportStagingOpenedTypeAdvanced
|
||||
*/
|
||||
public static final byte UDP_REPORT_CLIENT_STAGING_OPENED = UDP_REPORT_CLIENT_DISCONNECTION+1;
|
||||
/**
|
||||
* 客户端UDP 上报暂存关闭
|
||||
*
|
||||
* @see MessageTypeEnums#UDP_REPORT_CLIENT_STAGING_CLOSED
|
||||
* @see AbstractHandleUdpReportStagingClosedTypeAdvanced
|
||||
*/
|
||||
public static final byte UDP_REPORT_CLIENT_STAGING_CLOSED = UDP_REPORT_CLIENT_STAGING_OPENED+1;
|
||||
|
||||
/**
|
||||
* UDP 上报 客户端数据传输(内网穿透数据回传)
|
||||
*
|
||||
* @see MessageTypeEnums#UDP_REPORT_CLIENT_TRANSFER
|
||||
* @see AbstractHandleUdpReportServicePermeateClientTransferTypeAdvanced
|
||||
*/
|
||||
public static final byte UDP_REPORT_CLIENT_TRANSFER = UDP_REPORT_CLIENT_STAGING_CLOSED+1;
|
||||
|
||||
|
||||
/**
|
||||
* UDP 上报 客户端创建需要代理的真实端口成功
|
||||
*
|
||||
* @see MessageTypeEnums#UDP_REPORT_SINGLE_CLIENT_REAL_CONNECT
|
||||
* @see AbstractHandleUdpReportServicePermeateClientRealConnectTypeAdvanced
|
||||
*/
|
||||
public static final byte UDP_REPORT_SINGLE_CLIENT_REAL_CONNECT = UDP_REPORT_CLIENT_TRANSFER+1;
|
||||
/**
|
||||
* UDP 上报 客户端关闭一个访客通道
|
||||
*
|
||||
* @see MessageTypeEnums#UDP_REPORT_SINGLE_CLIENT_CLOSE_VISITOR
|
||||
* @see AbstractHandleUdpReportServicePermeateClientCloseVisitorTypeAdvanced
|
||||
*/
|
||||
public static final byte UDP_REPORT_SERVICE_PERMEATE_CLIENT_CLIENT_CLOSE_VISITOR = UDP_REPORT_SINGLE_CLIENT_REAL_CONNECT+1;
|
||||
|
||||
/**
|
||||
* UDP 上报 客户端消息到另一个客户端
|
||||
*
|
||||
* @see MessageTypeEnums#UDP_REPORT_SINGLE_CLIENT_MESSAGE
|
||||
* @see AbstractHandleUdpReportSingleClientMessage2OtherClientTypeAdvanced
|
||||
*/
|
||||
public static final byte UDP_REPORT_SINGLE_CLIENT_MESSAGE = UDP_REPORT_SERVICE_PERMEATE_CLIENT_CLIENT_CLOSE_VISITOR+1;
|
||||
/**
|
||||
* 服务端通道 is active
|
||||
*
|
||||
* @see MessageTypeEnums#UDP_SERVER_CHANNEL_ACTIVE
|
||||
* @see AbstractHandleUdpReportServerChannelActiveTypeAdvanced
|
||||
*/
|
||||
public static final byte UDP_SERVER_CHANNEL_ACTIVE = UDP_REPORT_SINGLE_CLIENT_MESSAGE+1;
|
||||
|
||||
/**
|
||||
* UDP 上报 集群注册
|
||||
*
|
||||
* @see MessageTypeEnums#UDP_REPORT_CLUSTER_NODE_REGISTER_MESSAGE
|
||||
* @see AbstractHandleUdpReportClusterNodeRegisterTypeAdvanced
|
||||
*/
|
||||
public static final byte UDP_REPORT_CLUSTER_NODE_REGISTER_MESSAGE = UDP_SERVER_CHANNEL_ACTIVE+1;
|
||||
|
||||
|
||||
/**
|
||||
* 客户端渗透服务端类型------------------------------------------------------------------------------------
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* UDP 上报 客户端渗透服务端数据传输通道连接成功
|
||||
*
|
||||
* @see MessageTypeEnums#UDP_REPORT_CLIENT_TRANSFER_SERVER_PERMEATE_CHANNEL_CONNECTION_SUCCESSFUL
|
||||
* @see AbstractHandleUdpReportClientTransferServerPermeateChannelConnectionSuccessfulTypeAdvanced
|
||||
*/
|
||||
public static final byte UDP_REPORT_CLIENT_TRANSFER_SERVER_PERMEATE_CHANNEL_CONNECTION_SUCCESSFUL = UDP_REPORT_CLUSTER_NODE_REGISTER_MESSAGE+1;
|
||||
|
||||
/**
|
||||
* UDP 上报 客户端渗透服务端init信息
|
||||
*
|
||||
* @see MessageTypeEnums#UDP_REPORT_CLIENT_PERMEATE_SERVER_INIT
|
||||
* @see AbstractHandleUdpReportClientPermeateServerInitTypeAdvanced
|
||||
*/
|
||||
public static final byte UDP_REPORT_CLIENT_PERMEATE_SERVER_INIT = UDP_REPORT_CLIENT_TRANSFER_SERVER_PERMEATE_CHANNEL_CONNECTION_SUCCESSFUL+1;
|
||||
/**
|
||||
* UDP 上报 客户端渗透服务端init close 信息
|
||||
*
|
||||
* @see MessageTypeEnums#UDP_REPORT_CLIENT_PERMEATE_SERVER_CLOSE
|
||||
* @see AbstractHandleUdpReportClientPermeateServerCloseTypeAdvanced
|
||||
*/
|
||||
public static final byte UDP_REPORT_CLIENT_PERMEATE_SERVER_CLOSE = UDP_REPORT_CLIENT_PERMEATE_SERVER_INIT+1;
|
||||
/**
|
||||
* UDP 上报 客户端渗透服务端通信通道关闭
|
||||
*
|
||||
* @see MessageTypeEnums#UDP_UDP_REPORT_CLIENT_PERMEATE_SERVER_TRANSFER_CLOSE
|
||||
* @see AbstractHandleUdpReportClientPermeateServerTransferCloseTypeAdvanced
|
||||
*/
|
||||
public static final byte UDP_UDP_REPORT_CLIENT_PERMEATE_SERVER_TRANSFER_CLOSE = UDP_REPORT_CLIENT_PERMEATE_SERVER_CLOSE+1;
|
||||
|
||||
/**
|
||||
* UDP 上报 客户端渗透服务端通信传输
|
||||
*
|
||||
* @see MessageTypeEnums#UDP_REPORT_CLIENT_PERMEATE_SERVER_TRANSFER
|
||||
* @see AbstractHandleUdpReportClientPermeateServerTransferTypeAdvanced
|
||||
*/
|
||||
public static final byte UDP_REPORT_CLIENT_PERMEATE_SERVER_TRANSFER = UDP_UDP_REPORT_CLIENT_PERMEATE_SERVER_TRANSFER_CLOSE+1;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 客户端渗透客户端类型------------------------------------------------------------------------------------
|
||||
* 60~90
|
||||
*/
|
||||
|
||||
/**
|
||||
* UDP 上报 客户端渗透客户端init信息
|
||||
*
|
||||
* @see MessageTypeEnums#UDP_REPORT_CLIENT_PERMEATE_CLIENT_INIT
|
||||
* @see AbstractHandleUdpReportClientPermeateClientInitTypeAdvanced
|
||||
*/
|
||||
public static final byte UDP_REPORT_CLIENT_PERMEATE_CLIENT_INIT = UDP_REPORT_CLIENT_PERMEATE_SERVER_TRANSFER+1;
|
||||
/**
|
||||
* UDP 上报 客户端渗透客户端init close 信息
|
||||
*
|
||||
* @see MessageTypeEnums#UDP_REPORT_CLIENT_PERMEATE_CLIENT_CLOSE
|
||||
* @see AbstractHandleUdpReportClientPermeateClientCloseTypeAdvanced
|
||||
*/
|
||||
public static final byte UDP_REPORT_CLIENT_PERMEATE_CLIENT_CLOSE = UDP_REPORT_CLIENT_PERMEATE_CLIENT_INIT+1;
|
||||
/**
|
||||
* UDP 上报 客户端渗透客户端数据传输通道连接成功
|
||||
*
|
||||
* @see MessageTypeEnums#UDP_REPORT_CLIENT_TRANSFER_CLIENT_PERMEATE_CHANNEL_CONNECTION_SUCCESSFUL
|
||||
* @see AbstractHandleUdpReportClientTransferClientPermeateChannelConnectionSuccessfulTypeAdvanced
|
||||
* @see MessageType#UDP_DISTRIBUTE_CLIENT_TRANSFER_CLIENT_PERMEATE_CHANNEL_CONNECTION_SUCCESSFUL
|
||||
*/
|
||||
public static final byte UDP_REPORT_CLIENT_TRANSFER_CLIENT_PERMEATE_CHANNEL_CONNECTION_SUCCESSFUL = UDP_REPORT_CLIENT_PERMEATE_CLIENT_CLOSE+1;
|
||||
|
||||
|
||||
/**
|
||||
* UDP 上报 客户端渗透客户端数据传输通道init 成功
|
||||
*
|
||||
* @see MessageTypeEnums#UDP_REPORT_CLIENT_TRANSFER_CLIENT_PERMEATE_CHANNEL_INIT_SUCCESSFUL
|
||||
* @see AbstractHandleUdpReportClientTransferClientPermeateChannelInitSuccessfulTypeAdvanced
|
||||
* @see MessageType#UDP_DISTRIBUTE_CLIENT_PERMEATE_CLIENT_TRANSFER_CHANNEL_INIT_SUCCESSFUL
|
||||
*/
|
||||
public static final byte UDP_REPORT_CLIENT_PERMEATE_CLIENT_TRANSFER_CHANNEL_INIT_SUCCESSFUL = UDP_REPORT_CLIENT_TRANSFER_CLIENT_PERMEATE_CHANNEL_CONNECTION_SUCCESSFUL+1;
|
||||
/**
|
||||
* UDP 上报客户端渗透客户端数据传输请求
|
||||
*
|
||||
* @see MessageTypeEnums#UDP_REPORT_CLIENT_TRANSFER_CLIENT_REQUEST
|
||||
* @see AbstractHandleUdpReportClientTransferClientTypeAdvanced
|
||||
* @see MessageType#UDP_DISTRIBUTE_CLIENT_PERMEATE_CLIENT_TRANSFER_REQUEST
|
||||
*/
|
||||
public static final byte UDP_REPORT_CLIENT_PERMEATE_CLIENT_TRANSFER_REQUEST = UDP_REPORT_CLIENT_PERMEATE_CLIENT_TRANSFER_CHANNEL_INIT_SUCCESSFUL+1;
|
||||
|
||||
/**
|
||||
* UDP 上报客户端渗透客户端数据传输结果
|
||||
*
|
||||
* @see MessageTypeEnums#UDP_REPORT_CLIENT_TRANSFER_CLIENT_RESPONSE
|
||||
* @see AbstractHandleUdpReportClientTransferClientResponseTypeAdvanced
|
||||
* @see MessageType#UDP_DISTRIBUTE_CLIENT_PERMEATE_CLIENT_TRANSFER_RESPONSE
|
||||
*/
|
||||
public static final byte UDP_REPORT_CLIENT_TRANSFER_CLIENT_RESPONSE = UDP_REPORT_CLIENT_PERMEATE_CLIENT_TRANSFER_REQUEST+1;
|
||||
|
||||
/**
|
||||
* UDP 上报客户端渗透客户端通信通道关闭
|
||||
*
|
||||
* @see MessageTypeEnums#UDP_REPORT_CLIENT_PERMEATE_CLIENT_TRANSFER_CLOSE
|
||||
* @see AbstractHandleUdpReportClientPermeateClientTransferCloseTypeAdvanced
|
||||
* @see MessageType#UDP_DISTRIBUTE_CLIENT_PERMEATE_CLIENT_TRANSFER_CLOSE
|
||||
*/
|
||||
public static final byte UDP_REPORT_CLIENT_PERMEATE_CLIENT_TRANSFER_CLOSE = UDP_REPORT_CLIENT_TRANSFER_CLIENT_RESPONSE+1;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* UDP 下发 客户端接收连接成功通知
|
||||
*
|
||||
* @see MessageTypeEnums#UDP_DISTRIBUTE_CLIENT_CONNECTION_SUCCESS_NOTIFICATION
|
||||
* @see AbstractHandleUdpDistributeConnectSuccessNotificationTypeAdvancedHandle
|
||||
*/
|
||||
public static final byte UDP_DISTRIBUTE_CLIENT_CONNECTION_SUCCESS_NOTIFICATION = -64;
|
||||
/**
|
||||
* UDP 下发 客户端断开连接通知
|
||||
*
|
||||
* @see MessageTypeEnums#UDP_DISTRIBUTE_CLIENT_DISCONNECTION_NOTIFICATION
|
||||
* @see AbstractHandleUdpDistributeDisconnectTypeAdvancedHandle
|
||||
*/
|
||||
public static final byte UDP_DISTRIBUTE_CLIENT_DISCONNECTION_NOTIFICATION = UDP_DISTRIBUTE_CLIENT_CONNECTION_SUCCESS_NOTIFICATION-1;
|
||||
/**
|
||||
* UDP 下发 客户端暂存开启通知
|
||||
*
|
||||
* @see MessageTypeEnums#UDP_DISTRIBUTE_CLIENT_STAGING_OPENED_NOTIFICATION
|
||||
* @see AbstractHandleUdpDistributeStagingOpenedTypeAdvanced
|
||||
*/
|
||||
public static final byte UDP_DISTRIBUTE_CLIENT_STAGING_OPENED_NOTIFICATION = UDP_DISTRIBUTE_CLIENT_DISCONNECTION_NOTIFICATION-1;
|
||||
|
||||
/**
|
||||
* UDP 下发 客户端暂存关闭通知
|
||||
*
|
||||
* @see MessageTypeEnums#UDP_DISTRIBUTE_CLIENT_STAGING_CLOSED_NOTIFICATION
|
||||
* @see AbstractHandleUdpDistributeStagingClosedTypeAdvanced
|
||||
*/
|
||||
public static final byte UDP_DISTRIBUTE_CLIENT_STAGING_CLOSED_NOTIFICATION = UDP_DISTRIBUTE_CLIENT_STAGING_OPENED_NOTIFICATION-1;
|
||||
/**
|
||||
* UDP 下发 客户端数据传输(内网穿透数据发送)
|
||||
*
|
||||
* @see MessageTypeEnums#UDP_DISTRIBUTE_CLIENT_TRANSFER
|
||||
* @see AbstractHandleUdpDistributeServicePermeateClientTransferTypeAdvanced
|
||||
*/
|
||||
public static final byte UDP_DISTRIBUTE_CLIENT_TRANSFER = UDP_DISTRIBUTE_CLIENT_STAGING_CLOSED_NOTIFICATION-1;
|
||||
/**
|
||||
* UDP 下发 客户端创建需要代理的真实端口
|
||||
*
|
||||
* @see MessageTypeEnums#UDP_DISTRIBUTE_SINGLE_CLIENT_REAL_CONNECT
|
||||
* @see AbstractHandleUdpDistributeServicePermeateClientRealConnectTypeAdvanced
|
||||
*/
|
||||
public static final byte UDP_DISTRIBUTE_SINGLE_CLIENT_REAL_CONNECT = UDP_DISTRIBUTE_CLIENT_TRANSFER-1;
|
||||
|
||||
/**
|
||||
* UDP 下发 客户端代理的真实端口自动读写
|
||||
*
|
||||
* @see MessageTypeEnums#UDP_DISTRIBUTE_SINGLE_CLIENT_REAL_CONNECT_AUTO_READ
|
||||
* @see AbstractHandleUdpDistributeSingleClientRealAutoReadConnectTypeAdvanced
|
||||
*/
|
||||
public static final byte UDP_DISTRIBUTE_SINGLE_CLIENT_REAL_CONNECT_AUTO_READ = UDP_DISTRIBUTE_SINGLE_CLIENT_REAL_CONNECT-1;
|
||||
|
||||
/**
|
||||
* UDP 下发 客户端关闭代理服务通道
|
||||
*
|
||||
* @see MessageTypeEnums#UDP_DISTRIBUTE_SINGLE_CLIENT_REAL_CLOSE_VISITOR
|
||||
* @see AbstractHandleUdpDistributeSingleClientRealCloseVisitorTypeAdvanced
|
||||
*/
|
||||
public static final byte UDP_DISTRIBUTE_SERVER_PERMEATE_CLIENT_REAL_CLOSE_VISITOR = UDP_DISTRIBUTE_SINGLE_CLIENT_REAL_CONNECT_AUTO_READ-1;
|
||||
|
||||
/**
|
||||
* UDP 下发 客户端消息
|
||||
*
|
||||
* @see MessageTypeEnums#UDP_DISTRIBUTE_SINGLE_CLIENT_MESSAGE
|
||||
* @see AbstractHandleUdpDistributeSingleClientMessageTypeAdvanced
|
||||
*/
|
||||
public static final byte UDP_DISTRIBUTE_SINGLE_CLIENT_MESSAGE = UDP_DISTRIBUTE_SERVER_PERMEATE_CLIENT_REAL_CLOSE_VISITOR-1;
|
||||
|
||||
|
||||
/**
|
||||
* 客户端通道 is active
|
||||
*
|
||||
* @see MessageTypeEnums#UDP_CLIENT_CHANNEL_ACTIVE
|
||||
* @see AbstractHandleUdpClientChannelActiveAdvanced
|
||||
*/
|
||||
public static final byte UDP_CLIENT_CHANNEL_ACTIVE = UDP_DISTRIBUTE_SINGLE_CLIENT_MESSAGE-1;
|
||||
|
||||
/**
|
||||
* UDP 下发 集群注册
|
||||
*
|
||||
* @see MessageTypeEnums#UDP_DISTRIBUTE_CLUSTER_NODE_REGISTER_MESSAGE
|
||||
* @see AbstractHandleUdpDistributeClusterNodeRegisterTypeAdvanced
|
||||
*/
|
||||
public static final byte UDP_DISTRIBUTE_CLUSTER_NODE_REGISTER_MESSAGE = UDP_CLIENT_CHANNEL_ACTIVE -1;
|
||||
|
||||
/**
|
||||
* UDP 下发 客户端渗透服务端数据传输通道连接成功
|
||||
*
|
||||
* @see MessageTypeEnums#UDP_DISTRIBUTE_CLIENT_TRANSFER_SERVER_PERMEATE_CHANNEL_CONNECTION_SUCCESSFUL
|
||||
* @see AbstractHandleUdpDistributeClientTransferServerPermeateChannelConnectionSuccessfulTypeAdvanced
|
||||
*/
|
||||
public static final byte UDP_DISTRIBUTE_CLIENT_TRANSFER_SERVER_PERMEATE_CHANNEL_CONNECTION_SUCCESSFUL = UDP_DISTRIBUTE_CLUSTER_NODE_REGISTER_MESSAGE-1;
|
||||
|
||||
/**
|
||||
* UDP 下发 客户端渗透服务端init信息
|
||||
*
|
||||
* @see MessageTypeEnums#UDP_DISTRIBUTE_CLIENT_PERMEATE_SERVER_INIT
|
||||
* @see AbstractHandleUdpDistributeClientPermeateServerInitTypeAdvanced
|
||||
*/
|
||||
public static final byte UDP_DISTRIBUTE_CLIENT_PERMEATE_SERVER_INIT = UDP_DISTRIBUTE_CLIENT_TRANSFER_SERVER_PERMEATE_CHANNEL_CONNECTION_SUCCESSFUL-1;
|
||||
|
||||
/**
|
||||
* UDP 下发 客户端渗透服务端init close信息
|
||||
*
|
||||
* @see MessageTypeEnums#UDP_DISTRIBUTE_CLIENT_PERMEATE_SERVER_CLOSE
|
||||
* @see AbstractHandleUdpDistributeClientPermeateServerCloseTypeAdvanced
|
||||
*/
|
||||
public static final byte UDP_DISTRIBUTE_CLIENT_PERMEATE_SERVER_CLOSE = UDP_DISTRIBUTE_CLIENT_PERMEATE_SERVER_INIT-1;
|
||||
|
||||
|
||||
/**
|
||||
* UDP 下发 客户端渗透服务端通信通道关闭
|
||||
*
|
||||
* @see MessageTypeEnums#UDP_DISTRIBUTE_CLIENT_PERMEATE_SERVER_TRANSFER_CLOSE
|
||||
* @see AbstractHandleUdpDistributeClientPermeateServerTransferCloseTypeAdvanced
|
||||
*/
|
||||
public static final byte UDP_DISTRIBUTE_CLIENT_PERMEATE_SERVER_TRANSFER_CLOSE = UDP_DISTRIBUTE_CLIENT_PERMEATE_SERVER_CLOSE-1;
|
||||
|
||||
/**
|
||||
* UDP 下发 客户端渗透服务端通信传输
|
||||
*
|
||||
* @see MessageTypeEnums#UDP_DISTRIBUTE_CLIENT_PERMEATE_SERVER_TRANSFER
|
||||
* @see AbstractHandleUdpDistributeClientPermeateServerTransferTypeAdvanced
|
||||
*/
|
||||
public static final byte UDP_DISTRIBUTE_CLIENT_PERMEATE_SERVER_TRANSFER = UDP_DISTRIBUTE_CLIENT_PERMEATE_SERVER_TRANSFER_CLOSE-1;
|
||||
/**
|
||||
* UDP 下发 客户端渗透客户端init信息
|
||||
*
|
||||
* @see MessageTypeEnums#UDP_DISTRIBUTE_CLIENT_PERMEATE_CLIENT_INIT
|
||||
* @see AbstractHandleUdpDistributeClientPermeateClientInitTypeAdvanced
|
||||
*/
|
||||
public static final byte UDP_DISTRIBUTE_CLIENT_PERMEATE_CLIENT_INIT = UDP_DISTRIBUTE_CLIENT_PERMEATE_SERVER_TRANSFER-1;
|
||||
|
||||
/**
|
||||
* UDP 下发 客户端渗透客户端init close信息
|
||||
*
|
||||
* @see MessageTypeEnums#UDP_DISTRIBUTE_CLIENT_PERMEATE_CLIENT_CLOSE
|
||||
* @see AbstractHandleUdpDistributeClientPermeateClientCloseTypeAdvanced
|
||||
*/
|
||||
public static final byte UDP_DISTRIBUTE_CLIENT_PERMEATE_CLIENT_CLOSE = UDP_DISTRIBUTE_CLIENT_PERMEATE_CLIENT_INIT-1;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* UDP 下发 客户端渗透客户端数据传输通道连接成功
|
||||
*
|
||||
* @see MessageTypeEnums#UDP_DISTRIBUTE_CLIENT_TRANSFER_CLIENT_PERMEATE_CHANNEL_CONNECTION_SUCCESSFUL
|
||||
* @see AbstractHandleUdpDistributeClientTransferClientPermeateChannelConnectionSuccessfulTypeAdvanced
|
||||
* @see MessageType#UDP_REPORT_CLIENT_TRANSFER_CLIENT_PERMEATE_CHANNEL_CONNECTION_SUCCESSFUL
|
||||
*/
|
||||
public static final byte UDP_DISTRIBUTE_CLIENT_TRANSFER_CLIENT_PERMEATE_CHANNEL_CONNECTION_SUCCESSFUL = UDP_DISTRIBUTE_CLIENT_PERMEATE_CLIENT_CLOSE-1;
|
||||
|
||||
|
||||
/**
|
||||
* UDP 下发 客户端渗透客户端数据传输通道init 成功
|
||||
*
|
||||
* @see MessageTypeEnums#UDP_DISTRIBUTE_CLIENT_PERMEATE_CLIENT_TRANSFER_CHANNEL_INIT_SUCCESSFUL
|
||||
* @see AbstractHandleUdpDistributeClientTransferClientPermeateChannelInitSuccessfulTypeAdvanced
|
||||
* @see MessageType#UDP_DISTRIBUTE_CLIENT_PERMEATE_CLIENT_TRANSFER_CHANNEL_INIT_SUCCESSFUL
|
||||
*/
|
||||
public static final byte UDP_DISTRIBUTE_CLIENT_PERMEATE_CLIENT_TRANSFER_CHANNEL_INIT_SUCCESSFUL = UDP_DISTRIBUTE_CLIENT_TRANSFER_CLIENT_PERMEATE_CHANNEL_CONNECTION_SUCCESSFUL-1;
|
||||
|
||||
/**
|
||||
* UDP 下发 客户端渗透客户端数据传输请求
|
||||
*
|
||||
* @see MessageTypeEnums#UDP_DISTRIBUTE_CLIENT_PERMEATE_CLIENT_TRANSFER_REQUEST
|
||||
* @see AbstractHandleUdpDistributeClientTransferClientRequestTypeAdvanced
|
||||
* @see MessageType#UDP_REPORT_CLIENT_PERMEATE_CLIENT_TRANSFER_REQUEST
|
||||
*/
|
||||
public static final byte UDP_DISTRIBUTE_CLIENT_PERMEATE_CLIENT_TRANSFER_REQUEST = UDP_DISTRIBUTE_CLIENT_PERMEATE_CLIENT_TRANSFER_CHANNEL_INIT_SUCCESSFUL-1;
|
||||
/**
|
||||
* UDP 下发客户端渗透客户端数据传输响应
|
||||
*
|
||||
* @see MessageTypeEnums#UDP_DISTRIBUTE_CLIENT_PERMEATE_CLIENT_TRANSFER_RESPONSE
|
||||
* @see AbstractHandleUdpDistributeServicePermeateClientTransferClientResponseTypeAdvanced
|
||||
* @see MessageType#UDP_REPORT_CLIENT_TRANSFER_CLIENT_RESPONSE
|
||||
*/
|
||||
public static final byte UDP_DISTRIBUTE_CLIENT_PERMEATE_CLIENT_TRANSFER_RESPONSE = UDP_DISTRIBUTE_CLIENT_PERMEATE_CLIENT_TRANSFER_REQUEST-1;
|
||||
|
||||
|
||||
/**
|
||||
* UDP 下发客户端渗透客户端通信通道关闭
|
||||
*
|
||||
* @see MessageTypeEnums#UDP_DISTRIBUTE_CLIENT_PERMEATE_CLIENT_TRANSFER_CLOSE
|
||||
* @see AbstractHandleUdpDistributeClientPermeateClientTransferCloseTypeAdvanced
|
||||
* @see MessageType#UDP_REPORT_CLIENT_PERMEATE_CLIENT_TRANSFER_CLOSE
|
||||
*/
|
||||
public static final byte UDP_DISTRIBUTE_CLIENT_PERMEATE_CLIENT_TRANSFER_CLOSE = UDP_DISTRIBUTE_CLIENT_PERMEATE_CLIENT_TRANSFER_RESPONSE-1;
|
||||
|
||||
}
|
||||
@@ -54,6 +54,7 @@ public class ChannelFlowAdapter {
|
||||
* @param channelFlow 通道数据
|
||||
*/
|
||||
public void asyncHandler(Channel channel, ChannelFlow channelFlow) {
|
||||
// TODO 流量并发异常
|
||||
CHANNEL_FLOW_ADAPTER_EXECUTOR.submit(() -> handler(channel, channelFlow));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
package org.framework.lazy.cloud.network.heartbeat.common.advanced;
|
||||
|
||||
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.enums.MessageTypeEnums;
|
||||
|
||||
|
||||
/**
|
||||
* 服务端 处理客户端心跳
|
||||
* TYPE_HEARTBEAT
|
||||
*/
|
||||
|
||||
public abstract class AbstractHandleChannelHeartbeatTypeAdvanced<MSG> extends AbstractHandleChannelTypeAdvanced<NettyProxyMsg> implements HandleChannelTypeAdvanced {
|
||||
|
||||
/**
|
||||
* 是否支持当前类型
|
||||
*
|
||||
* @param msg 通道数据
|
||||
* @return 布尔类型 是、否
|
||||
*/
|
||||
@Override
|
||||
public boolean doSupport(NettyProxyMsg msg) {
|
||||
return MessageTypeEnums.TYPE_HEARTBEAT.getTypeByte() == msg.getType();
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
package org.framework.lazy.cloud.network.heartbeat.common.advanced.server;
|
||||
|
||||
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.AbstractHandleChannelTypeAdvanced;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.HandleChannelTypeAdvanced;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.enums.MessageTypeEnums;
|
||||
|
||||
|
||||
/**
|
||||
* 服务端处理客户端上报数据
|
||||
* REPORT_CLIENT_STAGING_CLOSED
|
||||
*/
|
||||
public abstract class AbstractHandleReportServicePermeateClientTransferTypeAdvanced<MSG> extends AbstractHandleChannelTypeAdvanced<NettyProxyMsg> implements HandleChannelTypeAdvanced {
|
||||
|
||||
|
||||
/**
|
||||
* 是否支持当前类型
|
||||
*
|
||||
* @param msg 通道数据
|
||||
* @return 布尔类型 是、否
|
||||
*/
|
||||
@Override
|
||||
public boolean doSupport(NettyProxyMsg msg) {
|
||||
return MessageTypeEnums.REPORT_CLIENT_TRANSFER.getTypeByte() == msg.getType();
|
||||
}
|
||||
}
|
||||
@@ -1,18 +1,21 @@
|
||||
package org.framework.lazy.cloud.network.heartbeat.common.advanced.server;
|
||||
package org.framework.lazy.cloud.network.heartbeat.common.advanced.tcp;
|
||||
|
||||
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.AbstractHandleChannelTypeAdvanced;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.HandleChannelTypeAdvanced;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.enums.MessageTypeEnums;
|
||||
|
||||
|
||||
/**
|
||||
* 上报客户端暂存开启
|
||||
* 服务端 处理客户端心跳
|
||||
* TCP_TYPE_HEARTBEAT
|
||||
*/
|
||||
|
||||
public abstract class AbstractHandleReportStagingOpenedTypeAdvanced<MSG> extends AbstractHandleChannelTypeAdvanced<NettyProxyMsg> implements HandleChannelTypeAdvanced {
|
||||
public abstract class AbstractTcpHandleChannelHeartbeatTypeAdvanced<MSG> extends AbstractHandleChannelTypeAdvanced<NettyProxyMsg> implements HandleChannelTypeAdvanced {
|
||||
|
||||
/**
|
||||
*
|
||||
* 是否支持当前类型
|
||||
*
|
||||
* @param msg 通道数据
|
||||
@@ -20,6 +23,6 @@ public abstract class AbstractHandleReportStagingOpenedTypeAdvanced<MSG> extends
|
||||
*/
|
||||
@Override
|
||||
public boolean doSupport(NettyProxyMsg msg) {
|
||||
return MessageTypeEnums.REPORT_CLIENT_STAGING_OPENED.getTypeByte() == msg.getType();
|
||||
return MessageTypeEnums.TCP_TYPE_HEARTBEAT.getTypeByte() == msg.getType();
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.framework.lazy.cloud.network.heartbeat.common.advanced.client;
|
||||
package org.framework.lazy.cloud.network.heartbeat.common.advanced.tcp.client;
|
||||
|
||||
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.AbstractHandleChannelTypeAdvanced;
|
||||
@@ -10,7 +10,7 @@ import org.framework.lazy.cloud.network.heartbeat.common.enums.MessageTypeEnums;
|
||||
* 客户端通道 is active
|
||||
*/
|
||||
|
||||
public abstract class AbstractHandleClientChannelActiveAdvanced<MSG> extends AbstractHandleChannelTypeAdvanced<NettyProxyMsg> implements HandleChannelTypeAdvanced {
|
||||
public abstract class AbstractHandleTcpClientChannelActiveAdvanced<MSG> extends AbstractHandleChannelTypeAdvanced<NettyProxyMsg> implements HandleChannelTypeAdvanced {
|
||||
|
||||
/**
|
||||
* 是否支持当前类型
|
||||
@@ -20,6 +20,6 @@ public abstract class AbstractHandleClientChannelActiveAdvanced<MSG> extends Abs
|
||||
*/
|
||||
@Override
|
||||
public boolean doSupport(NettyProxyMsg msg) {
|
||||
return MessageTypeEnums.CLIENT_CHANNEL_ACTIVE.getTypeByte() == msg.getType();
|
||||
return MessageTypeEnums.TCP_CLIENT_CHANNEL_ACTIVE.getTypeByte() == msg.getType();
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.framework.lazy.cloud.network.heartbeat.common.advanced.client;
|
||||
package org.framework.lazy.cloud.network.heartbeat.common.advanced.tcp.client;
|
||||
|
||||
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
|
||||
@@ -8,11 +8,11 @@ import org.framework.lazy.cloud.network.heartbeat.common.enums.MessageTypeEnums;
|
||||
|
||||
|
||||
/**
|
||||
* 下发 客户端渗透服务端通信传输
|
||||
* 下发 客户端渗透客户端init close 信息
|
||||
*
|
||||
* @see MessageTypeEnums#DISTRIBUTE_CLIENT_PERMEATE_SERVER_TRANSFER
|
||||
* @see MessageTypeEnums#TCP_DISTRIBUTE_CLIENT_PERMEATE_CLIENT_CLOSE
|
||||
*/
|
||||
public abstract class AbstractHandleDistributeClientPermeateServerTransferTypeAdvanced<MSG> extends AbstractHandleChannelTypeAdvanced<NettyProxyMsg> implements HandleChannelTypeAdvanced {
|
||||
public abstract class AbstractHandleTcpDistributeClientPermeateClientCloseTypeAdvanced<MSG> extends AbstractHandleChannelTypeAdvanced<NettyProxyMsg> implements HandleChannelTypeAdvanced {
|
||||
|
||||
|
||||
/**
|
||||
@@ -23,6 +23,6 @@ public abstract class AbstractHandleDistributeClientPermeateServerTransferTypeAd
|
||||
*/
|
||||
@Override
|
||||
public boolean doSupport(NettyProxyMsg msg) {
|
||||
return MessageTypeEnums.DISTRIBUTE_CLIENT_PERMEATE_SERVER_TRANSFER.getTypeByte() == msg.getType();
|
||||
return MessageTypeEnums.TCP_DISTRIBUTE_CLIENT_PERMEATE_CLIENT_CLOSE.getTypeByte() == msg.getType();
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.framework.lazy.cloud.network.heartbeat.common.advanced.client;
|
||||
package org.framework.lazy.cloud.network.heartbeat.common.advanced.tcp.client;
|
||||
|
||||
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
|
||||
@@ -8,11 +8,11 @@ import org.framework.lazy.cloud.network.heartbeat.common.enums.MessageTypeEnums;
|
||||
|
||||
|
||||
/**
|
||||
* 下发客户端渗透客户端数据传输
|
||||
* 下发 客户端渗透客户端init信息
|
||||
*
|
||||
* @see MessageTypeEnums#DISTRIBUTE_CLIENT_PERMEATE_CLIENT_TRANSFER_REQUEST
|
||||
* @see MessageTypeEnums#TCP_DISTRIBUTE_CLIENT_PERMEATE_CLIENT_INIT
|
||||
*/
|
||||
public abstract class AbstractHandleDistributeClientTransferClientRequestTypeAdvanced<MSG> extends AbstractHandleChannelTypeAdvanced<NettyProxyMsg> implements HandleChannelTypeAdvanced {
|
||||
public abstract class AbstractHandleTcpDistributeClientPermeateClientInitTypeAdvanced<MSG> extends AbstractHandleChannelTypeAdvanced<NettyProxyMsg> implements HandleChannelTypeAdvanced {
|
||||
|
||||
|
||||
/**
|
||||
@@ -23,6 +23,6 @@ public abstract class AbstractHandleDistributeClientTransferClientRequestTypeAdv
|
||||
*/
|
||||
@Override
|
||||
public boolean doSupport(NettyProxyMsg msg) {
|
||||
return MessageTypeEnums.DISTRIBUTE_CLIENT_PERMEATE_CLIENT_TRANSFER_REQUEST.getTypeByte() == msg.getType();
|
||||
return MessageTypeEnums.TCP_DISTRIBUTE_CLIENT_PERMEATE_CLIENT_INIT.getTypeByte() == msg.getType();
|
||||
}
|
||||
}
|
||||