diff --git a/Proxies_Config_1.png b/Proxies_Config_1.png new file mode 100644 index 0000000..bdd55a1 Binary files /dev/null and b/Proxies_Config_1.png differ diff --git a/Proxies_Config_2.png b/Proxies_Config_2.png new file mode 100644 index 0000000..8a77362 Binary files /dev/null and b/Proxies_Config_2.png differ diff --git a/Proxies_Config_3.png b/Proxies_Config_3.png new file mode 100644 index 0000000..98df0dc Binary files /dev/null and b/Proxies_Config_3.png differ diff --git a/Proxies_Config_4.png b/Proxies_Config_4.png new file mode 100644 index 0000000..7a61dac Binary files /dev/null and b/Proxies_Config_4.png differ diff --git a/Proxifier3.8.0.dmg b/Proxifier3.8.0.dmg new file mode 100644 index 0000000..287a738 Binary files /dev/null and b/Proxifier3.8.0.dmg differ diff --git a/Proxy.md b/Proxy.md new file mode 100644 index 0000000..8c5bc93 --- /dev/null +++ b/Proxy.md @@ -0,0 +1,33 @@ +### 使用手册 +#### Mac 使用方式 +##### 获取socks或者http代理服务器信息 + 如:ip:127.0.0.1 port:9001(socks)、8001(http) +##### 使用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) \ No newline at end of file diff --git a/README.md b/README.md index 3d57345..95f1428 100644 --- a/README.md +++ b/README.md @@ -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 handleChannelTypeAdvancedList; // 处理服务端发送过来的数据类型 - - public NettyClientSocket(String inetHost, int inetPort, String clientId, ClientNettyConfigApplication clientChangeEvent, List 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) \ No newline at end of file +![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) \ No newline at end of file diff --git a/client_route.png b/client_route.png new file mode 100644 index 0000000..a757731 Binary files /dev/null and b/client_route.png differ diff --git a/client_virtual_route.png b/client_virtual_route.png new file mode 100644 index 0000000..09c0fef Binary files /dev/null and b/client_virtual_route.png differ diff --git a/mac_http_proxy.png b/mac_http_proxy.png new file mode 100644 index 0000000..ed6c0e7 Binary files /dev/null and b/mac_http_proxy.png differ diff --git a/mac_socks_proxy.png b/mac_socks_proxy.png new file mode 100644 index 0000000..2a2aafc Binary files /dev/null and b/mac_socks_proxy.png differ diff --git a/proxy_inner_net_ui.png b/proxy_inner_net_ui.png new file mode 100644 index 0000000..ef3812b Binary files /dev/null and b/proxy_inner_net_ui.png differ diff --git a/server_route.png b/server_route.png new file mode 100644 index 0000000..545a3e0 Binary files /dev/null and b/server_route.png differ diff --git a/server_virtual_route.png b/server_virtual_route.png new file mode 100644 index 0000000..bb42eb6 Binary files /dev/null and b/server_virtual_route.png differ diff --git a/version.md b/version.md index 37a5bcf..321dae9 100644 --- a/version.md +++ b/version.md @@ -34,4 +34,6 @@ [add] 新增http代理(客户端代理服务端、客户端代理客户杜安、服务端代理客户端、服务端代理服务端) [add] 新增socks代理(客户端代理服务端、客户端代理客户杜安、服务端代理客户端、服务端代理服务端) [add] 新增客户端路由管理、新增服务端路由管理 + [add] 支持新增虚拟IP,代理到指定的IP + [add] 通过页面配置,代理支持控制端口代理控制 #### 下一版本计划 \ No newline at end of file diff --git a/windows_wifi_proxy.png b/windows_wifi_proxy.png new file mode 100644 index 0000000..654a789 Binary files /dev/null and b/windows_wifi_proxy.png differ diff --git a/wlcn-proxy1.0-.png b/wlcn-proxy1.0-.png new file mode 100644 index 0000000..38cd12c Binary files /dev/null and b/wlcn-proxy1.0-.png differ