Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7255701084 | ||
|
|
99b3b673f1 | ||
|
|
f6f6017f8a | ||
|
|
fc0830acfe | ||
|
|
9baee2c909 | ||
|
|
6558a8c327 | ||
|
|
ffa8ee502c | ||
|
|
4c993316de | ||
|
|
d451424de8 | ||
|
|
754070e795 | ||
|
|
b21fd8e2d9 | ||
|
|
4f5fc5dfbc | ||
|
|
d1eba19cb9 |
@@ -30,7 +30,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
cd neutrino-proxy-admin
|
cd neutrino-proxy-admin
|
||||||
npm install
|
npm install
|
||||||
npm run build:docker·
|
npm run build:docker
|
||||||
cp -rf ./dist/ ./../neutrino-proxy-server/src/main/resources/static/
|
cp -rf ./dist/ ./../neutrino-proxy-server/src/main/resources/static/
|
||||||
- name: GitHub Action for GraalVM JDK 21
|
- name: GitHub Action for GraalVM JDK 21
|
||||||
uses: graalvm/setup-graalvm@v1
|
uses: graalvm/setup-graalvm@v1
|
||||||
@@ -58,28 +58,42 @@ jobs:
|
|||||||
cd neutrino-proxy-server
|
cd neutrino-proxy-server
|
||||||
mvn clean native:compile -P native --file pom.xml --no-transfer-progress
|
mvn clean native:compile -P native --file pom.xml --no-transfer-progress
|
||||||
chmod +x target/neutrino-proxy-server
|
chmod +x target/neutrino-proxy-server
|
||||||
cp target/neutrino-proxy-server ./../neutrino-proxy-server-${{ env.VERSION }}
|
mkdir ./../neutrino-proxy-server-${{ env.OS }}-${{ env.VERSION }}-native
|
||||||
cp target/classes/app-copy.yml ./../neutrino-proxy-server-${{ env.VERSION }}/app.yml
|
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)
|
- name: Archive zip (neutrino-proxy-server)
|
||||||
uses: thedoctor0/zip-release@master
|
uses: thedoctor0/zip-release@master
|
||||||
with:
|
with:
|
||||||
type: 'zip'
|
type: 'zip'
|
||||||
path: 'neutrino-proxy-server-${{ env.VERSION }}'
|
path: 'neutrino-proxy-server-${{ env.OS }}-${{ env.VERSION }}-native'
|
||||||
filename: neutrino-proxy-server-${{ env.OS }}-${{ env.VERSION }}.zip
|
filename: neutrino-proxy-server-${{ env.OS }}-${{ env.VERSION }}-native.zip
|
||||||
- name: Build with Maven (neutrino-proxy-client)
|
- name: Build with Maven (neutrino-proxy-client)
|
||||||
run: |
|
run: |
|
||||||
cd neutrino-proxy-client
|
cd neutrino-proxy-client
|
||||||
mvn clean package --file pom.xml --no-transfer-progress
|
mvn clean package --file pom.xml --no-transfer-progress
|
||||||
mvn clean native:compile -P native --file pom.xml --no-transfer-progress
|
mvn clean native:compile -P native --file pom.xml --no-transfer-progress
|
||||||
chmod +x target/neutrino-proxy-client
|
chmod +x target/neutrino-proxy-client
|
||||||
cp target/neutrino-proxy-client ./../neutrino-proxy-client-${{ env.VERSION }}
|
mkdir ./../neutrino-proxy-client-${{ env.OS }}-${{ env.VERSION }}-native
|
||||||
cp target/classes/app-copy.yml ./../neutrino-proxy-client-${{ env.VERSION }}/app.yml
|
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)
|
- name: Archive zip (neutrino-proxy-client)
|
||||||
uses: thedoctor0/zip-release@master
|
uses: thedoctor0/zip-release@master
|
||||||
with:
|
with:
|
||||||
type: 'zip'
|
type: 'zip'
|
||||||
path: 'neutrino-proxy-client-${{ env.VERSION }}'
|
path: 'neutrino-proxy-client-${{ env.OS }}-${{ env.VERSION }}-native'
|
||||||
filename: neutrino-proxy-client-${{ env.OS }}-${{ env.VERSION }}.zip
|
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
|
# GitHub 上创建 release
|
||||||
- name: Release
|
- name: Release
|
||||||
uses: softprops/action-gh-release@v1
|
uses: softprops/action-gh-release@v1
|
||||||
@@ -88,7 +102,7 @@ jobs:
|
|||||||
files: |
|
files: |
|
||||||
neutrino-proxy-server/target/neutrino-proxy-server.jar
|
neutrino-proxy-server/target/neutrino-proxy-server.jar
|
||||||
neutrino-proxy-client/target/neutrino-proxy-client.jar
|
neutrino-proxy-client/target/neutrino-proxy-client.jar
|
||||||
neutrino-proxy-server-${{ env.OS }}-${{ env.VERSION }}.zip
|
neutrino-proxy-server-${{ env.OS }}-${{ env.VERSION }}-native.zip
|
||||||
neutrino-proxy-client-${{ env.OS }}-${{ env.VERSION }}.zip
|
neutrino-proxy-client-${{ env.OS }}-${{ env.VERSION }}-native.zip
|
||||||
prerelease: true
|
prerelease: true
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|||||||
@@ -57,26 +57,42 @@ jobs:
|
|||||||
mvn clean install -pl neutrino-proxy-core -am -DskipTests --no-transfer-progress
|
mvn clean install -pl neutrino-proxy-core -am -DskipTests --no-transfer-progress
|
||||||
cd neutrino-proxy-server
|
cd neutrino-proxy-server
|
||||||
mvn clean native:compile -P native --file pom.xml --no-transfer-progress
|
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)
|
- name: Archive zip (neutrino-proxy-server)
|
||||||
uses: thedoctor0/zip-release@master
|
uses: thedoctor0/zip-release@master
|
||||||
with:
|
with:
|
||||||
type: 'zip'
|
type: 'zip'
|
||||||
path: 'neutrino-proxy-server.exe'
|
path: 'neutrino-proxy-server-${{ env.OS }}-${{ env.VERSION }}-native'
|
||||||
filename: neutrino-proxy-server-${{ env.OS }}-${{ env.VERSION }}.zip
|
filename: neutrino-proxy-server-${{ env.OS }}-${{ env.VERSION }}-native.zip
|
||||||
- name: Build with Maven (neutrino-proxy-client)
|
- name: Build with Maven (neutrino-proxy-client)
|
||||||
run: |
|
run: |
|
||||||
set MAVEN_OPTS="-Duser.language=UTF-8 -Dfile.encoding=UTF-8"
|
set MAVEN_OPTS="-Duser.language=UTF-8 -Dfile.encoding=UTF-8"
|
||||||
cd neutrino-proxy-client
|
cd neutrino-proxy-client
|
||||||
mvn clean package --file pom.xml --no-transfer-progress
|
mvn clean package --file pom.xml --no-transfer-progress
|
||||||
mvn clean native:compile -P native --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)
|
- name: Archive zip (neutrino-proxy-client)
|
||||||
uses: thedoctor0/zip-release@master
|
uses: thedoctor0/zip-release@master
|
||||||
with:
|
with:
|
||||||
type: 'zip'
|
type: 'zip'
|
||||||
path: 'neutrino-proxy-client.exe'
|
path: 'neutrino-proxy-client-${{ env.OS }}-${{ env.VERSION }}-native'
|
||||||
filename: neutrino-proxy-client-${{ env.OS }}-${{ env.VERSION }}.zip
|
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
|
# GitHub 上创建 release
|
||||||
- name: Release
|
- name: Release
|
||||||
uses: softprops/action-gh-release@v1
|
uses: softprops/action-gh-release@v1
|
||||||
@@ -85,7 +101,7 @@ jobs:
|
|||||||
files: |
|
files: |
|
||||||
neutrino-proxy-server/target/neutrino-proxy-server.jar
|
neutrino-proxy-server/target/neutrino-proxy-server.jar
|
||||||
neutrino-proxy-client/target/neutrino-proxy-client.jar
|
neutrino-proxy-client/target/neutrino-proxy-client.jar
|
||||||
neutrino-proxy-server-${{ env.OS }}-${{ env.VERSION }}.zip
|
neutrino-proxy-server-${{ env.OS }}-${{ env.VERSION }}-native.zip
|
||||||
neutrino-proxy-client-${{ env.OS }}-${{ env.VERSION }}.zip
|
neutrino-proxy-client-${{ env.OS }}-${{ env.VERSION }}-native.zip
|
||||||
prerelease: true
|
prerelease: true
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|||||||
@@ -75,6 +75,7 @@
|
|||||||
|
|
||||||
## 2.0.1
|
## 2.0.1
|
||||||
- jdk版本升级为21
|
- jdk版本升级为21
|
||||||
- 解决HTTP(S)映射时使用tcp端口访问正常,使用域名访问偶现一直loading的问题
|
|
||||||
- 新增安全组模块,支持黑名单、白名单限制
|
- 新增安全组模块,支持黑名单、白名单限制
|
||||||
- 支持对用户、license限速
|
- 支持对用户、license限速
|
||||||
|
- 修复HTTP(S)映射时使用tcp端口访问正常,使用域名访问偶现一直loading的问题
|
||||||
|
- 修复HTTP(S)映射时使用映射的域名上传文件时,连接中断的问题
|
||||||
|
|||||||
@@ -50,6 +50,8 @@ public interface Constants {
|
|||||||
AttributeKey<InetSocketAddress> SENDER = AttributeKey.newInstance("sender");
|
AttributeKey<InetSocketAddress> SENDER = AttributeKey.newInstance("sender");
|
||||||
|
|
||||||
AttributeKey<Integer> SERVER_PORT = AttributeKey.newInstance("serverPort");
|
AttributeKey<Integer> SERVER_PORT = AttributeKey.newInstance("serverPort");
|
||||||
|
AttributeKey<String> REAL_REMOTE_IP = AttributeKey.newInstance("realRemoteIp");
|
||||||
|
|
||||||
|
|
||||||
AttributeKey<Boolean> FLOW_LIMITER_FLAG = AttributeKey.newInstance("flowLimiterFlag");
|
AttributeKey<Boolean> FLOW_LIMITER_FLAG = AttributeKey.newInstance("flowLimiterFlag");
|
||||||
|
|
||||||
|
|||||||
+40
-35
@@ -39,47 +39,52 @@ public class HttpVisitorSecurityChannelHandler extends ChannelInboundHandlerAdap
|
|||||||
}
|
}
|
||||||
|
|
||||||
ByteBuf buf = (ByteBuf) msg;
|
ByteBuf buf = (ByteBuf) msg;
|
||||||
byte[] bytes = new byte[buf.readableBytes()];
|
|
||||||
buf.readBytes(bytes);
|
|
||||||
|
|
||||||
// 获取Host请求头
|
Integer serverPort = ctx.channel().attr(Constants.SERVER_PORT).get();
|
||||||
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);
|
|
||||||
if (null == serverPort) {
|
if (null == serverPort) {
|
||||||
ctx.channel().close();
|
// 获取Host请求头
|
||||||
return;
|
byte[] bytes = new byte[buf.readableBytes()];
|
||||||
}
|
buf.readBytes(bytes);
|
||||||
|
String httpContent = new String(bytes);
|
||||||
|
String host = HttpUtil.getHostIgnorePort(httpContent);
|
||||||
|
|
||||||
// 判断IP是否在该端口绑定的安全组允许的规则内
|
log.debug("HttpProxy host: {}", host);
|
||||||
String ip = IpUtil.getRealRemoteIp(httpContent);
|
if (StringUtils.isBlank(host)) {
|
||||||
if (ip == null) {
|
ctx.channel().close();
|
||||||
ip = IpUtil.getRemoteIp(ctx);
|
return;
|
||||||
}
|
}
|
||||||
if (!securityGroupService.judgeAllow(ip, portMappingService.getSecurityGroupIdByMappingPort(serverPort))) {
|
|
||||||
// 不在安全组规则放行范围内
|
// 根据Host匹配端口映射
|
||||||
ctx.channel().close();
|
if (!host.endsWith(domainName)) {
|
||||||
return;
|
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();
|
buf.resetReaderIndex();
|
||||||
ctx.fireChannelRead(buf);
|
ctx.fireChannelRead(buf);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-15
@@ -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 {
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user