2 Commits

Author SHA1 Message Date
wujiawei
6f8e6cd8a9 【fix】 2025-05-27 11:11:39 +08:00
wujiawei
cf22211114 【fix】1.3.0-JDK17 2025-05-26 15:35:19 +08:00
1080 changed files with 8958 additions and 20802 deletions

View File

@@ -7,19 +7,19 @@
#### 操作步骤拥有公网ip的服务器开发6001web、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.3.1-JDK24
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.3.0-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.3.1-JDK24
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.3.0-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.3.1-JDK24
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.3.0-JDK17-SNAPSHOT
```
#### 操作步骤:配置端口
![client_permeate_port_pool.png](client_permeate_port_pool.png)
#### 操作步骤:打开页面配置菜单看到如下界面(客户端ID你老家网络中的电脑目标客户端ID
#### 操作步骤:打开页面配置菜单看到如下界面(from客户端ID你老家网络中的电脑to客户端ID
![client_permeate_client_mapping.png](client_permeate_client_mapping.png)
#### 连接使用在你老家使用my-home这个客户端所在机器上的ip+13306 即可访问杭州机房内的数据库的服务3306

View File

@@ -2,8 +2,8 @@
#### 模块说明
| 模块 | 所属层级 | 描述 | 端口 |
|------------------------------------------------------------------|------|------------------------|----------------------------------------------------------------|
| 模块 | 所属层级 | 描述 | 端口 |
|------------------------------------------------------------------------------------|------|------------------------|----------------------------------------------------------------|
| [wu-lazy-cloud-heartbeat-common](wu-lazy-cloud-heartbeat-common) | 基础模块 | 基于Netty数据解码、编码、通道处理器声明 | 无 |
| [wu-lazy-cloud-heartbeat-server](wu-lazy-cloud-heartbeat-server) | 启动模块 | 内网穿透服务端 | http端口6001、tcp端口:7001 (默认tcp端口=http端口+1000 如6001+1000=7001) |
| [wu-lazy-cloud-heartbeat-client](wu-lazy-cloud-heartbeat-client) | 启动模块 | 内网穿透客户端 | 6004 |

Binary file not shown.

Before

Width:  |  Height:  |  Size: 542 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 528 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 547 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 553 KiB

Binary file not shown.

View File

@@ -1,33 +0,0 @@
### 使用手册
#### Mac 使用方式
##### 获取socks或者http代理服务器信息
ip127.0.0.1 port9001socks、8001http
##### 使用Wi-Fi代理
注意如下方式只能代理浏览器请求,无法代理其他应用请求
![mac_http_proxy.png](mac_http_proxy.png)
![mac_socks_proxy.png](mac_socks_proxy.png)
##### 使用第三方软件全局代理[Proxifier3.8.0.dmg](Proxifier3.8.0.dmg)
注册码
# Proxifier Mac
cracked@macked.app
8TB85-UWT64-AKK2R-XGBDY-F2UP5
# Proxifier Standard Edition
cracked@macked.app
4JB8X-9YMEZ-BD332-PPNN3-46P48
# Proxifier Portable Edition
cracked@macked.app
FXBZZ-U2FPK-G5KW9-KAANW-TLGPL
- Proxifier配置
![Proxies_Config_1.png](Proxies_Config_1.png)
- 配置socks服务器地址
![Proxies_Config_2.png](Proxies_Config_2.png)
![Proxies_Config_3.png](Proxies_Config_3.png)
- 配置代理路由
![Proxies_Config_4.png](Proxies_Config_4.png)
- 展示效果
![proxy_inner_net_ui.png](proxy_inner_net_ui.png)
#### Windows 使用方式
##### 使用Wi-Fi代理
![windows_wifi_proxy.png](windows_wifi_proxy.png)

244
README.md
View File

@@ -14,9 +14,6 @@
<a target="_blank" href="https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html">
<img src="https://img.shields.io/badge/JDK-17-green.svg" alt="jdk-17" />
</a>
<a target="_blank" href="https://www.oracle.com/java/technologies/javase/jdk24-archive-downloads.html">
<img src="https://img.shields.io/badge/JDK-24-green.svg" alt="jdk-24" />
</a>
<br />
<img src="https://img.shields.io/badge/SpringBoot-v3.x-blue">
<br />
@@ -36,7 +33,7 @@
wu-lazy-cloud-network
是一款基于([wu-framework-parent](https://gitee.com/wujiawei1207537021/wu-framework-parent)孵化出的项目内部使用Lazy
ORM操作数据库使用环境JDK24 Spring Boot 3.5.0。的网络穿透、渗透工具支持Tcp、Http、Socks
ORM操作数据库使用环境JDK17 Spring Boot 3.0.2。
主要功能:
- 服务端渗透客户端网络穿透对于没有公网IP的服务进行公网IP映射
- ![NetworkPermeateServerPermeateClient.png](NetworkPermeateServerPermeateClient.png)
@@ -46,22 +43,10 @@ ORM操作数据库使用环境JDK24 Spring Boot 3.5.0。的网络穿透、渗
- ![NetworkPermeateClientPermeateServer.png](NetworkPermeateClientPermeateServer.png)
- 客户端渗透客户端----本地端口映射到另一个局域网端口
- ![NetworkPermeateClientPermeateClient.png](NetworkPermeateClientPermeateClient.png)
- 客户端代理服务端、客户端代理客户端、服务端代理服务端、服务端代理客户端VPN----异地组网搭建代理
- ![wlcn-proxy1.0-.png](wlcn-proxy1.0-.png)
[UI](https://gitee.com/wujiawei1207537021/wu-lazy-cloud-network-server-ui)
### 内网穿透
| 模块 | 所属层级 | 描述 | 快照版本 | 发布版本 |
|--------------------------------------|------|------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| wu-lazy-cloud-heartbeat-common | 组件 | 内网穿透公共模块(声明接口、枚举、常量、适配器、解析器) | <a target="_blank" href="https://search.maven.org/search?q=wu-lazy-cloud-heartbeat-common%20wu-bionic-parent"><img src="https://img.shields.io/nexus/s/top.wu2020/wu-bionic-parent?server=https%3A%2F%2Foss.sonatype.org&style=flat&logo=log" alt="Maven" /></a> | <a target="_blank" href="https://search.maven.org/search?q=wu-lazy-cloud-heartbeat-common%20wu-lazy-cloud-heartbeat-common"><img src="https://img.shields.io/maven-central/v/top.wu2020/wu-lazy-cloud-heartbeat-common" alt="Maven" /></a> |
| wu-lazy-cloud-heartbeat-client | 组件 | 客户端(支持二次开发) | <a target="_blank" href="https://search.maven.org/search?q=wu-lazy-cloud-heartbeat-client%20wu-lazy-cloud-heartbeat-client"><img src="https://img.shields.io/nexus/s/top.wu2020/wu-lazy-cloud-heartbeat-client?server=https%3A%2F%2Foss.sonatype.org&style=flat&logo=log" alt="Maven" /></a> | <a target="_blank" href="https://search.maven.org/search?q=wu-lazy-cloud-heartbeat-client%20wu-lazy-cloud-heartbeat-client"><img src="https://img.shields.io/maven-central/v/top.wu2020/wu-lazy-cloud-heartbeat-client" alt="Maven" /></a> |
| wu-lazy-cloud-heartbeat-server | 组件 | 服务端(支持二次开发) | <a target="_blank" href="https://search.maven.org/search?q=wu-lazy-cloud-heartbeat-server%20wu-lazy-cloud-heartbeat-server"><img src="https://img.shields.io/nexus/s/top.wu2020/wu-lazy-cloud-heartbeat-server?server=https%3A%2F%2Foss.sonatype.org&style=flat&logo=log" alt="Maven" /></a> | <a target="_blank" href="https://search.maven.org/search?q=wu-lazy-cloud-heartbeat-server%20wu-lazy-cloud-heartbeat-server"><img src="https://img.shields.io/maven-central/v/top.wu2020/wu-lazy-cloud-heartbeat-server" alt="Maven" /></a> |
| wu-lazy-cloud-ui | ui | 服务端页面 | | |
| wu-lazy-cloud-heartbeat-client-start | 客户端 | 客户端 | <a target="_blank" href="https://search.maven.org/search?q=wu-lazy-cloud-heartbeat-client-start%20wu-lazy-cloud-heartbeat-client-start"><img src="https://img.shields.io/nexus/s/top.wu2020/wu-lazy-cloud-heartbeat-client-start?server=https%3A%2F%2Foss.sonatype.org&style=flat&logo=log" alt="Maven" /></a> | <a target="_blank" href="https://search.maven.org/search?q=wu-lazy-cloud-heartbeat-client-start%20wu-lazy-cloud-heartbeat-client-start"><img src="https://img.shields.io/maven-central/v/top.wu2020/wu-lazy-cloud-heartbeat-client-start" alt="Maven" /></a> |
| wu-lazy-cloud-heartbeat-server-start | 服务端 | 服务端 | <a target="_blank" href="https://search.maven.org/search?q=wu-lazy-cloud-heartbeat-server-start%20wu-lazy-cloud-heartbeat-server-start"><img src="https://img.shields.io/nexus/s/top.wu2020/wu-lazy-cloud-heartbeat-server-start?server=https%3A%2F%2Foss.sonatype.org&style=flat&logo=log" alt="Maven" /></a> | <a target="_blank" href="https://search.maven.org/search?q=wu-lazy-cloud-heartbeat-server-start%20wu-lazy-cloud-heartbeat-server-start"><img src="https://img.shields.io/maven-central/v/top.wu2020/wu-lazy-cloud-heartbeat-server-start" alt="Maven" /></a> |
#### 项目地址
[Gitee](https://gitee.com/wujiawei1207537021/wu-lazy-cloud-network)
@@ -72,6 +57,191 @@ ORM操作数据库使用环境JDK24 Spring Boot 3.5.0。的网络穿透、渗
![architecture.png](architecture.png)
#### 实现原理
##### 服务端创建socket服务端绑定本地端口用于客户端连接
```java
package org.framework.lazy.cloud.network.heartbeat.server.netty.socket;
import io.netty.bootstrap.ServerBootstrap;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelFutureListener;
import io.netty.channel.ChannelOption;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.nio.NioServerSocketChannel;
import filter.netty.org.framework.lazy.cloud.network.heartbeat.server.NettyServerFilter;
public class NettyOnCloudNettyServerSocket {
private final EventLoopGroup bossGroup = new NioEventLoopGroup();
private final EventLoopGroup workerGroup = new NioEventLoopGroup();
private final NettyServerFilter nettyServerFilter;// 通道业务处理
private ChannelFuture channelFuture;
public NettyOnCloudNettyServerSocket(NettyServerFilter nettyServerFilter) {
this.nettyServerFilter = nettyServerFilter;
}
/**
* 启动服务端
*
* @throws Exception
*/
public void startServer(int serverPort) throws Exception {
try {
ServerBootstrap b = new ServerBootstrap();
b.group(bossGroup, workerGroup).channel(NioServerSocketChannel.class)
// 给服务端channel设置属性
.option(ChannelOption.SO_BACKLOG, 128)
.childOption(ChannelOption.SO_KEEPALIVE, true)
.childHandler(nettyServerFilter)
;
channelFuture = b.bind(serverPort).sync();
channelFuture.addListener((ChannelFutureListener) channelFuture -> {
// 服务器已启动
});
channelFuture.channel().closeFuture().sync();
} finally {
shutdown();
// 服务器已关闭
}
}
public void shutdown() {
if (channelFuture != null) {
channelFuture.channel().close().syncUninterruptibly();
}
if ((bossGroup != null) && (!bossGroup.isShutdown())) {
bossGroup.shutdownGracefully();
}
if ((workerGroup != null) && (!workerGroup.isShutdown())) {
workerGroup.shutdownGracefully();
}
}
}
```
##### 客户端通过class NettyClientSocket 连接服务端
```java
package org.framework.lazy.cloud.network.heartbeat.client.netty.socket;
import io.netty.bootstrap.Bootstrap;
import io.netty.channel.Channel;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelFutureListener;
import io.netty.channel.EventLoopGroup;
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.application.ClientChangeEvent;
import filter.netty.org.framework.lazy.cloud.heartbeat.client.NettyClientFilter;
import org.framework.lazy.cloud.network.heartbeat.common.MessageType;
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
import adapter.org.framework.lazy.cloud.network.heartbeat.common.ChannelTypeAdapter;
import advanced.org.framework.lazy.cloud.network.heartbeat.common.HandleChannelTypeAdvanced;
import utils.org.framework.lazy.cloud.network.heartbeat.common.ChannelAttributeKeyUtils;
import java.util.List;
import java.util.concurrent.TimeUnit;
/**
* 客户端连接服务端
*/
@Slf4j
public class NettyClientSocket {
private static final EventLoopGroup eventLoopGroup = new NioEventLoopGroup();
/**
* 服务端host
*/
private final String inetHost;
/**
* 服务端端口
*/
private final int inetPort;
/**
* 当前客户端id
*/
@Getter
private final String clientId;
/**
* nacos配置信息处理应用
*/
@Getter
private final ClientNettyConfigApplication clientChangeEvent;
private final List<HandleChannelTypeAdvanced> handleChannelTypeAdvancedList; // 处理服务端发送过来的数据类型
public NettyClientSocket(String inetHost, int inetPort, String clientId, ClientNettyConfigApplication clientChangeEvent, List<HandleChannelTypeAdvanced> handleChannelTypeAdvancedList) {
this.inetHost = inetHost;
this.inetPort = inetPort;
this.clientId = clientId;
this.clientChangeEvent = clientChangeEvent;
this.handleChannelTypeAdvancedList = handleChannelTypeAdvancedList;
}
public void newConnect2Server() throws InterruptedException {
newConnect2Server(inetHost, inetPort, clientId, clientChangeEvent);
}
protected void newConnect2Server(String inetHost, int inetPort, String clientId, ClientNettyConfigApplication clientChangeEvent) throws InterruptedException {
Bootstrap bootstrap = new Bootstrap();
bootstrap.group(eventLoopGroup)
.channel(NioSocketChannel.class)
.handler(new NettyClientFilter(new ChannelTypeAdapter(handleChannelTypeAdvancedList), this))
;
log.info("连接服务端IP:{},连接服务端端口:{}", inetHost, inetPort);
ChannelFuture future = bootstrap.connect(inetHost, inetPort);
Channel channel = future.channel();
log.info("使用的客户端ID:" + clientId);
future.addListener((ChannelFutureListener) futureListener -> {
if (futureListener.isSuccess()) {
log.info("连接服务端成功");
// 告诉服务端这条连接是client的连接
NettyProxyMsg nettyMsg = new NettyProxyMsg();
nettyMsg.setType(MessageType.TCP_REPORT_CLIENT_CONNECT_SUCCESS);
nettyMsg.setClientId(clientId);
nettyMsg.setData((clientId).getBytes());
ChannelAttributeKeyUtils.buildClientId(channel, clientId);
channel.writeAndFlush(nettyMsg);
// 在线
clientChangeEvent.clientOnLine(clientId);
} else {
log.info("每隔2s重连....");
// 离线
clientChangeEvent.clientOffLine(clientId);
futureListener.channel().eventLoop().schedule(() -> {
try {
newConnect2Server(inetHost, inetPort, clientId, clientChangeEvent);
} catch (InterruptedException e) {
e.printStackTrace();
}
}, 2, TimeUnit.SECONDS);
}
});
}
/**
* 关闭连接
*/
public void shutdown() {
if ((eventLoopGroup != null) && (!eventLoopGroup.isShutdown())) {
eventLoopGroup.shutdownGracefully();
}
}
}
```
##### 通过客户端与服务端建立的连接进行访客端口绑定
@@ -85,27 +255,26 @@ ORM操作数据库使用环境JDK24 Spring Boot 3.5.0。的网络穿透、渗
1.内网穿透
2.服务端自主下发数据到客户端
3.流量监控
4.网络代理socks、http
### 项目结构
| 模块 | 版本 | 描述 |
|------------------------------------------------------------------------------------------------------------|----------------------|------------------------------|
| [wu-lazy-cloud-heartbeat-common](wu-lazy-cloud-heartbeat-common) | 1.3.1-JDK24 | 内网穿透公共模块(声明接口、枚举、常量、适配器、解析器) |
| [wu-lazy-cloud-heartbeat-client](wu-lazy-cloud-heartbeat-client) | 1.3.1-JDK24 | 客户端(支持二次开发) |
| [wu-lazy-cloud-heartbeat-server](wu-lazy-cloud-heartbeat-server) | 1.3.1-JDK24 | 服务端(支持二次开发) |
| [wu-lazy-cloud-heartbeat-client-start](wu-lazy-cloud-heartbeat-start/wu-lazy-cloud-heartbeat-server-start) | 1.3.1-JDK24 | 客户端样例 |
| [wu-lazy-cloud-heartbeat-server-start](wu-lazy-cloud-heartbeat-start/wu-lazy-cloud-heartbeat-client-start) | 1.3.1-JDK24 | 服务端样例 |
| [wu-lazy-cloud-heartbeat-common](wu-lazy-cloud-heartbeat-common) | 1.3.0-JDK17-SNAPSHOT | 内网穿透公共模块(声明接口、枚举、常量、适配器、解析器) |
| [wu-lazy-cloud-heartbeat-client](wu-lazy-cloud-heartbeat-client) | 1.3.0-JDK17-SNAPSHOT | 客户端(支持二次开发) |
| [wu-lazy-cloud-heartbeat-server](wu-lazy-cloud-heartbeat-server) | 1.3.0-JDK17-SNAPSHOT | 服务端(支持二次开发) |
| [wu-lazy-cloud-heartbeat-client-start](wu-lazy-cloud-heartbeat-start/wu-lazy-cloud-heartbeat-server-start) | 1.3.0-JDK17-SNAPSHOT | 客户端样例 |
| [wu-lazy-cloud-heartbeat-server-start](wu-lazy-cloud-heartbeat-start/wu-lazy-cloud-heartbeat-client-start) | 1.3.0-JDK17-SNAPSHOT | 服务端样例 |
### 使用技术
| 框架 | 版本 | 描述 |
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------|--------------|
| spring-boot | 3.0.7 | springboot框架 |
| [wu-framework-web](https://gitee.com/wujiawei1207537021/wu-framework-parent/tree/master/wu-framework-web) | 1.3.1-JDK24 | web容器 |
| [Lazy -ORM](https://gitee.com/wujiawei1207537021/wu-framework-parent/tree/master/wu-inner-intergration/wu-database-parent) | 1.3.1-JDK24 | ORM |
| [wu-framework-web](https://gitee.com/wujiawei1207537021/wu-framework-parent/tree/master/wu-framework-web) | 1.3.0-JDK17-SNAPSHOT | web容器 |
| [Lazy -ORM](https://gitee.com/wujiawei1207537021/wu-framework-parent/tree/master/wu-inner-intergration/wu-database-parent) | 1.3.0-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.3.1-JDK24 | 用户授权体系 |
| [wu-authorization-server-platform-starter](https://gitee.com/wujiawei1207537021/wu-framework-parent/tree/master/wu-smart-platform/wu-authorization-server-platform-starter) | 1.3.0-JDK17-SNAPSHOT | 用户授权体系 |
### 使用环境
@@ -114,16 +283,15 @@ ORM操作数据库使用环境JDK24 Spring Boot 3.5.0。的网络穿透、渗
JAVA >=13
MAVEN
### 启动[install.md](install.md)
### 启动
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.3.1-JDK24
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.3.0-JDK17-SNAPSHOT
http://127.0.0.1:18080/swagger-ui/index.html
源码启动
### 代理工具使用[Proxy.md](Proxy.md)
#### 页面操作
@@ -173,20 +341,4 @@ ORM操作数据库使用环境JDK24 Spring Boot 3.5.0。的网络穿透、渗
![clientPerDayFlow.png](clientPerDayFlow.png)
客户端近七天使用流量
![clientPortPerDayFlow.png](clientPortPerDayFlow.png)
## 路由
- 客户端路由管理
![client_route.png](client_route.png)
- 客户端虚拟路由管理
- 创建一个虚拟的不存在的IP代理到指定的IP
![client_virtual_route.png](client_virtual_route.png)
- 服务端路由管理
![server_route.png](server_route.png)
- 服务端虚拟路由管理
- 创建一个虚拟的不存在的IP代理到指定的IP
![server_virtual_route.png](server_virtual_route.png)
-
- 代理流量管理
![client_proxy_flow_manager.png](client_proxy_flow_manager.png)
![clientPortPerDayFlow.png](clientPortPerDayFlow.png)

View File

@@ -28,7 +28,7 @@ spec:
containers:
- name: wu-lazy-cloud-heartbeat-local-client-start
image: >-
registry.cn-hangzhou.aliyuncs.com/wu-lazy/wu-lazy-cloud-heartbeat-client-start:1.3.1-JDK24
registry.cn-hangzhou.aliyuncs.com/wu-lazy/wu-lazy-cloud-heartbeat-client-start:1.3.0-JDK17-SNAPSHOT
env:
- name: spring.lazy.netty.client.inet-host
value: 124.222.48.62

Binary file not shown.

Before

Width:  |  Height:  |  Size: 206 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 108 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 115 KiB

View File

@@ -1,28 +0,0 @@
#### docker环境安装wlcn
##### 启动服务端
- 6001端口 webui
- 7001端口 tcp连接端口
- 8001端口 http代理端口
- 9001端口 socks代理端口
- 1001端口 自定义需要代理到客户端端口
- 打开浏览器访问界面 http://127.0.0.1:6001/netty-server-ui/index.html
```shell
docker run -d -it -p 6001:6001 -p 7001:7001 -p 8001:8001 -p 9001:9001 --name wlcn-s registry.cn-hangzhou.aliyuncs.com/wu-lazy/wu-lazy-cloud-heartbeat-server:1.3.1-JDK24
```
##### 启动客户端
- 6004端口 webui
- 8001端口 http代理端口
- 9001端口 socks代理端口
- 环境变量
- spring.lazy.netty.client.inet-host 服务端IP
- spring.lazy.netty.client.inet-port 服务端tcp端口
- spring.lazy.netty.client.client-id 客户端ID
- 打开浏览器访问界面 http://127.0.0.1:6004/netty-client-local-ui/index.html
```shell
docker run -d -it --privileged -p 6004:6004 --name wlcn-c --restart=always -e spring.lazy.netty.client.inet-host=192.168.xx.xx -e spring.lazy.netty.client.inet-port=7001 -e spring.lazy.netty.client.client-id="wlcn-c" registry.cn-hangzhou.aliyuncs.com/wu-lazy/wu-lazy-cloud-heartbeat-client-start:1.3.1-JDK24
```

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

229
pom.xml
View File

@@ -8,33 +8,14 @@
<parent>
<artifactId>wu-framework-parent</artifactId>
<groupId>top.wu2020</groupId>
<version>1.3.3-JDK24</version>
<version>1.3.0-JDK17</version>
</parent>
<artifactId>wu-lazy-cloud-network</artifactId>
<packaging>pom</packaging>
<version>1.3.3-JDK24</version>
<version>1.3.0-JDK17</version>
<description>云上云下</description>
<name>wlcn项目</name>
<url>https://gitee.com/wujiawei1207537021/wu-lazy-cloud-network</url>
<!-->开发者的信息<-->
<developers>
<developer>
<name>Jia Wei Wu</name>
<email>1207537021@qq.com</email>
</developer>
</developers>
<licenses>
<license>
<name>Apache License, Version 2.0</name>
<url>https://www.apache.org/licenses/LICENSE-2.0</url>
<distribution>repo</distribution>
</license>
</licenses>
<!-->项目的版本管理地址<-->
<scm>
<url>https://gitee.com/wujiawei1207537021/wu-lazy-cloud-network</url>
</scm>
<modules>
<!-- 云上服务组件 -->
@@ -57,7 +38,7 @@
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.38</version>
<version>1.18.32</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
@@ -67,24 +48,22 @@
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct</artifactId>
<version>1.6.3</version>
<version>1.6.0.Beta1</version>
</dependency>
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
<version>1.6.3</version>
<version>1.6.0.Beta1</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<version>3.5.3</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
<version>${spring-boot-starter.version}</version>
</dependency>
</dependencies>
@@ -93,7 +72,7 @@
<dependency>
<groupId>top.wu2020</groupId>
<artifactId>wu-framework-dependencies</artifactId>
<version>1.3.3-JDK24</version>
<version>1.3.0-JDK17</version>
<type>pom</type>
<scope>import</scope>
</dependency>
@@ -101,6 +80,200 @@
</dependencyManagement>
<profiles>
<profile>
<id>oss</id>
<build>
<plugins>
<!-- Source -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.2.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- Javadoc -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<locale>en_US</locale>
<encoding>UTF-8</encoding>
<charset>UTF-8</charset>
<doclint>none</doclint>
</configuration>
</execution>
</executions>
</plugin>
<!-- GPG -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>${maven-gpg-plugin.version}</version>
<executions>
<execution>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- flatten -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>flatten-maven-plugin</artifactId>
<version>${flatten-maven-plugin.version}</version>
<configuration>
<updatePomFile>true</updatePomFile>
<flattenMode>resolveCiFriendliesOnly</flattenMode>
</configuration>
<executions>
<execution>
<id>flatten</id>
<phase>process-resources</phase>
<goals>
<goal>flatten</goal>
</goals>
</execution>
<execution>
<id>flatten.clean</id>
<phase>clean</phase>
<goals>
<goal>clean</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<!-->发布的地址<-->
<distributionManagement>
<snapshotRepository>
<id>oss-snapshots</id>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
</snapshotRepository>
<repository>
<id>oss-snapshots</id>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>
</profile>
<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>
<configuration>
<classesDirectory>${project.build.outputDirectory}</classesDirectory>
<requiredVersion>22.3</requiredVersion>
</configuration>
<executions>
<execution>
<id>native-test</id>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 71 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 122 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 119 KiB

View File

@@ -24,24 +24,10 @@
[change] 新增服务端渗透服务端----本地同局域网内端口映射
[change] 新增客户端渗透服务端----本地端口映射到另一个服务端中的局域网端口
[change] 新增客户端渗透客户端----本地端口映射到另一个局域网端口
#### 1.2.9-JDK17-SNAPSHOT
#### 1.3.0-JDK17-SNAPSHOT
[change] 添加appkey&appsecret 验证
[change] 支持同一个客户端ID多次注册
[change] 修复通道关闭导致调度线程池submit异常问题
[change] 添加记录客户端IP
[change] 1.2.9为大版本,报文中添加数据无法向下兼容,建议服务端与客户端保持版本一致
#### 1.3.1-JDK17-SNAPSHOT
[add] 新增http代理客户端代理服务端、客户端代理客户杜安、服务端代理客户端、服务端代理服务端
[add] 新增socks代理客户端代理服务端、客户端代理客户杜安、服务端代理客户端、服务端代理服务端
[add] 新增客户端路由管理、新增服务端路由管理
[add] 支持新增虚拟IP代理到指定的IP
[add] 通过页面配置,代理支持控制端口代理控制
#### 1.3.1-JDK17
[add] 新增代理流量监控
[add] docker仓库上架dockerhub搜索https://hub.docker.com/search?q=wlcn
#### 1.3.1-JDK24
[add] 新增代理流量监控
[add] 升级使用jdk24、springboot 3.5.0
[add] 添加socks授权验证
#### 下一版本计划
#### 下一版本计划https

Binary file not shown.

Before

Width:  |  Height:  |  Size: 309 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 76 KiB

View File

@@ -1,84 +0,0 @@
@startuml
title 网络代理
package "服务端" as "服务端"{
node "12.16.5.xx"{
[12.16.5.1]
[wlcn_s_a] as "wlcn服务端"
}
}
package "杭州客户端"{
node "172.16.5.xx"{
[172.16.5.1]
[wlcn_c_a] as "wlcn客户端9001"
actor Navicat_c_a as "本地Navicat"
actor App_c_a as "本地App"
actor Chrome_c_a as "本地浏览器"
[socks_proxy_a] as "杭州本地用户socks代理软件"
[socks_proxy_a]<--up--> [wlcn_c_a]:访客通过软件代理本地socks网络
[Navicat_c_a]<..up..> [socks_proxy_a]:访问服务端所在网段12.16.5.xx
[App_c_a]<..up..> [socks_proxy_a]:访问访问本地所在网段172.16.5.xx
[Chrome_c_a]<..up..> [socks_proxy_a]:访问访问另一个客户端所在网段162.16.5.xx
}
}
package "上海客户端" as "上海客户端"{
node "162.16.5.xx"{
[162.16.5.1]
[wlcn_c_b] as "wlcn客户端9001"
actor Navicat_c_b as "本地Navicat"
actor App_c_b as "本地App"
actor Chrome_c_b as "本地浏览器"
[socks_proxy_b] as "上海本地用户socks代理软件"
[socks_proxy_b]<--up--> [wlcn_c_b]:访客通过软件代理本地socks网络
[Navicat_c_b]<..up..> [socks_proxy_b]:访问服务端所在网段12.16.5.xx
[App_c_b]<..up..> [socks_proxy_b]:访问访问本地所在网段172.16.5.xx
[Chrome_c_b]<..up..> [socks_proxy_b]:访问访问另一个客户端所在网段162.16.5.xx
}
}
package "第三方局域网"{
node "152.16.5.xx"{
[152.16.5.1]
actor Navicat_c_c as "本地Navicat"
actor App_c_c as "本地App"
actor Chrome_c_c as "本地浏览器"
[socks_proxy_c] as "上海本地用户socks代理软件"
[Navicat_c_c]<..up..> [socks_proxy_c]:访问服务端所在网段12.16.5.xx
[App_c_c]<..up..> [socks_proxy_c]:访问访问上海在网段172.16.5.xx
[Chrome_c_c]<..up..> [socks_proxy_c]:访问访问杭州客户端所在网段162.16.5.xx
}
}
[wlcn_s_a] <==down==> [wlcn_c_a]: 客户端连接服务端
[wlcn_s_a] <==down==> [wlcn_c_b]: 客户端连接服务端
[wlcn_s_a]<--down--> [socks_proxy_c]:访客通过软件代理本地socks网络
@enduml

View File

@@ -10,8 +10,8 @@ mvn native:build -Pnative
### 构建docker镜像
```shell
docker build -t docker-registry.wujiawei.com/lazy/lazy-under-cloud-heartbeat-client:lazy-2.4.2-NATIVE-SNAPSHOT_latest -f Native-Dockerfile .
docker push docker-registry.wujiawei.com/lazy/lazy-under-cloud-heartbeat-client:lazy-2.4.2-NATIVE-SNAPSHOT_latest
docker build -t docker-registry.wujiawei.com/lazy/lazy-under-cloud-heartbeat-client:lazy-2.4.2-native-SNAPSHOT_latest -f Native-Dockerfile .
docker push docker-registry.wujiawei.com/lazy/lazy-under-cloud-heartbeat-client:lazy-2.4.2-native-SNAPSHOT_latest
```
## BUILD IMAGE

View File

@@ -5,36 +5,16 @@
<parent>
<groupId>top.wu2020</groupId>
<artifactId>wu-lazy-cloud-network</artifactId>
<version>1.3.3-JDK24</version>
<version>1.3.0-JDK17</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>wu-lazy-cloud-heartbeat-client</artifactId>
<description>云下心跳客户端</description>
<name>wlcn客户端模块</name>
<url>https://gitee.com/wujiawei1207537021/wu-lazy-cloud-network</url>
<!-->开发者的信息<-->
<developers>
<developer>
<name>Jia Wei Wu</name>
<email>1207537021@qq.com</email>
</developer>
</developers>
<licenses>
<license>
<name>Apache License, Version 2.0</name>
<url>https://www.apache.org/licenses/LICENSE-2.0</url>
<distribution>repo</distribution>
</license>
</licenses>
<!-->项目的版本管理地址<-->
<scm>
<url>https://gitee.com/wujiawei1207537021/wu-lazy-cloud-network</url>
</scm>
<properties>
<maven.compiler.source>24</maven.compiler.source>
<maven.compiler.target>24</maven.compiler.target>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
</properties>
<dependencies>
@@ -42,34 +22,30 @@
<dependency>
<groupId>top.wu2020</groupId>
<artifactId>wu-lazy-cloud-heartbeat-common</artifactId>
<version>${wu-lazy-cloud-heartbeat-common.version}</version>
</dependency>
<dependency>
<groupId>top.wu2020</groupId>
<artifactId>wu-lazy-cloud-heartbeat-protocol-proxy</artifactId>
<version>${wu-lazy-cloud-heartbeat-protocol-proxy.version}</version>
<version>1.3.0-JDK17</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>2.0.50</version>
</dependency>
<dependency>
<groupId>top.wu2020</groupId>
<artifactId>wu-framework-web-spring-starter</artifactId>
</dependency>
<!-- h2数据库驱动 -->
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>2.3.232</version>
</dependency>
<dependency>
<groupId>top.wu2020</groupId>
<artifactId>wu-framework-web-spring-starter</artifactId>
<version>${wu-framework-web-spring-starter.version}</version>
</dependency>
<dependency>
<groupId>top.wu2020</groupId>
<artifactId>wu-database-lazy-orm-plus-starter</artifactId>
<version>${wu-database-lazy-orm-plus-starter.version}</version>
<artifactId>wu-database-lazy-plus-starter</artifactId>
</dependency>
</dependencies>

View File

@@ -7,86 +7,87 @@ import org.framework.lazy.cloud.network.heartbeat.client.application.command.laz
import org.framework.lazy.cloud.network.heartbeat.client.application.command.lazy.netty.server.properties.LazyNettyServerPropertiesQueryListCommand;
import org.framework.lazy.cloud.network.heartbeat.client.application.command.lazy.netty.server.properties.LazyNettyServerPropertiesQueryOneCommand;
import org.framework.lazy.cloud.network.heartbeat.client.application.dto.LazyNettyServerPropertiesDTO;
import org.wu.framework.core.mapper.LazyStructMappers;
import org.wu.framework.core.mapper.LazyStructMapper;
import org.mapstruct.factory.Mappers;
import org.mapstruct.Mapper;
/**
* describe 服务端配置信息
* describe 服务端配置信息
*
* @author Jia wei Wu
* @date 2024/04/03 03:00 下午
* @see org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyAssembler
* @see org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyAssembler
**/
@LazyStructMapper
@Mapper
public interface LazyNettyServerPropertiesDTOAssembler {
/**
* describe MapStruct 创建的代理对象
*
* @author Jia wei Wu
* @date 2024/04/03 03:00 下午
**/
LazyNettyServerPropertiesDTOAssembler INSTANCE = LazyStructMappers.getMapper(LazyNettyServerPropertiesDTOAssembler.class);
// LazyNettyServerPropertiesDTOAssembler INSTANCE = new LazyNettyServerPropertiesDTOAssemblerImpl();
LazyNettyServerPropertiesDTOAssembler INSTANCE = Mappers.getMapper(LazyNettyServerPropertiesDTOAssembler.class);
/**
* describe 应用层存储入参转换成 领域对象
*
* @param lazyNettyServerPropertiesStoryCommand 保存服务端配置信息对象
* @param lazyNettyServerPropertiesStoryCommand 保存服务端配置信息对象
* @return {@link LazyNettyServerProperties} 服务端配置信息领域对象
* @author Jia wei Wu
* @date 2024/04/03 03:00 下午
**/
LazyNettyServerProperties toLazyNettyServerProperties(LazyNettyServerPropertiesStoryCommand lazyNettyServerPropertiesStoryCommand);
LazyNettyServerProperties toLazyNettyServerProperties(LazyNettyServerPropertiesStoryCommand lazyNettyServerPropertiesStoryCommand);
/**
* describe 应用层更新入参转换成 领域对象
*
* @param lazyNettyServerPropertiesUpdateCommand 更新服务端配置信息对象
* @return {@link LazyNettyServerProperties} 服务端配置信息领域对象
* @param lazyNettyServerPropertiesUpdateCommand 更新服务端配置信息对象
* @return {@link LazyNettyServerProperties} 服务端配置信息领域对象
* @author Jia wei Wu
* @date 2024/04/03 03:00 下午
**/
LazyNettyServerProperties toLazyNettyServerProperties(LazyNettyServerPropertiesUpdateCommand lazyNettyServerPropertiesUpdateCommand);
LazyNettyServerProperties toLazyNettyServerProperties(LazyNettyServerPropertiesUpdateCommand lazyNettyServerPropertiesUpdateCommand);
/**
* describe 应用层查询入参转换成 领域对象
*
* @param lazyNettyServerPropertiesQueryOneCommand 查询单个服务端配置信息对象参数
* @return {@link LazyNettyServerProperties} 服务端配置信息领域对象
* @param lazyNettyServerPropertiesQueryOneCommand 查询单个服务端配置信息对象参数
* @return {@link LazyNettyServerProperties} 服务端配置信息领域对象
* @author Jia wei Wu
* @date 2024/04/03 03:00 下午
**/
LazyNettyServerProperties toLazyNettyServerProperties(LazyNettyServerPropertiesQueryOneCommand lazyNettyServerPropertiesQueryOneCommand);
LazyNettyServerProperties toLazyNettyServerProperties(LazyNettyServerPropertiesQueryOneCommand lazyNettyServerPropertiesQueryOneCommand);
/**
* describe 应用层查询入参转换成 领域对象
*
* @param lazyNettyServerPropertiesQueryListCommand 查询集合服务端配置信息对象参数
* @return {@link LazyNettyServerProperties} 服务端配置信息领域对象
* @param lazyNettyServerPropertiesQueryListCommand 查询集合服务端配置信息对象参数
* @return {@link LazyNettyServerProperties} 服务端配置信息领域对象
* @author Jia wei Wu
* @date 2024/04/03 03:00 下午
**/
LazyNettyServerProperties toLazyNettyServerProperties(LazyNettyServerPropertiesQueryListCommand lazyNettyServerPropertiesQueryListCommand);
LazyNettyServerProperties toLazyNettyServerProperties(LazyNettyServerPropertiesQueryListCommand lazyNettyServerPropertiesQueryListCommand);
/**
* describe 应用层删除入参转换成 领域对象
*
* @param lazyNettyServerPropertiesRemoveCommand 删除服务端配置信息对象参数
* @return {@link LazyNettyServerProperties} 服务端配置信息领域对象
* @param lazyNettyServerPropertiesRemoveCommand 删除服务端配置信息对象参数
* @return {@link LazyNettyServerProperties} 服务端配置信息领域对象
* @author Jia wei Wu
* @date 2024/04/03 03:00 下午
**/
LazyNettyServerProperties toLazyNettyServerProperties(LazyNettyServerPropertiesRemoveCommand lazyNettyServerPropertiesRemoveCommand);
LazyNettyServerProperties toLazyNettyServerProperties(LazyNettyServerPropertiesRemoveCommand lazyNettyServerPropertiesRemoveCommand);
/**
* describe 持久层领域对象转换成DTO对象
*
* @param lazyNettyServerProperties 服务端配置信息领域对象
* @return {@link LazyNettyServerPropertiesDTO} 服务端配置信息DTO对象
* @param lazyNettyServerProperties 服务端配置信息领域对象
* @return {@link LazyNettyServerPropertiesDTO} 服务端配置信息DTO对象
* @author Jia wei Wu
* @date 2024/04/03 03:00 下午
**/
LazyNettyServerPropertiesDTO fromLazyNettyServerProperties(LazyNettyServerProperties lazyNettyServerProperties);
LazyNettyServerPropertiesDTO fromLazyNettyServerProperties(LazyNettyServerProperties lazyNettyServerProperties);
}

View File

@@ -1,12 +1,14 @@
package org.framework.lazy.cloud.network.heartbeat.client.application.command.lazy.netty.server.properties;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.experimental.Accessors;
import org.framework.lazy.cloud.network.heartbeat.client.config.PropertiesType;
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 java.lang.String;
import java.time.LocalDateTime;
import java.lang.Integer;
/**
* describe 服务端配置信息
*
@@ -19,6 +21,7 @@ import java.time.LocalDateTime;
@Schema(title = "lazy_netty_server_properties_query_List_command",description = "服务端配置信息")
public class LazyNettyServerPropertiesQueryListCommand {
/**
*
* 客户身份ID

View File

@@ -5,7 +5,6 @@ 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.core.NormalUsedString;
import java.lang.String;
import java.time.LocalDateTime;
@@ -23,7 +22,6 @@ import java.lang.Integer;
public class LazyNettyServerPropertiesQueryOneCommand {
/**
*
* 客户身份ID

View File

@@ -5,7 +5,6 @@ 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.core.NormalUsedString;
import java.lang.String;
import java.time.LocalDateTime;
@@ -23,7 +22,6 @@ import java.lang.Integer;
public class LazyNettyServerPropertiesRemoveCommand {
/**
*
* 客户身份ID

View File

@@ -5,7 +5,6 @@ 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.core.NormalUsedString;
import java.lang.String;
import java.time.LocalDateTime;
@@ -23,7 +22,6 @@ import java.lang.Integer;
public class LazyNettyServerPropertiesStoryCommand {
/**
*
* 客户身份ID

View File

@@ -5,7 +5,6 @@ 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.core.NormalUsedString;
import java.lang.String;
import java.time.LocalDateTime;
@@ -23,7 +22,6 @@ import java.lang.Integer;
public class LazyNettyServerPropertiesUpdateCommand {
/**
*
* 客户身份ID

View File

@@ -1,12 +1,14 @@
package org.framework.lazy.cloud.network.heartbeat.client.application.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.experimental.Accessors;
import org.framework.lazy.cloud.network.heartbeat.client.config.PropertiesType;
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 java.lang.String;
import java.time.LocalDateTime;
import java.lang.Integer;
/**
* describe 服务端配置信息
*
@@ -20,7 +22,6 @@ import java.time.LocalDateTime;
public class LazyNettyServerPropertiesDTO {
/**
*
* 客户身份ID

View File

@@ -17,8 +17,9 @@ import org.framework.lazy.cloud.network.heartbeat.client.netty.permeate.udp.sock
import org.framework.lazy.cloud.network.heartbeat.common.advanced.HandleChannelTypeAdvanced;
import org.framework.lazy.cloud.network.heartbeat.common.enums.NettyClientStatus;
import org.framework.lazy.cloud.network.heartbeat.common.enums.ProtocolType;
import org.wu.framework.core.NormalUsedString;
import org.wu.framework.database.lazy.web.plus.stereotype.LazyApplication;
import org.wu.framework.lazy.orm.database.lambda.domain.LazyPage;
import org.wu.framework.lazy.orm.web.plus.stereotype.LazyApplication;
import org.wu.framework.web.response.Result;
import java.util.List;
@@ -141,7 +142,7 @@ public class LazyNettyServerPropertiesApplicationImpl implements LazyNettyServer
@Override
public Result<List<LazyNettyServerPropertiesDTO>> findList(LazyNettyServerPropertiesQueryListCommand lazyNettyServerPropertiesQueryListCommand) {
LazyNettyServerProperties lazyNettyServerProperties = LazyNettyServerPropertiesDTOAssembler.INSTANCE.toLazyNettyServerProperties(lazyNettyServerPropertiesQueryListCommand);
return lazyNettyServerPropertiesRepository.findList(lazyNettyServerProperties).convert(lazyNettyServerPropertiesList -> lazyNettyServerPropertiesList.stream().map(LazyNettyServerPropertiesDTOAssembler.INSTANCE::fromLazyNettyServerProperties).collect(Collectors.toList()));
return lazyNettyServerPropertiesRepository.findList(lazyNettyServerProperties).convert(lazyNettyServerPropertiess -> lazyNettyServerPropertiess.stream().map(LazyNettyServerPropertiesDTOAssembler.INSTANCE::fromLazyNettyServerProperties).collect(Collectors.toList()));
}
/**
@@ -195,12 +196,12 @@ public class LazyNettyServerPropertiesApplicationImpl implements LazyNettyServer
if (ProtocolType.TCP.equals(protocolType)) {
nettyClientSocket = new
NettyTcpClientSocket(inetHost, inetPort, clientId,
appKey, appSecret,
NormalUsedString.DEFAULT, appKey, appSecret,
clientChangeEvent, handleChannelTypeAdvancedList);
} else if (ProtocolType.UDP.equals(protocolType)) {
nettyClientSocket = new
NettyUdpClientSocket(inetHost, inetPort, clientId,
appKey, appSecret,
NormalUsedString.DEFAULT, appKey, appSecret,
clientChangeEvent, handleChannelTypeAdvancedList);
} else {
nettyClientSocket = null;

View File

@@ -6,7 +6,6 @@ import org.framework.lazy.cloud.network.heartbeat.client.netty.permeate.event.Cl
import org.framework.lazy.cloud.network.heartbeat.client.netty.permeate.tcp.advanced.*;
import org.framework.lazy.cloud.network.heartbeat.client.netty.permeate.udp.advanced.*;
import org.framework.lazy.cloud.network.heartbeat.client.netty.proxy.http.advanced.*;
import org.framework.lazy.cloud.network.heartbeat.client.netty.proxy.socks.advanced.*;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
@@ -352,20 +351,12 @@ public class ClientAutoConfiguration {
public ClientHandleDistributeHttpClientProxyServerServerRouteTypeAdvanced clientHandleDistributeHttpClientProxyServerServerRouteTypeAdvanced() {
return new ClientHandleDistributeHttpClientProxyServerServerRouteTypeAdvanced();
}
@Bean
public ClientHandleDistributeHttpClientProxyServerServerRouteCloseTypeAdvanced clientHandleDistributeHttpClientProxyServerServerRouteCloseTypeAdvanced(){
return new ClientHandleDistributeHttpClientProxyServerServerRouteCloseTypeAdvanced();
}
@Bean
public ClientHandleDistributeHttpClientProxyServerClientRouteTypeAdvanced clientHandleDistributeHttpClientProxyServerClientRouteTypeAdvanced() {
return new ClientHandleDistributeHttpClientProxyServerClientRouteTypeAdvanced();
}
@Bean
public ClientHandleDistributeHttpClientProxyServerClientRouteCloseTypeAdvanced clientHandleDistributeHttpClientProxyServerClientRouteCloseTypeAdvanced(){
return new ClientHandleDistributeHttpClientProxyServerClientRouteCloseTypeAdvanced();
}
@Bean
public ClientHandleDistributeHttpClientProxyClientConnectionTransferSuccessfulAdvanced clientHandleDistributeHttpClientProxyClientConnectionTransferSuccessfulAdvanced() {
return new ClientHandleDistributeHttpClientProxyClientConnectionTransferSuccessfulAdvanced();
@@ -392,68 +383,4 @@ public class ClientAutoConfiguration {
return new ClientHandleDistributeHttpServerProxyClientTransferRequestAdvanced();
}
}
@Configuration
static class SocksProxyConfiguration {
@Bean
public ClientHandleNettySocketProtocolHandleSocketClientProxyServerStartTypeAdvanced nettySocketProtocolHandleSocketClientProxyServerTypeAdvanced() {
return new ClientHandleNettySocketProtocolHandleSocketClientProxyServerStartTypeAdvanced();
}
@Bean
public ClientHandleDistributeSocksClientProxyServerConnectionTransferSuccessfulAdvanced clientHandleDistributeSocksClientProxyServerConnectionTransferSuccessfulAdvanced() {
return new ClientHandleDistributeSocksClientProxyServerConnectionTransferSuccessfulAdvanced();
}
@Bean
public ClientHandleDistributeSocksClientProxyServerConnectionTransferFailAdvanced clientHandleDistributeSocksClientProxyServerConnectionTransferFailAdvanced() {
return new ClientHandleDistributeSocksClientProxyServerConnectionTransferFailAdvanced();
}
@Bean
public ClientHandleDistributeSocksClientProxyServerTransferTransferResponseAdvanced clientHandleDistributeSocksClientProxyServerTransferTransferResponseAdvanced() {
return new ClientHandleDistributeSocksClientProxyServerTransferTransferResponseAdvanced();
}
@Bean
public ClientHandleDistributeSocksClientProxyServerTransferCloseAdvanced clientHandleDistributeSocksClientProxyServerTransferCloseAdvanced() {
return new ClientHandleDistributeSocksClientProxyServerTransferCloseAdvanced();
}
@Bean
public ClientHandleDistributeSocksClientProxyClientConnectionTransferFailAdvanced clientHandleDistributeSocksClientProxyClientConnectionTransferFailAdvanced(){
return new ClientHandleDistributeSocksClientProxyClientConnectionTransferFailAdvanced();
}
@Bean
public ClientHandleDistributeSocksClientProxyClientConnectionTransferSuccessfulAdvanced clientHandleDistributeSocksClientProxyClientConnectionTransferSuccessfulAdvanced(){
return new ClientHandleDistributeSocksClientProxyClientConnectionTransferSuccessfulAdvanced();
}
@Bean
public ClientHandleDistributeSocksClientProxyClientTransferCloseAdvanced clientHandleDistributeSocksClientProxyClientTransferCloseAdvanced(){
return new ClientHandleDistributeSocksClientProxyClientTransferCloseAdvanced();
}
@Bean
public ClientHandleDistributeSocksClientProxyClientTransferTransferResponseAdvanced clientHandleDistributeSocksClientProxyClientTransferTransferResponseAdvanced(){
return new ClientHandleDistributeSocksClientProxyClientTransferTransferResponseAdvanced();
}
@Bean
public ClientHandleDistributeSocksClientProxyClientOtherConnectionTransferAdvanced clientHandleDistributeSocksClientProxyClientOtherConnectionTransferAdvanced1(){
return new ClientHandleDistributeSocksClientProxyClientOtherConnectionTransferAdvanced();
}
@Bean
public ClientHandleDistributeSocksClientProxyClientTransferTransferRequestAdvanced clientHandleDistributeSocksClientProxyClientTransferTransferRequestAdvanced(){
return new ClientHandleDistributeSocksClientProxyClientTransferTransferRequestAdvanced();
}
@Bean
public ClientHandleSocksDistributeServerProxyClientConnectionInitTypeAdvanced clientHandleSocksDistributeServerProxyClientConnectionInitTypeAdvanced(){
return new ClientHandleSocksDistributeServerProxyClientConnectionInitTypeAdvanced();
}
@Bean
public ClientHandleSocksDistributeServerProxyClientRequestTypeAdvanced clientHandleSocksDistributeServerProxyClientRequestTypeAdvanced(){
return new ClientHandleSocksDistributeServerProxyClientRequestTypeAdvanced();
}
@Bean
public ClientHandleSocksDistributeServerProxyClientTransferCloseAdvanced clientHandleSocksDistributeServerProxyClientTransferCloseAdvanced(){
return new ClientHandleSocksDistributeServerProxyClientTransferCloseAdvanced();
}
}
}

View File

@@ -4,7 +4,6 @@ import lombok.Data;
import org.framework.lazy.cloud.network.heartbeat.common.enums.ProtocolType;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.wu.framework.core.NormalUsedString;
/**
* netty 客户服务端地址配置属性
@@ -14,7 +13,6 @@ import org.wu.framework.core.NormalUsedString;
@Data
public class NettyClientProperties {
public static final String PREFIX = "spring.lazy.netty.client";
/**
* 服务端地址 如127.0.0.1
*/

View File

@@ -7,8 +7,6 @@ import org.framework.lazy.cloud.network.heartbeat.client.config.NettyClientPrope
import org.framework.lazy.cloud.network.heartbeat.client.config.PropertiesType;
import org.framework.lazy.cloud.network.heartbeat.client.infrastructure.entity.LazyNettyServerPropertiesDO;
import org.framework.lazy.cloud.network.heartbeat.common.enums.ProtocolType;
import org.framework.lazy.cloud.network.heartbeat.protocol.token.AuthenticationToken;
import org.framework.lazy.cloud.network.heartbeat.protocol.token.AuthenticationTokenContext;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.boot.context.event.ApplicationStartedEvent;
import org.springframework.context.ApplicationListener;
@@ -28,9 +26,7 @@ public class NettyClientSocketApplicationListener implements ApplicationListener
private final LazyNettyServerPropertiesApplication lazyNettyServerPropertiesApplication;
public NettyClientSocketApplicationListener(NettyClientProperties nettyClientProperties,
LazyLambdaStream lazyLambdaStream,
LazyNettyServerPropertiesApplication lazyNettyServerPropertiesApplication) {
public NettyClientSocketApplicationListener(NettyClientProperties nettyClientProperties, LazyLambdaStream lazyLambdaStream, LazyNettyServerPropertiesApplication lazyNettyServerPropertiesApplication) {
this.nettyClientProperties = nettyClientProperties;
this.lazyLambdaStream = lazyLambdaStream;
this.lazyNettyServerPropertiesApplication = lazyNettyServerPropertiesApplication;
@@ -53,9 +49,7 @@ public class NettyClientSocketApplicationListener implements ApplicationListener
log.warn("配置信息为空,请通过页面添加配置信息:{}", nettyClientProperties);
return;
}
LazyNettyServerPropertiesDO lazyNettyServerPropertiesDO = new LazyNettyServerPropertiesDO();
lazyNettyServerPropertiesDO.setClientId(clientId);
lazyNettyServerPropertiesDO.setInetHost(inetHost);
lazyNettyServerPropertiesDO.setInetPort(inetPort);
@@ -76,12 +70,6 @@ public class NettyClientSocketApplicationListener implements ApplicationListener
if (!exists) {
lazyLambdaStream.insert(lazyNettyServerPropertiesDO);
}
// 添加本地token
AuthenticationToken authenticationToken = new AuthenticationToken();
authenticationToken.setUsedByClientId(clientId);
authenticationToken.setAppKey(appKey);
authenticationToken.setAppSecret(appSecret);
AuthenticationTokenContext.setAuthenticationToken(clientId, appKey, appSecret);
}catch (Exception e){
e.printStackTrace();
}

View File

@@ -6,7 +6,6 @@ import lombok.experimental.Accessors;
import org.framework.lazy.cloud.network.heartbeat.client.config.PropertiesType;
import org.framework.lazy.cloud.network.heartbeat.common.enums.NettyClientStatus;
import org.framework.lazy.cloud.network.heartbeat.common.enums.ProtocolType;
import org.wu.framework.core.NormalUsedString;
import java.time.LocalDateTime;
/**
@@ -22,7 +21,6 @@ import java.time.LocalDateTime;
public class LazyNettyServerProperties {
/**
*
* 客户身份ID

View File

@@ -2,46 +2,47 @@ package org.framework.lazy.cloud.network.heartbeat.client.infrastructure.convert
import org.framework.lazy.cloud.network.heartbeat.client.domain.model.lazy.netty.server.properties.LazyNettyServerProperties;
import org.framework.lazy.cloud.network.heartbeat.client.infrastructure.entity.LazyNettyServerPropertiesDO;
import org.wu.framework.core.mapper.LazyStructMapper;
import org.wu.framework.core.mapper.LazyStructMappers;
import org.mapstruct.factory.Mappers;
import org.mapstruct.Mapper;
/**
* describe 服务端配置信息
* describe 服务端配置信息
*
* @author Jia wei Wu
* @date 2024/04/03 03:00 下午
* @see org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyInfrastructureConverter
* @see org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyInfrastructureConverter
**/
@LazyStructMapper
@Mapper
public interface LazyNettyServerPropertiesConverter {
/**
* describe MapStruct 创建的代理对象
*
* @author Jia wei Wu
* @date 2024/04/03 03:00 下午
**/
LazyNettyServerPropertiesConverter INSTANCE = LazyStructMappers.getMapper(LazyNettyServerPropertiesConverter.class);
// LazyNettyServerPropertiesConverter INSTANCE = new LazyNettyServerPropertiesConverterImpl();
LazyNettyServerPropertiesConverter INSTANCE = Mappers.getMapper(LazyNettyServerPropertiesConverter.class);
/**
* describe 实体对象 转换成领域对象
*
* @param lazyNettyServerPropertiesDO 服务端配置信息实体对象
* @param lazyNettyServerPropertiesDO 服务端配置信息实体对象
* @return {@link LazyNettyServerProperties} 服务端配置信息领域对象
* @author Jia wei Wu
* @date 2024/04/03 03:00 下午
**/
LazyNettyServerProperties toLazyNettyServerProperties(LazyNettyServerPropertiesDO lazyNettyServerPropertiesDO);
/**
* describe 领域对象 转换成实体对象
*
* @param lazyNettyServerProperties 服务端配置信息领域对象
* @return {@link LazyNettyServerPropertiesDO} 服务端配置信息实体对象
* @param lazyNettyServerProperties 服务端配置信息领域对象
* @return {@link LazyNettyServerPropertiesDO} 服务端配置信息实体对象
* @author Jia wei Wu
* @date 2024/04/03 03:00 下午
**/
LazyNettyServerPropertiesDO fromLazyNettyServerProperties(LazyNettyServerProperties lazyNettyServerProperties);
LazyNettyServerPropertiesDO fromLazyNettyServerProperties(LazyNettyServerProperties lazyNettyServerProperties);
}

View File

@@ -6,7 +6,6 @@ import lombok.experimental.Accessors;
import org.framework.lazy.cloud.network.heartbeat.client.config.PropertiesType;
import org.framework.lazy.cloud.network.heartbeat.common.enums.NettyClientStatus;
import org.framework.lazy.cloud.network.heartbeat.common.enums.ProtocolType;
import org.wu.framework.core.NormalUsedString;
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.LazyTableFieldId;
@@ -27,7 +26,6 @@ import java.time.LocalDateTime;
public class LazyNettyServerPropertiesDO {
/**
*
* 主键ID
@@ -40,7 +38,7 @@ public class LazyNettyServerPropertiesDO {
* 客户身份ID
*/
@Schema(description ="客户身份ID",name ="clientId",example = "")
@LazyTableFieldUnique(name="client_id",comment="客户身份ID",columnType="varchar(25)")
@LazyTableFieldUnique(name="client_id",comment="客户身份ID",columnType="varchar(255)")
private String clientId;
/**

View File

@@ -1,19 +1,22 @@
package org.framework.lazy.cloud.network.heartbeat.client.infrastructure.persistence;
import jakarta.annotation.Resource;
import org.framework.lazy.cloud.network.heartbeat.client.domain.model.lazy.netty.server.properties.LazyNettyServerProperties;
import org.framework.lazy.cloud.network.heartbeat.client.domain.model.lazy.netty.server.properties.LazyNettyServerPropertiesRepository;
import org.framework.lazy.cloud.network.heartbeat.client.infrastructure.converter.LazyNettyServerPropertiesConverter;
import org.framework.lazy.cloud.network.heartbeat.client.infrastructure.entity.LazyNettyServerPropertiesDO;
import org.framework.lazy.cloud.network.heartbeat.client.infrastructure.converter.LazyNettyServerPropertiesConverter;
import org.springframework.stereotype.Repository;
import org.wu.framework.lazy.orm.database.lambda.domain.LazyPage;
import org.wu.framework.lazy.orm.database.lambda.stream.lambda.LazyLambdaStream;
import java.util.stream.Collectors;
import org.wu.framework.lazy.orm.database.lambda.stream.wrapper.LazyWrappers;
import org.wu.framework.web.response.Result;
import org.wu.framework.web.response.ResultFactory;
import jakarta.annotation.Resource;
import org.wu.framework.lazy.orm.database.lambda.stream.lambda.LazyLambdaStream;
import java.util.List;
import java.util.stream.Collectors;
import org.wu.framework.lazy.orm.database.lambda.domain.LazyPage;
/**
* describe 服务端配置信息

View File

@@ -13,15 +13,14 @@ import java.util.List;
@Data
public class NettyClientPermeateClientVisitor implements InternalNetworkPermeate {
/**
* 当前客户端ID
*/
private String originClientId;
private String fromClientId;
/**
* 目标客户端ID
*/
private String targetClientId;
private String toClientId;
/**
* 目标地址
*/

View File

@@ -13,12 +13,12 @@ public interface ClientChangeEvent {
/**
* 推送客户端在线
*
* @param inetHost 服务端ip
* @param inetPort 服务端端口
* @param clientId 客户端
* @param clientId 客户端
* @param inetHost 服务端ip
* @param inetPort 服务端端口
* @param serverId 服务端ID
*/
void clientOnLine(String inetHost, int inetPort,String clientId);
void clientOnLine(String inetHost, int inetPort,String serverId ,String clientId);
/**
* 推送客户端离线
@@ -30,9 +30,10 @@ public interface ClientChangeEvent {
*
* @param inetHost 服务端ip
* @param inetPort 服务端端口
* @param serverId 服务端ID
* @param clientId 客户端
*/
void clientOffLine(String inetHost, int inetPort,String clientId);
void clientOffLine(String inetHost, int inetPort,String serverId,String clientId);
/**
* 暂存开启

View File

@@ -51,10 +51,11 @@ public class DefaultClientChangeEventImpl implements ClientChangeEvent {
*
* @param inetHost 服务端ip
* @param inetPort 服务端端口
* @param serverId 服务端ID
* @param clientId 客户端
*/
@Override
public void clientOnLine(String inetHost, int inetPort, String clientId) {
public void clientOnLine(String inetHost, int inetPort, String serverId, String clientId) {
LazyNettyServerProperties lazyNettyServerProperties = new LazyNettyServerProperties();
lazyNettyServerProperties.setClientId(clientId);
lazyNettyServerProperties.setInetHost(inetHost);
@@ -91,10 +92,11 @@ public class DefaultClientChangeEventImpl implements ClientChangeEvent {
*
* @param inetHost 服务端ip
* @param inetPort 服务端端口
* @param serverId
* @param clientId 客户端
*/
@Override
public void clientOffLine(String inetHost, int inetPort, String clientId) {
public void clientOffLine(String inetHost, int inetPort, String serverId, String clientId) {
LazyNettyServerProperties lazyNettyServerProperties = new LazyNettyServerProperties();
lazyNettyServerProperties.setClientId(clientId);
lazyNettyServerProperties.setInetHost(inetHost);

View File

@@ -1,32 +1,29 @@
package org.framework.lazy.cloud.network.heartbeat.client.netty.permeate.tcp.advanced;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyChannelContext;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.permeate.tcp.AbstractTcpHandleChannelHeartbeatTypeAdvanced;
import io.netty.channel.Channel;
import org.framework.lazy.cloud.network.heartbeat.common.constant.TcpMessageType;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.Role;
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.permeate.tcp.AbstractTcpHandleChannelHeartbeatTypeAdvanced;
/**
* 服务端 处理客户端心跳
* TCP_TYPE_HEARTBEAT
*/
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public class ClientHandleTcpChannelHeartbeatTypeAdvanced extends AbstractTcpHandleChannelHeartbeatTypeAdvanced<NettyProxyMsg> {
/**
* 处理当前数据
*
* @param nettyChannelContext 当前通道
* @param channel 当前通道
* @param msg 通道数据
*/
@Override
public void doHandler(NettyChannelContext nettyChannelContext, NettyProxyMsg msg) {
public void doHandler(Channel channel, NettyProxyMsg msg) {
NettyProxyMsg hb = new NettyProxyMsg();
hb.setType(TcpMessageType.TCP_TYPE_HEARTBEAT);
// nettyChannelContext.writeAndFlush(hb);
// channel.writeAndFlush(hb);
}
}

View File

@@ -5,13 +5,10 @@ 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.advanced.payload.NettyChannelContext;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.permeate.tcp.client.AbstractHandleTcpDistributeServicePermeateClientTransferTypeAdvanced;
import org.framework.lazy.cloud.network.heartbeat.common.enums.TcpMessageTypeEnums;
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.Role;
/**
@@ -19,7 +16,6 @@ import org.springframework.context.annotation.Role;
*
* @see TcpMessageTypeEnums#TCP_DISTRIBUTE_CLIENT_TRANSFER
*/
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
@Slf4j
public class ClientHandleTcpChannelTransferTypeAdvancedHandleDistributeTcpDistribute extends AbstractHandleTcpDistributeServicePermeateClientTransferTypeAdvanced<NettyProxyMsg> {
@@ -32,17 +28,16 @@ public class ClientHandleTcpChannelTransferTypeAdvancedHandleDistributeTcpDistri
/**
* 处理当前数据
*
* @param nettyChannelContext 当前通道
* @param channel 当前通道
* @param nettyProxyMsg 通道数据
*/
@Override
public void doHandler(NettyChannelContext nettyChannelContext, NettyProxyMsg nettyProxyMsg) {
Channel channel = nettyChannelContext.channel();
public void doHandler(Channel channel, NettyProxyMsg nettyProxyMsg) {
log.debug("接收到服务端需要内网穿透的数据:{}" , nettyProxyMsg);
String clientId = nettyClientProperties.getClientId();
byte[] visitorPort = nettyProxyMsg.getVisitorPort();
byte[] clientTargetIp = nettyProxyMsg.getTargetIp();
byte[] clientTargetPort = nettyProxyMsg.getTargetPort();
byte[] clientTargetIp = nettyProxyMsg.getClientTargetIp();
byte[] clientTargetPort = nettyProxyMsg.getClientTargetPort();
byte[] visitorId = nettyProxyMsg.getVisitorId();
// 真实服务通道
// Channel realChannel = NettyRealIdContext.getReal(new String(visitorId));

View File

@@ -3,17 +3,13 @@ package org.framework.lazy.cloud.network.heartbeat.client.netty.permeate.tcp.adv
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.advanced.payload.NettyChannelContext;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.permeate.tcp.client.AbstractHandleTcpClientChannelActiveAdvanced;
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.Role;
/**
* 客户端通道 is active
*/
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public class ClientHandleTcpClientChannelActiveAdvanced extends AbstractHandleTcpClientChannelActiveAdvanced<NettyProxyMsg> {
private final NettyClientProperties nettyClientProperties;
@@ -24,15 +20,14 @@ public class ClientHandleTcpClientChannelActiveAdvanced extends AbstractHandleTc
/**
* 处理当前数据
*
* @param nettyChannelContext 当前通道
* @param channel 当前通道
* @param nettyProxyMsg 通道数据
*/
@Override
protected void doHandler(NettyChannelContext nettyChannelContext, NettyProxyMsg nettyProxyMsg) {
Channel channel = nettyChannelContext.channel();
protected void doHandler(Channel channel, NettyProxyMsg nettyProxyMsg) {
// 缓存当前通道
String clientId = nettyProxyMsg.clientId();
byte[] clientIdByte = nettyProxyMsg.getClientId();
String clientId = new String(clientIdByte);
ChannelContext.push(channel, clientId);
ChannelAttributeKeyUtils.buildClientId(channel, clientId);
}

View File

@@ -1,15 +1,13 @@
package org.framework.lazy.cloud.network.heartbeat.client.netty.permeate.tcp.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.NettyVisitorPortContext;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyChannelContext;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.permeate.tcp.client.AbstractHandleTcpDistributeClientPermeateClientCloseTypeAdvanced;
import org.framework.lazy.cloud.network.heartbeat.common.enums.TcpMessageTypeEnums;
import org.framework.lazy.cloud.network.heartbeat.common.socket.PermeateVisitorSocket;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.Role;
/**
@@ -17,7 +15,6 @@ import org.springframework.context.annotation.Role;
*
* @see TcpMessageTypeEnums#TCP_DISTRIBUTE_CLIENT_PERMEATE_CLIENT_CLOSE
*/
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
@Slf4j
public class ClientHandleTcpDistributeClientPermeateClientCloseTypeAdvanced extends AbstractHandleTcpDistributeClientPermeateClientCloseTypeAdvanced<NettyProxyMsg> {
@@ -25,11 +22,11 @@ public class ClientHandleTcpDistributeClientPermeateClientCloseTypeAdvanced exte
/**
* 处理当前数据
*
* @param nettyChannelContext 当前通道
* @param channel 当前通道
* @param nettyProxyMsg 通道数据
*/
@Override
public void doHandler(NettyChannelContext nettyChannelContext, NettyProxyMsg nettyProxyMsg) {
public void doHandler(Channel channel, NettyProxyMsg nettyProxyMsg) {
// 初始化 客户端渗透服务端socket
byte[] msgVisitorPort = nettyProxyMsg.getVisitorPort();
Integer visitorPort = Integer.parseInt(new String(msgVisitorPort));

View File

@@ -1,16 +1,14 @@
package org.framework.lazy.cloud.network.heartbeat.client.netty.permeate.tcp.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.permeate.tcp.socket.NettyTcpClientPermeateClientVisitorSocket;
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.payload.NettyChannelContext;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.permeate.tcp.client.AbstractHandleTcpDistributeClientPermeateClientInitTypeAdvanced;
import org.framework.lazy.cloud.network.heartbeat.common.enums.TcpMessageTypeEnums;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.Role;
import org.wu.framework.spring.utils.SpringContextHolder;
import java.util.ArrayList;
@@ -22,28 +20,26 @@ import java.util.List;
*
* @see TcpMessageTypeEnums#TCP_DISTRIBUTE_CLIENT_PERMEATE_CLIENT_INIT
*/
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
@Slf4j
public class ClientHandleTcpDistributeClientPermeateClientInitTypeAdvanced
extends AbstractHandleTcpDistributeClientPermeateClientInitTypeAdvanced<NettyProxyMsg> {
public class ClientHandleTcpDistributeClientPermeateClientInitTypeAdvanced extends AbstractHandleTcpDistributeClientPermeateClientInitTypeAdvanced<NettyProxyMsg> {
/**
* 处理当前数据
*
* @param nettyChannelContext 当前通道
* @param channel 当前通道
* @param nettyProxyMsg 通道数据
*/
@Override
public void doHandler(NettyChannelContext nettyChannelContext, NettyProxyMsg nettyProxyMsg) {
public void doHandler(Channel channel, NettyProxyMsg nettyProxyMsg) {
// 初始化 客户端渗透服务端socket
byte[] originClientIdBytes = nettyProxyMsg.getClientId();
byte[] fromClientIdBytes = nettyProxyMsg.getClientId();
byte[] visitorPortBytes = nettyProxyMsg.getVisitorPort();
byte[] clientTargetIpBytes = nettyProxyMsg.getTargetIp();
byte[] clientTargetPortBytes = nettyProxyMsg.getTargetPort();
byte[] targetClientIdBytes = nettyProxyMsg.getData();
byte[] clientTargetIpBytes = nettyProxyMsg.getClientTargetIp();
byte[] clientTargetPortBytes = nettyProxyMsg.getClientTargetPort();
byte[] toClientIdBytes = nettyProxyMsg.getData();
String originClientId = new String(originClientIdBytes);
String targetClientId = new String(targetClientIdBytes);
String fromClientId = new String(fromClientIdBytes);
String toClientId = new String(toClientIdBytes);
Integer visitorPort = Integer.parseInt(new String(visitorPortBytes));
String clientTargetIp = new String(clientTargetIpBytes);
Integer clientTargetPort = Integer.parseInt(new String(clientTargetPortBytes));
@@ -51,17 +47,17 @@ public class ClientHandleTcpDistributeClientPermeateClientInitTypeAdvanced
List<HandleChannelTypeAdvanced> handleChannelTypeAdvancedList = new ArrayList<>(SpringContextHolder.getApplicationContext().getBeansOfType(HandleChannelTypeAdvanced.class).values());
// ChannelFlowAdapter channelFlowAdapter = SpringContextHolder.getBean(ChannelFlowAdapter.class);
NettyClientProperties nettyClientProperties = SpringContextHolder.getBean(NettyClientProperties.class);
log.info("client permeate client from client_id:【{}】 target_client_id【{}】with visitor_port【{}】, clientTargetIp:【{}】clientTargetPort:【{}】",
originClientId, targetClientId, visitorPort, clientTargetIp, clientTargetPort);
log.info("client permeate client from client_id:【{}】 to_client_id【{}】with visitor_port【{}】, clientTargetIp:【{}】clientTargetPort:【{}】",
fromClientId, toClientId, visitorPort, clientTargetIp, clientTargetPort);
NettyTcpClientPermeateClientVisitorSocket nettyTcpClientPermeateClientVisitorSocket =
NettyTcpClientPermeateClientVisitorSocket.NettyClientPermeateClientVisitorSocketBuilder.builder()
.builderClientId(originClientId)
.builderClientId(fromClientId)
.builderClientTargetIp(clientTargetIp)
.builderClientTargetPort(clientTargetPort)
.builderVisitorPort(visitorPort)
.builderNettyClientProperties(nettyClientProperties)
//.builderChannelFlowAdapter(channelFlowAdapter)
.builderToClientId(targetClientId)
.builderToClientId(toClientId)
.builderHandleChannelTypeAdvancedList(handleChannelTypeAdvancedList)
.build();

View File

@@ -3,13 +3,10 @@ package org.framework.lazy.cloud.network.heartbeat.client.netty.permeate.tcp.adv
import io.netty.channel.Channel;
import lombok.extern.slf4j.Slf4j;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyChannelContext;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.permeate.tcp.client.AbstractHandleTcpDistributeClientPermeateClientTransferCloseTypeAdvanced;
import org.framework.lazy.cloud.network.heartbeat.common.enums.TcpMessageTypeEnums;
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.Role;
/**
@@ -17,19 +14,17 @@ import org.springframework.context.annotation.Role;
*
* @see TcpMessageTypeEnums#TCP_DISTRIBUTE_CLIENT_PERMEATE_CLIENT_TRANSFER_CLOSE
*/
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
@Slf4j
public class ClientHandleTcpDistributeClientPermeateClientTransferCloseTypeAdvanced extends AbstractHandleTcpDistributeClientPermeateClientTransferCloseTypeAdvanced<NettyProxyMsg> {
/**
* 处理当前数据
*
* @param nettyChannelContext 当前通道
* @param channel 当前通道
* @param nettyProxyMsg 通道数据
*/
@Override
public void doHandler(NettyChannelContext nettyChannelContext, NettyProxyMsg nettyProxyMsg) {
Channel channel = nettyChannelContext.channel();
public void doHandler(Channel channel, NettyProxyMsg nettyProxyMsg) {
// 关闭客户端真实通道、访客通道
Channel realChannel = ChannelAttributeKeyUtils.getNextChannel(channel);
realChannel.close();// 真实通道关闭

View File

@@ -1,15 +1,13 @@
package org.framework.lazy.cloud.network.heartbeat.client.netty.permeate.tcp.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.NettyVisitorPortContext;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyChannelContext;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.permeate.tcp.client.AbstractHandleTcpDistributeClientPermeateServerCloseTypeAdvanced;
import org.framework.lazy.cloud.network.heartbeat.common.enums.TcpMessageTypeEnums;
import org.framework.lazy.cloud.network.heartbeat.common.socket.PermeateVisitorSocket;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.Role;
/**
@@ -17,7 +15,6 @@ import org.springframework.context.annotation.Role;
*
* @see TcpMessageTypeEnums#TCP_DISTRIBUTE_CLIENT_PERMEATE_SERVER_CLOSE
*/
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
@Slf4j
public class ClientHandleTcpDistributeClientPermeateServerCloseTypeAdvanced extends AbstractHandleTcpDistributeClientPermeateServerCloseTypeAdvanced<NettyProxyMsg> {
@@ -25,11 +22,11 @@ public class ClientHandleTcpDistributeClientPermeateServerCloseTypeAdvanced exte
/**
* 处理当前数据
*
* @param nettyChannelContext 当前通道
* @param channel 当前通道
* @param nettyProxyMsg 通道数据
*/
@Override
public void doHandler(NettyChannelContext nettyChannelContext, NettyProxyMsg nettyProxyMsg) {
public void doHandler(Channel channel, NettyProxyMsg nettyProxyMsg) {
// 初始化 客户端渗透服务端socket
byte[] msgVisitorPort = nettyProxyMsg.getVisitorPort();
Integer visitorPort = Integer.parseInt(new String(msgVisitorPort));

View File

@@ -1,16 +1,14 @@
package org.framework.lazy.cloud.network.heartbeat.client.netty.permeate.tcp.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.permeate.tcp.socket.NettyTcpClientPermeateServerVisitorSocket;
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.payload.NettyChannelContext;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.permeate.tcp.client.AbstractHandleTcpDistributeClientPermeateServerInitTypeAdvanced;
import org.framework.lazy.cloud.network.heartbeat.common.enums.TcpMessageTypeEnums;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.Role;
import org.wu.framework.spring.utils.SpringContextHolder;
import java.util.ArrayList;
@@ -22,7 +20,6 @@ import java.util.List;
*
* @see TcpMessageTypeEnums#TCP_DISTRIBUTE_CLIENT_PERMEATE_SERVER_INIT
*/
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
@Slf4j
public class ClientHandleTcpDistributeClientPermeateServerInitTypeAdvanced extends AbstractHandleTcpDistributeClientPermeateServerInitTypeAdvanced<NettyProxyMsg> {
@@ -35,16 +32,16 @@ public class ClientHandleTcpDistributeClientPermeateServerInitTypeAdvanced exten
/**
* 处理当前数据
*
* @param nettyChannelContext 当前通道
* @param channel 当前通道
* @param nettyProxyMsg 通道数据
*/
@Override
public void doHandler(NettyChannelContext nettyChannelContext, NettyProxyMsg nettyProxyMsg) {
public void doHandler(Channel channel, NettyProxyMsg nettyProxyMsg) {
// 初始化 客户端渗透服务端socket
byte[] clientIdBytes = nettyProxyMsg.getClientId();
byte[] visitorPort = nettyProxyMsg.getVisitorPort();
byte[] clientTargetIp = nettyProxyMsg.getTargetIp();
byte[] clientTargetPort = nettyProxyMsg.getTargetPort();
byte[] clientTargetIp = nettyProxyMsg.getClientTargetIp();
byte[] clientTargetPort = nettyProxyMsg.getClientTargetPort();
List<HandleChannelTypeAdvanced> handleChannelTypeAdvancedList = new ArrayList<>(SpringContextHolder.getApplicationContext().getBeansOfType(HandleChannelTypeAdvanced.class).values());
NettyTcpClientPermeateServerVisitorSocket nettyTcpClientPermeateServerVisitorSocket = NettyTcpClientPermeateServerVisitorSocket.NettyVisitorSocketBuilder.builder()

View File

@@ -3,13 +3,10 @@ package org.framework.lazy.cloud.network.heartbeat.client.netty.permeate.tcp.adv
import io.netty.channel.Channel;
import lombok.extern.slf4j.Slf4j;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyChannelContext;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.permeate.tcp.client.AbstractHandleTcpDistributeClientPermeateServerTransferCloseTypeAdvanced;
import org.framework.lazy.cloud.network.heartbeat.common.enums.TcpMessageTypeEnums;
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.Role;
/**
@@ -17,19 +14,17 @@ import org.springframework.context.annotation.Role;
*
* @see TcpMessageTypeEnums#TCP_DISTRIBUTE_CLIENT_PERMEATE_SERVER_TRANSFER_CLOSE
*/
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
@Slf4j
public class ClientHandleTcpDistributeClientPermeateServerTransferCloseTypeAdvanced extends AbstractHandleTcpDistributeClientPermeateServerTransferCloseTypeAdvanced<NettyProxyMsg> {
/**
* 处理当前数据
*
* @param nettyChannelContext 当前通道
* @param channel 当前通道
* @param nettyProxyMsg 通道数据
*/
@Override
public void doHandler(NettyChannelContext nettyChannelContext, NettyProxyMsg nettyProxyMsg) {
Channel channel = nettyChannelContext.channel();
public void doHandler(Channel channel, NettyProxyMsg nettyProxyMsg) {
// 关闭本地通信通道
Channel nextChannel = ChannelAttributeKeyUtils.getNextChannel(channel);
channel.close();

View File

@@ -4,13 +4,10 @@ package org.framework.lazy.cloud.network.heartbeat.client.netty.permeate.tcp.adv
import io.netty.buffer.ByteBuf;
import io.netty.channel.Channel;
import lombok.extern.slf4j.Slf4j;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyChannelContext;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.permeate.tcp.client.AbstractHandleTcpDistributeClientPermeateServerTransferTypeAdvanced;
import org.framework.lazy.cloud.network.heartbeat.common.enums.TcpMessageTypeEnums;
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.Role;
/**
@@ -18,7 +15,6 @@ import org.springframework.context.annotation.Role;
*
* @see TcpMessageTypeEnums#TCP_DISTRIBUTE_CLIENT_TRANSFER
*/
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
@Slf4j
public class ClientHandleTcpDistributeClientPermeateServerTransferTypeAdvanced extends AbstractHandleTcpDistributeClientPermeateServerTransferTypeAdvanced<NettyProxyMsg> {
@@ -26,16 +22,15 @@ public class ClientHandleTcpDistributeClientPermeateServerTransferTypeAdvanced e
/**
* 处理当前数据
*
* @param nettyChannelContext 当前通道
* @param channel 当前通道
* @param nettyProxyMsg 通道数据
*/
@Override
public void doHandler(NettyChannelContext nettyChannelContext, NettyProxyMsg nettyProxyMsg) {
Channel channel = nettyChannelContext.channel();
public void doHandler(Channel channel, NettyProxyMsg nettyProxyMsg) {
log.debug("客户端渗透服务端返回数据:{}" , new String(nettyProxyMsg.getData()));
byte[] visitorPort = nettyProxyMsg.getVisitorPort();
byte[] clientTargetIp = nettyProxyMsg.getTargetIp();
byte[] clientTargetPort = nettyProxyMsg.getTargetPort();
byte[] clientTargetIp = nettyProxyMsg.getClientTargetIp();
byte[] clientTargetPort = nettyProxyMsg.getClientTargetPort();
byte[] visitorId = nettyProxyMsg.getVisitorId();
// 真实服务通道
// Channel realChannel = NettyRealIdContext.getReal(new String(visitorId));

View File

@@ -1,16 +1,14 @@
package org.framework.lazy.cloud.network.heartbeat.client.netty.permeate.tcp.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.permeate.tcp.socket.NettyTcpClientPermeateClientRealSocket;
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.payload.NettyChannelContext;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.permeate.tcp.client.AbstractHandleTcpDistributeClientTransferClientPermeateChannelConnectionSuccessfulTypeAdvanced;
import org.framework.lazy.cloud.network.heartbeat.common.enums.TcpMessageTypeEnums;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.Role;
import org.wu.framework.spring.utils.SpringContextHolder;
import java.util.ArrayList;
@@ -23,22 +21,21 @@ import java.util.List;
*
* @see TcpMessageTypeEnums#TCP_DISTRIBUTE_CLIENT_TRANSFER_CLIENT_PERMEATE_CHANNEL_CONNECTION_SUCCESSFUL
*/
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
@Slf4j
public class ClientHandleTcpDistributeClientTransferClientPermeateChannelConnectionSuccessfulTypeAdvanced extends AbstractHandleTcpDistributeClientTransferClientPermeateChannelConnectionSuccessfulTypeAdvanced<NettyProxyMsg> {
/**
* 处理当前数据
*
* @param nettyChannelContext 当前通道
* @param channel 当前通道
* @param nettyProxyMsg 通道数据
*/
@Override
public void doHandler(NettyChannelContext nettyChannelContext, NettyProxyMsg nettyProxyMsg) {
public void doHandler(Channel channel, NettyProxyMsg nettyProxyMsg) {
// 创建connect 然后发送创建成功
byte[] msgClientId = nettyProxyMsg.getClientId();
byte[] msgClientTargetIp = nettyProxyMsg.getTargetIp();
byte[] msgClientTargetPort = nettyProxyMsg.getTargetPort();
byte[] msgClientTargetIp = nettyProxyMsg.getClientTargetIp();
byte[] msgClientTargetPort = nettyProxyMsg.getClientTargetPort();
byte[] msgVisitorId = nettyProxyMsg.getVisitorId();
byte[] msgVisitorPort = nettyProxyMsg.getVisitorPort();

View File

@@ -4,13 +4,10 @@ package org.framework.lazy.cloud.network.heartbeat.client.netty.permeate.tcp.adv
import io.netty.channel.Channel;
import io.netty.channel.ChannelOption;
import lombok.extern.slf4j.Slf4j;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyChannelContext;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.permeate.tcp.client.AbstractHandleTcpDistributeClientTransferClientPermeateChannelInitSuccessfulTypeAdvanced;
import org.framework.lazy.cloud.network.heartbeat.common.enums.TcpMessageTypeEnums;
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.Role;
/**
@@ -19,7 +16,6 @@ import org.springframework.context.annotation.Role;
*
* @see TcpMessageTypeEnums#TCP_DISTRIBUTE_CLIENT_TRANSFER_CLIENT_PERMEATE_CHANNEL_CONNECTION_SUCCESSFUL
*/
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
@Slf4j
public class ClientHandleTcpDistributeClientTransferClientPermeateChannelInitSuccessfulTypeAdvanced extends AbstractHandleTcpDistributeClientTransferClientPermeateChannelInitSuccessfulTypeAdvanced<NettyProxyMsg> {
@@ -28,16 +24,15 @@ public class ClientHandleTcpDistributeClientTransferClientPermeateChannelInitSuc
/**
* 处理当前数据
*
* @param nettyChannelContext 当前通道
* @param channel 当前通道
* @param nettyProxyMsg 通道数据
*/
@Override
public void doHandler(NettyChannelContext nettyChannelContext, NettyProxyMsg nettyProxyMsg) {
Channel channel = nettyChannelContext.channel();
public void doHandler(Channel channel, NettyProxyMsg nettyProxyMsg) {
// 连接成功 开启自动读取写
byte[] msgClientId = nettyProxyMsg.getClientId();
byte[] msgClientTargetIp = nettyProxyMsg.getTargetIp();
byte[] msgClientTargetPort = nettyProxyMsg.getTargetPort();
byte[] msgClientTargetIp = nettyProxyMsg.getClientTargetIp();
byte[] msgClientTargetPort = nettyProxyMsg.getClientTargetPort();
byte[] msgVisitorId = nettyProxyMsg.getVisitorId();
byte[] msgVisitorPort = nettyProxyMsg.getVisitorPort();

View File

@@ -4,13 +4,10 @@ package org.framework.lazy.cloud.network.heartbeat.client.netty.permeate.tcp.adv
import io.netty.buffer.ByteBuf;
import io.netty.channel.Channel;
import lombok.extern.slf4j.Slf4j;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyChannelContext;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.permeate.tcp.client.AbstractHandleTcpDistributeClientTransferClientRequestTypeAdvanced;
import org.framework.lazy.cloud.network.heartbeat.common.enums.TcpMessageTypeEnums;
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.Role;
/**
@@ -19,7 +16,6 @@ import org.springframework.context.annotation.Role;
*
* @see TcpMessageTypeEnums#TCP_DISTRIBUTE_CLIENT_PERMEATE_CLIENT_TRANSFER_REQUEST
*/
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
@Slf4j
public class ClientHandleTcpDistributeClientTransferClientRequestTypeAdvanced extends AbstractHandleTcpDistributeClientTransferClientRequestTypeAdvanced<NettyProxyMsg> {
@@ -28,12 +24,11 @@ public class ClientHandleTcpDistributeClientTransferClientRequestTypeAdvanced ex
/**
* 处理当前数据
*
* @param nettyChannelContext 当前通道
* @param channel 当前通道
* @param nettyProxyMsg 通道数据
*/
@Override
public void doHandler(NettyChannelContext nettyChannelContext, NettyProxyMsg nettyProxyMsg) {
Channel channel = nettyChannelContext.channel();
public void doHandler(Channel channel, NettyProxyMsg nettyProxyMsg) {
Channel nextChannel = ChannelAttributeKeyUtils.getNextChannel(channel);
// 把数据转到真实服务
ByteBuf buf = channel.config().getAllocator().buffer(nettyProxyMsg.getData().length);

View File

@@ -6,13 +6,10 @@ import io.netty.channel.ChannelOption;
import lombok.extern.slf4j.Slf4j;
import org.framework.lazy.cloud.network.heartbeat.client.netty.permeate.tcp.handler.NettyTcpClientPermeateServerVisitorHandler;
import org.framework.lazy.cloud.network.heartbeat.client.netty.permeate.tcp.socket.NettyTcpClientPermeateServerVisitorTransferSocket;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyChannelContext;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.permeate.tcp.client.AbstractHandleTcpDistributeClientTransferServerPermeateChannelConnectionSuccessfulTypeAdvanced;
import org.framework.lazy.cloud.network.heartbeat.common.enums.TcpMessageTypeEnums;
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.Role;
/**
@@ -22,7 +19,6 @@ import org.springframework.context.annotation.Role;
*
* @see TcpMessageTypeEnums#TCP_DISTRIBUTE_CLIENT_TRANSFER_SERVER_PERMEATE_CHANNEL_CONNECTION_SUCCESSFUL
*/
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
@Slf4j
public class ClientHandleTcpDistributeClientTransferServerPermeateChannelConnectionSuccessfulTypeAdvanced extends AbstractHandleTcpDistributeClientTransferServerPermeateChannelConnectionSuccessfulTypeAdvanced<NettyProxyMsg> {
@@ -31,16 +27,15 @@ public class ClientHandleTcpDistributeClientTransferServerPermeateChannelConnect
/**
* 处理当前数据
*
* @param nettyChannelContext 当前通道
* @param transferChannel 当前通道
* @param nettyProxyMsg 通道数据
*/
@Override
public void doHandler(NettyChannelContext nettyChannelContext, NettyProxyMsg nettyProxyMsg) {
Channel channel = nettyChannelContext.channel();
public void doHandler(Channel transferChannel, NettyProxyMsg nettyProxyMsg) {
// 连接成功 开启自动读取写
byte[] msgVisitorId = nettyProxyMsg.getVisitorId();
String visitorId = new String(msgVisitorId);
Channel nextChannel = ChannelAttributeKeyUtils.getNextChannel(channel);
Channel nextChannel = ChannelAttributeKeyUtils.getNextChannel(transferChannel);
nextChannel.config().setOption(ChannelOption.AUTO_READ, true);
}

View File

@@ -1,20 +1,17 @@
package org.framework.lazy.cloud.network.heartbeat.client.netty.permeate.tcp.advanced;
import com.alibaba.fastjson.JSONObject;
import io.netty.channel.Channel;
import lombok.extern.slf4j.Slf4j;
import org.framework.lazy.cloud.network.heartbeat.client.netty.permeate.event.ClientChangeEvent;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyChannelContext;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.permeate.tcp.client.AbstractHandleTcpDistributeConnectSuccessNotificationTypeAdvancedHandle;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.Role;
import java.util.List;
/**
* 客户端连接成功通知
*/
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
@Slf4j
public class ClientHandleTcpDistributeConnectSuccessNotificationTypeAdvancedHandle extends AbstractHandleTcpDistributeConnectSuccessNotificationTypeAdvancedHandle<NettyProxyMsg> {
@@ -28,11 +25,11 @@ public class ClientHandleTcpDistributeConnectSuccessNotificationTypeAdvancedHand
/**
* 处理当前数据
*
* @param nettyChannelContext 当前通道
* @param channel 当前通道
* @param msg 通道数据
*/
@Override
protected void doHandler(NettyChannelContext nettyChannelContext, NettyProxyMsg msg) {
protected void doHandler(Channel channel, NettyProxyMsg msg) {
// 客户端ID{},客户端:{}连接成功
log.warn("Client ID: {}, Client Data : {} Connection successful", new String(msg.getClientId()), new String(msg.getData()));

View File

@@ -1,20 +1,17 @@
package org.framework.lazy.cloud.network.heartbeat.client.netty.permeate.tcp.advanced;
import io.netty.channel.Channel;
import lombok.extern.slf4j.Slf4j;
import org.framework.lazy.cloud.network.heartbeat.client.netty.permeate.event.ClientChangeEvent;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyChannelContext;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.permeate.tcp.client.AbstractHandleTcpDistributeDisconnectTypeAdvancedHandle;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.Role;
/**
* 服务端处理客户端断开连接处理
* TYPE_DISCONNECT
*/
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
@Slf4j
public class ClientHandleTcpDistributeDisconnectTypeAdvancedHandle extends AbstractHandleTcpDistributeDisconnectTypeAdvancedHandle<NettyProxyMsg> {
@@ -28,11 +25,11 @@ public class ClientHandleTcpDistributeDisconnectTypeAdvancedHandle extends Abstr
/**
* 处理当前数据
*
* @param nettyChannelContext 当前通道
* @param channel 当前通道
* @param msg 通道数据
*/
@Override
public void doHandler(NettyChannelContext nettyChannelContext, NettyProxyMsg msg) {
public void doHandler(Channel channel, NettyProxyMsg msg) {
// 服务下线
byte[] data = msg.getData();
byte[] clientId = msg.getClientId();

View File

@@ -1,15 +1,13 @@
package org.framework.lazy.cloud.network.heartbeat.client.netty.permeate.tcp.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.permeate.tcp.socket.NettyTcpServerPermeateClientRealSocket;
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.payload.NettyChannelContext;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.permeate.tcp.client.AbstractHandleTcpDistributeServicePermeateClientRealConnectTypeAdvanced;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.Role;
import org.wu.framework.spring.utils.SpringContextHolder;
import java.util.ArrayList;
@@ -18,7 +16,6 @@ import java.util.List;
/**
* 客户端创建真实代理同奥
*/
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
@Slf4j
public class ClientHandleTcpDistributeServicePermeateClientRealConnectTypeAdvanced extends AbstractHandleTcpDistributeServicePermeateClientRealConnectTypeAdvanced<NettyProxyMsg> {
@@ -33,16 +30,16 @@ public class ClientHandleTcpDistributeServicePermeateClientRealConnectTypeAdvanc
/**
* 处理当前数据
*
* @param nettyChannelContext 当前通道
* @param channel 当前通道
* @param msg 通道数据
*/
@Override
protected void doHandler(NettyChannelContext nettyChannelContext, NettyProxyMsg msg) {
protected void doHandler(Channel channel, NettyProxyMsg msg) {
// 创建真实端口监听
byte[] clientIdBytes = msg.getClientId();
byte[] visitorPort = msg.getVisitorPort();
byte[] clientTargetIp = msg.getTargetIp();
byte[] clientTargetPort = msg.getTargetPort();
byte[] clientTargetIp = msg.getClientTargetIp();
byte[] clientTargetPort = msg.getClientTargetPort();
byte[] visitorIdBytes = msg.getVisitorId();
InternalNetworkPenetrationRealClient internalNetworkPenetrationRealClient =
InternalNetworkPenetrationRealClient

View File

@@ -4,13 +4,10 @@ package org.framework.lazy.cloud.network.heartbeat.client.netty.permeate.tcp.adv
import io.netty.buffer.ByteBuf;
import io.netty.channel.Channel;
import lombok.extern.slf4j.Slf4j;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyChannelContext;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.permeate.tcp.client.AbstractHandleTcpDistributeServicePermeateClientTransferClientResponseTypeAdvanced;
import org.framework.lazy.cloud.network.heartbeat.common.enums.TcpMessageTypeEnums;
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.Role;
/**
@@ -19,7 +16,6 @@ import org.springframework.context.annotation.Role;
*
* @see TcpMessageTypeEnums#TCP_DISTRIBUTE_CLIENT_PERMEATE_CLIENT_TRANSFER_RESPONSE
*/
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
@Slf4j
public class ClientHandleTcpDistributeServicePermeateClientTransferClientResponseTypeAdvanced extends AbstractHandleTcpDistributeServicePermeateClientTransferClientResponseTypeAdvanced<NettyProxyMsg> {
@@ -28,12 +24,11 @@ public class ClientHandleTcpDistributeServicePermeateClientTransferClientRespons
/**
* 处理当前数据
*
* @param nettyChannelContext 当前通道
* @param channel 当前通道
* @param nettyProxyMsg 通道数据
*/
@Override
public void doHandler(NettyChannelContext nettyChannelContext, NettyProxyMsg nettyProxyMsg) {
Channel channel = nettyChannelContext.channel();
public void doHandler(Channel channel, NettyProxyMsg nettyProxyMsg) {
Channel nextChannel = ChannelAttributeKeyUtils.getNextChannel(channel);
// 把数据转到真实服务
ByteBuf buf = channel.config().getAllocator().buffer(nettyProxyMsg.getData().length);

View File

@@ -1,26 +1,23 @@
package org.framework.lazy.cloud.network.heartbeat.client.netty.permeate.tcp.advanced;
import io.netty.channel.Channel;
import lombok.extern.slf4j.Slf4j;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyChannelContext;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.permeate.tcp.client.AbstractHandleTcpDistributeSingleClientMessageTypeAdvanced;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.Role;
/**
* 接收服务端发送过来的聊天信息
*/
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
@Slf4j
public class ClientHandleTcpDistributeSingleClientMessageTypeAdvanced extends AbstractHandleTcpDistributeSingleClientMessageTypeAdvanced<NettyProxyMsg> {
/**
* 处理当前数据
*
* @param nettyChannelContext 当前通道
* @param channel 当前通道
* @param nettyProxyMsg 通道数据
*/
@Override
protected void doHandler(NettyChannelContext nettyChannelContext, NettyProxyMsg nettyProxyMsg) {
protected void doHandler(Channel channel, NettyProxyMsg nettyProxyMsg) {
byte[] clientId = nettyProxyMsg.getClientId();
byte[] data = nettyProxyMsg.getData();
log.info("接收客户端:{},发送过来的聊天信息:{}", new String(clientId), new String(data));

View File

@@ -3,26 +3,21 @@ package org.framework.lazy.cloud.network.heartbeat.client.netty.permeate.tcp.adv
import io.netty.channel.Channel;
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.payload.NettyChannelContext;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.permeate.tcp.client.AbstractHandleTcpDistributeSingleClientRealAutoReadConnectTypeAdvanced;
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.Role;
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
@Slf4j
public class ClientHandleTcpDistributeSingleClientRealAutoReadConnectTypeAdvanced extends AbstractHandleTcpDistributeSingleClientRealAutoReadConnectTypeAdvanced<NettyProxyMsg> {
/**
* 处理当前数据
*
* @param nettyChannelContext 当前通道
* @param channel 当前通道
* @param nettyProxyMsg 通道数据
*/
@Override
protected void doHandler(NettyChannelContext nettyChannelContext, NettyProxyMsg nettyProxyMsg) {
Channel channel = nettyChannelContext.channel();
protected void doHandler(Channel channel, NettyProxyMsg nettyProxyMsg) {
// 获取访客ID
byte[] visitorId = nettyProxyMsg.getVisitorId();
// 获取访客对应的真实代理通道

View File

@@ -1,25 +1,22 @@
package org.framework.lazy.cloud.network.heartbeat.client.netty.permeate.tcp.advanced;
import io.netty.channel.Channel;
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.payload.NettyChannelContext;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.permeate.tcp.client.AbstractHandleTcpDistributeSingleClientRealCloseVisitorTypeAdvanced;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.Role;
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
@Slf4j
public class ClientHandleTcpDistributeSingleClientRealCloseVisitorTypeAdvanced extends AbstractHandleTcpDistributeSingleClientRealCloseVisitorTypeAdvanced<NettyProxyMsg> {
/**
* 处理当前数据
*
* @param nettyChannelContext 当前通道
* @param channel 当前通道
* @param nettyProxyMsg 通道数据
*/
@Override
protected void doHandler(NettyChannelContext nettyChannelContext, NettyProxyMsg nettyProxyMsg) {
protected void doHandler(Channel channel, NettyProxyMsg nettyProxyMsg) {
// 关闭代理的真实通道
byte[] visitorId = nettyProxyMsg.getVisitorId();
NettyRealIdContext.clear(visitorId);

View File

@@ -1,16 +1,13 @@
package org.framework.lazy.cloud.network.heartbeat.client.netty.permeate.tcp.advanced;
import io.netty.channel.Channel;
import lombok.extern.slf4j.Slf4j;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyChannelContext;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.permeate.tcp.client.AbstractHandleTcpDistributeStagingClosedTypeAdvanced;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.Role;
/**
* 服务端下发暂存关闭消息处理
*/
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
@Slf4j
public class ClientHandleTcpDistributeStagingClosedTypeAdvanced extends AbstractHandleTcpDistributeStagingClosedTypeAdvanced<NettyProxyMsg> {
@@ -18,11 +15,11 @@ public class ClientHandleTcpDistributeStagingClosedTypeAdvanced extends Abstract
/**
* 处理当前数据
*
* @param nettyChannelContext 当前通道
* @param channel 当前通道
* @param msg 通道数据
*/
@Override
protected void doHandler(NettyChannelContext nettyChannelContext, NettyProxyMsg msg) {
protected void doHandler(Channel channel, NettyProxyMsg msg) {
String clientId = new String(msg.getClientId());
log.info("客户端:{}离线暂存关闭", clientId);
// 修改redis 客户端暂存状态

View File

@@ -1,16 +1,13 @@
package org.framework.lazy.cloud.network.heartbeat.client.netty.permeate.tcp.advanced;
import io.netty.channel.Channel;
import lombok.extern.slf4j.Slf4j;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyChannelContext;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.permeate.tcp.client.AbstractHandleTcpDistributeStagingOpenedTypeAdvanced;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.Role;
/**
* 服务端下发暂存开启消息处理
*/
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
@Slf4j
public class ClientHandleTcpDistributeStagingOpenedTypeAdvanced extends AbstractHandleTcpDistributeStagingOpenedTypeAdvanced<NettyProxyMsg> {
@@ -22,11 +19,11 @@ public class ClientHandleTcpDistributeStagingOpenedTypeAdvanced extends Abstract
/**
* 处理当前数据
*
* @param nettyChannelContext 当前通道
* @param channel 当前通道
* @param msg 通道数据
*/
@Override
protected void doHandler(NettyChannelContext nettyChannelContext, NettyProxyMsg msg) {
protected void doHandler(Channel channel, NettyProxyMsg msg) {
String clientId = new String(msg.getClientId());
//客户端:{}离线暂存开启
log.warn("Client: {} Offline temporary storage enabled", new String(msg.getClientId()));

View File

@@ -8,9 +8,9 @@ import io.netty.handler.timeout.IdleState;
import io.netty.handler.timeout.IdleStateEvent;
import lombok.extern.slf4j.Slf4j;
import org.framework.lazy.cloud.network.heartbeat.client.netty.permeate.tcp.socket.NettyTcpClientSocket;
import org.framework.lazy.cloud.network.heartbeat.common.adapter.ChannelTypeAdapter;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.constant.TcpMessageType;
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.adapter.ChannelTypeAdapter;
import java.nio.charset.StandardCharsets;
import java.util.Date;
@@ -47,7 +47,7 @@ public class NettyTcpClientHandler extends SimpleChannelInboundHandler<NettyProx
// 接收服务端、或者是代理端的信息
Channel channel = ctx.channel();
// log.info("type:{},clientId:{},data:{}",msg.getMysqlType(),new String(msg.getClientId()),new String(msg.getData()));
channelTypeAdapter.handler(ctx, msg);
channelTypeAdapter.handler(channel, msg);
}
/**
@@ -56,7 +56,7 @@ public class NettyTcpClientHandler extends SimpleChannelInboundHandler<NettyProx
@Override
public void channelActive(ChannelHandlerContext ctx) throws Exception {
// 建立连接时
log.info("When establishing a connection{}", new Date());
log.info("When establishing a connection{}" , new Date());
ctx.fireChannelActive();
String clientId = nettyTcpClientSocket.getClientId();
// 处理客户端连接成功
@@ -64,7 +64,9 @@ public class NettyTcpClientHandler extends SimpleChannelInboundHandler<NettyProx
NettyProxyMsg nettyMsg = new NettyProxyMsg();
nettyMsg.setType(TcpMessageType.TCP_CLIENT_CHANNEL_ACTIVE);
nettyMsg.setClientId(clientId);
channelTypeAdapter.handler(ctx, nettyMsg);
channelTypeAdapter.handler(channel, nettyMsg);
}
/**
@@ -73,8 +75,8 @@ public class NettyTcpClientHandler extends SimpleChannelInboundHandler<NettyProx
@Override
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
//服务端主动关闭当前客户端连接时
log.info("When the server actively closes the current client connection{}", new Date());
EventLoop eventLoop = ctx.channel().eventLoop();
log.info("When the server actively closes the current client connection{}" , new Date());
final EventLoop eventLoop = ctx.channel().eventLoop();
eventLoop.schedule(() -> {
try {
nettyTcpClientSocket.newConnect2Server();
@@ -106,7 +108,7 @@ public class NettyTcpClientHandler extends SimpleChannelInboundHandler<NettyProx
NettyProxyMsg nettyMsg = new NettyProxyMsg();
nettyMsg.setType(TcpMessageType.TCP_DISTRIBUTE_CLIENT_DISCONNECTION_NOTIFICATION);
nettyMsg.setClientId(clientId.getBytes(StandardCharsets.UTF_8));
channelTypeAdapter.handler(ctx, nettyMsg);
channelTypeAdapter.handler(channel, nettyMsg);
ctx.close();
}

View File

@@ -7,7 +7,7 @@ import io.netty.channel.SimpleChannelInboundHandler;
import lombok.extern.slf4j.Slf4j;
import org.framework.lazy.cloud.network.heartbeat.common.constant.TcpMessageType;
import org.framework.lazy.cloud.network.heartbeat.common.NettyByteBuf;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
/**

View File

@@ -6,7 +6,7 @@ import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
import lombok.extern.slf4j.Slf4j;
import org.framework.lazy.cloud.network.heartbeat.common.constant.TcpMessageType;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.adapter.ChannelTypeAdapter;
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
@@ -29,7 +29,7 @@ public class NettyTcpClientPermeateClientTransferHandler extends SimpleChannelIn
@Override
public void channelRead0(ChannelHandlerContext ctx, NettyProxyMsg nettyProxyMsg) throws Exception {
Channel channel = ctx.channel();
channelTypeAdapter.handler(ctx, nettyProxyMsg);
channelTypeAdapter.handler(channel, nettyProxyMsg);
}

View File

@@ -6,7 +6,7 @@ import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
import lombok.extern.slf4j.Slf4j;
import org.framework.lazy.cloud.network.heartbeat.common.constant.TcpMessageType;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.adapter.ChannelTypeAdapter;
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
@@ -29,7 +29,7 @@ public class NettyTcpClientPermeateClientTransferRealHandler extends SimpleChann
@Override
public void channelRead0(ChannelHandlerContext ctx, NettyProxyMsg nettyProxyMsg) throws Exception {
Channel channel = ctx.channel();
channelTypeAdapter.handler(ctx, nettyProxyMsg);
channelTypeAdapter.handler(channel, nettyProxyMsg);
}

View File

@@ -14,7 +14,7 @@ import org.framework.lazy.cloud.network.heartbeat.client.netty.permeate.tcp.sock
import org.framework.lazy.cloud.network.heartbeat.client.netty.permeate.tcp.socket.NettyTcpClientPermeateServerVisitorTransferSocket;
import org.framework.lazy.cloud.network.heartbeat.common.constant.TcpMessageType;
import org.framework.lazy.cloud.network.heartbeat.common.NettyCommunicationIdContext;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyProxyMsg;
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.utils.ChannelAttributeKeyUtils;

View File

@@ -8,7 +8,7 @@ import io.netty.handler.timeout.IdleState;
import io.netty.handler.timeout.IdleStateEvent;
import lombok.extern.slf4j.Slf4j;
import org.framework.lazy.cloud.network.heartbeat.common.constant.TcpMessageType;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.adapter.ChannelTypeAdapter;
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
@@ -31,7 +31,7 @@ public class NettyTcpClientPermeateServerTransferHandler extends SimpleChannelIn
@Override
public void channelRead0(ChannelHandlerContext ctx, NettyProxyMsg nettyProxyMsg) throws Exception {
Channel channel = ctx.channel();
channelTypeAdapter.handler(ctx, nettyProxyMsg);
channelTypeAdapter.handler(channel, nettyProxyMsg);
}

View File

@@ -12,7 +12,7 @@ import org.framework.lazy.cloud.network.heartbeat.client.netty.permeate.NettyCli
import org.framework.lazy.cloud.network.heartbeat.client.netty.permeate.tcp.advanced.ClientHandleTcpDistributeClientTransferServerPermeateChannelConnectionSuccessfulTypeAdvanced;
import org.framework.lazy.cloud.network.heartbeat.client.netty.permeate.tcp.socket.NettyTcpClientPermeateServerVisitorTransferSocket;
import org.framework.lazy.cloud.network.heartbeat.common.constant.TcpMessageType;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
import java.util.UUID;

View File

@@ -8,7 +8,7 @@ import io.netty.channel.SimpleChannelInboundHandler;
import lombok.extern.slf4j.Slf4j;
import org.framework.lazy.cloud.network.heartbeat.common.constant.TcpMessageType;
import org.framework.lazy.cloud.network.heartbeat.common.NettyByteBuf;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
import org.wu.framework.core.utils.ObjectUtils;

View File

@@ -6,8 +6,8 @@ import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelOption;
import io.netty.channel.SimpleChannelInboundHandler;
import lombok.extern.slf4j.Slf4j;
import org.framework.lazy.cloud.network.heartbeat.common.*;
import org.framework.lazy.cloud.network.heartbeat.common.adapter.ChannelTypeAdapter;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.constant.TcpMessageType;
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
import org.wu.framework.core.utils.ObjectUtils;
@@ -31,7 +31,7 @@ public class NettyTcpServerPermeateClientTransferHandler extends SimpleChannelIn
@Override
public void channelRead0(ChannelHandlerContext ctx, NettyProxyMsg nettyProxyMsg) throws Exception {
Channel channel = ctx.channel();
channelTypeAdapter.handler(ctx, nettyProxyMsg);
channelTypeAdapter.handler(channel, nettyProxyMsg);
}

View File

@@ -11,7 +11,6 @@ import org.framework.lazy.cloud.network.heartbeat.client.netty.permeate.tcp.filt
import org.framework.lazy.cloud.network.heartbeat.client.netty.permeate.tcp.filter.NettyTcpClientPermeateClientTransferRealFilter;
import org.framework.lazy.cloud.network.heartbeat.common.*;
import org.framework.lazy.cloud.network.heartbeat.common.adapter.ChannelTypeAdapter;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.HandleChannelTypeAdvanced;
import org.framework.lazy.cloud.network.heartbeat.common.constant.TcpMessageType;
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
@@ -139,8 +138,8 @@ public class NettyTcpClientPermeateClientRealSocket {
NettyProxyMsg nettyProxyMsg = new NettyProxyMsg();
nettyProxyMsg.setVisitorId(visitorId);
nettyProxyMsg.setClientId(clientId);
nettyProxyMsg.setTargetIp(clientTargetIp);
nettyProxyMsg.setTargetPort(clientTargetPort);
nettyProxyMsg.setClientTargetIp(clientTargetIp);
nettyProxyMsg.setClientTargetPort(clientTargetPort);
nettyProxyMsg.setVisitorPort(visitorPort);
nettyProxyMsg.setType(TcpMessageType.TCP_REPORT_CLIENT_PERMEATE_CLIENT_TRANSFER_CHANNEL_INIT_SUCCESSFUL);
transferChannel.writeAndFlush(nettyProxyMsg);

View File

@@ -141,7 +141,7 @@ public class NettyTcpClientPermeateClientVisitorSocket implements PermeateVisito
/**
* 目标客户端ID
*/
private String targetClientId;
private String toClientId;
/**
* 流量适配器
@@ -249,11 +249,11 @@ public class NettyTcpClientPermeateClientVisitorSocket implements PermeateVisito
/**
* 目标客户端ID
*
* @param targetClientId 目标客户端ID
* @param toClientId 目标客户端ID
* @return 当前对象
*/
public NettyClientPermeateClientVisitorSocketBuilder builderToClientId(String targetClientId) {
this.targetClientId = targetClientId;
public NettyClientPermeateClientVisitorSocketBuilder builderToClientId(String toClientId) {
this.toClientId = toClientId;
return this;
}
public NettyTcpClientPermeateClientVisitorSocket build() {
@@ -268,8 +268,8 @@ public class NettyTcpClientPermeateClientVisitorSocket implements PermeateVisito
}
NettyClientPermeateClientVisitor nettyClientPermeateClientVisitor = new NettyClientPermeateClientVisitor();
nettyClientPermeateClientVisitor.setOriginClientId(nettyClientProperties.getClientId());
nettyClientPermeateClientVisitor.setTargetClientId(targetClientId);
nettyClientPermeateClientVisitor.setFromClientId(nettyClientProperties.getClientId());
nettyClientPermeateClientVisitor.setToClientId(toClientId);
nettyClientPermeateClientVisitor.setTargetIp(clientTargetIp);
nettyClientPermeateClientVisitor.setTargetPort(clientTargetPort);
nettyClientPermeateClientVisitor.setVisitorPort(visitorPort);

View File

@@ -10,7 +10,7 @@ import org.framework.lazy.cloud.network.heartbeat.client.config.NettyClientPrope
import org.framework.lazy.cloud.network.heartbeat.client.netty.permeate.NettyClientPermeateClientVisitor;
import org.framework.lazy.cloud.network.heartbeat.client.netty.permeate.tcp.filter.NettyTcpClientPermeateClientTransferFilter;
import org.framework.lazy.cloud.network.heartbeat.common.constant.TcpMessageType;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.adapter.ChannelTypeAdapter;
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
@@ -57,10 +57,10 @@ public class NettyTcpClientPermeateClientVisitorTransferSocket {
String visitorId = ChannelAttributeKeyUtils.getVisitorId(visitorChannel);
Integer visitorPort = nettyClientPermeateClientVisitor.getVisitorPort();
String targetClientId = nettyClientPermeateClientVisitor.getTargetClientId();
String toClientId = nettyClientPermeateClientVisitor.getToClientId();
// 客户端新建访客通道 连接服务端IP:{},连接服务端端口:{}
log.info("Client creates a new visitor channel to connect to server IP: {}, connecting to server port: {} with clientId:【{}】 targetClientId:【{}】 & visitorId:【{}】", inetHost, inetPort, clientId, targetClientId, visitorId);
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:{}
@@ -70,12 +70,11 @@ public class NettyTcpClientPermeateClientVisitorTransferSocket {
NettyProxyMsg nettyProxyMsg = new NettyProxyMsg();
nettyProxyMsg.setType(TcpMessageType.TCP_REPORT_CLIENT_TRANSFER_CLIENT_PERMEATE_CHANNEL_CONNECTION_SUCCESSFUL);
// other clientId
nettyProxyMsg.setClientId(targetClientId);
nettyProxyMsg.setClientId(toClientId);
nettyProxyMsg.setVisitorPort(visitorPort);
nettyProxyMsg.setTargetIp(targetIp);
nettyProxyMsg.setTargetPort(targetPort);
nettyProxyMsg.setClientTargetIp(targetIp);
nettyProxyMsg.setClientTargetPort(targetPort);
nettyProxyMsg.setVisitorId(visitorId);
transferChannel.writeAndFlush(nettyProxyMsg);

View File

@@ -10,7 +10,7 @@ import org.framework.lazy.cloud.network.heartbeat.client.config.NettyClientPrope
import org.framework.lazy.cloud.network.heartbeat.client.netty.permeate.NettyClientPermeateServerVisitor;
import org.framework.lazy.cloud.network.heartbeat.client.netty.permeate.tcp.filter.NettyTcpClientPermeateServerTransferFilter;
import org.framework.lazy.cloud.network.heartbeat.common.constant.TcpMessageType;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.adapter.ChannelTypeAdapter;
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
@@ -74,8 +74,8 @@ public class NettyTcpClientPermeateServerVisitorTransferSocket {
myMsg.setType(TcpMessageType.TCP_REPORT_CLIENT_TRANSFER_SERVER_PERMEATE_CHANNEL_CONNECTION_SUCCESSFUL);
myMsg.setClientId(clientId);
myMsg.setVisitorPort(visitorPort);
myMsg.setTargetIp(targetIp);
myMsg.setTargetPort(targetPort);
myMsg.setClientTargetIp(targetIp);
myMsg.setClientTargetPort(targetPort);
myMsg.setVisitorId(visitorId);
ChannelAttributeKeyUtils.buildVisitorId(transferChannel, visitorId);
ChannelAttributeKeyUtils.buildClientId(transferChannel, clientId);

View File

@@ -10,11 +10,11 @@ import lombok.extern.slf4j.Slf4j;
import org.framework.lazy.cloud.network.heartbeat.client.netty.permeate.NettyClientSocket;
import org.framework.lazy.cloud.network.heartbeat.client.netty.permeate.event.ClientChangeEvent;
import org.framework.lazy.cloud.network.heartbeat.client.netty.permeate.tcp.filter.NettyTcpClientFilter;
import org.framework.lazy.cloud.network.heartbeat.common.constant.TcpMessageType;
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.NettyServerContext;
import org.framework.lazy.cloud.network.heartbeat.common.adapter.ChannelTypeAdapter;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.HandleChannelTypeAdvanced;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.constant.TcpMessageType;
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
import java.net.InetAddress;
@@ -41,6 +41,10 @@ public class NettyTcpClientSocket implements NettyClientSocket {
@Getter
private final String clientId;
/**
* 当前连接的服务端ID
*/
private final String serverId;
private final String appKey;
private final String appSecret;
/**
@@ -53,6 +57,7 @@ public class NettyTcpClientSocket implements NettyClientSocket {
public NettyTcpClientSocket(String inetHost,
int inetPort,
String clientId,
String serverId,
String appKey,
String appSecret,
ClientChangeEvent clientChangeEvent,
@@ -60,6 +65,7 @@ public class NettyTcpClientSocket implements NettyClientSocket {
this.inetHost = inetHost;
this.inetPort = inetPort;
this.clientId = clientId;
this.serverId = serverId;
this.appKey = appKey;
this.appSecret = appSecret;
this.clientChangeEvent = clientChangeEvent;
@@ -67,7 +73,7 @@ public class NettyTcpClientSocket implements NettyClientSocket {
}
protected void newTcpConnect2Server(String inetHost, int inetPort, String clientId, ClientChangeEvent clientChangeEvent) throws InterruptedException {
protected void newTcpConnect2Server(String inetHost, int inetPort, String clientId, String serverId, ClientChangeEvent clientChangeEvent) throws InterruptedException {
Bootstrap bootstrap = new Bootstrap();
bootstrap.group(eventLoopGroup)
.channel(NioSocketChannel.class)
@@ -82,7 +88,7 @@ public class NettyTcpClientSocket implements NettyClientSocket {
.option(ChannelOption.WRITE_BUFFER_WATER_MARK, new WriteBufferWaterMark(1024 * 1024, 1024 * 1024 * 2))
.handler(new NettyTcpClientFilter(new ChannelTypeAdapter(handleChannelTypeAdvancedList), this))
;
log.info("use clientId:{} connect to server IP:{},server port :{}", clientId, inetHost, inetPort);
log.info("use clientId:{} connect to server IP:{},server port :{}", clientId, inetHost, inetPort);
ChannelFuture future = bootstrap.connect(inetHost, inetPort);
// 客户端连接服务端的channel
Channel serviceChannel = future.channel();
@@ -90,7 +96,7 @@ public class NettyTcpClientSocket implements NettyClientSocket {
future.addListener((ChannelFutureListener) futureListener -> {
if (futureListener.isSuccess()) {
log.info("clientId:{},connect to server IP:{},server port :{} isSuccess ", clientId, inetHost, inetPort);
log.info("clientId:{},connect to server IP:{},server port :{} isSuccess ", clientId, inetHost, inetPort);
// 告诉服务端这条连接是client的连接
NettyProxyMsg nettyMsg = new NettyProxyMsg();
nettyMsg.setType(TcpMessageType.TCP_REPORT_CLIENT_CONNECT_SUCCESS);
@@ -103,17 +109,17 @@ public class NettyTcpClientSocket implements NettyClientSocket {
ChannelAttributeKeyUtils.buildClientId(serviceChannel, clientId);
serviceChannel.writeAndFlush(nettyMsg);
NettyServerContext.pushServerEndpointChannel(clientId, serviceChannel);
NettyServerContext.pushServerEndpointChannel(serverId, clientId, serviceChannel);
// 在线 客户端注册服务端成功
clientChangeEvent.clientOnLine(inetHost, inetPort, clientId);
clientChangeEvent.clientOnLine(inetHost, inetPort,serverId, clientId);
} else {
log.warn("Reconnect every 2 seconds....");
// 离线
NettyServerContext.removeServerEndpointChannels(clientId);
clientChangeEvent.clientOffLine(inetHost, inetPort, clientId);
NettyServerContext.removeServerEndpointChannels(serverId, clientId);
clientChangeEvent.clientOffLine(inetHost, inetPort,serverId, clientId);
eventLoopGroup.schedule(() -> {
try {
newTcpConnect2Server(inetHost, inetPort, clientId, clientChangeEvent);
newTcpConnect2Server(inetHost, inetPort, clientId, serverId, clientChangeEvent);
} catch (InterruptedException e) {
e.printStackTrace();
}
@@ -139,6 +145,6 @@ public class NettyTcpClientSocket implements NettyClientSocket {
*/
@Override
public void newConnect2Server() throws InterruptedException {
newTcpConnect2Server(inetHost, inetPort, clientId, clientChangeEvent);
newTcpConnect2Server(inetHost, inetPort, clientId, serverId, clientChangeEvent);
}
}

View File

@@ -11,7 +11,6 @@ import org.framework.lazy.cloud.network.heartbeat.client.netty.permeate.tcp.filt
import org.framework.lazy.cloud.network.heartbeat.client.netty.permeate.tcp.filter.NettyTcpServerPermeateClientTransferFilter;
import org.framework.lazy.cloud.network.heartbeat.common.*;
import org.framework.lazy.cloud.network.heartbeat.common.adapter.ChannelTypeAdapter;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.HandleChannelTypeAdvanced;
import org.framework.lazy.cloud.network.heartbeat.common.constant.TcpMessageType;
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
@@ -181,8 +180,8 @@ public class NettyTcpServerPermeateClientRealSocket {
myMsg.setType(TcpMessageType.TCP_REPORT_SINGLE_CLIENT_REAL_CONNECT);
myMsg.setClientId(visitorClientId);
myMsg.setVisitorPort(visitorPort);
myMsg.setTargetIp(clientTargetIp);
myMsg.setTargetPort(clientTargetPort);
myMsg.setClientTargetIp(clientTargetIp);
myMsg.setClientTargetPort(clientTargetPort);
myMsg.setVisitorId(visitorId);
transferChannel.writeAndFlush(myMsg);

View File

@@ -1,32 +1,29 @@
package org.framework.lazy.cloud.network.heartbeat.client.netty.permeate.udp.advanced;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyChannelContext;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.permeate.udp.AbstractUdpHandleChannelHeartbeatTypeAdvanced;
import io.netty.channel.Channel;
import org.framework.lazy.cloud.network.heartbeat.common.constant.UdpMessageType;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.Role;
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.permeate.udp.AbstractUdpHandleChannelHeartbeatTypeAdvanced;
/**
* 服务端 处理客户端心跳
* UDP_TYPE_HEARTBEAT
*/
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public class ClientHandleUdpChannelHeartbeatTypeAdvanced extends AbstractUdpHandleChannelHeartbeatTypeAdvanced<NettyProxyMsg> {
/**
* 处理当前数据
*
* @param nettyChannelContext 当前通道
* @param channel 当前通道
* @param msg 通道数据
*/
@Override
public void doHandler(NettyChannelContext nettyChannelContext, NettyProxyMsg msg) {
NettyProxyMsg nettyProxyMsg = new NettyProxyMsg();
nettyProxyMsg.setType(UdpMessageType.UDP_TYPE_HEARTBEAT);
// nettyChannelContext.writeAndFlush(nettyProxyMsg);
public void doHandler(Channel channel, NettyProxyMsg msg) {
NettyProxyMsg hb = new NettyProxyMsg();
hb.setType(UdpMessageType.UDP_TYPE_HEARTBEAT);
// channel.writeAndFlush(hb);
}
}

View File

@@ -5,13 +5,10 @@ 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.advanced.payload.NettyChannelContext;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.permeate.udp.client.AbstractHandleUdpDistributeServicePermeateClientTransferTypeAdvanced;
import org.framework.lazy.cloud.network.heartbeat.common.enums.UdpMessageTypeEnums;
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.Role;
/**
@@ -19,7 +16,6 @@ import org.springframework.context.annotation.Role;
*
* @see UdpMessageTypeEnums#UDP_DISTRIBUTE_CLIENT_TRANSFER
*/
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
@Slf4j
public class ClientHandleUdpChannelTransferTypeAdvancedHandleDistribute extends AbstractHandleUdpDistributeServicePermeateClientTransferTypeAdvanced<NettyProxyMsg> {
@@ -32,17 +28,16 @@ public class ClientHandleUdpChannelTransferTypeAdvancedHandleDistribute extends
/**
* 处理当前数据
*
* @param nettyChannelContext 当前通道
* @param channel 当前通道
* @param nettyProxyMsg 通道数据
*/
@Override
public void doHandler(NettyChannelContext nettyChannelContext, NettyProxyMsg nettyProxyMsg) {
Channel channel = nettyChannelContext.channel();
public void doHandler(Channel channel, NettyProxyMsg nettyProxyMsg) {
log.debug("接收到服务端需要内网穿透的数据:{}" , nettyProxyMsg);
String clientId = nettyClientProperties.getClientId();
byte[] visitorPort = nettyProxyMsg.getVisitorPort();
byte[] clientTargetIp = nettyProxyMsg.getTargetIp();
byte[] clientTargetPort = nettyProxyMsg.getTargetPort();
byte[] clientTargetIp = nettyProxyMsg.getClientTargetIp();
byte[] clientTargetPort = nettyProxyMsg.getClientTargetPort();
byte[] visitorId = nettyProxyMsg.getVisitorId();
// 真实服务通道
// Channel realChannel = NettyRealIdContext.getReal(new String(visitorId));

View File

@@ -3,17 +3,13 @@ package org.framework.lazy.cloud.network.heartbeat.client.netty.permeate.udp.adv
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.advanced.payload.NettyChannelContext;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.permeate.udp.client.AbstractHandleUdpClientChannelActiveAdvanced;
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.Role;
/**
* 客户端通道 is active
*/
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public class ClientHandleUdpClientChannelActiveAdvanced extends AbstractHandleUdpClientChannelActiveAdvanced<NettyProxyMsg> {
private final NettyClientProperties nettyClientProperties;
@@ -24,16 +20,14 @@ public class ClientHandleUdpClientChannelActiveAdvanced extends AbstractHandleUd
/**
* 处理当前数据
*
* @param nettyChannelContext 当前通道
* @param channel 当前通道
* @param nettyProxyMsg 通道数据
*/
@Override
protected void doHandler(NettyChannelContext nettyChannelContext, NettyProxyMsg nettyProxyMsg) {
Channel channel = nettyChannelContext.channel();
protected void doHandler(Channel channel, NettyProxyMsg nettyProxyMsg) {
// 缓存当前通道
byte[] clientIdByte = nettyProxyMsg.getClientId();
String clientId = new String(clientIdByte);
String serverId = new String(clientIdByte);
ChannelContext.push(channel, clientId);
ChannelAttributeKeyUtils.buildClientId(channel, clientId);
}

View File

@@ -1,15 +1,13 @@
package org.framework.lazy.cloud.network.heartbeat.client.netty.permeate.udp.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.NettyVisitorPortContext;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyChannelContext;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.permeate.udp.client.AbstractHandleUdpDistributeClientPermeateClientCloseTypeAdvanced;
import org.framework.lazy.cloud.network.heartbeat.common.enums.UdpMessageTypeEnums;
import org.framework.lazy.cloud.network.heartbeat.common.socket.PermeateVisitorSocket;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.Role;
/**
@@ -17,7 +15,6 @@ import org.springframework.context.annotation.Role;
*
* @see UdpMessageTypeEnums#UDP_DISTRIBUTE_CLIENT_PERMEATE_CLIENT_CLOSE
*/
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
@Slf4j
public class ClientHandleUdpDistributeClientPermeateClientCloseTypeAdvanced extends AbstractHandleUdpDistributeClientPermeateClientCloseTypeAdvanced<NettyProxyMsg> {
@@ -25,11 +22,11 @@ public class ClientHandleUdpDistributeClientPermeateClientCloseTypeAdvanced exte
/**
* 处理当前数据
*
* @param nettyChannelContext 当前通道
* @param channel 当前通道
* @param nettyProxyMsg 通道数据
*/
@Override
public void doHandler(NettyChannelContext nettyChannelContext, NettyProxyMsg nettyProxyMsg) {
public void doHandler(Channel channel, NettyProxyMsg nettyProxyMsg) {
// 初始化 客户端渗透服务端socket
byte[] msgVisitorPort = nettyProxyMsg.getVisitorPort();
Integer visitorPort = Integer.parseInt(new String(msgVisitorPort));

View File

@@ -1,16 +1,14 @@
package org.framework.lazy.cloud.network.heartbeat.client.netty.permeate.udp.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.permeate.udp.socket.NettyUdpClientPermeateClientVisitorSocket;
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.payload.NettyChannelContext;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.permeate.udp.client.AbstractHandleUdpDistributeClientPermeateClientInitTypeAdvanced;
import org.framework.lazy.cloud.network.heartbeat.common.enums.TcpMessageTypeEnums;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.Role;
import org.wu.framework.spring.utils.SpringContextHolder;
import java.util.ArrayList;
@@ -22,27 +20,26 @@ import java.util.List;
*
* @see TcpMessageTypeEnums#TCP_DISTRIBUTE_CLIENT_PERMEATE_CLIENT_INIT
*/
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
@Slf4j
public class ClientHandleUdpDistributeClientPermeateClientInitTypeAdvanced extends AbstractHandleUdpDistributeClientPermeateClientInitTypeAdvanced<NettyProxyMsg> {
/**
* 处理当前数据
*
* @param nettyChannelContext 当前通道
* @param channel 当前通道
* @param nettyProxyMsg 通道数据
*/
@Override
public void doHandler(NettyChannelContext nettyChannelContext, NettyProxyMsg nettyProxyMsg) {
public void doHandler(Channel channel, NettyProxyMsg nettyProxyMsg) {
// 初始化 客户端渗透服务端socket
byte[] originClientIdBytes = nettyProxyMsg.getClientId();
byte[] fromClientIdBytes = nettyProxyMsg.getClientId();
byte[] visitorPortBytes = nettyProxyMsg.getVisitorPort();
byte[] clientTargetIpBytes = nettyProxyMsg.getTargetIp();
byte[] clientTargetPortBytes = nettyProxyMsg.getTargetPort();
byte[] targetClientIdBytes = nettyProxyMsg.getData();
byte[] clientTargetIpBytes = nettyProxyMsg.getClientTargetIp();
byte[] clientTargetPortBytes = nettyProxyMsg.getClientTargetPort();
byte[] toClientIdBytes = nettyProxyMsg.getData();
String originClientId = new String(originClientIdBytes);
String targetClientId = new String(targetClientIdBytes);
String fromClientId = new String(fromClientIdBytes);
String toClientId = new String(toClientIdBytes);
Integer visitorPort = Integer.parseInt(new String(visitorPortBytes));
String clientTargetIp = new String(clientTargetIpBytes);
Integer clientTargetPort = Integer.parseInt(new String(clientTargetPortBytes));
@@ -50,17 +47,17 @@ public class ClientHandleUdpDistributeClientPermeateClientInitTypeAdvanced exten
List<HandleChannelTypeAdvanced> handleChannelTypeAdvancedList = new ArrayList<>(SpringContextHolder.getApplicationContext().getBeansOfType(HandleChannelTypeAdvanced.class).values());
// ChannelFlowAdapter channelFlowAdapter = SpringContextHolder.getBean(ChannelFlowAdapter.class);
NettyClientProperties nettyClientProperties = SpringContextHolder.getBean(NettyClientProperties.class);
log.info("client permeate client from client_id:【{}】 target_client_id【{}】with visitor_port【{}】, clientTargetIp:【{}】clientTargetPort:【{}】",
originClientId, targetClientId, visitorPort, clientTargetIp, clientTargetPort);
log.info("client permeate client from client_id:【{}】 to_client_id【{}】with visitor_port【{}】, clientTargetIp:【{}】clientTargetPort:【{}】",
fromClientId, toClientId, visitorPort, clientTargetIp, clientTargetPort);
NettyUdpClientPermeateClientVisitorSocket nettyTcpClientPermeateClientVisitorSocket =
NettyUdpClientPermeateClientVisitorSocket.NettyClientPermeateClientVisitorSocketBuilder.builder()
.builderClientId(originClientId)
.builderClientId(fromClientId)
.builderClientTargetIp(clientTargetIp)
.builderClientTargetPort(clientTargetPort)
.builderVisitorPort(visitorPort)
.builderNettyClientProperties(nettyClientProperties)
// .builderChannelFlowAdapter(channelFlowAdapter)
.builderToClientId(targetClientId)
.builderToClientId(toClientId)
.builderHandleChannelTypeAdvancedList(handleChannelTypeAdvancedList)
.build();

View File

@@ -3,13 +3,10 @@ package org.framework.lazy.cloud.network.heartbeat.client.netty.permeate.udp.adv
import io.netty.channel.Channel;
import lombok.extern.slf4j.Slf4j;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyChannelContext;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.permeate.udp.client.AbstractHandleUdpDistributeClientPermeateClientTransferCloseTypeAdvanced;
import org.framework.lazy.cloud.network.heartbeat.common.enums.UdpMessageTypeEnums;
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.Role;
/**
@@ -17,19 +14,17 @@ import org.springframework.context.annotation.Role;
*
* @see UdpMessageTypeEnums#UDP_DISTRIBUTE_CLIENT_PERMEATE_CLIENT_TRANSFER_CLOSE
*/
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
@Slf4j
public class ClientHandleUdpDistributeClientPermeateClientTransferCloseTypeAdvanced extends AbstractHandleUdpDistributeClientPermeateClientTransferCloseTypeAdvanced<NettyProxyMsg> {
/**
* 处理当前数据
*
* @param nettyChannelContext 当前通道
* @param channel 当前通道
* @param nettyProxyMsg 通道数据
*/
@Override
public void doHandler(NettyChannelContext nettyChannelContext, NettyProxyMsg nettyProxyMsg) {
Channel channel = nettyChannelContext.channel();
public void doHandler(Channel channel, NettyProxyMsg nettyProxyMsg) {
// 关闭客户端真实通道、访客通道
Channel realChannel = ChannelAttributeKeyUtils.getNextChannel(channel);
realChannel.close();// 真实通道关闭

View File

@@ -1,15 +1,13 @@
package org.framework.lazy.cloud.network.heartbeat.client.netty.permeate.udp.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.NettyVisitorPortContext;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyChannelContext;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.permeate.udp.client.AbstractHandleUdpDistributeClientPermeateServerCloseTypeAdvanced;
import org.framework.lazy.cloud.network.heartbeat.common.enums.UdpMessageTypeEnums;
import org.framework.lazy.cloud.network.heartbeat.common.socket.PermeateVisitorSocket;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.Role;
/**
@@ -17,7 +15,6 @@ import org.springframework.context.annotation.Role;
*
* @see UdpMessageTypeEnums#UDP_DISTRIBUTE_CLIENT_PERMEATE_SERVER_CLOSE
*/
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
@Slf4j
public class ClientHandleUdpDistributeClientPermeateServerCloseTypeAdvanced extends AbstractHandleUdpDistributeClientPermeateServerCloseTypeAdvanced<NettyProxyMsg> {
@@ -25,11 +22,11 @@ public class ClientHandleUdpDistributeClientPermeateServerCloseTypeAdvanced exte
/**
* 处理当前数据
*
* @param nettyChannelContext 当前通道
* @param channel 当前通道
* @param nettyProxyMsg 通道数据
*/
@Override
public void doHandler(NettyChannelContext nettyChannelContext, NettyProxyMsg nettyProxyMsg) {
public void doHandler(Channel channel, NettyProxyMsg nettyProxyMsg) {
// 初始化 客户端渗透服务端socket
byte[] msgVisitorPort = nettyProxyMsg.getVisitorPort();
Integer visitorPort = Integer.parseInt(new String(msgVisitorPort));

View File

@@ -1,16 +1,14 @@
package org.framework.lazy.cloud.network.heartbeat.client.netty.permeate.udp.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.permeate.udp.socket.NettyUdpClientPermeateServerVisitorSocket;
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.payload.NettyChannelContext;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.permeate.udp.client.AbstractHandleUdpDistributeClientPermeateServerInitTypeAdvanced;
import org.framework.lazy.cloud.network.heartbeat.common.enums.TcpMessageTypeEnums;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.Role;
import org.wu.framework.spring.utils.SpringContextHolder;
import java.util.ArrayList;
@@ -22,7 +20,6 @@ import java.util.List;
*
* @see TcpMessageTypeEnums#TCP_DISTRIBUTE_CLIENT_PERMEATE_SERVER_INIT
*/
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
@Slf4j
public class ClientHandleUdpDistributeClientPermeateServerInitTypeAdvanced extends AbstractHandleUdpDistributeClientPermeateServerInitTypeAdvanced<NettyProxyMsg> {
@@ -35,16 +32,16 @@ public class ClientHandleUdpDistributeClientPermeateServerInitTypeAdvanced exten
/**
* 处理当前数据
*
* @param nettyChannelContext 当前通道
* @param channel 当前通道
* @param nettyProxyMsg 通道数据
*/
@Override
public void doHandler(NettyChannelContext nettyChannelContext, NettyProxyMsg nettyProxyMsg) {
public void doHandler(Channel channel, NettyProxyMsg nettyProxyMsg) {
// 初始化 客户端渗透服务端socket
byte[] clientIdBytes = nettyProxyMsg.getClientId();
byte[] visitorPort = nettyProxyMsg.getVisitorPort();
byte[] clientTargetIp = nettyProxyMsg.getTargetIp();
byte[] clientTargetPort = nettyProxyMsg.getTargetPort();
byte[] clientTargetIp = nettyProxyMsg.getClientTargetIp();
byte[] clientTargetPort = nettyProxyMsg.getClientTargetPort();
List<HandleChannelTypeAdvanced> handleChannelTypeAdvancedList = new ArrayList<>(SpringContextHolder.getApplicationContext().getBeansOfType(HandleChannelTypeAdvanced.class).values());
NettyUdpClientPermeateServerVisitorSocket nettyTcpClientPermeateServerVisitorSocket = NettyUdpClientPermeateServerVisitorSocket.NettyVisitorSocketBuilder.builder()

View File

@@ -3,13 +3,10 @@ package org.framework.lazy.cloud.network.heartbeat.client.netty.permeate.udp.adv
import io.netty.channel.Channel;
import lombok.extern.slf4j.Slf4j;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyChannelContext;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.permeate.udp.client.AbstractHandleUdpDistributeClientPermeateServerTransferCloseTypeAdvanced;
import org.framework.lazy.cloud.network.heartbeat.common.enums.UdpMessageTypeEnums;
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.Role;
/**
@@ -17,19 +14,17 @@ import org.springframework.context.annotation.Role;
*
* @see UdpMessageTypeEnums#UDP_DISTRIBUTE_CLIENT_PERMEATE_SERVER_TRANSFER_CLOSE
*/
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
@Slf4j
public class ClientHandleUdpDistributeClientPermeateServerTransferCloseTypeAdvanced extends AbstractHandleUdpDistributeClientPermeateServerTransferCloseTypeAdvanced<NettyProxyMsg> {
/**
* 处理当前数据
*
* @param nettyChannelContext 当前通道
* @param channel 当前通道
* @param nettyProxyMsg 通道数据
*/
@Override
public void doHandler(NettyChannelContext nettyChannelContext, NettyProxyMsg nettyProxyMsg) {
Channel channel = nettyChannelContext.channel();
public void doHandler(Channel channel, NettyProxyMsg nettyProxyMsg) {
// 关闭本地通信通道
Channel nextChannel = ChannelAttributeKeyUtils.getNextChannel(channel);
channel.close();

View File

@@ -4,13 +4,10 @@ package org.framework.lazy.cloud.network.heartbeat.client.netty.permeate.udp.adv
import io.netty.buffer.ByteBuf;
import io.netty.channel.Channel;
import lombok.extern.slf4j.Slf4j;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyChannelContext;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.permeate.udp.client.AbstractHandleUdpDistributeClientPermeateServerTransferTypeAdvanced;
import org.framework.lazy.cloud.network.heartbeat.common.enums.UdpMessageTypeEnums;
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.Role;
/**
@@ -18,7 +15,6 @@ import org.springframework.context.annotation.Role;
*
* @see UdpMessageTypeEnums#UDP_DISTRIBUTE_CLIENT_TRANSFER
*/
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
@Slf4j
public class ClientHandleUdpDistributeClientPermeateServerTransferTypeAdvanced extends AbstractHandleUdpDistributeClientPermeateServerTransferTypeAdvanced<NettyProxyMsg> {
@@ -26,16 +22,15 @@ public class ClientHandleUdpDistributeClientPermeateServerTransferTypeAdvanced e
/**
* 处理当前数据
*
* @param nettyChannelContext 当前通道
* @param channel 当前通道
* @param nettyProxyMsg 通道数据
*/
@Override
public void doHandler(NettyChannelContext nettyChannelContext, NettyProxyMsg nettyProxyMsg) {
Channel channel = nettyChannelContext.channel();
public void doHandler(Channel channel, NettyProxyMsg nettyProxyMsg) {
log.debug("客户端渗透服务端返回数据:{}" , new String(nettyProxyMsg.getData()));
byte[] visitorPort = nettyProxyMsg.getVisitorPort();
byte[] clientTargetIp = nettyProxyMsg.getTargetIp();
byte[] clientTargetPort = nettyProxyMsg.getTargetPort();
byte[] clientTargetIp = nettyProxyMsg.getClientTargetIp();
byte[] clientTargetPort = nettyProxyMsg.getClientTargetPort();
byte[] visitorId = nettyProxyMsg.getVisitorId();
// 真实服务通道
// Channel realChannel = NettyRealIdContext.getReal(new String(visitorId));

View File

@@ -1,15 +1,13 @@
package org.framework.lazy.cloud.network.heartbeat.client.netty.permeate.udp.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.permeate.udp.socket.NettyUdpClientPermeateClientRealSocket;
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.payload.NettyChannelContext;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.permeate.udp.client.AbstractHandleUdpDistributeClientTransferClientPermeateChannelConnectionSuccessfulTypeAdvanced;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.Role;
import org.wu.framework.spring.utils.SpringContextHolder;
import java.util.ArrayList;
@@ -22,22 +20,21 @@ import java.util.List;
*
* @see MessageTypeEnums#UDP_DISTRIBUTE_CLIENT_TRANSFER_CLIENT_PERMEATE_CHANNEL_CONNECTION_SUCCESSFUL
*/
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
@Slf4j
public class ClientHandleUdpDistributeClientTransferClientPermeateChannelConnectionSuccessfulTypeAdvanced extends AbstractHandleUdpDistributeClientTransferClientPermeateChannelConnectionSuccessfulTypeAdvanced<NettyProxyMsg> {
/**
* 处理当前数据
*
* @param nettyChannelContext 当前通道
* @param channel 当前通道
* @param nettyProxyMsg 通道数据
*/
@Override
public void doHandler(NettyChannelContext nettyChannelContext, NettyProxyMsg nettyProxyMsg) {
public void doHandler(Channel channel, NettyProxyMsg nettyProxyMsg) {
// 创建connect 然后发送创建成功
byte[] msgClientId = nettyProxyMsg.getClientId();
byte[] msgClientTargetIp = nettyProxyMsg.getTargetIp();
byte[] msgClientTargetPort = nettyProxyMsg.getTargetPort();
byte[] msgClientTargetIp = nettyProxyMsg.getClientTargetIp();
byte[] msgClientTargetPort = nettyProxyMsg.getClientTargetPort();
byte[] msgVisitorId = nettyProxyMsg.getVisitorId();
byte[] msgVisitorPort = nettyProxyMsg.getVisitorPort();

View File

@@ -4,13 +4,10 @@ package org.framework.lazy.cloud.network.heartbeat.client.netty.permeate.udp.adv
import io.netty.channel.Channel;
import io.netty.channel.ChannelOption;
import lombok.extern.slf4j.Slf4j;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyChannelContext;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.permeate.udp.client.AbstractHandleUdpDistributeClientTransferClientPermeateChannelInitSuccessfulTypeAdvanced;
import org.framework.lazy.cloud.network.heartbeat.common.enums.UdpMessageTypeEnums;
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.Role;
/**
@@ -19,7 +16,6 @@ import org.springframework.context.annotation.Role;
*
* @see UdpMessageTypeEnums#UDP_DISTRIBUTE_CLIENT_TRANSFER_CLIENT_PERMEATE_CHANNEL_CONNECTION_SUCCESSFUL
*/
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
@Slf4j
public class ClientHandleUdpDistributeClientTransferClientPermeateChannelInitSuccessfulTypeAdvanced extends AbstractHandleUdpDistributeClientTransferClientPermeateChannelInitSuccessfulTypeAdvanced<NettyProxyMsg> {
@@ -28,16 +24,15 @@ public class ClientHandleUdpDistributeClientTransferClientPermeateChannelInitSuc
/**
* 处理当前数据
*
* @param nettyChannelContext 当前通道
* @param channel 当前通道
* @param nettyProxyMsg 通道数据
*/
@Override
public void doHandler(NettyChannelContext nettyChannelContext, NettyProxyMsg nettyProxyMsg) {
Channel channel = nettyChannelContext.channel();
public void doHandler(Channel channel, NettyProxyMsg nettyProxyMsg) {
// 连接成功 开启自动读取写
byte[] msgClientId = nettyProxyMsg.getClientId();
byte[] msgClientTargetIp = nettyProxyMsg.getTargetIp();
byte[] msgClientTargetPort = nettyProxyMsg.getTargetPort();
byte[] msgClientTargetIp = nettyProxyMsg.getClientTargetIp();
byte[] msgClientTargetPort = nettyProxyMsg.getClientTargetPort();
byte[] msgVisitorId = nettyProxyMsg.getVisitorId();
byte[] msgVisitorPort = nettyProxyMsg.getVisitorPort();

View File

@@ -4,13 +4,10 @@ package org.framework.lazy.cloud.network.heartbeat.client.netty.permeate.udp.adv
import io.netty.buffer.ByteBuf;
import io.netty.channel.Channel;
import lombok.extern.slf4j.Slf4j;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyChannelContext;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.permeate.udp.client.AbstractHandleUdpDistributeClientTransferClientRequestTypeAdvanced;
import org.framework.lazy.cloud.network.heartbeat.common.enums.UdpMessageTypeEnums;
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.Role;
/**
@@ -19,7 +16,6 @@ import org.springframework.context.annotation.Role;
*
* @see UdpMessageTypeEnums#UDP_DISTRIBUTE_CLIENT_PERMEATE_CLIENT_TRANSFER_REQUEST
*/
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
@Slf4j
public class ClientHandleUdpDistributeClientTransferClientRequestTypeAdvanced extends AbstractHandleUdpDistributeClientTransferClientRequestTypeAdvanced<NettyProxyMsg> {
@@ -28,12 +24,11 @@ public class ClientHandleUdpDistributeClientTransferClientRequestTypeAdvanced ex
/**
* 处理当前数据
*
* @param nettyChannelContext 当前通道
* @param channel 当前通道
* @param nettyProxyMsg 通道数据
*/
@Override
public void doHandler(NettyChannelContext nettyChannelContext, NettyProxyMsg nettyProxyMsg) {
Channel channel = nettyChannelContext.channel();
public void doHandler(Channel channel, NettyProxyMsg nettyProxyMsg) {
Channel nextChannel = ChannelAttributeKeyUtils.getNextChannel(channel);
// 把数据转到真实服务
ByteBuf buf = channel.config().getAllocator().buffer(nettyProxyMsg.getData().length);

View File

@@ -6,13 +6,10 @@ import io.netty.channel.ChannelOption;
import lombok.extern.slf4j.Slf4j;
import org.framework.lazy.cloud.network.heartbeat.client.netty.permeate.udp.handler.NettyUdpClientPermeateServerVisitorHandler;
import org.framework.lazy.cloud.network.heartbeat.client.netty.permeate.udp.socket.NettyUdpClientPermeateServerVisitorTransferSocket;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyChannelContext;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.permeate.udp.client.AbstractHandleUdpDistributeClientTransferServerPermeateChannelConnectionSuccessfulTypeAdvanced;
import org.framework.lazy.cloud.network.heartbeat.common.enums.UdpMessageTypeEnums;
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.Role;
/**
@@ -22,7 +19,6 @@ import org.springframework.context.annotation.Role;
*
* @see UdpMessageTypeEnums#UDP_DISTRIBUTE_CLIENT_TRANSFER_SERVER_PERMEATE_CHANNEL_CONNECTION_SUCCESSFUL
*/
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
@Slf4j
public class ClientHandleUdpDistributeClientTransferServerPermeateChannelConnectionSuccessfulTypeAdvanced extends AbstractHandleUdpDistributeClientTransferServerPermeateChannelConnectionSuccessfulTypeAdvanced<NettyProxyMsg> {
@@ -31,16 +27,15 @@ public class ClientHandleUdpDistributeClientTransferServerPermeateChannelConnect
/**
* 处理当前数据
*
* @param nettyChannelContext 当前通道
* @param transferChannel 当前通道
* @param nettyProxyMsg 通道数据
*/
@Override
public void doHandler(NettyChannelContext nettyChannelContext, NettyProxyMsg nettyProxyMsg) {
Channel channel = nettyChannelContext.channel();
public void doHandler(Channel transferChannel, NettyProxyMsg nettyProxyMsg) {
// 连接成功 开启自动读取写
byte[] msgVisitorId = nettyProxyMsg.getVisitorId();
String visitorId = new String(msgVisitorId);
Channel nextChannel = ChannelAttributeKeyUtils.getNextChannel(channel);
Channel nextChannel = ChannelAttributeKeyUtils.getNextChannel(transferChannel);
nextChannel.config().setOption(ChannelOption.AUTO_READ, true);
}

View File

@@ -1,20 +1,17 @@
package org.framework.lazy.cloud.network.heartbeat.client.netty.permeate.udp.advanced;
import com.alibaba.fastjson.JSONObject;
import io.netty.channel.Channel;
import lombok.extern.slf4j.Slf4j;
import org.framework.lazy.cloud.network.heartbeat.client.netty.permeate.event.ClientChangeEvent;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyChannelContext;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.permeate.udp.client.AbstractHandleUdpDistributeConnectSuccessNotificationTypeAdvancedHandle;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.Role;
import java.util.List;
/**
* 客户端连接成功通知
*/
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
@Slf4j
public class ClientHandleUdpDistributeConnectSuccessNotificationTypeAdvancedHandle extends AbstractHandleUdpDistributeConnectSuccessNotificationTypeAdvancedHandle<NettyProxyMsg> {
@@ -28,11 +25,11 @@ public class ClientHandleUdpDistributeConnectSuccessNotificationTypeAdvancedHand
/**
* 处理当前数据
*
* @param nettyChannelContext 当前通道
* @param channel 当前通道
* @param msg 通道数据
*/
@Override
protected void doHandler(NettyChannelContext nettyChannelContext, NettyProxyMsg msg) {
protected void doHandler(Channel channel, NettyProxyMsg msg) {
// 客户端ID{},客户端:{}连接成功
log.warn("Client ID: {}, Client Data : {} Connection successful", new String(msg.getClientId()), new String(msg.getData()));

View File

@@ -1,20 +1,17 @@
package org.framework.lazy.cloud.network.heartbeat.client.netty.permeate.udp.advanced;
import io.netty.channel.Channel;
import lombok.extern.slf4j.Slf4j;
import org.framework.lazy.cloud.network.heartbeat.client.netty.permeate.event.ClientChangeEvent;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyChannelContext;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.permeate.udp.client.AbstractHandleUdpDistributeDisconnectTypeAdvancedHandle;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.Role;
/**
* 服务端处理客户端断开连接处理
* TYPE_DISCONNECT
*/
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
@Slf4j
public class ClientHandleUdpDistributeDisconnectTypeAdvancedHandle extends AbstractHandleUdpDistributeDisconnectTypeAdvancedHandle<NettyProxyMsg> {
@@ -28,11 +25,11 @@ public class ClientHandleUdpDistributeDisconnectTypeAdvancedHandle extends Abstr
/**
* 处理当前数据
*
* @param nettyChannelContext 当前通道
* @param channel 当前通道
* @param msg 通道数据
*/
@Override
public void doHandler(NettyChannelContext nettyChannelContext, NettyProxyMsg msg) {
public void doHandler(Channel channel, NettyProxyMsg msg) {
// 服务下线
byte[] data = msg.getData();
byte[] clientId = msg.getClientId();

View File

@@ -1,15 +1,13 @@
package org.framework.lazy.cloud.network.heartbeat.client.netty.permeate.udp.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.permeate.udp.socket.NettyUdpServerPermeateClientRealSocket;
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.payload.NettyChannelContext;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.permeate.udp.client.AbstractHandleUdpDistributeServicePermeateClientRealConnectTypeAdvanced;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.Role;
import org.wu.framework.spring.utils.SpringContextHolder;
import java.util.ArrayList;
@@ -18,7 +16,6 @@ import java.util.List;
/**
* 客户端创建真实代理同奥
*/
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
@Slf4j
public class ClientHandleUdpDistributeServicePermeateClientRealConnectTypeAdvanced extends AbstractHandleUdpDistributeServicePermeateClientRealConnectTypeAdvanced<NettyProxyMsg> {
@@ -32,16 +29,16 @@ public class ClientHandleUdpDistributeServicePermeateClientRealConnectTypeAdvanc
/**
* 处理当前数据
*
* @param nettyChannelContext 当前通道
* @param channel 当前通道
* @param msg 通道数据
*/
@Override
protected void doHandler(NettyChannelContext nettyChannelContext, NettyProxyMsg msg) {
protected void doHandler(Channel channel, NettyProxyMsg msg) {
// 创建真实端口监听
byte[] clientIdBytes = msg.getClientId();
byte[] visitorPort = msg.getVisitorPort();
byte[] clientTargetIp = msg.getTargetIp();
byte[] clientTargetPort = msg.getTargetPort();
byte[] clientTargetIp = msg.getClientTargetIp();
byte[] clientTargetPort = msg.getClientTargetPort();
byte[] visitorIdBytes = msg.getVisitorId();
InternalNetworkPenetrationRealClient internalNetworkPenetrationRealClient =
InternalNetworkPenetrationRealClient

View File

@@ -4,13 +4,10 @@ package org.framework.lazy.cloud.network.heartbeat.client.netty.permeate.udp.adv
import io.netty.buffer.ByteBuf;
import io.netty.channel.Channel;
import lombok.extern.slf4j.Slf4j;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyChannelContext;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.permeate.udp.client.AbstractHandleUdpDistributeServicePermeateClientTransferClientResponseTypeAdvanced;
import org.framework.lazy.cloud.network.heartbeat.common.enums.UdpMessageTypeEnums;
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.Role;
/**
@@ -19,7 +16,6 @@ import org.springframework.context.annotation.Role;
*
* @see UdpMessageTypeEnums#UDP_DISTRIBUTE_CLIENT_PERMEATE_CLIENT_TRANSFER_RESPONSE
*/
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
@Slf4j
public class ClientHandleUdpDistributeServicePermeateClientTransferClientResponseTypeAdvanced extends AbstractHandleUdpDistributeServicePermeateClientTransferClientResponseTypeAdvanced<NettyProxyMsg> {
@@ -28,12 +24,11 @@ public class ClientHandleUdpDistributeServicePermeateClientTransferClientRespons
/**
* 处理当前数据
*
* @param nettyChannelContext 当前通道
* @param channel 当前通道
* @param nettyProxyMsg 通道数据
*/
@Override
public void doHandler(NettyChannelContext nettyChannelContext, NettyProxyMsg nettyProxyMsg) {
Channel channel = nettyChannelContext.channel();
public void doHandler(Channel channel, NettyProxyMsg nettyProxyMsg) {
Channel nextChannel = ChannelAttributeKeyUtils.getNextChannel(channel);
// 把数据转到真实服务
ByteBuf buf = channel.config().getAllocator().buffer(nettyProxyMsg.getData().length);

Some files were not shown because too many files have changed in this diff Show More