Compare commits

..
Author SHA1 Message Date
aoshiguchen b5d30e227c 新增2.0.1发版文章. 2023-12-20 10:05:38 +08:00
aoshiguchen 88790c7f36 新增2.0.1发版文章 2023-12-19 18:01:29 +08:00
aoshiguchen c30755c663 更新官网安装部署文档 2023-12-19 15:44:37 +08:00
aoshiguchen 2e81bfbe2c 更新官网里程碑 2023-12-19 15:26:41 +08:00
aoshiguchen f49898b9b0 更新官网管理后台文档. 2023-12-19 14:56:12 +08:00
aoshiguchen 74d36fc5d1 更新官网赞赏列表 2023-12-19 14:13:33 +08:00
aoshiguchen fb5980e577 新增运行示例截图 2023-12-19 14:07:58 +08:00
aoshiguchen b9277d142c 更新官网首页 2023-12-19 11:32:44 +08:00
aoshiguchen 81b0a28e2c 更新官网里程碑、版本记录 2023-12-19 11:09:17 +08:00
aoshiguchen 59d47e6bf1 更新revision 2023-12-19 10:46:33 +08:00
aoshiguchen 7255701084 workflow调整 2023-12-18 22:31:26 +08:00
aoshiguchen 99b3b673f1 workflow调整. 2023-12-18 21:45:26 +08:00
aoshiguchen f6f6017f8a 更新版本日志 2023-12-18 19:20:22 +08:00
aoshiguchen fc0830acfe 解决使用映射域名上传文件连接断开的问题 2023-12-18 18:39:23 +08:00
aoshiguchen 9baee2c909 调整workflow. 2023-12-18 16:43:19 +08:00
aoshiguchen 6558a8c327 调整workflow 2023-12-18 16:27:22 +08:00
aoshiguchen ffa8ee502c Merge remote-tracking branch 'origin/dev' into dev 2023-12-18 15:44:29 +08:00
aoshiguchen 4c993316de . 2023-12-18 15:44:21 +08:00
songyinyin d451424de8 Github Action: fix 前端打包 2023-12-18 15:35:49 +08:00
songyinyin 754070e795 Github Action: 临时上传构建物 2023-12-18 14:43:54 +08:00
aoshiguchen b21fd8e2d9 注释无用测试类. 2023-12-18 13:50:28 +08:00
aoshiguchen 4f5fc5dfbc 注释无用测试类 2023-12-18 13:39:06 +08:00
aoshiguchen d1eba19cb9 注释无用测试类 2023-12-18 13:38:37 +08:00
songyinyin efb3a7015d Merge remote-tracking branch 'origin/dev' into dev 2023-12-18 12:00:16 +08:00
songyinyin 47efe37a0e Github Action: 构建物的版本号使用 pom 文件中定义的 2023-12-18 12:00:06 +08:00
aoshiguchen 0ad05e7dc8 端口映射分页优化,解决license被删除后,端口映射分页报错的问题 2023-12-18 11:53:44 +08:00
aoshiguchen 9576707660 限速描述支持小数,如1.5M、3.7M 2023-12-18 11:36:27 +08:00
aoshiguchen 168acd6bfe 更新版本日志. 2023-12-18 11:30:09 +08:00
aoshiguchen ad32e36ba2 . 2023-12-18 10:47:55 +08:00
aoshiguchen 00fd0bab84 限速相关处理优化 2023-12-16 16:07:47 +08:00
songyinyin 8f90cf461d 原生编译:注册 netty 在 jdk 21 中新使用的类 2023-12-15 18:18:00 +08:00
39 changed files with 240 additions and 133 deletions
+33 -12
View File
@@ -12,7 +12,7 @@ jobs:
fail-fast: false
matrix:
# see: https://docs.github.com/zh/actions/using-jobs/choosing-the-runner-for-a-job
# os: ['ubuntu-20.04', 'macos-12']
# os: ['ubuntu-20.04', 'macos-12']
os: ['ubuntu-20.04']
name: build - ${{ matrix.os }}
runs-on: ${{ matrix.os }}
@@ -30,7 +30,7 @@ jobs:
run: |
cd neutrino-proxy-admin
npm install
npm run build:docker·
npm run build:docker
cp -rf ./dist/ ./../neutrino-proxy-server/src/main/resources/static/
- name: GitHub Action for GraalVM JDK 21
uses: graalvm/setup-graalvm@v1
@@ -45,34 +45,55 @@ jobs:
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Set vars
shell: bash
run: |
OS=$(echo '${{ runner.os }}' | awk '{print tolower($0)}')
[[ $OS == 'ubuntu' ]] && echo "OS=linux" >> $GITHUB_ENV || echo "OS=$OS" >> $GITHUB_ENV
[[ $OS == 'macos' ]] && echo "OS=darwin" >> $GITHUB_ENV || echo "OS=$OS" >> $GITHUB_ENV
echo "VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV
- name: Build with Maven (neutrino-proxy-server)
run: |
mvn clean install -pl neutrino-proxy-core -am -DskipTests --no-transfer-progress
cd neutrino-proxy-server
mvn clean native:compile -P native --file pom.xml --no-transfer-progress
chmod +x target/neutrino-proxy-server
cp target/neutrino-proxy-server ./../neutrino-proxy-server-${{ github.ref_name }}
cp target/classes/app-copy.yml ./../neutrino-proxy-server-${{ github.ref_name }}/app.yml
mkdir ./../neutrino-proxy-server-${{ env.OS }}-${{ env.VERSION }}-native
cp target/neutrino-proxy-server ./../neutrino-proxy-server-${{ env.OS }}-${{ env.VERSION }}-native/neutrino-proxy-server
cp target/classes/app-copy.yml ./../neutrino-proxy-server-${{ env.OS }}-${{ env.VERSION }}-native/app.yml
- name: Archive zip (neutrino-proxy-server)
uses: thedoctor0/zip-release@master
with:
type: 'zip'
path: 'neutrino-proxy-server-${{ github.ref_name }}'
filename: neutrino-proxy-server-${{ matrix.os }}-${{ github.ref_name }}.zip
path: 'neutrino-proxy-server-${{ env.OS }}-${{ env.VERSION }}-native'
filename: neutrino-proxy-server-${{ env.OS }}-${{ env.VERSION }}-native.zip
- name: Build with Maven (neutrino-proxy-client)
run: |
cd neutrino-proxy-client
mvn clean package --file pom.xml --no-transfer-progress
mvn clean native:compile -P native --file pom.xml --no-transfer-progress
chmod +x target/neutrino-proxy-client
cp target/neutrino-proxy-client ./../neutrino-proxy-client-${{ github.ref_name }}
cp target/classes/app-copy.yml ./../neutrino-proxy-client-${{ github.ref_name }}/app.yml
mkdir ./../neutrino-proxy-client-${{ env.OS }}-${{ env.VERSION }}-native
cp target/neutrino-proxy-client ./../neutrino-proxy-client-${{ env.OS }}-${{ env.VERSION }}-native/neutrino-proxy-client
cp target/classes/app-copy.yml ./../neutrino-proxy-client-${{ env.OS }}-${{ env.VERSION }}-native/app.yml
- name: Archive zip (neutrino-proxy-client)
uses: thedoctor0/zip-release@master
with:
type: 'zip'
path: 'neutrino-proxy-client-${{ github.ref_name }}'
filename: neutrino-proxy-client-${{ matrix.os }}-${{ github.ref_name }}.zip
path: 'neutrino-proxy-client-${{ env.OS }}-${{ env.VERSION }}-native'
filename: neutrino-proxy-client-${{ env.OS }}-${{ env.VERSION }}-native.zip
# 上传构建产物
- name: Upload artifact
uses: actions/[email protected]
with:
name: neutrino-proxy-server-client-${{ env.OS }}-${{ env.VERSION }}
path: |
neutrino-proxy-server/target/neutrino-proxy-server.jar
neutrino-proxy-client/target/neutrino-proxy-client.jar
neutrino-proxy-server-${{ env.OS }}-${{ env.VERSION }}-native.zip
neutrino-proxy-client-${{ env.OS }}-${{ env.VERSION }}-native.zip
# 保存时间,默认 90 天
retention-days: 5
# GitHub 上创建 release
- name: Release
uses: softprops/action-gh-release@v1
@@ -81,7 +102,7 @@ jobs:
files: |
neutrino-proxy-server/target/neutrino-proxy-server.jar
neutrino-proxy-client/target/neutrino-proxy-client.jar
neutrino-proxy-server-${{ matrix.os }}-${{ github.ref_name }}.zip
neutrino-proxy-client-${{ matrix.os }}-${{ github.ref_name }}.zip
neutrino-proxy-server-${{ env.OS }}-${{ env.VERSION }}-native.zip
neutrino-proxy-client-${{ env.OS }}-${{ env.VERSION }}-native.zip
prerelease: true
token: ${{ secrets.GITHUB_TOKEN }}
+31 -8
View File
@@ -44,32 +44,55 @@ jobs:
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Set vars
shell: bash
run: |
OS=$(echo '${{ runner.os }}' | awk '{print tolower($0)}')
[[ $OS == 'ubuntu' ]] && echo "OS=linux" >> $GITHUB_ENV || echo "OS=$OS" >> $GITHUB_ENV
[[ $OS == 'macos' ]] && echo "OS=darwin" >> $GITHUB_ENV || echo "OS=$OS" >> $GITHUB_ENV
echo "VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV
- name: Build with Maven (neutrino-proxy-server)
run: |
set MAVEN_OPTS="-Duser.language=UTF-8 -Dfile.encoding=UTF-8"
mvn clean install -pl neutrino-proxy-core -am -DskipTests --no-transfer-progress
cd neutrino-proxy-server
mvn clean native:compile -P native --file pom.xml --no-transfer-progress
cp target/neutrino-proxy-server.exe ./../neutrino-proxy-server.exe
mkdir ./../neutrino-proxy-server-${{ env.OS }}-${{ env.VERSION }}-native
cp target/neutrino-proxy-server.exe ./../neutrino-proxy-server-${{ env.OS }}-${{ env.VERSION }}-native/neutrino-proxy-server.exe
cp target/classes/app-copy.yml ./../neutrino-proxy-server-${{ env.OS }}-${{ env.VERSION }}-native/app.yml
- name: Archive zip (neutrino-proxy-server)
uses: thedoctor0/zip-release@master
with:
type: 'zip'
path: 'neutrino-proxy-server.exe'
filename: neutrino-proxy-server-${{ matrix.os }}-${{ github.ref_name }}.zip
path: 'neutrino-proxy-server-${{ env.OS }}-${{ env.VERSION }}-native'
filename: neutrino-proxy-server-${{ env.OS }}-${{ env.VERSION }}-native.zip
- name: Build with Maven (neutrino-proxy-client)
run: |
set MAVEN_OPTS="-Duser.language=UTF-8 -Dfile.encoding=UTF-8"
cd neutrino-proxy-client
mvn clean package --file pom.xml --no-transfer-progress
mvn clean native:compile -P native --file pom.xml --no-transfer-progress
cp target/neutrino-proxy-client.exe ./../neutrino-proxy-client.exe
mkdir ./../neutrino-proxy-client-${{ env.OS }}-${{ env.VERSION }}-native
cp target/neutrino-proxy-client.exe ./../neutrino-proxy-client-${{ env.OS }}-${{ env.VERSION }}-native/neutrino-proxy-client.exe
cp target/classes/app-copy.yml ./../neutrino-proxy-client-${{ env.OS }}-${{ env.VERSION }}-native/app.yml
- name: Archive zip (neutrino-proxy-client)
uses: thedoctor0/zip-release@master
with:
type: 'zip'
path: 'neutrino-proxy-client.exe'
filename: neutrino-proxy-client-${{ matrix.os }}-${{ github.ref_name }}.zip
path: 'neutrino-proxy-client-${{ env.OS }}-${{ env.VERSION }}-native'
filename: neutrino-proxy-client-${{ env.OS }}-${{ env.VERSION }}-native.zip
# 上传构建产物
- name: Upload artifact
uses: actions/[email protected]
with:
name: neutrino-proxy-server-client-${{ env.OS }}-${{ env.VERSION }}
path: |
neutrino-proxy-server/target/neutrino-proxy-server.jar
neutrino-proxy-client/target/neutrino-proxy-client.jar
neutrino-proxy-server-${{ env.OS }}-${{ env.VERSION }}-native.zip
neutrino-proxy-client-${{ env.OS }}-${{ env.VERSION }}-native.zip
# 保存时间,默认 90 天
retention-days: 5
# GitHub 上创建 release
- name: Release
uses: softprops/action-gh-release@v1
@@ -78,7 +101,7 @@ jobs:
files: |
neutrino-proxy-server/target/neutrino-proxy-server.jar
neutrino-proxy-client/target/neutrino-proxy-client.jar
neutrino-proxy-server-${{ matrix.os }}-${{ github.ref_name }}.zip
neutrino-proxy-client-${{ matrix.os }}-${{ github.ref_name }}.zip
neutrino-proxy-server-${{ env.OS }}-${{ env.VERSION }}-native.zip
neutrino-proxy-client-${{ env.OS }}-${{ env.VERSION }}-native.zip
prerelease: true
token: ${{ secrets.GITHUB_TOKEN }}
+2
View File
@@ -14,3 +14,5 @@
- 2023-09-07 1.8.6版本发布,后台若干细节优化
- 2023-09-22 1.9.0版本发布,端口映射支持UDP协议
- 2023-09-25 中微子代理Gitee Star数突破1000
- 2023-10-31 2.0.0版本发布,升级jdk版本至jdk17、支持原生编译、去掉sqlite改为默认H2数据库
- 2023-12-21 2.0.1版本发布,jdk版本升级到21,支持安全组(黑/白名单IP限制)、限速
+4 -4
View File
@@ -75,7 +75,7 @@
## 2.0.1
- jdk版本升级为21
- native部署,后台新增提交到后端,数据库乱码问题
- 解决HTTP(S)映射时使用tcp端口访问正常,使用域名访问偶现一直loading的问题
- [ ] 支持被代理服务获取访问者真实ip
- [ ] 支持对用户、license限速
- 新增安全组模块,支持黑名单、白名单限制
- 支持对用户、license限速
- 修复HTTP(S)映射时使用tcp端口访问正常,使用域名访问偶现一直loading的问题
- 修复HTTP(S)映射时使用映射的域名上传文件时,连接中断的问题
Binary file not shown.

After

Width:  |  Height:  |  Size: 175 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 262 KiB

After

Width:  |  Height:  |  Size: 243 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 143 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 123 KiB

+62
View File
@@ -0,0 +1,62 @@
# NeutrinoProxy2.0.1发布,新增IP访问拦截+限速支持
## 项目简介
- [中微子代理(neutrino-proxy)](https://gitee.com/asgc/neutrino-proxy) 是一款基于Solon、Netty的内网穿透神器。该项目采用最为宽松的MIT协议,因此您可以对它进行复制、修改、传播并用于任何个人或商业行为。
- 市面上基于内网穿透的常见产品有:花生壳、TeamView、cpolar等。
- 常见的使用场景:
- 本地开发调试第三方回调
- 本地开发异地接口连调
- 远程登录内网windows机器
- 将本地服务映射到外网,用于演示
- Gitee仓库:https://gitee.com/dromara/neutrino-proxy
- Github仓库:https://github.com/dromara/neutrino-proxy
- 官网地址1: https://neutrino-proxy.dromara.org
- 官网地址2: https://dromara.gitee.io/neutrino-proxy
## 主要特点:
- 1、流量监控:首页图表、报表管理多维度流量监控。全方位掌握实时、历史代理数据。
- 2、用户/License:支持多用户、多客户端使用。后台禁用实时生效。
- 3、端口池:对外端口统一管理,支持用户、License独占端口。
- 4、端口映射:新增、编辑、删除、禁用实时生效。
- 5、Docker:服务端/客户端支持Docker一键部署。
- 6、SSL证书:隧道通信支持SSL加密,保护您的数据安全。
- 7、域名映射:支持绑定子域名,方便本地调试三方回调
- 8、多种协议:支持代理TCP、HTTP、HTTPS、UDP协议
- 9、原生部署:支持编译为原生可执行文件,更低部署门槛、更少内存占用
- 10、安全组:支持黑/白名单IP访问限制
- 11、限速:支持对License、端口映射限制上传/下载速度
- 12、采用最为宽松的MIT协议,免去你的后顾之忧
## 本次更新内容
- jdk版本升级为21
- 新增安全组模块,支持黑名单、白名单限制
- 支持对用户、license限速
- 修复HTTP(S)映射时使用tcp端口访问正常,使用域名访问偶现一直loading的问题
- 修复HTTP(S)映射时使用映射的域名上传文件时,连接中断的问题
## 安装使用说明
- 快速上手:https://neutrino-proxy.dromara.org/neutrino-proxy/pages/793dcb/
- 升级须知:
- jdk版本升级为了jdk21,jar部署时请注意
- 涉及到表结构变更,执行增量SQLhttps://gitee.com/dromara/neutrino-proxy/blob/master/neutrino-proxy-server/src/main/resources/sql/mysql/update/UPDATE-20231215.SQL
## 运行示例
#### License限速
<img src="./license2.png" width="100%"/>
#### 端口映射限速
<img src="./port-mapping2.png" width="100%"/>
#### 安全组
<img src="./security-group1.png" width="100%"/>
<img src="./security-rule1.png" width="100%"/>
## 联系我们
笔者时间、能力有限,且开源项目非一朝一夕之事,存在众多问题亦在所难免。使用、学习过程中有任何问题欢迎大家与我联系。
对项目有什么想法或者建议,可以加我微信拉交流群,或者创建[issues](https://gitee.com/dromara/neutrino-proxy/issues),一起完善项目
- 微信号:yuyunshize
- Email: aoshiguchen@dromara.org
- 微信二维码(添加时请备注"中微子进群"):
<img src="MyWeChatQRCode.jpeg" width="100%"/>
Binary file not shown.

After

Width:  |  Height:  |  Size: 175 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 243 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 143 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 KiB

@@ -50,6 +50,8 @@ public interface Constants {
AttributeKey<InetSocketAddress> SENDER = AttributeKey.newInstance("sender");
AttributeKey<Integer> SERVER_PORT = AttributeKey.newInstance("serverPort");
AttributeKey<String> REAL_REMOTE_IP = AttributeKey.newInstance("realRemoteIp");
AttributeKey<Boolean> FLOW_LIMITER_FLAG = AttributeKey.newInstance("flowLimiterFlag");
@@ -8,6 +8,7 @@ import org.noear.solon.aot.RuntimeNativeRegistrar;
import org.noear.solon.aot.hint.MemberCategory;
import org.noear.solon.core.AppContext;
import java.nio.ByteBuffer;
import java.util.Set;
/**
@@ -22,6 +23,11 @@ public class NeutrinoCoreRuntimeNativeRegistrar implements RuntimeNativeRegistra
metadata.registerReflection(clazz, MemberCategory.INVOKE_DECLARED_METHODS);
}
Set<Class<?>> byteBufferClasses = ClassUtil.scanPackageBySuper("java", ByteBuffer.class);
for (Class<?> clazz : byteBufferClasses) {
metadata.registerReflection(clazz, MemberCategory.INVOKE_DECLARED_METHODS);
}
metadata.registerReflection(ProxyMessage.class, MemberCategory.DECLARED_FIELDS, MemberCategory.INVOKE_DECLARED_METHODS, MemberCategory.INVOKE_DECLARED_CONSTRUCTORS);
metadata.registerReflection(ProxyMessage.UdpBaseInfo.class, MemberCategory.DECLARED_FIELDS, MemberCategory.INVOKE_DECLARED_METHODS, MemberCategory.INVOKE_DECLARED_CONSTRUCTORS);
@@ -77,8 +77,8 @@ public class ProxyConfiguration implements LifecycleBean {
}
ch.pipeline().addFirst(new BytesMetricsHandler());
// ch.pipeline().addLast(new ChannelTrafficShapingHandler(1024 * 1024 * 20, 1024 * 1024 * 20, 100, 20000));
ch.pipeline().addLast("security", new TcpVisitorSecurityChannelHandler());
ch.pipeline().addLast(new VisitorFlowLimiterChannelHandler());
ch.pipeline().addLast(new TcpVisitorSecurityChannelHandler());
ch.pipeline().addLast("flowLimiter", new VisitorFlowLimiterChannelHandler());
ch.pipeline().addLast(new TcpVisitorChannelHandler());
}
});
@@ -116,8 +116,8 @@ public class ProxyConfiguration implements LifecycleBean {
if (null != proxyConfig.getServer().getUdp().getTransferLogEnable() && proxyConfig.getServer().getUdp().getTransferLogEnable()) {
ch.pipeline().addFirst(new LoggingHandler(UdpVisitorChannelHandler.class));
}
pipeline.addLast(udpServerWorkerGroup, "security", new UdpVisitorSecurityChannelHandler());
ch.pipeline().addLast(new VisitorFlowLimiterChannelHandler());
pipeline.addLast(udpServerWorkerGroup, new UdpVisitorSecurityChannelHandler());
ch.pipeline().addLast("flowLimiter", new VisitorFlowLimiterChannelHandler());
pipeline.addLast(udpServerWorkerGroup, new UdpVisitorChannelHandler());
}
});
@@ -48,8 +48,8 @@ public class HttpProxy implements EventListener<AppLoadEndEvent> {
ch.pipeline().addFirst(new LoggingHandler(HttpProxy.class));
}
ch.pipeline().addFirst(new BytesMetricsHandler());
ch.pipeline().addLast("security", new HttpVisitorSecurityChannelHandler(proxyConfig.getServer().getTcp().getDomainName()));
ch.pipeline().addLast(new VisitorFlowLimiterChannelHandler());
ch.pipeline().addLast(new HttpVisitorSecurityChannelHandler(proxyConfig.getServer().getTcp().getDomainName()));
ch.pipeline().addLast("flowLimiter",new VisitorFlowLimiterChannelHandler());
ch.pipeline().addLast(new HttpVisitorChannelHandler());
}
});
@@ -57,8 +57,8 @@ public class HttpsProxy implements EventListener<AppLoadEndEvent> {
}
ch.pipeline().addLast(createSslHandler());
ch.pipeline().addFirst(new BytesMetricsHandler());
ch.pipeline().addLast("security", new HttpVisitorSecurityChannelHandler(proxyConfig.getServer().getTcp().getDomainName()));
ch.pipeline().addLast(new VisitorFlowLimiterChannelHandler());
ch.pipeline().addLast(new HttpVisitorSecurityChannelHandler(proxyConfig.getServer().getTcp().getDomainName()));
ch.pipeline().addLast("flowLimiter",new VisitorFlowLimiterChannelHandler());
ch.pipeline().addLast(new HttpVisitorChannelHandler());
}
});
@@ -39,47 +39,52 @@ public class HttpVisitorSecurityChannelHandler extends ChannelInboundHandlerAdap
}
ByteBuf buf = (ByteBuf) msg;
byte[] bytes = new byte[buf.readableBytes()];
buf.readBytes(bytes);
// 获取Host请求头
String httpContent = new String(bytes);
String host = HttpUtil.getHostIgnorePort(httpContent);
log.debug("HttpProxy host: {}", host);
if (StringUtils.isBlank(host)) {
ctx.channel().close();
return;
}
// 根据Host匹配端口映射
if (!host.endsWith(domainName)) {
ctx.channel().close();
return;
}
int index = host.lastIndexOf("." + domainName);
String subdomain = host.substring(0, index);
// 根据域名拿到绑定的映射对应的cmdChannel
Integer serverPort = ProxyUtil.getServerPortBySubdomain(subdomain);
Integer serverPort = ctx.channel().attr(Constants.SERVER_PORT).get();
if (null == serverPort) {
ctx.channel().close();
return;
}
// 获取Host请求头
byte[] bytes = new byte[buf.readableBytes()];
buf.readBytes(bytes);
String httpContent = new String(bytes);
String host = HttpUtil.getHostIgnorePort(httpContent);
// 判断IP是否在该端口绑定的安全组允许的规则内
String ip = IpUtil.getRealRemoteIp(httpContent);
if (ip == null) {
ip = IpUtil.getRemoteIp(ctx);
}
if (!securityGroupService.judgeAllow(ip, portMappingService.getSecurityGroupIdByMappingPort(serverPort))) {
// 不在安全组规则放行范围内
ctx.channel().close();
return;
log.debug("HttpProxy host: {}", host);
if (StringUtils.isBlank(host)) {
ctx.channel().close();
return;
}
// 根据Host匹配端口映射
if (!host.endsWith(domainName)) {
ctx.channel().close();
return;
}
int index = host.lastIndexOf("." + domainName);
String subdomain = host.substring(0, index);
// 根据域名拿到绑定的映射对应的cmdChannel
serverPort = ProxyUtil.getServerPortBySubdomain(subdomain);
if (null == serverPort) {
ctx.channel().close();
return;
}
// 判断IP是否在该端口绑定的安全组允许的规则内
String ip = IpUtil.getRealRemoteIp(httpContent);
if (ip == null) {
ip = IpUtil.getRemoteIp(ctx);
}
if (!securityGroupService.judgeAllow(ip, portMappingService.getSecurityGroupIdByMappingPort(serverPort))) {
// 不在安全组规则放行范围内
ctx.channel().close();
return;
}
ctx.channel().attr(Constants.REAL_REMOTE_IP).set(ip);
ctx.channel().attr(Constants.SERVER_PORT).set(serverPort);
}
// 继续传播
ctx.channel().attr(Constants.SERVER_PORT).set(serverPort);
buf.resetReaderIndex();
ctx.fireChannelRead(buf);
}
@@ -18,8 +18,6 @@ import org.noear.solon.Solon;
*/
@Slf4j
public class VisitorFlowLimiterChannelHandler extends ChannelInboundHandlerAdapter {
private final LicenseService licenseService = Solon.context().getBean(LicenseService.class);
private final PortMappingService portMappingService = Solon.context().getBean(PortMappingService.class);
@Override
@@ -38,7 +36,7 @@ public class VisitorFlowLimiterChannelHandler extends ChannelInboundHandlerAdapt
}
if (null != upLimitRate || null != downLimitRate) {
// 如果不全为空,则需要做限速
ctx.pipeline().addAfter("security", "trafficShaping", new ChannelTrafficShapingHandler(downLimitRate == null ? 0 : downLimitRate, upLimitRate == null ? 0 : upLimitRate, 100, 600000));
ctx.pipeline().addAfter("flowLimiter", "trafficShaping", new ChannelTrafficShapingHandler(downLimitRate == null ? 0 : downLimitRate, upLimitRate == null ? 0 : upLimitRate, 100, 600000));
}
// 每个连接第一次处理之后。无论是否限速,该连接后续都不在处理,避免频繁执行影响性能
@@ -138,7 +138,9 @@ public class PortMappingService implements LifecycleBean {
}
});
//sorted [userId asc] [licenseId asc] [createTime asc]
respList = respList.stream().sorted(Comparator.comparing(PortMappingListRes::getUserId).thenComparing(PortMappingListRes::getLicenseId).thenComparing(PortMappingListRes::getCreateTime)).collect(Collectors.toList());
respList = respList.stream()
.filter(e -> null != e.getUserId())
.sorted(Comparator.comparing(PortMappingListRes::getUserId).thenComparing(PortMappingListRes::getLicenseId).thenComparing(PortMappingListRes::getCreateTime)).collect(Collectors.toList());
return PageInfo.of(respList, page.getTotal(), pageQuery.getCurrent(), pageQuery.getSize());
}
@@ -15,7 +15,7 @@ public class StringUtil {
private static final Integer BYTES_MUL_GB = BYTES_MUL_MB * 1024;
private static final String[] BYTES_UNIT_STR = {"B", "K", "KB", "M", "MB", "G", "GB"};
private static final Integer[] BYTES_UNIT_MUL = {1, BYTES_MUL_KB, BYTES_MUL_KB, BYTES_MUL_MB, BYTES_MUL_MB, BYTES_MUL_GB, BYTES_MUL_GB};
private static final String BYTES_DESC_REGEX = "\\s*(\\d+)\\s*(B|K|KB|M|MB|G|GB)\\s*";
private static final String BYTES_DESC_REGEX = "\\s*(\\d+\\.*\\d*)\\s*(B|K|KB|M|MB|G|GB)\\s*";
private static final Pattern BYTES_DESC_PATTERN = Pattern.compile(BYTES_DESC_REGEX);
/**
@@ -46,14 +46,14 @@ public class StringUtil {
if (!found) {
return null;
}
Integer n = Integer.parseInt(matcher.group(1));
Double n = Double.parseDouble(matcher.group(1));
String unit = matcher.group(2);
Integer unitIndex = getBytesUnitIndex(unit);
if (null == unitIndex) {
return null;
}
return (long)n * BYTES_UNIT_MUL[unitIndex];
return (long)(n * BYTES_UNIT_MUL[unitIndex]);
} catch (Exception e) {
// ignore
}
@@ -1,19 +0,0 @@
package org.dromara.neutrinoproxy.server;
import org.dromara.neutrinoproxy.core.util.NeutrinoProxyVersion;
import org.dromara.neutrinoproxy.server.app.AppBaseTest;
import org.junit.Assert;
import org.junit.Test;
/**
* @author songyinyin
* @since 2023/10/31 11:51
*/
public class VersionTest extends AppBaseTest {
@Test
public void testVersion() {
Assert.assertNotNull(NeutrinoProxyVersion.getVersion());
System.out.println("version: " + NeutrinoProxyVersion.getVersion());
}
}
@@ -1,15 +0,0 @@
package org.dromara.neutrinoproxy.server.app;
import org.dromara.neutrinoproxy.server.ProxyServer;
import org.junit.runner.RunWith;
import org.noear.solon.test.SolonJUnit4ClassRunner;
import org.noear.solon.test.SolonTest;
/**
* @author songyinyin
* @since 2023/10/31 11:56
*/
@SolonTest(value = ProxyServer.class, properties = "server.port=18888")
@RunWith(SolonJUnit4ClassRunner.class)
public class AppBaseTest {
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 175 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 243 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 143 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 KiB

@@ -6,13 +6,7 @@ article: false
---
::: tip
当前最新版本2.0.0,如果从之前的版本升级来,请注意以下变更
1、jdk版本升级为了jdk17,jar部署时请注意
2、去掉了默认的sqlite数据库,改为了h2。如果之前使用sqlite,请自行处理数据迁移
3、配置文件做了较大调整,请参照使用须知中的`服务端配置``客户端配置`进行更新
当前最新版本2.0.1。从之前的版本升级来,请参照:更新记录 > 版本记录
:::
## 1、快速上手须知
@@ -5,13 +5,13 @@ permalink: /pages/eebea1/
---
## 1、环境准备
- 首先确保已安装Java17运行环境
- 打开[发行版页面](https://gitee.com/dromara/neutrino-proxy/releases),下载最新的release包:`neutrino-proxy-server-jar.zip``neutrino-proxy-client-jar.zip`
- 首先确保已安装Java21运行环境
- 打开[发行版页面](https://gitee.com/dromara/neutrino-proxy/releases),下载最新的release包:`neutrino-proxy-server-jdk21-2.0.1-jar.zip``neutrino-proxy-client-jdk21-2.0.1-jar.zip`
## 2、部署服务端
- 在服务器上新建部署目录:`/work/projects/neutrino-proxy-server`
-`neutrino-proxy-server-jar.zip`上传至服务器部署目录,并解压
-`neutrino-proxy-server-jdk21-2.0.1-jar.zip`上传至服务器部署目录,并解压
- 执行命令`java -Dfile.encoding=utf-8 -jar neutrino-proxy-server.jar`启动服务端完成部署,默认使用h2数据库。
- 若需要指定自己的mysql数据库,则需要在当前目录下的`app.yml`文件中,修改数据库配置如下:
@@ -32,7 +32,7 @@ neutrino:
- 可参照 https://gitee.com/dromara/neutrino-proxy/blob/master/scripts/unix/server_start.sh 使用shell脚本启动服务端。
## 3、部署客户端
- 本地解压`neutrino-proxy-client-jar.zip`文件
- 本地解压`neutrino-proxy-client-jdk21-2.0.1-jar.zip`文件
- 修改`app.yml`文件中的server-ip为服务器公网ip,并配置license-key,以下是相关的部分配置:
```yml
neutrino:
@@ -18,7 +18,7 @@ permalink: /pages/69699a/
## 1、安装包下载
- 打开[发行版页面](https://gitee.com/dromara/neutrino-proxy/releases),下载所需的最新的release包:
- 比如服务器为linux则可下载`neutrino-proxy-server-ubuntu-20.04-native.zip`文件,客户端为windows则可下载`neutrino-proxy-client-windows-2022-native.zip`
- 比如服务器为linux则可下载`neutrino-proxy-server-linux-2.0.1-native.zip`文件,客户端为windows则可下载`neutrino-proxy-client-windows-2.0.1-native.zip`
## 2、部署服务端
- 将服务端安装包上传至服务器,并解压
@@ -17,8 +17,22 @@ article: false
# 代理配置
- License管理:License是客户端连接服务端的唯一合法凭证。一个License同时只能被一个客户端使用,一个License可以维护多条端口映射
- 端口映射:服务端IP+端口 -> 客户端IP+端口的四元组映射(因目前服务端单节点只有一个公网IP,所以不体现出来),是内网穿透的基本单元。
- 限速:
- 默认所有代理没有限速
- 对License限速,将使得License下的所有端口映射都被限速
- 若License设置了限速,License下的某条映射也设置了限速,则对于该映射优先采用端口映射上的限速规则
<img :src="$withBase('/img/run-example/license2.png')"></img>
<img :src="$withBase('/img/run-example/port-mapping2.png')"></img>
# 安全组
一个端口映射可绑定一个安全组,通过安全组的默认放行类型 + 安全组下的安全规则 控制该端口映射的安全访问规则。
- 场景1: 内部服务,穿透出来自己使用,不希望被其他人访问。端口映射可关联一个默认放行类型为“拒绝”的安全组,安全组下新增安全规则,将本地的出口ip添加到允许放行规则中。
- 场景2:公网服务,穿透出来开放给大家使用,但是希望拒绝某些IP访问。端口映射可关联一个默认放行类型为“允许”的安全组,安全组下新增安全规则,将黑名单ip添加到拒绝放行规则中。
<img :src="$withBase('/img/run-example/security-group1.png')"></img>
<img :src="$withBase('/img/run-example/security-rule1.png')"></img>
<img :src="$withBase('/img/run-example/license1.png')"></img>
# 系统管理
- 用户管理:支持多用户,一个用户可持有多个License。由于项目目前主推个人版,所以暂是没有权限这一套,管理员之外的所有用户都属于游客。对于绝大多数操作,游客仅有只读权限。
@@ -44,4 +58,4 @@ article: false
- 登录日志:管理后端登录、退出登录的日志
- 客户端连接日志:客户端连接、断开的日志
<img :src="$withBase('/img/run-example/login-log1.png')"></img>
<img :src="$withBase('/img/run-example/login-log1.png')"></img>
@@ -11,9 +11,9 @@ permalink: /pages/1ab20b/
|:-----|:-----|:----------------------|
| 任意金额 | - | 您将获得赞助者列表的永久留名。 |
| 30 | 一个月 | 您在群内反馈的问题将优先得到作者响应 |
| 80 | 三个月 | 获得微信一对一的咨询服务 |
| 180 | 个月 | 获得官网首页特别赞助席位一个,一次远程协助 |
| 更多金额 |-| 您将获得私人定制服务 |
| 120 | 三个月 | 获得微信一对一的咨询服务 |
| 399 | 个月 | 获得官网首页特别赞助席位一个,一次远程协助 |
| 更多金额 | - | 您将获得私人定制服务 |
> 注意1:服务项目是逐级叠加:如,您赞赏的金额是 80 员那么您将享受:任意金额、一个月、三个月的服务内容
@@ -6,6 +6,8 @@ permalink: /pages/cded59/
| 日期 | 渠道 | 金额 |昵称| 备注 |
|:-----------|:---|:-----|:-|:-----------------|
|2023-12-15|Gitee捐助|10|一杯香梨||
|2023-12-12|微信红包|50|喜鸽小宝||
|2023-11-30|Gitee捐助|10|26263|感谢您的开源项目!|
|2023-11-30|微信红包|10|姫野永遠||
| 2023-11-26 |微信转账|180|Teacher Du||
@@ -4,6 +4,16 @@ date: 2023-10-26 17:43:43
permalink: /pages/ff3519/
---
## 2.0.1
- jdk版本升级为21
- 新增安全组模块,支持黑名单、白名单限制
- 支持对用户、license限速
- 修复HTTP(S)映射时使用tcp端口访问正常,使用域名访问偶现一直loading的问题
- 修复HTTP(S)映射时使用映射的域名上传文件时,连接中断的问题
- 升级须知:
- jdk版本升级为了jdk21,jar部署时请注意
- 涉及到表结构变更,执行[增量SQL](https://gitee.com/dromara/neutrino-proxy/blob/master/neutrino-proxy-server/src/main/resources/sql/mysql/update/UPDATE-20231215.SQL)
## 2.0.0
- solon版本升级为`2.5.11`
- jdk版本升级为17
@@ -3,7 +3,7 @@ title: 里程碑
date: 2023-10-26 17:41:26
permalink: /pages/e406dd/
---
- 2023-12-21 2.0.1版本发布,jdk版本升级到21,支持安全组(黑/白名单IP限制)、限速
- 2023-10-31 2.0.0版本发布,升级jdk版本至jdk17、支持原生编译、去掉sqlite改为默认H2数据库
- 2023-09-25 中微子代理Gitee Star数突破1000
- 2023-09-22 1.9.0版本发布,端口映射支持UDP协议
+6 -6
View File
@@ -13,12 +13,12 @@ features: # 可选的
details: 首页图表、报表管理多维度流量监控。全方位掌握实时、历史代理数据。
- title: 域名映射
details: HTTP代理绑定子域名,开发调试三方回调更方便。
- title: 用户/License
details: 支持多用户、多客户端使用。后台禁用实时生效。
- title: 端口池
details: 对外端口统一管理,支持用户、License独占端口
- title: 端口映射
details: 新增、编辑、删除、禁用实时生效。
- title: 管理后台
details: 使用端口池统一管理对外代理端口,支持多用户、多客户端使用。端口/用户/License/端口映射在后台禁用实时生效。
- title: 安全组
details: 安全组模块支持黑/白名单IP访问限制
- title: 限速
details: 支持对License、端口映射限制上传、下载速率
- title: Docker
details: 服务端/客户端支持Docker一键部署。
- title: 隧道SSL加密
+1 -1
View File
@@ -26,7 +26,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven.compiler.encoding>UTF-8</maven.compiler.encoding>
<revision>2.0.1-SNAPSHOT</revision>
<revision>2.0.1</revision>
<native.version>0.9.28</native.version>