【fix】md

This commit is contained in:
wujiawei 2025-05-22 17:00:08 +08:00
parent afa4d5c360
commit 071b844d68
17 changed files with 52 additions and 187 deletions

BIN
Proxies_Config_1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 542 KiB

BIN
Proxies_Config_2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 528 KiB

BIN
Proxies_Config_3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 547 KiB

BIN
Proxies_Config_4.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 553 KiB

BIN
Proxifier3.8.0.dmg Normal file

Binary file not shown.

33
Proxy.md Normal file
View File

@ -0,0 +1,33 @@
### 使用手册
#### 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)

204
README.md
View File

@ -43,7 +43,8 @@ ORM操作数据库使用环境JDK17 Spring Boot 3.0.2。
- ![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)
@ -57,191 +58,6 @@ ORM操作数据库使用环境JDK17 Spring Boot 3.0.2。
![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();
}
}
}
```
##### 通过客户端与服务端建立的连接进行访客端口绑定
@ -255,6 +71,7 @@ public class NettyClientSocket {
1.内网穿透
2.服务端自主下发数据到客户端
3.流量监控
4.网络代理socks、http
### 项目结构
@ -341,4 +158,17 @@ public class NettyClientSocket {
![clientPerDayFlow.png](clientPerDayFlow.png)
客户端近七天使用流量
![clientPortPerDayFlow.png](clientPortPerDayFlow.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)

BIN
client_route.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 KiB

BIN
client_virtual_route.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 115 KiB

BIN
mac_http_proxy.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

BIN
mac_socks_proxy.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

BIN
proxy_inner_net_ui.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

BIN
server_route.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 122 KiB

BIN
server_virtual_route.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 119 KiB

View File

@ -34,4 +34,6 @@
[add] 新增http代理客户端代理服务端、客户端代理客户杜安、服务端代理客户端、服务端代理服务端
[add] 新增socks代理客户端代理服务端、客户端代理客户杜安、服务端代理客户端、服务端代理服务端
[add] 新增客户端路由管理、新增服务端路由管理
[add] 支持新增虚拟IP代理到指定的IP
[add] 通过页面配置,代理支持控制端口代理控制
#### 下一版本计划

BIN
windows_wifi_proxy.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 309 KiB

BIN
wlcn-proxy1.0-.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB