Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
31813c822f | ||
|
|
c456e7a703 | ||
|
|
9131350052 | ||
|
|
18500c2212 | ||
|
|
6389c8bf43 | ||
|
|
c478d8ba80 | ||
|
|
a93646619e | ||
|
|
f83f9e45a4 | ||
|
|
2104f829ef | ||
|
|
456ac900e9 | ||
|
|
72d79b5ccf | ||
|
|
2ae5259670 | ||
|
|
0c5c7908ae | ||
|
|
7282e32ac5 | ||
|
|
810661d5f4 | ||
|
|
7dc605ab7c | ||
|
|
150c69d37c | ||
|
|
9cbcf4de2e | ||
|
|
f124557686 | ||
|
|
4a7df310f1 | ||
|
|
e0aaccc949 | ||
|
|
da4b030234 | ||
|
|
7e7a1546b3 | ||
|
|
b001247088 | ||
|
|
b83e40051e | ||
|
|
a58902f984 | ||
|
|
9188a41ad6 | ||
|
|
e88671c880 | ||
|
|
82773034c6 | ||
|
|
2e33f9ff1a | ||
|
|
23f3ec1ba2 | ||
|
|
666f071e37 | ||
|
|
bd56ce094a | ||
|
|
a7ee52dbf1 | ||
|
|
95764cdfb0 | ||
|
|
22ff47dbe6 | ||
|
|
391d664710 | ||
|
|
f26ed2d12e | ||
|
|
aa02b7b3c2 | ||
|
|
344bf11b88 | ||
|
|
f9ab82cd80 | ||
|
|
e97aacee8f | ||
|
|
59acada928 | ||
|
|
498ffeed46 | ||
|
|
0164e71f37 | ||
|
|
65abda93fb | ||
|
|
9c818e5fcf | ||
|
|
a8c05a9e5e | ||
|
|
01ac42f269 | ||
|
|
d4f77524cf | ||
|
|
d22b8df0ac | ||
|
|
c96d91c17c | ||
|
|
af9cf5d260 | ||
|
|
6eb31879ab | ||
|
|
8cf89e86d5 | ||
|
|
43aec0d8de | ||
|
|
d343231351 | ||
|
|
83519299f8 | ||
|
|
87c2ff846a | ||
|
|
02af8df384 | ||
|
|
81d8a41842 | ||
|
|
f2999fa384 | ||
|
|
37ff5abb28 | ||
|
|
4b4bcd2829 | ||
|
|
adc8cb3f66 | ||
|
|
81c3e3f219 | ||
|
|
587359d40e | ||
|
|
cedef6589f | ||
|
|
9a1f0c65ce | ||
|
|
031eeae706 | ||
|
|
32366a06f5 | ||
|
|
4873fc5084 | ||
|
|
fda50fb383 | ||
|
|
65da4cdc53 | ||
|
|
7b8e92b402 | ||
|
|
c5d736eafd | ||
|
|
85e5e72363 | ||
|
|
216bbb449f | ||
|
|
1378e808f8 | ||
|
|
8a23c83c83 | ||
|
|
2936a934d2 | ||
|
|
98e9a9c663 | ||
|
|
a8fec7caef | ||
|
|
64c155ad68 | ||
|
|
b260602810 | ||
|
|
ca2e7e5254 | ||
|
|
00eb14c3be | ||
|
|
df7aec109d | ||
|
|
59ce5cfe85 | ||
|
|
d6ff43c7a6 | ||
|
|
9d226ab23b | ||
|
|
50afac643e | ||
|
|
249dd5ec12 | ||
|
|
7c82dce6a6 | ||
|
|
55c62c9281 | ||
|
|
b01226b5c5 | ||
|
|
e2f64ce407 | ||
|
|
c2cf34e6c8 | ||
|
|
1a326397f6 | ||
|
|
e6e0639a92 | ||
|
|
8e26e5b36c | ||
|
|
0006a33a5d | ||
|
|
98ab8fd3d0 | ||
|
|
131a8120ca | ||
|
|
14b03c5d51 | ||
|
|
e207b81d3b | ||
|
|
8761a4e93e | ||
|
|
19f4ad915e | ||
|
|
38a1304dab | ||
|
|
4d35c8ffef | ||
|
|
930ad52b3e | ||
|
|
214804b365 | ||
|
|
2243118206 | ||
|
|
29ab0118ff | ||
|
|
402aeb1e40 | ||
|
|
8bbd8d000d | ||
|
|
2950e123b0 | ||
|
|
132e4cf053 | ||
|
|
5b2ccbe5c3 | ||
|
|
fa5030277f | ||
|
|
b6224c42e7 | ||
|
|
b08bef691f | ||
|
|
ee08bc6ed3 | ||
|
|
bc7046305c | ||
|
|
cdec03d031 | ||
|
|
c36a89ba30 | ||
|
|
87857ef55a | ||
|
|
eafa89a35e | ||
|
|
30f6dc38f7 | ||
|
|
9476ee4bcd | ||
|
|
243605481a | ||
|
|
5aac309f47 | ||
|
|
c8f025290c | ||
|
|
4b52d7fafe | ||
|
|
ac901a551b | ||
|
|
4db6a15113 | ||
|
|
cb095575c0 | ||
|
|
b10eb48a45 | ||
|
|
fe9da42442 | ||
|
|
c28ce07a6d | ||
|
|
d1fde2e21d | ||
|
|
4a016d8102 | ||
|
|
1145467c11 | ||
|
|
571152b58a | ||
|
|
f70eb85419 | ||
|
|
6b5597514d | ||
|
|
dcb59975da | ||
|
|
8c455e5024 | ||
|
|
2955ad1a26 | ||
|
|
aa298c61b6 | ||
|
|
63bcd32a2a | ||
|
|
179904c3fe | ||
|
|
00e37e0a27 | ||
|
|
5838481358 | ||
|
|
88baeb3f33 | ||
|
|
2fc1754161 | ||
|
|
dd27a6609d | ||
|
|
d8d4fbf6a6 | ||
|
|
c7c7afa8af | ||
|
|
fe9dc46796 | ||
|
|
21c5dcb053 | ||
|
|
482214529e | ||
|
|
5998fb8785 | ||
|
|
6411b8759d | ||
|
|
da173f2005 | ||
|
|
c427213dfb | ||
|
|
bf6b1767b3 | ||
|
|
223ab4a447 | ||
|
|
b91910b61c | ||
|
|
b01864e362 | ||
|
|
a5df904f9a | ||
|
|
3d250b6833 | ||
|
|
889817e484 | ||
|
|
665ec3a708 | ||
|
|
fe5c2fe3ef | ||
|
|
744335b433 | ||
|
|
66e803d14e | ||
|
|
8b84d281e7 | ||
|
|
b5d30e227c | ||
|
|
88790c7f36 | ||
|
|
c30755c663 | ||
|
|
2e81bfbe2c | ||
|
|
f49898b9b0 | ||
|
|
74d36fc5d1 | ||
|
|
fb5980e577 | ||
|
|
b9277d142c | ||
|
|
81b0a28e2c | ||
|
|
59d47e6bf1 | ||
|
|
7255701084 | ||
|
|
99b3b673f1 | ||
|
|
f6f6017f8a | ||
|
|
fc0830acfe | ||
|
|
9baee2c909 | ||
|
|
6558a8c327 | ||
|
|
ffa8ee502c | ||
|
|
4c993316de | ||
|
|
d451424de8 | ||
|
|
754070e795 | ||
|
|
b21fd8e2d9 | ||
|
|
4f5fc5dfbc | ||
|
|
d1eba19cb9 | ||
|
|
efb3a7015d | ||
|
|
47efe37a0e | ||
|
|
0ad05e7dc8 | ||
|
|
9576707660 | ||
|
|
168acd6bfe | ||
|
|
ad32e36ba2 | ||
|
|
00fd0bab84 | ||
|
|
8f90cf461d | ||
|
|
e44f6e195c | ||
|
|
5db0bf94cb | ||
|
|
99c79f612a | ||
|
|
4890b8783f | ||
|
|
8e150c7696 | ||
|
|
051a36a43e | ||
|
|
46bcc8a25d | ||
|
|
6c3d195afc | ||
|
|
00de9ee464 | ||
|
|
a1608ba1be | ||
|
|
e7bdd4a631 | ||
|
|
67c42a19bb | ||
|
|
d3c658fa4d | ||
|
|
bb96caca64 | ||
|
|
306cd66034 | ||
|
|
5ccf0d1936 | ||
|
|
1ad80a6d8b | ||
|
|
faf5ec9bdc | ||
|
|
a369ee1a15 | ||
|
|
9121ff37bb | ||
|
|
5e1a2f5620 | ||
|
|
7530fd7d9f | ||
|
|
57339dc56c | ||
|
|
d072c05d31 | ||
|
|
a21a786884 | ||
|
|
670f581185 | ||
|
|
e642e5f103 | ||
|
|
d551aaeff6 | ||
|
|
78f2488fe9 | ||
|
|
035283a757 | ||
|
|
644102996b | ||
|
|
2ee2a5f38e | ||
|
|
b883cac767 | ||
|
|
8fd9a24d7c | ||
|
|
40cc5c0c7c | ||
|
|
d23f907d03 | ||
|
|
438714e9ee | ||
|
|
7a173757f0 | ||
|
|
9f2198e32e | ||
|
|
6cbf2ecac4 | ||
|
|
781b14861c | ||
|
|
82d78d2e4b | ||
|
|
d40028365b | ||
|
|
90623b9146 | ||
|
|
aab26f5b9d | ||
|
|
169551445c | ||
|
|
00308c0f5c | ||
|
|
306f2ed4d3 | ||
|
|
bbdd1860cf | ||
|
|
a9fc8f4cb4 | ||
|
|
836252f85b | ||
|
|
ce053be992 | ||
|
|
323e7c6277 | ||
|
|
f4797d22ba | ||
|
|
7c9aa1ebdc | ||
|
|
9564e51c91 | ||
|
|
09f934bdd0 | ||
|
|
d54c4644cf | ||
|
|
4232be546a | ||
|
|
b5b82e0b80 | ||
|
|
0eaad35379 | ||
|
|
b754dd5456 | ||
|
|
035db05e70 | ||
|
|
f7c3e5b76b | ||
|
|
85d86e15c2 | ||
|
|
eea06908f9 | ||
|
|
7fc339e6c1 | ||
|
|
97714e02c5 | ||
|
|
d8d5cc61ab | ||
|
|
67bcbb4383 | ||
|
|
c8207097c1 | ||
|
|
8a89786a41 | ||
|
|
c9b501f334 | ||
|
|
e90bc0f10a | ||
|
|
66d98711bf | ||
|
|
de0ac5b500 | ||
|
|
1dffa1d921 | ||
|
|
42dedf03e1 | ||
|
|
f1ebc47f51 | ||
|
|
4ca43572a0 | ||
|
|
116f3d7b36 | ||
|
|
265699c3dc | ||
|
|
c644128552 | ||
|
|
fa63ec71a5 | ||
|
|
07d5c9f5e4 | ||
|
|
cb9aa5da81 | ||
|
|
03a9d2e971 | ||
|
|
52d96157a4 | ||
|
|
c998512549 | ||
|
|
ac0487432d | ||
|
|
530b0e2ef9 | ||
|
|
311b4a266d | ||
|
|
94fea242e1 | ||
|
|
65f6d23eda | ||
|
|
635544b66d | ||
|
|
52cc45901e | ||
|
|
66898bded2 | ||
|
|
914813c904 | ||
|
|
1dd00f09a8 | ||
|
|
8b564cb2f5 | ||
|
|
d9dfd05180 | ||
|
|
066b63d38a | ||
|
|
78c5014cb0 | ||
|
|
768422d498 | ||
|
|
54d81092a0 | ||
|
|
49b4006f1b | ||
|
|
4dd23134e4 | ||
|
|
9257605be5 | ||
|
|
cd471c1eb4 | ||
|
|
8b358ccadf | ||
|
|
35f9f7756e | ||
|
|
2c2b169460 | ||
|
|
f15eec426d |
@@ -2,4 +2,7 @@ root=true
|
||||
|
||||
[*.{groovy,java,kt,xml}]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
indent_size = 4
|
||||
|
||||
[*.sh]
|
||||
end_of_line=lf
|
||||
|
||||
@@ -1,67 +0,0 @@
|
||||
name: jar release
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
strategy:
|
||||
fail-fast: true
|
||||
matrix:
|
||||
# 'ubuntu-latest', 'windows-latest', 'macos-latest'
|
||||
# os: ['ubuntu-latest', 'windows-latest', 'macos-latest']
|
||||
os: ['ubuntu-latest']
|
||||
name: build - ${{ matrix.os }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
# https://github.com/softprops/action-gh-release/issues/236#issuecomment-1150530128
|
||||
permissions:
|
||||
contents: write
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: setup node v13.12.0
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 13.12.0
|
||||
cache: 'npm'
|
||||
cache-dependency-path: neutrino-proxy-admin/package-lock.json
|
||||
- name: build neutrino-proxy-admin
|
||||
run: |
|
||||
cd neutrino-proxy-admin
|
||||
npm install
|
||||
npm run build:dev
|
||||
cp -rf ./dist/ ./../neutrino-proxy-server/src/main/resources/static/
|
||||
- name: GitHub Action for GraalVM JDK 17
|
||||
uses: graalvm/setup-graalvm@v1
|
||||
with:
|
||||
java-version: '17.0.7' # for a specific JDK 17; or '17' for the latest JDK 17
|
||||
distribution: 'graalvm' # New 'distribution' option
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Cache local Maven repository
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ~/.m2/repository
|
||||
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-maven-
|
||||
- name: Build with Maven (neutrino-proxy-server)
|
||||
run: |
|
||||
mvn clean install -pl neutrino-proxy-core -am -DskipTests --no-transfer-progress package
|
||||
cd neutrino-proxy-server
|
||||
mvn clean package --file pom.xml --no-transfer-progress package
|
||||
- name: Build with Maven (neutrino-proxy-client)
|
||||
run: |
|
||||
cd neutrino-proxy-client
|
||||
mvn clean package --file pom.xml --no-transfer-progress package
|
||||
# GitHub 上创建 release
|
||||
- name: Release
|
||||
uses: softprops/action-gh-release@v1
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
with:
|
||||
files: |
|
||||
neutrino-proxy-server/target/neutrino-proxy-server.jar
|
||||
neutrino-proxy-client/target/neutrino-proxy-client.jar
|
||||
prerelease: true
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -0,0 +1,108 @@
|
||||
name: Build linux and mac native image
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
strategy:
|
||||
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-latest']
|
||||
name: build - ${{ matrix.os }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
# https://github.com/softprops/action-gh-release/issues/236#issuecomment-1150530128
|
||||
permissions:
|
||||
contents: write
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: setup node v13.12.0
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 13.12.0
|
||||
# cache: 'npm' # 使用缓存需要把 package-lock.json 也上传到 git 上
|
||||
- name: build neutrino-proxy-admin
|
||||
run: |
|
||||
cd neutrino-proxy-admin
|
||||
npm install
|
||||
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
|
||||
with:
|
||||
java-version: '21.0.1' # for a specific JDK 21
|
||||
distribution: 'graalvm' # New 'distribution' option
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Cache local Maven repository
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.m2/repository
|
||||
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
|
||||
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-${{ 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
|
||||
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-${{ 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
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
with:
|
||||
files: |
|
||||
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
|
||||
prerelease: true
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -0,0 +1,107 @@
|
||||
name: Build windows native image
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
# see: https://docs.github.com/zh/actions/using-jobs/choosing-the-runner-for-a-job
|
||||
os: ['windows-2022']
|
||||
name: build - ${{ matrix.os }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
# https://github.com/softprops/action-gh-release/issues/236#issuecomment-1150530128
|
||||
permissions:
|
||||
contents: write
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: setup node v13.12.0
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 13.12.0
|
||||
# cache: 'npm' # 使用缓存需要把 package-lock.json 也上传到 git 上
|
||||
- name: build neutrino-proxy-admin
|
||||
run: |
|
||||
cd neutrino-proxy-admin
|
||||
npm install
|
||||
npm run build:docker
|
||||
cp -r ./dist/ ./../neutrino-proxy-server/src/main/resources/static/
|
||||
- name: GitHub Action for GraalVM JDK 21
|
||||
uses: graalvm/setup-graalvm@v1
|
||||
with:
|
||||
java-version: '21.0.1' # for a specific JDK 21;
|
||||
distribution: 'graalvm' # New 'distribution' option
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Cache local Maven repository
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.m2/repository
|
||||
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
|
||||
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-${{ 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
|
||||
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-${{ 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
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
with:
|
||||
files: |
|
||||
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
|
||||
prerelease: true
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -54,8 +54,11 @@ hs_err_pid*
|
||||
|
||||
**/memo/**
|
||||
|
||||
neutrino-proxy-vuepress/deploy
|
||||
neutrino-proxy-vuepress/deploy.sh
|
||||
.NEUTRINO_PROXY_CLIENT_ID
|
||||
logs
|
||||
data
|
||||
**/cert/**
|
||||
neutrino-proxy-server/src/main/resources/static/**
|
||||
rebel.xml
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
version: '1.0'
|
||||
name: pipeline-docs-build
|
||||
displayName: 官网静态资源构建
|
||||
triggers:
|
||||
trigger: auto
|
||||
push:
|
||||
branches:
|
||||
precise:
|
||||
- master
|
||||
paths:
|
||||
include:
|
||||
- neutrino-proxy-vuepress.*
|
||||
variables:
|
||||
global:
|
||||
- git_token
|
||||
- username
|
||||
commit_name: aoshiguchen
|
||||
commit_email: [email protected]
|
||||
repo_url: https://gitee.com/dromara/neutrino-proxy.git
|
||||
target_branch: site
|
||||
stages:
|
||||
- name: stage-build
|
||||
displayName: 构建
|
||||
strategy: naturally
|
||||
trigger: auto
|
||||
executor:
|
||||
- asgc
|
||||
steps:
|
||||
- step: build@nodejs
|
||||
name: build_nodejs
|
||||
displayName: Nodejs 构建
|
||||
nodeVersion: 14.16.0
|
||||
commands:
|
||||
- '# 切换到工作目录'
|
||||
- ''
|
||||
- cd ./neutrino-proxy-vuepress
|
||||
- '# 设置NPM源,提升安装速度'
|
||||
- npm config set registry https://registry.npmmirror.com
|
||||
- ''
|
||||
- '# 执行编译命令'
|
||||
- npm install && npm run build
|
||||
- ''
|
||||
- '# 初始化git仓库'
|
||||
- cd docs/.vuepress/dist
|
||||
- git init
|
||||
- ''
|
||||
- '# 设置Git信息'
|
||||
- GIT_REPO_URL=$repo_url
|
||||
- GIT_USERNAME=$username
|
||||
- GIT_NAME=$commit_name
|
||||
- GIT_EMAIL=$commit_email
|
||||
- GIT_TOKEN=$git_token
|
||||
- echo "https://${GIT_USERNAME}:${GIT_TOKEN}@${GIT_REPO_URL#https://}" > ~/.git-credentials
|
||||
- git config --global credential.helper store
|
||||
- git remote add origin ${GIT_REPO_URL}
|
||||
- git config user.name ${GIT_NAME}
|
||||
- git config user.email ${GIT_EMAIL}
|
||||
- ''
|
||||
- '# 将构建产物推送到目标分支'
|
||||
- git add -A
|
||||
- '# git commit -m $GITEE_COMMIT_MESSAGE'
|
||||
- git commit -m "update"
|
||||
- git checkout -b $target_branch
|
||||
- git push -f origin $target_branch
|
||||
artifacts:
|
||||
- name: BUILD_ARTIFACT
|
||||
path:
|
||||
- ./neutrino-proxy-vuepress/docs/.vuepress/dist
|
||||
caches:
|
||||
- ~/.npm
|
||||
- ~/.yarn
|
||||
notify: []
|
||||
strategy:
|
||||
retry: '0'
|
||||
@@ -0,0 +1,18 @@
|
||||
- 2022-06-16 1.0.0版本发布,基于自研应用框架、纯配置无管理后台
|
||||
- 2022-10-12 1.5.0版本发布,底层框架优化,新增管理后台
|
||||
- 2022-11-23 1.6.0版本发布,新增日志管理模块,新增首页流量统计
|
||||
- 2023-01-08 中微子代理Gitee Star突破100
|
||||
- 2023-01-16 加入Dromara组织
|
||||
- 2023-02-23 1.6.4版本发布,管理后台增、删、改、禁用实时生效,启动参数、GZip优化
|
||||
- 2023-03-12 1.7.0版本发布,底层框架更换为Solon + MybatisPlus
|
||||
- 2023-03-26 1.7.1版本发布,新增端口池分组、新增报表管理模块、首页图表优化
|
||||
- 2023-04-03 1.8.0版本发布,端口映射支持选择协议,HTTP映射支持子域名
|
||||
- 2023-05-27 1.8.2版本发布,增加HTTPS支持
|
||||
- 2023-06-03 1.8.3版本发布,客户端重连优化、服务端验证客户端身份逻辑优化
|
||||
- 2023-06-08 1.8.4版本发布,增加对mariadb的支持、配置文件支持指定日志级别、重连参数
|
||||
- 2023-07-04 1.8.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限制)、限速
|
||||
@@ -1,52 +0,0 @@
|
||||
# 基础
|
||||
- [x] 服务端编译、启动成功
|
||||
- [x] 客户端编译、启动成功
|
||||
- [x] 配置
|
||||
- [x] 启动参数
|
||||
- [x] 外部配置文件
|
||||
- [x] 环境变量
|
||||
- [ ] 日志
|
||||
- [x] 控制台输出
|
||||
- [x] debug启动有netty错误日志
|
||||
- [x] 文件输出
|
||||
- [x] 修改日志级别
|
||||
- [x] 心跳日志
|
||||
- [x] 传输报文日志
|
||||
- [x] 连接
|
||||
- [x] 隧道SSL连接
|
||||
- [x] 隧道非SSL连接
|
||||
- [x] 隧道SSL连接自定义证书
|
||||
|
||||
# 服务端管理后台
|
||||
- [x] 登录成功
|
||||
- [x] 首页统计
|
||||
- [x] 代理配置
|
||||
- [x] license管理
|
||||
- [x] 端口映射
|
||||
- [x] 系统管理
|
||||
- [x] 用户管理
|
||||
- [x] 端口分组管理
|
||||
- [x] 端口池管理
|
||||
- [x] 协议管理
|
||||
- [x] 调度管理
|
||||
- [x] 报表管理
|
||||
- [x] 用户流量报表
|
||||
- [x] License流量报表
|
||||
- [x] 用户流量月度明细
|
||||
- [x] License流量月度明细
|
||||
- [x] 日志管理
|
||||
- [x] 调度日志
|
||||
- [x] 登录日志
|
||||
- [x] 客户端连接日志
|
||||
|
||||
|
||||
# 客户端
|
||||
- [x] 重连机制
|
||||
|
||||
# 代理
|
||||
- [x] TCP代理
|
||||
- [x] HTTP(S)代理
|
||||
- [x] 端口访问
|
||||
- [x] HTTP域名访问
|
||||
- [x] HTTPS域名访问
|
||||
- [x] UDP代理
|
||||
@@ -4,8 +4,8 @@
|
||||
<p align="center">
|
||||
<a href='https://gitee.com/dromara/neutrino-proxy/stargazers'><img src='https://gitee.com/dromara/neutrino-proxy/badge/star.svg?theme=dark' alt='star'></img></a>
|
||||
<a href='https://gitee.com/dromara/neutrino-proxy/members'><img src='https://gitee.com/dromara/neutrino-proxy/badge/fork.svg?theme=dark' alt='fork'></img></a>
|
||||
<a target="_blank" href="https://www.oracle.com/java/technologies/javase/javase-jdk8-downloads.html">
|
||||
<img src="https://img.shields.io/badge/JDK-8+-red.svg" />
|
||||
<a target="_blank" href="https://www.oracle.com/java/technologies/javase/javase-jdk21-downloads.html">
|
||||
<img src="https://img.shields.io/badge/JDK-21+-red.svg" />
|
||||
</a>
|
||||
<a href="./LICENSE">
|
||||
<img src="https://img.shields.io/badge/license-MIT-red" alt="license MIT">
|
||||
@@ -16,9 +16,8 @@
|
||||
- 中微子代理(neutrino-proxy)是一个基于netty的、开源的java内网穿透项目。
|
||||
- 技术栈:Solon、MybatisPlus、Netty
|
||||
- 遵循MIT许可,因此您可以对它进行复制、修改、传播并用于任何个人或商业行为。
|
||||
- 官网地址1:https://neutrino-proxy.dromara.org
|
||||
- 官网地址2:https://dromara.gitee.io/neutrino-proxy
|
||||
- 快速上手请[点击这里](https://dromara.gitee.io/neutrino-proxy/pages/793dcb)
|
||||
- 官网地址:https://neutrino-proxy-docs.asgc.fun
|
||||
- 快速上手请[点击这里](https://neutrino-proxy-docs.asgc.fun/pages/793dcb/)
|
||||
|
||||
# 2、名称由来
|
||||
中微子,是轻子的一种,是组成自然界的最基本的粒子之一。它十分微小、不带电,可自由穿过地球,以接近光速运动,与其他物质的相互作用十分微弱,号称宇宙间的“隐身人”。
|
||||
@@ -27,21 +26,30 @@
|
||||
|
||||
因此以中微子命名,寓意着中微子代理拥有中微子"安全"、"快速"、"穿透力强"的特点。
|
||||
|
||||
# 3、运行示例
|
||||
# 3、部署方式
|
||||
- 1、[使用宝塔面板](https://neutrino-proxy-docs.asgc.fun/pages/9e0fde/)
|
||||
- 2、[使用jar文件](https://neutrino-proxy-docs.asgc.fun/pages/eebea1/)
|
||||
- 3、[使用Docker](https://neutrino-proxy-docs.asgc.fun/pages/5b9bef/)
|
||||
- 4、[原生部署](https://neutrino-proxy-docs.asgc.fun/pages/69699a/)
|
||||
- 5、[使用Docker-Compose](https://neutrino-proxy-docs.asgc.fun/pages/2d4123/)
|
||||
|
||||
# 4、运行示例
|
||||

|
||||

|
||||

|
||||

|
||||

|
||||
|
||||
# 4、代理示意图
|
||||
# 5、代理示意图
|
||||

|
||||
|
||||
# 5、联系我们
|
||||
# 6、联系我们
|
||||
- 微信: yuyunshize
|
||||
- GitCode:https://gitcode.com/dromara/neutrino-proxy
|
||||
- Gitee: https://gitee.com/asgc/neutrino-proxy
|
||||
- Github仓库:https://github.com/dromara/neutrino-proxy
|
||||
|
||||
# 6、贡献者列表
|
||||
# 7、贡献者列表
|
||||
<p>
|
||||
<a href="https://gitee.com/zcans" target="_blank">
|
||||
<img src="assets/developer/zcans.png" width="11%">
|
||||
@@ -88,6 +96,12 @@
|
||||
<a href="https://gitee.com/songyinyin" target="_blank">
|
||||
<img src="assets/developer/songyinyin.png" width="11%">
|
||||
</a>
|
||||
<a href="https://gitee.com/nichenxyx" target="_blank">
|
||||
<img src="assets/developer/NichenFly.jpg" width="11%">
|
||||
</a>
|
||||
<a href="https://gitee.com/miracrl" target="_blank">
|
||||
<img src="assets/developer/miracrl.png" width="11%">
|
||||
</a>
|
||||
</p>
|
||||
|
||||
# ❤️ 感谢
|
||||
@@ -97,85 +111,10 @@
|
||||
|
||||

|
||||
|
||||
# 📚 Dromara 成员项目
|
||||
# 📚 作者其他项目
|
||||
|
||||
<p align="center">
|
||||
<a href="https://gitee.com/dromara/TLog" target="_blank">
|
||||
<img src="https://oss.dev33.cn/sa-token/link/tlog2.png" alt="一个轻量级的分布式日志标记追踪神器,10分钟即可接入,自动对日志打标签完成微服务的链路追踪" width="15%">
|
||||
</a>
|
||||
<a href="https://gitee.com/dromara/liteFlow" target="_blank">
|
||||
<img src="https://oss.dev33.cn/sa-token/link/liteflow.png" alt="轻量,快速,稳定,可编排的组件式流程引擎" width="15%">
|
||||
</a>
|
||||
<a href="https://hutool.cn/" target="_blank">
|
||||
<img src="https://oss.dev33.cn/sa-token/link/hutool.jpg" alt="小而全的Java工具类库,使Java拥有函数式语言般的优雅,让Java语言也可以“甜甜的”。" width="15%">
|
||||
</a>
|
||||
<a href="https://sa-token.dev33.cn/" target="_blank">
|
||||
<img src="https://oss.dev33.cn/sa-token/link/sa-token.png" alt="一个轻量级 java 权限认证框架,让鉴权变得简单、优雅!" width="15%">
|
||||
</a>
|
||||
<a href="https://gitee.com/dromara/hmily" target="_blank">
|
||||
<img src="https://oss.dev33.cn/sa-token/link/hmily.png" alt="高性能一站式分布式事务解决方案。" width="15%">
|
||||
</a>
|
||||
<a href="https://gitee.com/dromara/Raincat" target="_blank">
|
||||
<img src="https://oss.dev33.cn/sa-token/link/raincat.png" alt="强一致性分布式事务解决方案。" width="15%">
|
||||
</a>
|
||||
</p>
|
||||
<p align="center">
|
||||
<a href="https://gitee.com/dromara/myth" target="_blank">
|
||||
<img src="https://oss.dev33.cn/sa-token/link/myth.png" alt="可靠消息分布式事务解决方案。" width="15%">
|
||||
</a>
|
||||
<a href="https://cubic.jiagoujishu.com/" target="_blank">
|
||||
<img src="https://oss.dev33.cn/sa-token/link/cubic.png" alt="一站式问题定位平台,以agent的方式无侵入接入应用,完整集成arthas功能模块,致力于应用级监控,帮助开发人员快速定位问题" width="15%">
|
||||
</a>
|
||||
<a href="https://maxkey.top/" target="_blank">
|
||||
<img src="https://oss.dev33.cn/sa-token/link/maxkey.png" alt="业界领先的身份管理和认证产品" width="15%">
|
||||
</a>
|
||||
<a href="http://forest.dtflyx.com/" target="_blank">
|
||||
<img src="https://oss.dev33.cn/sa-token/link/forest-logo.png" alt="Forest能够帮助您使用更简单的方式编写Java的HTTP客户端" width="15%">
|
||||
</a>
|
||||
<a href="https://jpom.io/" target="_blank">
|
||||
<img src="https://oss.dev33.cn/sa-token/link/jpom.png" alt="一款简而轻的低侵入式在线构建、自动部署、日常运维、项目监控软件" width="15%">
|
||||
</a>
|
||||
<a href="https://su.usthe.com/" target="_blank">
|
||||
<img src="https://oss.dev33.cn/sa-token/link/sureness.png" alt="面向 REST API 的高性能认证鉴权框架" width="15%">
|
||||
</a>
|
||||
</p>
|
||||
<p align="center">
|
||||
<a href="https://easy-es.cn/" target="_blank">
|
||||
<img src="https://oss.dev33.cn/sa-token/link/easy-es2.png" alt="傻瓜级ElasticSearch搜索引擎ORM框架" width="15%">
|
||||
</a>
|
||||
<a href="https://gitee.com/dromara/northstar" target="_blank">
|
||||
<img src="https://oss.dev33.cn/sa-token/link/northstar_logo.png" alt="Northstar盈富量化交易平台" width="15%">
|
||||
</a>
|
||||
<a href="https://hertzbeat.com/" target="_blank">
|
||||
<img src="https://oss.dev33.cn/sa-token/link/hertzbeat_brand.jpg" alt="易用友好的云监控系统" width="15%">
|
||||
</a>
|
||||
<a href="https://plugins.sheng90.wang/fast-request/" target="_blank">
|
||||
<img src="https://oss.dev33.cn/sa-token/link/fast-request.gif" alt="Idea 版 Postman,为简化调试API而生" width="15%">
|
||||
</a>
|
||||
<a href="https://www.jeesuite.com/" target="_blank">
|
||||
<img src="https://oss.dev33.cn/sa-token/link/mendmix.png" alt="开源分布式云原生架构一站式解决方案" width="15%">
|
||||
</a>
|
||||
<a href="https://gitee.com/dromara/koalas-rpc" target="_blank">
|
||||
<img src="https://oss.dev33.cn/sa-token/link/koalas-rpc2.png" alt="企业生产级百亿日PV高可用可拓展的RPC框架。" width="15%">
|
||||
</a>
|
||||
</p>
|
||||
<p align="center">
|
||||
<a href="https://async.sizegang.cn/" target="_blank">
|
||||
<img src="https://oss.dev33.cn/sa-token/link/gobrs-async.png" alt="配置极简功能强大的异步任务动态编排框架" width="15%">
|
||||
</a>
|
||||
<a href="https://dynamictp.cn/" target="_blank">
|
||||
<img src="https://oss.dev33.cn/sa-token/link/dynamic-tp.png" alt="基于配置中心的轻量级动态可监控线程池" width="15%">
|
||||
</a>
|
||||
<a href="https://www.x-easypdf.cn" target="_blank">
|
||||
<img src="https://oss.dev33.cn/sa-token/link/x-easypdf.png" alt="一个用搭积木的方式构建pdf的框架(基于pdfbox)" width="15%">
|
||||
</a>
|
||||
<a href="http://dromara.gitee.io/image-combiner" target="_blank">
|
||||
<img src="https://oss.dev33.cn/sa-token/link/image-combiner.png" alt="一个专门用于图片合成的工具,没有很复杂的功能,简单实用,却不失强大" width="15%">
|
||||
</a>
|
||||
<a href="https://www.herodotus.cn/" target="_blank">
|
||||
<img src="https://oss.dev33.cn/sa-token/link/dante-cloud2.png" alt="Dante-Cloud 是一款企业级微服务架构和服务能力开发平台。" width="15%">
|
||||
</a>
|
||||
<a href="https://dromara.org/zh/projects/" target="_blank">
|
||||
<img src="https://oss.dev33.cn/sa-token/link/dromara.png" alt="让每一位开源爱好者,体会到开源的快乐。" width="15%">
|
||||
<a href="https://keydock.asgc.fun?from=neutrino-proxy" target="_blank">
|
||||
<img src="https://keydock.asgc.fun/project-recommend/dromara/logo/key-dock-horizontal.png" alt="钥栈 KeyDock 是一款 Chrome 浏览器多环境账号管理与一键登录填充插件,支持本地明文存储与可选 MinIO 同步,让多环境账号切换更高效安全。" width="15%">
|
||||
</a>
|
||||
</p>
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
# 1.x
|
||||
## 1.0.0
|
||||
> 第一个基本可用版本
|
||||
- 基于自研底层应用框架、Netty
|
||||
- 纯配置实现、无管理后台
|
||||
- 支持TCP代理
|
||||
|
||||
## 1.5.0
|
||||
- 管理后台新增用户管理、License管理、端口映射、调度管理、客户端连接日志、调度日志
|
||||
- 支持默认sqlite数据库
|
||||
- 底层框架Aop、Banner、SqlMapper、Ioc、@Value注解、Yml配置加载、静态资源服务等优化
|
||||
- 底层框架新增@Async、@Singleton等注解
|
||||
- 新增AsgcCompiler、ApplicationEvent机制封装
|
||||
|
||||
## 1.6.0
|
||||
- 新增日志管理模块,调度日志迁移至日志管理
|
||||
- 管理后台新增登录日志
|
||||
- 新增首页流量统计
|
||||
|
||||
## 1.6.4
|
||||
- 支持代理服务端用户(删除/禁用)、端口池(删除/禁用/启用)、License(删除/禁用/启用)、端口映射(新增/删除/禁用/启用)实时生效
|
||||
- 启动参数优化
|
||||
- 服务端静态资源服务支持缓存、gzip压缩,提升响应速度
|
||||
|
||||
## 1.7.0
|
||||
- 底层框架更换为Solon + MybatisPlus
|
||||
|
||||
## 1.7.1
|
||||
- 针对管理后台各页面的排序、搜索条件的优化
|
||||
- 增加端口池分组、相关的端口映射优化
|
||||
- 增加了报表管理模块:用户流量报表、license流量报表、用户流量月度明细、license流量月度明细
|
||||
- 完成首页图表展示:license统计、端口映射统计、今日流量统计、汇总流量统计、最近15日流量折线图
|
||||
|
||||
## 1.8.0
|
||||
- 端口映射支持选择协议
|
||||
- HTTP协议下映射支持配置子域名(前提是server端配置了域名)
|
||||
|
||||
## 1.8.2
|
||||
- 增加HTTPS的支持。
|
||||
|
||||
## 1.8.3
|
||||
- 客户端重连优化
|
||||
- 服务端验证客户端身份逻辑优化
|
||||
|
||||
## 1.8.4
|
||||
- 增加对mariadb的支持
|
||||
- 服务端/客户端,支持配置文件、启动参数指定日志级别
|
||||
- 客户端支持配置文件指定重连间隔,是否开启无限重连
|
||||
|
||||
## 1.8.5
|
||||
- 后台端口池管理支持批量删除
|
||||
- 端口映射下拉选择端口支持搜索
|
||||
- 客户端/服务端配置增加心跳日志开关,有需要时开启,方便排查问题
|
||||
- 客户端/服务端读写超时逻辑微调
|
||||
|
||||
## 1.8.6
|
||||
- 端口映射选择端口支持分页
|
||||
- 新增/更新端口映射,增加端口占用检测(端口映射编辑时,如果端口号没有变动,则不验证。避免出现端口映射正在使用时,无法更新端口映射其他信息的问题)
|
||||
- 下拉搜索license,支持模糊搜索
|
||||
- license下拉用户搜索,支持模糊搜索
|
||||
- 端口映射HTTP(S)新增打开网页按钮
|
||||
- 客户端断开连接时,记录日志空指针异常问题修复
|
||||
|
||||
## 1.9.0
|
||||
- 端口映射支持UDP协议
|
||||
- 端口映射HTTP(S)新增打开网页按钮,优先使用域名打开
|
||||
- 新增/编辑端口映射时端口占用检测功能屏蔽,解决docker下使用的各种问题
|
||||
|
||||
# 2.x
|
||||
## 2.0.0
|
||||
- solon版本升级为`2.5.11`
|
||||
- jdk版本升级为17
|
||||
- 支持原生编译改造
|
||||
- 默认支持的数据库由sqlite改为h2
|
||||
|
||||
## 2.0.1
|
||||
- jdk版本升级为21
|
||||
- 新增安全组模块,支持黑名单、白名单限制
|
||||
- 支持对用户、license限速
|
||||
- 修复HTTP(S)映射时使用tcp端口访问正常,使用域名访问偶现一直loading的问题
|
||||
- 修复HTTP(S)映射时使用映射的域名上传文件时,连接中断的问题
|
||||
|
||||
## 2.0.2
|
||||
- 部分细节优化
|
||||
- 解决客户端docker方式部署环境变量指定参数不生效的问题
|
||||
- 服务端解决服务端native下,清理日志定时任务报错的问题
|
||||
- 解决后台分页查询的已知问题
|
||||
- 端口映射中的客户端ip字段加长,解决配置阿里云数据库域名字段不够的问题
|
||||
- 管理后台新增域名管理
|
||||
- [x] 支持设置一个默认域名
|
||||
- [x] 删除、修改、禁用实时生效
|
||||
- [x] 支持维护https证书
|
||||
- 端口映射支持支持绑定多个子域名
|
||||
- 选择择不同的主域名、子域名变更实时生效
|
||||
## 2.0.3
|
||||
- 解决http请求拆包情况下域名映射失效的问题
|
||||
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 44 KiB |
|
After Width: | Height: | Size: 175 KiB |
|
After Width: | Height: | Size: 243 KiB |
|
After Width: | Height: | Size: 164 KiB |
|
After Width: | Height: | Size: 143 KiB |
|
After Width: | Height: | Size: 132 KiB |
@@ -0,0 +1,36 @@
|
||||
# lieme-chrome-plugins
|
||||
|
||||
#### Description
|
||||
猎么插件
|
||||
|
||||
#### Software Architecture
|
||||
Software architecture description
|
||||
|
||||
#### Installation
|
||||
|
||||
1. xxxx
|
||||
2. xxxx
|
||||
3. xxxx
|
||||
|
||||
#### Instructions
|
||||
|
||||
1. xxxx
|
||||
2. xxxx
|
||||
3. xxxx
|
||||
|
||||
#### Contribution
|
||||
|
||||
1. Fork the repository
|
||||
2. Create Feat_xxx branch
|
||||
3. Commit your code
|
||||
4. Create Pull Request
|
||||
|
||||
|
||||
#### Gitee Feature
|
||||
|
||||
1. You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md
|
||||
2. Gitee blog [blog.gitee.com](https://blog.gitee.com)
|
||||
3. Explore open source project [https://gitee.com/explore](https://gitee.com/explore)
|
||||
4. The most valuable open source project [GVP](https://gitee.com/gvp)
|
||||
5. The manual of Gitee [https://gitee.com/help](https://gitee.com/help)
|
||||
6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)
|
||||
@@ -0,0 +1,37 @@
|
||||
# lieme-chrome-plugins
|
||||
|
||||
#### 介绍
|
||||
猎么插件
|
||||
|
||||
#### 软件架构
|
||||
软件架构说明
|
||||
|
||||
|
||||
#### 安装教程
|
||||
|
||||
1. xxxx
|
||||
2. xxxx
|
||||
3. xxxx
|
||||
|
||||
#### 使用说明
|
||||
|
||||
1. xxxx
|
||||
2. xxxx
|
||||
3. xxxx
|
||||
|
||||
#### 参与贡献
|
||||
|
||||
1. Fork 本仓库
|
||||
2. 新建 Feat_xxx 分支
|
||||
3. 提交代码
|
||||
4. 新建 Pull Request
|
||||
|
||||
|
||||
#### 码云特技
|
||||
|
||||
1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md
|
||||
2. 码云官方博客 [blog.gitee.com](https://blog.gitee.com)
|
||||
3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解码云上的优秀开源项目
|
||||
4. [GVP](https://gitee.com/gvp) 全称是码云最有价值开源项目,是码云综合评定出的优秀开源项目
|
||||
5. 码云官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help)
|
||||
6. 码云封面人物是一档用来展示码云会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)
|
||||
|
After Width: | Height: | Size: 11 KiB |
@@ -0,0 +1,323 @@
|
||||
((global) => {
|
||||
let Asgc = {};
|
||||
global.Asgc = Asgc;
|
||||
|
||||
// 类型判断工具
|
||||
Asgc.types = (() => {
|
||||
let types = ['String', 'Null', 'Number', 'Boolean', 'Undefined', 'Array', 'Object', 'Function', 'Window', 'Arguments',
|
||||
'ArrayBuffer', 'Blob', 'File', 'Date'];
|
||||
let ret = {
|
||||
getType(val) {
|
||||
let typeStrig = toString.call(val);
|
||||
return typeStrig.slice(8,typeStrig.length - 1);
|
||||
},
|
||||
isType(val,type) {
|
||||
return this.getType(val) === type;
|
||||
}
|
||||
};
|
||||
|
||||
for (let t of types) {
|
||||
ret[`is${t}`] = function (val) {
|
||||
return this.isType(val, t);
|
||||
};
|
||||
}
|
||||
return ret;
|
||||
})();
|
||||
|
||||
Asgc.util = (function () {
|
||||
return {
|
||||
dateFormat: function (date, fmt) {
|
||||
// 默认格式
|
||||
fmt = fmt ? fmt : 'yyyy-MM-dd hh:mm:ss';
|
||||
|
||||
let o = {
|
||||
"M+" : date.getMonth()+1, // 月份
|
||||
"d+" : date.getDate(), // 日
|
||||
"h+" : date.getHours(), // 小时
|
||||
"m+" : date.getMinutes(), // 分
|
||||
"s+" : date.getSeconds(), // 秒
|
||||
"q+" : Math.floor((date.getMonth()+3)/3), // 季度
|
||||
"S+" : date.getMilliseconds() // 毫秒
|
||||
};
|
||||
if(/(y+)/.test(fmt)) {
|
||||
fmt=fmt.replace(RegExp.$1, (date.getFullYear()+"").substring(4 - RegExp.$1.length));
|
||||
}
|
||||
for(let k in o) {
|
||||
if(new RegExp("("+ k +")").test(fmt)){
|
||||
fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? (o[k]) :
|
||||
RegExp.$1.length === 2 ? (("00"+ o[k]).substring((""+ o[k]).length)) : (("000"+ o[k]).substring((""+ o[k]).length))
|
||||
);
|
||||
}
|
||||
}
|
||||
return fmt;
|
||||
}
|
||||
}
|
||||
})();
|
||||
|
||||
// 日志工具
|
||||
Asgc.Logger = function(name){
|
||||
return {
|
||||
/**
|
||||
* all
|
||||
* debug
|
||||
* info
|
||||
* warn
|
||||
* error
|
||||
* off
|
||||
* */
|
||||
|
||||
level: 'all',
|
||||
setLevel: function(level){
|
||||
this.level = level;
|
||||
},
|
||||
setLevelAll: function(){
|
||||
this.level = 'all';
|
||||
},
|
||||
setLevelDebug: function(){
|
||||
this.level = 'debug';
|
||||
},
|
||||
setLevelInfo: function(){
|
||||
this.level = 'info';
|
||||
},
|
||||
setLevelWarn: function(){
|
||||
this.level = 'warn';
|
||||
},
|
||||
setLevelError: function(){
|
||||
this.level = 'error';
|
||||
},
|
||||
setLevelOff: function(){
|
||||
this.level = 'off';
|
||||
},
|
||||
out: function(curLevel, msgs) {
|
||||
if(Asgc.Logger.LEVEL[curLevel].v < Asgc.Logger.LEVEL[this.level].v) return;
|
||||
let prefix = `%c [Asgc Log][${Asgc.util.dateFormat(new Date(), 'yyyy-MM-dd hh:mm:ss.SSS')}][${name}][level:${curLevel}]`;
|
||||
let params = [];
|
||||
params.push(prefix);
|
||||
params.push('color:' + Asgc.Logger.LEVEL[curLevel].color);
|
||||
for(let msg of msgs){
|
||||
params.push(msg);
|
||||
}
|
||||
console.log.apply(this,params);
|
||||
},
|
||||
debug: function(){
|
||||
this.out('debug', Array.prototype.slice.apply(arguments));
|
||||
},
|
||||
info: function(){
|
||||
this.out('info', Array.prototype.slice.apply(arguments));
|
||||
},
|
||||
warn: function(){
|
||||
this.out('warn', Array.prototype.slice.apply(arguments));
|
||||
},
|
||||
error: function(){
|
||||
this.out('error', Array.prototype.slice.apply(arguments));
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
Asgc.Logger.LEVEL = {
|
||||
all: {
|
||||
v: 0
|
||||
},
|
||||
debug: {
|
||||
v: 1,
|
||||
color: 'gray'
|
||||
},
|
||||
info: {
|
||||
v: 2,
|
||||
color: 'green'
|
||||
},
|
||||
warn: {
|
||||
v: 3,
|
||||
color: 'blue'
|
||||
},
|
||||
error: {
|
||||
v: 4,
|
||||
color: 'red'
|
||||
},
|
||||
off: {
|
||||
v: 5
|
||||
}
|
||||
};
|
||||
|
||||
Asgc.cache = (function(){
|
||||
let storage = window.localStorage;
|
||||
|
||||
return {
|
||||
set: function(k,v){
|
||||
storage.setItem(k,v);
|
||||
return this;
|
||||
},
|
||||
|
||||
get: function(k){
|
||||
return storage.getItem(k) || '';
|
||||
},
|
||||
|
||||
clear: function(){
|
||||
storage.clear();
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
switchLocalStorage: function(){
|
||||
storage = window.localStorage;
|
||||
return this;
|
||||
},
|
||||
|
||||
switchSessionStorage: function(){
|
||||
storage = window.sessionStorage;
|
||||
return this;
|
||||
},
|
||||
|
||||
setJson: function(k,v){
|
||||
storage.setItem(k,JSON.stringify(v));
|
||||
return this;
|
||||
},
|
||||
|
||||
getJson: function(k){
|
||||
|
||||
let val = storage.getItem(k);
|
||||
|
||||
if(!val) return null;
|
||||
else return JSON.parse(val);
|
||||
},
|
||||
|
||||
setJsonProperty: function(k,property,v){
|
||||
let data = this.getJson(k);
|
||||
data[property] = v;
|
||||
this.setJson(k,data);
|
||||
return this;
|
||||
},
|
||||
|
||||
getJsonProperty: function(k,property){
|
||||
let data = this.getJson(k);
|
||||
|
||||
return data[property];
|
||||
},
|
||||
|
||||
getString: function(k){
|
||||
return this.get(k);
|
||||
},
|
||||
|
||||
getInt: function(k){
|
||||
return parseInt(this.get(k));
|
||||
},
|
||||
|
||||
getFloat: function(k){
|
||||
return parseFloat(this.get(k));
|
||||
},
|
||||
|
||||
getNumber: function(k){
|
||||
return new Number(this.get(k));
|
||||
},
|
||||
|
||||
getBoolean: function(k){
|
||||
return this.get(k) === 'true';
|
||||
},
|
||||
|
||||
getDate: function(k){
|
||||
return new Date(this.get(k));
|
||||
},
|
||||
|
||||
//超级设值
|
||||
//如:s('a.b.c',10); => a:{b:{c:10}}
|
||||
//暂不支持数组下标
|
||||
s: function(k,v){
|
||||
if(!k) return this;
|
||||
|
||||
let ks = k.split('.');
|
||||
|
||||
if(ks.length === 1) return this.set(k,v);
|
||||
|
||||
let data = this.getJson(ks[0]);
|
||||
|
||||
function solve(data,ks,n){
|
||||
if(n === ks.length - 1){
|
||||
data[ks[n]] = v;
|
||||
return;
|
||||
}
|
||||
|
||||
if(!data[ks[n]]) data[ks[n]] = {};
|
||||
if(!Asgc.types.isObject(data[ks[n]])){
|
||||
logger.error('错误的引用! k:' + k);
|
||||
return;
|
||||
}
|
||||
solve(data[ks[n]],ks,n+1);
|
||||
|
||||
}
|
||||
|
||||
solve(data,ks,1);
|
||||
|
||||
this.setJson(ks[0],data);
|
||||
|
||||
return this;
|
||||
},
|
||||
//超级取值
|
||||
//如:a:{b:{c:10}} g('a.b.c') => 10
|
||||
//暂不支持数组下标
|
||||
g: function(k){
|
||||
if(!k) return '';
|
||||
let ks = k.split('.');
|
||||
|
||||
if(ks.length === 1) return this.get(k);
|
||||
|
||||
let data = this.getJson(ks[0]);
|
||||
|
||||
function solve(data,ks,n){
|
||||
if(n === ks.length - 1){
|
||||
return data[ks[n]];
|
||||
}
|
||||
|
||||
if(!data[ks[n]]) return '';
|
||||
if(!Asgc.types.isObject(data[ks[n]])){
|
||||
logger.error('错误的引用! k:' + k);
|
||||
return '';
|
||||
}
|
||||
|
||||
return solve(data[ks[n]],ks,n+1);
|
||||
|
||||
}
|
||||
|
||||
return JSON.stringify(solve(data,ks,1));
|
||||
},
|
||||
|
||||
sJson: function(k,v){
|
||||
this.s(k,JSON.stringify(v));
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
gJson: function(k){
|
||||
let val = this.g(k);
|
||||
|
||||
if(!val) return null;
|
||||
else return JSON.parse(val);
|
||||
},
|
||||
|
||||
gString: function(k){
|
||||
return this.g(k);
|
||||
},
|
||||
|
||||
gInt: function(k){
|
||||
return parseInt(this.g(k));
|
||||
},
|
||||
|
||||
gFloat: function(k){
|
||||
return parseFloat(this.g(k));
|
||||
},
|
||||
|
||||
gNumber: function(k){
|
||||
return new Number(this.g(k));
|
||||
},
|
||||
|
||||
gBoolean: function(k){
|
||||
return this.g(k) === 'true';
|
||||
},
|
||||
|
||||
gDate: function(k){
|
||||
return new Date(this.g(k));
|
||||
},
|
||||
|
||||
};
|
||||
})();
|
||||
|
||||
})(window);
|
||||
@@ -0,0 +1,9 @@
|
||||
/* axios v0.19.0 | (c) 2019 by Matt Zabriskie */
|
||||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.axios=t():e.axios=t()}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){e.exports=n(1)},function(e,t,n){"use strict";function r(e){var t=new i(e),n=s(i.prototype.request,t);return o.extend(n,i.prototype,t),o.extend(n,t),n}var o=n(2),s=n(3),i=n(5),a=n(22),u=n(11),c=r(u);c.Axios=i,c.create=function(e){return r(a(c.defaults,e))},c.Cancel=n(23),c.CancelToken=n(24),c.isCancel=n(10),c.all=function(e){return Promise.all(e)},c.spread=n(25),e.exports=c,e.exports.default=c},function(e,t,n){"use strict";function r(e){return"[object Array]"===j.call(e)}function o(e){return"[object ArrayBuffer]"===j.call(e)}function s(e){return"undefined"!=typeof FormData&&e instanceof FormData}function i(e){var t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer}function a(e){return"string"==typeof e}function u(e){return"number"==typeof e}function c(e){return"undefined"==typeof e}function f(e){return null!==e&&"object"==typeof e}function p(e){return"[object Date]"===j.call(e)}function d(e){return"[object File]"===j.call(e)}function l(e){return"[object Blob]"===j.call(e)}function h(e){return"[object Function]"===j.call(e)}function m(e){return f(e)&&h(e.pipe)}function y(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams}function g(e){return e.replace(/^\s*/,"").replace(/\s*$/,"")}function x(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)}function v(e,t){if(null!==e&&"undefined"!=typeof e)if("object"!=typeof e&&(e=[e]),r(e))for(var n=0,o=e.length;n<o;n++)t.call(null,e[n],n,e);else for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.call(null,e[s],s,e)}function w(){function e(e,n){"object"==typeof t[n]&&"object"==typeof e?t[n]=w(t[n],e):t[n]=e}for(var t={},n=0,r=arguments.length;n<r;n++)v(arguments[n],e);return t}function b(){function e(e,n){"object"==typeof t[n]&&"object"==typeof e?t[n]=b(t[n],e):"object"==typeof e?t[n]=b({},e):t[n]=e}for(var t={},n=0,r=arguments.length;n<r;n++)v(arguments[n],e);return t}function E(e,t,n){return v(t,function(t,r){n&&"function"==typeof t?e[r]=S(t,n):e[r]=t}),e}var S=n(3),R=n(4),j=Object.prototype.toString;e.exports={isArray:r,isArrayBuffer:o,isBuffer:R,isFormData:s,isArrayBufferView:i,isString:a,isNumber:u,isObject:f,isUndefined:c,isDate:p,isFile:d,isBlob:l,isFunction:h,isStream:m,isURLSearchParams:y,isStandardBrowserEnv:x,forEach:v,merge:w,deepMerge:b,extend:E,trim:g}},function(e,t){"use strict";e.exports=function(e,t){return function(){for(var n=new Array(arguments.length),r=0;r<n.length;r++)n[r]=arguments[r];return e.apply(t,n)}}},function(e,t){/*!
|
||||
* Determine if an object is a Buffer
|
||||
*
|
||||
* @author Feross Aboukhadijeh <https://feross.org>
|
||||
* @license MIT
|
||||
*/
|
||||
e.exports=function(e){return null!=e&&null!=e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}},function(e,t,n){"use strict";function r(e){this.defaults=e,this.interceptors={request:new i,response:new i}}var o=n(2),s=n(6),i=n(7),a=n(8),u=n(22);r.prototype.request=function(e){"string"==typeof e?(e=arguments[1]||{},e.url=arguments[0]):e=e||{},e=u(this.defaults,e),e.method=e.method?e.method.toLowerCase():"get";var t=[a,void 0],n=Promise.resolve(e);for(this.interceptors.request.forEach(function(e){t.unshift(e.fulfilled,e.rejected)}),this.interceptors.response.forEach(function(e){t.push(e.fulfilled,e.rejected)});t.length;)n=n.then(t.shift(),t.shift());return n},r.prototype.getUri=function(e){return e=u(this.defaults,e),s(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},o.forEach(["delete","get","head","options"],function(e){r.prototype[e]=function(t,n){return this.request(o.merge(n||{},{method:e,url:t}))}}),o.forEach(["post","put","patch"],function(e){r.prototype[e]=function(t,n,r){return this.request(o.merge(r||{},{method:e,url:t,data:n}))}}),e.exports=r},function(e,t,n){"use strict";function r(e){return encodeURIComponent(e).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var o=n(2);e.exports=function(e,t,n){if(!t)return e;var s;if(n)s=n(t);else if(o.isURLSearchParams(t))s=t.toString();else{var i=[];o.forEach(t,function(e,t){null!==e&&"undefined"!=typeof e&&(o.isArray(e)?t+="[]":e=[e],o.forEach(e,function(e){o.isDate(e)?e=e.toISOString():o.isObject(e)&&(e=JSON.stringify(e)),i.push(r(t)+"="+r(e))}))}),s=i.join("&")}if(s){var a=e.indexOf("#");a!==-1&&(e=e.slice(0,a)),e+=(e.indexOf("?")===-1?"?":"&")+s}return e}},function(e,t,n){"use strict";function r(){this.handlers=[]}var o=n(2);r.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1},r.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},r.prototype.forEach=function(e){o.forEach(this.handlers,function(t){null!==t&&e(t)})},e.exports=r},function(e,t,n){"use strict";function r(e){e.cancelToken&&e.cancelToken.throwIfRequested()}var o=n(2),s=n(9),i=n(10),a=n(11),u=n(20),c=n(21);e.exports=function(e){r(e),e.baseURL&&!u(e.url)&&(e.url=c(e.baseURL,e.url)),e.headers=e.headers||{},e.data=s(e.data,e.headers,e.transformRequest),e.headers=o.merge(e.headers.common||{},e.headers[e.method]||{},e.headers||{}),o.forEach(["delete","get","head","post","put","patch","common"],function(t){delete e.headers[t]});var t=e.adapter||a.adapter;return t(e).then(function(t){return r(e),t.data=s(t.data,t.headers,e.transformResponse),t},function(t){return i(t)||(r(e),t&&t.response&&(t.response.data=s(t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)})}},function(e,t,n){"use strict";var r=n(2);e.exports=function(e,t,n){return r.forEach(n,function(n){e=n(e,t)}),e}},function(e,t){"use strict";e.exports=function(e){return!(!e||!e.__CANCEL__)}},function(e,t,n){"use strict";function r(e,t){!s.isUndefined(e)&&s.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}function o(){var e;return"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process)?e=n(13):"undefined"!=typeof XMLHttpRequest&&(e=n(13)),e}var s=n(2),i=n(12),a={"Content-Type":"application/x-www-form-urlencoded"},u={adapter:o(),transformRequest:[function(e,t){return i(t,"Accept"),i(t,"Content-Type"),s.isFormData(e)||s.isArrayBuffer(e)||s.isBuffer(e)||s.isStream(e)||s.isFile(e)||s.isBlob(e)?e:s.isArrayBufferView(e)?e.buffer:s.isURLSearchParams(e)?(r(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):s.isObject(e)?(r(t,"application/json;charset=utf-8"),JSON.stringify(e)):e}],transformResponse:[function(e){if("string"==typeof e)try{e=JSON.parse(e)}catch(e){}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,validateStatus:function(e){return e>=200&&e<300}};u.headers={common:{Accept:"application/json, text/plain, */*"}},s.forEach(["delete","get","head"],function(e){u.headers[e]={}}),s.forEach(["post","put","patch"],function(e){u.headers[e]=s.merge(a)}),e.exports=u},function(e,t,n){"use strict";var r=n(2);e.exports=function(e,t){r.forEach(e,function(n,r){r!==t&&r.toUpperCase()===t.toUpperCase()&&(e[t]=n,delete e[r])})}},function(e,t,n){"use strict";var r=n(2),o=n(14),s=n(6),i=n(17),a=n(18),u=n(15);e.exports=function(e){return new Promise(function(t,c){var f=e.data,p=e.headers;r.isFormData(f)&&delete p["Content-Type"];var d=new XMLHttpRequest;if(e.auth){var l=e.auth.username||"",h=e.auth.password||"";p.Authorization="Basic "+btoa(l+":"+h)}if(d.open(e.method.toUpperCase(),s(e.url,e.params,e.paramsSerializer),!0),d.timeout=e.timeout,d.onreadystatechange=function(){if(d&&4===d.readyState&&(0!==d.status||d.responseURL&&0===d.responseURL.indexOf("file:"))){var n="getAllResponseHeaders"in d?i(d.getAllResponseHeaders()):null,r=e.responseType&&"text"!==e.responseType?d.response:d.responseText,s={data:r,status:d.status,statusText:d.statusText,headers:n,config:e,request:d};o(t,c,s),d=null}},d.onabort=function(){d&&(c(u("Request aborted",e,"ECONNABORTED",d)),d=null)},d.onerror=function(){c(u("Network Error",e,null,d)),d=null},d.ontimeout=function(){c(u("timeout of "+e.timeout+"ms exceeded",e,"ECONNABORTED",d)),d=null},r.isStandardBrowserEnv()){var m=n(19),y=(e.withCredentials||a(e.url))&&e.xsrfCookieName?m.read(e.xsrfCookieName):void 0;y&&(p[e.xsrfHeaderName]=y)}if("setRequestHeader"in d&&r.forEach(p,function(e,t){"undefined"==typeof f&&"content-type"===t.toLowerCase()?delete p[t]:d.setRequestHeader(t,e)}),e.withCredentials&&(d.withCredentials=!0),e.responseType)try{d.responseType=e.responseType}catch(t){if("json"!==e.responseType)throw t}"function"==typeof e.onDownloadProgress&&d.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&d.upload&&d.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then(function(e){d&&(d.abort(),c(e),d=null)}),void 0===f&&(f=null),d.send(f)})}},function(e,t,n){"use strict";var r=n(15);e.exports=function(e,t,n){var o=n.config.validateStatus;!o||o(n.status)?e(n):t(r("Request failed with status code "+n.status,n.config,null,n.request,n))}},function(e,t,n){"use strict";var r=n(16);e.exports=function(e,t,n,o,s){var i=new Error(e);return r(i,t,n,o,s)}},function(e,t){"use strict";e.exports=function(e,t,n,r,o){return e.config=t,n&&(e.code=n),e.request=r,e.response=o,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},e}},function(e,t,n){"use strict";var r=n(2),o=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];e.exports=function(e){var t,n,s,i={};return e?(r.forEach(e.split("\n"),function(e){if(s=e.indexOf(":"),t=r.trim(e.substr(0,s)).toLowerCase(),n=r.trim(e.substr(s+1)),t){if(i[t]&&o.indexOf(t)>=0)return;"set-cookie"===t?i[t]=(i[t]?i[t]:[]).concat([n]):i[t]=i[t]?i[t]+", "+n:n}}),i):i}},function(e,t,n){"use strict";var r=n(2);e.exports=r.isStandardBrowserEnv()?function(){function e(e){var t=e;return n&&(o.setAttribute("href",t),t=o.href),o.setAttribute("href",t),{href:o.href,protocol:o.protocol?o.protocol.replace(/:$/,""):"",host:o.host,search:o.search?o.search.replace(/^\?/,""):"",hash:o.hash?o.hash.replace(/^#/,""):"",hostname:o.hostname,port:o.port,pathname:"/"===o.pathname.charAt(0)?o.pathname:"/"+o.pathname}}var t,n=/(msie|trident)/i.test(navigator.userAgent),o=document.createElement("a");return t=e(window.location.href),function(n){var o=r.isString(n)?e(n):n;return o.protocol===t.protocol&&o.host===t.host}}():function(){return function(){return!0}}()},function(e,t,n){"use strict";var r=n(2);e.exports=r.isStandardBrowserEnv()?function(){return{write:function(e,t,n,o,s,i){var a=[];a.push(e+"="+encodeURIComponent(t)),r.isNumber(n)&&a.push("expires="+new Date(n).toGMTString()),r.isString(o)&&a.push("path="+o),r.isString(s)&&a.push("domain="+s),i===!0&&a.push("secure"),document.cookie=a.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}()},function(e,t){"use strict";e.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}},function(e,t){"use strict";e.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}},function(e,t,n){"use strict";var r=n(2);e.exports=function(e,t){t=t||{};var n={};return r.forEach(["url","method","params","data"],function(e){"undefined"!=typeof t[e]&&(n[e]=t[e])}),r.forEach(["headers","auth","proxy"],function(o){r.isObject(t[o])?n[o]=r.deepMerge(e[o],t[o]):"undefined"!=typeof t[o]?n[o]=t[o]:r.isObject(e[o])?n[o]=r.deepMerge(e[o]):"undefined"!=typeof e[o]&&(n[o]=e[o])}),r.forEach(["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","maxContentLength","validateStatus","maxRedirects","httpAgent","httpsAgent","cancelToken","socketPath"],function(r){"undefined"!=typeof t[r]?n[r]=t[r]:"undefined"!=typeof e[r]&&(n[r]=e[r])}),n}},function(e,t){"use strict";function n(e){this.message=e}n.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},n.prototype.__CANCEL__=!0,e.exports=n},function(e,t,n){"use strict";function r(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise(function(e){t=e});var n=this;e(function(e){n.reason||(n.reason=new o(e),t(n.reason))})}var o=n(23);r.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},r.source=function(){var e,t=new r(function(t){e=t});return{token:t,cancel:e}},e.exports=r},function(e,t){"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}}])});
|
||||
//# sourceMappingURL=axios.min.map
|
||||
@@ -0,0 +1,32 @@
|
||||
/*!Tdrag 0.0.1*/;(function($,window,document,undefined){jQuery(function(){$.fn.Tdrag=function(opt){var call={scope:null,grid:null,axis:"all",pos:false,handle:null,moveClass:"tezml",dragChange:false,changeMode:"point",cbStart:function(){},cbMove:function(){},cbEnd:function(){},random:false,randomInput:null,animation_options:{duration:800,easing:"ease-out"},disable:false,disableInput:null};var dragfn=new Dragfn(this,opt);if(opt&&$.isEmptyObject(opt)==false){dragfn.options=$.extend(call,opt);}else{dragfn.options=call;}
|
||||
dragfn.firstRandom=true;var ele=dragfn.$element;dragfn.pack(ele,false);if(dragfn.options.randomInput!=null){$(dragfn.options.randomInput).bind("click",function(){dragfn.pack(ele,true);})}
|
||||
dragfn.loadJqueryfn()};var Dragfn=function(ele,opt){this.$element=ele;this.options=opt;};Dragfn.prototype={init:function(obj){var self=this;self.ele=self.$element;self.handle=$(obj);self.options=self.options;self.disable=self.options.disable;self._start=false;self._move=false;self._end=false;self.disX=0;self.disY=0;self.zIndex=1000;self.moving=false;self.moves="";self.box=$.type(self.options.scope)==="string"?self.options.scope:null;if(self.options.handle!=null){self.handle=$(obj).find(self.options.handle);}
|
||||
self.handle.on("mousedown",function(ev){self.start(ev,obj);obj.setCapture&&obj.setCapture();return false;});if(self.options.dragChange){$(obj).on("mousemove",function(ev){self.move(ev,obj);});$(obj).on("mouseup",function(ev){self.end(ev,obj);});}else{$(document).on("mousemove",function(ev){self.move(ev,obj);});$(document).on("mouseup",function(ev){self.end(ev,obj);});}},loadJqueryfn:function(){var self=this;$.extend({sortBox:function(obj){var arr=[];for(var s=0;s<$(obj).length;s++){arr.push($(obj).eq(s));}
|
||||
for(var i=0;i<arr.length;i++){for(var j=i+1;j<arr.length;j++){if(Number(arr[i].attr("index"))>Number(arr[j].attr("index"))){var temp=arr[i];arr[i]=arr[j];arr[j]=temp;}}}
|
||||
return arr},randomfn:function(obj){self.pack($(obj),true);},disable_open:function(){self.disable=false;},disable_cloose:function(){self.disable=true;}});},toDisable:function(){var self=this;if(self.options.disableInput!=null){$(self.options.disableInput).bind("click",function(){if(self.disable==true){self.disable=false}else{self.disable=true}})}},start:function(ev,obj){var self=this;self.moved=obj;if(self.disable==true){return false}
|
||||
self._start=true;var oEvent=ev||event;self.disX=oEvent.clientX-obj.offsetLeft;self.disY=oEvent.clientY-obj.offsetTop;$(obj).css("zIndex",self.zIndex++);self.options.cbStart();},move:function(ev,obj){var self=this;if(self._start!=true){return false}
|
||||
if(obj!=self.moved){return false}
|
||||
self._move=true;var oEvent=ev||event;var l=oEvent.clientX-self.disX;var t=oEvent.clientY-self.disY;if(self.box!=null){var rule=self.collTestBox(obj,self.box);if(l>rule.lmax){l=rule.lmax;}else if(l<rule.lmin){l=rule.lmin;}
|
||||
if(t>rule.tmax){t=rule.tmax;}else if(t<rule.tmin){t=rule.tmin;}}
|
||||
if(self.options.axis=="all"){obj.style.left=self.grid(obj,l,t).left+'px';obj.style.top=self.grid(obj,l,t).top+'px';}else if(self.options.axis=="y"){obj.style.top=self.grid(obj,l,t).top+'px';}else if(self.options.axis=="x"){obj.style.left=self.grid(obj,l,t).left+'px';}
|
||||
if(self.options.pos==true){self.moveAddClass(obj);}
|
||||
self.options.cbMove(obj,self);},end:function(ev,obj){var self=this;if(self._start!=true){return false}
|
||||
if(self.options.changeMode=="sort"&&self.options.pos==true){self.sortDrag(obj);}else if(self.options.changeMode=="point"&&self.options.pos==true){self.pointDrag(obj);}
|
||||
if(self.options.pos==true){self.animation(obj,self.aPos[$(obj).attr("index")]);}
|
||||
self.options.cbEnd();if(self.options.handle!=null){$(obj).find(self.options.handle).unbind("onmousemove");$(obj).find(self.options.handle).unbind("onmouseup");}else{$(obj).unbind("onmousemove");$(obj).unbind("onmouseup");}
|
||||
obj.releaseCapture&&obj.releaseCapture();self._start=false;},collTestBox:function(obj,obj2){var self=this;var l1=0;var t1=0;var l2=$(obj2).innerWidth()-$(obj).outerWidth();var t2=$(obj2).innerHeight()-$(obj).outerHeight();return{lmin:l1,tmin:t1,lmax:l2,tmax:t2}},grid:function(obj,l,t){var self=this;var json={left:l,top:t};if($.isArray(self.options.grid)&&self.options.grid.length==2){var gx=self.options.grid[0];var gy=self.options.grid[1];json.left=Math.floor((l+gx/2)/gx)*gx;json.top=Math.floor((t+gy/2)/gy)*gy;return json}else if(self.options.grid==null){return json}else{console.log("grid参数传递格式错误");return false}},findNearest:function(obj){var self=this;var iMin=new Date().getTime();var iMinIndex=-1;var ele=self.ele;for(var i=0;i<ele.length;i++){if(obj==ele[i]){continue;}
|
||||
if(self.collTest(obj,ele[i])){var dis=self.getDis(obj,ele[i]);if(dis<iMin){iMin=dis;iMinIndex=i;}}}
|
||||
if(iMinIndex==-1){return null;}else{return ele[iMinIndex];}},getDis:function(obj,obj2){var self=this;var l1=obj.offsetLeft+obj.offsetWidth/2;var l2=obj2.offsetLeft+obj2.offsetWidth/2;var t1=obj.offsetTop+obj.offsetHeight/2;var t2=obj2.offsetTop+obj2.offsetHeight/2;var a=l2-l1;var b=t1-t2;return Math.sqrt(a*a+b*b);},collTest:function(obj,obj2){var self=this;var l1=obj.offsetLeft;var r1=obj.offsetLeft+obj.offsetWidth;var t1=obj.offsetTop;var b1=obj.offsetTop+obj.offsetHeight;var l2=obj2.offsetLeft;var r2=obj2.offsetLeft+obj2.offsetWidth;var t2=obj2.offsetTop;var b2=obj2.offsetTop+obj2.offsetHeight;if(r1<l2||r2<l1||t2>b1||b2<t1){return false;}else{return true;}},pack:function(ele,click){var self=this;self.toDisable();if(self.options.pos==false){for(var i=0;i<ele.length;i++){$(ele[i]).css("position","absolute");$(ele[i]).css("margin","0");self.init(ele[i]);}}else if(self.options.pos==true){var arr=[];if(self.options.random||click){while(arr.length<ele.length){var n=self.rnd(0,ele.length);if(!self.finInArr(arr,n)){arr.push(n);}}}
|
||||
if(self.options.random==false||click!=true){var n=0;while(arr.length<ele.length){arr.push(n);n++}}
|
||||
if(self.firstRandom==false){var sortarr=[];var n=0;while(sortarr.length<ele.length){sortarr.push(n);n++}
|
||||
for(var i=0;i<ele.length;i++){$(ele[i]).attr("index",sortarr[i]);$(ele[i]).css("left",self.aPos[sortarr[i]].left);$(ele[i]).css("top",self.aPos[sortarr[i]].top);}}
|
||||
self.aPos=[];if(self.firstRandom==false){for(var j=0;j<ele.length;j++){self.aPos[j]={left:ele[$(ele).eq(j).attr("index")].offsetLeft,top:ele[$(ele).eq(j).attr("index")].offsetTop};}}else{for(var j=0;j<ele.length;j++){self.aPos[j]={left:ele[j].offsetLeft,top:ele[j].offsetTop};}}
|
||||
for(var i=0;i<ele.length;i++){$(ele[i]).attr("index",arr[i]);$(ele[i]).css("left",self.aPos[arr[i]].left);$(ele[i]).css("top",self.aPos[arr[i]].top);$(ele[i]).css("position","absolute");$(ele[i]).css("margin","0");self.init(ele[i]);}
|
||||
self.firstRandom=false;}},moveAddClass:function(obj){var self=this;var oNear=self.findNearest(obj);$(self.$element).removeClass(self.options.moveClass);if(oNear&&$(oNear).hasClass(self.options.moveClass)==false){$(oNear).addClass(self.options.moveClass);}},sort:function(){var self=this;var arr_li=[];for(var s=0;s<self.$element.length;s++){arr_li.push(self.$element[s]);}
|
||||
for(var i=0;i<arr_li.length;i++){for(var j=i+1;j<arr_li.length;j++){if(Number($(arr_li[i]).attr("index"))>Number($(arr_li[j]).attr("index"))){var temp=arr_li[i];arr_li[i]=arr_li[j];arr_li[j]=temp;}}}
|
||||
return arr_li;},pointDrag:function(obj){var self=this;var oNear=self.findNearest(obj);if(oNear){self.animation(obj,self.aPos[$(oNear).attr("index")]);self.animation(oNear,self.aPos[$(obj).attr("index")]);var tmp;tmp=$(obj).attr("index");$(obj).attr("index",$(oNear).attr("index"));$(oNear).attr("index",tmp);$(oNear).removeClass(self.options.moveClass);}else if(self.options.changeWhen=="end"){self.animation(obj,self.aPos[$(obj).attr("index")]);}},sortDrag:function(obj){var self=this;var arr_li=self.sort();var oNear=self.findNearest(obj);if(oNear){if(Number($(oNear).attr("index"))>Number($(obj).attr("index"))){var obj_tmp=Number($(obj).attr("index"));$(obj).attr("index",Number($(oNear).attr("index"))+1);for(var i=obj_tmp;i<Number($(oNear).attr("index"))+1;i++){self.animation(arr_li[i],self.aPos[i-1]);self.animation(obj,self.aPos[$(oNear).attr("index")]);$(arr_li[i]).removeClass(self.options.moveClass);$(arr_li[i]).attr("index",Number($(arr_li[i]).attr("index"))-1);}}else if(Number($(obj).attr("index"))>Number($(oNear).attr("index"))){var obj_tmp=Number($(obj).attr("index"));$(obj).attr("index",$(oNear).attr("index"));for(var i=Number($(oNear).attr("index"));i<obj_tmp;i++){self.animation(arr_li[i],self.aPos[i+1]);self.animation(obj,self.aPos[Number($(obj).attr("index"))]);$(arr_li[i]).removeClass(self.options.moveClass);$(arr_li[i]).attr("index",Number($(arr_li[i]).attr("index"))+1);}}}else{self.animation(obj,self.aPos[$(obj).attr("index")]);}},animation:function(obj,json){var self=this;var options=self.options.animation_options;var self=this;var count=Math.round(options.duration/30);var start={};var dis={};for(var name in json){start[name]=parseFloat(self.getStyle(obj,name));if(isNaN(start[name])){switch(name){case 'left':start[name]=obj.offsetLeft;break;case 'top':start[name]=obj.offsetTop;break;case 'width':start[name]=obj.offsetWidth;break;case 'height':start[name]=obj.offsetHeight;break;case 'marginLeft':start[name]=obj.offsetLeft;break;case 'borderWidth':start[name]=0;break;}}
|
||||
dis[name]=json[name]-start[name];}
|
||||
var n=0;clearInterval(obj.timer);obj.timer=setInterval(function(){n++;for(var name in json){switch(options.easing){case 'linear':var a=n/count;var cur=start[name]+dis[name]*a;break;case 'ease-in':var a=n/count;var cur=start[name]+dis[name]*a*a*a;break;case 'ease-out':var a=1-n/count;var cur=start[name]+dis[name]*(1-a*a*a);break;}
|
||||
if(name=='opacity'){obj.style.opacity=cur;obj.style.filter='alpha(opacity:'+cur*100+')';}else{obj.style[name]=cur+'px';}}
|
||||
if(n==count){clearInterval(obj.timer);options.complete&&options.complete();}},30);},getStyle:function(obj,name){return(obj.currentStyle||getComputedStyle(obj,false))[name];},rnd:function(n,m){return parseInt(Math.random()*(m-n)+n);},finInArr:function(arr,n){for(var i=0;i<arr.length;i++){if(arr[i]==n){return true;}}
|
||||
return false;}}})})(jQuery,window,document);
|
||||
@@ -0,0 +1,4 @@
|
||||
/*! jQuery v2.2.3 | (c) jQuery Foundation | jquery.org/license */
|
||||
!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=a.document,e=c.slice,f=c.concat,g=c.push,h=c.indexOf,i={},j=i.toString,k=i.hasOwnProperty,l={},m="2.2.3",n=function(a,b){return new n.fn.init(a,b)},o=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,p=/^-ms-/,q=/-([\da-z])/gi,r=function(a,b){return b.toUpperCase()};n.fn=n.prototype={jquery:m,constructor:n,selector:"",length:0,toArray:function(){return e.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:e.call(this)},pushStack:function(a){var b=n.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a){return n.each(this,a)},map:function(a){return this.pushStack(n.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(e.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor()},push:g,sort:c.sort,splice:c.splice},n.extend=n.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||n.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(a=arguments[h]))for(b in a)c=g[b],d=a[b],g!==d&&(j&&d&&(n.isPlainObject(d)||(e=n.isArray(d)))?(e?(e=!1,f=c&&n.isArray(c)?c:[]):f=c&&n.isPlainObject(c)?c:{},g[b]=n.extend(j,f,d)):void 0!==d&&(g[b]=d));return g},n.extend({expando:"jQuery"+(m+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===n.type(a)},isArray:Array.isArray,isWindow:function(a){return null!=a&&a===a.window},isNumeric:function(a){var b=a&&a.toString();return!n.isArray(a)&&b-parseFloat(b)+1>=0},isPlainObject:function(a){var b;if("object"!==n.type(a)||a.nodeType||n.isWindow(a))return!1;if(a.constructor&&!k.call(a,"constructor")&&!k.call(a.constructor.prototype||{},"isPrototypeOf"))return!1;for(b in a);return void 0===b||k.call(a,b)},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?i[j.call(a)]||"object":typeof a},globalEval:function(a){var b,c=eval;a=n.trim(a),a&&(1===a.indexOf("use strict")?(b=d.createElement("script"),b.text=a,d.head.appendChild(b).parentNode.removeChild(b)):c(a))},camelCase:function(a){return a.replace(p,"ms-").replace(q,r)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b){var c,d=0;if(s(a)){for(c=a.length;c>d;d++)if(b.call(a[d],d,a[d])===!1)break}else for(d in a)if(b.call(a[d],d,a[d])===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(o,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(s(Object(a))?n.merge(c,"string"==typeof a?[a]:a):g.call(c,a)),c},inArray:function(a,b,c){return null==b?-1:h.call(b,a,c)},merge:function(a,b){for(var c=+b.length,d=0,e=a.length;c>d;d++)a[e++]=b[d];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,e,g=0,h=[];if(s(a))for(d=a.length;d>g;g++)e=b(a[g],g,c),null!=e&&h.push(e);else for(g in a)e=b(a[g],g,c),null!=e&&h.push(e);return f.apply([],h)},guid:1,proxy:function(a,b){var c,d,f;return"string"==typeof b&&(c=a[b],b=a,a=c),n.isFunction(a)?(d=e.call(arguments,2),f=function(){return a.apply(b||this,d.concat(e.call(arguments)))},f.guid=a.guid=a.guid||n.guid++,f):void 0},now:Date.now,support:l}),"function"==typeof Symbol&&(n.fn[Symbol.iterator]=c[Symbol.iterator]),n.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(a,b){i["[object "+b+"]"]=b.toLowerCase()});function s(a){var b=!!a&&"length"in a&&a.length,c=n.type(a);return"function"===c||n.isWindow(a)?!1:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var t=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+1*new Date,v=a.document,w=0,x=0,y=ga(),z=ga(),A=ga(),B=function(a,b){return a===b&&(l=!0),0},C=1<<31,D={}.hasOwnProperty,E=[],F=E.pop,G=E.push,H=E.push,I=E.slice,J=function(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1},K="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",L="[\\x20\\t\\r\\n\\f]",M="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",N="\\["+L+"*("+M+")(?:"+L+"*([*^$|!~]?=)"+L+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+M+"))|)"+L+"*\\]",O=":("+M+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+N+")*)|.*)\\)|)",P=new RegExp(L+"+","g"),Q=new RegExp("^"+L+"+|((?:^|[^\\\\])(?:\\\\.)*)"+L+"+$","g"),R=new RegExp("^"+L+"*,"+L+"*"),S=new RegExp("^"+L+"*([>+~]|"+L+")"+L+"*"),T=new RegExp("="+L+"*([^\\]'\"]*?)"+L+"*\\]","g"),U=new RegExp(O),V=new RegExp("^"+M+"$"),W={ID:new RegExp("^#("+M+")"),CLASS:new RegExp("^\\.("+M+")"),TAG:new RegExp("^("+M+"|[*])"),ATTR:new RegExp("^"+N),PSEUDO:new RegExp("^"+O),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+L+"*(even|odd|(([+-]|)(\\d*)n|)"+L+"*(?:([+-]|)"+L+"*(\\d+)|))"+L+"*\\)|)","i"),bool:new RegExp("^(?:"+K+")$","i"),needsContext:new RegExp("^"+L+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+L+"*((?:-\\d)?\\d*)"+L+"*\\)|)(?=[^-]|$)","i")},X=/^(?:input|select|textarea|button)$/i,Y=/^h\d$/i,Z=/^[^{]+\{\s*\[native \w/,$=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,_=/[+~]/,aa=/'|\\/g,ba=new RegExp("\\\\([\\da-f]{1,6}"+L+"?|("+L+")|.)","ig"),ca=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)},da=function(){m()};try{H.apply(E=I.call(v.childNodes),v.childNodes),E[v.childNodes.length].nodeType}catch(ea){H={apply:E.length?function(a,b){G.apply(a,I.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function fa(a,b,d,e){var f,h,j,k,l,o,r,s,w=b&&b.ownerDocument,x=b?b.nodeType:9;if(d=d||[],"string"!=typeof a||!a||1!==x&&9!==x&&11!==x)return d;if(!e&&((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,p)){if(11!==x&&(o=$.exec(a)))if(f=o[1]){if(9===x){if(!(j=b.getElementById(f)))return d;if(j.id===f)return d.push(j),d}else if(w&&(j=w.getElementById(f))&&t(b,j)&&j.id===f)return d.push(j),d}else{if(o[2])return H.apply(d,b.getElementsByTagName(a)),d;if((f=o[3])&&c.getElementsByClassName&&b.getElementsByClassName)return H.apply(d,b.getElementsByClassName(f)),d}if(c.qsa&&!A[a+" "]&&(!q||!q.test(a))){if(1!==x)w=b,s=a;else if("object"!==b.nodeName.toLowerCase()){(k=b.getAttribute("id"))?k=k.replace(aa,"\\$&"):b.setAttribute("id",k=u),r=g(a),h=r.length,l=V.test(k)?"#"+k:"[id='"+k+"']";while(h--)r[h]=l+" "+qa(r[h]);s=r.join(","),w=_.test(a)&&oa(b.parentNode)||b}if(s)try{return H.apply(d,w.querySelectorAll(s)),d}catch(y){}finally{k===u&&b.removeAttribute("id")}}}return i(a.replace(Q,"$1"),b,d,e)}function ga(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function ha(a){return a[u]=!0,a}function ia(a){var b=n.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function ja(a,b){var c=a.split("|"),e=c.length;while(e--)d.attrHandle[c[e]]=b}function ka(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||C)-(~a.sourceIndex||C);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function la(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function ma(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function na(a){return ha(function(b){return b=+b,ha(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function oa(a){return a&&"undefined"!=typeof a.getElementsByTagName&&a}c=fa.support={},f=fa.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=fa.setDocument=function(a){var b,e,g=a?a.ownerDocument||a:v;return g!==n&&9===g.nodeType&&g.documentElement?(n=g,o=n.documentElement,p=!f(n),(e=n.defaultView)&&e.top!==e&&(e.addEventListener?e.addEventListener("unload",da,!1):e.attachEvent&&e.attachEvent("onunload",da)),c.attributes=ia(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ia(function(a){return a.appendChild(n.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=Z.test(n.getElementsByClassName),c.getById=ia(function(a){return o.appendChild(a).id=u,!n.getElementsByName||!n.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c=b.getElementById(a);return c?[c]:[]}},d.filter.ID=function(a){var b=a.replace(ba,ca);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(ba,ca);return function(a){var c="undefined"!=typeof a.getAttributeNode&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return"undefined"!=typeof b.getElementsByTagName?b.getElementsByTagName(a):c.qsa?b.querySelectorAll(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return"undefined"!=typeof b.getElementsByClassName&&p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=Z.test(n.querySelectorAll))&&(ia(function(a){o.appendChild(a).innerHTML="<a id='"+u+"'></a><select id='"+u+"-\r\\' msallowcapture=''><option selected=''></option></select>",a.querySelectorAll("[msallowcapture^='']").length&&q.push("[*^$]="+L+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+L+"*(?:value|"+K+")"),a.querySelectorAll("[id~="+u+"-]").length||q.push("~="),a.querySelectorAll(":checked").length||q.push(":checked"),a.querySelectorAll("a#"+u+"+*").length||q.push(".#.+[+~]")}),ia(function(a){var b=n.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+L+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=Z.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ia(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",O)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=Z.test(o.compareDocumentPosition),t=b||Z.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===n||a.ownerDocument===v&&t(v,a)?-1:b===n||b.ownerDocument===v&&t(v,b)?1:k?J(k,a)-J(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,e=a.parentNode,f=b.parentNode,g=[a],h=[b];if(!e||!f)return a===n?-1:b===n?1:e?-1:f?1:k?J(k,a)-J(k,b):0;if(e===f)return ka(a,b);c=a;while(c=c.parentNode)g.unshift(c);c=b;while(c=c.parentNode)h.unshift(c);while(g[d]===h[d])d++;return d?ka(g[d],h[d]):g[d]===v?-1:h[d]===v?1:0},n):n},fa.matches=function(a,b){return fa(a,null,null,b)},fa.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(T,"='$1']"),c.matchesSelector&&p&&!A[b+" "]&&(!r||!r.test(b))&&(!q||!q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return fa(b,n,null,[a]).length>0},fa.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},fa.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&D.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},fa.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},fa.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=fa.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=fa.selectors={cacheLength:50,createPseudo:ha,match:W,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(ba,ca),a[3]=(a[3]||a[4]||a[5]||"").replace(ba,ca),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||fa.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&fa.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return W.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&U.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(ba,ca).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+L+")"+a+"("+L+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||"undefined"!=typeof a.getAttribute&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=fa.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e.replace(P," ")+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h,t=!1;if(q){if(f){while(p){m=b;while(m=m[p])if(h?m.nodeName.toLowerCase()===r:1===m.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){m=q,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n&&j[2],m=n&&q.childNodes[n];while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if(1===m.nodeType&&++t&&m===b){k[a]=[w,n,t];break}}else if(s&&(m=b,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n),t===!1)while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if((h?m.nodeName.toLowerCase()===r:1===m.nodeType)&&++t&&(s&&(l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),k[a]=[w,t]),m===b))break;return t-=e,t===d||t%d===0&&t/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||fa.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?ha(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=J(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:ha(function(a){var b=[],c=[],d=h(a.replace(Q,"$1"));return d[u]?ha(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),b[0]=null,!c.pop()}}),has:ha(function(a){return function(b){return fa(a,b).length>0}}),contains:ha(function(a){return a=a.replace(ba,ca),function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:ha(function(a){return V.test(a||"")||fa.error("unsupported lang: "+a),a=a.replace(ba,ca).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return Y.test(a.nodeName)},input:function(a){return X.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:na(function(){return[0]}),last:na(function(a,b){return[b-1]}),eq:na(function(a,b,c){return[0>c?c+b:c]}),even:na(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:na(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:na(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:na(function(a,b,c){for(var d=0>c?c+b:c;++d<b;)a.push(d);return a})}},d.pseudos.nth=d.pseudos.eq;for(b in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})d.pseudos[b]=la(b);for(b in{submit:!0,reset:!0})d.pseudos[b]=ma(b);function pa(){}pa.prototype=d.filters=d.pseudos,d.setFilters=new pa,g=fa.tokenize=function(a,b){var c,e,f,g,h,i,j,k=z[a+" "];if(k)return b?0:k.slice(0);h=a,i=[],j=d.preFilter;while(h){c&&!(e=R.exec(h))||(e&&(h=h.slice(e[0].length)||h),i.push(f=[])),c=!1,(e=S.exec(h))&&(c=e.shift(),f.push({value:c,type:e[0].replace(Q," ")}),h=h.slice(c.length));for(g in d.filter)!(e=W[g].exec(h))||j[g]&&!(e=j[g](e))||(c=e.shift(),f.push({value:c,type:g,matches:e}),h=h.slice(c.length));if(!c)break}return b?h.length:h?fa.error(a):z(a,i).slice(0)};function qa(a){for(var b=0,c=a.length,d="";c>b;b++)d+=a[b].value;return d}function ra(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=x++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j,k=[w,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(j=b[u]||(b[u]={}),i=j[b.uniqueID]||(j[b.uniqueID]={}),(h=i[d])&&h[0]===w&&h[1]===f)return k[2]=h[2];if(i[d]=k,k[2]=a(b,c,g))return!0}}}function sa(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function ta(a,b,c){for(var d=0,e=b.length;e>d;d++)fa(a,b[d],c);return c}function ua(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(c&&!c(f,d,e)||(g.push(f),j&&b.push(h)));return g}function va(a,b,c,d,e,f){return d&&!d[u]&&(d=va(d)),e&&!e[u]&&(e=va(e,f)),ha(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||ta(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:ua(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=ua(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?J(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=ua(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):H.apply(g,r)})}function wa(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=ra(function(a){return a===b},h,!0),l=ra(function(a){return J(b,a)>-1},h,!0),m=[function(a,c,d){var e=!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d));return b=null,e}];f>i;i++)if(c=d.relative[a[i].type])m=[ra(sa(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++)if(d.relative[a[e].type])break;return va(i>1&&sa(m),i>1&&qa(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(Q,"$1"),c,e>i&&wa(a.slice(i,e)),f>e&&wa(a=a.slice(e)),f>e&&qa(a))}m.push(c)}return sa(m)}function xa(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,o,q,r=0,s="0",t=f&&[],u=[],v=j,x=f||e&&d.find.TAG("*",k),y=w+=null==v?1:Math.random()||.1,z=x.length;for(k&&(j=g===n||g||k);s!==z&&null!=(l=x[s]);s++){if(e&&l){o=0,g||l.ownerDocument===n||(m(l),h=!p);while(q=a[o++])if(q(l,g||n,h)){i.push(l);break}k&&(w=y)}c&&((l=!q&&l)&&r--,f&&t.push(l))}if(r+=s,c&&s!==r){o=0;while(q=b[o++])q(t,u,g,h);if(f){if(r>0)while(s--)t[s]||u[s]||(u[s]=F.call(i));u=ua(u)}H.apply(i,u),k&&!f&&u.length>0&&r+b.length>1&&fa.uniqueSort(i)}return k&&(w=y,j=v),t};return c?ha(f):f}return h=fa.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=wa(b[c]),f[u]?d.push(f):e.push(f);f=A(a,xa(e,d)),f.selector=a}return f},i=fa.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(ba,ca),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=W.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(ba,ca),_.test(j[0].type)&&oa(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&qa(j),!a)return H.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,!b||_.test(a)&&oa(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ia(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),ia(function(a){return a.innerHTML="<a href='#'></a>","#"===a.firstChild.getAttribute("href")})||ja("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ia(function(a){return a.innerHTML="<input/>",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||ja("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),ia(function(a){return null==a.getAttribute("disabled")})||ja(K,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),fa}(a);n.find=t,n.expr=t.selectors,n.expr[":"]=n.expr.pseudos,n.uniqueSort=n.unique=t.uniqueSort,n.text=t.getText,n.isXMLDoc=t.isXML,n.contains=t.contains;var u=function(a,b,c){var d=[],e=void 0!==c;while((a=a[b])&&9!==a.nodeType)if(1===a.nodeType){if(e&&n(a).is(c))break;d.push(a)}return d},v=function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c},w=n.expr.match.needsContext,x=/^<([\w-]+)\s*\/?>(?:<\/\1>|)$/,y=/^.[^:#\[\.,]*$/;function z(a,b,c){if(n.isFunction(b))return n.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return n.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(y.test(b))return n.filter(b,a,c);b=n.filter(b,a)}return n.grep(a,function(a){return h.call(b,a)>-1!==c})}n.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?n.find.matchesSelector(d,a)?[d]:[]:n.find.matches(a,n.grep(b,function(a){return 1===a.nodeType}))},n.fn.extend({find:function(a){var b,c=this.length,d=[],e=this;if("string"!=typeof a)return this.pushStack(n(a).filter(function(){for(b=0;c>b;b++)if(n.contains(e[b],this))return!0}));for(b=0;c>b;b++)n.find(a,e[b],d);return d=this.pushStack(c>1?n.unique(d):d),d.selector=this.selector?this.selector+" "+a:a,d},filter:function(a){return this.pushStack(z(this,a||[],!1))},not:function(a){return this.pushStack(z(this,a||[],!0))},is:function(a){return!!z(this,"string"==typeof a&&w.test(a)?n(a):a||[],!1).length}});var A,B=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,C=n.fn.init=function(a,b,c){var e,f;if(!a)return this;if(c=c||A,"string"==typeof a){if(e="<"===a[0]&&">"===a[a.length-1]&&a.length>=3?[null,a,null]:B.exec(a),!e||!e[1]&&b)return!b||b.jquery?(b||c).find(a):this.constructor(b).find(a);if(e[1]){if(b=b instanceof n?b[0]:b,n.merge(this,n.parseHTML(e[1],b&&b.nodeType?b.ownerDocument||b:d,!0)),x.test(e[1])&&n.isPlainObject(b))for(e in b)n.isFunction(this[e])?this[e](b[e]):this.attr(e,b[e]);return this}return f=d.getElementById(e[2]),f&&f.parentNode&&(this.length=1,this[0]=f),this.context=d,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):n.isFunction(a)?void 0!==c.ready?c.ready(a):a(n):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),n.makeArray(a,this))};C.prototype=n.fn,A=n(d);var D=/^(?:parents|prev(?:Until|All))/,E={children:!0,contents:!0,next:!0,prev:!0};n.fn.extend({has:function(a){var b=n(a,this),c=b.length;return this.filter(function(){for(var a=0;c>a;a++)if(n.contains(this,b[a]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=w.test(a)||"string"!=typeof a?n(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&n.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?n.uniqueSort(f):f)},index:function(a){return a?"string"==typeof a?h.call(n(a),this[0]):h.call(this,a.jquery?a[0]:a):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(n.uniqueSort(n.merge(this.get(),n(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function F(a,b){while((a=a[b])&&1!==a.nodeType);return a}n.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return u(a,"parentNode")},parentsUntil:function(a,b,c){return u(a,"parentNode",c)},next:function(a){return F(a,"nextSibling")},prev:function(a){return F(a,"previousSibling")},nextAll:function(a){return u(a,"nextSibling")},prevAll:function(a){return u(a,"previousSibling")},nextUntil:function(a,b,c){return u(a,"nextSibling",c)},prevUntil:function(a,b,c){return u(a,"previousSibling",c)},siblings:function(a){return v((a.parentNode||{}).firstChild,a)},children:function(a){return v(a.firstChild)},contents:function(a){return a.contentDocument||n.merge([],a.childNodes)}},function(a,b){n.fn[a]=function(c,d){var e=n.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=n.filter(d,e)),this.length>1&&(E[a]||n.uniqueSort(e),D.test(a)&&e.reverse()),this.pushStack(e)}});var G=/\S+/g;function H(a){var b={};return n.each(a.match(G)||[],function(a,c){b[c]=!0}),b}n.Callbacks=function(a){a="string"==typeof a?H(a):n.extend({},a);var b,c,d,e,f=[],g=[],h=-1,i=function(){for(e=a.once,d=b=!0;g.length;h=-1){c=g.shift();while(++h<f.length)f[h].apply(c[0],c[1])===!1&&a.stopOnFalse&&(h=f.length,c=!1)}a.memory||(c=!1),b=!1,e&&(f=c?[]:"")},j={add:function(){return f&&(c&&!b&&(h=f.length-1,g.push(c)),function d(b){n.each(b,function(b,c){n.isFunction(c)?a.unique&&j.has(c)||f.push(c):c&&c.length&&"string"!==n.type(c)&&d(c)})}(arguments),c&&!b&&i()),this},remove:function(){return n.each(arguments,function(a,b){var c;while((c=n.inArray(b,f,c))>-1)f.splice(c,1),h>=c&&h--}),this},has:function(a){return a?n.inArray(a,f)>-1:f.length>0},empty:function(){return f&&(f=[]),this},disable:function(){return e=g=[],f=c="",this},disabled:function(){return!f},lock:function(){return e=g=[],c||(f=c=""),this},locked:function(){return!!e},fireWith:function(a,c){return e||(c=c||[],c=[a,c.slice?c.slice():c],g.push(c),b||i()),this},fire:function(){return j.fireWith(this,arguments),this},fired:function(){return!!d}};return j},n.extend({Deferred:function(a){var b=[["resolve","done",n.Callbacks("once memory"),"resolved"],["reject","fail",n.Callbacks("once memory"),"rejected"],["notify","progress",n.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return n.Deferred(function(c){n.each(b,function(b,f){var g=n.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&n.isFunction(a.promise)?a.promise().progress(c.notify).done(c.resolve).fail(c.reject):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?n.extend(a,d):d}},e={};return d.pipe=d.then,n.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=e.call(arguments),d=c.length,f=1!==d||a&&n.isFunction(a.promise)?d:0,g=1===f?a:n.Deferred(),h=function(a,b,c){return function(d){b[a]=this,c[a]=arguments.length>1?e.call(arguments):d,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(d>1)for(i=new Array(d),j=new Array(d),k=new Array(d);d>b;b++)c[b]&&n.isFunction(c[b].promise)?c[b].promise().progress(h(b,j,i)).done(h(b,k,c)).fail(g.reject):--f;return f||g.resolveWith(k,c),g.promise()}});var I;n.fn.ready=function(a){return n.ready.promise().done(a),this},n.extend({isReady:!1,readyWait:1,holdReady:function(a){a?n.readyWait++:n.ready(!0)},ready:function(a){(a===!0?--n.readyWait:n.isReady)||(n.isReady=!0,a!==!0&&--n.readyWait>0||(I.resolveWith(d,[n]),n.fn.triggerHandler&&(n(d).triggerHandler("ready"),n(d).off("ready"))))}});function J(){d.removeEventListener("DOMContentLoaded",J),a.removeEventListener("load",J),n.ready()}n.ready.promise=function(b){return I||(I=n.Deferred(),"complete"===d.readyState||"loading"!==d.readyState&&!d.documentElement.doScroll?a.setTimeout(n.ready):(d.addEventListener("DOMContentLoaded",J),a.addEventListener("load",J))),I.promise(b)},n.ready.promise();var K=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===n.type(c)){e=!0;for(h in c)K(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,n.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(n(a),c)})),b))for(;i>h;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f},L=function(a){return 1===a.nodeType||9===a.nodeType||!+a.nodeType};function M(){this.expando=n.expando+M.uid++}M.uid=1,M.prototype={register:function(a,b){var c=b||{};return a.nodeType?a[this.expando]=c:Object.defineProperty(a,this.expando,{value:c,writable:!0,configurable:!0}),a[this.expando]},cache:function(a){if(!L(a))return{};var b=a[this.expando];return b||(b={},L(a)&&(a.nodeType?a[this.expando]=b:Object.defineProperty(a,this.expando,{value:b,configurable:!0}))),b},set:function(a,b,c){var d,e=this.cache(a);if("string"==typeof b)e[b]=c;else for(d in b)e[d]=b[d];return e},get:function(a,b){return void 0===b?this.cache(a):a[this.expando]&&a[this.expando][b]},access:function(a,b,c){var d;return void 0===b||b&&"string"==typeof b&&void 0===c?(d=this.get(a,b),void 0!==d?d:this.get(a,n.camelCase(b))):(this.set(a,b,c),void 0!==c?c:b)},remove:function(a,b){var c,d,e,f=a[this.expando];if(void 0!==f){if(void 0===b)this.register(a);else{n.isArray(b)?d=b.concat(b.map(n.camelCase)):(e=n.camelCase(b),b in f?d=[b,e]:(d=e,d=d in f?[d]:d.match(G)||[])),c=d.length;while(c--)delete f[d[c]]}(void 0===b||n.isEmptyObject(f))&&(a.nodeType?a[this.expando]=void 0:delete a[this.expando])}},hasData:function(a){var b=a[this.expando];return void 0!==b&&!n.isEmptyObject(b)}};var N=new M,O=new M,P=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,Q=/[A-Z]/g;function R(a,b,c){var d;if(void 0===c&&1===a.nodeType)if(d="data-"+b.replace(Q,"-$&").toLowerCase(),c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:P.test(c)?n.parseJSON(c):c;
|
||||
}catch(e){}O.set(a,b,c)}else c=void 0;return c}n.extend({hasData:function(a){return O.hasData(a)||N.hasData(a)},data:function(a,b,c){return O.access(a,b,c)},removeData:function(a,b){O.remove(a,b)},_data:function(a,b,c){return N.access(a,b,c)},_removeData:function(a,b){N.remove(a,b)}}),n.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=O.get(f),1===f.nodeType&&!N.get(f,"hasDataAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=n.camelCase(d.slice(5)),R(f,d,e[d])));N.set(f,"hasDataAttrs",!0)}return e}return"object"==typeof a?this.each(function(){O.set(this,a)}):K(this,function(b){var c,d;if(f&&void 0===b){if(c=O.get(f,a)||O.get(f,a.replace(Q,"-$&").toLowerCase()),void 0!==c)return c;if(d=n.camelCase(a),c=O.get(f,d),void 0!==c)return c;if(c=R(f,d,void 0),void 0!==c)return c}else d=n.camelCase(a),this.each(function(){var c=O.get(this,d);O.set(this,d,b),a.indexOf("-")>-1&&void 0!==c&&O.set(this,a,b)})},null,b,arguments.length>1,null,!0)},removeData:function(a){return this.each(function(){O.remove(this,a)})}}),n.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=N.get(a,b),c&&(!d||n.isArray(c)?d=N.access(a,b,n.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=n.queue(a,b),d=c.length,e=c.shift(),f=n._queueHooks(a,b),g=function(){n.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return N.get(a,c)||N.access(a,c,{empty:n.Callbacks("once memory").add(function(){N.remove(a,[b+"queue",c])})})}}),n.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length<c?n.queue(this[0],a):void 0===b?this:this.each(function(){var c=n.queue(this,a,b);n._queueHooks(this,a),"fx"===a&&"inprogress"!==c[0]&&n.dequeue(this,a)})},dequeue:function(a){return this.each(function(){n.dequeue(this,a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,b){var c,d=1,e=n.Deferred(),f=this,g=this.length,h=function(){--d||e.resolveWith(f,[f])};"string"!=typeof a&&(b=a,a=void 0),a=a||"fx";while(g--)c=N.get(f[g],a+"queueHooks"),c&&c.empty&&(d++,c.empty.add(h));return h(),e.promise(b)}});var S=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,T=new RegExp("^(?:([+-])=|)("+S+")([a-z%]*)$","i"),U=["Top","Right","Bottom","Left"],V=function(a,b){return a=b||a,"none"===n.css(a,"display")||!n.contains(a.ownerDocument,a)};function W(a,b,c,d){var e,f=1,g=20,h=d?function(){return d.cur()}:function(){return n.css(a,b,"")},i=h(),j=c&&c[3]||(n.cssNumber[b]?"":"px"),k=(n.cssNumber[b]||"px"!==j&&+i)&&T.exec(n.css(a,b));if(k&&k[3]!==j){j=j||k[3],c=c||[],k=+i||1;do f=f||".5",k/=f,n.style(a,b,k+j);while(f!==(f=h()/i)&&1!==f&&--g)}return c&&(k=+k||+i||0,e=c[1]?k+(c[1]+1)*c[2]:+c[2],d&&(d.unit=j,d.start=k,d.end=e)),e}var X=/^(?:checkbox|radio)$/i,Y=/<([\w:-]+)/,Z=/^$|\/(?:java|ecma)script/i,$={option:[1,"<select multiple='multiple'>","</select>"],thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};$.optgroup=$.option,$.tbody=$.tfoot=$.colgroup=$.caption=$.thead,$.th=$.td;function _(a,b){var c="undefined"!=typeof a.getElementsByTagName?a.getElementsByTagName(b||"*"):"undefined"!=typeof a.querySelectorAll?a.querySelectorAll(b||"*"):[];return void 0===b||b&&n.nodeName(a,b)?n.merge([a],c):c}function aa(a,b){for(var c=0,d=a.length;d>c;c++)N.set(a[c],"globalEval",!b||N.get(b[c],"globalEval"))}var ba=/<|&#?\w+;/;function ca(a,b,c,d,e){for(var f,g,h,i,j,k,l=b.createDocumentFragment(),m=[],o=0,p=a.length;p>o;o++)if(f=a[o],f||0===f)if("object"===n.type(f))n.merge(m,f.nodeType?[f]:f);else if(ba.test(f)){g=g||l.appendChild(b.createElement("div")),h=(Y.exec(f)||["",""])[1].toLowerCase(),i=$[h]||$._default,g.innerHTML=i[1]+n.htmlPrefilter(f)+i[2],k=i[0];while(k--)g=g.lastChild;n.merge(m,g.childNodes),g=l.firstChild,g.textContent=""}else m.push(b.createTextNode(f));l.textContent="",o=0;while(f=m[o++])if(d&&n.inArray(f,d)>-1)e&&e.push(f);else if(j=n.contains(f.ownerDocument,f),g=_(l.appendChild(f),"script"),j&&aa(g),c){k=0;while(f=g[k++])Z.test(f.type||"")&&c.push(f)}return l}!function(){var a=d.createDocumentFragment(),b=a.appendChild(d.createElement("div")),c=d.createElement("input");c.setAttribute("type","radio"),c.setAttribute("checked","checked"),c.setAttribute("name","t"),b.appendChild(c),l.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,b.innerHTML="<textarea>x</textarea>",l.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue}();var da=/^key/,ea=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,fa=/^([^.]*)(?:\.(.+)|)/;function ga(){return!0}function ha(){return!1}function ia(){try{return d.activeElement}catch(a){}}function ja(a,b,c,d,e,f){var g,h;if("object"==typeof b){"string"!=typeof c&&(d=d||c,c=void 0);for(h in b)ja(a,h,c,d,b[h],f);return a}if(null==d&&null==e?(e=c,d=c=void 0):null==e&&("string"==typeof c?(e=d,d=void 0):(e=d,d=c,c=void 0)),e===!1)e=ha;else if(!e)return a;return 1===f&&(g=e,e=function(a){return n().off(a),g.apply(this,arguments)},e.guid=g.guid||(g.guid=n.guid++)),a.each(function(){n.event.add(this,b,e,d,c)})}n.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=N.get(a);if(r){c.handler&&(f=c,c=f.handler,e=f.selector),c.guid||(c.guid=n.guid++),(i=r.events)||(i=r.events={}),(g=r.handle)||(g=r.handle=function(b){return"undefined"!=typeof n&&n.event.triggered!==b.type?n.event.dispatch.apply(a,arguments):void 0}),b=(b||"").match(G)||[""],j=b.length;while(j--)h=fa.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o&&(l=n.event.special[o]||{},o=(e?l.delegateType:l.bindType)||o,l=n.event.special[o]||{},k=n.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&n.expr.match.needsContext.test(e),namespace:p.join(".")},f),(m=i[o])||(m=i[o]=[],m.delegateCount=0,l.setup&&l.setup.call(a,d,p,g)!==!1||a.addEventListener&&a.addEventListener(o,g)),l.add&&(l.add.call(a,k),k.handler.guid||(k.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,k):m.push(k),n.event.global[o]=!0)}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=N.hasData(a)&&N.get(a);if(r&&(i=r.events)){b=(b||"").match(G)||[""],j=b.length;while(j--)if(h=fa.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=n.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,m=i[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),g=f=m.length;while(f--)k=m[f],!e&&q!==k.origType||c&&c.guid!==k.guid||h&&!h.test(k.namespace)||d&&d!==k.selector&&("**"!==d||!k.selector)||(m.splice(f,1),k.selector&&m.delegateCount--,l.remove&&l.remove.call(a,k));g&&!m.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||n.removeEvent(a,o,r.handle),delete i[o])}else for(o in i)n.event.remove(a,o+b[j],c,d,!0);n.isEmptyObject(i)&&N.remove(a,"handle events")}},dispatch:function(a){a=n.event.fix(a);var b,c,d,f,g,h=[],i=e.call(arguments),j=(N.get(this,"events")||{})[a.type]||[],k=n.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=n.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,c=0;while((g=f.handlers[c++])&&!a.isImmediatePropagationStopped())a.rnamespace&&!a.rnamespace.test(g.namespace)||(a.handleObj=g,a.data=g.data,d=((n.event.special[g.origType]||{}).handle||g.handler).apply(f.elem,i),void 0!==d&&(a.result=d)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&("click"!==a.type||isNaN(a.button)||a.button<1))for(;i!==this;i=i.parentNode||this)if(1===i.nodeType&&(i.disabled!==!0||"click"!==a.type)){for(d=[],c=0;h>c;c++)f=b[c],e=f.selector+" ",void 0===d[e]&&(d[e]=f.needsContext?n(e,this).index(i)>-1:n.find(e,this,null,[i]).length),d[e]&&d.push(f);d.length&&g.push({elem:i,handlers:d})}return h<b.length&&g.push({elem:this,handlers:b.slice(h)}),g},props:"altKey bubbles cancelable ctrlKey currentTarget detail eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){return null==a.which&&(a.which=null!=b.charCode?b.charCode:b.keyCode),a}},mouseHooks:{props:"button buttons clientX clientY offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,b){var c,e,f,g=b.button;return null==a.pageX&&null!=b.clientX&&(c=a.target.ownerDocument||d,e=c.documentElement,f=c.body,a.pageX=b.clientX+(e&&e.scrollLeft||f&&f.scrollLeft||0)-(e&&e.clientLeft||f&&f.clientLeft||0),a.pageY=b.clientY+(e&&e.scrollTop||f&&f.scrollTop||0)-(e&&e.clientTop||f&&f.clientTop||0)),a.which||void 0===g||(a.which=1&g?1:2&g?3:4&g?2:0),a}},fix:function(a){if(a[n.expando])return a;var b,c,e,f=a.type,g=a,h=this.fixHooks[f];h||(this.fixHooks[f]=h=ea.test(f)?this.mouseHooks:da.test(f)?this.keyHooks:{}),e=h.props?this.props.concat(h.props):this.props,a=new n.Event(g),b=e.length;while(b--)c=e[b],a[c]=g[c];return a.target||(a.target=d),3===a.target.nodeType&&(a.target=a.target.parentNode),h.filter?h.filter(a,g):a},special:{load:{noBubble:!0},focus:{trigger:function(){return this!==ia()&&this.focus?(this.focus(),!1):void 0},delegateType:"focusin"},blur:{trigger:function(){return this===ia()&&this.blur?(this.blur(),!1):void 0},delegateType:"focusout"},click:{trigger:function(){return"checkbox"===this.type&&this.click&&n.nodeName(this,"input")?(this.click(),!1):void 0},_default:function(a){return n.nodeName(a.target,"a")}},beforeunload:{postDispatch:function(a){void 0!==a.result&&a.originalEvent&&(a.originalEvent.returnValue=a.result)}}}},n.removeEvent=function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c)},n.Event=function(a,b){return this instanceof n.Event?(a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||void 0===a.defaultPrevented&&a.returnValue===!1?ga:ha):this.type=a,b&&n.extend(this,b),this.timeStamp=a&&a.timeStamp||n.now(),void(this[n.expando]=!0)):new n.Event(a,b)},n.Event.prototype={constructor:n.Event,isDefaultPrevented:ha,isPropagationStopped:ha,isImmediatePropagationStopped:ha,preventDefault:function(){var a=this.originalEvent;this.isDefaultPrevented=ga,a&&a.preventDefault()},stopPropagation:function(){var a=this.originalEvent;this.isPropagationStopped=ga,a&&a.stopPropagation()},stopImmediatePropagation:function(){var a=this.originalEvent;this.isImmediatePropagationStopped=ga,a&&a.stopImmediatePropagation(),this.stopPropagation()}},n.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(a,b){n.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj;return e&&(e===d||n.contains(d,e))||(a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b),c}}}),n.fn.extend({on:function(a,b,c,d){return ja(this,a,b,c,d)},one:function(a,b,c,d){return ja(this,a,b,c,d,1)},off:function(a,b,c){var d,e;if(a&&a.preventDefault&&a.handleObj)return d=a.handleObj,n(a.delegateTarget).off(d.namespace?d.origType+"."+d.namespace:d.origType,d.selector,d.handler),this;if("object"==typeof a){for(e in a)this.off(e,b,a[e]);return this}return b!==!1&&"function"!=typeof b||(c=b,b=void 0),c===!1&&(c=ha),this.each(function(){n.event.remove(this,a,c,b)})}});var ka=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi,la=/<script|<style|<link/i,ma=/checked\s*(?:[^=]|=\s*.checked.)/i,na=/^true\/(.*)/,oa=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;function pa(a,b){return n.nodeName(a,"table")&&n.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function qa(a){return a.type=(null!==a.getAttribute("type"))+"/"+a.type,a}function ra(a){var b=na.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function sa(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(N.hasData(a)&&(f=N.access(a),g=N.set(b,f),j=f.events)){delete g.handle,g.events={};for(e in j)for(c=0,d=j[e].length;d>c;c++)n.event.add(b,e,j[e][c])}O.hasData(a)&&(h=O.access(a),i=n.extend({},h),O.set(b,i))}}function ta(a,b){var c=b.nodeName.toLowerCase();"input"===c&&X.test(a.type)?b.checked=a.checked:"input"!==c&&"textarea"!==c||(b.defaultValue=a.defaultValue)}function ua(a,b,c,d){b=f.apply([],b);var e,g,h,i,j,k,m=0,o=a.length,p=o-1,q=b[0],r=n.isFunction(q);if(r||o>1&&"string"==typeof q&&!l.checkClone&&ma.test(q))return a.each(function(e){var f=a.eq(e);r&&(b[0]=q.call(this,e,f.html())),ua(f,b,c,d)});if(o&&(e=ca(b,a[0].ownerDocument,!1,a,d),g=e.firstChild,1===e.childNodes.length&&(e=g),g||d)){for(h=n.map(_(e,"script"),qa),i=h.length;o>m;m++)j=e,m!==p&&(j=n.clone(j,!0,!0),i&&n.merge(h,_(j,"script"))),c.call(a[m],j,m);if(i)for(k=h[h.length-1].ownerDocument,n.map(h,ra),m=0;i>m;m++)j=h[m],Z.test(j.type||"")&&!N.access(j,"globalEval")&&n.contains(k,j)&&(j.src?n._evalUrl&&n._evalUrl(j.src):n.globalEval(j.textContent.replace(oa,"")))}return a}function va(a,b,c){for(var d,e=b?n.filter(b,a):a,f=0;null!=(d=e[f]);f++)c||1!==d.nodeType||n.cleanData(_(d)),d.parentNode&&(c&&n.contains(d.ownerDocument,d)&&aa(_(d,"script")),d.parentNode.removeChild(d));return a}n.extend({htmlPrefilter:function(a){return a.replace(ka,"<$1></$2>")},clone:function(a,b,c){var d,e,f,g,h=a.cloneNode(!0),i=n.contains(a.ownerDocument,a);if(!(l.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||n.isXMLDoc(a)))for(g=_(h),f=_(a),d=0,e=f.length;e>d;d++)ta(f[d],g[d]);if(b)if(c)for(f=f||_(a),g=g||_(h),d=0,e=f.length;e>d;d++)sa(f[d],g[d]);else sa(a,h);return g=_(h,"script"),g.length>0&&aa(g,!i&&_(a,"script")),h},cleanData:function(a){for(var b,c,d,e=n.event.special,f=0;void 0!==(c=a[f]);f++)if(L(c)){if(b=c[N.expando]){if(b.events)for(d in b.events)e[d]?n.event.remove(c,d):n.removeEvent(c,d,b.handle);c[N.expando]=void 0}c[O.expando]&&(c[O.expando]=void 0)}}}),n.fn.extend({domManip:ua,detach:function(a){return va(this,a,!0)},remove:function(a){return va(this,a)},text:function(a){return K(this,function(a){return void 0===a?n.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=a)})},null,a,arguments.length)},append:function(){return ua(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=pa(this,a);b.appendChild(a)}})},prepend:function(){return ua(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=pa(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return ua(this,arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return ua(this,arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},empty:function(){for(var a,b=0;null!=(a=this[b]);b++)1===a.nodeType&&(n.cleanData(_(a,!1)),a.textContent="");return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return n.clone(this,a,b)})},html:function(a){return K(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a&&1===b.nodeType)return b.innerHTML;if("string"==typeof a&&!la.test(a)&&!$[(Y.exec(a)||["",""])[1].toLowerCase()]){a=n.htmlPrefilter(a);try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(n.cleanData(_(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=[];return ua(this,arguments,function(b){var c=this.parentNode;n.inArray(this,a)<0&&(n.cleanData(_(this)),c&&c.replaceChild(b,this))},a)}}),n.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){n.fn[a]=function(a){for(var c,d=[],e=n(a),f=e.length-1,h=0;f>=h;h++)c=h===f?this:this.clone(!0),n(e[h])[b](c),g.apply(d,c.get());return this.pushStack(d)}});var wa,xa={HTML:"block",BODY:"block"};function ya(a,b){var c=n(b.createElement(a)).appendTo(b.body),d=n.css(c[0],"display");return c.detach(),d}function za(a){var b=d,c=xa[a];return c||(c=ya(a,b),"none"!==c&&c||(wa=(wa||n("<iframe frameborder='0' width='0' height='0'/>")).appendTo(b.documentElement),b=wa[0].contentDocument,b.write(),b.close(),c=ya(a,b),wa.detach()),xa[a]=c),c}var Aa=/^margin/,Ba=new RegExp("^("+S+")(?!px)[a-z%]+$","i"),Ca=function(b){var c=b.ownerDocument.defaultView;return c&&c.opener||(c=a),c.getComputedStyle(b)},Da=function(a,b,c,d){var e,f,g={};for(f in b)g[f]=a.style[f],a.style[f]=b[f];e=c.apply(a,d||[]);for(f in b)a.style[f]=g[f];return e},Ea=d.documentElement;!function(){var b,c,e,f,g=d.createElement("div"),h=d.createElement("div");if(h.style){h.style.backgroundClip="content-box",h.cloneNode(!0).style.backgroundClip="",l.clearCloneStyle="content-box"===h.style.backgroundClip,g.style.cssText="border:0;width:8px;height:0;top:0;left:-9999px;padding:0;margin-top:1px;position:absolute",g.appendChild(h);function i(){h.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;position:relative;display:block;margin:auto;border:1px;padding:1px;top:1%;width:50%",h.innerHTML="",Ea.appendChild(g);var d=a.getComputedStyle(h);b="1%"!==d.top,f="2px"===d.marginLeft,c="4px"===d.width,h.style.marginRight="50%",e="4px"===d.marginRight,Ea.removeChild(g)}n.extend(l,{pixelPosition:function(){return i(),b},boxSizingReliable:function(){return null==c&&i(),c},pixelMarginRight:function(){return null==c&&i(),e},reliableMarginLeft:function(){return null==c&&i(),f},reliableMarginRight:function(){var b,c=h.appendChild(d.createElement("div"));return c.style.cssText=h.style.cssText="-webkit-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:0",c.style.marginRight=c.style.width="0",h.style.width="1px",Ea.appendChild(g),b=!parseFloat(a.getComputedStyle(c).marginRight),Ea.removeChild(g),h.removeChild(c),b}})}}();function Fa(a,b,c){var d,e,f,g,h=a.style;return c=c||Ca(a),g=c?c.getPropertyValue(b)||c[b]:void 0,""!==g&&void 0!==g||n.contains(a.ownerDocument,a)||(g=n.style(a,b)),c&&!l.pixelMarginRight()&&Ba.test(g)&&Aa.test(b)&&(d=h.width,e=h.minWidth,f=h.maxWidth,h.minWidth=h.maxWidth=h.width=g,g=c.width,h.width=d,h.minWidth=e,h.maxWidth=f),void 0!==g?g+"":g}function Ga(a,b){return{get:function(){return a()?void delete this.get:(this.get=b).apply(this,arguments)}}}var Ha=/^(none|table(?!-c[ea]).+)/,Ia={position:"absolute",visibility:"hidden",display:"block"},Ja={letterSpacing:"0",fontWeight:"400"},Ka=["Webkit","O","Moz","ms"],La=d.createElement("div").style;function Ma(a){if(a in La)return a;var b=a[0].toUpperCase()+a.slice(1),c=Ka.length;while(c--)if(a=Ka[c]+b,a in La)return a}function Na(a,b,c){var d=T.exec(b);return d?Math.max(0,d[2]-(c||0))+(d[3]||"px"):b}function Oa(a,b,c,d,e){for(var f=c===(d?"border":"content")?4:"width"===b?1:0,g=0;4>f;f+=2)"margin"===c&&(g+=n.css(a,c+U[f],!0,e)),d?("content"===c&&(g-=n.css(a,"padding"+U[f],!0,e)),"margin"!==c&&(g-=n.css(a,"border"+U[f]+"Width",!0,e))):(g+=n.css(a,"padding"+U[f],!0,e),"padding"!==c&&(g+=n.css(a,"border"+U[f]+"Width",!0,e)));return g}function Pa(b,c,e){var f=!0,g="width"===c?b.offsetWidth:b.offsetHeight,h=Ca(b),i="border-box"===n.css(b,"boxSizing",!1,h);if(d.msFullscreenElement&&a.top!==a&&b.getClientRects().length&&(g=Math.round(100*b.getBoundingClientRect()[c])),0>=g||null==g){if(g=Fa(b,c,h),(0>g||null==g)&&(g=b.style[c]),Ba.test(g))return g;f=i&&(l.boxSizingReliable()||g===b.style[c]),g=parseFloat(g)||0}return g+Oa(b,c,e||(i?"border":"content"),f,h)+"px"}function Qa(a,b){for(var c,d,e,f=[],g=0,h=a.length;h>g;g++)d=a[g],d.style&&(f[g]=N.get(d,"olddisplay"),c=d.style.display,b?(f[g]||"none"!==c||(d.style.display=""),""===d.style.display&&V(d)&&(f[g]=N.access(d,"olddisplay",za(d.nodeName)))):(e=V(d),"none"===c&&e||N.set(d,"olddisplay",e?c:n.css(d,"display"))));for(g=0;h>g;g++)d=a[g],d.style&&(b&&"none"!==d.style.display&&""!==d.style.display||(d.style.display=b?f[g]||"":"none"));return a}n.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=Fa(a,"opacity");return""===c?"1":c}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":"cssFloat"},style:function(a,b,c,d){if(a&&3!==a.nodeType&&8!==a.nodeType&&a.style){var e,f,g,h=n.camelCase(b),i=a.style;return b=n.cssProps[h]||(n.cssProps[h]=Ma(h)||h),g=n.cssHooks[b]||n.cssHooks[h],void 0===c?g&&"get"in g&&void 0!==(e=g.get(a,!1,d))?e:i[b]:(f=typeof c,"string"===f&&(e=T.exec(c))&&e[1]&&(c=W(a,b,e),f="number"),null!=c&&c===c&&("number"===f&&(c+=e&&e[3]||(n.cssNumber[h]?"":"px")),l.clearCloneStyle||""!==c||0!==b.indexOf("background")||(i[b]="inherit"),g&&"set"in g&&void 0===(c=g.set(a,c,d))||(i[b]=c)),void 0)}},css:function(a,b,c,d){var e,f,g,h=n.camelCase(b);return b=n.cssProps[h]||(n.cssProps[h]=Ma(h)||h),g=n.cssHooks[b]||n.cssHooks[h],g&&"get"in g&&(e=g.get(a,!0,c)),void 0===e&&(e=Fa(a,b,d)),"normal"===e&&b in Ja&&(e=Ja[b]),""===c||c?(f=parseFloat(e),c===!0||isFinite(f)?f||0:e):e}}),n.each(["height","width"],function(a,b){n.cssHooks[b]={get:function(a,c,d){return c?Ha.test(n.css(a,"display"))&&0===a.offsetWidth?Da(a,Ia,function(){return Pa(a,b,d)}):Pa(a,b,d):void 0},set:function(a,c,d){var e,f=d&&Ca(a),g=d&&Oa(a,b,d,"border-box"===n.css(a,"boxSizing",!1,f),f);return g&&(e=T.exec(c))&&"px"!==(e[3]||"px")&&(a.style[b]=c,c=n.css(a,b)),Na(a,c,g)}}}),n.cssHooks.marginLeft=Ga(l.reliableMarginLeft,function(a,b){return b?(parseFloat(Fa(a,"marginLeft"))||a.getBoundingClientRect().left-Da(a,{marginLeft:0},function(){return a.getBoundingClientRect().left}))+"px":void 0}),n.cssHooks.marginRight=Ga(l.reliableMarginRight,function(a,b){return b?Da(a,{display:"inline-block"},Fa,[a,"marginRight"]):void 0}),n.each({margin:"",padding:"",border:"Width"},function(a,b){n.cssHooks[a+b]={expand:function(c){for(var d=0,e={},f="string"==typeof c?c.split(" "):[c];4>d;d++)e[a+U[d]+b]=f[d]||f[d-2]||f[0];return e}},Aa.test(a)||(n.cssHooks[a+b].set=Na)}),n.fn.extend({css:function(a,b){return K(this,function(a,b,c){var d,e,f={},g=0;if(n.isArray(b)){for(d=Ca(a),e=b.length;e>g;g++)f[b[g]]=n.css(a,b[g],!1,d);return f}return void 0!==c?n.style(a,b,c):n.css(a,b)},a,b,arguments.length>1)},show:function(){return Qa(this,!0)},hide:function(){return Qa(this)},toggle:function(a){return"boolean"==typeof a?a?this.show():this.hide():this.each(function(){V(this)?n(this).show():n(this).hide()})}});function Ra(a,b,c,d,e){return new Ra.prototype.init(a,b,c,d,e)}n.Tween=Ra,Ra.prototype={constructor:Ra,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||n.easing._default,this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(n.cssNumber[c]?"":"px")},cur:function(){var a=Ra.propHooks[this.prop];return a&&a.get?a.get(this):Ra.propHooks._default.get(this)},run:function(a){var b,c=Ra.propHooks[this.prop];return this.options.duration?this.pos=b=n.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):this.pos=b=a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):Ra.propHooks._default.set(this),this}},Ra.prototype.init.prototype=Ra.prototype,Ra.propHooks={_default:{get:function(a){var b;return 1!==a.elem.nodeType||null!=a.elem[a.prop]&&null==a.elem.style[a.prop]?a.elem[a.prop]:(b=n.css(a.elem,a.prop,""),b&&"auto"!==b?b:0)},set:function(a){n.fx.step[a.prop]?n.fx.step[a.prop](a):1!==a.elem.nodeType||null==a.elem.style[n.cssProps[a.prop]]&&!n.cssHooks[a.prop]?a.elem[a.prop]=a.now:n.style(a.elem,a.prop,a.now+a.unit)}}},Ra.propHooks.scrollTop=Ra.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},n.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2},_default:"swing"},n.fx=Ra.prototype.init,n.fx.step={};var Sa,Ta,Ua=/^(?:toggle|show|hide)$/,Va=/queueHooks$/;function Wa(){return a.setTimeout(function(){Sa=void 0}),Sa=n.now()}function Xa(a,b){var c,d=0,e={height:a};for(b=b?1:0;4>d;d+=2-b)c=U[d],e["margin"+c]=e["padding"+c]=a;return b&&(e.opacity=e.width=a),e}function Ya(a,b,c){for(var d,e=(_a.tweeners[b]||[]).concat(_a.tweeners["*"]),f=0,g=e.length;g>f;f++)if(d=e[f].call(c,b,a))return d}function Za(a,b,c){var d,e,f,g,h,i,j,k,l=this,m={},o=a.style,p=a.nodeType&&V(a),q=N.get(a,"fxshow");c.queue||(h=n._queueHooks(a,"fx"),null==h.unqueued&&(h.unqueued=0,i=h.empty.fire,h.empty.fire=function(){h.unqueued||i()}),h.unqueued++,l.always(function(){l.always(function(){h.unqueued--,n.queue(a,"fx").length||h.empty.fire()})})),1===a.nodeType&&("height"in b||"width"in b)&&(c.overflow=[o.overflow,o.overflowX,o.overflowY],j=n.css(a,"display"),k="none"===j?N.get(a,"olddisplay")||za(a.nodeName):j,"inline"===k&&"none"===n.css(a,"float")&&(o.display="inline-block")),c.overflow&&(o.overflow="hidden",l.always(function(){o.overflow=c.overflow[0],o.overflowX=c.overflow[1],o.overflowY=c.overflow[2]}));for(d in b)if(e=b[d],Ua.exec(e)){if(delete b[d],f=f||"toggle"===e,e===(p?"hide":"show")){if("show"!==e||!q||void 0===q[d])continue;p=!0}m[d]=q&&q[d]||n.style(a,d)}else j=void 0;if(n.isEmptyObject(m))"inline"===("none"===j?za(a.nodeName):j)&&(o.display=j);else{q?"hidden"in q&&(p=q.hidden):q=N.access(a,"fxshow",{}),f&&(q.hidden=!p),p?n(a).show():l.done(function(){n(a).hide()}),l.done(function(){var b;N.remove(a,"fxshow");for(b in m)n.style(a,b,m[b])});for(d in m)g=Ya(p?q[d]:0,d,l),d in q||(q[d]=g.start,p&&(g.end=g.start,g.start="width"===d||"height"===d?1:0))}}function $a(a,b){var c,d,e,f,g;for(c in a)if(d=n.camelCase(c),e=b[d],f=a[c],n.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=n.cssHooks[d],g&&"expand"in g){f=g.expand(f),delete a[d];for(c in f)c in a||(a[c]=f[c],b[c]=e)}else b[d]=e}function _a(a,b,c){var d,e,f=0,g=_a.prefilters.length,h=n.Deferred().always(function(){delete i.elem}),i=function(){if(e)return!1;for(var b=Sa||Wa(),c=Math.max(0,j.startTime+j.duration-b),d=c/j.duration||0,f=1-d,g=0,i=j.tweens.length;i>g;g++)j.tweens[g].run(f);return h.notifyWith(a,[j,f,c]),1>f&&i?c:(h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:n.extend({},b),opts:n.extend(!0,{specialEasing:{},easing:n.easing._default},c),originalProperties:b,originalOptions:c,startTime:Sa||Wa(),duration:c.duration,tweens:[],createTween:function(b,c){var d=n.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(d),d},stop:function(b){var c=0,d=b?j.tweens.length:0;if(e)return this;for(e=!0;d>c;c++)j.tweens[c].run(1);return b?(h.notifyWith(a,[j,1,0]),h.resolveWith(a,[j,b])):h.rejectWith(a,[j,b]),this}}),k=j.props;for($a(k,j.opts.specialEasing);g>f;f++)if(d=_a.prefilters[f].call(j,a,k,j.opts))return n.isFunction(d.stop)&&(n._queueHooks(j.elem,j.opts.queue).stop=n.proxy(d.stop,d)),d;return n.map(k,Ya,j),n.isFunction(j.opts.start)&&j.opts.start.call(a,j),n.fx.timer(n.extend(i,{elem:a,anim:j,queue:j.opts.queue})),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always)}n.Animation=n.extend(_a,{tweeners:{"*":[function(a,b){var c=this.createTween(a,b);return W(c.elem,a,T.exec(b),c),c}]},tweener:function(a,b){n.isFunction(a)?(b=a,a=["*"]):a=a.match(G);for(var c,d=0,e=a.length;e>d;d++)c=a[d],_a.tweeners[c]=_a.tweeners[c]||[],_a.tweeners[c].unshift(b)},prefilters:[Za],prefilter:function(a,b){b?_a.prefilters.unshift(a):_a.prefilters.push(a)}}),n.speed=function(a,b,c){var d=a&&"object"==typeof a?n.extend({},a):{complete:c||!c&&b||n.isFunction(a)&&a,duration:a,easing:c&&b||b&&!n.isFunction(b)&&b};return d.duration=n.fx.off?0:"number"==typeof d.duration?d.duration:d.duration in n.fx.speeds?n.fx.speeds[d.duration]:n.fx.speeds._default,null!=d.queue&&d.queue!==!0||(d.queue="fx"),d.old=d.complete,d.complete=function(){n.isFunction(d.old)&&d.old.call(this),d.queue&&n.dequeue(this,d.queue)},d},n.fn.extend({fadeTo:function(a,b,c,d){return this.filter(V).css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=n.isEmptyObject(a),f=n.speed(b,c,d),g=function(){var b=_a(this,n.extend({},a),f);(e||N.get(this,"finish"))&&b.stop(!0)};return g.finish=g,e||f.queue===!1?this.each(g):this.queue(f.queue,g)},stop:function(a,b,c){var d=function(a){var b=a.stop;delete a.stop,b(c)};return"string"!=typeof a&&(c=b,b=a,a=void 0),b&&a!==!1&&this.queue(a||"fx",[]),this.each(function(){var b=!0,e=null!=a&&a+"queueHooks",f=n.timers,g=N.get(this);if(e)g[e]&&g[e].stop&&d(g[e]);else for(e in g)g[e]&&g[e].stop&&Va.test(e)&&d(g[e]);for(e=f.length;e--;)f[e].elem!==this||null!=a&&f[e].queue!==a||(f[e].anim.stop(c),b=!1,f.splice(e,1));!b&&c||n.dequeue(this,a)})},finish:function(a){return a!==!1&&(a=a||"fx"),this.each(function(){var b,c=N.get(this),d=c[a+"queue"],e=c[a+"queueHooks"],f=n.timers,g=d?d.length:0;for(c.finish=!0,n.queue(this,a,[]),e&&e.stop&&e.stop.call(this,!0),b=f.length;b--;)f[b].elem===this&&f[b].queue===a&&(f[b].anim.stop(!0),f.splice(b,1));for(b=0;g>b;b++)d[b]&&d[b].finish&&d[b].finish.call(this);delete c.finish})}}),n.each(["toggle","show","hide"],function(a,b){var c=n.fn[b];n.fn[b]=function(a,d,e){return null==a||"boolean"==typeof a?c.apply(this,arguments):this.animate(Xa(b,!0),a,d,e)}}),n.each({slideDown:Xa("show"),slideUp:Xa("hide"),slideToggle:Xa("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){n.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),n.timers=[],n.fx.tick=function(){var a,b=0,c=n.timers;for(Sa=n.now();b<c.length;b++)a=c[b],a()||c[b]!==a||c.splice(b--,1);c.length||n.fx.stop(),Sa=void 0},n.fx.timer=function(a){n.timers.push(a),a()?n.fx.start():n.timers.pop()},n.fx.interval=13,n.fx.start=function(){Ta||(Ta=a.setInterval(n.fx.tick,n.fx.interval))},n.fx.stop=function(){a.clearInterval(Ta),Ta=null},n.fx.speeds={slow:600,fast:200,_default:400},n.fn.delay=function(b,c){return b=n.fx?n.fx.speeds[b]||b:b,c=c||"fx",this.queue(c,function(c,d){var e=a.setTimeout(c,b);d.stop=function(){a.clearTimeout(e)}})},function(){var a=d.createElement("input"),b=d.createElement("select"),c=b.appendChild(d.createElement("option"));a.type="checkbox",l.checkOn=""!==a.value,l.optSelected=c.selected,b.disabled=!0,l.optDisabled=!c.disabled,a=d.createElement("input"),a.value="t",a.type="radio",l.radioValue="t"===a.value}();var ab,bb=n.expr.attrHandle;n.fn.extend({attr:function(a,b){return K(this,n.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){n.removeAttr(this,a)})}}),n.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(3!==f&&8!==f&&2!==f)return"undefined"==typeof a.getAttribute?n.prop(a,b,c):(1===f&&n.isXMLDoc(a)||(b=b.toLowerCase(),e=n.attrHooks[b]||(n.expr.match.bool.test(b)?ab:void 0)),void 0!==c?null===c?void n.removeAttr(a,b):e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:(a.setAttribute(b,c+""),c):e&&"get"in e&&null!==(d=e.get(a,b))?d:(d=n.find.attr(a,b),null==d?void 0:d))},attrHooks:{type:{set:function(a,b){if(!l.radioValue&&"radio"===b&&n.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}},removeAttr:function(a,b){var c,d,e=0,f=b&&b.match(G);if(f&&1===a.nodeType)while(c=f[e++])d=n.propFix[c]||c,n.expr.match.bool.test(c)&&(a[d]=!1),a.removeAttribute(c)}}),ab={set:function(a,b,c){return b===!1?n.removeAttr(a,c):a.setAttribute(c,c),c}},n.each(n.expr.match.bool.source.match(/\w+/g),function(a,b){var c=bb[b]||n.find.attr;bb[b]=function(a,b,d){var e,f;return d||(f=bb[b],bb[b]=e,e=null!=c(a,b,d)?b.toLowerCase():null,bb[b]=f),e}});var cb=/^(?:input|select|textarea|button)$/i,db=/^(?:a|area)$/i;n.fn.extend({prop:function(a,b){return K(this,n.prop,a,b,arguments.length>1)},removeProp:function(a){return this.each(function(){delete this[n.propFix[a]||a]})}}),n.extend({prop:function(a,b,c){var d,e,f=a.nodeType;if(3!==f&&8!==f&&2!==f)return 1===f&&n.isXMLDoc(a)||(b=n.propFix[b]||b,
|
||||
e=n.propHooks[b]),void 0!==c?e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&"get"in e&&null!==(d=e.get(a,b))?d:a[b]},propHooks:{tabIndex:{get:function(a){var b=n.find.attr(a,"tabindex");return b?parseInt(b,10):cb.test(a.nodeName)||db.test(a.nodeName)&&a.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),l.optSelected||(n.propHooks.selected={get:function(a){var b=a.parentNode;return b&&b.parentNode&&b.parentNode.selectedIndex,null},set:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex)}}),n.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){n.propFix[this.toLowerCase()]=this});var eb=/[\t\r\n\f]/g;function fb(a){return a.getAttribute&&a.getAttribute("class")||""}n.fn.extend({addClass:function(a){var b,c,d,e,f,g,h,i=0;if(n.isFunction(a))return this.each(function(b){n(this).addClass(a.call(this,b,fb(this)))});if("string"==typeof a&&a){b=a.match(G)||[];while(c=this[i++])if(e=fb(c),d=1===c.nodeType&&(" "+e+" ").replace(eb," ")){g=0;while(f=b[g++])d.indexOf(" "+f+" ")<0&&(d+=f+" ");h=n.trim(d),e!==h&&c.setAttribute("class",h)}}return this},removeClass:function(a){var b,c,d,e,f,g,h,i=0;if(n.isFunction(a))return this.each(function(b){n(this).removeClass(a.call(this,b,fb(this)))});if(!arguments.length)return this.attr("class","");if("string"==typeof a&&a){b=a.match(G)||[];while(c=this[i++])if(e=fb(c),d=1===c.nodeType&&(" "+e+" ").replace(eb," ")){g=0;while(f=b[g++])while(d.indexOf(" "+f+" ")>-1)d=d.replace(" "+f+" "," ");h=n.trim(d),e!==h&&c.setAttribute("class",h)}}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):n.isFunction(a)?this.each(function(c){n(this).toggleClass(a.call(this,c,fb(this),b),b)}):this.each(function(){var b,d,e,f;if("string"===c){d=0,e=n(this),f=a.match(G)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else void 0!==a&&"boolean"!==c||(b=fb(this),b&&N.set(this,"__className__",b),this.setAttribute&&this.setAttribute("class",b||a===!1?"":N.get(this,"__className__")||""))})},hasClass:function(a){var b,c,d=0;b=" "+a+" ";while(c=this[d++])if(1===c.nodeType&&(" "+fb(c)+" ").replace(eb," ").indexOf(b)>-1)return!0;return!1}});var gb=/\r/g,hb=/[\x20\t\r\n\f]+/g;n.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=n.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,n(this).val()):a,null==e?e="":"number"==typeof e?e+="":n.isArray(e)&&(e=n.map(e,function(a){return null==a?"":a+""})),b=n.valHooks[this.type]||n.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=n.valHooks[e.type]||n.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(gb,""):null==c?"":c)}}}),n.extend({valHooks:{option:{get:function(a){var b=n.find.attr(a,"value");return null!=b?b:n.trim(n.text(a)).replace(hb," ")}},select:{get:function(a){for(var b,c,d=a.options,e=a.selectedIndex,f="select-one"===a.type||0>e,g=f?null:[],h=f?e+1:d.length,i=0>e?h:f?e:0;h>i;i++)if(c=d[i],(c.selected||i===e)&&(l.optDisabled?!c.disabled:null===c.getAttribute("disabled"))&&(!c.parentNode.disabled||!n.nodeName(c.parentNode,"optgroup"))){if(b=n(c).val(),f)return b;g.push(b)}return g},set:function(a,b){var c,d,e=a.options,f=n.makeArray(b),g=e.length;while(g--)d=e[g],(d.selected=n.inArray(n.valHooks.option.get(d),f)>-1)&&(c=!0);return c||(a.selectedIndex=-1),f}}}}),n.each(["radio","checkbox"],function(){n.valHooks[this]={set:function(a,b){return n.isArray(b)?a.checked=n.inArray(n(a).val(),b)>-1:void 0}},l.checkOn||(n.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})});var ib=/^(?:focusinfocus|focusoutblur)$/;n.extend(n.event,{trigger:function(b,c,e,f){var g,h,i,j,l,m,o,p=[e||d],q=k.call(b,"type")?b.type:b,r=k.call(b,"namespace")?b.namespace.split("."):[];if(h=i=e=e||d,3!==e.nodeType&&8!==e.nodeType&&!ib.test(q+n.event.triggered)&&(q.indexOf(".")>-1&&(r=q.split("."),q=r.shift(),r.sort()),l=q.indexOf(":")<0&&"on"+q,b=b[n.expando]?b:new n.Event(q,"object"==typeof b&&b),b.isTrigger=f?2:3,b.namespace=r.join("."),b.rnamespace=b.namespace?new RegExp("(^|\\.)"+r.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=e),c=null==c?[b]:n.makeArray(c,[b]),o=n.event.special[q]||{},f||!o.trigger||o.trigger.apply(e,c)!==!1)){if(!f&&!o.noBubble&&!n.isWindow(e)){for(j=o.delegateType||q,ib.test(j+q)||(h=h.parentNode);h;h=h.parentNode)p.push(h),i=h;i===(e.ownerDocument||d)&&p.push(i.defaultView||i.parentWindow||a)}g=0;while((h=p[g++])&&!b.isPropagationStopped())b.type=g>1?j:o.bindType||q,m=(N.get(h,"events")||{})[b.type]&&N.get(h,"handle"),m&&m.apply(h,c),m=l&&h[l],m&&m.apply&&L(h)&&(b.result=m.apply(h,c),b.result===!1&&b.preventDefault());return b.type=q,f||b.isDefaultPrevented()||o._default&&o._default.apply(p.pop(),c)!==!1||!L(e)||l&&n.isFunction(e[q])&&!n.isWindow(e)&&(i=e[l],i&&(e[l]=null),n.event.triggered=q,e[q](),n.event.triggered=void 0,i&&(e[l]=i)),b.result}},simulate:function(a,b,c){var d=n.extend(new n.Event,c,{type:a,isSimulated:!0});n.event.trigger(d,null,b),d.isDefaultPrevented()&&c.preventDefault()}}),n.fn.extend({trigger:function(a,b){return this.each(function(){n.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];return c?n.event.trigger(a,b,c,!0):void 0}}),n.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(a,b){n.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),n.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}}),l.focusin="onfocusin"in a,l.focusin||n.each({focus:"focusin",blur:"focusout"},function(a,b){var c=function(a){n.event.simulate(b,a.target,n.event.fix(a))};n.event.special[b]={setup:function(){var d=this.ownerDocument||this,e=N.access(d,b);e||d.addEventListener(a,c,!0),N.access(d,b,(e||0)+1)},teardown:function(){var d=this.ownerDocument||this,e=N.access(d,b)-1;e?N.access(d,b,e):(d.removeEventListener(a,c,!0),N.remove(d,b))}}});var jb=a.location,kb=n.now(),lb=/\?/;n.parseJSON=function(a){return JSON.parse(a+"")},n.parseXML=function(b){var c;if(!b||"string"!=typeof b)return null;try{c=(new a.DOMParser).parseFromString(b,"text/xml")}catch(d){c=void 0}return c&&!c.getElementsByTagName("parsererror").length||n.error("Invalid XML: "+b),c};var mb=/#.*$/,nb=/([?&])_=[^&]*/,ob=/^(.*?):[ \t]*([^\r\n]*)$/gm,pb=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,qb=/^(?:GET|HEAD)$/,rb=/^\/\//,sb={},tb={},ub="*/".concat("*"),vb=d.createElement("a");vb.href=jb.href;function wb(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(G)||[];if(n.isFunction(c))while(d=f[e++])"+"===d[0]?(d=d.slice(1)||"*",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}function xb(a,b,c,d){var e={},f=a===tb;function g(h){var i;return e[h]=!0,n.each(a[h]||[],function(a,h){var j=h(b,c,d);return"string"!=typeof j||f||e[j]?f?!(i=j):void 0:(b.dataTypes.unshift(j),g(j),!1)}),i}return g(b.dataTypes[0])||!e["*"]&&g("*")}function yb(a,b){var c,d,e=n.ajaxSettings.flatOptions||{};for(c in b)void 0!==b[c]&&((e[c]?a:d||(d={}))[c]=b[c]);return d&&n.extend(!0,a,d),a}function zb(a,b,c){var d,e,f,g,h=a.contents,i=a.dataTypes;while("*"===i[0])i.shift(),void 0===d&&(d=a.mimeType||b.getResponseHeader("Content-Type"));if(d)for(e in h)if(h[e]&&h[e].test(d)){i.unshift(e);break}if(i[0]in c)f=i[0];else{for(e in c){if(!i[0]||a.converters[e+" "+i[0]]){f=e;break}g||(g=e)}f=f||g}return f?(f!==i[0]&&i.unshift(f),c[f]):void 0}function Ab(a,b,c,d){var e,f,g,h,i,j={},k=a.dataTypes.slice();if(k[1])for(g in a.converters)j[g.toLowerCase()]=a.converters[g];f=k.shift();while(f)if(a.responseFields[f]&&(c[a.responseFields[f]]=b),!i&&d&&a.dataFilter&&(b=a.dataFilter(b,a.dataType)),i=f,f=k.shift())if("*"===f)f=i;else if("*"!==i&&i!==f){if(g=j[i+" "+f]||j["* "+f],!g)for(e in j)if(h=e.split(" "),h[1]===f&&(g=j[i+" "+h[0]]||j["* "+h[0]])){g===!0?g=j[e]:j[e]!==!0&&(f=h[0],k.unshift(h[1]));break}if(g!==!0)if(g&&a["throws"])b=g(b);else try{b=g(b)}catch(l){return{state:"parsererror",error:g?l:"No conversion from "+i+" to "+f}}}return{state:"success",data:b}}n.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:jb.href,type:"GET",isLocal:pb.test(jb.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":ub,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":n.parseJSON,"text xml":n.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?yb(yb(a,n.ajaxSettings),b):yb(n.ajaxSettings,a)},ajaxPrefilter:wb(sb),ajaxTransport:wb(tb),ajax:function(b,c){"object"==typeof b&&(c=b,b=void 0),c=c||{};var e,f,g,h,i,j,k,l,m=n.ajaxSetup({},c),o=m.context||m,p=m.context&&(o.nodeType||o.jquery)?n(o):n.event,q=n.Deferred(),r=n.Callbacks("once memory"),s=m.statusCode||{},t={},u={},v=0,w="canceled",x={readyState:0,getResponseHeader:function(a){var b;if(2===v){if(!h){h={};while(b=ob.exec(g))h[b[1].toLowerCase()]=b[2]}b=h[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return 2===v?g:null},setRequestHeader:function(a,b){var c=a.toLowerCase();return v||(a=u[c]=u[c]||a,t[a]=b),this},overrideMimeType:function(a){return v||(m.mimeType=a),this},statusCode:function(a){var b;if(a)if(2>v)for(b in a)s[b]=[s[b],a[b]];else x.always(a[x.status]);return this},abort:function(a){var b=a||w;return e&&e.abort(b),z(0,b),this}};if(q.promise(x).complete=r.add,x.success=x.done,x.error=x.fail,m.url=((b||m.url||jb.href)+"").replace(mb,"").replace(rb,jb.protocol+"//"),m.type=c.method||c.type||m.method||m.type,m.dataTypes=n.trim(m.dataType||"*").toLowerCase().match(G)||[""],null==m.crossDomain){j=d.createElement("a");try{j.href=m.url,j.href=j.href,m.crossDomain=vb.protocol+"//"+vb.host!=j.protocol+"//"+j.host}catch(y){m.crossDomain=!0}}if(m.data&&m.processData&&"string"!=typeof m.data&&(m.data=n.param(m.data,m.traditional)),xb(sb,m,c,x),2===v)return x;k=n.event&&m.global,k&&0===n.active++&&n.event.trigger("ajaxStart"),m.type=m.type.toUpperCase(),m.hasContent=!qb.test(m.type),f=m.url,m.hasContent||(m.data&&(f=m.url+=(lb.test(f)?"&":"?")+m.data,delete m.data),m.cache===!1&&(m.url=nb.test(f)?f.replace(nb,"$1_="+kb++):f+(lb.test(f)?"&":"?")+"_="+kb++)),m.ifModified&&(n.lastModified[f]&&x.setRequestHeader("If-Modified-Since",n.lastModified[f]),n.etag[f]&&x.setRequestHeader("If-None-Match",n.etag[f])),(m.data&&m.hasContent&&m.contentType!==!1||c.contentType)&&x.setRequestHeader("Content-Type",m.contentType),x.setRequestHeader("Accept",m.dataTypes[0]&&m.accepts[m.dataTypes[0]]?m.accepts[m.dataTypes[0]]+("*"!==m.dataTypes[0]?", "+ub+"; q=0.01":""):m.accepts["*"]);for(l in m.headers)x.setRequestHeader(l,m.headers[l]);if(m.beforeSend&&(m.beforeSend.call(o,x,m)===!1||2===v))return x.abort();w="abort";for(l in{success:1,error:1,complete:1})x[l](m[l]);if(e=xb(tb,m,c,x)){if(x.readyState=1,k&&p.trigger("ajaxSend",[x,m]),2===v)return x;m.async&&m.timeout>0&&(i=a.setTimeout(function(){x.abort("timeout")},m.timeout));try{v=1,e.send(t,z)}catch(y){if(!(2>v))throw y;z(-1,y)}}else z(-1,"No Transport");function z(b,c,d,h){var j,l,t,u,w,y=c;2!==v&&(v=2,i&&a.clearTimeout(i),e=void 0,g=h||"",x.readyState=b>0?4:0,j=b>=200&&300>b||304===b,d&&(u=zb(m,x,d)),u=Ab(m,u,x,j),j?(m.ifModified&&(w=x.getResponseHeader("Last-Modified"),w&&(n.lastModified[f]=w),w=x.getResponseHeader("etag"),w&&(n.etag[f]=w)),204===b||"HEAD"===m.type?y="nocontent":304===b?y="notmodified":(y=u.state,l=u.data,t=u.error,j=!t)):(t=y,!b&&y||(y="error",0>b&&(b=0))),x.status=b,x.statusText=(c||y)+"",j?q.resolveWith(o,[l,y,x]):q.rejectWith(o,[x,y,t]),x.statusCode(s),s=void 0,k&&p.trigger(j?"ajaxSuccess":"ajaxError",[x,m,j?l:t]),r.fireWith(o,[x,y]),k&&(p.trigger("ajaxComplete",[x,m]),--n.active||n.event.trigger("ajaxStop")))}return x},getJSON:function(a,b,c){return n.get(a,b,c,"json")},getScript:function(a,b){return n.get(a,void 0,b,"script")}}),n.each(["get","post"],function(a,b){n[b]=function(a,c,d,e){return n.isFunction(c)&&(e=e||d,d=c,c=void 0),n.ajax(n.extend({url:a,type:b,dataType:e,data:c,success:d},n.isPlainObject(a)&&a))}}),n._evalUrl=function(a){return n.ajax({url:a,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})},n.fn.extend({wrapAll:function(a){var b;return n.isFunction(a)?this.each(function(b){n(this).wrapAll(a.call(this,b))}):(this[0]&&(b=n(a,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstElementChild)a=a.firstElementChild;return a}).append(this)),this)},wrapInner:function(a){return n.isFunction(a)?this.each(function(b){n(this).wrapInner(a.call(this,b))}):this.each(function(){var b=n(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=n.isFunction(a);return this.each(function(c){n(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){n.nodeName(this,"body")||n(this).replaceWith(this.childNodes)}).end()}}),n.expr.filters.hidden=function(a){return!n.expr.filters.visible(a)},n.expr.filters.visible=function(a){return a.offsetWidth>0||a.offsetHeight>0||a.getClientRects().length>0};var Bb=/%20/g,Cb=/\[\]$/,Db=/\r?\n/g,Eb=/^(?:submit|button|image|reset|file)$/i,Fb=/^(?:input|select|textarea|keygen)/i;function Gb(a,b,c,d){var e;if(n.isArray(b))n.each(b,function(b,e){c||Cb.test(a)?d(a,e):Gb(a+"["+("object"==typeof e&&null!=e?b:"")+"]",e,c,d)});else if(c||"object"!==n.type(b))d(a,b);else for(e in b)Gb(a+"["+e+"]",b[e],c,d)}n.param=function(a,b){var c,d=[],e=function(a,b){b=n.isFunction(b)?b():null==b?"":b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};if(void 0===b&&(b=n.ajaxSettings&&n.ajaxSettings.traditional),n.isArray(a)||a.jquery&&!n.isPlainObject(a))n.each(a,function(){e(this.name,this.value)});else for(c in a)Gb(c,a[c],b,e);return d.join("&").replace(Bb,"+")},n.fn.extend({serialize:function(){return n.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=n.prop(this,"elements");return a?n.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!n(this).is(":disabled")&&Fb.test(this.nodeName)&&!Eb.test(a)&&(this.checked||!X.test(a))}).map(function(a,b){var c=n(this).val();return null==c?null:n.isArray(c)?n.map(c,function(a){return{name:b.name,value:a.replace(Db,"\r\n")}}):{name:b.name,value:c.replace(Db,"\r\n")}}).get()}}),n.ajaxSettings.xhr=function(){try{return new a.XMLHttpRequest}catch(b){}};var Hb={0:200,1223:204},Ib=n.ajaxSettings.xhr();l.cors=!!Ib&&"withCredentials"in Ib,l.ajax=Ib=!!Ib,n.ajaxTransport(function(b){var c,d;return l.cors||Ib&&!b.crossDomain?{send:function(e,f){var g,h=b.xhr();if(h.open(b.type,b.url,b.async,b.username,b.password),b.xhrFields)for(g in b.xhrFields)h[g]=b.xhrFields[g];b.mimeType&&h.overrideMimeType&&h.overrideMimeType(b.mimeType),b.crossDomain||e["X-Requested-With"]||(e["X-Requested-With"]="XMLHttpRequest");for(g in e)h.setRequestHeader(g,e[g]);c=function(a){return function(){c&&(c=d=h.onload=h.onerror=h.onabort=h.onreadystatechange=null,"abort"===a?h.abort():"error"===a?"number"!=typeof h.status?f(0,"error"):f(h.status,h.statusText):f(Hb[h.status]||h.status,h.statusText,"text"!==(h.responseType||"text")||"string"!=typeof h.responseText?{binary:h.response}:{text:h.responseText},h.getAllResponseHeaders()))}},h.onload=c(),d=h.onerror=c("error"),void 0!==h.onabort?h.onabort=d:h.onreadystatechange=function(){4===h.readyState&&a.setTimeout(function(){c&&d()})},c=c("abort");try{h.send(b.hasContent&&b.data||null)}catch(i){if(c)throw i}},abort:function(){c&&c()}}:void 0}),n.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(a){return n.globalEval(a),a}}}),n.ajaxPrefilter("script",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type="GET")}),n.ajaxTransport("script",function(a){if(a.crossDomain){var b,c;return{send:function(e,f){b=n("<script>").prop({charset:a.scriptCharset,src:a.url}).on("load error",c=function(a){b.remove(),c=null,a&&f("error"===a.type?404:200,a.type)}),d.head.appendChild(b[0])},abort:function(){c&&c()}}}});var Jb=[],Kb=/(=)\?(?=&|$)|\?\?/;n.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=Jb.pop()||n.expando+"_"+kb++;return this[a]=!0,a}}),n.ajaxPrefilter("json jsonp",function(b,c,d){var e,f,g,h=b.jsonp!==!1&&(Kb.test(b.url)?"url":"string"==typeof b.data&&0===(b.contentType||"").indexOf("application/x-www-form-urlencoded")&&Kb.test(b.data)&&"data");return h||"jsonp"===b.dataTypes[0]?(e=b.jsonpCallback=n.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,h?b[h]=b[h].replace(Kb,"$1"+e):b.jsonp!==!1&&(b.url+=(lb.test(b.url)?"&":"?")+b.jsonp+"="+e),b.converters["script json"]=function(){return g||n.error(e+" was not called"),g[0]},b.dataTypes[0]="json",f=a[e],a[e]=function(){g=arguments},d.always(function(){void 0===f?n(a).removeProp(e):a[e]=f,b[e]&&(b.jsonpCallback=c.jsonpCallback,Jb.push(e)),g&&n.isFunction(f)&&f(g[0]),g=f=void 0}),"script"):void 0}),n.parseHTML=function(a,b,c){if(!a||"string"!=typeof a)return null;"boolean"==typeof b&&(c=b,b=!1),b=b||d;var e=x.exec(a),f=!c&&[];return e?[b.createElement(e[1])]:(e=ca([a],b,f),f&&f.length&&n(f).remove(),n.merge([],e.childNodes))};var Lb=n.fn.load;n.fn.load=function(a,b,c){if("string"!=typeof a&&Lb)return Lb.apply(this,arguments);var d,e,f,g=this,h=a.indexOf(" ");return h>-1&&(d=n.trim(a.slice(h)),a=a.slice(0,h)),n.isFunction(b)?(c=b,b=void 0):b&&"object"==typeof b&&(e="POST"),g.length>0&&n.ajax({url:a,type:e||"GET",dataType:"html",data:b}).done(function(a){f=arguments,g.html(d?n("<div>").append(n.parseHTML(a)).find(d):a)}).always(c&&function(a,b){g.each(function(){c.apply(this,f||[a.responseText,b,a])})}),this},n.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(a,b){n.fn[b]=function(a){return this.on(b,a)}}),n.expr.filters.animated=function(a){return n.grep(n.timers,function(b){return a===b.elem}).length};function Mb(a){return n.isWindow(a)?a:9===a.nodeType&&a.defaultView}n.offset={setOffset:function(a,b,c){var d,e,f,g,h,i,j,k=n.css(a,"position"),l=n(a),m={};"static"===k&&(a.style.position="relative"),h=l.offset(),f=n.css(a,"top"),i=n.css(a,"left"),j=("absolute"===k||"fixed"===k)&&(f+i).indexOf("auto")>-1,j?(d=l.position(),g=d.top,e=d.left):(g=parseFloat(f)||0,e=parseFloat(i)||0),n.isFunction(b)&&(b=b.call(a,c,n.extend({},h))),null!=b.top&&(m.top=b.top-h.top+g),null!=b.left&&(m.left=b.left-h.left+e),"using"in b?b.using.call(a,m):l.css(m)}},n.fn.extend({offset:function(a){if(arguments.length)return void 0===a?this:this.each(function(b){n.offset.setOffset(this,a,b)});var b,c,d=this[0],e={top:0,left:0},f=d&&d.ownerDocument;if(f)return b=f.documentElement,n.contains(b,d)?(e=d.getBoundingClientRect(),c=Mb(f),{top:e.top+c.pageYOffset-b.clientTop,left:e.left+c.pageXOffset-b.clientLeft}):e},position:function(){if(this[0]){var a,b,c=this[0],d={top:0,left:0};return"fixed"===n.css(c,"position")?b=c.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),n.nodeName(a[0],"html")||(d=a.offset()),d.top+=n.css(a[0],"borderTopWidth",!0),d.left+=n.css(a[0],"borderLeftWidth",!0)),{top:b.top-d.top-n.css(c,"marginTop",!0),left:b.left-d.left-n.css(c,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var a=this.offsetParent;while(a&&"static"===n.css(a,"position"))a=a.offsetParent;return a||Ea})}}),n.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,b){var c="pageYOffset"===b;n.fn[a]=function(d){return K(this,function(a,d,e){var f=Mb(a);return void 0===e?f?f[b]:a[d]:void(f?f.scrollTo(c?f.pageXOffset:e,c?e:f.pageYOffset):a[d]=e)},a,d,arguments.length)}}),n.each(["top","left"],function(a,b){n.cssHooks[b]=Ga(l.pixelPosition,function(a,c){return c?(c=Fa(a,b),Ba.test(c)?n(a).position()[b]+"px":c):void 0})}),n.each({Height:"height",Width:"width"},function(a,b){n.each({padding:"inner"+a,content:b,"":"outer"+a},function(c,d){n.fn[d]=function(d,e){var f=arguments.length&&(c||"boolean"!=typeof d),g=c||(d===!0||e===!0?"margin":"border");return K(this,function(b,c,d){var e;return n.isWindow(b)?b.document.documentElement["client"+a]:9===b.nodeType?(e=b.documentElement,Math.max(b.body["scroll"+a],e["scroll"+a],b.body["offset"+a],e["offset"+a],e["client"+a])):void 0===d?n.css(b,c,g):n.style(b,c,d,g)},b,f?d:void 0,f,null)}})}),n.fn.extend({bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return 1===arguments.length?this.off(a,"**"):this.off(b,a||"**",c)},size:function(){return this.length}}),n.fn.andSelf=n.fn.addBack,"function"==typeof define&&define.amd&&define("jquery",[],function(){return n});var Nb=a.jQuery,Ob=a.$;return n.noConflict=function(b){return a.$===n&&(a.$=Ob),b&&a.jQuery===n&&(a.jQuery=Nb),n},b||(a.jQuery=a.$=n),n});
|
||||
@@ -0,0 +1,45 @@
|
||||
{
|
||||
"manifest_version": 2,
|
||||
"name": "中微子代理客户端",
|
||||
"description": "中微子代理客户端,方便本地开发调试,一键连接服务端,开启穿透之旅。",
|
||||
"version": "1.0",
|
||||
"permissions": [
|
||||
"storage",
|
||||
"unlimitedStorage",
|
||||
"management",
|
||||
"cookies",
|
||||
"tabs",
|
||||
"notifications",
|
||||
"webRequest",
|
||||
"webRequestBlocking",
|
||||
"webNavigation",
|
||||
"nativeMessaging",
|
||||
"http://*/*",
|
||||
"https://*/*",
|
||||
"<all_urls>"
|
||||
|
||||
],
|
||||
"icons": {
|
||||
"48": "assets/logo.png",
|
||||
"128": "assets/logo.png"
|
||||
},
|
||||
"browser_action": {
|
||||
"default_icon": "assets/logo.png",
|
||||
"default_popup": "src/popup/popup.html"
|
||||
},
|
||||
"background": {
|
||||
"persistent": true,
|
||||
"scripts": ["lib/jquery/jquery-2.2.3.min.js",
|
||||
"lib/axios/axios.js",
|
||||
"lib/drag/drag.js",
|
||||
"lib/asgc/asgc.js",
|
||||
"src/base/init.js",
|
||||
"src/base/util.js",
|
||||
"src/background/background.js"
|
||||
]
|
||||
},
|
||||
"web_accessible_resources":[
|
||||
"manifest.json",
|
||||
"assets/*"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
chrome.runtime.onMessage.addListener(function (request, sender, sendResponse){
|
||||
try{
|
||||
System.log.debug('chrome.runtime.onMessage:', request, sender);
|
||||
|
||||
switch(request.action){
|
||||
case System.Constant.Action.Runtime.DOMContentLoaded: {
|
||||
System.log.info('页面加载完毕!');
|
||||
break;
|
||||
}
|
||||
}
|
||||
}catch(e){
|
||||
System.log.error('chrome.runtime.onMessage error:', e);
|
||||
}
|
||||
sendResponse('ans:ok');
|
||||
});
|
||||
|
||||
chrome.browserAction.onClicked.addListener(function(tab) {
|
||||
System.log.debug('chrome.browserAction.onClicked:', tab);
|
||||
chrome.tabs.sendMessage(tab.id, { action: System.Constant.Action.Extension.SHOW }, function (response) {
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
// 获取当前选项卡ID
|
||||
function getCurrentTabId(callback){
|
||||
chrome.tabs.query({active: true, currentWindow: true}, function(tabs){
|
||||
if(callback) callback(tabs.length ? tabs[0].id: null);
|
||||
});
|
||||
}
|
||||
|
||||
// 当前标签打开某个链接
|
||||
function openUrlCurrentTab(url){
|
||||
getCurrentTabId(tabId => {
|
||||
chrome.tabs.update(tabId, {url: url});
|
||||
})
|
||||
}
|
||||
|
||||
// 新标签打开某个链接
|
||||
function openUrlNewTab(url){
|
||||
chrome.tabs.create({url: url});
|
||||
}
|
||||
|
||||
//判断某个标签页是否存在
|
||||
function isExistTab(callback){
|
||||
chrome.tabs.getAllInWindow(null, function(tabs)
|
||||
{
|
||||
bexist = false;
|
||||
for ( var i = 0; i <tabs.length; i++)
|
||||
{
|
||||
url = tabs[i].url;
|
||||
if(url.indexOf("pan.bitqiu.com") != -1)
|
||||
{
|
||||
bexist = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(callback) callback(bexist)
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function checkNotification(){
|
||||
if (!("Notification" in window)) {
|
||||
alert("This browser does not support desktop notification");
|
||||
}
|
||||
// check whether notification permissions have alredy been granted
|
||||
else if (Notification.permission === "granted") {
|
||||
// If it's okay let's create a notification
|
||||
new Notification("标题!");
|
||||
}
|
||||
// Otherwise, ask the user for permission
|
||||
else if (Notification.permission !== 'denied') {
|
||||
Notification.requestPermission(function (permission) {
|
||||
// If the user accepts, let's create a notification
|
||||
if (permission === "granted") {
|
||||
new Notification("Request granted!");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
// 猎么登录接口
|
||||
System.api.base.login = function(params, successCallback){
|
||||
return System.axios(System.Constant.Lieme.API_BASE_URL + '/user/login',
|
||||
System.Constant.RequestMethod.POST,
|
||||
{},
|
||||
null,
|
||||
params,
|
||||
successCallback
|
||||
);
|
||||
};
|
||||
|
||||
// 加载图片
|
||||
System.api.base.loadImage = function(url, successCallback){
|
||||
return System.axios(url,
|
||||
System.Constant.RequestMethod.GET,
|
||||
{},
|
||||
'arraybuffer',
|
||||
{
|
||||
Accept: 'image/webp,image/apng,image/*,*/*;q=0.8'
|
||||
},
|
||||
successCallback
|
||||
);
|
||||
};
|
||||
|
||||
// 解析猎聘简历
|
||||
System.api.liepin.resumePaser = function(params, successCallback){
|
||||
return System.axios(System.Constant.Lieme.API_BASE_URL + '/paser/html',
|
||||
System.Constant.RequestMethod.POST,
|
||||
{},
|
||||
null,
|
||||
params,
|
||||
successCallback
|
||||
);
|
||||
};
|
||||
|
||||
// 更新猎聘简历
|
||||
System.api.liepin.resumeUpdate = function(params, successCallback){
|
||||
return System.axios(System.Constant.Lieme.API_BASE_URL + '/paser/update',
|
||||
System.Constant.RequestMethod.POST,
|
||||
{},
|
||||
null,
|
||||
params,
|
||||
successCallback
|
||||
);
|
||||
};
|
||||
|
||||
// 导入猎聘简历
|
||||
System.api.liepin.resumeImport = function(params, successCallback){
|
||||
return System.axios(System.Constant.Lieme.API_BASE_URL + '/paser/import',
|
||||
System.Constant.RequestMethod.POST,
|
||||
{},
|
||||
null,
|
||||
params,
|
||||
successCallback
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,62 @@
|
||||
let System = {
|
||||
Constant: {
|
||||
RequestMethod: {
|
||||
GET: 'GET',
|
||||
POST: 'POST'
|
||||
},
|
||||
SessionKeys: {
|
||||
USER_INFO: 'lm-user-info'
|
||||
},
|
||||
Action: {
|
||||
Runtime: {
|
||||
DOMContentLoaded: 'DOMContentLoaded',
|
||||
},
|
||||
Extension: {
|
||||
COPY: 'copy',
|
||||
URL: 'url',
|
||||
SHOW: 'show'
|
||||
}
|
||||
},
|
||||
Lieme: {
|
||||
API_BASE_URL: 'https://resume.api.yuujob.com',
|
||||
RESUME_TYPE: {
|
||||
BOSS: 'boss',
|
||||
ZHI_LIE_BANG: 'zhiliebang',
|
||||
QIAN_CHENG: 'qiancheng',
|
||||
ZHI_LIAN: 'zhilian',
|
||||
ZHUO_PIN: 'zhuopin',
|
||||
LA_GOU: 'lagou',
|
||||
LIE_PIN: 'liepin',
|
||||
UNKNOWN: 'Unknown'
|
||||
}
|
||||
},
|
||||
ResumePageUrl: {
|
||||
LIE_PIN: ['h.liepin.com/resume/showresumedetail', 'h.liepin.cn/resume/showresumedetail']
|
||||
}
|
||||
},
|
||||
inject: {
|
||||
js: {},
|
||||
html: {},
|
||||
css: {}
|
||||
},
|
||||
util: {},
|
||||
api: {
|
||||
base: {},
|
||||
// boss
|
||||
boss: {},
|
||||
// 直猎邦
|
||||
zhiliebang: {},
|
||||
// 前程无忧
|
||||
qiancheng: {},
|
||||
// 智联
|
||||
zhilian: {},
|
||||
// 卓聘
|
||||
zhuopin: {},
|
||||
// 拉勾网
|
||||
lagou: {},
|
||||
// 猎聘
|
||||
liepin: {},
|
||||
}
|
||||
};
|
||||
window.System = System;
|
||||
|
||||
@@ -0,0 +1,123 @@
|
||||
// 日志对象
|
||||
System.log = Asgc.Logger("NeutrinoProxyClient");
|
||||
System.log.setLevelAll();
|
||||
|
||||
// 发送ajax请求,未传回调方法时采用同步方式
|
||||
System.ajax = function(url, method, headers, params, successCallback, errorCallback){
|
||||
let result = undefined;
|
||||
System.log.debug("[ajax] request url:", url, "method:", method, "params:", params);
|
||||
$.ajax({
|
||||
url: url,
|
||||
data: params,
|
||||
type: method,
|
||||
async: !!successCallback,
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
result = data;
|
||||
System.log.debug("[ajax] response:", data);
|
||||
if(!!successCallback){
|
||||
successCallback.call(this, Array.prototype.slice.apply(arguments));
|
||||
}
|
||||
},
|
||||
error: function(e){
|
||||
System.log.debug("[ajax] error:", e);
|
||||
if(!!errorCallback){
|
||||
errorCallback.call(this, Array.prototype.slice.apply(arguments));
|
||||
}
|
||||
}
|
||||
});
|
||||
return result;
|
||||
};
|
||||
|
||||
// 发送axios请求
|
||||
System.axios = function(url, method, headers, responseType, params, successCallback, errorCallback){
|
||||
System.log.debug("[axios] request url:", url, "method:", method, "params:", params);
|
||||
var options = {
|
||||
url: url,
|
||||
method: method,
|
||||
headers: headers,
|
||||
data: params
|
||||
};
|
||||
|
||||
if(responseType){
|
||||
options.responseType = responseType;
|
||||
}
|
||||
|
||||
return axios(options).then(function (res){
|
||||
System.log.debug("[axios] response:", res.data);
|
||||
if(!!successCallback){
|
||||
successCallback(res.data);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// 获取注释块
|
||||
Function.prototype.getCommentBlockString = function(){
|
||||
var block = new String(this);
|
||||
block = block.substring(block.indexOf("/*") + 3,block.lastIndexOf("*/"));
|
||||
return block;
|
||||
}
|
||||
|
||||
// 获取用户信息
|
||||
System.util.getUserInfo = function(){
|
||||
return Asgc.cache.getJson(System.Constant.SessionKeys.USER_INFO);
|
||||
};
|
||||
|
||||
// 获取待注入的js片段
|
||||
System.util.getInjectJS = function(name){
|
||||
var fun = System.inject.js[name];
|
||||
if(!fun){
|
||||
System.log.error('获取待注入的JS片段异常: ' + name + '不存在!');
|
||||
}
|
||||
return fun.getCommentBlockString();
|
||||
};
|
||||
|
||||
// 获取待注入的html片段
|
||||
System.util.getInjectHTML = function(name){
|
||||
var fun = System.inject.html[name];
|
||||
if(!fun){
|
||||
System.log.error('获取待注入的HTML片段异常: ' + name + '不存在!');
|
||||
}
|
||||
return fun.getCommentBlockString();
|
||||
};
|
||||
|
||||
// 获取待注入的css代码片段
|
||||
System.util.getInjectCSS = function(name){
|
||||
var fun = System.inject.css[name];
|
||||
if(!fun){
|
||||
System.log.error('获取待注入的CSS片段异常: ' + name + '不存在!');
|
||||
}
|
||||
return fun.getCommentBlockString();
|
||||
};
|
||||
|
||||
// 获取html content
|
||||
System.util.getHtmlContent = function(){
|
||||
let login = System.util.getUserInfo();
|
||||
if(!login){
|
||||
return System.util.getInjectHTML('loginBeforeContent');
|
||||
}
|
||||
return System.util.getInjectHTML('loginAfterContent');
|
||||
};
|
||||
|
||||
// 获取content内容
|
||||
System.util.getRenderHtml = function(){
|
||||
var html = '<div id="lpBack" class="lm-back tst" >';
|
||||
html += System.util.getHtmlContent();
|
||||
html += '</div>';
|
||||
return html;
|
||||
};
|
||||
|
||||
// 获取当前简历页面类型
|
||||
System.util.getCurrentResumeType = function(){
|
||||
var resumeType = System.Constant.Lieme.RESUME_TYPE.UNKNOWN;
|
||||
for(var type in System.Constant.ResumePageUrl){
|
||||
var urls = System.Constant.ResumePageUrl[type];
|
||||
for(var url of urls){
|
||||
if(location.href.indexOf(url) !== -1){
|
||||
return System.Constant.Lieme.RESUME_TYPE[type];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return resumeType;
|
||||
};
|
||||
@@ -0,0 +1,61 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>中微子代理客户端</title>
|
||||
<script src="lib/jquery/jquery-2.2.3.min.js"></script>
|
||||
<script src="./popup.js"></script>
|
||||
<style>
|
||||
body {
|
||||
width: 200px;
|
||||
}
|
||||
.content {
|
||||
background-color: #eee9e9;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
.block {
|
||||
margin-top: 10px;
|
||||
}
|
||||
.item {
|
||||
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="content">
|
||||
<div class="block">
|
||||
<div class="item">
|
||||
1111-1
|
||||
</div>
|
||||
<div class="item">
|
||||
1111-2
|
||||
</div>
|
||||
</div>
|
||||
<div class="block">
|
||||
<div class="item">
|
||||
2222-1
|
||||
</div>
|
||||
<div class="item">
|
||||
2222-2
|
||||
</div>
|
||||
</div>
|
||||
<div class="block">
|
||||
<div class="item">
|
||||
3333-1
|
||||
</div>
|
||||
</div>
|
||||
<div class="block">
|
||||
<div class="item">
|
||||
4444-1
|
||||
</div>
|
||||
<div class="item">
|
||||
4444-2
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
<script>
|
||||
|
||||
</script>
|
||||
@@ -0,0 +1,68 @@
|
||||
$(function () {
|
||||
$("#btnGet").click(function () {
|
||||
// chrome.tabs.query可以通过回调函数获得当前页面的信息tabs
|
||||
|
||||
chrome.tabs.query({ active: true, currentWindow: true }, function (tabs) {
|
||||
// 发送一个copy消息出去
|
||||
chrome.tabs.sendMessage(tabs[0].id, { action: System.Constant.Action.Extension.COPY }, function (response) {
|
||||
// 这里的回调函数接收到了要抓取的值,获取值得操作在下方content-script.js
|
||||
// 将值存在background.js的data属性里面。
|
||||
// console.log(response);
|
||||
var win = chrome.extension.getBackgroundPage();
|
||||
win.data= response;
|
||||
// export_raw('test.html', response);
|
||||
$.ajax({
|
||||
url: 'http://www.hzcms.com/api/demo/test1',
|
||||
type: 'POST',
|
||||
data: {'html': response},
|
||||
dataType: 'json',
|
||||
}).then(function(res){
|
||||
console.log(res);
|
||||
}, function(error){
|
||||
console.log(error);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
$("#btnLogin").click(function () {
|
||||
|
||||
let account = $('input[name=account]').val();
|
||||
let password = $('input[name=password]').val();
|
||||
|
||||
|
||||
console.log()
|
||||
// 登录逻辑
|
||||
window.localStorage.setItem('login','1');
|
||||
changeLogin();
|
||||
});
|
||||
|
||||
$('#updateAll').click(function () {
|
||||
// 更新全部
|
||||
});
|
||||
$('#updateItem').click(function (e) {
|
||||
// 更新
|
||||
console.log(e.currentTarget.dataset.value);
|
||||
});
|
||||
});
|
||||
console.log('popup...')
|
||||
|
||||
// chrome-extension://mkonfdhljckogillahgannggmlmkegjp/popup.html
|
||||
|
||||
// changeLogin();
|
||||
|
||||
|
||||
|
||||
// function changeLogin() {
|
||||
// let login = window.localStorage.getItem('login');
|
||||
// if (login && login == '1') {
|
||||
// $('#logined').attr('style','');
|
||||
// $('#login').attr('style','display: none;');
|
||||
// } else {
|
||||
// $('#logined').attr('style','display: none;');
|
||||
// $('#login').attr('style','');
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
> 从1.9.0之前的版本升级需要注意:
|
||||
- 在项目`neutrino-proxy-server/src/main/resources/sql`目录下找到mysql/sqlite的增量sql文件`UPDATE-20230922.SQL`,执行更新自己的中微子代理数据库
|
||||
- 参照[官网服务端配置](https://dromara.gitee.io/neutrino-proxy/pages/f2d0f1)调整现有的服务端配置
|
||||
- 参照[官网客户端配置](https://dromara.gitee.io/neutrino-proxy/pages/50ce10)吊证现有的客户端配置
|
||||
- 参照[官网客户端配置](https://dromara.gitee.io/neutrino-proxy/pages/50ce10)调整现有的客户端配置
|
||||
- 从[仓库发行版](https://gitee.com/dromara/neutrino-proxy/releases)下载最新版本的客户端(neutrino-proxy-client.jar)、服务端(neutrino-proxy-server.jar、 neutrino-proxy-admin.zip)部署文件。若为服务端是docker镜像部署,则更新镜像重启即可
|
||||
|
||||
## 项目简介
|
||||
|
||||
|
After Width: | Height: | Size: 123 KiB |
|
After Width: | Height: | Size: 502 KiB |
@@ -0,0 +1,60 @@
|
||||
# 中微子代理(NeutrinoProxy)2.0.0重磅发布
|
||||
|
||||
## 项目简介
|
||||
- [中微子代理(neutrino-proxy)](https://gitee.com/asgc/neutrino-proxy) 是一款基于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、采用最为宽松的MIT协议,免去你的后顾之忧
|
||||
|
||||
## 本次更新内容
|
||||
- solon版本升级为`2.5.12-M1`
|
||||
- jdk版本升级为17
|
||||
- 支持原生编译改造
|
||||
- 默认支持的数据库由sqlite改为h2
|
||||
- 官方默认使用的docker镜像仓库从阿里云改为dockerhub
|
||||
|
||||
## 安装使用说明
|
||||
- 快速上手:[点击这里](https://neutrino-proxy.dromara.org/neutrino-proxy/pages/793dcb/)
|
||||
- 升级须知:
|
||||
- jdk版本升级为了jdk17,jar部署时请注意
|
||||
- 去掉了默认的sqlite数据库,改为了h2。如果之前使用sqlite,请自行处理数据迁移
|
||||
- 配置文件做了较大调整,请参照官网使用须知中的`服务端配置`、`客户端配置`进行更新
|
||||
|
||||
## 运行示例
|
||||
#### 本地原生启动截图
|
||||
<img src="./run1.png" width="100%"/>
|
||||
|
||||
#### 管理后台首页
|
||||
<img src="./home.png" width="100%"/>
|
||||
|
||||
#### 端口映射
|
||||
<img src="./port-mapping2.png" width="100%"/>
|
||||
|
||||
## 联系我们
|
||||
笔者时间、能力有限,且开源项目非一朝一夕之事,存在众多问题亦在所难免。使用、学习过程中有任何问题欢迎大家与我联系。
|
||||
|
||||
对项目有什么想法或者建议,可以加我微信拉交流群,或者创建[issues](https://gitee.com/dromara/neutrino-proxy/issues),一起完善项目
|
||||
|
||||
- 微信号:yuyunshize
|
||||
- Email: aoshiguchen@dromara.org
|
||||
- 微信二维码(添加时请备注"中微子进群"):
|
||||
<img src="MyWeChatQRCode.jpeg" width="100%"/>
|
||||
|
After Width: | Height: | Size: 262 KiB |
|
After Width: | Height: | Size: 2.3 MiB |
|
After Width: | Height: | Size: 458 KiB |
@@ -0,0 +1,86 @@
|
||||
# 从Neutrino-Proxy(中微子代理)到Solon Native
|
||||
|
||||
## Neutrino-Proxy(中微子代理)是啥
|
||||
#### 项目简介
|
||||
- [中微子代理(neutrino-proxy)](https://gitee.com/asgc/neutrino-proxy) 是一款基于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、采用最为宽松的MIT协议,免去你的后顾之忧
|
||||
|
||||
## 为什么开发Neutrino-Proxy(中微子代理)
|
||||
2022年4月份左右,因工作原因需要用到内网穿透。此前一段时间使用的`coplar`,由于公司担心带来安全隐患,
|
||||
因此决定自己研究一下这一块。
|
||||
|
||||
对于常年写业务代码的一介码农来说,内网穿透就是一个黑盒。为了打开这个黑盒,我开始到处找相关的开源项目,其中包括lanproxy、ngrok、nps、frp等。
|
||||
|
||||
经过一翻努力,2022年6月份,实现了中微子代理1.0.0。此版本纯粹为了练手, 所以是基于自己手写的一套底层框架(包含Ioc、Aop、SqlMaper(简易版本的mybatis)、xxljob等),
|
||||
实现了客户端/服务端+纯配置文件版本的TCP代理。
|
||||
|
||||
千里之行,始于足下。1.0.0版本发布后,经过不断的迭代,如今2.0.0版本终于和大家见面了。
|
||||
|
||||
## 为什么选择Solon
|
||||
中微子1.0.0版本发布之后,大约7~8个月的时间,进行了大量的更新,主要围绕在底层基础框架、
|
||||
管理后台这一块。
|
||||
|
||||
此时中微子陆陆续续开始有了一些用户,开始迫切的需要加快代理相关功能的迭代进度。而此时自己手写
|
||||
的底层框架成为了最大的掣肘,单单底层框架各种细节优化、测试、参考借鉴其他框架源码这些就足以耗光
|
||||
我为数不多的业余时间,更别提在这个尚不成熟的框架上开发代理功能了。任何一次底层的优化调整,可能带来的
|
||||
是上层代理功能的大量重构。
|
||||
|
||||
于是,我开始搜寻其它替代框架。因日常工作一直都在用Spring体系,我始终相信多种技术两相印证之后学到的东西更为深刻,所以自己的开源项目始终将Spring体系作为优先级最低
|
||||
的选项。最终一个或偶然、或必然的机会,我了解到了Solon。
|
||||
|
||||
经过对Solon项目源码、官网文档、项目更新频率、生态完善度的深入了解,最终决定选择Solon作为中微子代理的底层框架。
|
||||
|
||||
2023年3月12日,中微子代理1.7.0版本发布,开始正式基于Solon框架。
|
||||
2023年10月30日,中微子代理2.0.0版本发布,基于Solon Native实现原生部署。
|
||||
|
||||
## Solon简介
|
||||
#### 项目简介
|
||||
- Solon是一个全新的java生态体系,给人带来一种与众不同的开发体验,让你能更快的构建自己的应用、更小的打包产出、更快的启动速度。
|
||||
- Gitee仓库:https://gitee.com/noear/solon
|
||||
- Github仓库:https://github.com/noear/solon
|
||||
- 官网地址:https://solon.noear.org/
|
||||
|
||||
#### 主要特性
|
||||
> 启动快 5 ~ 10 倍;qps 高 2~ 3 倍;运行时内存节省 1/3 ~ 1/2;打包可以缩到 1/2 ~ 1/10
|
||||
- 克制、简洁、高效、开放、生态
|
||||
- 支持 JDK8、JDK11、JDK17、JDK21
|
||||
- Http、WebSocket、Socket 三种信号统一的开发体验(俗称:三源合一)
|
||||
- 支持“注解”与“手动”两种模式,按需自由操控
|
||||
- Not Servlet,可以适配任何基础通讯框架(最小 0.3m 运行rpc架构)
|
||||
- 独特的 IOC/AOP 容器设计。不会因为插件变多而启动变很慢
|
||||
- 支持 Web、Data、Job、Remoting、Cloud 等任何开发场景
|
||||
- 兼顾 Handler + Context 和 Listener + Message 两种架构模式
|
||||
- 强调插件式扩展,可扩展可切换;适应不同的应用场景
|
||||
- 支持 GraalVm Native Image 打包
|
||||
- 允许业务插件“热插”、“热拔”、“热管理”
|
||||
|
||||
## 最后说点什么
|
||||
开源实属不易,开源国产生态型基础框架更是举步维艰。不仅需要长时间、持续、稳定的投入迭代、测试、文档撰写、bug修复、发版、推广,
|
||||
还经常需要面对来自四面八方汹涌如潮的质疑。
|
||||
|
||||
时光无言,它磨灭了一切、也证明着一切。
|
||||
|
||||
一千八百多个日日夜夜、五年的风雨兼程,Solon生态已经初具规模,社区汇聚了一大批开源爱好者。
|
||||
|
||||
大鹏一日通风起,扶摇直上九万里。我相信国产开源在大家的努力下,一定会越来越好!
|
||||
|
After Width: | Height: | Size: 123 KiB |
@@ -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部署时请注意
|
||||
- 涉及到表结构变更,执行增量SQL:https://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%"/>
|
||||
|
After Width: | Height: | Size: 175 KiB |
|
After Width: | Height: | Size: 243 KiB |
|
After Width: | Height: | Size: 143 KiB |
|
After Width: | Height: | Size: 132 KiB |
|
After Width: | Height: | Size: 123 KiB |
@@ -0,0 +1,81 @@
|
||||
# NeutrinoProxy2.0.2发布,端口映射支持绑定多个域名
|
||||
|
||||
## 项目简介
|
||||
- [中微子代理(neutrino-proxy)](https://gitee.com/dromara/neutrino-proxy) 是一款基于Solon、Netty的内网穿透神器。该项目采用最为宽松的MIT协议,因此您可以对它进行复制、修改、传播并用于任何个人或商业行为。
|
||||
- 市面上基于内网穿透的常见产品有:花生壳、TeamView、cpolar等。
|
||||
- 常见的使用场景:
|
||||
- 本地开发调试第三方回调
|
||||
- 本地开发异地接口连调
|
||||
- 远程登录内网windows机器
|
||||
- 将本地服务映射到外网,用于演示
|
||||
- GitCode:https://gitcode.com/dromara/neutrino-proxy
|
||||
- Gitee仓库:https://gitee.com/dromara/neutrino-proxy
|
||||
- Github仓库:https://github.com/dromara/neutrino-proxy
|
||||
- 官网地址: https://neutrino-proxy.dromara.org
|
||||
|
||||
## 主要特点:
|
||||
- 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协议,免去你的后顾之忧
|
||||
|
||||
## 本次更新内容
|
||||
- bug修复
|
||||
- 解决安全组在ipv6场景下误拦截导致域名映射访问不通的问题
|
||||
- 解决native编译后,端口池批量删除报错的问题
|
||||
- 解决客户端docker方式部署环境变量指定参数不生效的问题
|
||||
- 服务端解决native下清理日志定时任务报错的问题
|
||||
- 解决后台分页查询的已知问题
|
||||
- 端口映射中的客户端ip字段加长一点,解决配置阿里云数据库域名字段不够的问题
|
||||
- 解决服务端native部署时,访问后台用户列表,日志警告“you should use: nativeMetadata.registerField(field) at aot runtime”的问题
|
||||
- 新增功能
|
||||
- 新增后台域名管理,⽀持新增、修改、删除、禁⽤主域名,支持添加多级域名。
|
||||
- 域名管理支持上传域名对应的SSL证书、⽀持设置强制HTTPS、⽀持域名映射⾃动加载对应的服务器证书。
|
||||
- 端口映射支持选择切换不同的主域名,⽀持绑定多个⼦域名,单个端⼝⽀持绑定多个不同的主域名。
|
||||
|
||||
## 安装使用说明
|
||||
- 快速上手:https://neutrino-proxy.dromara.org/neutrino-proxy/pages/793dcb/
|
||||
- 支持的部署方式
|
||||
- 1、jar
|
||||
- 2、docker
|
||||
- 3、native
|
||||
- windows
|
||||
- linux
|
||||
- mac
|
||||
- 4、docker-compose
|
||||
- 升级须知:
|
||||
- **域名和SSL证书的配置由配置文件配置改为后台域名管理页面配置。**
|
||||
- 去掉了配置文件声明服务器端域名和证书的方式,改为通过页面进行管理,请注意自行进行数据迁移。
|
||||
- 数据库新增`域名表`和`域名映射中间表`,修改了`端口映射表`,涉及到表结构变更,执行[增量SQL](https://gitee.com/dromara/neutrino-proxy/blob/master/neutrino-proxy-server/src/main/resources/sql/mysql/update/UPDATE-20240808.SQL)
|
||||
|
||||
## 运行示例
|
||||
#### License限速
|
||||
<img src="./license2.png" width="100%"/>
|
||||
|
||||
#### 端口映射限速
|
||||
<img src="./port-mapping2.png" width="100%"/>
|
||||
|
||||
#### 端口映射绑定多个域名
|
||||
<img src="./port-mapping3.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%"/>
|
||||
|
After Width: | Height: | Size: 175 KiB |
|
After Width: | Height: | Size: 243 KiB |
|
After Width: | Height: | Size: 164 KiB |
|
After Width: | Height: | Size: 143 KiB |
|
After Width: | Height: | Size: 132 KiB |
@@ -31,7 +31,7 @@
|
||||
- 原则上,不允许自行添加第三方依赖库。若确有必要,请先和项目负责人沟通达成一致。
|
||||
- 对现有代码的优化,请在注释中说明原因。
|
||||
- 如果涉及到数据库的变更,则至少需要做到以下绩点:
|
||||
- sqlite、mysql下均测试通过
|
||||
- h2、mysql下均测试通过
|
||||
- 在`./neutrino-proxy-server/src/main/resource/sql`下维护更新对应的表结构sql文件
|
||||
- 对于新增的表,维护必要的初始化数据
|
||||
- 在对应的mysql、sqlite的update目录下,维护SQL变更记录,确保SQL执行测试通过
|
||||
- 在对应的mysql、h2的update目录下,维护SQL变更记录,确保SQL执行测试通过
|
||||
@@ -37,7 +37,7 @@ registry.cn-hangzhou.aliyuncs.com/asgc/neutrino-proxy:1.7.1
|
||||
- 在服务器上新建部署目录:`/work/projects/neutrino-proxy-server`
|
||||
- 将` neutrino-proxy-server.jar`、`neutrino-proxy-admin.zip`上传至服务器部署目录。
|
||||
- 解压`neutrino-proxy-admin.zip`文件
|
||||
- 执行命令`java -jar neutrino-proxy-server.jar`启动服务端完成部署,默认使用sqlite数据库。
|
||||
- 执行命令`java -jar neutrino-proxy-server.jar`启动服务端完成部署,默认使用h2数据库。
|
||||
- 若需要指定自己的mysql数据库,同样的需要在当前目录下新建`app.yml`文件,文件内容同上。执行命令`java -jar neutrino-proxy-server.jar config=app.yml`启动服务端完成部署
|
||||
- 可参照 https://gitee.com/dromara/neutrino-proxy/blob/master/bin/server_start.sh 使用shell脚本启动服务端。
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
# 代理配置
|
||||
- License管理:License是客户端连接服务端的唯一合法凭证。一个License同时只能被一个客户端使用,一个License可以维护多条端口映射
|
||||
- 端口映射:服务端IP+端口 -> 客户端IP+端口的四元组映射(因目前服务端单节点只有一个公网IP,所以不体现出来),是内网穿透的基本单元。
|
||||
- 域名管理:用于统一管理服务器主域名和证书,支持多域名。
|
||||
|
||||
# 系统管理
|
||||
- 用户管理:支持多用户,一个用户可持有多个License。由于项目目前主推个人版,所以暂是没有权限这一套,管理员之外的所有用户都属于游客。对于绝大多数操作,游客仅有只读权限。
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
"codemirror": "5.32.0",
|
||||
"dropzone": "5.2.0",
|
||||
"echarts": "3.8.5",
|
||||
"element-ui": "2.0.8",
|
||||
"element-ui": "^2.15.14",
|
||||
"file-saver": "1.3.3",
|
||||
"font-awesome": "4.7.0",
|
||||
"js-cookie": "2.2.0",
|
||||
@@ -70,7 +70,7 @@
|
||||
"friendly-errors-webpack-plugin": "1.6.1",
|
||||
"html-webpack-plugin": "2.30.1",
|
||||
"node-notifier": "5.1.2",
|
||||
"node-sass": "^4.7.2",
|
||||
"node-sass": "^9.0.0",
|
||||
"optimize-css-assets-webpack-plugin": "3.2.0",
|
||||
"ora": "1.3.0",
|
||||
"portfinder": "1.0.13",
|
||||
|
||||
@@ -7,3 +7,69 @@ export function domainNameBindInfo(query) {
|
||||
params: query
|
||||
})
|
||||
}
|
||||
export function fetchList(query) {
|
||||
return request({
|
||||
url: '/domain/page',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
export function fetchAvailableDomainList(query) {
|
||||
return request({
|
||||
url: '/domain/all',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
export function updateEnableStatus(id, enable, domain) {
|
||||
return request({
|
||||
url: '/domain/update/enable-status',
|
||||
method: 'post',
|
||||
data: {
|
||||
id: id,
|
||||
enable: enable,
|
||||
domain: domain,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export function createDomain(data) {
|
||||
return request({
|
||||
url: '/domain/create',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function updateDomain(data) {
|
||||
return request({
|
||||
url: '/domain/update',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function deleteDomain(id) {
|
||||
return request({
|
||||
url: '/domain/delete',
|
||||
method: 'post',
|
||||
params: {
|
||||
id: id
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export function updateDefaultStatus(id, isDefault) {
|
||||
return request({
|
||||
url: '/domain/update/default-status',
|
||||
method: 'post',
|
||||
data: {
|
||||
id: id,
|
||||
isDefault: isDefault
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -44,3 +44,22 @@ export function updateEnableStatus(id, enable) {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export function portMappingBindSecurityGroup(id, securityGroupId) {
|
||||
return request({
|
||||
url: '/port-mapping/bind/security-group',
|
||||
method: 'post',
|
||||
data: {
|
||||
id: id,
|
||||
securityGroupId: securityGroupId
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export function portMappingUnbindSecurityGroup(id) {
|
||||
return request({
|
||||
url: `/port-mapping/unbind/security-group?id=${id}`,
|
||||
method: 'post'
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,109 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function fetchGroupPage(query) {
|
||||
return request({
|
||||
url: '/security/group/page',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
export function fetchGroupList() {
|
||||
return request({
|
||||
url: '/security/group/list',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
export function fetchGroupDetail(query) {
|
||||
return request({
|
||||
url: '/security/group/detail',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
export function createGroup(data) {
|
||||
return request({
|
||||
url: `/security/group/create`,
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function updateGroup(query) {
|
||||
return request({
|
||||
url: `/security/group/update`,
|
||||
method: 'post',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
export function deleteGroup(data) {
|
||||
return request({
|
||||
url: '/security/group/delete',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function updateGroupEnableStatus(id, enable) {
|
||||
return request({
|
||||
url: '/security/group/update/enable-status',
|
||||
method: 'post',
|
||||
data: {
|
||||
id: id,
|
||||
enable: enable
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export function fetchRulePage(query) {
|
||||
return request({
|
||||
url: '/security/rule/page',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
export function fetchRuleList(query) {
|
||||
return request({
|
||||
url: '/security/rule/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
export function createRule(data) {
|
||||
return request({
|
||||
url: `/security/rule/create`,
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function updateRule(data) {
|
||||
return request({
|
||||
url: `/security/rule/update`,
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
export function deleteRule(query) {
|
||||
return request({
|
||||
url: '/security/rule/delete',
|
||||
method: 'post',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
export function updateRuleEnableStatus(id, enable) {
|
||||
return request({
|
||||
url: '/security/rule/update/enable-status',
|
||||
method: 'post',
|
||||
data: {
|
||||
id: id,
|
||||
enable: enable
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -50,7 +50,7 @@
|
||||
:hide-on-single-pageInfo="false"
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange"
|
||||
:current-pageInfo="PaginationData.currentPage"
|
||||
:current-page="PaginationData.currentPage"
|
||||
:pageInfo-sizes="[10, 20, 50, 100]"
|
||||
:pageInfo-size="PaginationData.pageSize"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
<template>
|
||||
<el-popover
|
||||
placement="top"
|
||||
:width="width"
|
||||
v-model="visible">
|
||||
<p class="popper-p-css"><i class="el-icon-warning" style="color: #e6a23c"/>{{title}}</p>
|
||||
<div style="text-align: center; margin: 0">
|
||||
<el-button size="mini" @click="handleCancelClick">{{cancelText}}</el-button>
|
||||
<el-button type="primary" size="mini" @click="handleCommitClick">{{okText}}</el-button>
|
||||
</div>
|
||||
<el-link slot="reference" :underline="false" :type="type" :size="size" :icon="icon" :disabled="disabled" style="text-align: left; font-size: 12px">{{buttonText}}</el-link>
|
||||
</el-popover>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
export default {
|
||||
name: 'deleteLink',
|
||||
props: {
|
||||
width: {
|
||||
type: Number,
|
||||
default: 160
|
||||
},
|
||||
buttonText: {
|
||||
type: String,
|
||||
default: '删除'
|
||||
},
|
||||
type: {
|
||||
type: String,
|
||||
default: 'danger'
|
||||
},
|
||||
size: {
|
||||
type: String,
|
||||
default: 'mini'
|
||||
},
|
||||
icon: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
title: {
|
||||
type: String,
|
||||
default: '确定删除吗?'
|
||||
},
|
||||
okText: {
|
||||
type: String,
|
||||
default: '确定'
|
||||
},
|
||||
cancelText: {
|
||||
type: String,
|
||||
default: '取消'
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
visible: false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleCancelClick() {
|
||||
this.visible = false
|
||||
this.$emit('handleCancelClick')
|
||||
},
|
||||
handleCommitClick() {
|
||||
this.visible = false
|
||||
this.$emit('handleCommitClick')
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||
.popper-p-css{
|
||||
margin-top: 0px !important;
|
||||
margin-bottom: 5px !important;
|
||||
.el-icon-warning{
|
||||
margin-right: 5px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -48,11 +48,14 @@ export default {
|
||||
user: '用户管理',
|
||||
system: '系统管理',
|
||||
portPool: '端口池管理',
|
||||
securityGroup: '安全组管理',
|
||||
securityRule: '安全规则管理',
|
||||
portGroup: '端口分组管理',
|
||||
protocal: '协议管理',
|
||||
proxy: '代理配置',
|
||||
license: 'License管理',
|
||||
portMapping: '端口映射',
|
||||
domainManagement: '域名管理',
|
||||
jobManager: '调度管理',
|
||||
jobLog: '调度日志',
|
||||
log: '日志管理',
|
||||
@@ -126,8 +129,10 @@ export default {
|
||||
deleteBatch: '批量删除',
|
||||
cancel: '取 消',
|
||||
confirm: '确 定',
|
||||
domain: '域名',
|
||||
userId: '用户ID',
|
||||
userName: '用户名',
|
||||
name: '名称',
|
||||
group: '分组',
|
||||
groupName: '分组名称',
|
||||
groupPossessor: '分组所属',
|
||||
@@ -169,7 +174,19 @@ export default {
|
||||
totalFlow: '总流量',
|
||||
protocalName: '协议',
|
||||
supportStatus: '支持状态',
|
||||
domainName: '域名'
|
||||
domainName: '域名',
|
||||
securityGroup: '安全组',
|
||||
defaultPassType: '默认放行类型',
|
||||
ruleName: '规则名称',
|
||||
rule: '规则内容',
|
||||
passType: '放行类型',
|
||||
priority: '优先级',
|
||||
ruleConfig: '配置规则',
|
||||
portMappingBindSecurityGroup: '绑定安全组',
|
||||
securityGroupBindPortMapping: '端口映射绑定',
|
||||
bind: '绑定',
|
||||
unbind: '解绑',
|
||||
bindOtherSecurityGroup: '已绑定其他安全组'
|
||||
},
|
||||
button: {
|
||||
lookOver: '查看'
|
||||
|
||||
@@ -61,7 +61,8 @@ export const asyncRouterMap = [
|
||||
},
|
||||
children: [
|
||||
{ path: 'license', component: _import('proxy/license'), name: 'license', meta: { title: 'license' }},
|
||||
{ path: 'portMapping', component: _import('proxy/portMapping'), name: 'portMapping', meta: { title: 'portMapping' }}
|
||||
{ path: 'portMapping', component: _import('proxy/portMapping'), name: 'portMapping', meta: { title: 'portMapping' }},
|
||||
{ path: 'domainManagement', component: _import('proxy/domain'), name: 'domainManagement', meta: { title: 'domainManagement' }}
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -77,6 +78,8 @@ export const asyncRouterMap = [
|
||||
{ path: 'user', component: _import('system/user'), name: 'user', meta: { title: 'user' }},
|
||||
{ path: 'portGroup', component: _import('system/portGroup'), name: 'portGroup', meta: { title: 'portGroup' }},
|
||||
{ path: 'portPool', component: _import('system/portPool'), name: 'portPool', meta: { title: 'portPool' }},
|
||||
{ path: 'securityGroup', component: _import('system/securityGroup'), name: 'securityGroup', meta: { title: 'securityGroup' }},
|
||||
{ path: 'securityRule', component: _import('system/securityRule'), name: 'securityRule', meta: { title: 'securityRule' }, hidden: true },
|
||||
{ path: 'protocal', component: _import('system/protocal'), name: 'protocal', meta: { title: 'protocal' }},
|
||||
{ path: 'jobManager', component: _import('system/jobManager'), name: 'jobManager', meta: { title: 'jobManager' }}
|
||||
]
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="pagination-container">
|
||||
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-pageInfo.sync="listQuery.current"
|
||||
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page.sync="listQuery.current"
|
||||
:pageInfo-sizes="[10,20,30, 50]" :pageInfo-size="listQuery.size" layout="total, sizes, prev, pager, next, jumper" :total="total">
|
||||
</el-pagination>
|
||||
</div>
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
</el-table-column>-->
|
||||
</el-table>
|
||||
<div class="pagination-container">
|
||||
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-pageInfo.sync="listQuery.current"
|
||||
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page.sync="listQuery.current"
|
||||
:pageInfo-sizes="[10,20,30, 50]" :pageInfo-size="listQuery.size" layout="total, sizes, prev, pager, next, jumper" :total="total">
|
||||
</el-pagination>
|
||||
</div>
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="pagination-container">
|
||||
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-pageInfo.sync="listQuery.current"
|
||||
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page.sync="listQuery.current"
|
||||
:pageInfo-sizes="[10,20,30, 50]" :pageInfo-size="listQuery.size" layout="total, sizes, prev, pager, next, jumper" :total="total">
|
||||
</el-pagination>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,467 @@
|
||||
<template>
|
||||
<div class="app-container calendar-list-container">
|
||||
<div class="filter-container" style="display:flex">
|
||||
<el-select v-model="listQuery.userId" placeholder="请选择用户" filterable clearable style="margin-right:10px;width: 120px;">
|
||||
<el-option v-for="item in userList" :key="item.id" :label="item.name" :value="item.id"/>
|
||||
</el-select>
|
||||
<el-select v-model="listQuery.enable" placeholder="请选择启用状态" clearable style="width:145px;margin-right:10px">
|
||||
<el-option v-for="item in selectObj.statusOptions" :key="item.value" :label="item.label" :value="item.value"/>
|
||||
</el-select>
|
||||
<el-button class="filter-item" type="primary" v-waves icon="el-icon-search" @click="handleFilter">{{$t('table.search')}}</el-button>
|
||||
<el-button class="filter-item" style="margin-left: 10px;" @click="handleCreate" type="primary" icon="el-icon-edit">{{$t('table.add')}}</el-button>
|
||||
</div>
|
||||
|
||||
<el-table :key='tableKey' :data="list" v-loading="listLoading" element-loading-text="给我一点时间" border fit highlight-current-row
|
||||
style="width: 100%">
|
||||
<el-table-column align="center" :label="$t('table.id')" width="50">
|
||||
<template slot-scope="scope">
|
||||
<span>{{scope.row.id}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" :label="$t('table.userName')" width="150">
|
||||
<template slot-scope="scope">
|
||||
<span>{{scope.row.userName}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" :label="$t('table.domain')" width="300">
|
||||
<template slot-scope="scope">
|
||||
<span>{{scope.row.domain}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column width="150px" align="center" :label="$t('table.createTime')">
|
||||
<template slot-scope="scope">
|
||||
<span>{{scope.row.createTime | parseTime('{y}-{m}-{d} {h}:{i}')}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column width="150px" align="center" :label="$t('table.updateTime')">
|
||||
<template slot-scope="scope">
|
||||
<span>{{scope.row.updateTime | parseTime('{y}-{m}-{d} {h}:{i}')}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column class-name="status-col" :label="$t('SSL证书状态')" width="110">
|
||||
<template slot-scope="scope">
|
||||
<el-tag :type="scope.row.sslStatus | statusFilter">{{scope.row.sslStatus | sslStatusName}}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column class-name="status-col" :label="$t('默认域名')" width="100">
|
||||
<template slot-scope="scope">
|
||||
<el-tag :type="scope.row.isDefault | statusFilter">{{scope.row.isDefault | httpStatusName}}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column class-name="status-col" :label="$t('强制HTTPS')" width="100">
|
||||
<template slot-scope="scope">
|
||||
<el-tag :type="scope.row.forceHttps | statusFilter">{{scope.row.forceHttps | httpStatusName}}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column class-name="status-col" :label="$t('table.enableStatus')" width="100">
|
||||
<template slot-scope="scope">
|
||||
<el-tag :type="scope.row.enable | statusFilter">{{scope.row.enable | statusName}}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" :label="$t('table.actions')" width="330" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button v-if="scope.row.isDefault !='1' && scope.row.enable == '1'" size="mini" type="primary" @click="handleDefaultStatus(scope.row)">{{$t('默认')}}</el-button>
|
||||
|
||||
<el-button type="primary" size="mini" @click="handleUpdate(scope.row)">{{$t('table.edit')}}</el-button>
|
||||
<el-button v-if="scope.row.enable =='1'" size="mini" type="danger" @click="handleModifyStatus(scope.row,2)">{{$t('table.disable')}}</el-button>
|
||||
<el-button v-if="scope.row.enable =='2'" size="mini" type="success" @click="handleModifyStatus(scope.row,1)">{{$t('table.enable')}}</el-button>
|
||||
<!-- <el-button size="mini" type="danger" @click="handleDelete(scope.row,'deleted')">{{$t('table.delete')}}</el-button>-->
|
||||
<ButtonPopover @handleCommitClick="handleDelete2(scope.row)" style="margin-left: 10px"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<div class="pagination-container">
|
||||
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page.sync="listQuery.current"
|
||||
:pageInfo-sizes="[10,20,30, 50]" :pageInfo-size="listQuery.size" layout="total, sizes, prev, pager, next, jumper" :total="total">
|
||||
</el-pagination>
|
||||
</div>
|
||||
|
||||
<el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible">
|
||||
<el-form :rules="rules" ref="dataForm" :model="temp" label-position="left" label-width="120px" style='width: 400px; margin-left:50px;'>
|
||||
<el-form-item :label="$t('主域名')" prop="domain">
|
||||
<el-input v-model="temp.domain"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('强制HTTPS')" prop="userId">
|
||||
<el-select style="width: 280px" class="filter-item" v-model="temp.forceHttps" placeholder="请选择">
|
||||
<el-option label="开启" :value="1"></el-option>
|
||||
<el-option label="关闭" :value="2"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('JKS文件上传')" prop="file">
|
||||
<el-upload
|
||||
ref="upload"
|
||||
class="upload-demo"
|
||||
action=""
|
||||
:http-request="httpRequest"
|
||||
:file-list="this.fileList"
|
||||
:auto-upload="false"
|
||||
:multiple="false"
|
||||
accept=".jks"
|
||||
:limit="1"
|
||||
:on-change="handleChange"
|
||||
>
|
||||
<el-button slot="trigger" size="small" type="primary">选择文件</el-button>
|
||||
</el-upload>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="passWordInputStatus" :label="$t('JKS密码')" prop="filePassword">
|
||||
<el-input type="password" v-model="temp.keyStorePassword"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogFormVisible = false">{{$t('table.cancel')}}</el-button>
|
||||
<el-button v-if="dialogStatus=='create'" type="primary" @click="createData">{{$t('table.confirm')}}</el-button>
|
||||
<el-button v-else type="primary" @click="updateData">{{$t('table.confirm')}}</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<!-- <el-dialog title="Reading statistics" :visible.sync="dialogPvVisible">-->
|
||||
<!-- <el-table :data="pvData" border fit highlight-current-row style="width: 100%">-->
|
||||
<!-- <el-table-column prop="key" label="Channel"> </el-table-column>-->
|
||||
<!-- <el-table-column prop="pv" label="Pv"> </el-table-column>-->
|
||||
<!-- </el-table>-->
|
||||
<!-- <span slot="footer" class="dialog-footer">-->
|
||||
<!-- <el-button type="primary" @click="dialogPvVisible = false">{{$t('table.confirm')}}</el-button>-->
|
||||
<!-- </span>-->
|
||||
<!-- </el-dialog>-->
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { fetchList, updateEnableStatus, createDomain, updateDomain, deleteDomain, updateDefaultStatus } from '@/api/domain'
|
||||
import { userList } from '@/api/user'
|
||||
import waves from '@/directive/waves' // 水波纹指令
|
||||
import { parseTime } from '@/utils'
|
||||
import ButtonPopover from '../../components/Button/buttonPopover'
|
||||
|
||||
const calendarTypeOptions = [
|
||||
{ key: 'CN', display_name: 'China' },
|
||||
{ key: 'US', display_name: 'USA' },
|
||||
{ key: 'JP', display_name: 'Japan' },
|
||||
{ key: 'EU', display_name: 'Eurozone' }
|
||||
]
|
||||
|
||||
// arr to obj ,such as { CN : "China", US : "USA" }
|
||||
const calendarTypeKeyValue = calendarTypeOptions.reduce((acc, cur) => {
|
||||
acc[cur.key] = cur.display_name
|
||||
return acc
|
||||
}, {})
|
||||
|
||||
export default {
|
||||
name: 'complexTable',
|
||||
directives: {
|
||||
waves
|
||||
},
|
||||
components: {
|
||||
ButtonPopover
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
fileList: [],
|
||||
tableKey: 0,
|
||||
list: null,
|
||||
total: null,
|
||||
listLoading: true,
|
||||
listQuery: {
|
||||
current: 1,
|
||||
size: 10,
|
||||
enable: undefined,
|
||||
userId: null
|
||||
},
|
||||
importanceOptions: [1, 2, 3],
|
||||
calendarTypeOptions,
|
||||
userList: [],
|
||||
sortOptions: [{ label: 'ID Ascending', key: '+id' }, { label: 'ID Descending', key: '-id' }],
|
||||
statusOptions: ['published', 'draft', 'deleted'],
|
||||
showReviewer: false,
|
||||
temp: {
|
||||
id: undefined,
|
||||
importance: 1,
|
||||
remark: '',
|
||||
timestamp: new Date(),
|
||||
title: '',
|
||||
type: '',
|
||||
status: 'published',
|
||||
domain: '',
|
||||
jks: undefined,
|
||||
keyStorePassword: '',
|
||||
forceHttps: ''
|
||||
},
|
||||
dialogFormVisible: false,
|
||||
dialogStatus: '',
|
||||
passWordInputStatus: false,
|
||||
textMap: {
|
||||
update: '编辑',
|
||||
create: '新建'
|
||||
},
|
||||
dialogPvVisible: false,
|
||||
pvData: [],
|
||||
rules: {
|
||||
domain: [
|
||||
{ required: true, message: '主域名不能为空', trigger: 'blur' },
|
||||
{ validator: this.validateDomain, trigger: 'blur' }
|
||||
],
|
||||
file: [
|
||||
{ required: false, message: '请选择文件', trigger: 'blur' }
|
||||
],
|
||||
filePassword: [
|
||||
{ required: false, message: '密码不能为空', trigger: 'blur' }
|
||||
]// TODO required改为true后,密码不为空,仍不能通过
|
||||
},
|
||||
downloadLoading: false,
|
||||
selectObj: {
|
||||
statusOptions: [{ label: '启用', value: 1 }, { label: '禁用', value: 2 }],
|
||||
onlineOptions: [{ label: '在线', value: 1 }, { label: '离线', value: 2 }]
|
||||
}
|
||||
}
|
||||
},
|
||||
filters: {
|
||||
statusName(status) {
|
||||
const statusMap = {
|
||||
1: '启用',
|
||||
2: '禁用'
|
||||
}
|
||||
return statusMap[status]
|
||||
},
|
||||
sslStatusName(status) {
|
||||
const statusMap = {
|
||||
1: '已上传',
|
||||
2: '未上传',
|
||||
3: '已验证'
|
||||
}
|
||||
return statusMap[status]
|
||||
},
|
||||
httpStatusName(status) {
|
||||
const statusMap = {
|
||||
1: '开启',
|
||||
2: '关闭'
|
||||
}
|
||||
return statusMap[status]
|
||||
},
|
||||
statusFilter(status) {
|
||||
const statusMap = {
|
||||
1: 'success',
|
||||
2: 'danger'
|
||||
}
|
||||
return statusMap[status]
|
||||
},
|
||||
typeFilter(type) {
|
||||
return calendarTypeKeyValue[type]
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getDataList()
|
||||
},
|
||||
methods: {
|
||||
httpRequest(param) {
|
||||
this.temp.jks = param.file
|
||||
},
|
||||
validateDomain(rule, value, callback) {
|
||||
// 匹配多级域名,例如:sub.example.com, sub.sub.example.com
|
||||
const domainPattern = /^(?:[A-Za-z0-9](?:[A-Za-z0-9-]{0,61}[A-Za-z0-9])?\.)+[A-Za-z]{2,6}$/
|
||||
|
||||
if (!value) {
|
||||
callback(new Error('主域名不能为空'));
|
||||
} else if (!domainPattern.test(value)) {
|
||||
callback(new Error('请输入正确的域名格式'));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
},
|
||||
handleChange(file) {
|
||||
this.fileList = [file]
|
||||
this.passWordInputStatus = true
|
||||
},
|
||||
getList() {
|
||||
this.listLoading = true
|
||||
fetchList(this.listQuery).then(response => {
|
||||
this.list = response.data.data.records
|
||||
this.total = response.data.data.total
|
||||
this.listLoading = false
|
||||
})
|
||||
},
|
||||
getUserList() {
|
||||
userList().then(response => {
|
||||
this.userList = response.data.data
|
||||
})
|
||||
},
|
||||
getDataList() {
|
||||
const loginName = this.$store.state.user.loginName
|
||||
userList().then(response => {
|
||||
this.userList = response.data.data
|
||||
const curUser = this.userList.find((val) => val.loginName === loginName)
|
||||
if (curUser) {
|
||||
this.listQuery.userId = curUser.id
|
||||
}
|
||||
this.getList()
|
||||
})
|
||||
},
|
||||
handleFilter() {
|
||||
this.listQuery.current = 1
|
||||
this.getList()
|
||||
},
|
||||
handleSizeChange(val) {
|
||||
this.listQuery.size = val
|
||||
this.getList()
|
||||
},
|
||||
handleCurrentChange(val) {
|
||||
this.listQuery.current = val
|
||||
this.getList()
|
||||
},
|
||||
handleDefaultStatus(row) {
|
||||
updateDefaultStatus(row.id, 1).then(response => {
|
||||
if (response.data.code === 0) {
|
||||
this.$notify({
|
||||
title: '成功',
|
||||
message: '操作成功',
|
||||
type: 'success'
|
||||
})
|
||||
this.getList()
|
||||
}
|
||||
this.getList()
|
||||
})
|
||||
},
|
||||
handleModifyStatus(row, enable) {
|
||||
console.log('route', this.$route)
|
||||
updateEnableStatus(row.id, enable, row.domain).then(response => {
|
||||
if (response.data.data.code === 0) {
|
||||
this.$message({
|
||||
message: '操作成功',
|
||||
type: 'success'
|
||||
})
|
||||
}
|
||||
this.getList()
|
||||
})
|
||||
},
|
||||
resetTemp() {
|
||||
this.passWordInputStatus = false
|
||||
this.fileList = []
|
||||
this.temp = {
|
||||
domain: undefined,
|
||||
jks: undefined,
|
||||
keyStorePassword: undefined,
|
||||
forceHttps: undefined
|
||||
}
|
||||
},
|
||||
handleCreate() {
|
||||
this.resetTemp()
|
||||
this.dialogStatus = 'create'
|
||||
this.dialogFormVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].clearValidate()
|
||||
})
|
||||
},
|
||||
createData() {
|
||||
this.$refs['dataForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
this.$refs.upload.submit()
|
||||
const formData = this.objectToFormData(this.temp)
|
||||
createDomain(formData).then(response => {
|
||||
if (response.data.code === 0) {
|
||||
this.dialogFormVisible = false
|
||||
this.$notify({
|
||||
title: '成功',
|
||||
message: '创建成功',
|
||||
type: 'success',
|
||||
duration: 2000
|
||||
})
|
||||
this.getList()
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
handleUpdate(row) {
|
||||
this.resetTemp()
|
||||
this.temp = Object.assign({}, row) // copy obj
|
||||
this.dialogStatus = 'update'
|
||||
this.dialogFormVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].clearValidate()
|
||||
})
|
||||
},
|
||||
updateData() {
|
||||
this.$refs['dataForm'].validate((valid) => {
|
||||
console.log(this.temp)
|
||||
if (valid) {
|
||||
this.$refs.upload.submit()
|
||||
const tempData = Object.assign({}, this.temp)
|
||||
const formData = this.objectToFormData(tempData)
|
||||
updateDomain(formData).then(response => {
|
||||
if (response.data.code === 0) {
|
||||
this.dialogFormVisible = false
|
||||
this.$notify({
|
||||
title: '成功',
|
||||
message: '创建成功',
|
||||
type: 'success',
|
||||
duration: 2000
|
||||
})
|
||||
this.getList()
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
objectToFormData(obj) {
|
||||
const formData = new FormData()
|
||||
Object.keys(obj).forEach(key => {
|
||||
if (obj[key] !== undefined) {
|
||||
formData.append(key, obj[key])
|
||||
}
|
||||
})
|
||||
return formData
|
||||
},
|
||||
handleDelete(row) {
|
||||
this.$confirm('确定要删除吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
deleteDomain(row.id).then(response => {
|
||||
if (response.data.code === 0) {
|
||||
this.$notify({
|
||||
title: '成功',
|
||||
message: '删除成功',
|
||||
type: 'success',
|
||||
duration: 2000
|
||||
})
|
||||
this.getList()
|
||||
}
|
||||
})
|
||||
}).catch(() => {})
|
||||
},
|
||||
handleDelete2(row) {
|
||||
deleteDomain(row.id).then(response => {
|
||||
if (response.data.code === 0) {
|
||||
this.$notify({
|
||||
title: '成功',
|
||||
message: '删除成功',
|
||||
type: 'success',
|
||||
duration: 2000
|
||||
})
|
||||
this.getList()
|
||||
}
|
||||
})
|
||||
},
|
||||
handleDownload() {
|
||||
this.downloadLoading = true
|
||||
import('@/vendor/Export2Excel').then(excel => {
|
||||
const tHeader = ['timestamp', 'title', 'type', 'importance', 'status']
|
||||
const filterVal = ['timestamp', 'title', 'type', 'importance', 'status']
|
||||
const data = this.formatJson(filterVal, this.list)
|
||||
excel.export_json_to_excel(tHeader, data, 'table-list')
|
||||
this.downloadLoading = false
|
||||
})
|
||||
},
|
||||
formatJson(filterVal, jsonData) {
|
||||
return jsonData.map(v => filterVal.map(j => {
|
||||
if (j === 'timestamp') {
|
||||
return parseTime(v[j])
|
||||
} else {
|
||||
return v[j]
|
||||
}
|
||||
}))
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -1,13 +1,13 @@
|
||||
<template>
|
||||
<div class="app-container calendar-list-container">
|
||||
<div class="filter-container">
|
||||
<el-select v-model="listQuery.userId" placeholder="请选择用户" filterable clearable>
|
||||
<el-select v-model="listQuery.userId" placeholder="请选择用户" filterable clearable style="margin-right:10px;width: 120px;">
|
||||
<el-option v-for="item in userList" :key="item.id" :label="item.name" :value="item.id"/>
|
||||
</el-select>
|
||||
<el-select v-model="listQuery.isOnline" placeholder="请选择在线状态" clearable>
|
||||
<el-select v-model="listQuery.isOnline" placeholder="请选择在线状态" clearable style="width:145px;margin-right:10px">
|
||||
<el-option v-for="item in selectObj.onlineOptions" :key="item.value" :label="item.label" :value="item.value"/>
|
||||
</el-select>
|
||||
<el-select v-model="listQuery.enable" placeholder="请选择启用状态" clearable>
|
||||
<el-select v-model="listQuery.enable" placeholder="请选择启用状态" clearable style="width:145px;margin-right:10px">
|
||||
<el-option v-for="item in selectObj.statusOptions" :key="item.value" :label="item.label" :value="item.value"/>
|
||||
</el-select>
|
||||
<el-button class="filter-item" type="primary" v-waves icon="el-icon-search" @click="handleFilter">{{$t('table.search')}}</el-button>
|
||||
@@ -36,6 +36,11 @@
|
||||
<span>{{scope.row.key}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" :label="$t('限速')" width="100">
|
||||
<template slot-scope="scope">
|
||||
<span>{{scope.row.upLimitRate ? scope.row.upLimitRate : '--'}} / {{scope.row.downLimitRate ? scope.row.downLimitRate : '--'}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column width="150px" align="center" :label="$t('table.createTime')">
|
||||
<template slot-scope="scope">
|
||||
<span>{{scope.row.createTime | parseTime('{y}-{m}-{d} {h}:{i}')}}</span>
|
||||
@@ -69,7 +74,7 @@
|
||||
</el-table>
|
||||
|
||||
<div class="pagination-container">
|
||||
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-pageInfo.sync="listQuery.current"
|
||||
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page.sync="listQuery.current"
|
||||
:pageInfo-sizes="[10,20,30, 50]" :pageInfo-size="listQuery.size" layout="total, sizes, prev, pager, next, jumper" :total="total">
|
||||
</el-pagination>
|
||||
</div>
|
||||
@@ -85,6 +90,12 @@
|
||||
<el-form-item :label="$t('License名称')" prop="name">
|
||||
<el-input v-model="temp.name"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('上传限速')" prop="upLimitRate">
|
||||
<el-input v-model="temp.upLimitRate" placeholder="如:10240B、500K、1M"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('下载限速')" prop="downLimitRate">
|
||||
<el-input v-model="temp.downLimitRate" placeholder="如:10240B、500K、1M"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogFormVisible = false">{{$t('table.cancel')}}</el-button>
|
||||
|
||||
@@ -39,19 +39,30 @@
|
||||
<span>{{ scope.row.userName }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" :label="$t('table.licenseName')" width="130">
|
||||
<el-table-column align="center" :label="$t('table.licenseName')" width="120">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ scope.row.licenseName }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" :label="$t('table.protocalName')" width="100">
|
||||
<el-table-column align="center" :label="$t('table.protocalName')" width="80">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ scope.row.protocal }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" :label="$t('table.domainName')" width="200">
|
||||
<el-table-column align="center" :label="$t('table.domainName')" width="190">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ scope.row.domain }}</span>
|
||||
<el-dropdown v-if="scope.row.allFullDomainList" @command="handleCopy">
|
||||
<span class="el-dropdown-link">
|
||||
{{ scope.row.allFullDomainList[0] }}<i v-if="scope.row.allFullDomainList.length > 1" class="el-icon-arrow-down el-icon--right"></i>
|
||||
</span>
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item v-for="(domain, index) in scope.row.allFullDomainList" :command="domain">{{ domain }}</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
<div v-if="!scope.row.allFullDomainList">-</div>
|
||||
<!-- <div v-if="scope.row.allFullDomainList" v-for="(domain, index) in scope.row.allFullDomainList" :key="index">-->
|
||||
<!-- <span>{{ domain }}</span>-->
|
||||
<!-- </div>-->
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" :label="$t('table.serverPort')" width="80">
|
||||
@@ -64,17 +75,22 @@
|
||||
<span>{{ scope.row.clientIp }}:{{ scope.row.clientPort }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" :label="$t('限速')" width="100">
|
||||
<template slot-scope="scope">
|
||||
<span>{{scope.row.upLimitRate ? scope.row.upLimitRate : '--'}} / {{scope.row.downLimitRate ? scope.row.downLimitRate : '--'}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" :label="$t('table.desc')" width="120">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ scope.row.description }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column width="150px" align="center" :label="$t('table.createTime')">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ scope.row.createTime | parseTime('{y}-{m}-{d} {h}:{i}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column width="150px" align="center" :label="$t('table.createTime')">-->
|
||||
<!-- <template slot-scope="scope">-->
|
||||
<!-- <span>{{ scope.row.createTime | parseTime('{y}-{m}-{d} {h}:{i}') }}</span>-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-table-column>-->
|
||||
<el-table-column width="150px" align="center" :label="$t('table.updateTime')">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ scope.row.updateTime | parseTime('{y}-{m}-{d} {h}:{i}') }}</span>
|
||||
@@ -99,8 +115,7 @@
|
||||
<template slot-scope="scope">
|
||||
<el-button type="primary" size="mini" @click="handleUpdate(scope.row)">{{ $t('table.edit') }}</el-button>
|
||||
<el-button v-if="scope.row.enable == '1'" size="mini" type="danger" @click="handleModifyStatus(scope.row, 2)">{{$t('table.disable')}}</el-button>
|
||||
<el-button v-if="scope.row.enable == '2'" size="mini" type="success"
|
||||
@click="handleModifyStatus(scope.row, 1)">{{ $t('table.enable') }}</el-button>
|
||||
<el-button v-if="scope.row.enable == '2'" size="mini" type="success" @click="handleModifyStatus(scope.row, 1)">{{ $t('table.enable') }}</el-button>
|
||||
<!-- <el-button size="mini" type="danger" @click="handleDelete(scope.row,'deleted')">{{$t('table.delete')}}</el-button>-->
|
||||
<ButtonPopover @handleCommitClick="handleDelete2(scope.row)" style="margin-left: 10px" />
|
||||
|
||||
@@ -110,76 +125,112 @@
|
||||
|
||||
<div class="pagination-container">
|
||||
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange"
|
||||
:current-pageInfo.sync="listQuery.current" :pageInfo-sizes="[10, 20, 30, 50]" :pageInfo-size="listQuery.size"
|
||||
:current-page.sync="listQuery.current" :pageInfo-sizes="[10, 20, 30, 50]" :pageInfo-size="listQuery.size"
|
||||
layout="total, sizes, prev, pager, next, jumper" :total="total">
|
||||
</el-pagination>
|
||||
</div>
|
||||
|
||||
<el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible">
|
||||
<el-form :rules="rules" ref="dataForm" :model="temp" label-position="left" label-width="120px"
|
||||
style='width: 400px; margin-left:50px;'>
|
||||
<!-- <el-form-item :label="$t('License')" prop="licenseId">-->
|
||||
<!-- <el-select style="width: 280px;" class="filter-item" v-model="temp.licenseId" placeholder="请选择" :disabled="dialogStatus=='update'">-->
|
||||
<!-- <el-option v-for="item in licenseList" :key="item.id" :label="item.name" :value="item.id">-->
|
||||
<!-- </el-option>-->
|
||||
<!-- </el-select>-->
|
||||
<!-- </el-form-item>-->
|
||||
|
||||
<el-form-item :label="$t('License')" prop="licenseId">
|
||||
<DropdownTable v-model="temp.licenseId" :name.sync="temp.licenseName" :tableData="licenseAuthList"
|
||||
@selectedData="selectedFeeItem" placeholder="请选择" :width="280" :disabled="dialogStatus === 'update'" />
|
||||
<!-- <DropdownTable
|
||||
:columns="countryColumns"
|
||||
:data="licenseList"
|
||||
v-model="temp.licenseId"
|
||||
:value="temp.licenseName"
|
||||
@rowClick="selectedFeeItem"
|
||||
disabled
|
||||
:disabled="dialogStatus==='update'"
|
||||
style="width: 280px"
|
||||
/>-->
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('协议')" prop="protocal">
|
||||
<el-select style="width: 280px;" class="filter-item" v-model="temp.protocal" placeholder="请选择">
|
||||
<el-option v-for="item in protocalList" :key="item.name" :label="item.name" :value="item.name"
|
||||
:disabled="!item.enable">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('服务端端口')" prop="serverPort" >
|
||||
<load-select style="width: 280px;" class="filter-item"
|
||||
v-model="temp.serverPort"
|
||||
:data="serverPortList"
|
||||
:page="loadServerPortQuery.page"
|
||||
:hasMore="more"
|
||||
:clearable="false"
|
||||
:dictLabel="'port'"
|
||||
:dictValue="'port'"
|
||||
:request="loadServerPort"/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('客户端IP')" prop="clientIp">
|
||||
<el-input v-model="temp.clientIp"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('客户端端口')" prop="clientPort">
|
||||
<el-input v-model="temp.clientPort"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('域名')" prop="subdomain" v-if="(temp.protocal === 'HTTP' || temp.protocal === 'HTTP(S)') && domainName && domainName != ''">
|
||||
<el-input v-model="temp.subdomain">
|
||||
<template slot="append">.{{ domainName }}</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('响应数量')" prop="proxyResponses" v-if="temp.protocal === 'UDP'">
|
||||
<el-input v-model="temp.proxyResponses"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('超时时间')" prop="proxyTimeoutMs" v-if="temp.protocal === 'UDP'">
|
||||
<el-input v-model="temp.proxyTimeoutMs">
|
||||
<template slot="append">毫秒</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('描述')" prop="description">
|
||||
<el-input v-model="temp.description"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible" width="800px">
|
||||
<div style="height: 500px; overflow-y: auto;">
|
||||
<el-form :rules="rules" ref="dataForm" :model="temp" label-position="right" label-width="150px" inline>
|
||||
<!-- <el-form-item :label="$t('License')" prop="licenseId">-->
|
||||
<!-- <el-select style="width: 187px;" class="filter-item" v-model="temp.licenseId" placeholder="请选择" :disabled="dialogStatus=='update'">-->
|
||||
<!-- <el-option v-for="item in licenseList" :key="item.id" :label="item.name" :value="item.id">-->
|
||||
<!-- </el-option>-->
|
||||
<!-- </el-select>-->
|
||||
<!-- </el-form-item>-->
|
||||
<el-form-item :label="$t('License')" prop="licenseId">
|
||||
<DropdownTable v-model="temp.licenseId" :name.sync="temp.licenseName" :tableData="licenseAuthList"
|
||||
@selectedData="selectedFeeItem" placeholder="请选择" :width="280" :disabled="dialogStatus === 'update'" />
|
||||
<!-- <DropdownTable
|
||||
:columns="countryColumns"
|
||||
:data="licenseList"
|
||||
v-model="temp.licenseId"
|
||||
:value="temp.licenseName"
|
||||
@rowClick="selectedFeeItem"
|
||||
disabled
|
||||
:disabled="dialogStatus==='update'"
|
||||
style="width: 280px"
|
||||
/>-->
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('协议')" prop="protocal">
|
||||
<el-select style="width: 187px;" class="filter-item" v-model="temp.protocal" placeholder="请选择">
|
||||
<el-option v-for="item in protocalList" :key="item.name" :label="item.name" :value="item.name"
|
||||
:disabled="!item.enable">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('服务端端口')" prop="serverPort" >
|
||||
<load-select style="width: 187px;" class="filter-item"
|
||||
v-model="temp.serverPort"
|
||||
:data="serverPortList"
|
||||
:page="loadServerPortQuery.page"
|
||||
:hasMore="more"
|
||||
:clearable="false"
|
||||
:dictLabel="'port'"
|
||||
:dictValue="'port'"
|
||||
:request="loadServerPort"/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('客户端IP')" prop="clientIp">
|
||||
<el-input v-model="temp.clientIp"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('客户端端口')" prop="clientPort">
|
||||
<el-input v-model="temp.clientPort"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('响应数量')" prop="proxyResponses" v-if="temp.protocal === 'UDP'">
|
||||
<el-input v-model="temp.proxyResponses"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('超时时间')" prop="proxyTimeoutMs" v-if="temp.protocal === 'UDP'">
|
||||
<el-input v-model="temp.proxyTimeoutMs">
|
||||
<template slot="append">毫秒</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('table.securityGroup')" prop="securityGroup">
|
||||
<el-select style="width: 187px;" class="filter-item" v-model="temp.securityGroupId" clearable >
|
||||
<el-option v-for="item in securityGroupList" :key="item.id" :label="item.name" :value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('上传限速')" prop="upLimitRate">
|
||||
<el-input v-model="temp.upLimitRate" placeholder="如:10240B、500K、1M"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('下载限速')" prop="downLimitRate">
|
||||
<el-input v-model="temp.downLimitRate" placeholder="如:10240B、500K、1M"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('描述')" prop="description">
|
||||
<el-input v-model="temp.description" style="width: 540px;"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('域名')" prop="domainMappings" v-if="(temp.protocal === 'HTTP' || temp.protocal === 'HTTP(S)') && domainList != null && domainList.length > 0" >
|
||||
<div class="my-tag">
|
||||
<el-tag
|
||||
:key="index"
|
||||
v-for="(domain, index) in temp.domainMappings"
|
||||
closable
|
||||
:disable-transitions="false"
|
||||
@close="removeDomainMapping(index)"
|
||||
class="my-tag_item"
|
||||
>
|
||||
<el-input v-model="domain.subdomain" class="my-input"></el-input>
|
||||
<el-select v-model="domain.domainId" placeholder="请选择主域名" class="my-select">
|
||||
<el-option v-for="tmp in domainList" :key="tmp.id" :label="'.'+tmp.domain" :value="tmp.id"></el-option>
|
||||
</el-select>
|
||||
</el-tag>
|
||||
<el-button v-if="!temp.domainMappings.length || temp.domainMappings[temp.domainMappings.length - 1].subdomain" class="button-new-tag" size="small" @click="addDomainMapping">+ 添加域名</el-button>
|
||||
</div>
|
||||
<!--<div v-for="(domain, index) in temp.domainMappings" :key="index" class="domain-mapping">
|
||||
<el-input v-model="domain.subdomain">
|
||||
<template slot="append">
|
||||
<el-select v-model="domain.domainId" placeholder="请选择主域名" style="width: 187px;">
|
||||
<el-option v-for="tmp in domainList" :key="tmp.id" :label="'.'+tmp.domain" :value="tmp.id"></el-option>
|
||||
</el-select>
|
||||
<el-button type="danger" @click="removeDomainMapping(index)" style="margin-left: 10px;">删除</el-button>
|
||||
</template>
|
||||
</el-input>
|
||||
</div>
|
||||
<el-button type="primary" @click="addDomainMapping" style="margin-top: 10px;">添加域名</el-button>-->
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="
|
||||
dialogFormVisible = false">{{ $t('table.cancel') }}</el-button>
|
||||
@@ -204,17 +255,18 @@
|
||||
|
||||
<script>
|
||||
import { fetchList, createUserPortMapping, updateUserPortMapping, updateEnableStatus, deletePortMapping } from '@/api/portMapping'
|
||||
import { fetchGroupList } from '@/api/securityGroup'
|
||||
import { availablePortList, portAvailable } from '@/api/portPool'
|
||||
import { licenseList, licenseAuthList } from '@/api/license'
|
||||
import { protocalList } from '@/api/protocal'
|
||||
import { userList } from '@/api/user'
|
||||
import { domainNameBindInfo } from '@/api/domain'
|
||||
import waves from '@/directive/waves' // 水波纹指令
|
||||
import { parseTime } from '@/utils'
|
||||
import ButtonPopover from '../../components/Button/buttonPopover'
|
||||
import DropdownTable from '../../components/Dropdown/DropdownTable'
|
||||
// 下拉选择加载组件
|
||||
import loadSelect from "@/components/Select/SelectLoadMore";
|
||||
import {fetchAvailableDomainList} from "../../api/domain";
|
||||
|
||||
const calendarTypeOptions = [
|
||||
{ key: 'CN', display_name: 'China' },
|
||||
@@ -280,7 +332,7 @@ export default {
|
||||
protocalList: [],
|
||||
licenseAuthList: [],
|
||||
serverPortList: [],
|
||||
domainName: '',
|
||||
domainList: [{ 'name': 'link.com', 'id': '1' }],
|
||||
showReviewer: false,
|
||||
temp: {
|
||||
id: undefined,
|
||||
@@ -291,7 +343,8 @@ export default {
|
||||
clientPort: undefined,
|
||||
protocal: undefined,
|
||||
proxyResponses: undefined,
|
||||
proxyTimeoutMs: undefined
|
||||
proxyTimeoutMs: undefined,
|
||||
domainMappings: []
|
||||
},
|
||||
selectObj: {
|
||||
statusOptions: [{ label: '启用', value: 1 }, { label: '禁用', value: 2 }],
|
||||
@@ -306,6 +359,27 @@ export default {
|
||||
dialogPvVisible: false,
|
||||
pvData: [],
|
||||
rules: {
|
||||
domainMappings: [
|
||||
{
|
||||
validator: (rule, value, callback) => {
|
||||
if (value && value.length > 0) {
|
||||
for (let i = 0; i < value.length; i++) {
|
||||
if (!value[i].subdomain || !value[i].domainId) {
|
||||
return callback(new Error(`子域名和主域名都不能为空`))
|
||||
}
|
||||
}
|
||||
const set = new Set()
|
||||
value.forEach(i => {
|
||||
const row = this.domainList.find(d => d.id === i.domainId)
|
||||
set.add(i.subdomain + '.' + row.domain)
|
||||
})
|
||||
if (set.size !== value.length) return callback(new Error(`域名不能重复`))
|
||||
}
|
||||
callback() // 验证通过
|
||||
},
|
||||
trigger: ''
|
||||
}
|
||||
],
|
||||
licenseId: [{ required: true, message: '请选择License', trigger: 'blur,change' }],
|
||||
serverPort: [{ required: true, message: '请输入服务端端口', trigger: 'blur' },
|
||||
// { validator: isPortAvailable, trigger: 'change' }
|
||||
@@ -325,6 +399,7 @@ export default {
|
||||
licenseId:null,
|
||||
},
|
||||
more: true,
|
||||
securityGroupList: []
|
||||
}
|
||||
},
|
||||
filters: {
|
||||
@@ -354,17 +429,71 @@ export default {
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getDomainNameBindInfo()
|
||||
this.getDataList()
|
||||
this.getLicenseList()
|
||||
this.getLicenseAuthList()
|
||||
this.getProtocalList()
|
||||
this.fetchSecurityGroupList()
|
||||
this.getAvailableDomainList()
|
||||
},
|
||||
methods: {
|
||||
handleCopy(text) {
|
||||
navigator.clipboard.writeText(text).then(() => {
|
||||
this.$message.success('复制成功')
|
||||
}).catch(() => {
|
||||
this.$message.error('复制失败')
|
||||
})
|
||||
},
|
||||
// 添加新的域名映射
|
||||
addDomainMapping() {
|
||||
let defaultDomainId = this.domainList[0].id
|
||||
this.domainList.forEach(item => {
|
||||
if (item.isDefault === 1) {
|
||||
defaultDomainId = item.id
|
||||
}
|
||||
})
|
||||
this.temp.domainMappings.push({
|
||||
subdomain: undefined,
|
||||
domain: undefined,
|
||||
domainId: defaultDomainId
|
||||
});
|
||||
console.log(this.list)
|
||||
},
|
||||
// 删除指定的域名映射
|
||||
removeDomainMapping(index) {
|
||||
this.temp.domainMappings.splice(index, 1);
|
||||
},
|
||||
getList() {
|
||||
this.listLoading = true
|
||||
fetchList(this.listQuery).then(response => {
|
||||
this.list = response.data.data.records
|
||||
this.list = response.data.data.records.map(item => {
|
||||
// 初始化 domainMappings 字段
|
||||
item.domainMappings = [];
|
||||
// 检查是否存在 subdomain 和 domain 字段
|
||||
if (item.fullDomainMappings && Array.isArray(item.fullDomainMappings)) {
|
||||
let allFullDomainList = []
|
||||
for (const fullDomainMapping of item.fullDomainMappings) {
|
||||
item.domainMappings.push({
|
||||
id: fullDomainMapping.id || '',
|
||||
subdomain: fullDomainMapping.subdomain || '', // 使用 || '' 保证字段非空
|
||||
domainId: fullDomainMapping.domainNameId || '',
|
||||
domain: fullDomainMapping.domain || ''
|
||||
});
|
||||
// 拼接完整的域名
|
||||
let fullDomain = null;
|
||||
if (fullDomainMapping.forceHttps == 1) {
|
||||
fullDomain = `https://` + `${fullDomainMapping.subdomain}.${fullDomainMapping.domain}`;
|
||||
} else {
|
||||
fullDomain = `http://` + `${fullDomainMapping.subdomain}.${fullDomainMapping.domain}`;
|
||||
}
|
||||
// 将拼接后的域名添加到
|
||||
allFullDomainList.push(fullDomain);
|
||||
}
|
||||
item.allFullDomainList = allFullDomainList
|
||||
}
|
||||
return item;
|
||||
});
|
||||
// console.log(this.list)
|
||||
this.total = response.data.data.total
|
||||
this.listLoading = false
|
||||
})
|
||||
@@ -380,15 +509,22 @@ export default {
|
||||
this.getList()
|
||||
})
|
||||
},
|
||||
getDomainNameBindInfo() {
|
||||
domainNameBindInfo().then(response => {
|
||||
this.domainName = response.data.data
|
||||
fetchSecurityGroupList () {
|
||||
fetchGroupList().then(res => {
|
||||
if(res.data.code == 0) {
|
||||
this.securityGroupList = res.data.data
|
||||
}
|
||||
})
|
||||
},
|
||||
getAvailablePortList(licenseId) {
|
||||
this.loadServerPortQuery.licenseId = licenseId;
|
||||
this.serverPortList = []; //清掉数据
|
||||
},
|
||||
getAvailableDomainList() {
|
||||
fetchAvailableDomainList({}).then(response => {
|
||||
this.domainList = response.data.data
|
||||
})
|
||||
},
|
||||
getAllUserList() {
|
||||
userList().then(response => {
|
||||
this.userList = response.data.data
|
||||
@@ -443,9 +579,10 @@ export default {
|
||||
clientPort: undefined,
|
||||
userId: undefined,
|
||||
proxyResponses: undefined,
|
||||
proxyTimeoutMs: undefined
|
||||
}
|
||||
this.serverPortList = []
|
||||
proxyTimeoutMs: undefined,
|
||||
domainMappings: []
|
||||
};
|
||||
this.serverPortList = [];
|
||||
this.loadServerPortQuery.licenseId = null;
|
||||
this.more = true;
|
||||
},
|
||||
@@ -460,6 +597,7 @@ export default {
|
||||
createData() {
|
||||
this.$refs['dataForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
// console.log(this.temp)
|
||||
createUserPortMapping(this.temp).then(response => {
|
||||
if (response.data.code === 0) {
|
||||
this.dialogFormVisible = false
|
||||
@@ -477,13 +615,19 @@ export default {
|
||||
},
|
||||
handleOpenWebPage(row) {
|
||||
let url = location.protocol + '//' + location.hostname + ':' + row.serverPort
|
||||
if (row.domain) {
|
||||
url = location.protocol + '//' + row.domain
|
||||
if (row.allFullDomainList && row.allFullDomainList.length > 0) {
|
||||
url = row.allFullDomainList[0]
|
||||
}
|
||||
open(url)
|
||||
},
|
||||
handleUpdate(row) {
|
||||
this.temp = Object.assign({}, row) // copy obj
|
||||
this.resetTemp()
|
||||
console.log(this.temp)
|
||||
this.temp = JSON.parse(JSON.stringify(row))
|
||||
console.log(this.temp)
|
||||
if (row.securityGroupId === 0) {
|
||||
this.temp.securityGroupId = null
|
||||
}
|
||||
this.temp.timestamp = new Date(this.temp.timestamp)
|
||||
this.dialogStatus = 'update'
|
||||
this.dialogFormVisible = true
|
||||
@@ -607,3 +751,42 @@ export default {
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.my-tag {
|
||||
width: 570px;
|
||||
&_item {
|
||||
height: 36px;
|
||||
line-height: 35px;
|
||||
padding: 0 7px;
|
||||
.my-input, .my-select {
|
||||
width: auto;
|
||||
/deep/ input {
|
||||
height: 32px;
|
||||
line-height: 32px;
|
||||
}
|
||||
}
|
||||
.my-input {
|
||||
/deep/ input {
|
||||
width: 120px;
|
||||
padding: 0 6px;
|
||||
}
|
||||
}
|
||||
.my-select {
|
||||
/deep/ input {
|
||||
width: 110px;
|
||||
border-width: 0!important;
|
||||
background: #ecf5ff!important;
|
||||
}
|
||||
}
|
||||
&:first-child {
|
||||
margin-right: 8px;
|
||||
}
|
||||
& + & {
|
||||
margin-right: 8px;
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="pagination-container">
|
||||
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-pageInfo.sync="listQuery.current"
|
||||
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page.sync="listQuery.current"
|
||||
:pageInfo-sizes="[10,20,30, 50]" :pageInfo-size="listQuery.size" layout="total, sizes, prev, pager, next, jumper" :total="total">
|
||||
</el-pagination>
|
||||
</div>
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="pagination-container">
|
||||
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-pageInfo.sync="listQuery.current"
|
||||
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page.sync="listQuery.current"
|
||||
:pageInfo-sizes="[10,20,30, 50]" :pageInfo-size="listQuery.size" layout="total, sizes, prev, pager, next, jumper" :total="total">
|
||||
</el-pagination>
|
||||
</div>
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="pagination-container">
|
||||
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-pageInfo.sync="listQuery.current"
|
||||
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page.sync="listQuery.current"
|
||||
:pageInfo-sizes="[10,20,30, 50]" :pageInfo-size="listQuery.size" layout="total, sizes, prev, pager, next, jumper" :total="total">
|
||||
</el-pagination>
|
||||
</div>
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="pagination-container">
|
||||
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-pageInfo.sync="listQuery.current"
|
||||
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page.sync="listQuery.current"
|
||||
:pageInfo-sizes="[10,20,30, 50]" :pageInfo-size="listQuery.size" layout="total, sizes, prev, pager, next, jumper" :total="total">
|
||||
</el-pagination>
|
||||
</div>
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="pagination-container">
|
||||
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-pageInfo.sync="listQuery.current"
|
||||
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page.sync="listQuery.current"
|
||||
:pageInfo-sizes="[10,20,30, 50]" :pageInfo-size="listQuery.size" layout="total, sizes, prev, pager, next, jumper" :total="total">
|
||||
</el-pagination>
|
||||
</div>
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
|
||||
<div class="pagination-container">
|
||||
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange"
|
||||
:current-pageInfo.sync="listQuery.current"
|
||||
:current-page.sync="listQuery.current"
|
||||
:pageInfo-sizes="[10,20,30, 50]" :pageInfo-size="listQuery.size"
|
||||
layout="total, sizes, prev, pager, next, jumper" :total="total">
|
||||
</el-pagination>
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
</el-table>
|
||||
|
||||
<div class="pagination-container">
|
||||
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-pageInfo.sync="listQuery.current"
|
||||
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page.sync="listQuery.current"
|
||||
:pageInfo-sizes="[10,20,30, 50]" :pageInfo-size="listQuery.size" layout="total, sizes, prev, pager, next, jumper" :total="total">
|
||||
</el-pagination>
|
||||
</div>
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
<div class="pagination-container">
|
||||
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange"
|
||||
:current-pageInfo.sync="listQuery.current"
|
||||
:current-page.sync="listQuery.current"
|
||||
:pageInfo-sizes="[10,20,30, 50]" :pageInfo-size="listQuery.size"
|
||||
layout="total, sizes, prev, pager, next, jumper" :total="total">
|
||||
</el-pagination>
|
||||
|
||||
@@ -0,0 +1,463 @@
|
||||
<template>
|
||||
<div class="app-container calendar-list-container">
|
||||
<div class="filter-container">
|
||||
<el-input v-model="listQuery.name" style="width:145px;margin-right:10px" placeholder="请输入名称" />
|
||||
<el-input v-model="listQuery.description" style="width:145px;margin-right:10px" placeholder="请输入描述" />
|
||||
<el-select v-model="listQuery.defaultPassType" placeholder="请选择默认放行类型" clearable style="width:145px;margin-right:10px">
|
||||
<el-option v-for="item in selectObj.passType" :key="item.value" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
<el-select v-model="listQuery.enable" placeholder="请选择启用状态" clearable style="width:145px;margin-right:10px">
|
||||
<el-option v-for="item in selectObj.statusOptions" :key="item.value" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
<el-button class="filter-item" type="primary" v-waves icon="el-icon-search" @click="handleFilter">{{
|
||||
$t('table.search') }}
|
||||
</el-button>
|
||||
<el-button class="filter-item" style="margin-left: 10px;" @click="handleCreate" type="primary" icon="el-icon-edit">{{$t('table.add')}}</el-button>
|
||||
</div>
|
||||
|
||||
<el-table :key='tableKey' :data="list" v-loading="listLoading" element-loading-text="给我一点时间" border fit highlight-current-row
|
||||
style="width: 100%">
|
||||
<!-- <el-table-column align="center" width="40" type="selection" /> -->
|
||||
<el-table-column align="center" :label="$t('table.id')" width="60">
|
||||
<template slot-scope="scope">
|
||||
<span>{{scope.row.id}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" :label="$t('table.name')">
|
||||
<template slot-scope="scope">
|
||||
<span>{{scope.row.name}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" :label="$t('table.desc')">
|
||||
<template slot-scope="scope">
|
||||
<span>{{scope.row.description}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" :label="$t('table.defaultPassType')">
|
||||
<template slot-scope="scope">
|
||||
<el-tag :type="scope.row.defaultPassType | passTypeFilter">{{ scope.row.defaultPassType | passTypeName }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" :label="$t('table.createTime')">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ scope.row.createTime | parseTime('{y}-{m}-{d} {h}:{i}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" :label="$t('table.updateTime')">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ scope.row.updateTime | parseTime('{y}-{m}-{d} {h}:{i}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column class-name="status-col" :label="$t('table.enableStatus')">
|
||||
<template slot-scope="scope">
|
||||
<el-tag :type="scope.row.enable | statusFilter">{{ scope.row.enable | statusName }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" :label="$t('table.actions')" class-name="small-padding fixed-width" style="display:flex;justify-content:center">
|
||||
<template slot-scope="scope">
|
||||
<div >
|
||||
<el-link :underline="false" type="primary" size="mini" @click="handleGoRulePage(scope.row)" style="font-size: 12px">{{$t('table.ruleConfig')}}</el-link>
|
||||
<el-link :underline="false" type="primary" size="mini" @click="handleUpdate(scope.row)" style="font-size: 12px">{{$t('table.edit')}}</el-link>
|
||||
<el-link :underline="false" v-if="scope.row.enable =='1'" size="mini" type="warning" @click="handleModifyStatus(scope.row, 2)" style="font-size: 12px">{{$t('table.disable')}}</el-link>
|
||||
<el-link :underline="false" v-if="scope.row.enable =='2'" size="mini" type="success" @click="handleModifyStatus(scope.row, 1)" style="font-size: 12px">{{$t('table.enable')}}</el-link>
|
||||
</div>
|
||||
<el-dropdown>
|
||||
<span class="el-dropdown-link" style="font-size: 12px">
|
||||
更多操作<i class="el-icon-arrow-down el-icon--right"></i>
|
||||
</span>
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item>
|
||||
<LinkPopover @handleCommitClick="handleDelete(scope.row)" style="width: 100%"/>
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item>
|
||||
<el-link :underline="false" type="primary" size="mini" @click="handlePortMapping(scope.row)" style="font-size: 12px">{{$t('table.securityGroupBindPortMapping')}}</el-link>
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<div class="pagination-container">
|
||||
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange"
|
||||
:current-page.sync="listQuery.current" :pageInfo-sizes="[10, 20, 30, 50]" :pageInfo-size="listQuery.size"
|
||||
layout="total, sizes, prev, pager, next, jumper" :total="total">
|
||||
</el-pagination>
|
||||
</div>
|
||||
|
||||
<el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible">
|
||||
<el-form :rules="rules" ref="dataForm" :model="temp" label-position="right" label-width="120px" style='width: 500px; margin-left:10px;'>
|
||||
<el-form-item :label="$t('table.name')" prop="name">
|
||||
<el-input :placeholder="$t('table.name')" v-model="temp.name"></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item :label="$t('table.desc')" prop="desc">
|
||||
<el-input type="textarea" :autosize="{ minRows: 2, maxRows: 4}" :placeholder="$t('table.desc')" v-model="temp.description"></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item :label="$t('table.defaultPassType')" prop="defaultPassType">
|
||||
<el-tooltip class="item" effect="dark" content="当IP地址不能匹配任何规则时,默认执行的放行类型" placement="bottom">
|
||||
<el-select style="width: 380px" class="filter-item" v-model="temp.defaultPassType" :disabled="dialogStatus === 'update'">
|
||||
<el-option v-for="item in passTypeList" :key="item.key" :label="item.key" :value="item.value">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-tooltip>
|
||||
</el-form-item>
|
||||
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogFormVisible = false">{{$t('table.cancel')}}</el-button>
|
||||
<el-button v-if="dialogStatus=='create'" type="primary" @click="createData">{{$t('table.confirm')}}</el-button>
|
||||
<el-button v-else type="primary" @click="updateData">{{$t('table.confirm')}}</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog title="Reading statistics" :visible.sync="dialogPvVisible">
|
||||
<el-table :data="pvData" border fit highlight-current-row style="width: 100%">
|
||||
<el-table-column prop="key" label="Channel"> </el-table-column>
|
||||
<el-table-column prop="pv" label="Pv"> </el-table-column>
|
||||
</el-table>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="dialogPvVisible = false">{{$t('table.confirm')}}</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog :title="$t('table.securityGroupBindPortMapping')+'---'+forBindProtMappingSecurityGroup.name+'安全组'" :visible.sync="dialogBindPortMappingVisible" width="90%">
|
||||
<el-table :key='tableKey' :data="portMappingList" v-loading="listLoading" element-loading-text="给我一点时间" border width="100%"
|
||||
highlight-current-row style="width: 100%">
|
||||
<el-table-column align="center" :label="$t('table.id')" width="50">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ scope.row.id }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" :label="$t('table.licenseName')">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ scope.row.licenseName }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" :label="$t('table.protocalName')" width="120">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ scope.row.protocal }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" :label="$t('table.domainName')">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ scope.row.domain }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" :label="$t('table.serverPort')" width="100">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ scope.row.serverPort }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" :label="$t('table.proxyClient')" width="200">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ scope.row.clientIp }}:{{ scope.row.clientPort }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" :label="$t('table.desc')" width="120">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ scope.row.description }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column class-name="status-col" :label="$t('table.enableStatus')" width="120">
|
||||
<template slot-scope="scope">
|
||||
<el-tag :type="scope.row.enable | statusFilter">{{ scope.row.enable | statusName }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" :label="$t('table.actions')" width="150" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="primary" size="mini" v-if="!scope.row.securityGroupId" @click="handleBind(scope.row)">{{$t('table.bind')}}</el-button>
|
||||
<el-button type="danger" size="mini" v-if="scope.row.securityGroupId && scope.row.securityGroupId == forBindProtMappingSecurityGroup.id" @click="handleUnbind(scope.row)">{{$t('table.unbind')}}</el-button>
|
||||
<span v-if="scope.row.securityGroupId && scope.row.securityGroupId != forBindProtMappingSecurityGroup.id" style="font-size: 12px;">{{$t('table.bindOtherSecurityGroup')}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<div class="pagination-container">
|
||||
<el-pagination background @size-change="handlePortMappingSizeChange" @current-change="handlePortMappingCurrentChange"
|
||||
:current-page.sync="portMappingListQuery.current" :pageInfo-sizes="[10, 20, 30, 50]" :pageInfo-size="portMappingListQuery.size"
|
||||
layout="total, sizes, prev, pager, next, jumper" :total="portMappingTotal">
|
||||
</el-pagination>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {fetchGroupPage, createGroup, updateGroup, deleteGroup, updateGroupEnableStatus} from '@/api/securityGroup'
|
||||
import { fetchList as fetchPortMappingList, portMappingBindSecurityGroup, portMappingUnbindSecurityGroup} from '@/api/portMapping'
|
||||
import waves from '@/directive/waves' // 水波纹指令
|
||||
import { parseTime } from '@/utils'
|
||||
import LinkPopover from '../../components/Link/linkPopover'
|
||||
|
||||
export default {
|
||||
name: 'complexTable',
|
||||
directives: {
|
||||
waves
|
||||
},
|
||||
components: {
|
||||
LinkPopover
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
tableKey: 0,
|
||||
list: [],
|
||||
total: null,
|
||||
listQuery: {
|
||||
current: 1,
|
||||
size: 10,
|
||||
name: undefined,
|
||||
description: undefined,
|
||||
defaultPassType: undefined,
|
||||
enable: undefined
|
||||
},
|
||||
listLoading: true,
|
||||
temp: {
|
||||
id: undefined,
|
||||
name: '',
|
||||
description: '',
|
||||
defaultPassType: undefined
|
||||
},
|
||||
selectObj: {
|
||||
statusOptions: [{ label: '启用', value: 1 }, { label: '禁用', value: 2 }],
|
||||
onlineOptions: [{ label: '在线', value: 1 }, { label: '离线', value: 2 }],
|
||||
passType: [{ label: '允许', value: 1 }, { label: '拒绝', value: 0 }]
|
||||
|
||||
},
|
||||
dialogFormVisible: false,
|
||||
dialogStatus: '',
|
||||
textMap: {
|
||||
update: '编辑',
|
||||
create: '新建'
|
||||
},
|
||||
passTypeList: [{key: '允许', value: 1}, {key: '拒绝', value: 0}],
|
||||
dialogPvVisible: false,
|
||||
pvData: [],
|
||||
rules: {
|
||||
name: [{ required: true, message: '安全组名称必填', trigger: 'blur' }],
|
||||
defaultPassType: [{ required: true, message: '默认放行类型必选', trigger: 'blur' }]
|
||||
},
|
||||
downloadLoading: false,
|
||||
checkBoxData:[], //表单勾选的行
|
||||
dialogBindPortMappingVisible: false,
|
||||
forBindProtMappingSecurityGroup: {},
|
||||
portMappingList: [],
|
||||
portMappingTotal: null,
|
||||
portMappingListLoading: false,
|
||||
portMappingListQuery: {
|
||||
current: 1,
|
||||
size: 10,
|
||||
importance: undefined,
|
||||
title: undefined,
|
||||
type: undefined,
|
||||
userId: undefined,
|
||||
license: undefined,
|
||||
port: undefined,
|
||||
isOnline: undefined,
|
||||
enable: undefined,
|
||||
description: undefined
|
||||
},
|
||||
}
|
||||
},
|
||||
filters: {
|
||||
passTypeName(type) {
|
||||
const statusMap = {
|
||||
1: '允许',
|
||||
0: '拒绝'
|
||||
}
|
||||
return statusMap[type]
|
||||
},
|
||||
passTypeFilter(type) {
|
||||
const statusMap = {
|
||||
1: 'success',
|
||||
0: 'danger'
|
||||
}
|
||||
return statusMap[type]
|
||||
},
|
||||
statusName(status) {
|
||||
const statusMap = {
|
||||
1: '启用',
|
||||
2: '禁用'
|
||||
}
|
||||
return statusMap[status]
|
||||
},
|
||||
statusFilter(status) {
|
||||
const statusMap = {
|
||||
1: 'success',
|
||||
2: 'danger'
|
||||
}
|
||||
return statusMap[status]
|
||||
},
|
||||
typeFilter(type) {
|
||||
return calendarTypeKeyValue[type]
|
||||
}
|
||||
},
|
||||
created() {
|
||||
// eslint-disable-next-line no-sequences
|
||||
this.getList()
|
||||
this.getPortMappingList()
|
||||
},
|
||||
methods: {
|
||||
getList() {
|
||||
this.listLoading = true
|
||||
fetchGroupPage(this.listQuery).then(response => {
|
||||
this.list = response.data.data.records
|
||||
this.total = response.data.data.total
|
||||
this.listLoading = false
|
||||
})
|
||||
},
|
||||
handleFilter() {
|
||||
this.listQuery.current = 1
|
||||
this.getList()
|
||||
},
|
||||
handleSizeChange(val) {
|
||||
this.listQuery.size = val
|
||||
this.getList()
|
||||
},
|
||||
handleCurrentChange(val) {
|
||||
this.listQuery.current = val
|
||||
this.getList()
|
||||
},
|
||||
getPortMappingList() {
|
||||
this.portMappingListLoading = true
|
||||
fetchPortMappingList(this.portMappingListQuery).then(response => {
|
||||
this.portMappingList = response.data.data.records
|
||||
this.portMappingTotal = response.data.data.total
|
||||
this.portMappingListQuery.current = response.data.data.current
|
||||
this.portMappingListLoading = false
|
||||
})
|
||||
},
|
||||
handleModifyStatus(row, enable) {
|
||||
updateGroupEnableStatus(row.id, enable).then(response => {
|
||||
if (response.data.data.code === 0) {
|
||||
this.$message({
|
||||
message: '操作成功',
|
||||
type: 'success'
|
||||
})
|
||||
}
|
||||
this.getList()
|
||||
})
|
||||
},
|
||||
resetTemp() {
|
||||
this.temp = {
|
||||
id: undefined,
|
||||
name: '',
|
||||
description: '',
|
||||
defaultPassType: undefined
|
||||
}
|
||||
},
|
||||
handleCreate() {
|
||||
this.resetTemp()
|
||||
this.dialogStatus = 'create'
|
||||
this.dialogFormVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].clearValidate()
|
||||
})
|
||||
},
|
||||
createData() {
|
||||
this.$refs['dataForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
createGroup(this.temp).then(response => {
|
||||
if (response.data.code === 0) {
|
||||
this.dialogFormVisible = false
|
||||
this.$notify({
|
||||
title: '成功',
|
||||
message: '创建成功',
|
||||
type: 'success',
|
||||
duration: 2000
|
||||
})
|
||||
this.getList()
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
handleUpdate(row) {
|
||||
this.temp = Object.assign({}, row) // copy obj
|
||||
// this.temp.timestamp = new Date(this.temp.timestamp)
|
||||
this.dialogStatus = 'update'
|
||||
this.dialogFormVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].clearValidate()
|
||||
})
|
||||
},
|
||||
updateData() {
|
||||
this.$refs['dataForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
const tempData = Object.assign({}, this.temp)
|
||||
updateGroup(tempData).then(response => {
|
||||
if (response.data.code === 0) {
|
||||
this.$notify({
|
||||
title: '成功',
|
||||
message: '更新成功',
|
||||
type: 'success',
|
||||
duration: 2000
|
||||
})
|
||||
this.dialogFormVisible = false
|
||||
this.getList()
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
handleDelete(row) {
|
||||
deleteGroup({groupId: row.id}).then(response => {
|
||||
if (response.data.code === 0) {
|
||||
this.$notify({
|
||||
title: '成功',
|
||||
message: '删除成功',
|
||||
type: 'success',
|
||||
duration: 2000
|
||||
})
|
||||
this.getList()
|
||||
}
|
||||
})
|
||||
},
|
||||
handleGoRulePage (row) {
|
||||
this.$router.push({ path: '/system/securityRule', query: { groupId: row.id }})
|
||||
|
||||
// this.$router.push(`/system/securityRule?groupId=${row.id}`)
|
||||
},
|
||||
handlePortMapping(row) {
|
||||
this.dialogBindPortMappingVisible = true
|
||||
this.forBindProtMappingSecurityGroup = row
|
||||
},
|
||||
handlePortMappingSizeChange(val) {
|
||||
this.portMappingListQuery.size = val
|
||||
this.getPortMappingList()
|
||||
},
|
||||
handlePortMappingCurrentChange(val) {
|
||||
this.portMappingListQuery.current = val
|
||||
this.getPortMappingList()
|
||||
},
|
||||
handleBind(portMapping) {
|
||||
portMappingBindSecurityGroup(portMapping.id, this.forBindProtMappingSecurityGroup.id).then(response => {
|
||||
if (response.data.code === 0) {
|
||||
this.$notify({
|
||||
title: '成功',
|
||||
message: '绑定成功',
|
||||
type: 'success',
|
||||
duration: 2000
|
||||
})
|
||||
this.getPortMappingList()
|
||||
}
|
||||
})
|
||||
},
|
||||
handleUnbind(portMapping) {
|
||||
portMappingUnbindSecurityGroup(portMapping.id).then(response => {
|
||||
if (response.data.code === 0) {
|
||||
this.$notify({
|
||||
title: '成功',
|
||||
message: '解绑成功',
|
||||
type: 'success',
|
||||
duration: 2000
|
||||
})
|
||||
this.getPortMappingList()
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,419 @@
|
||||
<template>
|
||||
<div class="app-container calendar-list-container">
|
||||
|
||||
<div>
|
||||
<div style="text-align: center;line-height:48px;font-size:24px">{{group.name}}安全组</div>
|
||||
<div style="text-align: center;font-size:14px; color: #606266">{{group.description}}</div>
|
||||
</div>
|
||||
|
||||
<div class="filter-container">
|
||||
<el-input v-model="listQuery.name" style="width:145px;margin-right:10px" placeholder="请输入名称" />
|
||||
<el-input v-model="listQuery.description" style="width:145px;margin-right:10px" placeholder="请输入描述" />
|
||||
<!-- <el-select v-model="listQuery.passType" placeholder="请选择默认放行类型" clearable style="width:145px;margin-right:10px">-->
|
||||
<!-- <el-option v-for="item in selectObj.passType" :key="item.value" :label="item.label" :value="item.value" />-->
|
||||
<!-- </el-select>-->
|
||||
<el-select v-model="listQuery.enable" placeholder="请选择启用状态" clearable style="width:145px;margin-right:10px">
|
||||
<el-option v-for="item in selectObj.statusOptions" :key="item.value" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
<el-button class="filter-item" type="primary" v-waves icon="el-icon-search" @click="handleFilter">{{
|
||||
$t('table.search') }}
|
||||
</el-button>
|
||||
<el-button class="filter-item" @click="handleCreate" type="primary" icon="el-icon-edit">{{$t('table.add')}}</el-button>
|
||||
</div>
|
||||
|
||||
<el-table :key='tableKey' :data="list" v-loading="listLoading" element-loading-text="给我一点时间" border fit highlight-current-row
|
||||
style="width: 100%">
|
||||
<!-- <el-table-column align="center" width="40" type="selection" /> -->
|
||||
<el-table-column align="center" :label="$t('table.id')" width="60">
|
||||
<template slot-scope="scope">
|
||||
<span>{{scope.row.id}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" :label="$t('table.ruleName')">
|
||||
<template slot-scope="scope">
|
||||
<span>{{scope.row.name}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" :label="$t('table.desc')">
|
||||
<template slot-scope="scope">
|
||||
<span>{{scope.row.description}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" :label="$t('table.rule')">
|
||||
<template slot-scope="scope">
|
||||
<span>{{scope.row.rule}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" :label="$t('table.passType')">
|
||||
<template slot-scope="scope">
|
||||
<el-tag :type="scope.row.passType | passTypeFilter">{{ scope.row.passType | passTypeName }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column align="center" :label="$t('table.priority')">-->
|
||||
<!-- <template slot-scope="scope">-->
|
||||
<!-- <span>{{scope.row.priority}}</span>-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-table-column>-->
|
||||
<el-table-column align="center" :label="$t('table.createTime')">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ scope.row.createTime | parseTime('{y}-{m}-{d} {h}:{i}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" :label="$t('table.updateTime')">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ scope.row.updateTime | parseTime('{y}-{m}-{d} {h}:{i}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column class-name="status-col" :label="$t('table.enableStatus')" width="150">
|
||||
<template slot-scope="scope">
|
||||
<el-tag :type="scope.row.enable | statusFilter">{{ scope.row.enable | statusName }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" :label="$t('table.actions')" width="250" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-link type="primary" :underline="false" size="mini" @click="handleUpdate(scope.row)" style="font-size:12px">{{$t('table.edit')}}</el-link>
|
||||
<el-link :underline="false" v-if="scope.row.enable =='1'" size="mini" type="warning" @click="handleModifyStatus(scope.row, 2)" style="font-size:12px">{{$t('table.disable')}}</el-link>
|
||||
<el-link :underline="false" v-if="scope.row.enable =='2'" size="mini" type="success" @click="handleModifyStatus(scope.row, 1)" style="font-size:12px">{{$t('table.enable')}}</el-link>
|
||||
<LinkPopover @handleCommitClick="handleDelete(scope.row)"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<div class="pagination-container">
|
||||
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange"
|
||||
:current-page.sync="listQuery.current" :pageInfo-sizes="[10, 20, 30, 50]" :pageInfo-size="listQuery.size"
|
||||
layout="total, sizes, prev, pager, next, jumper" :total="total">
|
||||
</el-pagination>
|
||||
</div>
|
||||
|
||||
<el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible" top="4vh">
|
||||
<el-form :rules="rules" ref="dataForm" :model="temp" label-position="right" label-width="100px" style='margin-left:50px;margin-right: 150px'>
|
||||
<el-form-item :label="$t('table.name')" prop="name">
|
||||
<el-input :placeholder="$t('table.name')" v-model="temp.name"></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item :label="$t('table.desc')" prop="desc">
|
||||
<el-input type="textarea" :autosize="{ minRows: 2, maxRows: 4}" :placeholder="$t('table.desc')" v-model="temp.description"></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item :label="$t('table.rule')" prop="rule">
|
||||
<el-input type="textarea" :autosize="{ minRows: 4, maxRows: 10}" :placeholder="$t('table.rule')" v-model="temp.rule"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<div style="line-height: 28px; color: cornflowerblue">
|
||||
<div>规则描述:</div>
|
||||
<div>单个ip:192.168.1.1, AA22:BB11:1122:CDEF:1234:AA99:7654:7410, ipv6只支持单个ip判断</div>
|
||||
<div>范围类型:192.168.1.0-192.168.1.255</div>
|
||||
<div>掩码类型:192.168.1.0/24</div>
|
||||
<div>泛型:0.0.0.0/ALL</div>
|
||||
<div>每个类型中间以英文逗号分隔,形如 192.168.1.1,192.168.3.0/24 是正确的 </div>
|
||||
</div>
|
||||
</el-form-item>
|
||||
|
||||
|
||||
<el-form-item :label="$t('table.passType')" prop="passType">
|
||||
<el-tooltip class="item" effect="dark" :content="temp.passTypeTooltip" placement="right">
|
||||
<!-- <el-button>右边</el-button> -->
|
||||
<el-select class="filter-item" v-model="temp.passType" disabled>
|
||||
<el-option v-for="item in passTypeList" :key="item.key" :label="item.key" :value="item.value">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-tooltip>
|
||||
|
||||
</el-form-item>
|
||||
|
||||
<!-- <el-form-item :label="$t('table.priority')" prop="priority">
|
||||
<el-input-number v-model="temp.priority" :min="1" :max="1000" :placeholder="$t('table.priority')"></el-input-number>
|
||||
</el-form-item> -->
|
||||
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogFormVisible = false">{{$t('table.cancel')}}</el-button>
|
||||
<el-button v-if="dialogStatus=='create'" type="primary" @click="createData">{{$t('table.confirm')}}</el-button>
|
||||
<el-button v-else type="primary" @click="updateData">{{$t('table.confirm')}}</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog title="Reading statistics" :visible.sync="dialogPvVisible">
|
||||
<el-table :data="pvData" border fit highlight-current-row style="width: 100%">
|
||||
<el-table-column prop="key" label="Channel"> </el-table-column>
|
||||
<el-table-column prop="pv" label="Pv"> </el-table-column>
|
||||
</el-table>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="dialogPvVisible = false">{{$t('table.confirm')}}</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {fetchGroupDetail, fetchRulePage, createRule, updateRule, deleteRule, updateRuleEnableStatus} from '@/api/securityGroup'
|
||||
import waves from '@/directive/waves' // 水波纹指令
|
||||
import { parseTime } from '@/utils'
|
||||
import LinkPopover from '../../components/Link/linkPopover'
|
||||
|
||||
export default {
|
||||
name: 'complexTable',
|
||||
directives: {
|
||||
waves
|
||||
},
|
||||
components: {
|
||||
LinkPopover
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
groupId: 1,
|
||||
group: {},
|
||||
tableKey: 0,
|
||||
list: [],
|
||||
total: null,
|
||||
listQuery: {
|
||||
current: 1,
|
||||
size: 10,
|
||||
groupId: undefined,
|
||||
name: undefined,
|
||||
description: undefined,
|
||||
passType: undefined,
|
||||
enable: undefined
|
||||
},
|
||||
listLoading: true,
|
||||
temp: {
|
||||
id: undefined,
|
||||
groupId: undefined,
|
||||
name: '',
|
||||
description: '',
|
||||
rule: '',
|
||||
passType: undefined,
|
||||
passTypeTooltip: '',
|
||||
priority: 1
|
||||
},
|
||||
selectObj: {
|
||||
statusOptions: [{ label: '启用', value: 1 }, { label: '禁用', value: 2 }],
|
||||
onlineOptions: [{ label: '在线', value: 1 }, { label: '离线', value: 2 }],
|
||||
passType: [{ label: '允许', value: 1 }, { label: '拒绝', value: 2 }]
|
||||
|
||||
},
|
||||
dialogFormVisible: false,
|
||||
dialogStatus: '',
|
||||
textMap: {
|
||||
update: '编辑',
|
||||
create: '新建'
|
||||
},
|
||||
passTypeList: [{key: '允许', value: 1}, {key: '拒绝', value: 0}],
|
||||
dialogPvVisible: false,
|
||||
pvData: [],
|
||||
rules: {
|
||||
name: [{ required: true, message: '安全组名称必填', trigger: 'blur' }],
|
||||
rule: [{ required: true, message: '规则内容必填', trigger: 'blur' }],
|
||||
// passType: [{ required: true, message: '放行类型必选', trigger: 'blur' }],
|
||||
// priority: [{ required: true, message: '优先级必填', trigger: 'blur' }]
|
||||
},
|
||||
downloadLoading: false,
|
||||
checkBoxData:[], //表单勾选的行
|
||||
}
|
||||
},
|
||||
filters: {
|
||||
passTypeName(type) {
|
||||
const statusMap = {
|
||||
1: '允许',
|
||||
0: '拒绝'
|
||||
}
|
||||
return statusMap[type]
|
||||
},
|
||||
passTypeFilter(type) {
|
||||
const statusMap = {
|
||||
1: 'success',
|
||||
0: 'danger'
|
||||
}
|
||||
return statusMap[type]
|
||||
},
|
||||
statusName(status) {
|
||||
const statusMap = {
|
||||
1: '启用',
|
||||
2: '禁用'
|
||||
}
|
||||
return statusMap[status]
|
||||
},
|
||||
statusFilter(status) {
|
||||
const statusMap = {
|
||||
1: 'success',
|
||||
2: 'danger'
|
||||
}
|
||||
return statusMap[status]
|
||||
},
|
||||
typeFilter(type) {
|
||||
return calendarTypeKeyValue[type]
|
||||
}
|
||||
},
|
||||
created() {
|
||||
// eslint-disable-next-line no-sequences
|
||||
if (this.$route.query.groupId) {
|
||||
this.listQuery.groupId = this.$route.query.groupId
|
||||
} else {
|
||||
this.$notify({
|
||||
title: '错误',
|
||||
message: '没有获取到安全组信息',
|
||||
type: 'error',
|
||||
duration: 3000
|
||||
})
|
||||
this.$router.push(`/system/securityGroup`)
|
||||
return
|
||||
}
|
||||
this.getGroupDetail()
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
getGroupDetail () {
|
||||
fetchGroupDetail({id: this.listQuery.groupId}).then(response => {
|
||||
this.group = response.data.data
|
||||
})
|
||||
},
|
||||
getList() {
|
||||
if (!this.listQuery.groupId) {
|
||||
this.$notify({
|
||||
title: '错误',
|
||||
message: '没有获取到安全组信息',
|
||||
type: 'error',
|
||||
duration: 3000
|
||||
})
|
||||
return
|
||||
}
|
||||
this.listLoading = true
|
||||
fetchRulePage(this.listQuery).then(response => {
|
||||
this.list = response.data.data.records
|
||||
this.total = response.data.data.total
|
||||
this.listLoading = false
|
||||
})
|
||||
},
|
||||
handleFilter() {
|
||||
this.listQuery.current = 1
|
||||
this.getList()
|
||||
},
|
||||
handleSizeChange(val) {
|
||||
this.listQuery.size = val
|
||||
this.getList()
|
||||
},
|
||||
handleCurrentChange(val) {
|
||||
this.listQuery.current = val
|
||||
this.getList()
|
||||
},
|
||||
handleEnableStatus(row) {
|
||||
enableRule(row.id).then(response => {
|
||||
if (response.data.code === 0) {
|
||||
this.$message({
|
||||
message: '操作成功',
|
||||
type: 'success'
|
||||
})
|
||||
this.getList()
|
||||
}
|
||||
})
|
||||
},
|
||||
handleDisableStatus(row) {
|
||||
disableRule(row.id).then(response => {
|
||||
if (response.data.code === 0) {
|
||||
this.$message({
|
||||
message: '操作成功',
|
||||
type: 'success'
|
||||
})
|
||||
this.getList()
|
||||
}
|
||||
})
|
||||
},
|
||||
handleModifyStatus(row, enable) {
|
||||
updateRuleEnableStatus(row.id, enable).then(response => {
|
||||
if (response.data.data.code === 0) {
|
||||
this.$message({
|
||||
message: '操作成功',
|
||||
type: 'success'
|
||||
})
|
||||
}
|
||||
this.getList()
|
||||
})
|
||||
},
|
||||
resetTemp() {
|
||||
this.temp = {
|
||||
id: undefined,
|
||||
groupId: this.listQuery.groupId,
|
||||
name: '',
|
||||
description: '',
|
||||
rule: '',
|
||||
passType: this.group.defaultPassType == 1 ? 0 : 1,
|
||||
passTypeTooltip: `安全组已设置默认${(this.group.defaultPassType == 1 ? '允许' : '拒绝')}`,
|
||||
priority: 1
|
||||
}
|
||||
},
|
||||
handleCreate() {
|
||||
this.resetTemp()
|
||||
this.dialogStatus = 'create'
|
||||
this.dialogFormVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].clearValidate()
|
||||
})
|
||||
},
|
||||
createData() {
|
||||
this.$refs['dataForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
this.temp.groupId = this.listQuery.groupId
|
||||
createRule(this.temp).then(response => {
|
||||
if (response.data.code === 0) {
|
||||
this.dialogFormVisible = false
|
||||
this.$notify({
|
||||
title: '成功',
|
||||
message: '创建成功',
|
||||
type: 'success',
|
||||
duration: 2000
|
||||
})
|
||||
this.getList()
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
handleUpdate(row) {
|
||||
this.temp = Object.assign({}, row) // copy obj
|
||||
this.temp.passType = row.passType
|
||||
this.temp.passTypeTooltip = `安全组已设置默认${(this.group.defaultPassType == 1 ? '允许' : '拒绝')}`,
|
||||
this.temp.timestamp = new Date(this.temp.timestamp)
|
||||
this.dialogStatus = 'update'
|
||||
this.dialogFormVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].clearValidate()
|
||||
})
|
||||
},
|
||||
updateData() {
|
||||
this.$refs['dataForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
const tempData = Object.assign({}, this.temp)
|
||||
tempData.groupId = this.listQuery.groupId
|
||||
updateRule(tempData).then(response => {
|
||||
if (response.data.code === 0) {
|
||||
this.$notify({
|
||||
title: '成功',
|
||||
message: '更新成功',
|
||||
type: 'success',
|
||||
duration: 2000
|
||||
})
|
||||
this.dialogFormVisible = false
|
||||
this.getList()
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
handleDelete(row) {
|
||||
deleteRule({ruleId: row.id}).then(response => {
|
||||
if (response.data.code === 0) {
|
||||
this.$notify({
|
||||
title: '成功',
|
||||
message: '删除成功',
|
||||
type: 'success',
|
||||
duration: 2000
|
||||
})
|
||||
this.getList()
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -50,7 +50,7 @@
|
||||
</el-table>
|
||||
|
||||
<div class="pagination-container">
|
||||
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-pageInfo.sync="listQuery.current"
|
||||
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page.sync="listQuery.current"
|
||||
:pageInfo-sizes="[10,20,30, 50]" :pageInfo-size="listQuery.size" layout="total, sizes, prev, pager, next, jumper" :total="total">
|
||||
</el-pagination>
|
||||
</div>
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
FROM openjdk:8-jdk-alpine
|
||||
FROM openjdk:21-jdk-oracle
|
||||
#同步时间
|
||||
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories && \
|
||||
apk update && apk add wget unzip vim && apk add -U tzdata && \
|
||||
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo 'Asia/Shanghai' >/etc/timezone
|
||||
#RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories && \
|
||||
# apk update && apk add wget unzip vim && apk add -U tzdata && \
|
||||
# ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo 'Asia/Shanghai' >/etc/timezone
|
||||
# 设置时区为北京时间
|
||||
ENV TZ=Asia/Shanghai
|
||||
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
||||
RUN mkdir -p /root/neutrino-proxy/config
|
||||
WORKDIR /root/neutrino-proxy
|
||||
COPY ../neutrino-proxy-client/target/neutrino-proxy-client.jar /root/neutrino-proxy/neutrino-proxy-client.jar
|
||||
COPY ../neutrino-proxy-client/src/main/resources/app.yml /root/neutrino-proxy/config
|
||||
COPY ./target/neutrino-proxy-client.jar /root/neutrino-proxy/neutrino-proxy-client.jar
|
||||
COPY ./src/main/resources/app-copy.yml /root/neutrino-proxy/config/app.yml
|
||||
#VOLUME ["/root/neutrino-proxy"]
|
||||
ENTRYPOINT ["java","-jar","neutrino-proxy-client.jar","config=./config/app.yml"]
|
||||
|
||||
|
||||
@@ -28,6 +28,13 @@
|
||||
<build>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<filtering>true</filtering>
|
||||
<includes>
|
||||
<include>*.yml</include>
|
||||
</includes>
|
||||
</resource>
|
||||
<resource>
|
||||
<directory>${project.basedir}/src/main/resources</directory>
|
||||
<filtering>false</filtering>
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.dromara.neutrinoproxy.client;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.noear.solon.Solon;
|
||||
import org.noear.solon.Utils;
|
||||
import org.noear.solon.annotation.SolonMain;
|
||||
|
||||
/**
|
||||
@@ -16,13 +17,18 @@ public class ProxyClient {
|
||||
|
||||
public static void main(String[] args) {
|
||||
Solon.start(ProxyClient.class, args, app -> {
|
||||
setAlias("neutrino.proxy.tunnel.serverIp", "serverIp");
|
||||
setAlias("neutrino.proxy.tunnel.serverPort", "serverPort");
|
||||
setAlias("neutrino.proxy.tunnel.sslEnable", "sslEnable");
|
||||
setAlias("neutrino.proxy.tunnel.jksPath", "jksPath");
|
||||
setAlias("neutrino.proxy.tunnel.keyStorePassword", "keyStorePassword");
|
||||
setAlias("neutrino.proxy.tunnel.licenseKey", "licenseKey");
|
||||
});
|
||||
String loglevel = System.getenv("LOG_LEVEL");
|
||||
if (Utils.isNotEmpty(loglevel)) {
|
||||
app.cfg().put("solon.logging.logger.root.level", loglevel);
|
||||
}
|
||||
|
||||
setAlias("neutrino.proxy.tunnel.server-ip", "serverIp");
|
||||
setAlias("neutrino.proxy.tunnel.server-port", "serverPort");
|
||||
setAlias("neutrino.proxy.tunnel.ssl-enable", "sslEnable");
|
||||
setAlias("neutrino.proxy.tunnel.jks-path", "jksPath");
|
||||
setAlias("neutrino.proxy.tunnel.key-store-password", "keyStorePassword");
|
||||
setAlias("neutrino.proxy.tunnel.license-key", "licenseKey");
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
package org.dromara.neutrinoproxy.client.config;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.noear.solon.Solon;
|
||||
import org.noear.solon.annotation.Component;
|
||||
import org.noear.solon.core.event.AppLoadEndEvent;
|
||||
import org.noear.solon.core.event.EventListener;
|
||||
import org.noear.solon.core.runtime.NativeDetector;
|
||||
|
||||
/**
|
||||
* 启动成功后信息输出
|
||||
* @author: aoshiguchen
|
||||
* @date: 2024/10/16
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class AppLoadEndExecutor implements EventListener<AppLoadEndEvent> {
|
||||
|
||||
@Override
|
||||
public void onEvent(AppLoadEndEvent appLoadEndEvent) throws Throwable {
|
||||
// aot 阶段,不执行
|
||||
if (NativeDetector.isAotRuntime()) {
|
||||
return;
|
||||
}
|
||||
System.out.printf("""
|
||||
---------------------------------------------------------------
|
||||
Neutrino Proxy Client %s
|
||||
Gitee: https://gitee.com/dromara/neutrino-proxy
|
||||
GitHub: https://github.com/dromara/neutrino-proxy
|
||||
GitCode: https://gitcode.com/dromara/neutrino-proxy
|
||||
---------------------------------------------------------------
|
||||
%n""", Solon.app().cfg().get("solon.app.version"));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,6 +1,10 @@
|
||||
package org.dromara.neutrinoproxy.client.config;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import io.netty.channel.WriteBufferWaterMark;
|
||||
import lombok.Data;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.neutrinoproxy.client.util.StringUtil;
|
||||
import org.noear.solon.annotation.Component;
|
||||
import org.noear.solon.annotation.Inject;
|
||||
|
||||
@@ -9,6 +13,7 @@ import org.noear.solon.annotation.Inject;
|
||||
* @author: aoshiguchen
|
||||
* @date: 2022/6/16
|
||||
*/
|
||||
@Slf4j
|
||||
@Data
|
||||
@Component
|
||||
public class ProxyConfig {
|
||||
@@ -29,6 +34,8 @@ public class ProxyConfig {
|
||||
private Integer readIdleTime;
|
||||
private Integer writeIdleTime;
|
||||
private Integer allIdleTimeSeconds;
|
||||
// 水位线
|
||||
private String waterMark;
|
||||
}
|
||||
|
||||
@Data
|
||||
@@ -71,4 +78,38 @@ public class ProxyConfig {
|
||||
private String puppetPortRange;
|
||||
private Boolean transferLogEnable;
|
||||
}
|
||||
|
||||
|
||||
private WriteBufferWaterMark waterMark;
|
||||
private boolean isParseWaterMark = false;
|
||||
|
||||
public synchronized WriteBufferWaterMark getWaterMark() {
|
||||
if (isParseWaterMark) {
|
||||
return waterMark;
|
||||
}
|
||||
isParseWaterMark = true;
|
||||
if (null == protocol || StrUtil.isBlank(protocol.getWaterMark())) {
|
||||
return null;
|
||||
}
|
||||
String[] tmp = protocol.getWaterMark().split("/");
|
||||
if (tmp.length != 2) {
|
||||
log.info("[配置解析] 水位线配置参数格式有误! config={}", protocol.getWaterMark());
|
||||
return null;
|
||||
}
|
||||
String lowStr = tmp[0].trim();
|
||||
String highStr = tmp[1].trim();
|
||||
if (!StringUtil.isBytesDesc(lowStr) || !StringUtil.isBytesDesc(highStr)) {
|
||||
log.info("[配置解析] 水位线配置参数格式有误! config={}", protocol.getWaterMark());
|
||||
return null;
|
||||
}
|
||||
Long low = StringUtil.parseBytes(lowStr);
|
||||
Long high = StringUtil.parseBytes(highStr);
|
||||
if (null == low || null == high || low >= high) {
|
||||
log.info("[配置解析] 水位线配置参数格式或大小有误! config={}", protocol.getWaterMark());
|
||||
return null;
|
||||
}
|
||||
waterMark = new WriteBufferWaterMark(low.intValue(), high.intValue());
|
||||
log.info("[配置解析] 水位线配置 config={},low={},high={}", protocol.getWaterMark(), low.intValue(), high.intValue());
|
||||
return waterMark;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
package org.dromara.neutrinoproxy.client.config;
|
||||
|
||||
import io.netty.channel.ChannelInitializer;
|
||||
import io.netty.channel.ChannelOption;
|
||||
import io.netty.channel.ChannelPipeline;
|
||||
import io.netty.channel.*;
|
||||
import io.netty.channel.nio.NioEventLoopGroup;
|
||||
import io.netty.channel.socket.SocketChannel;
|
||||
import io.netty.channel.socket.nio.NioDatagramChannel;
|
||||
@@ -16,7 +14,6 @@ import org.dromara.neutrinoproxy.core.aot.NeutrinoCoreRuntimeNativeRegistrar;
|
||||
import org.dromara.neutrinoproxy.core.dispatcher.DefaultDispatcher;
|
||||
import org.dromara.neutrinoproxy.core.dispatcher.Dispatcher;
|
||||
import io.netty.bootstrap.Bootstrap;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import org.noear.solon.Solon;
|
||||
import org.noear.solon.annotation.Bean;
|
||||
import org.noear.solon.annotation.Configuration;
|
||||
@@ -108,6 +105,12 @@ public class ProxyConfiguration implements LifecycleBean {
|
||||
Bootstrap bootstrap = new Bootstrap();
|
||||
bootstrap.group(tunnelWorkGroup);
|
||||
bootstrap.channel(NioSocketChannel.class);
|
||||
|
||||
WriteBufferWaterMark waterMark = proxyConfig.getWaterMark();
|
||||
if (null != waterMark) {
|
||||
bootstrap.option(ChannelOption.WRITE_BUFFER_WATER_MARK, waterMark);
|
||||
}
|
||||
|
||||
bootstrap.remoteAddress(InetSocketAddress.createUnresolved(proxyConfig.getTunnel().getServerIp(), proxyConfig.getTunnel().getServerPort()));
|
||||
bootstrap.handler(new ChannelInitializer<SocketChannel>() {
|
||||
|
||||
@@ -165,6 +168,12 @@ public class ProxyConfiguration implements LifecycleBean {
|
||||
Bootstrap bootstrap = new Bootstrap();
|
||||
bootstrap.group(tcpRealServerWorkGroup);
|
||||
bootstrap.channel(NioSocketChannel.class);
|
||||
|
||||
WriteBufferWaterMark waterMark = proxyConfig.getWaterMark();
|
||||
if (null != waterMark) {
|
||||
bootstrap.option(ChannelOption.WRITE_BUFFER_WATER_MARK, waterMark);
|
||||
}
|
||||
|
||||
bootstrap.handler(new ChannelInitializer<SocketChannel>() {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.dromara.neutrinoproxy.client.core;
|
||||
|
||||
import io.netty.handler.codec.DecoderException;
|
||||
import org.dromara.neutrinoproxy.client.config.ProxyConfig;
|
||||
import org.dromara.neutrinoproxy.client.util.ProxyUtil;
|
||||
import org.dromara.neutrinoproxy.core.Constants;
|
||||
@@ -13,6 +14,9 @@ import io.netty.handler.timeout.IdleStateEvent;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.noear.solon.Solon;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.SocketException;
|
||||
|
||||
/**
|
||||
* 处理与服务端之间的数据传输
|
||||
* @author: aoshiguchen
|
||||
@@ -58,8 +62,29 @@ public class CmdChannelHandler extends SimpleChannelInboundHandler<ProxyMessage>
|
||||
|
||||
@Override
|
||||
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
|
||||
log.error("[CMD Channel]Client CmdChannel Error channelId:{}", ctx.channel().id().asLongText(), cause);
|
||||
ctx.close();
|
||||
// 对于网络IO异常(致命异常),关闭channel以防止资源泄漏
|
||||
// 对于其他异常(可能是可恢复的业务异常),只记录日志
|
||||
if (cause instanceof IOException) {
|
||||
// IOException及其子类(包括SocketException)都是致命的网络异常
|
||||
if (cause instanceof SocketException && cause.getMessage() != null && cause.getMessage().contains("Connection reset")) {
|
||||
// Connection reset是常见的客户端断开,使用debug级别
|
||||
log.debug("[Cmd Channel] Client connection reset: {}", cause.getMessage());
|
||||
} else {
|
||||
log.error("[Cmd Channel] IO Error", cause);
|
||||
}
|
||||
if (ctx.channel().isActive()) {
|
||||
ctx.channel().close();
|
||||
}
|
||||
} else if(cause instanceof DecoderException) {
|
||||
// 协议解析错误,为防止数据污染,立即关闭
|
||||
log.debug("[Cmd Channel] decoder error: {}", cause.getMessage());
|
||||
if (ctx.channel().isActive()) {
|
||||
ctx.channel().close();
|
||||
}
|
||||
} else {
|
||||
// 其他异常只记录日志,不关闭channel,让Netty自己处理
|
||||
log.error("[Cmd Channel] error", cause);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,24 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package org.dromara.neutrinoproxy.client.core;
|
||||
|
||||
import java.util.concurrent.ThreadFactory;
|
||||
|
||||
@@ -1,25 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.dromara.neutrinoproxy.client.core;
|
||||
|
||||
import io.netty.channel.Channel;
|
||||
|
||||
@@ -1,36 +1,16 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.dromara.neutrinoproxy.client.core;
|
||||
|
||||
import io.netty.buffer.Unpooled;
|
||||
import io.netty.channel.*;
|
||||
import io.netty.handler.codec.DecoderException;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.neutrinoproxy.client.util.ProxyUtil;
|
||||
import org.dromara.neutrinoproxy.core.Constants;
|
||||
import org.dromara.neutrinoproxy.core.ProxyMessage;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.channel.Channel;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import io.netty.channel.ChannelOption;
|
||||
import io.netty.channel.SimpleChannelInboundHandler;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.SocketException;
|
||||
|
||||
/**
|
||||
* 处理与被代理客户端的数据传输
|
||||
@@ -77,9 +57,10 @@ public class RealServerChannelHandler extends SimpleChannelInboundHandler<ByteBu
|
||||
Channel realServerChannel = ctx.channel();
|
||||
String visitorId = ProxyUtil.getVisitorIdByRealServerChannel(realServerChannel);
|
||||
ProxyUtil.removeRealServerChannel(visitorId);
|
||||
Channel channel = realServerChannel.attr(Constants.NEXT_CHANNEL).get();
|
||||
if (channel != null) {
|
||||
channel.writeAndFlush(ProxyMessage.buildDisconnectMessage(visitorId));
|
||||
Channel proxyChannel = realServerChannel.attr(Constants.NEXT_CHANNEL).get();
|
||||
if (proxyChannel != null && proxyChannel.isActive()) {
|
||||
// channel.writeAndFlush(ProxyMessage.buildDisconnectMessage(visitorId));
|
||||
proxyChannel.writeAndFlush(Unpooled.EMPTY_BUFFER).addListener(ChannelFutureListener.CLOSE);
|
||||
}
|
||||
|
||||
super.channelInactive(ctx);
|
||||
@@ -98,6 +79,28 @@ public class RealServerChannelHandler extends SimpleChannelInboundHandler<ByteBu
|
||||
|
||||
@Override
|
||||
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
|
||||
log.error("Client ProxyChannel Error", cause);
|
||||
// 对于网络IO异常(致命异常),关闭channel以防止资源泄漏
|
||||
// 对于其他异常(可能是可恢复的业务异常),只记录日志
|
||||
if (cause instanceof IOException) {
|
||||
// IOException及其子类(包括SocketException)都是致命的网络异常
|
||||
if (cause instanceof SocketException && cause.getMessage() != null && cause.getMessage().contains("Connection reset")) {
|
||||
// Connection reset是常见的客户端断开,使用debug级别
|
||||
log.debug("[Real Server Channel] Client connection reset: {}", cause.getMessage());
|
||||
} else {
|
||||
log.error("[Real Server Channel] IO Error", cause);
|
||||
}
|
||||
if (ctx.channel().isActive()) {
|
||||
ctx.channel().close();
|
||||
}
|
||||
} else if(cause instanceof DecoderException) {
|
||||
// 协议解析错误,为防止数据污染,立即关闭
|
||||
log.debug("[Real Server Channel] decoder error: {}", cause.getMessage());
|
||||
if (ctx.channel().isActive()) {
|
||||
ctx.channel().close();
|
||||
}
|
||||
} else {
|
||||
// 其他异常只记录日志,不关闭channel,让Netty自己处理
|
||||
log.error("[Real Server Channel] error", cause);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
package org.dromara.neutrinoproxy.client.core;
|
||||
|
||||
import io.netty.channel.Channel;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import io.netty.channel.ChannelOption;
|
||||
import io.netty.channel.SimpleChannelInboundHandler;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import io.netty.channel.*;
|
||||
import io.netty.handler.codec.DecoderException;
|
||||
import io.netty.handler.timeout.IdleStateEvent;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.neutrinoproxy.client.util.ProxyUtil;
|
||||
@@ -12,6 +11,9 @@ import org.dromara.neutrinoproxy.core.ProxyMessage;
|
||||
import org.dromara.neutrinoproxy.core.dispatcher.Dispatcher;
|
||||
import org.noear.solon.Solon;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.SocketException;
|
||||
|
||||
/**
|
||||
* 处理与服务端之间的数据传输
|
||||
* @author: aoshiguchen
|
||||
@@ -43,18 +45,43 @@ public class TcpProxyChannelHandler extends SimpleChannelInboundHandler<ProxyMes
|
||||
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
|
||||
// 数据传输连接
|
||||
Channel realServerChannel = ctx.channel().attr(Constants.NEXT_CHANNEL).get();
|
||||
if (realServerChannel != null && realServerChannel.isActive()) {
|
||||
realServerChannel.close();
|
||||
if (null != realServerChannel && realServerChannel.isActive()) {
|
||||
// realServerChannel.close();
|
||||
realServerChannel.writeAndFlush(Unpooled.EMPTY_BUFFER).addListener(ChannelFutureListener.CLOSE);
|
||||
}
|
||||
|
||||
ProxyUtil.returnTcpProxyChanel(ctx.channel());
|
||||
ctx.channel().attr(Constants.NEXT_CHANNEL).remove();
|
||||
ProxyUtil.removeTcpProxyChanel(ctx.channel());
|
||||
|
||||
super.channelInactive(ctx);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
|
||||
log.error("[TCP Proxy Channel]Client ProxyChannel Error channelId:{}", ctx.channel().id().asLongText(), cause);
|
||||
ctx.close();
|
||||
// 对于网络IO异常(致命异常),关闭channel以防止资源泄漏
|
||||
// 对于其他异常(可能是可恢复的业务异常),只记录日志
|
||||
if (cause instanceof IOException) {
|
||||
// IOException及其子类(包括SocketException)都是致命的网络异常
|
||||
if (cause instanceof SocketException && cause.getMessage() != null && cause.getMessage().contains("Connection reset")) {
|
||||
// Connection reset是常见的客户端断开,使用debug级别
|
||||
log.debug("[TCP Proxy Channel] Client connection reset: {}", cause.getMessage());
|
||||
} else {
|
||||
log.error("[TCP Proxy Channel] IO Error", cause);
|
||||
}
|
||||
if (ctx.channel().isActive()) {
|
||||
ctx.channel().close();
|
||||
}
|
||||
} else if(cause instanceof DecoderException) {
|
||||
// 协议解析错误,为防止数据污染,立即关闭
|
||||
log.debug("[TCP Proxy Channel] decoder error: {}", cause.getMessage());
|
||||
if (ctx.channel().isActive()) {
|
||||
ctx.channel().close();
|
||||
}
|
||||
} else {
|
||||
// 其他异常只记录日志,不关闭channel,让Netty自己处理
|
||||
log.error("[TCP Proxy Channel] error", cause);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
package org.dromara.neutrinoproxy.client.core;
|
||||
|
||||
import io.netty.channel.Channel;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import io.netty.channel.ChannelOption;
|
||||
import io.netty.channel.SimpleChannelInboundHandler;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import io.netty.channel.*;
|
||||
import io.netty.handler.codec.DecoderException;
|
||||
import io.netty.handler.timeout.IdleStateEvent;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.neutrinoproxy.client.util.ProxyUtil;
|
||||
@@ -12,6 +11,9 @@ import org.dromara.neutrinoproxy.core.ProxyMessage;
|
||||
import org.dromara.neutrinoproxy.core.dispatcher.Dispatcher;
|
||||
import org.noear.solon.Solon;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.SocketException;
|
||||
|
||||
/**
|
||||
* 处理与服务端之间的数据传输
|
||||
* @author: aoshiguchen
|
||||
@@ -44,17 +46,40 @@ public class UdpProxyChannelHandler extends SimpleChannelInboundHandler<ProxyMes
|
||||
// 数据传输连接
|
||||
Channel realServerChannel = ctx.channel().attr(Constants.NEXT_CHANNEL).get();
|
||||
if (realServerChannel != null && realServerChannel.isActive()) {
|
||||
realServerChannel.close();
|
||||
// realServerChannel.close();
|
||||
realServerChannel.writeAndFlush(Unpooled.EMPTY_BUFFER).addListener(ChannelFutureListener.CLOSE);
|
||||
}
|
||||
|
||||
ProxyUtil.removeTcpProxyChanel(ctx.channel());
|
||||
ProxyUtil.returnUdpProxyChanel(ctx.channel());
|
||||
ProxyUtil.removeUdpProxyChanel(ctx.channel());
|
||||
super.channelInactive(ctx);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
|
||||
log.error("[UDP Proxy Channel]Client ProxyChannel Error channelId:{}", ctx.channel().id().asLongText(), cause);
|
||||
ctx.close();
|
||||
// 对于网络IO异常(致命异常),关闭channel以防止资源泄漏
|
||||
// 对于其他异常(可能是可恢复的业务异常),只记录日志
|
||||
if (cause instanceof IOException) {
|
||||
// IOException及其子类(包括SocketException)都是致命的网络异常
|
||||
if (cause instanceof SocketException && cause.getMessage() != null && cause.getMessage().contains("Connection reset")) {
|
||||
// Connection reset是常见的客户端断开,使用debug级别
|
||||
log.debug("[UDP Proxy Channel] Client connection reset: {}", cause.getMessage());
|
||||
} else {
|
||||
log.error("[UDP Proxy Channel] IO Error", cause);
|
||||
}
|
||||
if (ctx.channel().isActive()) {
|
||||
ctx.channel().close();
|
||||
}
|
||||
} else if(cause instanceof DecoderException) {
|
||||
// 协议解析错误,为防止数据污染,立即关闭
|
||||
log.debug("[UDP Proxy Channel] decoder error: {}", cause.getMessage());
|
||||
if (ctx.channel().isActive()) {
|
||||
ctx.channel().close();
|
||||
}
|
||||
} else {
|
||||
// 其他异常只记录日志,不关闭channel,让Netty自己处理
|
||||
log.error("[UDP Proxy Channel] error", cause);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -63,16 +88,18 @@ public class UdpProxyChannelHandler extends SimpleChannelInboundHandler<ProxyMes
|
||||
IdleStateEvent event = (IdleStateEvent)evt;
|
||||
switch (event.state()) {
|
||||
case READER_IDLE:
|
||||
// 读超时,断开连接
|
||||
log.info("[UDP Proxy Channel]Read timeout");
|
||||
ctx.channel().close();
|
||||
if (ctx.channel().isWritable()) {
|
||||
// 读超时,断开连接
|
||||
log.info("[UDP Proxy Channel]Read timeout");
|
||||
ctx.channel().close();
|
||||
}
|
||||
break;
|
||||
case WRITER_IDLE:
|
||||
ctx.channel().writeAndFlush(ProxyMessage.buildHeartbeatMessage());
|
||||
break;
|
||||
case ALL_IDLE:
|
||||
log.debug("[UDP Proxy Channel]ReadWrite timeout");
|
||||
ctx.close();
|
||||
// log.debug("[UDP Proxy Channel]ReadWrite timeout");
|
||||
// ctx.close();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,12 +3,16 @@ package org.dromara.neutrinoproxy.client.core;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import io.netty.channel.SimpleChannelInboundHandler;
|
||||
import io.netty.channel.socket.DatagramPacket;
|
||||
import io.netty.handler.codec.DecoderException;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.neutrinoproxy.client.constant.Constants;
|
||||
import org.dromara.neutrinoproxy.client.util.UdpChannelBindInfo;
|
||||
import org.dromara.neutrinoproxy.core.ProxyMessage;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.SocketException;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author: aoshiguchen
|
||||
@@ -36,6 +40,47 @@ public class UdpRealServerHandler extends SimpleChannelInboundHandler<DatagramPa
|
||||
);
|
||||
|
||||
udpChannelBindInfo.getLockChannel().setResponseCount(udpChannelBindInfo.getLockChannel().getResponseCount() + 1);
|
||||
udpChannelBindInfo.getLockChannel().setLastActiveTime(new Date());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
|
||||
// 对于网络IO异常(致命异常),关闭channel以防止资源泄漏
|
||||
// 对于其他异常(可能是可恢复的业务异常),只记录日志
|
||||
if (cause instanceof IOException) {
|
||||
// IOException及其子类(包括SocketException)都是致命的网络异常
|
||||
if (cause instanceof SocketException && cause.getMessage() != null && cause.getMessage().contains("Connection reset")) {
|
||||
// Connection reset是常见的客户端断开,使用debug级别
|
||||
log.debug("[UDP RealServer Channel] Client connection reset: {}", cause.getMessage());
|
||||
} else {
|
||||
log.error("[UDP RealServer Channel] IO Error", cause);
|
||||
}
|
||||
if (ctx.channel().isActive()) {
|
||||
ctx.channel().close();
|
||||
}
|
||||
} else if(cause instanceof DecoderException) {
|
||||
// 协议解析错误,为防止数据污染,立即关闭
|
||||
log.debug("[UDP RealServer Channel] decoder error: {}", cause.getMessage());
|
||||
if (ctx.channel().isActive()) {
|
||||
ctx.channel().close();
|
||||
}
|
||||
} else {
|
||||
// 其他异常只记录日志,不关闭channel,让Netty自己处理
|
||||
log.error("[UDP RealServer Channel] error", cause);
|
||||
}
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public void channelInactive(ChannelHandlerContext ctx) throws Exception {
|
||||
// // 数据传输连接
|
||||
// Channel realServerChannel = ctx.channel().attr(org.dromara.neutrinoproxy.core.Constants.NEXT_CHANNEL).get();
|
||||
// if (realServerChannel != null && realServerChannel.isActive()) {
|
||||
// // realServerChannel.close();
|
||||
// realServerChannel.writeAndFlush(Unpooled.EMPTY_BUFFER).addListener(ChannelFutureListener.CLOSE);
|
||||
// }
|
||||
//
|
||||
// ProxyUtil.removeUdpProxyChanel(ctx.channel());
|
||||
// super.channelInactive(ctx);
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -1,14 +1,10 @@
|
||||
package org.dromara.neutrinoproxy.client.handler;
|
||||
|
||||
import org.dromara.neutrinoproxy.client.util.ProxyUtil;
|
||||
import org.dromara.neutrinoproxy.core.Constants;
|
||||
import org.dromara.neutrinoproxy.core.ProxyDataTypeEnum;
|
||||
import org.dromara.neutrinoproxy.core.ProxyMessage;
|
||||
import org.dromara.neutrinoproxy.core.ProxyMessageHandler;
|
||||
import org.dromara.neutrinoproxy.core.dispatcher.Match;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import io.netty.channel.Channel;
|
||||
import io.netty.channel.ChannelFutureListener;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import org.noear.solon.annotation.Component;
|
||||
|
||||
@@ -23,12 +19,12 @@ public class ProxyMessageDisconnectHandler implements ProxyMessageHandler {
|
||||
|
||||
@Override
|
||||
public void handle(ChannelHandlerContext ctx, ProxyMessage proxyMessage) {
|
||||
Channel realServerChannel = ctx.channel().attr(Constants.NEXT_CHANNEL).get();
|
||||
if (null != realServerChannel) {
|
||||
ctx.channel().attr(Constants.NEXT_CHANNEL).remove();
|
||||
ProxyUtil.returnTcpProxyChanel(ctx.channel());
|
||||
realServerChannel.writeAndFlush(Unpooled.EMPTY_BUFFER).addListener(ChannelFutureListener.CLOSE);
|
||||
}
|
||||
// Channel realServerChannel = ctx.channel().attr(Constants.NEXT_CHANNEL).get();
|
||||
// if (null != realServerChannel) {
|
||||
// ctx.channel().attr(Constants.NEXT_CHANNEL).remove();
|
||||
// ProxyUtil.returnTcpProxyChanel(ctx.channel());
|
||||
// realServerChannel.writeAndFlush(Unpooled.EMPTY_BUFFER).addListener(ChannelFutureListener.CLOSE);
|
||||
// }
|
||||
ctx.close();
|
||||
}
|
||||
|
||||
|
||||
@@ -23,6 +23,8 @@ public class LockChannel {
|
||||
private long proxyTimeoutMs;
|
||||
// 被获取的时间
|
||||
private Date takeTime;
|
||||
// 已经响应的次数
|
||||
// 最后一次活跃的时间(最后发生读写的时间),每次发送或响应需要重置
|
||||
private Date lastActiveTime;
|
||||
// 已经响应的次数(相对于最后一次发送的时,每次发送后需要重置)
|
||||
private int responseCount;
|
||||
}
|
||||
|
||||
@@ -1,24 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package org.dromara.neutrinoproxy.client.util;
|
||||
|
||||
import io.netty.channel.ChannelHandler;
|
||||
@@ -201,8 +180,7 @@ public class ProxyUtil {
|
||||
}
|
||||
|
||||
public static ChannelHandler createSslHandler(ProxyConfig proxyConfig) {
|
||||
try {
|
||||
InputStream jksInputStream = FileUtil.getInputStream(proxyConfig.getTunnel().getJksPath());
|
||||
try (InputStream jksInputStream = FileUtil.getInputStream(proxyConfig.getTunnel().getJksPath())) {
|
||||
|
||||
SSLContext clientContext = SSLContext.getInstance("TLS");
|
||||
final KeyStore ks = KeyStore.getInstance("JKS");
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
package org.dromara.neutrinoproxy.client.util;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* @author: aoshiguchen
|
||||
* @date: 2023/12/15
|
||||
*/
|
||||
public class StringUtil {
|
||||
private static final Integer BYTES_MUL_KB = 1024;
|
||||
private static final Integer BYTES_MUL_MB = BYTES_MUL_KB * 1024;
|
||||
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+\\.*\\d*)\\s*(B|K|KB|M|MB|G|GB)\\s*";
|
||||
private static final Pattern BYTES_DESC_PATTERN = Pattern.compile(BYTES_DESC_REGEX);
|
||||
|
||||
/**
|
||||
* 校验是否符合字节描述
|
||||
* @param desc
|
||||
* @return
|
||||
*/
|
||||
public static boolean isBytesDesc(String desc) {
|
||||
if (StrUtil.isBlank(desc)) {
|
||||
return false;
|
||||
}
|
||||
return desc.toUpperCase().matches(BYTES_DESC_REGEX);
|
||||
}
|
||||
|
||||
/**
|
||||
* 解析字节数
|
||||
* 支持B、K、KB、M、MB、G、GB 忽略大小写、忽略首尾空格、忽略数字与单位之间的空格
|
||||
* @param desc
|
||||
* @return
|
||||
*/
|
||||
public static Long parseBytes(String desc) {
|
||||
try {
|
||||
if (!isBytesDesc(desc)) {
|
||||
return null;
|
||||
}
|
||||
Matcher matcher = BYTES_DESC_PATTERN.matcher(desc.toUpperCase());
|
||||
boolean found = matcher.find();
|
||||
if (!found) {
|
||||
return null;
|
||||
}
|
||||
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]);
|
||||
} catch (Exception e) {
|
||||
// ignore
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private static Integer getBytesUnitIndex(String unit) {
|
||||
if (StrUtil.isBlank(unit)) {
|
||||
return null;
|
||||
}
|
||||
for (int i = 0; i < BYTES_UNIT_STR.length; i++) {
|
||||
if (unit.equals(BYTES_UNIT_STR[i])) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -133,28 +133,40 @@ public class UdpServerUtil {
|
||||
* @return
|
||||
*/
|
||||
public static synchronized Channel takeChannel(ProxyMessage.UdpBaseInfo info, Channel tunnelChannel) {
|
||||
if (info.getProxyResponses() <= 0 || info.getProxyTimeoutMs() <= 0) {
|
||||
Channel realServerChannel = tunnelChannel.attr(org.dromara.neutrinoproxy.core.Constants.NEXT_CHANNEL).get();
|
||||
if (null != realServerChannel) {
|
||||
UdpChannelBindInfo udpChannelBindInfo = realServerChannel.attr(Constants.UDP_CHANNEL_BIND_KEY).get();
|
||||
// 每次发送前重置
|
||||
udpChannelBindInfo.getLockChannel().setResponseCount(0);
|
||||
udpChannelBindInfo.getLockChannel().setLastActiveTime(new Date());
|
||||
|
||||
return realServerChannel;
|
||||
}
|
||||
// 响应数量为零、超时时间<=0,则不需要响应(注意:响应数量为-1 则不限制响应数量)
|
||||
if (info.getProxyResponses() == 0 || info.getProxyTimeoutMs() <= 0) {
|
||||
return defaultUdpServerChannel;
|
||||
}
|
||||
// 没有空闲的 傀儡端口,降级为不需要响应
|
||||
Integer port = udpServerFreePortPool.poll();
|
||||
if (null == port) {
|
||||
return defaultUdpServerChannel;
|
||||
}
|
||||
Channel channel = portToChannelMap.get(port);
|
||||
if (null == channel) {
|
||||
channel = bindPort(port);
|
||||
portToChannelMap.put(port, channel);
|
||||
realServerChannel = portToChannelMap.get(port);
|
||||
if (null == realServerChannel) {
|
||||
realServerChannel = bindPort(port);
|
||||
portToChannelMap.put(port, realServerChannel);
|
||||
}
|
||||
// 添加到锁定队列
|
||||
LockChannel lockChannel = new LockChannel()
|
||||
.setPort(port)
|
||||
.setChannel(channel)
|
||||
.setChannel(realServerChannel)
|
||||
.setProxyResponses(info.getProxyResponses())
|
||||
.setProxyTimeoutMs(info.getProxyTimeoutMs())
|
||||
.setTakeTime(new Date())
|
||||
.setLastActiveTime(new Date())
|
||||
.setResponseCount(0);
|
||||
lockChannelList.add(lockChannel);
|
||||
channel.attr(Constants.UDP_CHANNEL_BIND_KEY).set(new UdpChannelBindInfo()
|
||||
realServerChannel.attr(Constants.UDP_CHANNEL_BIND_KEY).set(new UdpChannelBindInfo()
|
||||
.setTunnelChannel(tunnelChannel)
|
||||
.setVisitorId(info.getVisitorId())
|
||||
.setVisitorIp(info.getVisitorIp())
|
||||
@@ -164,7 +176,12 @@ public class UdpServerUtil {
|
||||
.setTargetPort(info.getTargetPort())
|
||||
.setLockChannel(lockChannel)
|
||||
);
|
||||
return channel;
|
||||
|
||||
// 连接绑定
|
||||
realServerChannel.attr(org.dromara.neutrinoproxy.core.Constants.NEXT_CHANNEL).set(tunnelChannel);
|
||||
tunnelChannel.attr(org.dromara.neutrinoproxy.core.Constants.NEXT_CHANNEL).set(realServerChannel);
|
||||
|
||||
return realServerChannel;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -177,8 +194,8 @@ public class UdpServerUtil {
|
||||
Iterator<LockChannel> iter = lockChannelList.iterator();
|
||||
if (iter.hasNext()) {
|
||||
LockChannel lockChannel = iter.next();
|
||||
if (lockChannel.getResponseCount() >= lockChannel.getProxyResponses() ||
|
||||
System.currentTimeMillis() - lockChannel.getTakeTime().getTime() >= lockChannel.getProxyTimeoutMs()
|
||||
if ((lockChannel.getProxyResponses() > 0 && lockChannel.getResponseCount() >= lockChannel.getProxyResponses()) ||
|
||||
System.currentTimeMillis() - lockChannel.getLastActiveTime().getTime() > lockChannel.getProxyTimeoutMs()
|
||||
) {
|
||||
iter.remove();
|
||||
UdpChannelBindInfo udpChannelBindInfo = lockChannel.getChannel().attr(Constants.UDP_CHANNEL_BIND_KEY).get();
|
||||
@@ -186,6 +203,17 @@ public class UdpServerUtil {
|
||||
closeChannel(udpChannelBindInfo.getTunnelChannel());
|
||||
lockChannel.getChannel().attr(Constants.UDP_CHANNEL_BIND_KEY).set(null);
|
||||
udpServerFreePortPool.offer(lockChannel.getPort());
|
||||
|
||||
// 连接解绑
|
||||
Channel realServerChannel = lockChannel.getChannel();
|
||||
Channel tunnelChannel = realServerChannel.attr(org.dromara.neutrinoproxy.core.Constants.NEXT_CHANNEL).get();
|
||||
if (null != realServerChannel) {
|
||||
realServerChannel.attr(org.dromara.neutrinoproxy.core.Constants.NEXT_CHANNEL).set(null);
|
||||
}
|
||||
if (null != tunnelChannel) {
|
||||
tunnelChannel.attr(org.dromara.neutrinoproxy.core.Constants.NEXT_CHANNEL).set(null);
|
||||
}
|
||||
|
||||
log.debug("[udp channel]release udp channel port:{}", lockChannel.getPort());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
solon.logging.logger:
|
||||
"root":
|
||||
level: info
|
||||
|
||||
neutrino:
|
||||
proxy:
|
||||
protocol:
|
||||
# 高低水位线,如:32KB/64KB、32KB/1MB、1MB/5MB
|
||||
# water-mark: 1MB/8MB
|
||||
tunnel:
|
||||
# 线程池相关配置,用于技术调优,可忽略
|
||||
thread-count: 50
|
||||
# 隧道SSL证书配置
|
||||
key-store-password: 123456
|
||||
jks-path: classpath:/test.jks
|
||||
# 服务端IP
|
||||
server-ip: ${SERVER_IP:localhost}
|
||||
# 服务端端口(对应服务端app.yml中的tunnel.port、tunnel.ssl-port)
|
||||
server-port: ${SERVER_PORT:9002}
|
||||
# 是否启用SSL(注意:该配置必须和server-port对应上)
|
||||
ssl-enable: ${SSL_ENABLE:true}
|
||||
# 客户端连接唯一凭证
|
||||
license-key: ${LICENSE_KEY:}
|
||||
# 客户端唯一身份标识(可忽略,若不设置首次启动会自动生成)
|
||||
client-id:
|
||||
# 是否开启隧道传输报文日志(日志级别为debug时开启才有效)
|
||||
transfer-log-enable: false
|
||||
# 是否开启心跳日志
|
||||
heartbeat-log-enable: false
|
||||
# 重连设置
|
||||
reconnection:
|
||||
# 重连间隔(秒)
|
||||
interval-seconds: 10
|
||||
# 是否开启无限重连(未开启时,客户端license不合法会自动停止应用,开启了则不会,请谨慎开启)
|
||||
unlimited: false
|
||||
client:
|
||||
udp:
|
||||
# 线程池相关配置,用于技术调优,可忽略
|
||||
boss-thread-count: 5
|
||||
work-thread-count: 20
|
||||
# udp傀儡端口范围
|
||||
puppet-port-range: 10000-10500
|
||||
# 是否开启隧道传输报文日志(日志级别为debug时开启才有效)
|
||||
transfer-log-enable: false
|
||||
@@ -1,16 +1,22 @@
|
||||
solon:
|
||||
config:
|
||||
add: ./app.yml
|
||||
app:
|
||||
name: neutrino-proxy-client
|
||||
version: 2.0.4
|
||||
# 日志级别
|
||||
solon.logging.appender:
|
||||
console:
|
||||
pattern: "%d{yyyy-MM-dd HH:mm:ss.SSS} %highlight(%-5level) %magenta(${PID:-}) --- %-15([%15.15thread]) %-56(%cyan(%-40.40logger{39}%L)) : %msg%n"
|
||||
file:
|
||||
enable: false
|
||||
enable: true
|
||||
pattern: "%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level ${PID:-} --- %-15([%15.15thread]) %-56(%-40.40logger{39}%L) : %msg%n"
|
||||
name: "logs/${neutrino.application.name}"
|
||||
rolling: "logs/${neutrino.application.name}_%d{yyyy-MM-dd}_%i.log.gz"
|
||||
solon.logging.logger:
|
||||
"root":
|
||||
# level: ${LOG_LEVEL:info}
|
||||
level: info
|
||||
|
||||
neutrino:
|
||||
application:
|
||||
name: neutrino-proxy-client
|
||||
@@ -25,6 +31,8 @@ neutrino:
|
||||
read-idle-time: 120
|
||||
write-idle-time: 20
|
||||
all-idle-time-seconds: 0
|
||||
# 高低水位线,如:32KB/64KB、32KB/1MB、1MB/5MB
|
||||
# water-mark: 1MB/8MB
|
||||
tunnel:
|
||||
# 线程池相关配置,用于技术调优,可忽略
|
||||
thread-count: 50
|
||||
|
||||
@@ -30,10 +30,10 @@
|
||||
<artifactId>hutool-core</artifactId>
|
||||
<version>${hutool.version}</version>
|
||||
</dependency>
|
||||
<!--lombok-->
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-cache</artifactId>
|
||||
<version>${hutool.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
@@ -1,24 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package org.dromara.neutrinoproxy.core;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
@@ -1,31 +1,10 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.dromara.neutrinoproxy.core;
|
||||
|
||||
import io.netty.channel.Channel;
|
||||
import io.netty.util.AttributeKey;
|
||||
|
||||
import java.net.InetSocketAddress;
|
||||
import java.util.function.BiConsumer;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -49,6 +28,14 @@ public interface Constants {
|
||||
AttributeKey<Boolean> IS_UDP_KEY = AttributeKey.newInstance("isUdp");
|
||||
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");
|
||||
|
||||
AttributeKey<ProxyAttachment> PROXY_CONNECT_ATTACHMENT = AttributeKey.newInstance("proxyConnectAttachment");;
|
||||
|
||||
|
||||
int HEADER_SIZE = 4;
|
||||
int TYPE_SIZE = 1;
|
||||
@@ -67,4 +54,20 @@ public interface Constants {
|
||||
String ERROR = "ERROR";
|
||||
String PORT_MAPPING_SYNC = "PORT_MAPPING_SYNC";
|
||||
}
|
||||
|
||||
class ProxyAttachment {
|
||||
private byte[] bytes;
|
||||
private BiConsumer<Channel, byte[]> executor;
|
||||
|
||||
public ProxyAttachment(byte[] bytes, BiConsumer<Channel, byte[]> executor) {
|
||||
this.bytes = bytes;
|
||||
this.executor = executor;
|
||||
}
|
||||
|
||||
public void execute(Channel channel) {
|
||||
if (null != executor && null != channel && channel.isActive()) {
|
||||
this.executor.accept(channel, bytes);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,25 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.dromara.neutrinoproxy.core;
|
||||
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
|
||||
@@ -1,25 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.dromara.neutrinoproxy.core;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,25 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.dromara.neutrinoproxy.core;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
|
||||
@@ -1,25 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.dromara.neutrinoproxy.core;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,25 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.dromara.neutrinoproxy.core;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
@@ -1,25 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.dromara.neutrinoproxy.core;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
@@ -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,9 +23,18 @@ 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);
|
||||
|
||||
metadata.registerArg("--add-opens java.base/java.lang.invoke=ALL-UNNAMED --add-exports=java.base/jdk.internal.misc=ALL-UNNAMED");
|
||||
metadata.registerArg("-J--add-opens=java.base/java.lang.invoke=ALL-UNNAMED");
|
||||
metadata.registerArg("-J--add-opens=java.base/java.nio=ALL-UNNAMED");
|
||||
metadata.registerArg("-J--add-exports=java.base/jdk.internal.misc=ALL-UNNAMED");
|
||||
|
||||
metadata.registerArg("-march=compatibility");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,25 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.dromara.neutrinoproxy.core.base;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
|
||||
|
||||
package org.dromara.neutrinoproxy.core.base;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,25 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.dromara.neutrinoproxy.core.dispatcher;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,25 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.dromara.neutrinoproxy.core.dispatcher;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,25 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.dromara.neutrinoproxy.core.dispatcher;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
package org.dromara.neutrinoproxy.core.type;
|
||||
|
||||
/**
|
||||
|
||||
@@ -5,6 +5,7 @@ import org.dromara.neutrinoproxy.core.base.MetaDataConstant;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.io.*;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Enumeration;
|
||||
import java.util.List;
|
||||
import java.util.jar.JarEntry;
|
||||
@@ -56,7 +57,7 @@ public class FileUtil {
|
||||
* @throws IOException
|
||||
*/
|
||||
public static String readContentAsString(String path) {
|
||||
try (BufferedReader br = new BufferedReader(new InputStreamReader(getInputStream(path)))){
|
||||
try (BufferedReader br = new BufferedReader(new InputStreamReader(getInputStream(path), StandardCharsets.UTF_8))){
|
||||
return br.lines().collect(Collectors.joining("\n"));
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
@@ -70,7 +71,7 @@ public class FileUtil {
|
||||
* @throws IOException
|
||||
*/
|
||||
public static String readContentAsString(InputStream in) {
|
||||
try (BufferedReader br = new BufferedReader(new InputStreamReader(in))){
|
||||
try (BufferedReader br = new BufferedReader(new InputStreamReader(in, StandardCharsets.UTF_8))){
|
||||
return br.lines().collect(Collectors.joining("\n"));
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
@@ -84,7 +85,7 @@ public class FileUtil {
|
||||
* @throws IOException
|
||||
*/
|
||||
public static List<String> readContentAsStringList(String path) {
|
||||
try (BufferedReader br = new BufferedReader(new InputStreamReader(getInputStream(path)))){
|
||||
try (BufferedReader br = new BufferedReader(new InputStreamReader(getInputStream(path), StandardCharsets.UTF_8))){
|
||||
return br.lines().collect(Collectors.toList());
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
package org.dromara.neutrinoproxy.core.util;
|
||||
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
/**
|
||||
* @author: wen.y
|
||||
* @date: 2023/12/9
|
||||
*/
|
||||
public class HttpUtil {
|
||||
|
||||
/**
|
||||
* 获取请求头 Host 忽略端口号
|
||||
* @param httpContent
|
||||
* @return
|
||||
*/
|
||||
public static String getHostIgnorePort(String httpContent) {
|
||||
String host = getHost(httpContent);
|
||||
if (StringUtils.isEmpty(host) || !host.contains(":")) {
|
||||
return host;
|
||||
}
|
||||
return host.replaceAll(":.*", "");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取请求头 Host
|
||||
* @param httpContent
|
||||
* @return
|
||||
*/
|
||||
public static String getHost(String httpContent) {
|
||||
return getHeaderValue(httpContent, "Host");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取请求头
|
||||
* @param httpContent
|
||||
* @return
|
||||
*/
|
||||
public static String getHeaderValue(String httpContent, String header) {
|
||||
if (!httpContent.contains("\r\n\r\n")) {
|
||||
return null;
|
||||
}
|
||||
String headerContent = httpContent.split("\r\n\r\n")[0];
|
||||
if (!headerContent.contains("\r\n")) {
|
||||
return null;
|
||||
}
|
||||
String[] lines = headerContent.split("\r\n");
|
||||
if (lines.length == 0) {
|
||||
return null;
|
||||
}
|
||||
String firstLine = lines[0];
|
||||
if (!(firstLine.endsWith("HTTP/1.1") || firstLine.endsWith("HTTP/1.0"))) {
|
||||
return null;
|
||||
}
|
||||
for (int i = 1; i < lines.length; i++) {
|
||||
String line = lines[i];
|
||||
if (!line.startsWith(header + ":")) {
|
||||
continue;
|
||||
}
|
||||
if (line.length() > header.length() + 1) {
|
||||
return line.substring(header.length() + 1).trim();
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package org.dromara.neutrinoproxy.core.util;
|
||||
|
||||
import cn.hutool.core.net.Ipv4Util;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.net.InetSocketAddress;
|
||||
|
||||
@Slf4j
|
||||
public class IpUtil extends org.noear.solon.core.util.IpUtil {
|
||||
|
||||
public static String getRemoteIp(ChannelHandlerContext ctx) {
|
||||
String remoteAddress = "";
|
||||
InetSocketAddress socketAddress = (InetSocketAddress) ctx.channel().remoteAddress();
|
||||
if (socketAddress != null) {
|
||||
remoteAddress = socketAddress.getAddress().getHostAddress();
|
||||
}
|
||||
return remoteAddress;
|
||||
}
|
||||
|
||||
/**
|
||||
* 工作原理为从http协议的header中找公网地址,此主要用于处理nginx转发时塞进去的真实IP的header,找不到返回null
|
||||
* @param httpContent http协议文档内容
|
||||
* @return 返回找到的第一个公网地址
|
||||
*/
|
||||
public static String getRealRemoteIp(String httpContent) {
|
||||
String ip = HttpUtil.getHeaderValue(httpContent, "X-Forwarded-For");
|
||||
if (StringUtils.isEmpty(ip)) {
|
||||
ip = HttpUtil.getHeaderValue(httpContent, "X-Real-IP");
|
||||
}
|
||||
if (StringUtils.isNotEmpty(ip)) {
|
||||
log.debug("obtain http header ip:{}", ip);
|
||||
return ip;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package org.dromara.neutrinoproxy.core.util;
|
||||
|
||||
import org.noear.solon.Solon;
|
||||
|
||||
/**
|
||||
* @author songyinyin
|
||||
* @since 2023/10/31 11:48
|
||||
*/
|
||||
public class NeutrinoProxyVersion {
|
||||
|
||||
/**
|
||||
* 获取 NeutrinoProxy 版本号
|
||||
*/
|
||||
public static String getVersion() {
|
||||
return Solon.cfg().get("solon.app.version");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,15 +1,16 @@
|
||||
FROM openjdk:8-jdk-alpine
|
||||
FROM openjdk:21-jdk-oracle
|
||||
#同步时间
|
||||
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories && \
|
||||
apk update && apk add wget unzip vim && apk add -U tzdata && \
|
||||
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo 'Asia/Shanghai' >/etc/timezone
|
||||
#RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories && \
|
||||
# apk update && apk add wget unzip vim && apk add -U tzdata && \
|
||||
# ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo 'Asia/Shanghai' >/etc/timezone
|
||||
# 设置时区为北京时间
|
||||
ENV TZ=Asia/Shanghai
|
||||
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
||||
RUN mkdir -p /root/neutrino-proxy/config
|
||||
RUN mkdir -p /root/neutrino-proxy/neutrino-proxy-admin
|
||||
WORKDIR /root/neutrino-proxy
|
||||
COPY ../neutrino-proxy-server/target/neutrino-proxy-server.jar /root/neutrino-proxy/neutrino-proxy-server.jar
|
||||
COPY ../neutrino-proxy-server/src/main/resources/app.yml /root/neutrino-proxy/config
|
||||
COPY ../neutrino-proxy-admin/dist /root/neutrino-proxy/neutrino-proxy-admin/dist
|
||||
COPY ./target/neutrino-proxy-server.jar /root/neutrino-proxy/neutrino-proxy-server.jar
|
||||
COPY ./src/main/resources/app-copy.yml /root/neutrino-proxy/config/app.yml
|
||||
#VOLUME ["/root/neutrino-proxy"]
|
||||
ENTRYPOINT ["java","-jar","neutrino-proxy-server.jar","config=./config/app.yml"]
|
||||
|
||||
#docker run -it -p 9000-9200:9000-9200/tcp -p 8888:8888 -v /root/neutrino-proxy/config:/root/neutrino-proxy/config -d --restart=always --name neutrino registry.cn-hangzhou.aliyuncs.com/asgc/aoshiguchen-docker-images:1.7
|
||||
#docker run -it -p 9000-9200:9000-9200/tcp -p 8888:8888 -v /root/neutrino-proxy/config:/root/neutrino-proxy/config -d --restart=always --name neutrino registry.cn-hangzhou.aliyuncs.com/asgc/aoshiguchen-docker-images:1.7
|
||||
|
||||
@@ -61,6 +61,13 @@
|
||||
<build>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<filtering>true</filtering>
|
||||
<includes>
|
||||
<include>*.yml</include>
|
||||
</includes>
|
||||
</resource>
|
||||
<resource>
|
||||
<directory>${project.basedir}/src/main/resources</directory>
|
||||
<filtering>false</filtering>
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.dromara.neutrinoproxy.server;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.solonplugins.job.annotation.EnableJob;
|
||||
import org.noear.solon.Solon;
|
||||
import org.noear.solon.Utils;
|
||||
import org.noear.solon.annotation.SolonMain;
|
||||
import org.noear.solon.web.cors.CrossFilter;
|
||||
|
||||
@@ -20,6 +21,10 @@ public class ProxyServer {
|
||||
Solon.start(ProxyServer.class, args, app -> {
|
||||
// 跨域支持。加-1 优先级更高
|
||||
app.filter(-1, new CrossFilter().allowedOrigins("*"));
|
||||
String loglevel = System.getenv("LOG_LEVEL");
|
||||
if (Utils.isNotEmpty(loglevel)) {
|
||||
app.cfg().put("solon.logging.logger.root.level", loglevel);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
package org.dromara.neutrinoproxy.server.base;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.noear.solon.Solon;
|
||||
import org.noear.solon.annotation.Component;
|
||||
import org.noear.solon.core.event.AppLoadEndEvent;
|
||||
import org.noear.solon.core.event.EventListener;
|
||||
import org.noear.solon.core.runtime.NativeDetector;
|
||||
|
||||
/**
|
||||
* 启动成功后信息输出
|
||||
* @author: aoshiguchen
|
||||
* @date: 2024/10/16
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class AppLoadEndExecutor implements EventListener<AppLoadEndEvent> {
|
||||
|
||||
@Override
|
||||
public void onEvent(AppLoadEndEvent appLoadEndEvent) throws Throwable {
|
||||
// aot 阶段,不执行
|
||||
if (NativeDetector.isAotRuntime()) {
|
||||
return;
|
||||
}
|
||||
System.out.printf("""
|
||||
---------------------------------------------------------------
|
||||
Neutrino Proxy Server %s
|
||||
admin: http://localhost:%s
|
||||
account: admin/123456
|
||||
Gitee: https://gitee.com/dromara/neutrino-proxy
|
||||
GitHub: https://github.com/dromara/neutrino-proxy
|
||||
GitCode: https://gitcode.com/dromara/neutrino-proxy
|
||||
---------------------------------------------------------------
|
||||
%n""", Solon.app().cfg().get("solon.app.version"),
|
||||
Solon.app().cfg().get("server.port"));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,30 +1,14 @@
|
||||
package org.dromara.neutrinoproxy.server.base;
|
||||
|
||||
import org.apache.ibatis.type.SimpleTypeRegistry;
|
||||
import org.dromara.neutrinoproxy.server.base.proxy.ProxyConfig;
|
||||
import org.dromara.neutrinoproxy.server.base.rest.ResponseBody;
|
||||
import org.dromara.neutrinoproxy.server.controller.req.proxy.PortMappingCreateReq;
|
||||
import org.dromara.neutrinoproxy.server.controller.req.proxy.PortMappingUpdateReq;
|
||||
import org.dromara.neutrinoproxy.server.controller.res.report.HomeDataView;
|
||||
import org.dromara.neutrinoproxy.server.dal.ClientConnectRecordMapper;
|
||||
import org.dromara.neutrinoproxy.server.dal.FlowReportDayMapper;
|
||||
import org.dromara.neutrinoproxy.server.dal.FlowReportHourMapper;
|
||||
import org.dromara.neutrinoproxy.server.dal.FlowReportMinuteMapper;
|
||||
import org.dromara.neutrinoproxy.server.dal.FlowReportMonthMapper;
|
||||
import org.dromara.neutrinoproxy.server.dal.JobInfoMapper;
|
||||
import org.dromara.neutrinoproxy.server.dal.LicenseMapper;
|
||||
import org.dromara.neutrinoproxy.server.dal.PortMappingMapper;
|
||||
import org.dromara.neutrinoproxy.server.dal.PortPoolMapper;
|
||||
import org.dromara.neutrinoproxy.server.dal.UserLoginRecordMapper;
|
||||
import org.dromara.neutrinoproxy.server.dal.UserMapper;
|
||||
import org.dromara.neutrinoproxy.server.dal.UserTokenMapper;
|
||||
import org.dromara.neutrinoproxy.server.service.ClientConnectRecordService;
|
||||
import org.dromara.neutrinoproxy.server.service.JobInfoService;
|
||||
import org.dromara.neutrinoproxy.server.service.JobLogService;
|
||||
import org.dromara.neutrinoproxy.server.service.LicenseService;
|
||||
import org.dromara.neutrinoproxy.server.service.PortGroupService;
|
||||
import org.dromara.neutrinoproxy.server.service.PortMappingService;
|
||||
import org.dromara.neutrinoproxy.server.service.PortPoolService;
|
||||
import org.dromara.neutrinoproxy.server.service.ReportService;
|
||||
import org.dromara.neutrinoproxy.server.service.UserLoginRecordService;
|
||||
import org.dromara.neutrinoproxy.server.service.UserService;
|
||||
import org.dromara.neutrinoproxy.server.dal.*;
|
||||
import org.dromara.neutrinoproxy.server.proxy.enhance.SslContextManager;
|
||||
import org.dromara.neutrinoproxy.server.service.*;
|
||||
import org.dromara.solonplugins.job.JobBean;
|
||||
import org.noear.solon.annotation.Component;
|
||||
import org.noear.solon.aot.RuntimeNativeMetadata;
|
||||
@@ -43,6 +27,7 @@ public class NeutrinoServerRuntimeNativeRegistrar implements RuntimeNativeRegist
|
||||
@Override
|
||||
public void register(AppContext context, RuntimeNativeMetadata metadata) {
|
||||
metadata.registerResourceInclude("test.jks");
|
||||
metadata.registerResourceInclude("sql/.*");
|
||||
|
||||
// 使用 MP lambda 的类,需要注册序列化
|
||||
metadata.registerLambdaSerialization(ClientConnectRecordService.class);
|
||||
@@ -55,6 +40,9 @@ public class NeutrinoServerRuntimeNativeRegistrar implements RuntimeNativeRegist
|
||||
metadata.registerLambdaSerialization(ReportService.class);
|
||||
metadata.registerLambdaSerialization(UserLoginRecordService.class);
|
||||
metadata.registerLambdaSerialization(UserService.class);
|
||||
metadata.registerLambdaSerialization(SecurityGroupService.class);
|
||||
metadata.registerLambdaSerialization(DomainService.class);
|
||||
metadata.registerLambdaSerialization(SslContextManager.class);
|
||||
|
||||
metadata.registerLambdaSerialization(LicenseMapper.class);
|
||||
metadata.registerLambdaSerialization(ClientConnectRecordMapper.class);
|
||||
@@ -63,11 +51,21 @@ public class NeutrinoServerRuntimeNativeRegistrar implements RuntimeNativeRegist
|
||||
metadata.registerLambdaSerialization(FlowReportMinuteMapper.class);
|
||||
metadata.registerLambdaSerialization(FlowReportMonthMapper.class);
|
||||
metadata.registerLambdaSerialization(JobInfoMapper.class);
|
||||
metadata.registerLambdaSerialization(JobLogMapper.class);
|
||||
metadata.registerLambdaSerialization(PortMappingMapper.class);
|
||||
metadata.registerLambdaSerialization(PortGroupMapper.class);
|
||||
metadata.registerLambdaSerialization(ReportMapper.class);
|
||||
metadata.registerLambdaSerialization(PortPoolMapper.class);
|
||||
metadata.registerLambdaSerialization(UserLoginRecordMapper.class);
|
||||
metadata.registerLambdaSerialization(UserMapper.class);
|
||||
metadata.registerLambdaSerialization(UserTokenMapper.class);
|
||||
metadata.registerLambdaSerialization(SecurityGroupMapper.class);
|
||||
metadata.registerLambdaSerialization(SecurityRuleMapper.class);
|
||||
metadata.registerLambdaSerialization(DomainMapper.class);
|
||||
metadata.registerLambdaSerialization(DomainPortMappingMapper.class);
|
||||
|
||||
metadata.registerReflection(PortMappingUpdateReq.DomainMapping.class, MemberCategory.DECLARED_FIELDS, MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS, MemberCategory.INVOKE_DECLARED_METHODS);
|
||||
metadata.registerReflection(PortMappingCreateReq.DomainMapping.class, MemberCategory.DECLARED_FIELDS, MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS, MemberCategory.INVOKE_DECLARED_METHODS);
|
||||
|
||||
metadata.registerReflection(HomeDataView.class, MemberCategory.DECLARED_FIELDS);
|
||||
metadata.registerReflection(HomeDataView.Last7dFlow.class, MemberCategory.DECLARED_FIELDS);
|
||||
@@ -89,6 +87,8 @@ public class NeutrinoServerRuntimeNativeRegistrar implements RuntimeNativeRegist
|
||||
|
||||
metadata.registerReflection(JobBean.class, MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS);
|
||||
|
||||
// 解决mybatis调用deleteBatchIds报错“java.lang.ClassNotFoundException: Cannot find class: org.apache.ibatis.type.SimpleTypeRegistry”
|
||||
metadata.registerReflection(SimpleTypeRegistry.class, MemberCategory.DECLARED_FIELDS, MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS, MemberCategory.INVOKE_DECLARED_METHODS);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,24 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package org.dromara.neutrinoproxy.server.base.db;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
@@ -33,6 +12,7 @@ import org.noear.solon.annotation.Init;
|
||||
import org.noear.solon.annotation.Inject;
|
||||
import org.noear.solon.core.event.AppLoadEndEvent;
|
||||
import org.noear.solon.core.event.EventListener;
|
||||
import org.noear.solon.core.runtime.NativeDetector;
|
||||
import org.noear.wood.DbContext;
|
||||
import org.noear.wood.annotation.Db;
|
||||
|
||||
@@ -57,6 +37,10 @@ public class DBInitialize implements EventListener<AppLoadEndEvent> {
|
||||
|
||||
@Init
|
||||
public void init() throws Throwable {
|
||||
// aot 阶段,不初始化数据库
|
||||
if (NativeDetector.isAotRuntime()) {
|
||||
return;
|
||||
}
|
||||
Assert.notNull(dbConfig.getType(), "neutrino.data.db.type不能为空!");
|
||||
dbTypeEnum = DbTypeEnum.of(dbConfig.getType());
|
||||
Assert.notNull(dbTypeEnum, "neutrino.data.db.type取值异常!");
|
||||
|
||||
@@ -1,24 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package org.dromara.neutrinoproxy.server.base.db;
|
||||
|
||||
import org.dromara.neutrinoproxy.server.constant.DbTypeEnum;
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
package org.dromara.neutrinoproxy.server.base.proxy;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import io.netty.channel.WriteBufferWaterMark;
|
||||
import lombok.Data;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.neutrinoproxy.server.util.StringUtil;
|
||||
import org.noear.solon.annotation.Component;
|
||||
import org.noear.solon.annotation.Inject;
|
||||
|
||||
@@ -9,6 +13,7 @@ import org.noear.solon.annotation.Inject;
|
||||
* @author: aoshiguchen
|
||||
* @date: 2022/6/16
|
||||
*/
|
||||
@Slf4j
|
||||
@Data
|
||||
@Component
|
||||
public class ProxyConfig {
|
||||
@@ -38,6 +43,8 @@ public class ProxyConfig {
|
||||
private Integer readIdleTime;
|
||||
private Integer writeIdleTime;
|
||||
private Integer allIdleTimeSeconds;
|
||||
// 水位线
|
||||
private String waterMark;
|
||||
}
|
||||
|
||||
@Data
|
||||
@@ -63,7 +70,6 @@ public class ProxyConfig {
|
||||
public static class Tcp {
|
||||
private Integer bossThreadCount;
|
||||
private Integer workThreadCount;
|
||||
private String domainName;
|
||||
private Integer httpProxyPort;
|
||||
private Integer httpsProxyPort;
|
||||
private String keyStorePassword;
|
||||
@@ -77,4 +83,37 @@ public class ProxyConfig {
|
||||
private Integer workThreadCount;
|
||||
private Boolean transferLogEnable;
|
||||
}
|
||||
|
||||
private WriteBufferWaterMark waterMark;
|
||||
private boolean isParseWaterMark = false;
|
||||
|
||||
public synchronized WriteBufferWaterMark getWaterMark() {
|
||||
if (isParseWaterMark) {
|
||||
return waterMark;
|
||||
}
|
||||
isParseWaterMark = true;
|
||||
if (null == protocol || StrUtil.isBlank(protocol.getWaterMark())) {
|
||||
return null;
|
||||
}
|
||||
String[] tmp = protocol.getWaterMark().split("/");
|
||||
if (tmp.length != 2) {
|
||||
log.info("[配置解析] 水位线配置参数格式有误! config={}", protocol.getWaterMark());
|
||||
return null;
|
||||
}
|
||||
String lowStr = tmp[0].trim();
|
||||
String highStr = tmp[1].trim();
|
||||
if (!StringUtil.isBytesDesc(lowStr) || !StringUtil.isBytesDesc(highStr)) {
|
||||
log.info("[配置解析] 水位线配置参数格式有误! config={}", protocol.getWaterMark());
|
||||
return null;
|
||||
}
|
||||
Long low = StringUtil.parseBytes(lowStr);
|
||||
Long high = StringUtil.parseBytes(highStr);
|
||||
if (null == low || null == high || low >= high) {
|
||||
log.info("[配置解析] 水位线配置参数格式或大小有误! config={}", protocol.getWaterMark());
|
||||
return null;
|
||||
}
|
||||
waterMark = new WriteBufferWaterMark(low.intValue(), high.intValue());
|
||||
log.info("[配置解析] 水位线配置 config={},low={},high={}", protocol.getWaterMark(), low.intValue(), high.intValue());
|
||||
return waterMark;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
package org.dromara.neutrinoproxy.server.base.proxy;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import io.netty.bootstrap.Bootstrap;
|
||||
import io.netty.bootstrap.ServerBootstrap;
|
||||
import io.netty.channel.ChannelInitializer;
|
||||
import io.netty.channel.ChannelOption;
|
||||
import io.netty.channel.ChannelPipeline;
|
||||
import io.netty.channel.*;
|
||||
import io.netty.channel.socket.SocketChannel;
|
||||
import io.netty.channel.socket.nio.NioDatagramChannel;
|
||||
import io.netty.channel.socket.nio.NioServerSocketChannel;
|
||||
@@ -15,11 +14,13 @@ import org.dromara.neutrinoproxy.core.ProxyMessageHandler;
|
||||
import org.dromara.neutrinoproxy.core.aot.NeutrinoCoreRuntimeNativeRegistrar;
|
||||
import org.dromara.neutrinoproxy.core.dispatcher.DefaultDispatcher;
|
||||
import org.dromara.neutrinoproxy.core.dispatcher.Dispatcher;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import io.netty.channel.nio.NioEventLoopGroup;
|
||||
import org.dromara.neutrinoproxy.server.proxy.core.BytesMetricsHandler;
|
||||
import org.dromara.neutrinoproxy.server.proxy.core.TcpVisitorChannelHandler;
|
||||
import org.dromara.neutrinoproxy.server.proxy.core.UdpVisitorChannelHandler;
|
||||
import org.dromara.neutrinoproxy.server.proxy.security.TcpVisitorSecurityChannelHandler;
|
||||
import org.dromara.neutrinoproxy.server.proxy.security.UdpVisitorSecurityChannelHandler;
|
||||
import org.dromara.neutrinoproxy.server.proxy.security.VisitorFlowLimiterChannelHandler;
|
||||
import org.dromara.neutrinoproxy.server.util.ProxyUtil;
|
||||
import org.noear.solon.Solon;
|
||||
import org.noear.solon.annotation.Bean;
|
||||
import org.noear.solon.annotation.Configuration;
|
||||
@@ -44,6 +45,8 @@ public class ProxyConfiguration implements LifecycleBean {
|
||||
null : ProxyDataTypeEnum.of((int)proxyMessage.getType()).getName());
|
||||
|
||||
Solon.context().wrapAndPut(Dispatcher.class, dispatcher);
|
||||
|
||||
ProxyUtil.init();
|
||||
}
|
||||
|
||||
@Bean("tcpServerBossGroup")
|
||||
@@ -64,6 +67,11 @@ public class ProxyConfiguration implements LifecycleBean {
|
||||
@Inject ProxyConfig proxyConfig
|
||||
) {
|
||||
ServerBootstrap bootstrap = new ServerBootstrap();
|
||||
|
||||
WriteBufferWaterMark waterMark = proxyConfig.getWaterMark();
|
||||
if (null != waterMark) {
|
||||
bootstrap.childOption(ChannelOption.WRITE_BUFFER_WATER_MARK, waterMark);
|
||||
}
|
||||
bootstrap.group(tcpServerBossGroup, tcpServerWorkerGroup)
|
||||
.channel(NioServerSocketChannel.class)
|
||||
.childHandler(new ChannelInitializer<SocketChannel>() {
|
||||
@@ -72,8 +80,10 @@ public class ProxyConfiguration implements LifecycleBean {
|
||||
if (null != proxyConfig.getServer().getTcp().getTransferLogEnable() && proxyConfig.getServer().getTcp().getTransferLogEnable()) {
|
||||
ch.pipeline().addFirst(new LoggingHandler(TcpVisitorChannelHandler.class));
|
||||
}
|
||||
ch.pipeline().addFirst(new BytesMetricsHandler());
|
||||
// ch.pipeline().addFirst(new BytesMetricsHandler());
|
||||
// ch.pipeline().addLast(new ChannelTrafficShapingHandler(1024 * 1024 * 20, 1024 * 1024 * 20, 100, 20000));
|
||||
ch.pipeline().addLast(new TcpVisitorSecurityChannelHandler());
|
||||
ch.pipeline().addLast("flowLimiter", new VisitorFlowLimiterChannelHandler());
|
||||
ch.pipeline().addLast(new TcpVisitorChannelHandler());
|
||||
}
|
||||
});
|
||||
@@ -111,6 +121,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, new UdpVisitorSecurityChannelHandler());
|
||||
ch.pipeline().addLast("flowLimiter", new VisitorFlowLimiterChannelHandler());
|
||||
pipeline.addLast(udpServerWorkerGroup, new UdpVisitorChannelHandler());
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,24 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package org.dromara.neutrinoproxy.server.base.rest;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
|
||||
@@ -1,24 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package org.dromara.neutrinoproxy.server.base.rest;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,24 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package org.dromara.neutrinoproxy.server.base.rest;
|
||||
|
||||
import org.dromara.neutrinoproxy.server.constant.ExceptionConstant;
|
||||
|
||||
@@ -1,24 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package org.dromara.neutrinoproxy.server.base.rest;
|
||||
|
||||
import org.dromara.neutrinoproxy.server.dal.entity.UserDO;
|
||||
|
||||
@@ -1,24 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package org.dromara.neutrinoproxy.server.base.rest;
|
||||
|
||||
import org.dromara.neutrinoproxy.server.dal.entity.UserDO;
|
||||
|
||||
@@ -8,7 +8,6 @@ import org.dromara.neutrinoproxy.server.dal.entity.UserDO;
|
||||
import org.dromara.neutrinoproxy.server.service.UserService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.exception.ExceptionUtils;
|
||||
import org.dromara.neutrinoproxy.server.base.rest.*;
|
||||
import org.noear.solon.Solon;
|
||||
import org.noear.solon.annotation.Component;
|
||||
import org.noear.solon.core.handle.Action;
|
||||
|
||||
@@ -23,7 +23,7 @@ public class GlobalExceptionFilter implements Filter {
|
||||
try {
|
||||
chain.doFilter(ctx);
|
||||
} catch (Throwable e) {
|
||||
log.error("global error", e);
|
||||
log.debug("global error", e);
|
||||
|
||||
if (e instanceof ServiceException) {
|
||||
ServiceException serviceException = (ServiceException) e;
|
||||
|
||||
@@ -1,24 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package org.dromara.neutrinoproxy.server.constant;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
|
||||
@@ -1,24 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package org.dromara.neutrinoproxy.server.constant;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
|
||||
@@ -1,24 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package org.dromara.neutrinoproxy.server.constant;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
|
||||
@@ -1,24 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package org.dromara.neutrinoproxy.server.constant;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package org.dromara.neutrinoproxy.server.constant;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 默认域名状态枚举
|
||||
* @author Mirac
|
||||
* @date 21/7/2024
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum DefaultDomainStatusEnum {
|
||||
ENABLE(1, "默认域名"),
|
||||
DISABLE(2, "关闭");
|
||||
|
||||
private Integer status;
|
||||
private String desc;
|
||||
}
|
||||
@@ -1,24 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package org.dromara.neutrinoproxy.server.constant;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
|
||||
@@ -1,24 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package org.dromara.neutrinoproxy.server.constant;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
@@ -40,8 +19,8 @@ public enum ExceptionConstant {
|
||||
NO_PERMISSION_VISIT(5, "当前用户无权访问该资源"),
|
||||
PARAMS_NOT_NULL(10, "参数[{}]不能为空"),
|
||||
PARAMS_NOT_EMPTY(11, "参数[{}]不能为空"),
|
||||
|
||||
FILED_LENGTH_OUT(12 ,"{}不能超出长度{}"),
|
||||
BYTES_DESC_INVALID(13, "参数[{}]字节描述不合法"),
|
||||
|
||||
// 用户管理(11000)
|
||||
// license管理(12000)
|
||||
@@ -59,15 +38,23 @@ public enum ExceptionConstant {
|
||||
PORT_MAPPING_NOT_EXIST(14000, "端口映射记录不存在"),
|
||||
PORT_CANNOT_REPEAT_MAPPING(14001, "服务端口[{}]不能重复映射"),
|
||||
AN_UNSUPPORTED_PROTOCOL(14002, "不支持的协议[{}]!"),
|
||||
PORT_MAPPING_SUBDONAME_CONNOT_REPEAT(14003, "子域名不能重复使用!"),
|
||||
|
||||
// 调度管理(15000)
|
||||
JOB_INFO_NOT_EXIST(15000, "调度管理记录不存在"),
|
||||
SYSTEM_ERROR(500, "系统异常"),
|
||||
|
||||
PORT_GROUP_NAME_ALREADY_EXIST(16000,"端口分组名称[{}]已经存在"),
|
||||
PORT_GROUP_NAME_DOES_NOT_EXIST(16001,"端口分组不存在"),
|
||||
DEFAULT_GROUP_FORBID_DELETE(16002,"默认分组禁止删除")
|
||||
DEFAULT_GROUP_FORBID_DELETE(16002,"默认分组禁止删除"),
|
||||
|
||||
// 安全组管理(17000)
|
||||
SECURITY_GROUP_NOT_EXIST(17000, "安全组不存在"),
|
||||
SECURITY_RULE_NOT_EXIST(17001, "安全规则不存在"),
|
||||
// 域名映射管理(18000)
|
||||
DOMAIN_NAME_CANNOT_REPEAT(18000, "域名不能重复"),
|
||||
DOMAIN_NAME_NOT_EXIST(18001, "域名不存在"),
|
||||
DOMAIN_NAME_IS_DISABLE(18002, "当前域名[{}]被禁用"),
|
||||
SUDOMAIN_NAME_CANNOT_REPEAT(18003, "子域名不能重复"),
|
||||
DOMAIN_NAME_IS_USED(18002, "当前域名正在使用"),
|
||||
;
|
||||
|
||||
private int code;
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package org.dromara.neutrinoproxy.server.constant;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* 仅Https状态枚举
|
||||
* @author Mirac
|
||||
* @date 21/7/2024
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum HttpsStatusEnum {
|
||||
ONLY_HTTPS(1, "仅HTTPS"),
|
||||
DISABLE_ONLY_HTTPS(2, "关闭仅HTTPS");
|
||||
private static Map<Integer, HttpsStatusEnum> CACHE = Stream.of(HttpsStatusEnum.values()).collect(Collectors.toMap(HttpsStatusEnum::getStatus, Function.identity()));
|
||||
|
||||
private Integer status;
|
||||
private String desc;
|
||||
|
||||
public static HttpsStatusEnum of(Integer status) {
|
||||
return CACHE.get(status);
|
||||
}
|
||||
}
|
||||
@@ -1,24 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package org.dromara.neutrinoproxy.server.constant;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package org.dromara.neutrinoproxy.server.constant;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum SecurityRulePassTypeEnum {
|
||||
DENY(0, "deny"),
|
||||
ALLOW(1, "allow"),
|
||||
NONE(-1, "none")
|
||||
;
|
||||
|
||||
private final Integer type;
|
||||
private final String desc;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package org.dromara.neutrinoproxy.server.constant;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* 仅Https状态枚举
|
||||
* @author Mirac
|
||||
* @date 21/7/2024
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum SslStatusEnum {
|
||||
UPLOADED(1, "已上传"),
|
||||
NOT_UPLOADED(2, "未上传"),
|
||||
CERTIFIED(3, "已认证");//预留,用于证书验证
|
||||
|
||||
private Integer status;
|
||||
private String desc;
|
||||
}
|
||||
@@ -1,24 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package org.dromara.neutrinoproxy.server.constant;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
|
||||
@@ -1,24 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package org.dromara.neutrinoproxy.server.controller;
|
||||
|
||||
import org.dromara.neutrinoproxy.server.base.page.PageInfo;
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
package org.dromara.neutrinoproxy.server.controller;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import org.dromara.neutrinoproxy.server.base.page.PageInfo;
|
||||
import org.dromara.neutrinoproxy.server.base.page.PageQuery;
|
||||
import org.dromara.neutrinoproxy.server.base.rest.Authorization;
|
||||
import org.dromara.neutrinoproxy.server.controller.req.proxy.*;
|
||||
import org.dromara.neutrinoproxy.server.controller.res.proxy.DomainListRes;
|
||||
import org.dromara.neutrinoproxy.server.controller.res.proxy.DomainUpdateDefaultStatusRes;
|
||||
import org.dromara.neutrinoproxy.server.controller.res.proxy.DomainUpdateEnableStatusRes;
|
||||
import org.dromara.neutrinoproxy.server.util.ParamCheckUtil;
|
||||
import org.noear.solon.annotation.*;
|
||||
import org.dromara.neutrinoproxy.server.service.DomainService;
|
||||
import org.noear.solon.core.handle.Context;
|
||||
import org.noear.solon.core.handle.UploadedFile;
|
||||
import org.noear.solon.lang.Nullable;
|
||||
|
||||
import javax.sound.midi.Soundbank;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Mirac
|
||||
* @date 21/7/2024
|
||||
*/
|
||||
@Mapping("/domain")
|
||||
@Controller
|
||||
public class DomainController {
|
||||
@Inject
|
||||
private DomainService domainService;
|
||||
|
||||
@Get
|
||||
@Mapping("/page")
|
||||
public PageInfo<DomainListRes> page(PageQuery pageQuery, DomainListReq req) {
|
||||
return domainService.page(pageQuery, req);
|
||||
}
|
||||
@Get
|
||||
@Mapping("/all")
|
||||
public List<DomainListRes> all(DomainListReq req) {
|
||||
ParamCheckUtil.checkNotNull(req, "req");
|
||||
return domainService.all(req);
|
||||
}
|
||||
|
||||
@Post
|
||||
@Mapping(path = "/create")
|
||||
@Authorization(onlyAdmin = true)
|
||||
public void create(DomainCreateReq req, UploadedFile jks) throws IOException {
|
||||
ParamCheckUtil.checkNotNull(req, "req");
|
||||
ParamCheckUtil.checkNotEmpty(req.getDomain(), "domain");
|
||||
domainService.create(req, jks);
|
||||
}
|
||||
|
||||
@Post
|
||||
@Mapping(path = "/update")
|
||||
@Authorization(onlyAdmin = true)
|
||||
public void update(DomainUpdateReq req, UploadedFile jks) throws IOException {
|
||||
ParamCheckUtil.checkNotNull(req, "req");
|
||||
ParamCheckUtil.checkNotEmpty(req.getDomain(), "domain");
|
||||
domainService.update(req, jks);
|
||||
}
|
||||
|
||||
@Post
|
||||
@Mapping(path = "/update/enable-status")
|
||||
@Authorization(onlyAdmin = true)
|
||||
public DomainUpdateEnableStatusRes updateEnableStatus(DomainUpdateEnableStatusReq req){
|
||||
ParamCheckUtil.checkNotNull(req, "req");
|
||||
ParamCheckUtil.checkNotNull(req.getId(), "id");
|
||||
ParamCheckUtil.checkNotNull(req.getEnable(), "enable");
|
||||
return domainService.updateEnableStatus(req);
|
||||
}
|
||||
|
||||
@Post
|
||||
@Mapping(path = "/delete")
|
||||
@Authorization(onlyAdmin = true)
|
||||
public void delete(DomainDeleteReq req) {
|
||||
ParamCheckUtil.checkNotNull(req, "req");
|
||||
ParamCheckUtil.checkNotNull(req.getId(), "id");
|
||||
|
||||
domainService.delete(req.getId());
|
||||
}
|
||||
|
||||
@Post
|
||||
@Mapping(path = "/update/default-status")
|
||||
@Authorization(onlyAdmin = true)
|
||||
public DomainUpdateDefaultStatusRes updateDefaultStatus(DomainUpdateDefaultStatusReq req){
|
||||
ParamCheckUtil.checkNotNull(req, "req");
|
||||
ParamCheckUtil.checkNotNull(req.getId(), "id");
|
||||
ParamCheckUtil.checkNotNull(req.getIsDefault(), "isDefault");
|
||||
return domainService.updateDefaultStatus(req.getId(), req.getIsDefault());
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
package org.dromara.neutrinoproxy.server.controller;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.neutrinoproxy.server.base.proxy.ProxyConfig;
|
||||
import org.noear.solon.annotation.Controller;
|
||||
import org.noear.solon.annotation.Get;
|
||||
import org.noear.solon.annotation.Inject;
|
||||
import org.noear.solon.annotation.Mapping;
|
||||
|
||||
/**
|
||||
* @author: aoshiguchen
|
||||
* @date: 2023/4/2
|
||||
*/
|
||||
@Slf4j
|
||||
@Mapping("/domain-name")
|
||||
@Controller
|
||||
public class DomainNameController {
|
||||
@Inject
|
||||
private ProxyConfig proxyConfig;
|
||||
|
||||
@Get
|
||||
@Mapping("/bind-info")
|
||||
public String bindInfo () {
|
||||
return proxyConfig.getServer().getTcp().getDomainName();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,24 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package org.dromara.neutrinoproxy.server.controller;
|
||||
|
||||
import org.dromara.neutrinoproxy.server.base.rest.Authorization;
|
||||
|
||||
@@ -1,24 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package org.dromara.neutrinoproxy.server.controller;
|
||||
|
||||
import org.dromara.neutrinoproxy.server.base.page.PageInfo;
|
||||
|
||||
@@ -1,24 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package org.dromara.neutrinoproxy.server.controller;
|
||||
|
||||
import org.dromara.neutrinoproxy.server.base.page.PageInfo;
|
||||
|
||||
@@ -1,24 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package org.dromara.neutrinoproxy.server.controller;
|
||||
|
||||
import org.dromara.neutrinoproxy.server.base.page.PageInfo;
|
||||
@@ -70,6 +49,8 @@ public class LicenseController {
|
||||
ParamCheckUtil.checkNotNull(req, "req");
|
||||
ParamCheckUtil.checkNotEmpty(req.getName(), "name");
|
||||
ParamCheckUtil.checkNotNull(req.getUserId(), "userId");
|
||||
ParamCheckUtil.checkBytesDesc(req.getUpLimitRate(), "upLimitRate");
|
||||
ParamCheckUtil.checkBytesDesc(req.getDownLimitRate(), "downLimitRate");
|
||||
|
||||
return licenseService.create(req);
|
||||
}
|
||||
@@ -81,6 +62,8 @@ public class LicenseController {
|
||||
ParamCheckUtil.checkNotNull(req, "req");
|
||||
ParamCheckUtil.checkNotNull(req.getId(), "id");
|
||||
ParamCheckUtil.checkNotEmpty(req.getName(), "name");
|
||||
ParamCheckUtil.checkBytesDesc(req.getUpLimitRate(), "upLimitRate");
|
||||
ParamCheckUtil.checkBytesDesc(req.getDownLimitRate(), "downLimitRate");
|
||||
|
||||
return licenseService.update(req);
|
||||
}
|
||||
|
||||
@@ -13,6 +13,8 @@ import org.dromara.neutrinoproxy.server.util.ParamCheckUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.noear.solon.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 端口映射
|
||||
* @author: aoshiguchen
|
||||
@@ -28,7 +30,6 @@ public class PortMappingController {
|
||||
@Mapping("/page")
|
||||
public PageInfo<PortMappingListRes> page(PageQuery pageQuery, PortMappingListReq req) {
|
||||
ParamCheckUtil.checkNotNull(pageQuery, "pageQuery");
|
||||
|
||||
return portMappingService.page(pageQuery, req);
|
||||
}
|
||||
|
||||
@@ -41,6 +42,8 @@ public class PortMappingController {
|
||||
ParamCheckUtil.checkNotNull(req.getClientPort(), "clientPort");
|
||||
ParamCheckUtil.checkNotEmpty(req.getProtocal(), "protocal");
|
||||
ParamCheckUtil.checkMaxLength(req.getDescription(), 50, "描述", "50");
|
||||
ParamCheckUtil.checkBytesDesc(req.getUpLimitRate(), "upLimitRate");
|
||||
ParamCheckUtil.checkBytesDesc(req.getDownLimitRate(), "downLimitRate");
|
||||
if (StringUtils.isBlank(req.getClientIp())) {
|
||||
// 没传客户端ip,默认为127.0.0.1
|
||||
req.setClientIp("127.0.0.1");
|
||||
@@ -49,7 +52,7 @@ public class PortMappingController {
|
||||
ParamCheckUtil.checkNotNull(networkProtocolEnum, ExceptionConstant.AN_UNSUPPORTED_PROTOCOL, req.getProtocal());
|
||||
if (networkProtocolEnum != NetworkProtocolEnum.HTTP) {
|
||||
// 目前仅HTTP支持绑定域名
|
||||
req.setSubdomain(null);
|
||||
req.setDomainMappings(null);
|
||||
}
|
||||
req.setProtocal(networkProtocolEnum.getDesc());
|
||||
if (null == req.getProxyResponses()) {
|
||||
@@ -58,19 +61,24 @@ public class PortMappingController {
|
||||
if (null == req.getProxyTimeoutMs()) {
|
||||
req.setProxyTimeoutMs(0L);
|
||||
}
|
||||
if (null == req.getSecurityGroupId()) {
|
||||
req.setSecurityGroupId(0);
|
||||
}
|
||||
|
||||
return portMappingService.create(req);
|
||||
}
|
||||
|
||||
@Post
|
||||
@Mapping("/update")
|
||||
public PortMappingUpdateRes update(PortMappingUpdateReq req) {
|
||||
public void update(PortMappingUpdateReq req) {
|
||||
ParamCheckUtil.checkNotNull(req, "req");
|
||||
ParamCheckUtil.checkNotNull(req.getLicenseId(), "licenseId");
|
||||
ParamCheckUtil.checkNotNull(req.getServerPort(), "serverPort");
|
||||
ParamCheckUtil.checkNotNull(req.getClientPort(), "clientPort");
|
||||
ParamCheckUtil.checkNotEmpty(req.getProtocal(), "protocal");
|
||||
ParamCheckUtil.checkMaxLength(req.getDescription(), 50, "描述", "50");
|
||||
ParamCheckUtil.checkBytesDesc(req.getUpLimitRate(), "upLimitRate");
|
||||
ParamCheckUtil.checkBytesDesc(req.getDownLimitRate(), "downLimitRate");
|
||||
if (StringUtils.isBlank(req.getClientIp())) {
|
||||
// 没传客户端ip,默认为127.0.0.1
|
||||
req.setClientIp("127.0.0.1");
|
||||
@@ -79,7 +87,7 @@ public class PortMappingController {
|
||||
ParamCheckUtil.checkNotNull(networkProtocolEnum, ExceptionConstant.AN_UNSUPPORTED_PROTOCOL, req.getProtocal());
|
||||
if (networkProtocolEnum != NetworkProtocolEnum.HTTP) {
|
||||
// 目前仅HTTP支持绑定域名
|
||||
req.setSubdomain(null);
|
||||
req.setDomainMappings(null);
|
||||
}
|
||||
req.setProtocal(networkProtocolEnum.getDesc());
|
||||
if (null == req.getProxyResponses()) {
|
||||
@@ -88,8 +96,11 @@ public class PortMappingController {
|
||||
if (null == req.getProxyTimeoutMs()) {
|
||||
req.setProxyTimeoutMs(0L);
|
||||
}
|
||||
if (null == req.getSecurityGroupId()) {
|
||||
req.setSecurityGroupId(0);
|
||||
}
|
||||
|
||||
return portMappingService.update(req);
|
||||
portMappingService.update(req);
|
||||
}
|
||||
|
||||
@Get
|
||||
@@ -119,4 +130,26 @@ public class PortMappingController {
|
||||
|
||||
portMappingService.delete(req.getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 绑定安全组
|
||||
* @param req portMappingId和securityGroupId
|
||||
*/
|
||||
@Post
|
||||
@Mapping("/bind/security-group")
|
||||
public void bindSecurityGroup(PortMappingBindSecurityGroupReq req) {
|
||||
portMappingService.portBindSecurityGroup(req.getId(), req.getSecurityGroupId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 安全组解绑
|
||||
* @param id 端口映射Id
|
||||
*/
|
||||
@Post
|
||||
@Mapping("/unbind/security-group")
|
||||
public void unbindSecurityGroup(Integer id) {
|
||||
portMappingService.portUnbindSecurityGroup(id);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,24 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package org.dromara.neutrinoproxy.server.controller;
|
||||
|
||||
import org.dromara.neutrinoproxy.server.base.page.PageInfo;
|
||||
|
||||
@@ -0,0 +1,127 @@
|
||||
package org.dromara.neutrinoproxy.server.controller;
|
||||
|
||||
import org.dromara.neutrinoproxy.server.base.page.PageInfo;
|
||||
import org.dromara.neutrinoproxy.server.base.page.PageQuery;
|
||||
import org.dromara.neutrinoproxy.server.controller.req.system.*;
|
||||
import org.dromara.neutrinoproxy.server.controller.res.system.*;
|
||||
import org.dromara.neutrinoproxy.server.service.PortMappingService;
|
||||
import org.dromara.neutrinoproxy.server.service.SecurityGroupService;
|
||||
import org.dromara.neutrinoproxy.server.util.ParamCheckUtil;
|
||||
import org.noear.solon.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Controller
|
||||
@Mapping("/security")
|
||||
public class SecurityController {
|
||||
|
||||
@Inject
|
||||
private SecurityGroupService groupService;
|
||||
|
||||
@Inject
|
||||
private PortMappingService portMappingService;
|
||||
|
||||
/**
|
||||
* 获取当前用户权限下的安全组
|
||||
*/
|
||||
@Get
|
||||
@Mapping("/group/page")
|
||||
public PageInfo<SecurityGroupListRes> groupPage(PageQuery pageQuery, SecurityGroupListReq req) {
|
||||
ParamCheckUtil.checkNotNull(pageQuery, "pageQuery");
|
||||
|
||||
return groupService.groupPage(pageQuery, req);
|
||||
}
|
||||
|
||||
@Get
|
||||
@Mapping("/group/list")
|
||||
public List<SecurityGroupListRes> groupList() {
|
||||
return groupService.groupList();
|
||||
}
|
||||
|
||||
@Get
|
||||
@Mapping("/group/detail")
|
||||
public SecurityGroupDetailRes groupDetail(SecurityGroupDetailReq req) {
|
||||
ParamCheckUtil.checkNotNull(req, "req");
|
||||
ParamCheckUtil.checkNotNull(req.getId(), "id");
|
||||
|
||||
return groupService.groupDetail(req);
|
||||
}
|
||||
|
||||
@Post
|
||||
@Mapping("/group/create")
|
||||
public void createGroup(SecurityGroupCreateReq req) {
|
||||
groupService.createGroup(req);
|
||||
}
|
||||
|
||||
@Post
|
||||
@Mapping("/group/update")
|
||||
public void updateGroup(SecurityGroupUpdateReq req) {
|
||||
groupService.updateGroup(req);
|
||||
}
|
||||
|
||||
/**
|
||||
* 将级联删除对应规则,并更新缓存
|
||||
* @param groupId 安全组Id
|
||||
*/
|
||||
@Post
|
||||
@Mapping("/group/delete")
|
||||
public void deleteGroup(Integer groupId) {
|
||||
ParamCheckUtil.checkNotNull(groupId, "groupId");
|
||||
|
||||
groupService.deleteGroup(groupId);
|
||||
}
|
||||
|
||||
@Post
|
||||
@Mapping("/group/update/enable-status")
|
||||
public SecurityGroupUpdateEnableStatueRes updateGroupEnableStatueReq(SecurityGroupUpdateEnableStatueReq req) {
|
||||
ParamCheckUtil.checkNotNull(req, "req");
|
||||
ParamCheckUtil.checkNotNull(req.getId(), "id");
|
||||
ParamCheckUtil.checkNotNull(req.getEnable(), "enable");
|
||||
|
||||
return groupService.updateGroupEnableStatueReq(req);
|
||||
}
|
||||
|
||||
@Get
|
||||
@Mapping("/rule/page")
|
||||
public PageInfo<SecurityRuleListRes> rulePage(PageQuery pageQuery, SecurityRuleListReq req) {
|
||||
ParamCheckUtil.checkNotNull(pageQuery, "pageQuery");
|
||||
|
||||
return groupService.rulePage(pageQuery, req);
|
||||
}
|
||||
|
||||
@Get
|
||||
@Mapping("/rule/list")
|
||||
public List<SecurityRuleListRes> getRuleListByGroupId(SecurityRuleListReq req) {
|
||||
return groupService.ruleList(req);
|
||||
}
|
||||
|
||||
@Post
|
||||
@Mapping("/rule/create")
|
||||
public void createRule(SecurityRuleCreateReq req) {
|
||||
groupService.createRule(req);
|
||||
}
|
||||
|
||||
@Post
|
||||
@Mapping("/rule/update")
|
||||
public void updateRule(SecurityRuleUpdateReq req) {
|
||||
groupService.updateRule(req);
|
||||
}
|
||||
|
||||
@Post
|
||||
@Mapping("/rule/delete")
|
||||
public void deleteRule(Integer ruleId) {
|
||||
groupService.deleteRule(ruleId);
|
||||
}
|
||||
|
||||
|
||||
@Post
|
||||
@Mapping("/rule/update/enable-status")
|
||||
public SecurityRuleUpdateEnableStatueRes updateRuleEnableStatueReq(SecurityRuleUpdateEnableStatueReq req) {
|
||||
ParamCheckUtil.checkNotNull(req, "req");
|
||||
ParamCheckUtil.checkNotNull(req.getId(), "id");
|
||||
ParamCheckUtil.checkNotNull(req.getEnable(), "enable");
|
||||
|
||||
return groupService.updateRuleEnableStatueReq(req);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package org.dromara.neutrinoproxy.server.controller;
|
||||
|
||||
import org.dromara.neutrinoproxy.server.base.rest.Authorization;
|
||||
import org.dromara.neutrinoproxy.server.controller.res.stats.StatsInfoRes;
|
||||
import org.dromara.neutrinoproxy.server.util.ProxyUtil;
|
||||
import org.noear.solon.annotation.Controller;
|
||||
import org.noear.solon.annotation.Get;
|
||||
import org.noear.solon.annotation.Mapping;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author: wen.y
|
||||
* @date: 2026/1/20
|
||||
*/
|
||||
@Mapping("/stats")
|
||||
@Controller
|
||||
public class StatsController {
|
||||
|
||||
@Authorization(login = false)
|
||||
@Get
|
||||
@Mapping("/info")
|
||||
public StatsInfoRes info() {
|
||||
return new StatsInfoRes().setCacheInfo(ProxyUtil.getCacheInfo());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,24 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package org.dromara.neutrinoproxy.server.controller;
|
||||
|
||||
import org.dromara.neutrinoproxy.server.base.page.PageInfo;
|
||||
@@ -28,13 +7,11 @@ import org.dromara.neutrinoproxy.server.base.rest.SystemContextHolder;
|
||||
import org.dromara.neutrinoproxy.server.constant.ExceptionConstant;
|
||||
import org.dromara.neutrinoproxy.server.controller.req.system.*;
|
||||
import org.dromara.neutrinoproxy.server.controller.res.system.*;
|
||||
import org.dromara.neutrinoproxy.server.controller.res.system.*;
|
||||
import org.dromara.neutrinoproxy.server.dal.UserMapper;
|
||||
import org.dromara.neutrinoproxy.server.dal.entity.UserDO;
|
||||
import org.dromara.neutrinoproxy.server.service.UserService;
|
||||
import org.dromara.neutrinoproxy.server.util.Md5Util;
|
||||
import org.dromara.neutrinoproxy.server.util.ParamCheckUtil;
|
||||
import org.dromara.neutrinoproxy.server.controller.req.system.*;
|
||||
import org.noear.solon.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -1,24 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package org.dromara.neutrinoproxy.server.controller;
|
||||
|
||||
import org.dromara.neutrinoproxy.server.base.page.PageInfo;
|
||||
|
||||
@@ -1,24 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package org.dromara.neutrinoproxy.server.controller.req.log;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,24 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package org.dromara.neutrinoproxy.server.controller.req.log;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,24 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package org.dromara.neutrinoproxy.server.controller.req.log;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
package org.dromara.neutrinoproxy.server.controller.req.proxy;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author Mirac
|
||||
* @date 21/7/2024
|
||||
*/
|
||||
@Data
|
||||
public class DomainCreateReq {
|
||||
/**
|
||||
* 主域名
|
||||
*/
|
||||
private String domain;
|
||||
|
||||
/**
|
||||
* KeyStore密码
|
||||
*/
|
||||
private String keyStorePassword;
|
||||
|
||||
/**
|
||||
* 强制Https
|
||||
*/
|
||||
private Integer forceHttps;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package org.dromara.neutrinoproxy.server.controller.req.proxy;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author Mirac
|
||||
* @date 23/7/2024
|
||||
*/
|
||||
@Data
|
||||
public class DomainDeleteReq {
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
private Integer id;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package org.dromara.neutrinoproxy.server.controller.req.proxy;
|
||||
|
||||
import lombok.Data;
|
||||
import org.dromara.neutrinoproxy.server.constant.EnableStatusEnum;
|
||||
|
||||
/**
|
||||
* @author Mirac
|
||||
* @date 21/7/2024
|
||||
*/
|
||||
@Data
|
||||
public class DomainListReq {
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
private Integer userId;
|
||||
/**
|
||||
* 启用状态
|
||||
* {@link EnableStatusEnum}
|
||||
*/
|
||||
private Integer enable;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package org.dromara.neutrinoproxy.server.controller.req.proxy;
|
||||
|
||||
import lombok.Data;
|
||||
import org.dromara.neutrinoproxy.server.constant.DefaultDomainStatusEnum;
|
||||
|
||||
/**
|
||||
* @author Mirac
|
||||
* @date 23/7/2024
|
||||
*/
|
||||
@Data
|
||||
public class DomainUpdateDefaultStatusReq {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 启用状态 {@link DefaultDomainStatusEnum}
|
||||
*/
|
||||
private Integer isDefault;
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package org.dromara.neutrinoproxy.server.controller.req.proxy;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author Mirac
|
||||
* @date 23/7/2024
|
||||
*/
|
||||
@Data
|
||||
public class DomainUpdateEnableStatusReq {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 启用状态
|
||||
*/
|
||||
private Integer enable;
|
||||
|
||||
/**
|
||||
* 域名
|
||||
*/
|
||||
private String domain;
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package org.dromara.neutrinoproxy.server.controller.req.proxy;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author Mirac
|
||||
* @date 21/7/2024
|
||||
*/
|
||||
@Data
|
||||
public class DomainUpdateReq {
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 主域名
|
||||
*/
|
||||
private String domain;
|
||||
|
||||
/**
|
||||
* KeyStore密码
|
||||
*/
|
||||
private String keyStorePassword;
|
||||
|
||||
/**
|
||||
* 强制Https
|
||||
*/
|
||||
private Integer forceHttps;
|
||||
}
|
||||
@@ -1,24 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package org.dromara.neutrinoproxy.server.controller.req.proxy;
|
||||
|
||||
import lombok.Data;
|
||||
@@ -38,4 +17,12 @@ public class LicenseCreateReq {
|
||||
* 用户ID
|
||||
*/
|
||||
private Integer userId;
|
||||
/**
|
||||
* 上传限速
|
||||
*/
|
||||
private String upLimitRate;
|
||||
/**
|
||||
* 下载限速
|
||||
*/
|
||||
private String downLimitRate;
|
||||
}
|
||||
|
||||
@@ -1,24 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package org.dromara.neutrinoproxy.server.controller.req.proxy;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,24 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package org.dromara.neutrinoproxy.server.controller.req.proxy;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,24 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package org.dromara.neutrinoproxy.server.controller.req.proxy;
|
||||
|
||||
import lombok.Data;
|
||||
@@ -38,4 +17,12 @@ public class LicenseUpdateReq {
|
||||
* license名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 上传限速
|
||||
*/
|
||||
private String upLimitRate;
|
||||
/**
|
||||
* 下载限速
|
||||
*/
|
||||
private String downLimitRate;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
package org.dromara.neutrinoproxy.server.controller.req.proxy;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class PortMappingBindSecurityGroupReq {
|
||||
|
||||
private Integer id;
|
||||
|
||||
private Integer securityGroupId;
|
||||
|
||||
}
|
||||
@@ -1,28 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package org.dromara.neutrinoproxy.server.controller.req.proxy;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 端口映射创建请求
|
||||
* @author: aoshiguchen
|
||||
@@ -38,10 +19,6 @@ public class PortMappingCreateReq {
|
||||
* 协议
|
||||
*/
|
||||
private String protocal;
|
||||
/**
|
||||
* 子域名
|
||||
*/
|
||||
private String subdomain;
|
||||
/**
|
||||
* 服务端端口
|
||||
*/
|
||||
@@ -54,6 +31,14 @@ public class PortMappingCreateReq {
|
||||
* 客户端端口
|
||||
*/
|
||||
private Integer clientPort;
|
||||
/**
|
||||
* 上传限速
|
||||
*/
|
||||
private String upLimitRate;
|
||||
/**
|
||||
* 下载限速
|
||||
*/
|
||||
private String downLimitRate;
|
||||
/**
|
||||
* 代理响应数量(响应数据包数量,如果没有拆包则等于数据条数)
|
||||
*/
|
||||
@@ -62,8 +47,25 @@ public class PortMappingCreateReq {
|
||||
* 代理超时时间
|
||||
*/
|
||||
private Long proxyTimeoutMs;
|
||||
|
||||
/**
|
||||
* 安全组Id
|
||||
*/
|
||||
private Integer securityGroupId;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 域名映射列表
|
||||
*/
|
||||
private List<DomainMapping> domainMappings;
|
||||
|
||||
@Data
|
||||
public class DomainMapping {
|
||||
private Integer domainId;
|
||||
private String subdomain;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,24 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package org.dromara.neutrinoproxy.server.controller.req.proxy;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,24 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package org.dromara.neutrinoproxy.server.controller.req.proxy;
|
||||
|
||||
import org.dromara.neutrinoproxy.server.constant.EnableStatusEnum;
|
||||
|
||||
@@ -1,24 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package org.dromara.neutrinoproxy.server.controller.req.proxy;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,28 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package org.dromara.neutrinoproxy.server.controller.req.proxy;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 端口映射更新请求
|
||||
* @author: aoshiguchen
|
||||
@@ -42,10 +23,6 @@ public class PortMappingUpdateReq {
|
||||
* 协议
|
||||
*/
|
||||
private String protocal;
|
||||
/**
|
||||
* 子域名
|
||||
*/
|
||||
private String subdomain;
|
||||
/**
|
||||
* 服务端端口
|
||||
*/
|
||||
@@ -58,6 +35,14 @@ public class PortMappingUpdateReq {
|
||||
* 客户端端口
|
||||
*/
|
||||
private Integer clientPort;
|
||||
/**
|
||||
* 上传限速
|
||||
*/
|
||||
private String upLimitRate;
|
||||
/**
|
||||
* 下载限速
|
||||
*/
|
||||
private String downLimitRate;
|
||||
/**
|
||||
* 代理响应数量(响应数据包数量,如果没有拆包则等于数据条数)
|
||||
*/
|
||||
@@ -66,8 +51,26 @@ public class PortMappingUpdateReq {
|
||||
* 代理超时时间
|
||||
*/
|
||||
private Long proxyTimeoutMs;
|
||||
|
||||
/**
|
||||
* 安全组Id
|
||||
*/
|
||||
private Integer securityGroupId;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 域名映射列表
|
||||
*/
|
||||
private List<DomainMapping> domainMappings;
|
||||
|
||||
@Data
|
||||
public class DomainMapping {
|
||||
private Integer id;
|
||||
private Integer domainId;
|
||||
private String subdomain;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,24 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package org.dromara.neutrinoproxy.server.controller.req.system;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,24 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package org.dromara.neutrinoproxy.server.controller.req.system;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,24 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package org.dromara.neutrinoproxy.server.controller.req.system;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,24 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package org.dromara.neutrinoproxy.server.controller.req.system;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,24 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package org.dromara.neutrinoproxy.server.controller.req.system;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,24 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package org.dromara.neutrinoproxy.server.controller.req.system;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,24 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package org.dromara.neutrinoproxy.server.controller.req.system;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,24 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package org.dromara.neutrinoproxy.server.controller.req.system;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,24 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package org.dromara.neutrinoproxy.server.controller.req.system;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package org.dromara.neutrinoproxy.server.controller.req.system;
|
||||
|
||||
import lombok.Data;
|
||||
import org.dromara.neutrinoproxy.server.constant.SecurityRulePassTypeEnum;
|
||||
|
||||
@Data
|
||||
public class SecurityGroupCreateReq {
|
||||
/**
|
||||
* 组名
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 通过类型
|
||||
*/
|
||||
private Integer defaultPassType;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package org.dromara.neutrinoproxy.server.controller.req.system;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author: aoshiguchen
|
||||
* @date: 2023/12/10
|
||||
*/
|
||||
@Data
|
||||
public class SecurityGroupDetailReq {
|
||||
private Integer id;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package org.dromara.neutrinoproxy.server.controller.req.system;
|
||||
|
||||
import lombok.Data;
|
||||
import org.dromara.neutrinoproxy.server.constant.SecurityRulePassTypeEnum;
|
||||
|
||||
/**
|
||||
* @author: wen.y
|
||||
* @date: 2023/12/10
|
||||
*/
|
||||
@Data
|
||||
public class SecurityGroupListReq {
|
||||
private String name;
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String description;
|
||||
/**
|
||||
* 通过类型
|
||||
*/
|
||||
private Integer defaultPassType;
|
||||
private Integer enable;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package org.dromara.neutrinoproxy.server.controller.req.system;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author: aoshiguchen
|
||||
* @date: 2023/12/10
|
||||
*/
|
||||
@Data
|
||||
public class SecurityGroupUpdateEnableStatueReq {
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
private Integer id;
|
||||
/**
|
||||
* 启用状态
|
||||
*/
|
||||
private Integer enable;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package org.dromara.neutrinoproxy.server.controller.req.system;
|
||||
|
||||
import lombok.Data;
|
||||
import org.dromara.neutrinoproxy.server.constant.SecurityRulePassTypeEnum;
|
||||
|
||||
@Data
|
||||
public class SecurityGroupUpdateReq {
|
||||
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 组名
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String description;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package org.dromara.neutrinoproxy.server.controller.req.system;
|
||||
|
||||
import cn.hutool.core.net.Ipv4Util;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.dromara.neutrinoproxy.server.constant.EnableStatusEnum;
|
||||
import org.dromara.neutrinoproxy.server.constant.SecurityRulePassTypeEnum;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@ToString
|
||||
@Accessors(chain = true)
|
||||
public class SecurityRuleCreateReq {
|
||||
|
||||
/**
|
||||
* 所属安全组
|
||||
*/
|
||||
private Integer groupId;
|
||||
|
||||
/**
|
||||
* 规则名
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 规则描述
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 规则,ipv6只支持单个ip判断
|
||||
* 单个ip:192.168.1.1,0:0:0:0:0:0:10.0.0.1
|
||||
* 范围类型:192.168.1.0-192.168.1.255
|
||||
* 掩码类型:192.168.1.0/24
|
||||
* 泛型:0.0.0.0/ALL
|
||||
* 每个类型中间以英文逗号分隔
|
||||
*/
|
||||
private String rule;
|
||||
|
||||
/**
|
||||
* 放行类型,reject 或 allow
|
||||
* {@link SecurityRulePassTypeEnum}
|
||||
*/
|
||||
private Integer passType;
|
||||
|
||||
/**
|
||||
* 优先级,数字越小,优先级越高
|
||||
*/
|
||||
private Integer priority = 1;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package org.dromara.neutrinoproxy.server.controller.req.system;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author: aoshiguchen
|
||||
* @date: 2023/12/10
|
||||
*/
|
||||
@Data
|
||||
public class SecurityRuleListReq {
|
||||
private String groupId;
|
||||
private String name;
|
||||
private String description;
|
||||
private Integer passType;
|
||||
private Integer enable;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package org.dromara.neutrinoproxy.server.controller.req.system;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author: aoshiguchen
|
||||
* @date: 2023/12/10
|
||||
*/
|
||||
@Data
|
||||
public class SecurityRuleUpdateEnableStatueReq {
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
private Integer id;
|
||||
/**
|
||||
* 启用状态
|
||||
*/
|
||||
private Integer enable;
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package org.dromara.neutrinoproxy.server.controller.req.system;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.dromara.neutrinoproxy.server.constant.SecurityRulePassTypeEnum;
|
||||
|
||||
@Data
|
||||
@ToString
|
||||
@Accessors(chain = true)
|
||||
public class SecurityRuleUpdateReq {
|
||||
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 所属安全组
|
||||
*/
|
||||
private Integer groupId;
|
||||
|
||||
/**
|
||||
* 规则名
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 规则描述
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 规则,ipv6只支持单个ip判断
|
||||
* 单个ip:192.168.1.1,0:0:0:0:0:0:10.0.0.1
|
||||
* 范围类型:192.168.1.0-192.168.1.255
|
||||
* 掩码类型:192.168.1.0/24
|
||||
* 泛型:0.0.0.0/ALL
|
||||
* 每个类型中间以英文逗号分隔
|
||||
*/
|
||||
private String rule;
|
||||
|
||||
/**
|
||||
* 放行类型,reject 或 allow
|
||||
* {@link SecurityRulePassTypeEnum}
|
||||
*/
|
||||
private Integer passType;
|
||||
|
||||
/**
|
||||
* 优先级,数字越小,优先级越高
|
||||
*/
|
||||
private Integer priority;
|
||||
|
||||
}
|
||||
@@ -1,24 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package org.dromara.neutrinoproxy.server.controller.req.system;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,24 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package org.dromara.neutrinoproxy.server.controller.req.system;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,31 +1,18 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package org.dromara.neutrinoproxy.server.controller.req.system;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 用户列表请求
|
||||
* @author: aoshiguchen
|
||||
* @date: 2022/8/14
|
||||
*/
|
||||
@Data
|
||||
public class UserListReq {
|
||||
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
private String name;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,24 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package org.dromara.neutrinoproxy.server.controller.req.system;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,24 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package org.dromara.neutrinoproxy.server.controller.req.system;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,24 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package org.dromara.neutrinoproxy.server.controller.req.system;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,24 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package org.dromara.neutrinoproxy.server.controller.res.log;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,24 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package org.dromara.neutrinoproxy.server.controller.res.log;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,24 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package org.dromara.neutrinoproxy.server.controller.res.log;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
package org.dromara.neutrinoproxy.server.controller.res.proxy;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.dromara.neutrinoproxy.server.constant.DefaultDomainStatusEnum;
|
||||
import org.dromara.neutrinoproxy.server.constant.EnableStatusEnum;
|
||||
import org.dromara.neutrinoproxy.server.constant.HttpsStatusEnum;
|
||||
import org.dromara.neutrinoproxy.server.constant.SslStatusEnum;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author Mirac
|
||||
* @date 21/7/2024
|
||||
*/
|
||||
@Accessors(chain = true)
|
||||
@Data
|
||||
public class DomainListRes {
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 主域名
|
||||
*/
|
||||
private String domain;
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
private Integer userId;
|
||||
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
private String userName;
|
||||
|
||||
/**
|
||||
* 是否是默认域名(1、是 2、否)
|
||||
* {@link DefaultDomainStatusEnum}
|
||||
*/
|
||||
private Integer isDefault;
|
||||
|
||||
/**
|
||||
* 强制使用HTTPS(1、是 2、否)
|
||||
* {@link HttpsStatusEnum}
|
||||
*/
|
||||
private Integer forceHttps;
|
||||
|
||||
/**
|
||||
* 启用状态
|
||||
* {@link EnableStatusEnum}
|
||||
*/
|
||||
private Integer enable;
|
||||
|
||||
/**
|
||||
* SSLStatusEnum
|
||||
* {@link SslStatusEnum}
|
||||
*/
|
||||
private Integer sslStatus;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package org.dromara.neutrinoproxy.server.controller.res.proxy;
|
||||
|
||||
/**
|
||||
* @author Mirac
|
||||
* @date 23/7/2024
|
||||
*/
|
||||
public class DomainUpdateDefaultStatusRes {
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package org.dromara.neutrinoproxy.server.controller.res.proxy;
|
||||
|
||||
/**
|
||||
* @author Mirac
|
||||
* @date 23/7/2024
|
||||
*/
|
||||
public class DomainUpdateEnableStatusRes {
|
||||
}
|
||||
@@ -1,24 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package org.dromara.neutrinoproxy.server.controller.res.proxy;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,24 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package org.dromara.neutrinoproxy.server.controller.res.proxy;
|
||||
|
||||
import org.dromara.neutrinoproxy.server.constant.EnableStatusEnum;
|
||||
|
||||
@@ -32,6 +32,14 @@ public class LicenseListRes {
|
||||
* 用户名
|
||||
*/
|
||||
private String userName;
|
||||
/**
|
||||
* 上传限速
|
||||
*/
|
||||
private String upLimitRate;
|
||||
/**
|
||||
* 下载限速
|
||||
*/
|
||||
private String downLimitRate;
|
||||
/**
|
||||
* 是否在线
|
||||
* {@link OnlineStatusEnum}
|
||||
|
||||
@@ -1,24 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package org.dromara.neutrinoproxy.server.controller.res.proxy;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,24 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package org.dromara.neutrinoproxy.server.controller.res.proxy;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,24 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package org.dromara.neutrinoproxy.server.controller.res.proxy;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,31 +1,12 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package org.dromara.neutrinoproxy.server.controller.res.proxy;
|
||||
|
||||
import lombok.Data;
|
||||
import org.dromara.neutrinoproxy.server.constant.EnableStatusEnum;
|
||||
import org.dromara.neutrinoproxy.server.constant.OnlineStatusEnum;
|
||||
import lombok.Data;
|
||||
import org.dromara.neutrinoproxy.server.service.bo.FullDomainNameBO;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 端口映射列表响应
|
||||
@@ -43,14 +24,10 @@ public class PortMappingListRes {
|
||||
* 协议
|
||||
*/
|
||||
private String protocal;
|
||||
/**
|
||||
* 子域名
|
||||
*/
|
||||
private String subdomain;
|
||||
/**
|
||||
* 域名
|
||||
*/
|
||||
private String domain;
|
||||
/**
|
||||
* 完整域名映射
|
||||
*/
|
||||
private List<FullDomainNameBO> fullDomainMappings;
|
||||
/**
|
||||
* license名称
|
||||
*/
|
||||
@@ -75,6 +52,14 @@ public class PortMappingListRes {
|
||||
* 客户端端口
|
||||
*/
|
||||
private Integer clientPort;
|
||||
/**
|
||||
* 上传限速
|
||||
*/
|
||||
private String upLimitRate;
|
||||
/**
|
||||
* 下载限速
|
||||
*/
|
||||
private String downLimitRate;
|
||||
/**
|
||||
* 客户端端口
|
||||
*/
|
||||
@@ -101,6 +86,12 @@ public class PortMappingListRes {
|
||||
* 描述
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 安全组Id
|
||||
*/
|
||||
private Integer securityGroupId;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
|
||||
@@ -1,24 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package org.dromara.neutrinoproxy.server.controller.res.proxy;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,24 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package org.dromara.neutrinoproxy.server.controller.res.proxy;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
package org.dromara.neutrinoproxy.server.controller.res.stats;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author: wen.y
|
||||
* @date: 2026/1/20
|
||||
*/
|
||||
@Accessors(chain = true)
|
||||
@Data
|
||||
public class StatsInfoRes {
|
||||
private CacheInfo cacheInfo;
|
||||
|
||||
@Data
|
||||
public static class CacheInfo {
|
||||
private Integer proxyInfoMapSize;
|
||||
private Integer serverPortToCmdChannelMapSize;
|
||||
private Integer licenseToCmdChannelMapSize;
|
||||
private Integer serverPortToVisitorChannelMapSize;
|
||||
private Integer proxyConnectAttachmentMapSize;
|
||||
private Integer fullDomainToServerPortMapSize;
|
||||
private Integer domainToDomainNameIdMapSize;
|
||||
private Integer licenseIdToClientIdMapSize;
|
||||
private Integer visitorIdToSocketAddressMapSize;
|
||||
private Integer socketAddressToVisitorIdMapSize;
|
||||
private Integer visitorIdToTunnelChannelMapSize;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,24 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package org.dromara.neutrinoproxy.server.controller.res.system;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,24 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package org.dromara.neutrinoproxy.server.controller.res.system;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,24 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package org.dromara.neutrinoproxy.server.controller.res.system;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,24 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package org.dromara.neutrinoproxy.server.controller.res.system;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,24 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package org.dromara.neutrinoproxy.server.controller.res.system;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,24 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package org.dromara.neutrinoproxy.server.controller.res.system;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,24 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package org.dromara.neutrinoproxy.server.controller.res.system;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,24 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package org.dromara.neutrinoproxy.server.controller.res.system;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,24 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package org.dromara.neutrinoproxy.server.controller.res.system;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
package org.dromara.neutrinoproxy.server.controller.res.system;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.dromara.neutrinoproxy.server.constant.EnableStatusEnum;
|
||||
import org.dromara.neutrinoproxy.server.constant.SecurityRulePassTypeEnum;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class SecurityGroupDetailRes {
|
||||
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 组名
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 启用状态
|
||||
* {@link EnableStatusEnum}
|
||||
*/
|
||||
private Integer enable;
|
||||
|
||||
/**
|
||||
* 默认放行类型
|
||||
* {@link SecurityRulePassTypeEnum}
|
||||
*/
|
||||
private Integer defaultPassType;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private String createTime;
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private String updateTime;
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package org.dromara.neutrinoproxy.server.controller.res.system;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.dromara.neutrinoproxy.server.constant.EnableStatusEnum;
|
||||
import org.dromara.neutrinoproxy.server.constant.SecurityRulePassTypeEnum;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class SecurityGroupListRes {
|
||||
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 组名
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 启用状态
|
||||
* {@link EnableStatusEnum}
|
||||
*/
|
||||
private Integer enable;
|
||||
|
||||
/**
|
||||
* 默认放行类型
|
||||
* {@link SecurityRulePassTypeEnum}
|
||||
*/
|
||||
private Integer defaultPassType;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package org.dromara.neutrinoproxy.server.controller.res.system;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author: aoshiguchen
|
||||
* @date: 2023/12/10
|
||||
*/
|
||||
@Data
|
||||
public class SecurityGroupUpdateEnableStatueRes {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package org.dromara.neutrinoproxy.server.controller.res.system;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.dromara.neutrinoproxy.server.constant.SecurityRulePassTypeEnum;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@ToString
|
||||
@Accessors(chain = true)
|
||||
public class SecurityRuleListRes {
|
||||
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 所属安全组
|
||||
*/
|
||||
private Integer groupId;
|
||||
|
||||
/**
|
||||
* 规则名
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 规则描述
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 规则,ipv6只支持单个ip判断
|
||||
* 单个ip:192.168.1.1,0:0:0:0:0:0:10.0.0.1
|
||||
* 范围类型:192.168.1.0-192.168.1.255
|
||||
* 掩码类型:192.168.1.0/24
|
||||
* 泛型:0.0.0.0/ALL
|
||||
* 每个类型中间以英文逗号分隔
|
||||
*/
|
||||
private String rule;
|
||||
|
||||
/**
|
||||
* 放行类型,reject 或 allow
|
||||
* {@link SecurityRulePassTypeEnum}
|
||||
*/
|
||||
private Integer passType;
|
||||
|
||||
/**
|
||||
* 优先级,数字越小,优先级越高
|
||||
*/
|
||||
private Integer priority;
|
||||
|
||||
/**
|
||||
* 启用状态
|
||||
*/
|
||||
private Integer enable;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package org.dromara.neutrinoproxy.server.controller.res.system;
|
||||
|
||||
/**
|
||||
* @author: aoshiguchen
|
||||
* @date: 2023/12/10
|
||||
*/
|
||||
public class SecurityRuleUpdateEnableStatueRes {
|
||||
}
|
||||
@@ -1,24 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package org.dromara.neutrinoproxy.server.controller.res.system;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,24 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package org.dromara.neutrinoproxy.server.controller.res.system;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,24 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package org.dromara.neutrinoproxy.server.controller.res.system;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,24 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package org.dromara.neutrinoproxy.server.controller.res.system;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,24 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package org.dromara.neutrinoproxy.server.controller.res.system;
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
package org.dromara.neutrinoproxy.server.dal;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.dromara.neutrinoproxy.server.dal.entity.DomainNameDO;
|
||||
import org.dromara.neutrinoproxy.server.service.bo.FullDomainNameBO;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
|
||||
@Mapper
|
||||
public interface DomainMapper extends BaseMapper<DomainNameDO> {
|
||||
default DomainNameDO checkRepeat(String domain, Set<Integer> excludeIds) {
|
||||
// 查询与输入域名相关的域名列表
|
||||
List<DomainNameDO> domainList = this.selectList(new LambdaQueryWrapper<DomainNameDO>()
|
||||
.notIn(excludeIds != null, DomainNameDO::getId, excludeIds)
|
||||
);
|
||||
|
||||
// 遍历数据库中的域名,检查是否存在重复(包括子域名)
|
||||
for (DomainNameDO domainNameDO : domainList) {
|
||||
String existingDomain = domainNameDO.getDomain();
|
||||
// 完全相等的情况
|
||||
if (existingDomain.equals(domain)) {
|
||||
return domainNameDO;
|
||||
}
|
||||
// // 是子域名关系
|
||||
// if (isSubdomainOrEqual(existingDomain, domain)) {
|
||||
// return domainNameDO;
|
||||
// }
|
||||
}
|
||||
|
||||
// 如果没有找到重复的,返回 null
|
||||
return null;
|
||||
}
|
||||
|
||||
// 辅助方法:判断 domain1 是否是 domain2 的子域名,或者两者相等
|
||||
private boolean isSubdomainOrEqual(String domain1, String domain2) {
|
||||
// 判断是否是子域名关系,例如 "proxy.asgc.fun" 是 "asgc.fun" 的子域名
|
||||
return domain1.endsWith("." + domain2) || domain2.endsWith("." + domain1);
|
||||
}
|
||||
|
||||
default void updateEnableStatus(Integer id, Integer enable, Date updateTime) {
|
||||
this.update(Wrappers.<DomainNameDO>lambdaUpdate()
|
||||
.eq(DomainNameDO::getId, id)
|
||||
.set(DomainNameDO::getEnable, enable)
|
||||
.set(DomainNameDO::getUpdateTime, updateTime)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
List<FullDomainNameBO> selectFullDomainNameListByPortMappingIds(@Param("ids") Set<Integer> ids);
|
||||
|
||||
List<FullDomainNameBO> selectFullDomainNameListByDomainNameIds(@Param("ids") Set<Integer> ids);
|
||||
|
||||
List<FullDomainNameBO> selectFullDomainNameList();
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package org.dromara.neutrinoproxy.server.dal;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.dromara.neutrinoproxy.server.dal.entity.DomainPortMappingDO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author: Mirac
|
||||
* @date: 2024/8/24
|
||||
*/
|
||||
@Mapper
|
||||
public interface DomainPortMappingMapper extends BaseMapper<DomainPortMappingDO> {
|
||||
default Boolean checkRepeatBySubdomain(String subdomain, Integer domainNameId, Integer id) {
|
||||
return StringUtils.isEmpty(subdomain)? Boolean.FALSE : this.selectCount(new LambdaQueryWrapper<DomainPortMappingDO>()
|
||||
.eq(DomainPortMappingDO::getSubdomain, subdomain)
|
||||
.eq(DomainPortMappingDO::getDomainNameId, domainNameId)
|
||||
.ne(id != null, DomainPortMappingDO::getId, id)
|
||||
.last("limit 1")
|
||||
).intValue() > 0;
|
||||
}
|
||||
|
||||
default List<DomainPortMappingDO> findByPortMappingId(Integer portMappingId) {
|
||||
return this.selectList(Wrappers.<DomainPortMappingDO>lambdaQuery()
|
||||
.eq(DomainPortMappingDO::getPortMappingId, portMappingId));
|
||||
}
|
||||
|
||||
default void deleteByDomainNameId(Integer doomainNameId) {
|
||||
this.delete(Wrappers.<DomainPortMappingDO>lambdaQuery()
|
||||
.eq(DomainPortMappingDO::getDomainNameId, doomainNameId));
|
||||
}
|
||||
|
||||
default boolean checkUsed(Integer domainNameId) {
|
||||
return this.exists(Wrappers.<DomainPortMappingDO>lambdaQuery()
|
||||
.eq(DomainPortMappingDO::getDomainNameId, domainNameId));
|
||||
}
|
||||
}
|
||||
@@ -45,8 +45,8 @@ public interface FlowReportHourMapper extends BaseMapper<FlowReportHourDO> {
|
||||
|
||||
default List<FlowReportHourDO> findListByDateRange(Date startDate, Date endDate) {
|
||||
return this.selectList(new LambdaQueryWrapper<FlowReportHourDO>()
|
||||
.ge(FlowReportHourDO::getDateStr, startDate)
|
||||
.le(FlowReportHourDO::getDateStr, endDate)
|
||||
.ge(FlowReportHourDO::getDate, startDate)
|
||||
.le(FlowReportHourDO::getDate, endDate)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -89,14 +89,6 @@ public interface LicenseMapper extends BaseMapper<LicenseDO> {
|
||||
return this.selectById(id);
|
||||
}
|
||||
|
||||
default void update(Integer id, String name, Date updateTime) {
|
||||
this.update(null, new LambdaUpdateWrapper<LicenseDO>()
|
||||
.eq(LicenseDO::getId, id)
|
||||
.set(LicenseDO::getName, name)
|
||||
.set(LicenseDO::getUpdateTime, updateTime)
|
||||
);
|
||||
}
|
||||
|
||||
default List<LicenseDO> findByIds(Set<Integer> ids) {
|
||||
return selectBatchIds(ids);
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import org.dromara.neutrinoproxy.server.controller.req.proxy.PortMappingListReq;
|
||||
import org.dromara.neutrinoproxy.server.dal.entity.PortMappingDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.dromara.neutrinoproxy.server.service.bo.FullDomainNameBO;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@@ -44,18 +45,6 @@ public interface PortMappingMapper extends BaseMapper<PortMappingDO> {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验子域名是否重复
|
||||
* @param subdomain
|
||||
* @return
|
||||
*/
|
||||
default Boolean checkRepeatBySubdomain(String subdomain, Set<Integer> excludeIds) {
|
||||
return StringUtils.isEmpty(subdomain)? Boolean.FALSE : this.selectCount(new LambdaQueryWrapper<PortMappingDO>()
|
||||
.eq(PortMappingDO::getSubdomain, subdomain)
|
||||
.notIn(!CollectionUtil.isEmpty(excludeIds), PortMappingDO::getId, excludeIds)
|
||||
).intValue() > 0;
|
||||
}
|
||||
|
||||
default List<PortMappingDO> findEnableListByLicenseId(Integer licenseId) {
|
||||
return this.selectList(new LambdaQueryWrapper<PortMappingDO>()
|
||||
.eq(PortMappingDO::getLicenseId, licenseId)
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
package org.dromara.neutrinoproxy.server.dal;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.dromara.neutrinoproxy.server.controller.req.proxy.PortMappingListReq;
|
||||
import org.dromara.neutrinoproxy.server.controller.req.system.SecurityGroupListReq;
|
||||
import org.dromara.neutrinoproxy.server.dal.entity.PortMappingDO;
|
||||
import org.dromara.neutrinoproxy.server.dal.entity.SecurityGroupDO;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public interface SecurityGroupMapper extends BaseMapper<SecurityGroupDO> {
|
||||
List<SecurityGroupDO> selectByCondition(IPage<SecurityGroupDO> page, @Param("req") SecurityGroupListReq req);
|
||||
|
||||
default void updateEnableStatus(Integer id, Integer enable, Date updateTime) {
|
||||
this.update(null, new LambdaUpdateWrapper<SecurityGroupDO>()
|
||||
.eq(SecurityGroupDO::getId, id)
|
||||
.set(SecurityGroupDO::getEnable, enable)
|
||||
.set(SecurityGroupDO::getUpdateTime, updateTime)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package org.dromara.neutrinoproxy.server.dal;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.dromara.neutrinoproxy.server.controller.req.system.SecurityGroupListReq;
|
||||
import org.dromara.neutrinoproxy.server.controller.req.system.SecurityRuleListReq;
|
||||
import org.dromara.neutrinoproxy.server.dal.entity.SecurityGroupDO;
|
||||
import org.dromara.neutrinoproxy.server.dal.entity.SecurityRuleDO;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public interface SecurityRuleMapper extends BaseMapper<SecurityRuleDO> {
|
||||
List<SecurityRuleDO> selectByCondition(IPage<SecurityRuleDO> page, @Param("req") SecurityRuleListReq req);
|
||||
|
||||
default void updateEnableStatus(Integer id, Integer enable, Date updateTime) {
|
||||
this.update(null, new LambdaUpdateWrapper<SecurityRuleDO>()
|
||||
.eq(SecurityRuleDO::getId, id)
|
||||
.set(SecurityRuleDO::getEnable, enable)
|
||||
.set(SecurityRuleDO::getUpdateTime, updateTime)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package org.dromara.neutrinoproxy.server.dal.entity;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.dromara.neutrinoproxy.server.constant.*;
|
||||
import org.dromara.neutrinoproxy.server.controller.res.proxy.DomainListRes;
|
||||
import org.dromara.neutrinoproxy.server.controller.res.proxy.PortMappingListRes;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 域名
|
||||
* @author: Mirac
|
||||
* @date: 2024/7/21
|
||||
*/
|
||||
@ToString
|
||||
@Accessors(chain = true)
|
||||
@Data
|
||||
@TableName("domain_name")
|
||||
public class DomainNameDO {
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 主域名
|
||||
*/
|
||||
private String domain;
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
private Integer userId;
|
||||
|
||||
/**
|
||||
* SSL证书文件内容
|
||||
*/
|
||||
private byte[] jks;
|
||||
|
||||
/**
|
||||
* KeyStore密码
|
||||
*/
|
||||
private String keyStorePassword;
|
||||
|
||||
/**
|
||||
* 是否是默认域名(1、是 2、否)
|
||||
* {@link DefaultDomainStatusEnum}
|
||||
*/
|
||||
private Integer isDefault;
|
||||
|
||||
/**
|
||||
* 强制使用HTTPS(1、是 2、否)
|
||||
* {@link HttpsStatusEnum}
|
||||
*/
|
||||
private Integer forceHttps;
|
||||
|
||||
/**
|
||||
* 启用状态
|
||||
* {@link EnableStatusEnum}
|
||||
*/
|
||||
private Integer enable;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
public DomainListRes toRes() {
|
||||
DomainListRes res = new DomainListRes();
|
||||
BeanUtil.copyProperties(this, res);
|
||||
res.setSslStatus(this.getJks() == null ? SslStatusEnum.NOT_UPLOADED.getStatus() : SslStatusEnum.UPLOADED.getStatus());
|
||||
return res;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package org.dromara.neutrinoproxy.server.dal.entity;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.dromara.neutrinoproxy.server.constant.EnableStatusEnum;
|
||||
import org.dromara.neutrinoproxy.server.constant.OnlineStatusEnum;
|
||||
import org.dromara.neutrinoproxy.server.controller.res.proxy.PortMappingListRes;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author: Mirac
|
||||
* @date: 2024/8/24
|
||||
*/
|
||||
@ToString
|
||||
@Accessors(chain = true)
|
||||
@Data
|
||||
@TableName("domain_port_mapping")
|
||||
public class DomainPortMappingDO {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Integer id;
|
||||
/**
|
||||
* 端口映射id
|
||||
*/
|
||||
private Integer portMappingId;
|
||||
/**
|
||||
* 域名id
|
||||
*/
|
||||
private Integer domainNameId;
|
||||
/**
|
||||
* 子域名
|
||||
*/
|
||||
private String subdomain;
|
||||
}
|
||||
@@ -21,6 +21,7 @@
|
||||
*/
|
||||
package org.dromara.neutrinoproxy.server.dal.entity;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
@@ -59,6 +60,14 @@ public class LicenseDO {
|
||||
* 用户ID
|
||||
*/
|
||||
private Integer userId;
|
||||
/**
|
||||
* 上传限速
|
||||
*/
|
||||
private String upLimitRate;
|
||||
/**
|
||||
* 下载限速
|
||||
*/
|
||||
private String downLimitRate;
|
||||
/**
|
||||
* 是否在线
|
||||
* {@link OnlineStatusEnum}
|
||||
@@ -80,14 +89,7 @@ public class LicenseDO {
|
||||
|
||||
public LicenseListRes toRes() {
|
||||
LicenseListRes res = new LicenseListRes();
|
||||
res.setId(id);
|
||||
res.setName(name);
|
||||
res.setKey(key);
|
||||
res.setUserId(userId);
|
||||
res.setIsOnline(isOnline);
|
||||
res.setEnable(enable);
|
||||
res.setCreateTime(createTime);
|
||||
res.setUpdateTime(updateTime);
|
||||
BeanUtil.copyProperties(this, res);
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
*/
|
||||
package org.dromara.neutrinoproxy.server.dal.entity;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
@@ -53,10 +54,6 @@ public class PortMappingDO {
|
||||
* 协议
|
||||
*/
|
||||
private String protocal;
|
||||
/**
|
||||
* 子域名
|
||||
*/
|
||||
private String subdomain;
|
||||
/**
|
||||
* 服务端端口
|
||||
*/
|
||||
@@ -69,6 +66,14 @@ public class PortMappingDO {
|
||||
* 客户端端口
|
||||
*/
|
||||
private Integer clientPort;
|
||||
/**
|
||||
* 上传限速
|
||||
*/
|
||||
private String upLimitRate;
|
||||
/**
|
||||
* 下载限速
|
||||
*/
|
||||
private String downLimitRate;
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
@@ -92,6 +97,12 @@ public class PortMappingDO {
|
||||
* {@link EnableStatusEnum}
|
||||
*/
|
||||
private Integer enable;
|
||||
|
||||
/**
|
||||
* 安全组Id
|
||||
*/
|
||||
private Integer securityGroupId = 0; // 设置为null不生效,不知道为啥
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@@ -101,23 +112,9 @@ public class PortMappingDO {
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
|
||||
public PortMappingListRes toRes() {
|
||||
PortMappingListRes res = new PortMappingListRes();
|
||||
res.setId(id);
|
||||
res.setLicenseId(licenseId);
|
||||
res.setProtocal(protocal);
|
||||
res.setSubdomain(subdomain);
|
||||
res.setServerPort(serverPort);
|
||||
res.setClientIp(clientIp);
|
||||
res.setClientPort(clientPort);
|
||||
res.setDescription(description);
|
||||
res.setIsOnline(isOnline);
|
||||
res.setProxyResponses(proxyResponses);
|
||||
res.setProxyTimeoutMs(proxyTimeoutMs);
|
||||
res.setEnable(enable);
|
||||
res.setCreateTime(createTime);
|
||||
res.setUpdateTime(updateTime);
|
||||
BeanUtil.copyProperties(this, res);
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
package org.dromara.neutrinoproxy.server.dal.entity;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.dromara.neutrinoproxy.server.constant.EnableStatusEnum;
|
||||
import org.dromara.neutrinoproxy.server.constant.SecurityRulePassTypeEnum;
|
||||
import org.dromara.neutrinoproxy.server.controller.res.system.SecurityGroupDetailRes;
|
||||
import org.dromara.neutrinoproxy.server.controller.res.system.SecurityGroupListRes;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@ToString
|
||||
@Accessors(chain = true)
|
||||
@TableName("security_group")
|
||||
public class SecurityGroupDO {
|
||||
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 组名
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Integer userId;
|
||||
/**
|
||||
* 启用状态
|
||||
* {@link EnableStatusEnum}
|
||||
*/
|
||||
private Integer enable;
|
||||
|
||||
/**
|
||||
* 默认放行类型
|
||||
* {@link SecurityRulePassTypeEnum}
|
||||
*/
|
||||
private Integer defaultPassType;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
public SecurityGroupListRes toListRes() {
|
||||
SecurityGroupListRes res = new SecurityGroupListRes();
|
||||
BeanUtil.copyProperties(this, res);
|
||||
return res;
|
||||
}
|
||||
|
||||
public SecurityGroupDetailRes toDetailRes() {
|
||||
SecurityGroupDetailRes res = new SecurityGroupDetailRes();
|
||||
BeanUtil.copyProperties(this, res);
|
||||
return res;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,152 @@
|
||||
package org.dromara.neutrinoproxy.server.dal.entity;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.net.Ipv4Util;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.dromara.neutrinoproxy.server.constant.EnableStatusEnum;
|
||||
import org.dromara.neutrinoproxy.server.constant.SecurityRulePassTypeEnum;
|
||||
import org.dromara.neutrinoproxy.server.controller.res.system.SecurityRuleListRes;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@ToString
|
||||
@Accessors(chain = true)
|
||||
@TableName("security_rule")
|
||||
public class SecurityRuleDO {
|
||||
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 所属安全组
|
||||
*/
|
||||
private Integer groupId;
|
||||
|
||||
/**
|
||||
* 规则名
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 规则描述
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 规则,ipv6只支持单个ip判断
|
||||
* 单个ip:192.168.1.1,0:0:0:0:0:0:10.0.0.1
|
||||
* 范围类型:192.168.1.0-192.168.1.255
|
||||
* 掩码类型:192.168.1.0/24
|
||||
* 泛型:0.0.0.0/ALL
|
||||
* 每个类型中间以英文逗号分隔
|
||||
*/
|
||||
private String rule;
|
||||
|
||||
/**
|
||||
* 放行类型,reject 或 allow
|
||||
* {@link SecurityRulePassTypeEnum}
|
||||
*/
|
||||
private Integer passType;
|
||||
|
||||
/**
|
||||
* 优先级,数字越小,优先级越高
|
||||
*/
|
||||
private Integer priority = 1;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Integer userId;
|
||||
|
||||
/**
|
||||
* 启用状态
|
||||
* {@link EnableStatusEnum}
|
||||
*/
|
||||
private Integer enable;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 判断当前规则是否允许指定ip放行
|
||||
* @param ip 指定的IP
|
||||
* @return 放行状态
|
||||
*/
|
||||
public SecurityRulePassTypeEnum judge(String ip) {
|
||||
|
||||
// 被判断的IP地址为空,不做判断
|
||||
if (StrUtil.isEmpty(ip)) {
|
||||
return SecurityRulePassTypeEnum.NONE;
|
||||
}
|
||||
|
||||
// 没有规则,默认允许访问
|
||||
if (StrUtil.isEmpty(rule)) {
|
||||
return SecurityRulePassTypeEnum.ALLOW;
|
||||
}
|
||||
|
||||
// ipv6只适配单ip形式
|
||||
boolean isIpv6 = ip.contains(":");
|
||||
long ipLong = -1L;
|
||||
if (!isIpv6) {
|
||||
ipLong = Ipv4Util.ipv4ToLong(ip);
|
||||
}
|
||||
|
||||
String[] rules = this.rule.split(",");
|
||||
for (String rule : rules) {
|
||||
|
||||
rule = rule.trim();
|
||||
|
||||
// 单个ip,ipv6在此步已处理,后面不需要额外判断ipv6的情况
|
||||
if (rule.matches("(\\d+\\.){3}\\d+") || isIpv6) {
|
||||
if (rule.equalsIgnoreCase(ip)) {
|
||||
return SecurityRulePassTypeEnum.ALLOW.getType().equals(passType) ? SecurityRulePassTypeEnum.ALLOW : SecurityRulePassTypeEnum.DENY;
|
||||
}
|
||||
}
|
||||
|
||||
// 范围类型
|
||||
if (rule.matches("(\\d+\\.){3}\\d+-(\\d+\\.){3}\\d+")) {
|
||||
String[] ipRange = rule.split("-");
|
||||
if (ipRange[0].compareTo(ip) <= 0 && ip.compareTo(ipRange[1]) <= 0) {
|
||||
return SecurityRulePassTypeEnum.ALLOW.getType().equals(passType) ? SecurityRulePassTypeEnum.ALLOW : SecurityRulePassTypeEnum.DENY;
|
||||
}
|
||||
}
|
||||
|
||||
// 掩码类型
|
||||
if (rule.matches("(\\d+\\.){3}\\d+/\\d+")) {
|
||||
String[] netIp = rule.split("/");
|
||||
Long beginIp = Ipv4Util.getBeginIpLong(netIp[0], Integer.parseInt(netIp[1]));
|
||||
Long endIp = Ipv4Util.getEndIpLong(netIp[0], Integer.parseInt(netIp[1]));
|
||||
if (beginIp <= ipLong && ipLong <= endIp) {
|
||||
return SecurityRulePassTypeEnum.ALLOW.getType().equals(passType) ? SecurityRulePassTypeEnum.ALLOW : SecurityRulePassTypeEnum.DENY;
|
||||
}
|
||||
}
|
||||
|
||||
if (rule.equalsIgnoreCase("ALL") || rule.equals("0.0.0.0") || rule.equals("0.0.0.0/0")) {
|
||||
return SecurityRulePassTypeEnum.ALLOW.getType().equals(passType) ? SecurityRulePassTypeEnum.ALLOW : SecurityRulePassTypeEnum.DENY;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 都没有匹配到
|
||||
return SecurityRulePassTypeEnum.NONE;
|
||||
}
|
||||
|
||||
public SecurityRuleListRes toListRes() {
|
||||
SecurityRuleListRes res = new SecurityRuleListRes();
|
||||
BeanUtil.copyProperties(this, res);
|
||||
return res;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,24 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package org.dromara.neutrinoproxy.server.job;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
|
||||
@@ -1,25 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.dromara.neutrinoproxy.server.proxy.core;
|
||||
|
||||
import org.dromara.neutrinoproxy.server.proxy.domain.MetricsCollector;
|
||||
|
||||
@@ -1,27 +1,6 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.dromara.neutrinoproxy.server.proxy.core;
|
||||
|
||||
import io.netty.handler.codec.DecoderException;
|
||||
import org.dromara.neutrinoproxy.core.Constants;
|
||||
import org.dromara.neutrinoproxy.core.ProxyMessage;
|
||||
import org.dromara.neutrinoproxy.core.dispatcher.Dispatcher;
|
||||
@@ -39,7 +18,9 @@ import io.netty.handler.timeout.IdleStateEvent;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.noear.solon.Solon;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.SocketException;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
@@ -73,6 +54,7 @@ public class ProxyTunnelChannelHandler extends SimpleChannelInboundHandler<Proxy
|
||||
Channel visitorChannel = ctx.channel().attr(Constants.NEXT_CHANNEL).get();
|
||||
if (visitorChannel != null) {
|
||||
visitorChannel.config().setOption(ChannelOption.AUTO_READ, ctx.channel().isWritable());
|
||||
// visitorChannel.config().setAutoRead(ctx.channel().isWritable());
|
||||
}
|
||||
|
||||
super.channelWritabilityChanged(ctx);
|
||||
@@ -80,6 +62,13 @@ public class ProxyTunnelChannelHandler extends SimpleChannelInboundHandler<Proxy
|
||||
|
||||
@Override
|
||||
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
|
||||
{
|
||||
// udp情况下不能使用visitorChannel上的visitorId,因为所有的用户都是走的同一个VisitorChannel
|
||||
String visitorId = ctx.channel().attr(Constants.VISITOR_ID).get();
|
||||
// 删除Udp的SocketAddress
|
||||
ProxyUtil.removeSocketAddressByVisitorId(visitorId);
|
||||
}
|
||||
|
||||
Channel visitorChannel = ctx.channel().attr(Constants.NEXT_CHANNEL).get();
|
||||
if (null != visitorChannel) {
|
||||
Integer licenseId = ctx.channel().attr(Constants.LICENSE_ID).get();
|
||||
@@ -96,7 +85,7 @@ public class ProxyTunnelChannelHandler extends SimpleChannelInboundHandler<Proxy
|
||||
if (visitorChannel.isActive() && null == isUdp) {
|
||||
// 数据发送完成后再关闭连接,解决http1.0数据传输问题
|
||||
visitorChannel.writeAndFlush(Unpooled.EMPTY_BUFFER).addListener(ChannelFutureListener.CLOSE);
|
||||
visitorChannel.close();
|
||||
// visitorChannel.close();
|
||||
}
|
||||
} else {
|
||||
CmdChannelAttachInfo cmdChannelAttachInfo = ProxyUtil.getAttachInfo(ctx.channel());
|
||||
@@ -126,11 +115,29 @@ public class ProxyTunnelChannelHandler extends SimpleChannelInboundHandler<Proxy
|
||||
|
||||
@Override
|
||||
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
|
||||
// super.exceptionCaught(ctx, cause);
|
||||
// if (ctx.channel().isActive()) {
|
||||
// ctx.channel().close();
|
||||
// }
|
||||
log.error("[Tunnel Channel] error", cause);
|
||||
// 对于网络IO异常(致命异常),关闭channel以防止资源泄漏
|
||||
// 对于其他异常(可能是可恢复的业务异常),只记录日志
|
||||
if (cause instanceof IOException) {
|
||||
// IOException及其子类(包括SocketException)都是致命的网络异常
|
||||
if (cause instanceof SocketException && cause.getMessage() != null && cause.getMessage().contains("Connection reset")) {
|
||||
// Connection reset是常见的客户端断开,使用debug级别
|
||||
log.debug("[Tunnel Channel] Connection reset: {}", cause.getMessage());
|
||||
} else {
|
||||
log.error("[Tunnel Channel] IO error", cause);
|
||||
}
|
||||
if (ctx.channel().isActive()) {
|
||||
ctx.channel().close();
|
||||
}
|
||||
} else if(cause instanceof DecoderException) {
|
||||
// 协议解析错误,为防止数据污染,立即关闭
|
||||
log.debug("[Tunnel Channel] decoder error: {}", cause.getMessage());
|
||||
if (ctx.channel().isActive()) {
|
||||
ctx.channel().close();
|
||||
}
|
||||
} else {
|
||||
// 其他异常只记录日志,不关闭channel,让Netty自己处理
|
||||
log.error("[Tunnel Channel] error", cause);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package org.dromara.neutrinoproxy.server.proxy.core;
|
||||
|
||||
import io.netty.channel.ChannelOption;
|
||||
import io.netty.channel.WriteBufferWaterMark;
|
||||
import io.netty.handler.logging.LoggingHandler;
|
||||
import org.dromara.neutrinoproxy.core.ProxyMessageDecoder;
|
||||
import org.dromara.neutrinoproxy.core.ProxyMessageEncoder;
|
||||
@@ -54,6 +56,12 @@ public class ProxyTunnelServer implements EventListener<AppLoadEndEvent> {
|
||||
*/
|
||||
private void startProxyServer() {
|
||||
ServerBootstrap bootstrap = new ServerBootstrap();
|
||||
|
||||
WriteBufferWaterMark waterMark = proxyConfig.getWaterMark();
|
||||
if (null != waterMark) {
|
||||
bootstrap.childOption(ChannelOption.WRITE_BUFFER_WATER_MARK, waterMark);
|
||||
}
|
||||
|
||||
bootstrap.group(serverBossGroup, serverWorkerGroup).channel(NioServerSocketChannel.class).childHandler(new ChannelInitializer<SocketChannel>() {
|
||||
|
||||
@Override
|
||||
@@ -91,8 +99,7 @@ public class ProxyTunnelServer implements EventListener<AppLoadEndEvent> {
|
||||
}
|
||||
|
||||
private ChannelHandler createSslHandler() {
|
||||
try {
|
||||
InputStream jksInputStream = FileUtil.getInputStream(proxyConfig.getTunnel().getJksPath());
|
||||
try (InputStream jksInputStream = FileUtil.getInputStream(proxyConfig.getTunnel().getJksPath())) {
|
||||
SSLContext serverContext = SSLContext.getInstance("TLS");
|
||||
final KeyStore ks = KeyStore.getInstance("JKS");
|
||||
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
package org.dromara.neutrinoproxy.server.proxy.core;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import io.netty.channel.*;
|
||||
import io.netty.handler.codec.DecoderException;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.neutrinoproxy.core.Constants;
|
||||
import org.dromara.neutrinoproxy.core.ProxyMessage;
|
||||
@@ -8,14 +12,11 @@ import org.dromara.neutrinoproxy.server.constant.NetworkProtocolEnum;
|
||||
import org.dromara.neutrinoproxy.server.proxy.domain.VisitorChannelAttachInfo;
|
||||
import org.dromara.neutrinoproxy.server.service.FlowReportService;
|
||||
import org.dromara.neutrinoproxy.server.util.ProxyUtil;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.channel.Channel;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import io.netty.channel.ChannelOption;
|
||||
import io.netty.channel.SimpleChannelInboundHandler;
|
||||
import org.noear.solon.Solon;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.SocketException;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -27,9 +28,29 @@ public class TcpVisitorChannelHandler extends SimpleChannelInboundHandler<ByteBu
|
||||
|
||||
@Override
|
||||
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
|
||||
// 当出现异常就关闭连接
|
||||
ctx.close();
|
||||
log.error("VisitorChannel error", cause);
|
||||
// 对于网络IO异常(致命异常),关闭channel以防止资源泄漏
|
||||
// 对于其他异常(可能是可恢复的业务异常),只记录日志
|
||||
if (cause instanceof IOException) {
|
||||
// IOException及其子类(包括SocketException)都是致命的网络异常
|
||||
if (cause instanceof SocketException && cause.getMessage() != null && cause.getMessage().contains("Connection reset")) {
|
||||
// Connection reset是常见的客户端断开,使用debug级别
|
||||
log.debug("[TCP Visitor Channel] connection reset: {}", cause.getMessage());
|
||||
} else {
|
||||
log.error("[TCP Visitor Channel] IO error", cause);
|
||||
}
|
||||
if (ctx.channel().isActive()) {
|
||||
ctx.channel().close();
|
||||
}
|
||||
} else if(cause instanceof DecoderException) {
|
||||
// 协议解析错误,为防止数据污染,立即关闭
|
||||
log.debug("[TCP Visitor Channel] decoder error: {}", cause.getMessage());
|
||||
if (ctx.channel().isActive()) {
|
||||
ctx.channel().close();
|
||||
}
|
||||
} else {
|
||||
// 其他异常只记录日志,不关闭channel,让Netty自己处理
|
||||
log.error("[TCP Visitor Channel] error", cause);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -43,13 +64,13 @@ public class TcpVisitorChannelHandler extends SimpleChannelInboundHandler<ByteBu
|
||||
ctx.channel().close();
|
||||
return;
|
||||
}
|
||||
byte[] bytes = new byte[buf.readableBytes()];
|
||||
buf.readBytes(bytes);
|
||||
|
||||
// 代理通道可写,则设置访问通道可读。代理通道不可写,则设置访问通道不可读
|
||||
visitorChannel.config().setAutoRead(proxyChannel.isWritable());
|
||||
|
||||
// 转发代理数据
|
||||
byte[] bytes = new byte[buf.readableBytes()];
|
||||
buf.readBytes(bytes);
|
||||
String visitorId = ProxyUtil.getVisitorIdByChannel(visitorChannel);
|
||||
proxyChannel.writeAndFlush(ProxyMessage.buildTransferMessage(visitorId, bytes));
|
||||
|
||||
@@ -62,8 +83,8 @@ public class TcpVisitorChannelHandler extends SimpleChannelInboundHandler<ByteBu
|
||||
public void channelActive(ChannelHandlerContext ctx) throws Exception {
|
||||
Channel visitorChannel = ctx.channel();
|
||||
InetSocketAddress sa = (InetSocketAddress) visitorChannel.localAddress();
|
||||
Channel cmdChannel = ProxyUtil.getCmdChannelByServerPort(sa.getPort());
|
||||
|
||||
Channel cmdChannel = ProxyUtil.getCmdChannelByServerPort(sa.getPort());
|
||||
if (null == cmdChannel) {
|
||||
// 该端口还没有代理客户端
|
||||
ctx.channel().close();
|
||||
@@ -95,11 +116,7 @@ public class TcpVisitorChannelHandler extends SimpleChannelInboundHandler<ByteBu
|
||||
InetSocketAddress sa = (InetSocketAddress) visitorChannel.localAddress();
|
||||
Channel cmdChannel = ProxyUtil.getCmdChannelByServerPort(sa.getPort());
|
||||
|
||||
if (null == cmdChannel) {
|
||||
// 该端口还没有代理客户端
|
||||
ctx.channel().close();
|
||||
} else {
|
||||
|
||||
if (null != cmdChannel) {
|
||||
// 用户连接断开,从控制连接中移除
|
||||
String visitorId = ProxyUtil.getVisitorIdByChannel(visitorChannel);
|
||||
ProxyUtil.removeVisitorChannelFromCmdChannel(cmdChannel, visitorId);
|
||||
@@ -116,6 +133,8 @@ public class TcpVisitorChannelHandler extends SimpleChannelInboundHandler<ByteBu
|
||||
proxyChannel.config().setOption(ChannelOption.AUTO_READ, true);
|
||||
// 通知客户端,用户连接已经断开
|
||||
proxyChannel.writeAndFlush(ProxyMessage.buildDisconnectMessage(visitorId));
|
||||
|
||||
proxyChannel.writeAndFlush(Unpooled.EMPTY_BUFFER).addListener(ChannelFutureListener.CLOSE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -138,6 +157,7 @@ public class TcpVisitorChannelHandler extends SimpleChannelInboundHandler<ByteBu
|
||||
Channel proxyChannel = visitorChannel.attr(Constants.NEXT_CHANNEL).get();
|
||||
if (null != proxyChannel) {
|
||||
proxyChannel.config().setOption(ChannelOption.AUTO_READ, visitorChannel.isWritable());
|
||||
// proxyChannel.config().setAutoRead(visitorChannel.isWritable());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,18 +7,15 @@ import io.netty.channel.ChannelOption;
|
||||
import io.netty.channel.SimpleChannelInboundHandler;
|
||||
import io.netty.channel.socket.DatagramPacket;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.dromara.neutrinoproxy.core.Constants;
|
||||
import org.dromara.neutrinoproxy.core.ProxyMessage;
|
||||
import org.dromara.neutrinoproxy.server.constant.NetworkProtocolEnum;
|
||||
import org.dromara.neutrinoproxy.server.proxy.domain.ProxyAttachment;
|
||||
import org.dromara.neutrinoproxy.server.proxy.domain.VisitorChannelAttachInfo;
|
||||
import org.dromara.neutrinoproxy.server.service.FlowReportService;
|
||||
import org.dromara.neutrinoproxy.server.util.ProxyUtil;
|
||||
import org.noear.solon.Solon;
|
||||
|
||||
import java.net.InetSocketAddress;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
/**
|
||||
* @author: aoshiguchen
|
||||
@@ -29,12 +26,19 @@ public class UdpVisitorChannelHandler extends SimpleChannelInboundHandler<Datagr
|
||||
|
||||
@Override
|
||||
protected void channelRead0(ChannelHandlerContext ctx, DatagramPacket datagramPacket) throws Exception {
|
||||
log.debug("chid>>>{}", ctx.channel().id().asLongText());
|
||||
Channel visitorChannel = ctx.channel();
|
||||
InetSocketAddress sa = (InetSocketAddress) visitorChannel.localAddress();
|
||||
|
||||
byte[] bytes = new byte[datagramPacket.content().readableBytes()];
|
||||
datagramPacket.content().readBytes(bytes);
|
||||
datagramPacket.content().resetReaderIndex();
|
||||
ProxyAttachment proxyAttachment = new ProxyAttachment(ctx.channel(), bytes, (channel, buf) -> {
|
||||
Channel proxyChannel = channel.attr(Constants.NEXT_CHANNEL).get();
|
||||
Constants.ProxyAttachment proxyAttachment = new Constants.ProxyAttachment(bytes, (channel, buf) -> {
|
||||
String visitorId = ProxyUtil.getVisitorIdBySocketAddress(datagramPacket.sender());
|
||||
if (StrUtil.isBlank(visitorId)) {
|
||||
return;
|
||||
}
|
||||
Channel proxyChannel = ProxyUtil.getTunnelChannelByVisitorId(visitorId);
|
||||
// Channel proxyChannel = channel.attr(Constants.NEXT_CHANNEL).get();
|
||||
|
||||
if (null == proxyChannel) {
|
||||
// // 该端口还没有代理客户端
|
||||
@@ -49,7 +53,6 @@ public class UdpVisitorChannelHandler extends SimpleChannelInboundHandler<Datagr
|
||||
Long proxyTimeoutMs = proxyChannel.attr(Constants.PROXY_TIMEOUT_MS).get();
|
||||
|
||||
// 转发代理数据
|
||||
String visitorId = ProxyUtil.getVisitorIdByChannel(channel);
|
||||
proxyChannel.writeAndFlush(ProxyMessage.buildUdpTransferMessage(new ProxyMessage.UdpBaseInfo()
|
||||
.setVisitorId(visitorId)
|
||||
.setVisitorIp(datagramPacket.sender().getAddress().getHostAddress())
|
||||
@@ -65,21 +68,14 @@ public class UdpVisitorChannelHandler extends SimpleChannelInboundHandler<Datagr
|
||||
Solon.context().getBean(FlowReportService.class).addWriteByte(visitorChannelAttachInfo.getLicenseId(), bytes.length);
|
||||
});
|
||||
|
||||
// String visitorId = ProxyUtil.getVisitorIdByChannel(ctx.channel());
|
||||
// if (StringUtils.isNotBlank(visitorId)) {
|
||||
// // UDP代理隧道已就绪,直接转发
|
||||
// proxyAttachment.execute();
|
||||
// return;
|
||||
// }
|
||||
Channel proxyChannel = ctx.channel().attr(Constants.NEXT_CHANNEL).get();
|
||||
if (null != proxyChannel && proxyChannel.isActive()) {
|
||||
String visitorId = ProxyUtil.getVisitorIdBySocketAddress(datagramPacket.sender());
|
||||
Channel proxyChannel = ProxyUtil.getTunnelChannelByVisitorId(visitorId);
|
||||
if (StrUtil.isNotBlank(visitorId) && null != proxyChannel && proxyChannel.isActive()) {
|
||||
// UDP代理隧道已就绪,直接转发
|
||||
proxyAttachment.execute();
|
||||
proxyAttachment.execute(ctx.channel());
|
||||
return;
|
||||
}
|
||||
|
||||
Channel visitorChannel = ctx.channel();
|
||||
InetSocketAddress sa = (InetSocketAddress) visitorChannel.localAddress();
|
||||
Channel cmdChannel = ProxyUtil.getCmdChannelByServerPort(sa.getPort());
|
||||
|
||||
// 没有指令通道,直接结束
|
||||
@@ -103,8 +99,10 @@ public class UdpVisitorChannelHandler extends SimpleChannelInboundHandler<Datagr
|
||||
// // 用户连接到代理服务器时,设置用户连接不可读,等待代理后端服务器连接成功后再改变为可读状态
|
||||
// visitorChannel.config().setOption(ChannelOption.AUTO_READ, false);
|
||||
|
||||
// TODO UDP此处叫visitor似有不妥,与TCP不同,2.x重构思考
|
||||
String visitorId = ProxyUtil.newVisitorId();
|
||||
// UDP场景下,一个visitorId并不对应一个visitorChannel,所有visitor共用一个visitorChannel
|
||||
visitorId = ProxyUtil.newVisitorId();
|
||||
// 设置udp发送方的地址
|
||||
ProxyUtil.setVisitorIdToSocketAddressMap(visitorId, datagramPacket.sender());
|
||||
// 此处需要和tcp分开
|
||||
ProxyUtil.addVisitorChannelToCmdChannel(NetworkProtocolEnum.UDP, cmdChannel, visitorId, visitorChannel, sa.getPort());
|
||||
ProxyUtil.addProxyConnectAttachment(visitorId, proxyAttachment);
|
||||
@@ -113,6 +111,7 @@ public class UdpVisitorChannelHandler extends SimpleChannelInboundHandler<Datagr
|
||||
.setServerPort(sa.getPort())
|
||||
.setTargetIp(targetIp)
|
||||
.setTargetPort(targetPort)
|
||||
// connect消息没有传超时时间、响应数量,导致客户端日志输出的超时时间、响应数量都是0
|
||||
));
|
||||
}
|
||||
|
||||
@@ -121,12 +120,32 @@ public class UdpVisitorChannelHandler extends SimpleChannelInboundHandler<Datagr
|
||||
super.channelActive(ctx);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
|
||||
// 当出现异常就关闭连接
|
||||
ctx.close();
|
||||
log.error("[UDP Visitor Channel]VisitorChannel error", cause);
|
||||
}
|
||||
// @Override
|
||||
// public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
|
||||
// // 对于网络IO异常(致命异常),关闭channel以防止资源泄漏
|
||||
// // 对于其他异常(可能是可恢复的业务异常),只记录日志
|
||||
// if (cause instanceof IOException) {
|
||||
// // IOException及其子类(包括SocketException)都是致命的网络异常
|
||||
// if (cause instanceof SocketException && cause.getMessage() != null && cause.getMessage().contains("Connection reset")) {
|
||||
// // Connection reset是常见的客户端断开,使用debug级别
|
||||
// log.debug("[UDP Visitor Channel] Connection reset: {}", cause.getMessage());
|
||||
// } else {
|
||||
// log.error("[UDP Visitor Channel] IO error", cause);
|
||||
// }
|
||||
// if (ctx.channel().isActive()) {
|
||||
// ctx.channel().close();
|
||||
// }
|
||||
// } else if(cause instanceof DecoderException) {
|
||||
// // 协议解析错误,为防止数据污染,立即关闭
|
||||
// log.debug("[UDP Visitor Channel] decoder error: {}", cause.getMessage());
|
||||
// if (ctx.channel().isActive()) {
|
||||
// ctx.channel().close();
|
||||
// }
|
||||
// } else {
|
||||
// // 其他异常只记录日志,不关闭channel,让Netty自己处理
|
||||
// log.error("[UDP Visitor Channel] error", cause);
|
||||
// }
|
||||
// }
|
||||
|
||||
@Override
|
||||
public void channelWritabilityChanged(ChannelHandlerContext ctx) throws Exception {
|
||||
|
||||
@@ -1,24 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package org.dromara.neutrinoproxy.server.proxy.domain;
|
||||
|
||||
import io.netty.channel.Channel;
|
||||
|
||||
@@ -1,25 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.dromara.neutrinoproxy.server.proxy.domain;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -1,29 +1,28 @@
|
||||
package org.dromara.neutrinoproxy.server.proxy.domain;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.channel.Channel;
|
||||
|
||||
import java.util.function.BiConsumer;
|
||||
|
||||
/**
|
||||
* 代理连接附件
|
||||
* @author: aoshiguchen
|
||||
* @date: 2023/4/2
|
||||
*/
|
||||
public class ProxyAttachment {
|
||||
private Channel channel;
|
||||
private byte[] bytes;
|
||||
private BiConsumer<Channel, byte[]> executor;
|
||||
|
||||
public ProxyAttachment(Channel channel, byte[] bytes, BiConsumer<Channel, byte[]> executor) {
|
||||
this.channel = channel;
|
||||
this.bytes = bytes;
|
||||
this.executor = executor;
|
||||
}
|
||||
|
||||
public void execute() {
|
||||
if (null != executor) {
|
||||
this.executor.accept(channel, bytes);
|
||||
}
|
||||
}
|
||||
}
|
||||
//package org.dromara.neutrinoproxy.server.proxy.domain;
|
||||
//
|
||||
//import io.netty.channel.Channel;
|
||||
//
|
||||
//import java.util.function.BiConsumer;
|
||||
//
|
||||
///**
|
||||
// * 代理连接附件
|
||||
// * @author: aoshiguchen
|
||||
// * @date: 2023/4/2
|
||||
// */
|
||||
//public class ProxyAttachment {
|
||||
// private Channel channel;
|
||||
// private byte[] bytes;
|
||||
// private BiConsumer<Channel, byte[]> executor;
|
||||
//
|
||||
// public ProxyAttachment(Channel channel, byte[] bytes, BiConsumer<Channel, byte[]> executor) {
|
||||
// this.channel = channel;
|
||||
// this.bytes = bytes;
|
||||
// this.executor = executor;
|
||||
// }
|
||||
//
|
||||
// public void execute() {
|
||||
// if (null != executor) {
|
||||
// this.executor.accept(channel, bytes);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
@@ -1,24 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package org.dromara.neutrinoproxy.server.proxy.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
package org.dromara.neutrinoproxy.server.proxy.enhance;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import io.netty.bootstrap.ServerBootstrap;
|
||||
import io.netty.channel.*;
|
||||
import io.netty.channel.ChannelInitializer;
|
||||
import io.netty.channel.nio.NioEventLoopGroup;
|
||||
import io.netty.channel.socket.SocketChannel;
|
||||
import io.netty.channel.socket.nio.NioServerSocketChannel;
|
||||
import io.netty.handler.logging.LoggingHandler;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.neutrinoproxy.server.base.proxy.ProxyConfig;
|
||||
import org.dromara.neutrinoproxy.server.proxy.core.BytesMetricsHandler;
|
||||
import org.dromara.neutrinoproxy.server.proxy.core.ProxyTunnelServer;
|
||||
import org.dromara.neutrinoproxy.server.proxy.security.HttpVisitorSecurityChannelHandler;
|
||||
import org.dromara.neutrinoproxy.server.proxy.security.VisitorFlowLimiterChannelHandler;
|
||||
import org.noear.solon.annotation.Component;
|
||||
import org.noear.solon.annotation.Inject;
|
||||
import org.noear.solon.core.event.AppLoadEndEvent;
|
||||
@@ -28,8 +27,8 @@ public class HttpProxy implements EventListener<AppLoadEndEvent> {
|
||||
private ProxyConfig proxyConfig;
|
||||
@Override
|
||||
public void onEvent(AppLoadEndEvent appLoadEndEvent) throws Throwable {
|
||||
if (StrUtil.isBlank(proxyConfig.getServer().getTcp().getDomainName()) || null == proxyConfig.getServer().getTcp().getHttpProxyPort()) {
|
||||
log.info("no config domain name,nonsupport http proxy.");
|
||||
if (null == proxyConfig.getServer().getTcp().getHttpProxyPort()) {
|
||||
log.info("no config http proxy port, nonsupport http proxy.");
|
||||
return;
|
||||
}
|
||||
this.start();
|
||||
@@ -45,8 +44,10 @@ public class HttpProxy implements EventListener<AppLoadEndEvent> {
|
||||
if (null != proxyConfig.getServer().getTcp().getTransferLogEnable() && proxyConfig.getServer().getTcp().getTransferLogEnable()) {
|
||||
ch.pipeline().addFirst(new LoggingHandler(HttpProxy.class));
|
||||
}
|
||||
ch.pipeline().addFirst(new BytesMetricsHandler());
|
||||
ch.pipeline().addLast(new HttpVisitorChannelHandler(proxyConfig.getServer().getTcp().getDomainName()));
|
||||
// ch.pipeline().addFirst(new BytesMetricsHandler());
|
||||
ch.pipeline().addLast(new HttpVisitorSecurityChannelHandler(false));
|
||||
ch.pipeline().addLast("flowLimiter",new VisitorFlowLimiterChannelHandler());
|
||||
ch.pipeline().addLast(new HttpVisitorChannelHandler());
|
||||
}
|
||||
});
|
||||
bootstrap.bind("0.0.0.0", proxyConfig.getServer().getTcp().getHttpProxyPort()).sync();
|
||||
|
||||
@@ -1,23 +1,22 @@
|
||||
package org.dromara.neutrinoproxy.server.proxy.enhance;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.channel.Channel;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import io.netty.channel.ChannelOption;
|
||||
import io.netty.channel.SimpleChannelInboundHandler;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import io.netty.channel.*;
|
||||
import io.netty.handler.codec.DecoderException;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.dromara.neutrinoproxy.core.Constants;
|
||||
import org.dromara.neutrinoproxy.core.ProxyMessage;
|
||||
import org.dromara.neutrinoproxy.server.constant.NetworkProtocolEnum;
|
||||
import org.dromara.neutrinoproxy.server.proxy.domain.ProxyAttachment;
|
||||
import org.dromara.neutrinoproxy.server.proxy.domain.VisitorChannelAttachInfo;
|
||||
import org.dromara.neutrinoproxy.server.service.FlowReportService;
|
||||
import org.dromara.neutrinoproxy.server.util.ProxyUtil;
|
||||
import org.noear.solon.Solon;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.SocketException;
|
||||
|
||||
/**
|
||||
* @author: aoshiguchen
|
||||
@@ -25,26 +24,13 @@ import java.net.InetSocketAddress;
|
||||
*/
|
||||
@Slf4j
|
||||
public class HttpVisitorChannelHandler extends SimpleChannelInboundHandler<ByteBuf> {
|
||||
/**
|
||||
* 域名
|
||||
*/
|
||||
private String domainName;
|
||||
|
||||
public HttpVisitorChannelHandler(String domainName) {
|
||||
this.domainName = domainName;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void channelRead0(ChannelHandlerContext ctx, ByteBuf byteBuf) throws Exception {
|
||||
if (StrUtil.isBlank(domainName)) {
|
||||
ctx.channel().close();
|
||||
return;
|
||||
}
|
||||
|
||||
byte[] bytes = new byte[byteBuf.readableBytes()];
|
||||
byteBuf.readBytes(bytes);
|
||||
byteBuf.resetReaderIndex();
|
||||
ProxyAttachment proxyAttachment = new ProxyAttachment(ctx.channel(), bytes, (channel, buf) -> {
|
||||
Constants.ProxyAttachment proxyAttachment = new Constants.ProxyAttachment(bytes, (channel, buf) -> {
|
||||
Channel proxyChannel = channel.attr(Constants.NEXT_CHANNEL).get();
|
||||
if (null == proxyChannel) {
|
||||
// 该端口还没有代理客户端
|
||||
@@ -61,32 +47,16 @@ public class HttpVisitorChannelHandler extends SimpleChannelInboundHandler<ByteB
|
||||
|
||||
String visitorId = ProxyUtil.getVisitorIdByChannel(ctx.channel());
|
||||
if (StringUtils.isNotBlank(visitorId)) {
|
||||
proxyAttachment.execute();
|
||||
proxyAttachment.execute(ctx.channel());
|
||||
return;
|
||||
}
|
||||
|
||||
// 用户连接到代理服务器时,设置用户连接不可读,等待代理后端服务器连接成功后再改变为可读状态
|
||||
ctx.channel().config().setOption(ChannelOption.AUTO_READ, false);
|
||||
|
||||
String host = getHost(bytes);
|
||||
log.debug("HttpProxy host: {}", host);
|
||||
if (StringUtils.isBlank(host)) {
|
||||
ctx.channel().close();
|
||||
return;
|
||||
}
|
||||
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) {
|
||||
ctx.channel().close();
|
||||
return;
|
||||
}
|
||||
Integer serverPort = ctx.channel().attr(Constants.SERVER_PORT).get();
|
||||
Channel cmdChannel = ProxyUtil.getCmdChannelByServerPort(serverPort);
|
||||
if (null == cmdChannel) {
|
||||
ctx.channel().close();
|
||||
@@ -100,7 +70,8 @@ public class HttpVisitorChannelHandler extends SimpleChannelInboundHandler<ByteB
|
||||
|
||||
visitorId = ProxyUtil.newVisitorId();
|
||||
ProxyUtil.addVisitorChannelToCmdChannel(NetworkProtocolEnum.HTTP, cmdChannel, visitorId, ctx.channel(), serverPort);
|
||||
ProxyUtil.addProxyConnectAttachment(visitorId, proxyAttachment);
|
||||
// ProxyUtil.addProxyConnectAttachment(visitorId, proxyAttachment);
|
||||
ctx.channel().attr(Constants.PROXY_CONNECT_ATTACHMENT).set(proxyAttachment);
|
||||
cmdChannel.writeAndFlush(ProxyMessage.buildConnectMessage(visitorId).setData(lanInfo.getBytes()));
|
||||
}
|
||||
|
||||
@@ -112,11 +83,7 @@ public class HttpVisitorChannelHandler extends SimpleChannelInboundHandler<ByteB
|
||||
InetSocketAddress sa = (InetSocketAddress) visitorChannel.localAddress();
|
||||
Channel cmdChannel = ProxyUtil.getCmdChannelByServerPort(sa.getPort());
|
||||
|
||||
if (cmdChannel == null) {
|
||||
// 该端口还没有代理客户端
|
||||
ctx.channel().close();
|
||||
} else {
|
||||
|
||||
if (null != cmdChannel) {
|
||||
// 用户连接断开,从控制连接中移除
|
||||
String visitorId = ProxyUtil.getVisitorIdByChannel(visitorChannel);
|
||||
ProxyUtil.removeVisitorChannelFromCmdChannel(cmdChannel, visitorId);
|
||||
@@ -133,6 +100,8 @@ public class HttpVisitorChannelHandler extends SimpleChannelInboundHandler<ByteB
|
||||
proxyChannel.config().setOption(ChannelOption.AUTO_READ, true);
|
||||
// 通知客户端,用户连接已经断开
|
||||
proxyChannel.writeAndFlush(ProxyMessage.buildDisconnectMessage(visitorId));
|
||||
|
||||
proxyChannel.writeAndFlush(Unpooled.EMPTY_BUFFER).addListener(ChannelFutureListener.CLOSE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -146,27 +115,40 @@ public class HttpVisitorChannelHandler extends SimpleChannelInboundHandler<ByteB
|
||||
|
||||
@Override
|
||||
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
|
||||
// 当出现异常就关闭连接
|
||||
ctx.close();
|
||||
// 对于网络IO异常(致命异常),关闭channel以防止资源泄漏
|
||||
// 对于其他异常(可能是可恢复的业务异常),只记录日志
|
||||
if (cause instanceof IOException) {
|
||||
// IOException及其子类(包括SocketException)都是致命的网络异常
|
||||
if (cause instanceof SocketException && cause.getMessage() != null && cause.getMessage().contains("Connection reset")) {
|
||||
// Connection reset是常见的客户端断开,使用debug级别
|
||||
log.debug("[HTTP Visitor Channel] Connection reset: {}", cause.getMessage());
|
||||
} else {
|
||||
log.error("[HTTP Visitor Channel] IO error", cause);
|
||||
}
|
||||
if (ctx.channel().isActive()) {
|
||||
ctx.channel().close();
|
||||
}
|
||||
} else if(cause instanceof DecoderException) {
|
||||
// 协议解析错误,为防止数据污染,立即关闭
|
||||
log.debug("[HTTP Visitor Channel] decoder error: {}", cause.getMessage());
|
||||
if (ctx.channel().isActive()) {
|
||||
ctx.channel().close();
|
||||
}
|
||||
} else {
|
||||
// 其他异常只记录日志,不关闭channel,让Netty自己处理
|
||||
log.error("[HTTP Visitor Channel] error", cause);
|
||||
}
|
||||
}
|
||||
|
||||
private String getHost(byte[] buf) {
|
||||
String req = new String(buf);
|
||||
String[] lines = req.split("\r\n");
|
||||
String firstLine = lines[0];
|
||||
if (!(firstLine.endsWith("HTTP/1.1") || firstLine.endsWith("HTTP/1.0"))) {
|
||||
return null;
|
||||
@Override
|
||||
public void channelWritabilityChanged(ChannelHandlerContext ctx) throws Exception {
|
||||
|
||||
// 通知代理客户端
|
||||
Channel visitorChannel = ctx.channel();
|
||||
Channel proxyChannel = visitorChannel.attr(Constants.NEXT_CHANNEL).get();
|
||||
if (null != proxyChannel) {
|
||||
proxyChannel.config().setOption(ChannelOption.AUTO_READ, visitorChannel.isWritable());
|
||||
}
|
||||
for (int i = 1; i < lines.length; i++) {
|
||||
String line = lines[i];
|
||||
if (!line.startsWith("Host: ")) {
|
||||
continue;
|
||||
}
|
||||
// 域名
|
||||
String domain = line.substring(6);
|
||||
// 去掉域名后面的端口号
|
||||
return domain.replaceAll(":.*", "");
|
||||
}
|
||||
return null;
|
||||
super.channelWritabilityChanged(ctx);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,28 +1,22 @@
|
||||
package org.dromara.neutrinoproxy.server.proxy.enhance;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import io.netty.bootstrap.ServerBootstrap;
|
||||
import io.netty.channel.*;
|
||||
import io.netty.channel.ChannelInitializer;
|
||||
import io.netty.channel.nio.NioEventLoopGroup;
|
||||
import io.netty.channel.socket.SocketChannel;
|
||||
import io.netty.channel.socket.nio.NioServerSocketChannel;
|
||||
import io.netty.handler.logging.LoggingHandler;
|
||||
import io.netty.handler.ssl.SslHandler;
|
||||
import io.netty.handler.ssl.SniHandler;
|
||||
import io.netty.handler.ssl.SslContext;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.dromara.neutrinoproxy.core.util.FileUtil;
|
||||
import org.dromara.neutrinoproxy.server.base.proxy.ProxyConfig;
|
||||
import org.dromara.neutrinoproxy.server.proxy.core.BytesMetricsHandler;
|
||||
import org.dromara.neutrinoproxy.server.proxy.core.ProxyTunnelServer;
|
||||
import org.dromara.neutrinoproxy.server.proxy.security.HttpVisitorSecurityChannelHandler;
|
||||
import org.dromara.neutrinoproxy.server.proxy.security.VisitorFlowLimiterChannelHandler;
|
||||
import org.noear.solon.annotation.Component;
|
||||
import org.noear.solon.annotation.Inject;
|
||||
import org.noear.solon.core.event.AppLoadEndEvent;
|
||||
import org.noear.solon.core.event.EventListener;
|
||||
|
||||
import javax.net.ssl.*;
|
||||
import java.io.InputStream;
|
||||
import java.security.KeyStore;
|
||||
|
||||
/**
|
||||
* HTTPS代理
|
||||
* @author: aoshiguchen
|
||||
@@ -33,11 +27,13 @@ import java.security.KeyStore;
|
||||
public class HttpsProxy implements EventListener<AppLoadEndEvent> {
|
||||
@Inject
|
||||
private ProxyConfig proxyConfig;
|
||||
@Inject
|
||||
private SslContextManager sslContextManager;
|
||||
|
||||
@Override
|
||||
public void onEvent(AppLoadEndEvent appLoadEndEvent) throws Throwable {
|
||||
if (StrUtil.isBlank(proxyConfig.getServer().getTcp().getDomainName()) || null == proxyConfig.getServer().getTcp().getHttpsProxyPort() ||
|
||||
StringUtils.isEmpty(proxyConfig.getServer().getTcp().getJksPath()) || StringUtils.isEmpty(proxyConfig.getServer().getTcp().getKeyStorePassword())) {
|
||||
log.info("no config domain name,nonsupport https proxy.");
|
||||
public void onEvent(AppLoadEndEvent appLoadEndEvent) {
|
||||
if (null == proxyConfig.getServer().getTcp().getHttpsProxyPort()) {
|
||||
log.info("no config https proxy port, nonsupport http proxy.");
|
||||
return;
|
||||
}
|
||||
this.start();
|
||||
@@ -53,9 +49,11 @@ public class HttpsProxy implements EventListener<AppLoadEndEvent> {
|
||||
if (null != proxyConfig.getServer().getTcp().getTransferLogEnable() && proxyConfig.getServer().getTcp().getTransferLogEnable()) {
|
||||
ch.pipeline().addFirst(new LoggingHandler(HttpsProxy.class));
|
||||
}
|
||||
ch.pipeline().addLast(createSslHandler());
|
||||
ch.pipeline().addFirst(new BytesMetricsHandler());
|
||||
ch.pipeline().addLast(new HttpVisitorChannelHandler(proxyConfig.getServer().getTcp().getDomainName()));
|
||||
ch.pipeline().addLast(createSniHandler());
|
||||
// ch.pipeline().addFirst(new BytesMetricsHandler());
|
||||
ch.pipeline().addLast(new HttpVisitorSecurityChannelHandler(true));
|
||||
ch.pipeline().addLast("flowLimiter",new VisitorFlowLimiterChannelHandler());
|
||||
ch.pipeline().addLast(new HttpVisitorChannelHandler());
|
||||
}
|
||||
});
|
||||
bootstrap.bind("0.0.0.0", proxyConfig.getServer().getTcp().getHttpsProxyPort()).sync();
|
||||
@@ -65,26 +63,19 @@ public class HttpsProxy implements EventListener<AppLoadEndEvent> {
|
||||
}
|
||||
}
|
||||
|
||||
private ChannelHandler createSslHandler() {
|
||||
public SniHandler createSniHandler() {
|
||||
try {
|
||||
InputStream jksInputStream = FileUtil.getInputStream(proxyConfig.getServer().getTcp().getJksPath());
|
||||
SSLContext serverContext = SSLContext.getInstance("TLS");
|
||||
final KeyStore ks = KeyStore.getInstance("JKS");
|
||||
|
||||
ks.load(jksInputStream, proxyConfig.getServer().getTcp().getKeyStorePassword().toCharArray());
|
||||
final KeyManagerFactory kmf = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
|
||||
kmf.init(ks, proxyConfig.getServer().getTcp().getKeyStorePassword().toCharArray());
|
||||
TrustManager[] trustManagers = null;
|
||||
|
||||
serverContext.init(kmf.getKeyManagers(), trustManagers, null);
|
||||
|
||||
SSLEngine sslEngine = serverContext.createSSLEngine();
|
||||
sslEngine.setUseClientMode(false);
|
||||
sslEngine.setNeedClientAuth(false);
|
||||
|
||||
return new SslHandler(sslEngine);
|
||||
return new SniHandler(domainName -> {
|
||||
SslContext sslContext = sslContextManager.getSslContextByFullDomain(domainName);
|
||||
if (sslContext != null) {
|
||||
return sslContext;
|
||||
} else {
|
||||
log.info("No SSL context available for domain: {}", domainName);
|
||||
return null;
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
log.error("create SSL handler failed", e);
|
||||
log.info("create SSL handler failed", e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -0,0 +1,126 @@
|
||||
package org.dromara.neutrinoproxy.server.proxy.enhance;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import io.netty.handler.ssl.ClientAuth;
|
||||
import io.netty.handler.ssl.SslContext;
|
||||
import io.netty.handler.ssl.SslContextBuilder;
|
||||
import lombok.Data;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.ibatis.solon.annotation.Db;
|
||||
import org.dromara.neutrinoproxy.server.base.db.DBInitialize;
|
||||
import org.dromara.neutrinoproxy.server.dal.DomainMapper;
|
||||
import org.dromara.neutrinoproxy.server.dal.entity.DomainNameDO;
|
||||
import org.dromara.neutrinoproxy.server.util.ProxyUtil;
|
||||
import org.noear.solon.annotation.Component;
|
||||
import org.noear.solon.annotation.Init;
|
||||
import org.noear.solon.annotation.Inject;
|
||||
import org.noear.solon.core.event.AppLoadEndEvent;
|
||||
import org.noear.solon.core.event.EventListener;
|
||||
import org.noear.solon.core.runtime.NativeDetector;
|
||||
|
||||
import javax.net.ssl.KeyManagerFactory;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.InputStream;
|
||||
import java.security.KeyStore;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
* 域名到SSL上下文
|
||||
* @author: Mirac
|
||||
* @date: 2024/8/25
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@Data
|
||||
public class SslContextManager implements EventListener<AppLoadEndEvent> {
|
||||
|
||||
@Db
|
||||
private DomainMapper domainMapper;
|
||||
|
||||
@Inject
|
||||
private DBInitialize dbInitialize;
|
||||
|
||||
// 初始化时加载所有域名的 SSL 上下文
|
||||
@Init
|
||||
public void init() throws Throwable {
|
||||
// aot 阶段,不初始化
|
||||
if (NativeDetector.isAotRuntime()) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
initializeSslContexts();
|
||||
} catch (Exception e) {
|
||||
log.error("initialize SSL handler failed", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onEvent(AppLoadEndEvent appLoadEndEvent) throws Throwable {
|
||||
|
||||
}
|
||||
|
||||
// 维护域名到 SslContext 的映射
|
||||
private final ConcurrentHashMap<String, SslContext> domainSslContexts = new ConcurrentHashMap<>();
|
||||
|
||||
// 初始化所有域名的 SSL 上下文
|
||||
private void initializeSslContexts() throws Exception {
|
||||
List<DomainNameDO> domainNameDOS = domainMapper.selectList(Wrappers.<DomainNameDO>lambdaQuery()
|
||||
.isNotNull(DomainNameDO::getDomain)
|
||||
.isNotNull(DomainNameDO::getJks)
|
||||
.isNotNull(DomainNameDO::getKeyStorePassword));
|
||||
|
||||
for (DomainNameDO domainNameDO : domainNameDOS) {
|
||||
if (domainNameDO.getDomain() != null && domainNameDO.getKeyStorePassword() != null && domainNameDO.getJks() != null) {
|
||||
String domain = domainNameDO.getDomain();
|
||||
byte[] jks = domainNameDO.getJks();// 假设数据库中存储了每个域名对应的 JKS 路径
|
||||
String keyStorePassword = domainNameDO.getKeyStorePassword();
|
||||
SslContext sslContext = loadSslContextFromJks(jks, keyStorePassword);
|
||||
domainSslContexts.put(domain, sslContext);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 动态添加新的域名和证书
|
||||
public void addDomainAndCert(String domain, byte[] jks, String keyStorePassword) throws Exception {
|
||||
SslContext sslContext = loadSslContextFromJks(jks, keyStorePassword);
|
||||
domainSslContexts.put(domain, sslContext);
|
||||
}
|
||||
|
||||
// 使用 JKS 文件加载 SSL 上下文,禁用客户端认证并设置为服务器模式
|
||||
private SslContext loadSslContextFromJks(byte[] jks, String keyStorePassword) throws Exception {
|
||||
InputStream jksInputStream = new ByteArrayInputStream(jks);
|
||||
// 初始化 KeyStore
|
||||
KeyStore keyStore = KeyStore.getInstance("JKS");
|
||||
keyStore.load(jksInputStream, keyStorePassword.toCharArray());
|
||||
|
||||
// 初始化 KeyManagerFactory
|
||||
KeyManagerFactory kmf = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
|
||||
kmf.init(keyStore, keyStorePassword.toCharArray());
|
||||
|
||||
// 创建 SslContext 并禁用客户端认证
|
||||
return SslContextBuilder.forServer(kmf)
|
||||
.clientAuth(ClientAuth.NONE) // 禁用客户端认证
|
||||
.build();
|
||||
}
|
||||
|
||||
public SslContext getSslContextByDomain(String domain) {
|
||||
return domainSslContexts.get(domain);
|
||||
}
|
||||
|
||||
|
||||
public void removeSslContextByDomain(String domain) {
|
||||
domainSslContexts.remove(domain);
|
||||
}
|
||||
|
||||
public SslContext getSslContextByFullDomain(String fullDomain) {
|
||||
String domain = ProxyUtil.getDomainNameByFullDomain(fullDomain);
|
||||
if (StrUtil.isBlank(domain)) {
|
||||
return null;
|
||||
}
|
||||
return domainSslContexts.get(domain);
|
||||
}
|
||||
}
|
||||
@@ -1,25 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.dromara.neutrinoproxy.server.proxy.handler;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
@@ -90,7 +68,7 @@ public class ProxyMessageAuthHandler implements ProxyMessageHandler {
|
||||
|
||||
if (StrUtil.isEmpty(licenseKey)) {
|
||||
log.warn("[client connection] license cannot empty info:{} ", info);
|
||||
ctx.channel().writeAndFlush(ProxyMessage.buildAuthResultMessage(ExceptionEnum.AUTH_FAILED.getCode(), "license不能为空!", licenseKey));
|
||||
ctx.channel().writeAndFlush(ProxyMessage.buildAuthResultMessage(ExceptionEnum.AUTH_FAILED.getCode(), "license cannot be empty!", licenseKey));
|
||||
ctx.channel().close();
|
||||
clientConnectRecordService.add(new ClientConnectRecordDO()
|
||||
.setIp(ip)
|
||||
@@ -105,7 +83,7 @@ public class ProxyMessageAuthHandler implements ProxyMessageHandler {
|
||||
LicenseDO licenseDO = licenseService.findByKey(licenseKey);
|
||||
if (null == licenseDO) {
|
||||
log.warn("[client connection] license notfound info:{} ", info);
|
||||
ctx.channel().writeAndFlush(ProxyMessage.buildAuthResultMessage(ExceptionEnum.AUTH_FAILED.getCode(), "license不存在!", licenseKey));
|
||||
ctx.channel().writeAndFlush(ProxyMessage.buildAuthResultMessage(ExceptionEnum.AUTH_FAILED.getCode(), "license not found!", licenseKey));
|
||||
ctx.channel().close();
|
||||
clientConnectRecordService.add(new ClientConnectRecordDO()
|
||||
.setIp(ip)
|
||||
|
||||
@@ -7,7 +7,6 @@ import org.dromara.neutrinoproxy.core.dispatcher.Match;
|
||||
import org.dromara.neutrinoproxy.server.constant.EnableStatusEnum;
|
||||
import org.dromara.neutrinoproxy.server.dal.entity.LicenseDO;
|
||||
import org.dromara.neutrinoproxy.server.dal.entity.UserDO;
|
||||
import org.dromara.neutrinoproxy.server.proxy.domain.ProxyAttachment;
|
||||
import org.dromara.neutrinoproxy.server.service.LicenseService;
|
||||
import org.dromara.neutrinoproxy.server.service.UserService;
|
||||
import org.dromara.neutrinoproxy.server.util.ProxyUtil;
|
||||
@@ -50,7 +49,7 @@ public class ProxyMessageConnectHandler implements ProxyMessageHandler {
|
||||
|
||||
LicenseDO licenseDO = licenseService.findByKey(licenseKey);
|
||||
if (null == licenseDO) {
|
||||
ctx.channel().writeAndFlush(ProxyMessage.buildErrMessage(ExceptionEnum.CONNECT_FAILED, "the license notfound!"));
|
||||
ctx.channel().writeAndFlush(ProxyMessage.buildErrMessage(ExceptionEnum.CONNECT_FAILED, "the license not found!"));
|
||||
ctx.channel().close();
|
||||
return;
|
||||
}
|
||||
@@ -69,29 +68,44 @@ public class ProxyMessageConnectHandler implements ProxyMessageHandler {
|
||||
Channel cmdChannel = ProxyUtil.getCmdChannelByLicenseId(licenseDO.getId());
|
||||
|
||||
if (null == cmdChannel) {
|
||||
ctx.channel().writeAndFlush(ProxyMessage.buildErrMessage(ExceptionEnum.CONNECT_FAILED, "server error,cmd channel notfound!"));
|
||||
ctx.channel().writeAndFlush(ProxyMessage.buildErrMessage(ExceptionEnum.CONNECT_FAILED, "server error,cmd channel not found!"));
|
||||
ctx.channel().close();
|
||||
return;
|
||||
}
|
||||
|
||||
Channel visitorChannel = ProxyUtil.getVisitorChannel(cmdChannel, visitorId);
|
||||
if (null == visitorChannel) {
|
||||
ctx.channel().writeAndFlush(ProxyMessage.buildErrMessage(ExceptionEnum.CONNECT_FAILED, "server error,visitor channel not found!"));
|
||||
ctx.channel().close();
|
||||
return;
|
||||
}
|
||||
|
||||
ctx.channel().attr(Constants.VISITOR_ID).set(visitorId);
|
||||
ctx.channel().attr(Constants.LICENSE_ID).set(licenseDO.getId());
|
||||
ctx.channel().attr(Constants.NEXT_CHANNEL).set(visitorChannel);
|
||||
visitorChannel.attr(Constants.NEXT_CHANNEL).set(ctx.channel());
|
||||
// 代理客户端与后端服务器连接成功,修改用户连接为可读状态
|
||||
visitorChannel.attr(Constants.LICENSE_ID).set(licenseDO.getId());
|
||||
// 代理客户端与后端服务器连接成功,修改用户连接为可读状态
|
||||
visitorChannel.config().setOption(ChannelOption.AUTO_READ, true);
|
||||
|
||||
// 获取代理附加对象
|
||||
ProxyAttachment proxyAttachment = ProxyUtil.getProxyConnectAttachment(visitorId);
|
||||
if (null != proxyAttachment) {
|
||||
// 及时释放
|
||||
ProxyUtil.remoteProxyConnectAttachment(visitorId);
|
||||
proxyAttachment.execute();
|
||||
}
|
||||
|
||||
// 获取代理附加对象
|
||||
Constants.ProxyAttachment proxyAttachment = visitorChannel.attr(Constants.PROXY_CONNECT_ATTACHMENT).get();
|
||||
if (null != proxyAttachment) {
|
||||
// 转发来自visitor的首次代理数据
|
||||
proxyAttachment.execute(visitorChannel);
|
||||
|
||||
// 此处时TCP代理,不一定有代理附加对象,不能因为没有而直接释放visitorChannel
|
||||
}
|
||||
|
||||
|
||||
// // 获取代理附加对象
|
||||
// ProxyAttachment proxyAttachment = ProxyUtil.getProxyConnectAttachment(visitorId);
|
||||
// if (null != proxyAttachment) {
|
||||
// // 及时释放
|
||||
// ProxyUtil.remoteProxyConnectAttachment(visitorId);
|
||||
// proxyAttachment.execute();
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -38,6 +38,8 @@ public class ProxyMessageTransferHandler implements ProxyMessageHandler {
|
||||
ctx.channel().config().setAutoRead(true);
|
||||
}
|
||||
}
|
||||
// TODO Netty默认的高水位通常只有64KB,在SCP/SFTP场景下可能很快就填满了。
|
||||
// 而visitorChannel.writeAndFlush(buf);是异步的。有可能写入数据极快,而visitorChannel的isWritable还没来得及变成false,此处就会写入大量数据把缓冲撑爆。
|
||||
ByteBuf buf = ctx.alloc().buffer(proxyMessage.getData().length);
|
||||
buf.writeBytes(proxyMessage.getData());
|
||||
visitorChannel.writeAndFlush(buf);
|
||||
|
||||
@@ -14,7 +14,6 @@ import org.dromara.neutrinoproxy.server.dal.PortMappingMapper;
|
||||
import org.dromara.neutrinoproxy.server.dal.entity.LicenseDO;
|
||||
import org.dromara.neutrinoproxy.server.dal.entity.PortMappingDO;
|
||||
import org.dromara.neutrinoproxy.server.dal.entity.UserDO;
|
||||
import org.dromara.neutrinoproxy.server.proxy.domain.ProxyAttachment;
|
||||
import org.dromara.neutrinoproxy.server.service.LicenseService;
|
||||
import org.dromara.neutrinoproxy.server.service.UserService;
|
||||
import org.dromara.neutrinoproxy.server.util.ProxyUtil;
|
||||
@@ -87,16 +86,18 @@ public class UdpProxyMessageConnectHandler implements ProxyMessageHandler {
|
||||
ctx.channel().attr(Constants.TARGET_PORT).set(portMappingDO.getClientPort());
|
||||
ctx.channel().attr(Constants.PROXY_RESPONSES).set(portMappingDO.getProxyResponses());
|
||||
ctx.channel().attr(Constants.PROXY_TIMEOUT_MS).set(portMappingDO.getProxyTimeoutMs());
|
||||
visitorChannel.attr(Constants.NEXT_CHANNEL).set(ctx.channel());
|
||||
// 所有udb visitor共用一个visitorChannel,设置这个没啥用
|
||||
// visitorChannel.attr(Constants.NEXT_CHANNEL).set(ctx.channel());
|
||||
ProxyUtil.setVisitorIdToTunnelChannelMap(udpBaseInfo.getVisitorId(), ctx.channel());
|
||||
visitorChannel.attr(Constants.IS_UDP_KEY).set(Boolean.TRUE);
|
||||
// // 代理客户端与后端服务器连接成功,修改用户连接为可读状态
|
||||
// visitorChannel.config().setOption(ChannelOption.AUTO_READ, true);
|
||||
// 获取代理附加对象
|
||||
ProxyAttachment proxyAttachment = ProxyUtil.getProxyConnectAttachment(udpBaseInfo.getVisitorId());
|
||||
Constants.ProxyAttachment proxyAttachment = ProxyUtil.getProxyConnectAttachment(udpBaseInfo.getVisitorId());
|
||||
if (null != proxyAttachment) {
|
||||
// 及时释放
|
||||
ProxyUtil.remoteProxyConnectAttachment(udpBaseInfo.getVisitorId());
|
||||
proxyAttachment.execute();
|
||||
proxyAttachment.execute(visitorChannel);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -31,33 +31,31 @@ public class UdpProxyMessageTransferHandler implements ProxyMessageHandler {
|
||||
log.debug("[UDP transfer]info:{} data:{}", proxyMessage.getInfo(), new String(proxyMessage.getData()));
|
||||
|
||||
Channel visitorChannel = ctx.channel().attr(Constants.NEXT_CHANNEL).get();
|
||||
if (null != visitorChannel) {
|
||||
if (null == visitorChannel) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!visitorChannel.isWritable()) {
|
||||
//自己不可写,通道可以读,让通道关闭读
|
||||
//自己可写,通道不可以读,让通道打开读
|
||||
if (ctx.channel().config().isAutoRead()) {
|
||||
ctx.channel().config().setAutoRead(false);
|
||||
}
|
||||
} else {
|
||||
if (ctx.channel().config().isAutoRead()) {
|
||||
ctx.channel().config().setAutoRead(true);
|
||||
}
|
||||
if (!visitorChannel.isWritable()) {
|
||||
//自己不可写,通道可以读,让通道关闭读
|
||||
//自己可写,通道不可以读,让通道打开读
|
||||
if (ctx.channel().config().isAutoRead()) {
|
||||
ctx.channel().config().setAutoRead(false);
|
||||
}
|
||||
} else {
|
||||
if (ctx.channel().config().isAutoRead()) {
|
||||
ctx.channel().config().setAutoRead(true);
|
||||
}
|
||||
}
|
||||
|
||||
// InetSocketAddress address = new InetSocketAddress(udpBaseInfo.getVisitorIp(), udpBaseInfo.getVisitorPort());
|
||||
// ByteBuf byteBuf = Unpooled.copiedBuffer(proxyMessage.getData());
|
||||
// visitorChannel.writeAndFlush(new DatagramPacket(byteBuf, address));
|
||||
InetSocketAddress address = ctx.channel().attr(Constants.SENDER).get();
|
||||
if (null != address) {
|
||||
visitorChannel.writeAndFlush(new DatagramPacket(Unpooled.copiedBuffer(proxyMessage.getData()), address));
|
||||
}
|
||||
InetSocketAddress address = ctx.channel().attr(Constants.SENDER).get();
|
||||
if (null != address) {
|
||||
visitorChannel.writeAndFlush(new DatagramPacket(Unpooled.copiedBuffer(proxyMessage.getData()), address));
|
||||
}
|
||||
|
||||
// 增加流量计数(TODO 如果UDP映射服务端端口修改,这个似乎不准)
|
||||
Integer licenseId = visitorChannel.attr(Constants.LICENSE_ID).get();
|
||||
if (null != licenseId) {
|
||||
Solon.context().getBean(FlowReportService.class).addReadByte(licenseId, proxyMessage.getData().length);
|
||||
}
|
||||
// 增加流量计数(TODO 如果UDP映射服务端端口修改,这个似乎不准)
|
||||
Integer licenseId = visitorChannel.attr(Constants.LICENSE_ID).get();
|
||||
if (null != licenseId) {
|
||||
Solon.context().getBean(FlowReportService.class).addReadByte(licenseId, proxyMessage.getData().length);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,177 @@
|
||||
package org.dromara.neutrinoproxy.server.proxy.security;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import io.netty.channel.*;
|
||||
import io.netty.handler.codec.DecoderException;
|
||||
import io.netty.util.CharsetUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.checkerframework.checker.i18nformatter.qual.I18nFormat;
|
||||
import org.dromara.neutrinoproxy.core.Constants;
|
||||
import org.dromara.neutrinoproxy.core.ProxyMessage;
|
||||
import org.dromara.neutrinoproxy.core.util.HttpUtil;
|
||||
import org.dromara.neutrinoproxy.core.util.IpUtil;
|
||||
import org.dromara.neutrinoproxy.server.service.DomainService;
|
||||
import org.dromara.neutrinoproxy.server.service.PortMappingService;
|
||||
import org.dromara.neutrinoproxy.server.service.SecurityGroupService;
|
||||
import org.dromara.neutrinoproxy.server.util.ProxyUtil;
|
||||
import org.noear.solon.Solon;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.SocketException;
|
||||
|
||||
/**
|
||||
* @author: aoshiguchen
|
||||
* @date: 2023/12/14
|
||||
*/
|
||||
@Slf4j
|
||||
public class HttpVisitorSecurityChannelHandler extends ChannelInboundHandlerAdapter {
|
||||
private final SecurityGroupService securityGroupService = Solon.context().getBean(SecurityGroupService.class);
|
||||
private final PortMappingService portMappingService = Solon.context().getBean(PortMappingService.class);
|
||||
private final DomainService domainService = Solon.context().getBean(DomainService.class);
|
||||
/**
|
||||
* 域名
|
||||
*/
|
||||
private Boolean isHttps;
|
||||
|
||||
// 拼接收到的 ByteBuf 内容
|
||||
private ByteBuf cumulationBuf = Unpooled.buffer();
|
||||
// private boolean initialized = false;
|
||||
|
||||
public HttpVisitorSecurityChannelHandler(Boolean isHttps) {
|
||||
this.isHttps = isHttps;
|
||||
}
|
||||
@Override
|
||||
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
|
||||
// if (initialized) {
|
||||
// // 已经初始化,直接透传
|
||||
// ctx.fireChannelRead(msg);
|
||||
// return;
|
||||
// }
|
||||
|
||||
// 累加数据包
|
||||
ByteBuf buf = (ByteBuf) msg;
|
||||
cumulationBuf.writeBytes(buf);
|
||||
|
||||
String dataStr = cumulationBuf.toString(CharsetUtil.UTF_8);
|
||||
int headerEndIndex = dataStr.indexOf("\r\n\r\n");
|
||||
if (-1 == headerEndIndex) {
|
||||
// 请求头还没读完,继续等
|
||||
return;
|
||||
}
|
||||
|
||||
// 获取Host请求头
|
||||
String headerPart = dataStr.substring(0, headerEndIndex + 4);
|
||||
String host = HttpUtil.getHostIgnorePort(headerPart); //test1.asgc.fun
|
||||
|
||||
log.debug("HttpProxy host: {}", host);
|
||||
if (StringUtils.isBlank(host)) {
|
||||
ctx.channel().close();
|
||||
return;
|
||||
}
|
||||
// 判断域名是否被禁用或删除
|
||||
Integer domainNameId = ProxyUtil.getDomainNameIdByFullDomain(host);
|
||||
if (domainNameId == null) {
|
||||
ctx.channel().close();
|
||||
return;
|
||||
}
|
||||
// 域名映射强制https验证
|
||||
if (!isHttps && domainService.isOnlyHttps(domainNameId)) {
|
||||
ctx.channel().close();
|
||||
return;
|
||||
}
|
||||
|
||||
Integer serverPort = ctx.channel().attr(Constants.SERVER_PORT).get();
|
||||
if (null == serverPort) {
|
||||
// channel没有服务器端口信息,尝试根据完整域名拿到服务端端口
|
||||
serverPort = ProxyUtil.getServerPortByFullDomain(host);
|
||||
if (null == serverPort) {
|
||||
ctx.channel().close();
|
||||
return;
|
||||
}
|
||||
|
||||
// 判断IP是否在该端口绑定的安全组允许的规则内
|
||||
String ip = IpUtil.getRealRemoteIp(headerPart);
|
||||
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);
|
||||
}
|
||||
|
||||
// 从此之后所有的 in 都是“直接透传”。
|
||||
// 否则,若请求体过长,数据包被拆分为多个,后续的数据包都无法解析出host,导致转发数据不完整。
|
||||
ctx.pipeline().remove(this);
|
||||
|
||||
// 继续传播
|
||||
ctx.fireChannelRead(cumulationBuf);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
|
||||
// 对于网络IO异常(致命异常),关闭channel以防止资源泄漏
|
||||
// 对于其他异常(可能是可恢复的业务异常),只记录日志
|
||||
if (cause instanceof IOException) {
|
||||
// IOException及其子类(包括SocketException)都是致命的网络异常
|
||||
if (cause instanceof SocketException && cause.getMessage() != null && cause.getMessage().contains("Connection reset")) {
|
||||
// Connection reset是常见的客户端断开,使用debug级别
|
||||
log.debug("[HTTP Visitor Security Channel] Connection reset: {}", cause.getMessage());
|
||||
} else {
|
||||
log.error("[HTTP Visitor Security Channel] IO error", cause);
|
||||
}
|
||||
if (ctx.channel().isActive()) {
|
||||
ctx.channel().close();
|
||||
}
|
||||
} else if(cause instanceof DecoderException) {
|
||||
// 协议解析错误,为防止数据污染,立即关闭
|
||||
log.debug("[HTTP Visitor Security Channel] decoder error: {}", cause.getMessage());
|
||||
if (ctx.channel().isActive()) {
|
||||
ctx.channel().close();
|
||||
}
|
||||
} else {
|
||||
// 其他异常只记录日志,不关闭channel,让Netty自己处理
|
||||
log.error("[HTTP Visitor Security Channel] error", cause);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
|
||||
|
||||
// 通知代理客户端
|
||||
Channel visitorChannel = ctx.channel();
|
||||
InetSocketAddress sa = (InetSocketAddress) visitorChannel.localAddress();
|
||||
Channel cmdChannel = ProxyUtil.getCmdChannelByServerPort(sa.getPort());
|
||||
|
||||
if (null != cmdChannel) {
|
||||
// 用户连接断开,从控制连接中移除
|
||||
String visitorId = ProxyUtil.getVisitorIdByChannel(visitorChannel);
|
||||
ProxyUtil.removeVisitorChannelFromCmdChannel(cmdChannel, visitorId);
|
||||
|
||||
// 删除代理附加对象
|
||||
ProxyUtil.remoteProxyConnectAttachment(visitorId);
|
||||
|
||||
Channel proxyChannel = visitorChannel.attr(Constants.NEXT_CHANNEL).get();
|
||||
if (proxyChannel != null && proxyChannel.isActive()) {
|
||||
proxyChannel.attr(Constants.NEXT_CHANNEL).remove();
|
||||
proxyChannel.attr(Constants.LICENSE_ID).remove();
|
||||
proxyChannel.attr(Constants.VISITOR_ID).remove();
|
||||
|
||||
proxyChannel.config().setOption(ChannelOption.AUTO_READ, true);
|
||||
// 通知客户端,用户连接已经断开
|
||||
proxyChannel.writeAndFlush(ProxyMessage.buildDisconnectMessage(visitorId));
|
||||
|
||||
proxyChannel.writeAndFlush(Unpooled.EMPTY_BUFFER).addListener(ChannelFutureListener.CLOSE);
|
||||
}
|
||||
}
|
||||
|
||||
super.channelInactive(ctx);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,132 @@
|
||||
package org.dromara.neutrinoproxy.server.proxy.security;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import io.netty.channel.*;
|
||||
import io.netty.handler.codec.DecoderException;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.dromara.neutrinoproxy.core.Constants;
|
||||
import org.dromara.neutrinoproxy.core.ProxyMessage;
|
||||
import org.dromara.neutrinoproxy.core.util.IpUtil;
|
||||
import org.dromara.neutrinoproxy.server.service.PortMappingService;
|
||||
import org.dromara.neutrinoproxy.server.service.SecurityGroupService;
|
||||
import org.dromara.neutrinoproxy.server.util.ProxyUtil;
|
||||
import org.noear.solon.Solon;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.SocketException;
|
||||
|
||||
/**
|
||||
* @author: aoshiguchen
|
||||
* @date: 2023/12/14
|
||||
*/
|
||||
@Slf4j
|
||||
public class TcpVisitorSecurityChannelHandler extends ChannelInboundHandlerAdapter {
|
||||
private final SecurityGroupService securityGroupService = Solon.context().getBean(SecurityGroupService.class);
|
||||
private final PortMappingService portMappingService = Solon.context().getBean(PortMappingService.class);
|
||||
|
||||
@Override
|
||||
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
|
||||
Channel visitorChannel = ctx.channel();
|
||||
|
||||
ByteBuf buf = (ByteBuf) msg;
|
||||
byte[] bytes = new byte[buf.readableBytes()];
|
||||
buf.readBytes(bytes);
|
||||
|
||||
// 判断IP是否在该端口绑定的安全组允许的规则内
|
||||
String ip = IpUtil.getRealRemoteIp(new String(bytes));
|
||||
if (StringUtils.isEmpty(ip)) {
|
||||
ip = IpUtil.getRemoteIp(ctx);
|
||||
}
|
||||
InetSocketAddress sa = (InetSocketAddress) visitorChannel.localAddress();
|
||||
if (!securityGroupService.judgeAllow(ip, portMappingService.getSecurityGroupIdByMappingPort(sa.getPort()))) {
|
||||
// 不在安全组规则放行范围内
|
||||
ctx.channel().close();
|
||||
return;
|
||||
}
|
||||
|
||||
// 继续传播
|
||||
ctx.channel().attr(Constants.SERVER_PORT).set(sa.getPort());
|
||||
buf.resetReaderIndex();
|
||||
ctx.fireChannelRead(buf);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void channelActive(ChannelHandlerContext ctx) throws Exception {
|
||||
Channel visitorChannel = ctx.channel();
|
||||
InetSocketAddress sa = (InetSocketAddress) visitorChannel.localAddress();
|
||||
|
||||
// 判断IP是否在该端口绑定的安全组允许的规则内
|
||||
if (!securityGroupService.judgeAllow(IpUtil.getRemoteIp(ctx), portMappingService.getSecurityGroupIdByMappingPort(sa.getPort()))) {
|
||||
// 不在安全组规则放行范围内
|
||||
ctx.channel().close();
|
||||
return;
|
||||
}
|
||||
|
||||
// 继续传播
|
||||
ctx.fireChannelActive();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
|
||||
// 对于网络IO异常(致命异常),关闭channel以防止资源泄漏
|
||||
// 对于其他异常(可能是可恢复的业务异常),只记录日志
|
||||
if (cause instanceof IOException) {
|
||||
// IOException及其子类(包括SocketException)都是致命的网络异常
|
||||
if (cause instanceof SocketException && cause.getMessage() != null && cause.getMessage().contains("Connection reset")) {
|
||||
// Connection reset是常见的客户端断开,使用debug级别
|
||||
log.debug("[TCP Visitor Security Channel] Connection reset: {}", cause.getMessage());
|
||||
} else {
|
||||
log.error("[TCP Visitor Security Channel] IO error", cause);
|
||||
}
|
||||
if (ctx.channel().isActive()) {
|
||||
ctx.channel().close();
|
||||
}
|
||||
} else if(cause instanceof DecoderException) {
|
||||
// 协议解析错误,为防止数据污染,立即关闭
|
||||
log.debug("[TCP Visitor Security Channel] decoder error: {}", cause.getMessage());
|
||||
if (ctx.channel().isActive()) {
|
||||
ctx.channel().close();
|
||||
}
|
||||
} else {
|
||||
// 其他异常只记录日志,不关闭channel,让Netty自己处理
|
||||
log.error("[TCP Visitor Security Channel] error", cause);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
|
||||
|
||||
// 通知代理客户端
|
||||
Channel visitorChannel = ctx.channel();
|
||||
InetSocketAddress sa = (InetSocketAddress) visitorChannel.localAddress();
|
||||
Channel cmdChannel = ProxyUtil.getCmdChannelByServerPort(sa.getPort());
|
||||
|
||||
if (null != cmdChannel) {
|
||||
// 用户连接断开,从控制连接中移除
|
||||
String visitorId = ProxyUtil.getVisitorIdByChannel(visitorChannel);
|
||||
ProxyUtil.removeVisitorChannelFromCmdChannel(cmdChannel, visitorId);
|
||||
|
||||
// 删除代理附加对象
|
||||
ProxyUtil.remoteProxyConnectAttachment(visitorId);
|
||||
|
||||
Channel proxyChannel = visitorChannel.attr(Constants.NEXT_CHANNEL).get();
|
||||
if (proxyChannel != null && proxyChannel.isActive()) {
|
||||
proxyChannel.attr(Constants.NEXT_CHANNEL).remove();
|
||||
proxyChannel.attr(Constants.LICENSE_ID).remove();
|
||||
proxyChannel.attr(Constants.VISITOR_ID).remove();
|
||||
|
||||
proxyChannel.config().setOption(ChannelOption.AUTO_READ, true);
|
||||
// 通知客户端,用户连接已经断开
|
||||
proxyChannel.writeAndFlush(ProxyMessage.buildDisconnectMessage(visitorId));
|
||||
|
||||
proxyChannel.writeAndFlush(Unpooled.EMPTY_BUFFER).addListener(ChannelFutureListener.CLOSE);
|
||||
}
|
||||
}
|
||||
|
||||
super.channelInactive(ctx);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
package org.dromara.neutrinoproxy.server.proxy.security;
|
||||
|
||||
import io.netty.buffer.Unpooled;
|
||||
import io.netty.channel.*;
|
||||
import io.netty.channel.socket.DatagramPacket;
|
||||
import io.netty.handler.codec.DecoderException;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.neutrinoproxy.core.Constants;
|
||||
import org.dromara.neutrinoproxy.core.ProxyMessage;
|
||||
import org.dromara.neutrinoproxy.server.service.PortMappingService;
|
||||
import org.dromara.neutrinoproxy.server.service.SecurityGroupService;
|
||||
import org.dromara.neutrinoproxy.server.util.ProxyUtil;
|
||||
import org.noear.solon.Solon;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.SocketException;
|
||||
|
||||
/**
|
||||
* @author: aoshiguchen
|
||||
* @date: 2023/12/14
|
||||
*/
|
||||
@Slf4j
|
||||
public class UdpVisitorSecurityChannelHandler extends ChannelInboundHandlerAdapter {
|
||||
private final SecurityGroupService securityGroupService = Solon.context().getBean(SecurityGroupService.class);
|
||||
private final PortMappingService portMappingService = Solon.context().getBean(PortMappingService.class);
|
||||
|
||||
@Override
|
||||
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
|
||||
Channel visitorChannel = ctx.channel();
|
||||
InetSocketAddress sa = (InetSocketAddress) visitorChannel.localAddress();
|
||||
DatagramPacket datagramPacket = (DatagramPacket) msg;
|
||||
|
||||
// 判断IP是否在该端口绑定的安全组允许的规则内
|
||||
if (!securityGroupService.judgeAllow(datagramPacket.sender().getAddress().getHostAddress(), portMappingService.getSecurityGroupIdByMappingPort(sa.getPort()))) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 继续传播
|
||||
ctx.channel().attr(Constants.SERVER_PORT).set(sa.getPort());
|
||||
ctx.fireChannelRead(msg);
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
|
||||
// // 对于网络IO异常(致命异常),关闭channel以防止资源泄漏
|
||||
// // 对于其他异常(可能是可恢复的业务异常),只记录日志
|
||||
// if (cause instanceof IOException) {
|
||||
// // IOException及其子类(包括SocketException)都是致命的网络异常
|
||||
// if (cause instanceof SocketException && cause.getMessage() != null && cause.getMessage().contains("Connection reset")) {
|
||||
// // Connection reset是常见的客户端断开,使用debug级别
|
||||
// log.debug("[UDP Visitor Security Channel] Connection reset: {}", cause.getMessage());
|
||||
// } else {
|
||||
// log.error("[UDP Visitor Security Channel] IO error", cause);
|
||||
// }
|
||||
// if (ctx.channel().isActive()) {
|
||||
// ctx.channel().close();
|
||||
// }
|
||||
// } else if(cause instanceof DecoderException) {
|
||||
// // 协议解析错误,为防止数据污染,立即关闭
|
||||
// log.debug("[UDP Visitor Security Channel] decoder error: {}", cause.getMessage());
|
||||
// if (ctx.channel().isActive()) {
|
||||
// ctx.channel().close();
|
||||
// }
|
||||
// } else {
|
||||
// // 其他异常只记录日志,不关闭channel,让Netty自己处理
|
||||
// log.error("[UDP Visitor Security Channel] error", cause);
|
||||
// }
|
||||
// }
|
||||
|
||||
// @Override
|
||||
// public void channelInactive(ChannelHandlerContext ctx) throws Exception {
|
||||
//
|
||||
// // 通知代理客户端
|
||||
// Channel visitorChannel = ctx.channel();
|
||||
// InetSocketAddress sa = (InetSocketAddress) visitorChannel.localAddress();
|
||||
// Channel cmdChannel = ProxyUtil.getCmdChannelByServerPort(sa.getPort());
|
||||
//
|
||||
// if (null != cmdChannel) {
|
||||
// // 用户连接断开,从控制连接中移除
|
||||
// String visitorId = ProxyUtil.getVisitorIdByChannel(visitorChannel);
|
||||
// ProxyUtil.removeVisitorChannelFromCmdChannel(cmdChannel, visitorId);
|
||||
//
|
||||
// // 删除代理附加对象
|
||||
// ProxyUtil.remoteProxyConnectAttachment(visitorId);
|
||||
//
|
||||
// Channel proxyChannel = visitorChannel.attr(Constants.NEXT_CHANNEL).get();
|
||||
// if (proxyChannel != null && proxyChannel.isActive()) {
|
||||
// proxyChannel.attr(Constants.NEXT_CHANNEL).remove();
|
||||
// proxyChannel.attr(Constants.LICENSE_ID).remove();
|
||||
// proxyChannel.attr(Constants.VISITOR_ID).remove();
|
||||
//
|
||||
// proxyChannel.config().setOption(ChannelOption.AUTO_READ, true);
|
||||
// // 通知客户端,用户连接已经断开
|
||||
// proxyChannel.writeAndFlush(ProxyMessage.buildDisconnectMessage(visitorId));
|
||||
//
|
||||
// proxyChannel.writeAndFlush(Unpooled.EMPTY_BUFFER).addListener(ChannelFutureListener.CLOSE);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// super.channelInactive(ctx);
|
||||
// }
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
package org.dromara.neutrinoproxy.server.proxy.security;
|
||||
|
||||
import io.netty.channel.*;
|
||||
import io.netty.handler.traffic.ChannelTrafficShapingHandler;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.neutrinoproxy.core.Constants;
|
||||
import org.dromara.neutrinoproxy.server.service.PortMappingService;
|
||||
import org.dromara.neutrinoproxy.server.service.bo.FlowLimitBO;
|
||||
import org.noear.solon.Solon;
|
||||
|
||||
|
||||
/**
|
||||
* 访问者流量限制器
|
||||
* @author: aoshiguchen
|
||||
* @date: 2023/12/15
|
||||
*/
|
||||
@Slf4j
|
||||
public class VisitorFlowLimiterChannelHandler extends ChannelInboundHandlerAdapter {
|
||||
private final PortMappingService portMappingService = Solon.context().getBean(PortMappingService.class);
|
||||
|
||||
@Override
|
||||
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
|
||||
Boolean flowLimiterFlag = ctx.channel().attr(Constants.FLOW_LIMITER_FLAG).get();
|
||||
|
||||
if (null == flowLimiterFlag || !flowLimiterFlag) {
|
||||
Integer serverPort = ctx.channel().attr(Constants.SERVER_PORT).get();
|
||||
Long upLimitRate = null;
|
||||
Long downLimitRate = null;
|
||||
// 先获取端口映射上的限速设置
|
||||
FlowLimitBO flowLimitBO = portMappingService.getFlowLimitByServerPort(serverPort);
|
||||
if (null != flowLimitBO) {
|
||||
upLimitRate = flowLimitBO.getUpLimitRate();
|
||||
downLimitRate = flowLimitBO.getDownLimitRate();
|
||||
}
|
||||
if (null != upLimitRate || null != downLimitRate) {
|
||||
// 如果不全为空,则需要做限速
|
||||
ctx.pipeline().addAfter("flowLimiter", "trafficShaping", new ChannelTrafficShapingHandler(downLimitRate == null ? 0 : downLimitRate, upLimitRate == null ? 0 : upLimitRate, 100, 600000));
|
||||
}
|
||||
|
||||
// 每个连接第一次处理之后。无论是否限速,该连接后续都不在处理,避免频繁执行影响性能
|
||||
ctx.channel().attr(Constants.FLOW_LIMITER_FLAG).set(Boolean.TRUE);
|
||||
}
|
||||
|
||||
// 继续传播
|
||||
ctx.fireChannelRead(msg);
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
|
||||
// // 对于网络IO异常(致命异常),关闭channel以防止资源泄漏
|
||||
// // 对于其他异常(可能是可恢复的业务异常),只记录日志
|
||||
// if (cause instanceof IOException) {
|
||||
// // IOException及其子类(包括SocketException)都是致命的网络异常
|
||||
// if (cause instanceof SocketException && cause.getMessage() != null && cause.getMessage().contains("Connection reset")) {
|
||||
// // Connection reset是常见的客户端断开,使用debug级别
|
||||
// log.debug("[Visitor FlowLimit Channel] Connection reset: {}", cause.getMessage());
|
||||
// } else {
|
||||
// log.error("[Visitor FlowLimit Channel] IO error", cause);
|
||||
// }
|
||||
// if (ctx.channel().isActive()) {
|
||||
// ctx.channel().close();
|
||||
// }
|
||||
// } else if(cause instanceof DecoderException) {
|
||||
// // 协议解析错误,为防止数据污染,立即关闭
|
||||
// log.debug("[Visitor FlowLimit Channel] decoder error: {}", cause.getMessage());
|
||||
// if (ctx.channel().isActive()) {
|
||||
// ctx.channel().close();
|
||||
// }
|
||||
// } else {
|
||||
// // 其他异常只记录日志,不关闭channel,让Netty自己处理
|
||||
// log.error("[Visitor FlowLimit Channel] error", cause);
|
||||
// }
|
||||
// }
|
||||
|
||||
// @Override
|
||||
// public void channelInactive(ChannelHandlerContext ctx) throws Exception {
|
||||
//
|
||||
// // 通知代理客户端
|
||||
// Channel visitorChannel = ctx.channel();
|
||||
// InetSocketAddress sa = (InetSocketAddress) visitorChannel.localAddress();
|
||||
// Channel cmdChannel = ProxyUtil.getCmdChannelByServerPort(sa.getPort());
|
||||
//
|
||||
// if (null != cmdChannel) {
|
||||
// // 用户连接断开,从控制连接中移除
|
||||
// String visitorId = ProxyUtil.getVisitorIdByChannel(visitorChannel);
|
||||
// ProxyUtil.removeVisitorChannelFromCmdChannel(cmdChannel, visitorId);
|
||||
//
|
||||
// // 删除代理附加对象
|
||||
// ProxyUtil.remoteProxyConnectAttachment(visitorId);
|
||||
//
|
||||
// Channel proxyChannel = visitorChannel.attr(Constants.NEXT_CHANNEL).get();
|
||||
// if (proxyChannel != null && proxyChannel.isActive()) {
|
||||
// proxyChannel.attr(Constants.NEXT_CHANNEL).remove();
|
||||
// proxyChannel.attr(Constants.LICENSE_ID).remove();
|
||||
// proxyChannel.attr(Constants.VISITOR_ID).remove();
|
||||
//
|
||||
// proxyChannel.config().setOption(ChannelOption.AUTO_READ, true);
|
||||
// // 通知客户端,用户连接已经断开
|
||||
// proxyChannel.writeAndFlush(ProxyMessage.buildDisconnectMessage(visitorId));
|
||||
//
|
||||
// proxyChannel.writeAndFlush(Unpooled.EMPTY_BUFFER).addListener(ChannelFutureListener.CLOSE);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// super.channelInactive(ctx);
|
||||
// }
|
||||
}
|
||||
@@ -0,0 +1,301 @@
|
||||
package org.dromara.neutrinoproxy.server.service;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.text.StrPool;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.solon.plugins.pagination.Page;
|
||||
import com.google.common.collect.Sets;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.ibatis.solon.annotation.Db;
|
||||
import org.dromara.neutrinoproxy.server.base.page.PageInfo;
|
||||
import org.dromara.neutrinoproxy.server.base.page.PageQuery;
|
||||
import org.dromara.neutrinoproxy.server.base.rest.SystemContextHolder;
|
||||
import org.dromara.neutrinoproxy.server.constant.*;
|
||||
import org.dromara.neutrinoproxy.server.controller.req.proxy.DomainCreateReq;
|
||||
import org.dromara.neutrinoproxy.server.controller.req.proxy.DomainListReq;
|
||||
import org.dromara.neutrinoproxy.server.controller.req.proxy.DomainUpdateEnableStatusReq;
|
||||
import org.dromara.neutrinoproxy.server.controller.req.proxy.DomainUpdateReq;
|
||||
import org.dromara.neutrinoproxy.server.controller.res.proxy.DomainListRes;
|
||||
import org.dromara.neutrinoproxy.server.controller.res.proxy.DomainUpdateDefaultStatusRes;
|
||||
import org.dromara.neutrinoproxy.server.controller.res.proxy.DomainUpdateEnableStatusRes;
|
||||
import org.dromara.neutrinoproxy.server.dal.DomainMapper;
|
||||
import org.dromara.neutrinoproxy.server.dal.DomainPortMappingMapper;
|
||||
import org.dromara.neutrinoproxy.server.dal.PortMappingMapper;
|
||||
import org.dromara.neutrinoproxy.server.dal.UserMapper;
|
||||
import org.dromara.neutrinoproxy.server.dal.entity.DomainNameDO;
|
||||
import org.dromara.neutrinoproxy.server.dal.entity.PortMappingDO;
|
||||
import org.dromara.neutrinoproxy.server.dal.entity.UserDO;
|
||||
import org.dromara.neutrinoproxy.server.proxy.enhance.SslContextManager;
|
||||
import org.dromara.neutrinoproxy.server.service.bo.FullDomainNameBO;
|
||||
import org.dromara.neutrinoproxy.server.util.ParamCheckUtil;
|
||||
import org.dromara.neutrinoproxy.server.util.ProxyUtil;
|
||||
import org.noear.solon.annotation.Component;
|
||||
import org.noear.solon.annotation.Init;
|
||||
import org.noear.solon.annotation.Inject;
|
||||
import org.noear.solon.core.handle.UploadedFile;
|
||||
import org.noear.solon.core.runtime.NativeDetector;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author Mirac
|
||||
* @date 21/7/2024
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class DomainService {
|
||||
@Db
|
||||
private DomainMapper domainMapper;
|
||||
@Db
|
||||
private UserMapper userMapper;
|
||||
@Db
|
||||
private PortMappingMapper portMappingMapper;
|
||||
@Db
|
||||
private DomainPortMappingMapper domainPortMappingMapper;
|
||||
|
||||
@Inject
|
||||
private SslContextManager sslContextManager;
|
||||
|
||||
public PageInfo<DomainListRes> page(PageQuery pageQuery, DomainListReq req) {
|
||||
Page<DomainNameDO> page = domainMapper.selectPage(new Page<>(pageQuery.getCurrent(), pageQuery.getSize()), new LambdaQueryWrapper<DomainNameDO>()
|
||||
.eq(req.getEnable() != null, DomainNameDO::getEnable, req.getEnable())
|
||||
.eq(req.getUserId() != null, DomainNameDO::getUserId, req.getUserId())
|
||||
.orderByAsc(Arrays.asList(DomainNameDO::getUserId, DomainNameDO::getId))
|
||||
);
|
||||
List<DomainListRes> resList = page.getRecords().stream().map(DomainNameDO::toRes).collect(Collectors.toList());
|
||||
if (CollectionUtils.isEmpty(page.getRecords())) {
|
||||
return PageInfo.of(resList, page);
|
||||
}
|
||||
Set<Integer> userIds = resList.stream().map(DomainListRes::getUserId).collect(Collectors.toSet());
|
||||
List<UserDO> userDOList = userMapper.findByIds(userIds);
|
||||
Map<Integer, UserDO> userMap = userDOList.stream().collect(Collectors.toMap(UserDO::getId, c -> c));
|
||||
for (DomainListRes item : resList) {
|
||||
UserDO userDO = userMap.get(item.getUserId());
|
||||
if (null != userDO) {
|
||||
item.setUserName(userDO.getName());
|
||||
}
|
||||
}
|
||||
return PageInfo.of(resList, page);
|
||||
}
|
||||
|
||||
public List<DomainListRes> all(DomainListReq req) {
|
||||
LambdaQueryWrapper<DomainNameDO> wrapper = Wrappers.<DomainNameDO>lambdaQuery()
|
||||
.eq(req.getEnable() != null, DomainNameDO::getEnable, req.getEnable());
|
||||
List<DomainNameDO> domainNameDOS = domainMapper.selectList(wrapper);
|
||||
if (CollectionUtil.isEmpty(domainNameDOS)) {
|
||||
return null;
|
||||
}
|
||||
List<DomainListRes> resList = domainNameDOS.stream().map(DomainNameDO::toRes).toList();
|
||||
Set<Integer> userIds = resList.stream().map(DomainListRes::getUserId).collect(Collectors.toSet());
|
||||
List<UserDO> userDOList = userMapper.findByIds(userIds);
|
||||
Map<Integer, UserDO> userMap = userDOList.stream().collect(Collectors.toMap(UserDO::getId, c -> c));
|
||||
for (DomainListRes item : resList) {
|
||||
UserDO userDO = userMap.get(item.getUserId());
|
||||
if (null != userDO) {
|
||||
item.setUserName(userDO.getName());
|
||||
}
|
||||
}
|
||||
return resList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建域名
|
||||
*
|
||||
* @param req
|
||||
*/
|
||||
public void create(DomainCreateReq req, UploadedFile jks) {
|
||||
DomainNameDO domainNameCheck = domainMapper.checkRepeat(req.getDomain(), null);
|
||||
ParamCheckUtil.checkMustNull(domainNameCheck, ExceptionConstant.DOMAIN_NAME_CANNOT_REPEAT);
|
||||
DomainNameDO domainNameDO = new DomainNameDO();
|
||||
if (null != jks) {
|
||||
try {
|
||||
ParamCheckUtil.checkNotEmpty(req.getKeyStorePassword(), "keyStorePassword");
|
||||
|
||||
InputStream content = jks.getContent();
|
||||
byte[] byteArray = toByteArray(content);
|
||||
domainNameDO.setJks(byteArray);
|
||||
domainNameDO.setKeyStorePassword(req.getKeyStorePassword());
|
||||
//添加证书
|
||||
sslContextManager.addDomainAndCert(req.getDomain(), byteArray, req.getKeyStorePassword());
|
||||
} catch (Exception e) {
|
||||
log.error("证书添加失败", e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
Integer userId = SystemContextHolder.getUserId();
|
||||
Date now = new Date();
|
||||
domainNameDO.setDomain(req.getDomain());
|
||||
domainNameDO.setIsDefault(DefaultDomainStatusEnum.DISABLE.getStatus());
|
||||
domainNameDO.setForceHttps(req.getForceHttps() != null ? HttpsStatusEnum.of(req.getForceHttps()).getStatus() : HttpsStatusEnum.DISABLE_ONLY_HTTPS.getStatus());
|
||||
domainNameDO.setUserId(userId);
|
||||
domainNameDO.setEnable(EnableStatusEnum.ENABLE.getStatus());
|
||||
domainNameDO.setCreateTime(now);
|
||||
domainNameDO.setUpdateTime(now);
|
||||
domainMapper.insert(domainNameDO);
|
||||
//更新主域名到域名id映射
|
||||
ProxyUtil.setDomainToDomainNameId(domainNameDO.getDomain(), domainNameDO.getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 将 InputStream 转换为 byte[]
|
||||
*/
|
||||
private byte[] toByteArray(InputStream input) throws IOException {
|
||||
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
|
||||
int nRead;
|
||||
byte[] data = new byte[1024];
|
||||
while ((nRead = input.read(data, 0, data.length)) != -1) {
|
||||
buffer.write(data, 0, nRead);
|
||||
}
|
||||
buffer.flush();
|
||||
return buffer.toByteArray();
|
||||
}
|
||||
|
||||
public void update(DomainUpdateReq req, UploadedFile jks) {
|
||||
DomainNameDO domainNameCheck = domainMapper.checkRepeat(req.getDomain(), Sets.newHashSet(req.getId()));
|
||||
ParamCheckUtil.checkMustNull(domainNameCheck, ExceptionConstant.DOMAIN_NAME_CANNOT_REPEAT);
|
||||
|
||||
DomainNameDO oldDomainNameDO = domainMapper.selectOne(Wrappers.<DomainNameDO>lambdaQuery().eq(DomainNameDO::getId, req.getId()));
|
||||
List<FullDomainNameBO> oldFullDomainNameBOS = domainMapper.selectFullDomainNameListByDomainNameIds(Sets.newHashSet(req.getId()));
|
||||
LambdaUpdateWrapper<DomainNameDO> updateWrapper = new LambdaUpdateWrapper<>();
|
||||
updateWrapper.eq(DomainNameDO::getId, req.getId());
|
||||
if (null != jks) {
|
||||
try {
|
||||
ParamCheckUtil.checkNotEmpty(req.getKeyStorePassword(), "keyStorePassword");
|
||||
|
||||
InputStream content = jks.getContent();
|
||||
byte[] byteArray = toByteArray(content);
|
||||
updateWrapper.set(DomainNameDO::getKeyStorePassword, req.getKeyStorePassword());
|
||||
updateWrapper.set(DomainNameDO::getJks, byteArray);
|
||||
//添加证书并删除旧的证书
|
||||
sslContextManager.addDomainAndCert(req.getDomain(), byteArray, req.getKeyStorePassword());
|
||||
if (!req.getDomain().equals(oldDomainNameDO.getDomain())) {
|
||||
sslContextManager.removeSslContextByDomain(oldDomainNameDO.getDomain());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("证书添加失败", e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
updateWrapper.set(DomainNameDO::getDomain, req.getDomain());
|
||||
updateWrapper.set(DomainNameDO::getUpdateTime, new Date());
|
||||
updateWrapper.set(req.getForceHttps() != null, DomainNameDO::getForceHttps, req.getForceHttps());
|
||||
domainMapper.update(updateWrapper);
|
||||
|
||||
//更新域名相关映射
|
||||
if (!Objects.equals(oldDomainNameDO.getDomain(), req.getDomain())) {
|
||||
//更新主域名到域名id映射
|
||||
ProxyUtil.removeDomainToDomainNameId(oldDomainNameDO.getDomain());
|
||||
ProxyUtil.setDomainToDomainNameId(req.getDomain(), req.getId());
|
||||
if (CollectionUtil.isEmpty(oldFullDomainNameBOS)) return;
|
||||
//存在域名映射,更新完整域名到服务器端口映射
|
||||
for (FullDomainNameBO oldFullDomainNameBO : oldFullDomainNameBOS) {
|
||||
String oldFullDomain = StrUtil.join(StrPool.DOT, oldFullDomainNameBO.getSubdomain(), oldFullDomainNameBO.getDomain());
|
||||
Integer serverPort = ProxyUtil.getServerPortByFullDomain(oldFullDomain);
|
||||
ProxyUtil.removeFullDomainToServerPort(oldFullDomain);
|
||||
ProxyUtil.setFullDomainToServerPort(StrUtil.join(StrPool.DOT, oldFullDomainNameBO.getSubdomain(), req.getDomain()), serverPort);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public DomainUpdateEnableStatusRes updateEnableStatus(DomainUpdateEnableStatusReq req) {
|
||||
if (Objects.equals(req.getEnable(), EnableStatusEnum.DISABLE.getStatus())) {
|
||||
//如果设置状态为禁用,则将默认域名设置为非默认域名
|
||||
updateDefaultStatus(req.getId(), DefaultDomainStatusEnum.DISABLE.getStatus());
|
||||
}
|
||||
domainMapper.updateEnableStatus(req.getId(), req.getEnable(), new Date());
|
||||
if (Objects.equals(req.getEnable(), EnableStatusEnum.ENABLE.getStatus())) {
|
||||
ProxyUtil.setDomainToDomainNameId(req.getDomain(), req.getId());
|
||||
} else {
|
||||
ProxyUtil.removeDomainToDomainNameId(req.getDomain());
|
||||
}
|
||||
return new DomainUpdateEnableStatusRes();
|
||||
}
|
||||
|
||||
public void delete(Integer domainNameId) {
|
||||
//检查当前域名是否正在使用
|
||||
boolean checkUsed = domainPortMappingMapper.checkUsed(domainNameId);
|
||||
ParamCheckUtil.checkExpression(!checkUsed, ExceptionConstant.DOMAIN_NAME_IS_USED);
|
||||
DomainNameDO domainNameDO = domainMapper.selectOne(Wrappers.<DomainNameDO>lambdaQuery()
|
||||
.eq(DomainNameDO::getId, domainNameId)
|
||||
.select(DomainNameDO::getDomain, DomainNameDO::getEnable));
|
||||
if (Objects.equals(domainNameDO.getEnable(), EnableStatusEnum.ENABLE.getStatus())) {
|
||||
ProxyUtil.removeDomainToDomainNameId(domainNameDO.getDomain());
|
||||
}
|
||||
domainMapper.deleteById(domainNameId);
|
||||
//删除证书
|
||||
sslContextManager.removeSslContextByDomain(domainNameDO.getDomain());
|
||||
}
|
||||
|
||||
public DomainUpdateDefaultStatusRes updateDefaultStatus(Integer id, Integer isDefault) {
|
||||
if (Objects.equals(isDefault, DefaultDomainStatusEnum.ENABLE.getStatus())) {
|
||||
//如果设置状态为默认域名,则将之前的默认域名设置为非默认域名
|
||||
DomainNameDO oldDomainNameDO = domainMapper.selectOne(Wrappers.<DomainNameDO>lambdaQuery()
|
||||
.select(DomainNameDO::getId)
|
||||
.eq(DomainNameDO::getIsDefault, DefaultDomainStatusEnum.ENABLE.getStatus()));
|
||||
if (oldDomainNameDO != null) {
|
||||
oldDomainNameDO.setIsDefault(DefaultDomainStatusEnum.DISABLE.getStatus());
|
||||
domainMapper.updateById(oldDomainNameDO);
|
||||
}
|
||||
}
|
||||
|
||||
DomainNameDO domainNameDO = new DomainNameDO();
|
||||
domainNameDO.setId(id);
|
||||
domainNameDO.setIsDefault(isDefault);
|
||||
domainMapper.updateById(domainNameDO);
|
||||
|
||||
return new DomainUpdateDefaultStatusRes();
|
||||
}
|
||||
|
||||
@Init
|
||||
public void init() {
|
||||
// aot 阶段,不初始化
|
||||
if (NativeDetector.isAotRuntime()) {
|
||||
return;
|
||||
}
|
||||
List<FullDomainNameBO> fullDomainNameBOS = domainMapper.selectFullDomainNameList();
|
||||
if (CollectionUtil.isEmpty(fullDomainNameBOS)) {
|
||||
return;
|
||||
}
|
||||
Set<Integer> portMappingIds = fullDomainNameBOS.stream().map(FullDomainNameBO::getPortMappingId).collect(Collectors.toSet());
|
||||
List<PortMappingDO> portMappingDOS = portMappingMapper.selectBatchIds(portMappingIds);
|
||||
if (CollectionUtil.isEmpty(portMappingDOS)) {
|
||||
return;
|
||||
}
|
||||
Map<Integer, PortMappingDO> portMappingDOMap = portMappingDOS.stream()
|
||||
.filter(item -> NetworkProtocolEnum.HTTP.getDesc().equals(item.getProtocal()))
|
||||
.collect(Collectors.toMap(PortMappingDO::getId, Function.identity()));
|
||||
fullDomainNameBOS.forEach(item -> {
|
||||
PortMappingDO portMappingDO = portMappingDOMap.get(item.getPortMappingId());
|
||||
if (null == portMappingDO) {
|
||||
return;
|
||||
}
|
||||
String fullDomain = StrUtil.join(StrPool.DOT, item.getSubdomain(), item.getDomain());
|
||||
//更新完整域名到端口映射
|
||||
ProxyUtil.setFullDomainToServerPort(fullDomain, portMappingDO.getServerPort());
|
||||
});
|
||||
|
||||
//更新主域名到主域名id缓存,未禁用
|
||||
List<DomainNameDO> domainNameDOS = domainMapper.selectList(Wrappers.<DomainNameDO>lambdaQuery()
|
||||
.eq(DomainNameDO::getEnable, EnableStatusEnum.ENABLE.getStatus())
|
||||
.select(DomainNameDO::getDomain, DomainNameDO::getId));
|
||||
for (DomainNameDO domainNameDO : domainNameDOS) {
|
||||
ProxyUtil.setDomainToDomainNameId(domainNameDO.getDomain(), domainNameDO.getId());
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isOnlyHttps(Integer domainNameId) {
|
||||
ParamCheckUtil.checkExpression((domainNameId != null && domainNameId > 0), ExceptionConstant.DOMAIN_NAME_NOT_EXIST);
|
||||
DomainNameDO domainNameDO = domainMapper.selectOne(Wrappers.<DomainNameDO>lambdaQuery()
|
||||
.eq(DomainNameDO::getId, domainNameId));
|
||||
return domainNameDO != null && Objects.equals(domainNameDO.getForceHttps(), HttpsStatusEnum.ONLY_HTTPS.getStatus());
|
||||
}
|
||||
}
|
||||
@@ -1,24 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package org.dromara.neutrinoproxy.server.service;
|
||||
|
||||
import org.dromara.neutrinoproxy.core.util.LockUtil;
|
||||
|
||||
@@ -35,11 +35,9 @@ import org.noear.solon.Solon;
|
||||
import org.noear.solon.annotation.Component;
|
||||
import org.noear.solon.annotation.Init;
|
||||
import org.noear.solon.annotation.Inject;
|
||||
import org.noear.solon.core.runtime.NativeDetector;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -67,6 +65,10 @@ public class JobInfoService implements IJobSource {
|
||||
|
||||
@Init
|
||||
public void init() {
|
||||
// aot 阶段,不初始化
|
||||
if (NativeDetector.isAotRuntime()) {
|
||||
return;
|
||||
}
|
||||
jobHandlerMap.put("DataCleanJob", dataCleanJob);
|
||||
jobHandlerMap.put("DemoJob", demoJob);
|
||||
jobHandlerMap.put("FlowReportForDayJob", flowReportForDayJob);
|
||||
@@ -107,6 +109,10 @@ public class JobInfoService implements IJobSource {
|
||||
|
||||
@Override
|
||||
public List<JobInfo> sourceList() {
|
||||
// aot 阶段,不查数据库
|
||||
if (NativeDetector.isAotRuntime()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
List<JobInfo> jobInfoList = Lists.newArrayList();
|
||||
List<JobInfoDO> jobInfoDOList = jobInfoMapper.findList();
|
||||
if (CollectionUtil.isEmpty(jobInfoDOList)) {
|
||||
|
||||
@@ -1,24 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package org.dromara.neutrinoproxy.server.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
@@ -35,7 +14,9 @@ import org.dromara.neutrinoproxy.server.dal.entity.JobLogDO;
|
||||
import org.dromara.solonplugins.job.IJobCallback;
|
||||
import org.dromara.solonplugins.job.JobInfo;
|
||||
import org.noear.solon.annotation.Component;
|
||||
import org.noear.solon.core.runtime.NativeDetector;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -53,6 +34,10 @@ public class JobLogService implements IJobCallback {
|
||||
|
||||
@Override
|
||||
public void executeLog(JobInfo jobInfo, String param, Throwable throwable) {
|
||||
// aot 阶段,不查数据库
|
||||
if (NativeDetector.isAotRuntime()) {
|
||||
return;
|
||||
}
|
||||
Integer code = 0;
|
||||
String msg = "";
|
||||
if (null == throwable) {
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
package org.dromara.neutrinoproxy.server.service;
|
||||
|
||||
import cn.hutool.cache.Cache;
|
||||
import cn.hutool.cache.CacheUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import com.baomidou.mybatisplus.solon.plugins.pagination.Page;
|
||||
import com.google.common.collect.Sets;
|
||||
@@ -29,11 +32,14 @@ import org.dromara.neutrinoproxy.server.dal.UserMapper;
|
||||
import org.dromara.neutrinoproxy.server.dal.entity.LicenseDO;
|
||||
import org.dromara.neutrinoproxy.server.dal.entity.PortMappingDO;
|
||||
import org.dromara.neutrinoproxy.server.dal.entity.UserDO;
|
||||
import org.dromara.neutrinoproxy.server.service.bo.FlowLimitBO;
|
||||
import org.dromara.neutrinoproxy.server.util.ParamCheckUtil;
|
||||
import org.dromara.neutrinoproxy.server.util.StringUtil;
|
||||
import org.noear.solon.annotation.Component;
|
||||
import org.noear.solon.annotation.Init;
|
||||
import org.noear.solon.annotation.Inject;
|
||||
import org.noear.solon.core.bean.LifecycleBean;
|
||||
import org.noear.solon.core.runtime.NativeDetector;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
@@ -62,6 +68,8 @@ public class LicenseService implements LifecycleBean {
|
||||
private VisitorChannelService visitorChannelService;
|
||||
@Inject
|
||||
private DBInitialize dbInitialize;
|
||||
// 流量限制缓存
|
||||
private final Cache<Integer, FlowLimitBO> flowLimitCache = CacheUtil.newLRUCache(200, 1000 * 60 * 5);
|
||||
|
||||
public PageInfo<LicenseListRes> page(PageQuery pageQuery, LicenseListReq req) {
|
||||
Page<LicenseDO> page = licenseMapper.selectPage(new Page<>(pageQuery.getCurrent(), pageQuery.getSize()), new LambdaQueryWrapper<LicenseDO>()
|
||||
@@ -127,15 +135,21 @@ public class LicenseService implements LifecycleBean {
|
||||
String key = UUID.randomUUID().toString().replaceAll("-", "");
|
||||
Date now = new Date();
|
||||
|
||||
licenseMapper.insert(new LicenseDO()
|
||||
.setName(req.getName())
|
||||
.setKey(key)
|
||||
.setUserId(req.getUserId())
|
||||
.setIsOnline(OnlineStatusEnum.OFFLINE.getStatus())
|
||||
.setEnable(EnableStatusEnum.ENABLE.getStatus())
|
||||
.setCreateTime(now)
|
||||
.setUpdateTime(now)
|
||||
);
|
||||
licenseDO = new LicenseDO()
|
||||
.setName(req.getName())
|
||||
.setKey(key)
|
||||
.setUserId(req.getUserId())
|
||||
.setUpLimitRate(req.getUpLimitRate())
|
||||
.setDownLimitRate(req.getDownLimitRate())
|
||||
.setIsOnline(OnlineStatusEnum.OFFLINE.getStatus())
|
||||
.setEnable(EnableStatusEnum.ENABLE.getStatus())
|
||||
.setCreateTime(now)
|
||||
.setUpdateTime(now);
|
||||
|
||||
licenseMapper.insert(licenseDO);
|
||||
|
||||
// 刷新流量限制缓存
|
||||
refreshFlowLimitCache(licenseDO.getId(), licenseDO.getUpLimitRate(), licenseDO.getDownLimitRate());
|
||||
return new LicenseCreateRes();
|
||||
}
|
||||
|
||||
@@ -146,7 +160,17 @@ public class LicenseService implements LifecycleBean {
|
||||
LicenseDO licenseCheck = licenseMapper.checkRepeat(oldLicenseDO.getUserId(), req.getName(), Sets.newHashSet(oldLicenseDO.getId()));
|
||||
ParamCheckUtil.checkMustNull(licenseCheck, ExceptionConstant.LICENSE_NAME_CANNOT_REPEAT);
|
||||
|
||||
licenseMapper.update(req.getId(), req.getName(), new Date());
|
||||
licenseMapper.update(null, new LambdaUpdateWrapper<LicenseDO>()
|
||||
.eq(LicenseDO::getId, req.getId())
|
||||
.set(LicenseDO::getName, req.getName())
|
||||
.set(LicenseDO::getUpLimitRate, req.getUpLimitRate())
|
||||
.set(LicenseDO::getDownLimitRate, req.getDownLimitRate())
|
||||
.set(LicenseDO::getUpdateTime, new Date())
|
||||
);
|
||||
|
||||
// 刷新流量限制缓存
|
||||
refreshFlowLimitCache(req.getId(), req.getUpLimitRate(), req.getDownLimitRate());
|
||||
|
||||
return new LicenseUpdateRes();
|
||||
}
|
||||
|
||||
@@ -199,6 +223,8 @@ public class LicenseService implements LifecycleBean {
|
||||
licenseMapper.deleteById(id);
|
||||
// 更新VisitorChannel
|
||||
visitorChannelService.updateVisitorChannelByLicenseId(id, EnableStatusEnum.DISABLE.getStatus());
|
||||
// 删除流量限制缓存
|
||||
flowLimitCache.remove(id);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -238,10 +264,55 @@ public class LicenseService implements LifecycleBean {
|
||||
*/
|
||||
@Init
|
||||
public void init() {
|
||||
// aot 阶段,不初始化
|
||||
if (NativeDetector.isAotRuntime()) {
|
||||
return;
|
||||
}
|
||||
// 服务刚启动,所以默认所有license都是离线状态。解决服务突然关闭,在线状态来不及更新的问题
|
||||
licenseMapper.updateOnlineStatus(OnlineStatusEnum.OFFLINE.getStatus(), new Date());
|
||||
// 刷新流量限制缓存
|
||||
List<LicenseDO> licenseDOList = licenseMapper.listAll();
|
||||
if (CollectionUtils.isEmpty(licenseDOList)) {
|
||||
for (LicenseDO licenseDO : licenseDOList) {
|
||||
refreshFlowLimitCache(licenseDO.getId(), licenseDO.getUpLimitRate(), licenseDO.getDownLimitRate());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 刷新流量限制缓存
|
||||
* @param id
|
||||
* @param upLimitRate
|
||||
* @param downLimitRate
|
||||
*/
|
||||
private void refreshFlowLimitCache(Integer id, String upLimitRate, String downLimitRate) {
|
||||
if (null == id) {
|
||||
return;
|
||||
}
|
||||
flowLimitCache.put(id, new FlowLimitBO()
|
||||
.setUpLimitRate(StringUtil.parseBytes(upLimitRate))
|
||||
.setDownLimitRate(StringUtil.parseBytes(downLimitRate))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取license的流量限制
|
||||
* @param licenseId
|
||||
* @return
|
||||
*/
|
||||
public FlowLimitBO getFlowLimit(Integer licenseId) {
|
||||
FlowLimitBO res = flowLimitCache.get(licenseId);
|
||||
if (null == res) {
|
||||
LicenseDO licenseDO = licenseMapper.queryById(licenseId);
|
||||
if (null != licenseDO) {
|
||||
refreshFlowLimitCache(licenseId, licenseDO.getUpLimitRate(), licenseDO.getDownLimitRate());
|
||||
res = flowLimitCache.get(licenseId);
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start() throws Throwable {
|
||||
|
||||
|
||||
@@ -1,10 +1,15 @@
|
||||
package org.dromara.neutrinoproxy.server.service;
|
||||
|
||||
import cn.hutool.cache.Cache;
|
||||
import cn.hutool.cache.CacheUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.text.StrPool;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.solon.plugins.pagination.Page;
|
||||
import com.google.common.collect.Sets;
|
||||
import org.apache.ibatis.solon.annotation.Db;
|
||||
@@ -25,27 +30,21 @@ import org.dromara.neutrinoproxy.server.controller.res.proxy.PortMappingCreateRe
|
||||
import org.dromara.neutrinoproxy.server.controller.res.proxy.PortMappingDetailRes;
|
||||
import org.dromara.neutrinoproxy.server.controller.res.proxy.PortMappingListRes;
|
||||
import org.dromara.neutrinoproxy.server.controller.res.proxy.PortMappingUpdateEnableStatusRes;
|
||||
import org.dromara.neutrinoproxy.server.controller.res.proxy.PortMappingUpdateRes;
|
||||
import org.dromara.neutrinoproxy.server.dal.LicenseMapper;
|
||||
import org.dromara.neutrinoproxy.server.dal.PortMappingMapper;
|
||||
import org.dromara.neutrinoproxy.server.dal.PortPoolMapper;
|
||||
import org.dromara.neutrinoproxy.server.dal.UserMapper;
|
||||
import org.dromara.neutrinoproxy.server.dal.entity.LicenseDO;
|
||||
import org.dromara.neutrinoproxy.server.dal.entity.PortMappingDO;
|
||||
import org.dromara.neutrinoproxy.server.dal.entity.PortPoolDO;
|
||||
import org.dromara.neutrinoproxy.server.dal.entity.UserDO;
|
||||
import org.dromara.neutrinoproxy.server.dal.*;
|
||||
import org.dromara.neutrinoproxy.server.dal.entity.*;
|
||||
import org.dromara.neutrinoproxy.server.service.bo.FlowLimitBO;
|
||||
import org.dromara.neutrinoproxy.server.service.bo.FullDomainNameBO;
|
||||
import org.dromara.neutrinoproxy.server.util.ParamCheckUtil;
|
||||
import org.dromara.neutrinoproxy.server.util.ProxyUtil;
|
||||
import org.dromara.neutrinoproxy.server.util.StringUtil;
|
||||
import org.noear.solon.annotation.Component;
|
||||
import org.noear.solon.annotation.Init;
|
||||
import org.noear.solon.annotation.Inject;
|
||||
import org.noear.solon.core.bean.LifecycleBean;
|
||||
import org.noear.solon.core.runtime.NativeDetector;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -63,6 +62,10 @@ public class PortMappingService implements LifecycleBean {
|
||||
private UserMapper userMapper;
|
||||
@Db
|
||||
private PortPoolMapper portPoolMapper;
|
||||
@Db
|
||||
private DomainMapper domainMapper;
|
||||
@Db
|
||||
private DomainPortMappingMapper domainPortMappingMapper;
|
||||
@Inject
|
||||
private VisitorChannelService visitorChannelService;
|
||||
|
||||
@@ -72,6 +75,16 @@ public class PortMappingService implements LifecycleBean {
|
||||
private ProxyConfig proxyConfig;
|
||||
@Inject
|
||||
private DBInitialize dbInitialize;
|
||||
@Inject
|
||||
private LicenseService licenseService;
|
||||
|
||||
/** 端口到安全组Id的映射 */
|
||||
private final Map<Integer, Integer> mappingPortToSecurityGroupMap = new ConcurrentHashMap<>();
|
||||
private final Cache<Integer, Integer> serverPortToPortMappingIdCache = CacheUtil.newLRUCache(500, 1000 * 60 * 10);
|
||||
// 端口映射id到licenseId
|
||||
private final Cache<Integer, Integer> idToLicenseIdCache = CacheUtil.newLRUCache(500, 1000 * 60 * 10);
|
||||
// 流量限制缓存
|
||||
private final Cache<Integer, FlowLimitBO> flowLimitCache = CacheUtil.newLRUCache(500, 1000 * 60 * 5);
|
||||
|
||||
public PageInfo<PortMappingListRes> page(PageQuery pageQuery, PortMappingListReq req) {
|
||||
if (StringUtils.isNotEmpty(req.getDescription())) {
|
||||
@@ -102,6 +115,11 @@ public class PortMappingService implements LifecycleBean {
|
||||
Map<Integer, LicenseDO> licenseMap = licenseList.stream().collect(Collectors.toMap(LicenseDO::getId, Function.identity()));
|
||||
Map<Integer, UserDO> userMap = userList.stream().collect(Collectors.toMap(UserDO::getId, Function.identity()));
|
||||
|
||||
//域名相关
|
||||
Set<Integer> portMappingIds = respList.stream().map(PortMappingListRes::getId).collect(Collectors.toSet());
|
||||
List<FullDomainNameBO> fullDomainNameBOS = domainMapper.selectFullDomainNameListByPortMappingIds(portMappingIds);
|
||||
Map<Integer, List<FullDomainNameBO>> fullDomainNameBOMap = fullDomainNameBOS.stream().collect(Collectors.groupingBy(FullDomainNameBO::getPortMappingId));
|
||||
|
||||
respList.forEach(item -> {
|
||||
LicenseDO license = licenseMap.get(item.getLicenseId());
|
||||
if (null == license) {
|
||||
@@ -114,15 +132,16 @@ public class PortMappingService implements LifecycleBean {
|
||||
return;
|
||||
}
|
||||
item.setUserName(user.getName());
|
||||
if (StrUtil.isNotBlank(proxyConfig.getServer().getTcp().getDomainName()) && StrUtil.isNotBlank(item.getSubdomain())) {
|
||||
item.setDomain(item.getSubdomain() + "." + proxyConfig.getServer().getTcp().getDomainName());
|
||||
}
|
||||
//域名映射
|
||||
item.setFullDomainMappings(fullDomainNameBOMap.get(item.getId()));
|
||||
if (NetworkProtocolEnum.HTTP.getDesc().equals(item.getProtocal())) {
|
||||
item.setProtocal("HTTP(S)");
|
||||
}
|
||||
});
|
||||
//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());
|
||||
}
|
||||
|
||||
@@ -136,16 +155,30 @@ public class PortMappingService implements LifecycleBean {
|
||||
PortPoolDO portPoolDO = portPoolMapper.findByPort(req.getServerPort());
|
||||
ParamCheckUtil.checkNotNull(portPoolDO, ExceptionConstant.PORT_NOT_EXIST);
|
||||
ParamCheckUtil.checkExpression(null == portMappingMapper.findByPort(req.getServerPort(), null), ExceptionConstant.PORT_CANNOT_REPEAT_MAPPING, req.getServerPort());
|
||||
ParamCheckUtil.checkExpression(!portMappingMapper.checkRepeatBySubdomain(req.getSubdomain(), null), ExceptionConstant.PORT_MAPPING_SUBDONAME_CONNOT_REPEAT);
|
||||
//验证域名映射相关参数条件
|
||||
if (NetworkProtocolEnum.isHttp(req.getProtocal()) && CollectionUtil.isNotEmpty(req.getDomainMappings())) {
|
||||
Set<Integer> domainIds = req.getDomainMappings().stream().map(item -> item.getDomainId()).collect(Collectors.toSet());
|
||||
List<DomainNameDO> domainNameDOS = domainMapper.selectBatchIds(domainIds);
|
||||
Map<Integer, DomainNameDO> domainNameDOMap = domainNameDOS.stream().collect(Collectors.toMap(DomainNameDO::getId, Function.identity()));
|
||||
|
||||
req.getDomainMappings().forEach(item -> {
|
||||
DomainNameDO domainNameDO = domainNameDOMap.get(item.getDomainId());
|
||||
ParamCheckUtil.checkNotNull(domainNameDO, ExceptionConstant.DOMAIN_NAME_NOT_EXIST);
|
||||
//检查当前域名是否被禁用
|
||||
//ParamCheckUtil.checkExpression(Objects.equals(EnableStatusEnum.ENABLE.getStatus(), domainNameDO.getEnable()), ExceptionConstant.DOMAIN_NAME_IS_DISABLE, domainNameDO.getDomain());
|
||||
//检查子域名是否重复
|
||||
ParamCheckUtil.checkExpression(!domainPortMappingMapper.checkRepeatBySubdomain(item.getSubdomain(), item.getDomainId(), null), ExceptionConstant.SUDOMAIN_NAME_CANNOT_REPEAT);
|
||||
});
|
||||
}
|
||||
Date now = new Date();
|
||||
PortMappingDO portMappingDO = new PortMappingDO();
|
||||
portMappingDO.setLicenseId(req.getLicenseId());
|
||||
portMappingDO.setProtocal(req.getProtocal());
|
||||
portMappingDO.setSubdomain(req.getSubdomain());
|
||||
portMappingDO.setServerPort(req.getServerPort());
|
||||
portMappingDO.setClientIp(req.getClientIp());
|
||||
portMappingDO.setClientPort(req.getClientPort());
|
||||
portMappingDO.setUpLimitRate(req.getUpLimitRate());
|
||||
portMappingDO.setDownLimitRate(req.getDownLimitRate());
|
||||
portMappingDO.setProxyResponses(req.getProxyResponses());
|
||||
portMappingDO.setProxyTimeoutMs(req.getProxyTimeoutMs());
|
||||
portMappingDO.setDescription(req.getDescription());
|
||||
@@ -156,14 +189,39 @@ public class PortMappingService implements LifecycleBean {
|
||||
portMappingMapper.insert(portMappingDO);
|
||||
// 更新VisitorChannel
|
||||
visitorChannelService.addVisitorChannelByPortMapping(portMappingDO);
|
||||
// 更新域名映射
|
||||
if (NetworkProtocolEnum.isHttp(portMappingDO.getProtocal()) && StrUtil.isNotBlank(proxyConfig.getServer().getTcp().getDomainName()) && StrUtil.isNotBlank(portMappingDO.getSubdomain())) {
|
||||
ProxyUtil.setSubdomainToServerPort(portMappingDO.getSubdomain(), portMappingDO.getServerPort());
|
||||
|
||||
// 更新域名映射,添加新的域名映射
|
||||
if (NetworkProtocolEnum.isHttp(portMappingDO.getProtocal()) && CollectionUtil.isNotEmpty(req.getDomainMappings())) {
|
||||
Set<Integer> domainIds = req.getDomainMappings().stream().map(item -> item.getDomainId()).collect(Collectors.toSet());
|
||||
List<DomainNameDO> domainNameDOS = domainMapper.selectBatchIds(domainIds);
|
||||
Map<Integer, DomainNameDO> domainNameDOMap = domainNameDOS.stream().collect(Collectors.toMap(DomainNameDO::getId, Function.identity()));
|
||||
|
||||
req.getDomainMappings().forEach(item -> {
|
||||
DomainNameDO domainNameDO = domainNameDOMap.get(item.getDomainId());
|
||||
//创建域名映射
|
||||
DomainPortMappingDO domainPortMappingDO = new DomainPortMappingDO();
|
||||
domainPortMappingDO.setDomainNameId(item.getDomainId());
|
||||
domainPortMappingDO.setSubdomain(item.getSubdomain());
|
||||
domainPortMappingDO.setPortMappingId(portMappingDO.getId());
|
||||
domainPortMappingMapper.insert(domainPortMappingDO);
|
||||
//设置完整域名到服务端端口的映射
|
||||
ProxyUtil.setFullDomainToServerPort(StrUtil.join(StrPool.DOT, item.getSubdomain(), domainNameDO.getDomain()), portMappingDO.getServerPort());
|
||||
});
|
||||
}
|
||||
|
||||
updateMappingPortToSecurityGroupMap(portMappingDO.getServerPort(), req.getSecurityGroupId());
|
||||
|
||||
// 更新端口到映射的缓存
|
||||
serverPortToPortMappingIdCache.put(req.getServerPort(), portMappingDO.getId());
|
||||
// 更新端口映射到licenseId的缓存
|
||||
idToLicenseIdCache.put(portMappingDO.getId(), portMappingDO.getLicenseId());
|
||||
// 刷新流量限制缓存
|
||||
refreshFlowLimitCache(portMappingDO.getId(), portMappingDO.getUpLimitRate(), portMappingDO.getDownLimitRate());
|
||||
|
||||
return new PortMappingCreateRes();
|
||||
}
|
||||
|
||||
public PortMappingUpdateRes update(PortMappingUpdateReq req) {
|
||||
public void update(PortMappingUpdateReq req) {
|
||||
LicenseDO licenseDO = licenseMapper.findById(req.getLicenseId());
|
||||
ParamCheckUtil.checkNotNull(licenseDO, ExceptionConstant.LICENSE_NOT_EXIST);
|
||||
if (!SystemContextHolder.isAdmin()) {
|
||||
@@ -173,37 +231,82 @@ public class PortMappingService implements LifecycleBean {
|
||||
PortPoolDO portPoolDO = portPoolMapper.findByPort(req.getServerPort());
|
||||
ParamCheckUtil.checkNotNull(portPoolDO, ExceptionConstant.PORT_NOT_EXIST);
|
||||
ParamCheckUtil.checkExpression(null == portMappingMapper.findByPort(req.getServerPort(), Sets.newHashSet(req.getId())), ExceptionConstant.PORT_CANNOT_REPEAT_MAPPING, req.getServerPort());
|
||||
ParamCheckUtil.checkExpression(!portMappingMapper.checkRepeatBySubdomain(req.getSubdomain(), Sets.newHashSet(req.getId())), ExceptionConstant.PORT_MAPPING_SUBDONAME_CONNOT_REPEAT);
|
||||
|
||||
// 查询原端口映射
|
||||
PortMappingDO oldPortMappingDO = portMappingMapper.findById(req.getId());
|
||||
ParamCheckUtil.checkNotNull(oldPortMappingDO, ExceptionConstant.PORT_MAPPING_NOT_EXIST);
|
||||
|
||||
PortMappingDO portMappingDO = new PortMappingDO();
|
||||
portMappingDO.setId(req.getId());
|
||||
portMappingDO.setProtocal(req.getProtocal());
|
||||
portMappingDO.setSubdomain(req.getSubdomain());
|
||||
portMappingDO.setLicenseId(req.getLicenseId());
|
||||
portMappingDO.setServerPort(req.getServerPort());
|
||||
portMappingDO.setClientIp(req.getClientIp());
|
||||
portMappingDO.setClientPort(req.getClientPort());
|
||||
portMappingDO.setProxyResponses(req.getProxyResponses());
|
||||
portMappingDO.setProxyTimeoutMs(req.getProxyTimeoutMs());
|
||||
portMappingDO.setDescription(req.getDescription());
|
||||
portMappingDO.setUpdateTime(new Date());
|
||||
portMappingDO.setEnable(EnableStatusEnum.ENABLE.getStatus());
|
||||
portMappingMapper.updateById(portMappingDO);
|
||||
//验证域名映射相关参数条件
|
||||
if (NetworkProtocolEnum.isHttp(req.getProtocal()) && CollectionUtil.isNotEmpty(req.getDomainMappings())) {
|
||||
Set<Integer> domainIds = req.getDomainMappings().stream().map(item -> item.getDomainId()).collect(Collectors.toSet());
|
||||
List<DomainNameDO> domainNameDOS = domainMapper.selectBatchIds(domainIds);
|
||||
Map<Integer, DomainNameDO> domainNameDOMap = domainNameDOS.stream().collect(Collectors.toMap(DomainNameDO::getId, Function.identity()));
|
||||
|
||||
req.getDomainMappings().forEach(item -> {
|
||||
DomainNameDO domainNameDO = domainNameDOMap.get(item.getDomainId());
|
||||
ParamCheckUtil.checkNotNull(domainNameDO, ExceptionConstant.DOMAIN_NAME_NOT_EXIST);
|
||||
//检查子域名是否重复
|
||||
boolean b = !domainPortMappingMapper.checkRepeatBySubdomain(item.getSubdomain(), item.getDomainId(), item.getId());
|
||||
ParamCheckUtil.checkExpression(b,
|
||||
ExceptionConstant.SUDOMAIN_NAME_CANNOT_REPEAT);
|
||||
});
|
||||
}
|
||||
// 更新端口映射
|
||||
portMappingMapper.update(null, new LambdaUpdateWrapper<PortMappingDO>()
|
||||
.eq(PortMappingDO::getId, req.getId())
|
||||
.set(PortMappingDO::getProtocal, req.getProtocal())
|
||||
.set(PortMappingDO::getServerPort, req.getServerPort())
|
||||
.set(PortMappingDO::getClientIp, req.getClientIp())
|
||||
.set(PortMappingDO::getClientPort, req.getClientPort())
|
||||
.set(PortMappingDO::getUpLimitRate, req.getUpLimitRate())
|
||||
.set(PortMappingDO::getDownLimitRate, req.getDownLimitRate())
|
||||
.set(PortMappingDO::getProxyTimeoutMs, req.getProxyTimeoutMs())
|
||||
.set(PortMappingDO::getProxyResponses, req.getProxyResponses())
|
||||
.set(PortMappingDO::getSecurityGroupId, req.getSecurityGroupId())
|
||||
.set(PortMappingDO::getDescription, req.getDescription())
|
||||
.set(PortMappingDO::getUpdateTime, new Date())
|
||||
);
|
||||
|
||||
// 更新VisitorChannel
|
||||
PortMappingDO portMappingDO = portMappingMapper.findById(req.getId());
|
||||
visitorChannelService.updateVisitorChannelByPortMapping(oldPortMappingDO, portMappingDO);
|
||||
// 删除老的域名映射
|
||||
if (NetworkProtocolEnum.isHttp(oldPortMappingDO.getProtocal()) && StrUtil.isNotBlank(oldPortMappingDO.getSubdomain())) {
|
||||
ProxyUtil.removeSubdomainToServerPort(oldPortMappingDO.getSubdomain());
|
||||
}
|
||||
|
||||
// 更新域名映射
|
||||
if (NetworkProtocolEnum.isHttp(portMappingDO.getProtocal()) && StrUtil.isNotBlank(proxyConfig.getServer().getTcp().getDomainName()) && StrUtil.isNotBlank(portMappingDO.getSubdomain())) {
|
||||
ProxyUtil.setSubdomainToServerPort(portMappingDO.getSubdomain(), portMappingDO.getServerPort());
|
||||
// 删除老的域名映射
|
||||
if (NetworkProtocolEnum.isHttp(oldPortMappingDO.getProtocal())) {
|
||||
//删除完整域名到服务端端口的映射
|
||||
ProxyUtil.removeFullDomainToServerPortByServerPort(oldPortMappingDO.getServerPort());
|
||||
//删除旧的域名映射
|
||||
LambdaQueryWrapper<DomainPortMappingDO> lambdaQueryWrapper = Wrappers.<DomainPortMappingDO>lambdaQuery()
|
||||
.eq(DomainPortMappingDO::getPortMappingId, oldPortMappingDO.getId());
|
||||
domainPortMappingMapper.delete(lambdaQueryWrapper);
|
||||
}
|
||||
return new PortMappingUpdateRes();
|
||||
// 添加新的域名映射
|
||||
if (NetworkProtocolEnum.isHttp(portMappingDO.getProtocal()) && CollectionUtil.isNotEmpty(req.getDomainMappings())) {
|
||||
Set<Integer> domainIds = req.getDomainMappings().stream().map(item -> item.getDomainId()).collect(Collectors.toSet());
|
||||
List<DomainNameDO> domainNameDOS = domainMapper.selectBatchIds(domainIds);
|
||||
Map<Integer, DomainNameDO> domainNameDOMap = domainNameDOS.stream().collect(Collectors.toMap(DomainNameDO::getId, Function.identity()));
|
||||
|
||||
req.getDomainMappings().forEach(item -> {
|
||||
DomainNameDO domainNameDO = domainNameDOMap.get(item.getDomainId());
|
||||
//创建域名映射
|
||||
DomainPortMappingDO domainPortMappingDO = new DomainPortMappingDO();
|
||||
domainPortMappingDO.setDomainNameId(item.getDomainId());
|
||||
domainPortMappingDO.setSubdomain(item.getSubdomain());
|
||||
domainPortMappingDO.setPortMappingId(portMappingDO.getId());
|
||||
domainPortMappingMapper.insert(domainPortMappingDO);
|
||||
//设置完整域名到服务端端口的映射
|
||||
ProxyUtil.setFullDomainToServerPort(StrUtil.join(StrPool.DOT, item.getSubdomain(), domainNameDO.getDomain()), portMappingDO.getServerPort());
|
||||
});
|
||||
}
|
||||
|
||||
updateMappingPortToSecurityGroupMap(portMappingDO.getServerPort(), req.getSecurityGroupId());
|
||||
|
||||
// 更新端口到映射的缓存
|
||||
serverPortToPortMappingIdCache.put(req.getServerPort(), req.getId());
|
||||
// 更新端口映射到licenseId的缓存
|
||||
idToLicenseIdCache.put(portMappingDO.getId(), portMappingDO.getLicenseId());
|
||||
// 刷新流量限制缓存
|
||||
refreshFlowLimitCache(req.getId(), req.getUpLimitRate(), req.getDownLimitRate());
|
||||
}
|
||||
|
||||
public PortMappingDetailRes detail(Integer id) {
|
||||
@@ -274,10 +377,45 @@ public class PortMappingService implements LifecycleBean {
|
||||
|
||||
// 更新VisitorChannel
|
||||
visitorChannelService.removeVisitorChannelByPortMapping(portMappingDO);
|
||||
// 更新域名映射
|
||||
if (NetworkProtocolEnum.isHttp(portMappingDO.getProtocal()) && StrUtil.isNotBlank(portMappingDO.getSubdomain())) {
|
||||
ProxyUtil.removeSubdomainToServerPort(portMappingDO.getSubdomain());
|
||||
|
||||
// 删除域名映射
|
||||
if (NetworkProtocolEnum.isHttp(portMappingDO.getProtocal())) {
|
||||
//删除完整域名到服务端端口的映射
|
||||
ProxyUtil.removeFullDomainToServerPortByServerPort(portMappingDO.getServerPort());
|
||||
//删除旧的域名映射
|
||||
LambdaQueryWrapper<DomainPortMappingDO> lambdaQueryWrapper = Wrappers.<DomainPortMappingDO>lambdaQuery()
|
||||
.eq(DomainPortMappingDO::getPortMappingId, portMappingDO.getId());
|
||||
domainPortMappingMapper.delete(lambdaQueryWrapper);
|
||||
}
|
||||
|
||||
updateMappingPortToSecurityGroupMap(portMappingDO.getServerPort(), null);
|
||||
|
||||
// 删除id到licenseId的映射
|
||||
idToLicenseIdCache.remove(id);
|
||||
// 删除流量限制缓存
|
||||
flowLimitCache.remove(id);
|
||||
}
|
||||
|
||||
public void portBindSecurityGroup(Integer portMappingId, Integer groupId) {
|
||||
PortMappingDO mappingDO = portMappingMapper.findById(portMappingId);
|
||||
if (mappingDO == null) {
|
||||
throw new RuntimeException("指定的端口映射不存在");
|
||||
}
|
||||
mappingDO.setSecurityGroupId(groupId);
|
||||
mappingDO.setUpdateTime(new Date());
|
||||
portMappingMapper.updateById(mappingDO);
|
||||
updateMappingPortToSecurityGroupMap(mappingDO.getServerPort(), groupId);
|
||||
}
|
||||
|
||||
public void portUnbindSecurityGroup(Integer portMappingId) {
|
||||
PortMappingDO mappingDO = portMappingMapper.findById(portMappingId);
|
||||
if (mappingDO == null) {
|
||||
throw new RuntimeException("指定的端口映射不存在");
|
||||
}
|
||||
mappingDO.setSecurityGroupId(0);
|
||||
mappingDO.setUpdateTime(new Date());
|
||||
portMappingMapper.updateById(mappingDO);
|
||||
updateMappingPortToSecurityGroupMap(mappingDO.getServerPort(), null);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -290,29 +428,124 @@ public class PortMappingService implements LifecycleBean {
|
||||
return portMappingMapper.findEnableListByLicenseId(licenseId);
|
||||
}
|
||||
|
||||
public Integer getSecurityGroupIdByMappingPort(Integer port) {
|
||||
return mappingPortToSecurityGroupMap.get(port);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 服务端项目停止、启动时,更新在线状态为离线
|
||||
*/
|
||||
@Init
|
||||
public void init() {
|
||||
// aot 阶段,不初始化
|
||||
if (NativeDetector.isAotRuntime()) {
|
||||
return;
|
||||
}
|
||||
// 服务刚启动,所以默认所有license都是离线状态。解决服务突然关闭,在线状态来不及更新的问题
|
||||
portMappingMapper.updateOnlineStatus(OnlineStatusEnum.OFFLINE.getStatus(), new Date());
|
||||
|
||||
// 未配置域名,则不需要处理域名映射逻辑
|
||||
if (StrUtil.isBlank(proxyConfig.getServer().getTcp().getDomainName())) {
|
||||
return;
|
||||
}
|
||||
List<PortMappingDO> portMappingDOList = portMappingMapper.selectList(new LambdaQueryWrapper<PortMappingDO>().eq(PortMappingDO::getProtocal, NetworkProtocolEnum.HTTP.getDesc()).isNotNull(PortMappingDO::getSubdomain));
|
||||
if (CollectionUtil.isEmpty(portMappingDOList)) {
|
||||
return;
|
||||
}
|
||||
portMappingDOList.forEach(item -> {
|
||||
if (StrUtil.isBlank(item.getSubdomain())) {
|
||||
return;
|
||||
List<PortMappingDO> allMappingDOList = portMappingMapper.selectList(Wrappers.lambdaQuery(PortMappingDO.class));
|
||||
allMappingDOList.forEach(item -> {
|
||||
Integer securityGroupId = item.getSecurityGroupId();
|
||||
if (securityGroupId != null && securityGroupId > 0) {
|
||||
updateMappingPortToSecurityGroupMap(item.getServerPort(), item.getSecurityGroupId());
|
||||
}
|
||||
ProxyUtil.setSubdomainToServerPort(item.getSubdomain(), item.getServerPort());
|
||||
// 更新端口到映射的缓存
|
||||
serverPortToPortMappingIdCache.put(item.getServerPort(), item.getId());
|
||||
// 更新端口映射到licenseId的缓存
|
||||
idToLicenseIdCache.put(item.getId(), item.getLicenseId());
|
||||
// 刷新流量限制缓存
|
||||
refreshFlowLimitCache(item.getId(), item.getUpLimitRate(), item.getDownLimitRate());
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷新流量限制缓存
|
||||
* @param id
|
||||
* @param upLimitRate
|
||||
* @param downLimitRate
|
||||
*/
|
||||
private void refreshFlowLimitCache(Integer id, String upLimitRate, String downLimitRate) {
|
||||
if (null == id) {
|
||||
return;
|
||||
}
|
||||
flowLimitCache.put(id, new FlowLimitBO()
|
||||
.setUpLimitRate(StringUtil.parseBytes(upLimitRate))
|
||||
.setDownLimitRate(StringUtil.parseBytes(downLimitRate))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取license的流量限制
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
public FlowLimitBO getFlowLimit(Integer id) {
|
||||
FlowLimitBO res = flowLimitCache.get(id);
|
||||
if (null == res) {
|
||||
PortMappingDO portMappingDO = portMappingMapper.findById(id);
|
||||
if (null != portMappingDO) {
|
||||
refreshFlowLimitCache(id, portMappingDO.getUpLimitRate(), portMappingDO.getDownLimitRate());
|
||||
res = flowLimitCache.get(id);
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
public Integer getPortMappingIdByServerPort(Integer serverPort) {
|
||||
if (null == serverPort) {
|
||||
return null;
|
||||
}
|
||||
Integer id = serverPortToPortMappingIdCache.get(serverPort);
|
||||
if (null != id) {
|
||||
return id;
|
||||
}
|
||||
List<PortMappingDO> portMappingDOList = portMappingMapper.findListByServerPort(serverPort);
|
||||
// 不存在 或者 有多条记录,都不处理
|
||||
if (CollectionUtils.isEmpty(portMappingDOList) || portMappingDOList.size() > 1) {
|
||||
return null;
|
||||
}
|
||||
id = portMappingDOList.get(0).getId();
|
||||
serverPortToPortMappingIdCache.put(serverPort, id);
|
||||
return id;
|
||||
}
|
||||
|
||||
public Integer getLicenseIdById(Integer id) {
|
||||
Integer licenseId = idToLicenseIdCache.get(id);
|
||||
if (null == licenseId) {
|
||||
PortMappingDO portMappingDO = portMappingMapper.findById(id);
|
||||
if (null != portMappingDO) {
|
||||
licenseId = portMappingDO.getLicenseId();
|
||||
idToLicenseIdCache.put(id, licenseId);
|
||||
}
|
||||
}
|
||||
return licenseId;
|
||||
}
|
||||
|
||||
public FlowLimitBO getFlowLimitByServerPort(Integer serverPort) {
|
||||
Integer id = getPortMappingIdByServerPort(serverPort);
|
||||
if (null == id) {
|
||||
return null;
|
||||
}
|
||||
FlowLimitBO res = getFlowLimit(id);
|
||||
if (null == res || (null == res.getUpLimitRate() && null == res.getDownLimitRate())) {
|
||||
Integer licenseId = getLicenseIdById(id);
|
||||
if (null != licenseId) {
|
||||
res = licenseService.getFlowLimit(licenseId);
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
private void updateMappingPortToSecurityGroupMap(Integer serverPort, Integer securityGroupId) {
|
||||
if (securityGroupId == null || securityGroupId == 0) {
|
||||
mappingPortToSecurityGroupMap.remove(serverPort);
|
||||
return;
|
||||
}
|
||||
mappingPortToSecurityGroupMap.put(serverPort, securityGroupId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start() throws Throwable {
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ public class ProtocalService {
|
||||
public List<ProtocalListRes> list() {
|
||||
return Lists.newArrayList(
|
||||
new ProtocalListRes().setName("TCP").setEnable(Boolean.TRUE).setRemark("支持一切TCP之上的协议"),
|
||||
new ProtocalListRes().setName("HTTP(S)").setEnable(Boolean.TRUE).setRemark("支持绑定子域名,未绑定时等价于时使用TCP。 若配置了证书,则同时支持HTTPS。"),
|
||||
new ProtocalListRes().setName("HTTP(S)").setEnable(Boolean.TRUE).setRemark("支持绑定子域名,未绑定时等价于使用TCP。 若配置了证书,则同时支持HTTPS。"),
|
||||
new ProtocalListRes().setName("UDP").setEnable(Boolean.TRUE).setRemark("支持UDP转发、响应。需要配合响应数、超时时间使用")
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,24 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package org.dromara.neutrinoproxy.server.service;
|
||||
|
||||
import org.dromara.neutrinoproxy.server.constant.OnlineStatusEnum;
|
||||
|
||||
@@ -0,0 +1,267 @@
|
||||
package org.dromara.neutrinoproxy.server.service;
|
||||
|
||||
import cn.hutool.cache.Cache;
|
||||
import cn.hutool.cache.CacheUtil;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.solon.plugins.pagination.Page;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.ibatis.solon.annotation.Db;
|
||||
import org.dromara.neutrinoproxy.server.base.page.PageInfo;
|
||||
import org.dromara.neutrinoproxy.server.base.page.PageQuery;
|
||||
import org.dromara.neutrinoproxy.server.base.rest.SystemContextHolder;
|
||||
import org.dromara.neutrinoproxy.server.constant.EnableStatusEnum;
|
||||
import org.dromara.neutrinoproxy.server.constant.ExceptionConstant;
|
||||
import org.dromara.neutrinoproxy.server.constant.SecurityRulePassTypeEnum;
|
||||
import org.dromara.neutrinoproxy.server.controller.req.system.*;
|
||||
import org.dromara.neutrinoproxy.server.controller.res.system.*;
|
||||
import org.dromara.neutrinoproxy.server.dal.SecurityGroupMapper;
|
||||
import org.dromara.neutrinoproxy.server.dal.SecurityRuleMapper;
|
||||
import org.dromara.neutrinoproxy.server.dal.entity.SecurityGroupDO;
|
||||
import org.dromara.neutrinoproxy.server.dal.entity.SecurityRuleDO;
|
||||
import org.dromara.neutrinoproxy.server.util.ParamCheckUtil;
|
||||
import org.noear.solon.annotation.Component;
|
||||
import org.noear.solon.annotation.Init;
|
||||
import org.noear.solon.core.runtime.NativeDetector;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
public class SecurityGroupService {
|
||||
|
||||
@Db
|
||||
private SecurityGroupMapper securityGroupMapper;
|
||||
|
||||
@Db
|
||||
private SecurityRuleMapper securityRuleMapper;
|
||||
|
||||
private final Map<Integer, SecurityGroupDO> securityGroupMap = new ConcurrentHashMap<>();
|
||||
|
||||
// 允许通过控制的缓存,缓存类型最近最久未使用缓存,容量100,超时时间5分钟
|
||||
private final Cache<String, Boolean> ipAllowControlCache = CacheUtil.newLRUCache(100, 1000 * 60 * 5);
|
||||
|
||||
@Init(index = 100)
|
||||
public synchronized void init() {
|
||||
// aot 阶段,不初始化
|
||||
if (NativeDetector.isAotRuntime()) {
|
||||
return;
|
||||
}
|
||||
securityGroupMap.clear();
|
||||
List<SecurityGroupDO> groupDOList = securityGroupMapper.selectList(Wrappers.lambdaQuery(SecurityGroupDO.class)
|
||||
.eq(SecurityGroupDO::getEnable, EnableStatusEnum.ENABLE.getStatus()));
|
||||
groupDOList.forEach(securityGroupDO -> securityGroupMap.put(securityGroupDO.getId(), securityGroupDO));
|
||||
ipAllowControlCache.clear();
|
||||
}
|
||||
|
||||
public void clearCache() {
|
||||
ipAllowControlCache.clear();
|
||||
}
|
||||
|
||||
public PageInfo<SecurityGroupListRes> groupPage(PageQuery pageQuery, SecurityGroupListReq req) {
|
||||
if (StringUtils.isNotEmpty(req.getName())) {
|
||||
//在应用层处理,否则sqlite不支持
|
||||
req.setName("%" + req.getName() + "%");
|
||||
}
|
||||
if (StringUtils.isNotEmpty(req.getDescription())) {
|
||||
//在应用层处理,否则sqlite不支持
|
||||
req.setDescription("%" + req.getDescription() + "%");
|
||||
}
|
||||
Page<SecurityGroupDO> page = new Page<>(pageQuery.getCurrent(), pageQuery.getSize());
|
||||
List<SecurityGroupDO> list = securityGroupMapper.selectByCondition(page, req);
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return PageInfo.of(null, page.getTotal(), pageQuery.getCurrent(), pageQuery.getSize());
|
||||
}
|
||||
List<SecurityGroupListRes> respList = list.stream().map(SecurityGroupDO::toListRes).collect(Collectors.toList());
|
||||
return PageInfo.of(respList, page.getTotal(), pageQuery.getCurrent(), pageQuery.getSize());
|
||||
}
|
||||
|
||||
public List<SecurityGroupListRes> groupList() {
|
||||
List<SecurityGroupDO> list = securityGroupMapper.selectList(Wrappers.lambdaQuery(SecurityGroupDO.class)
|
||||
.eq(SecurityGroupDO::getUserId, SystemContextHolder.getUserId()));
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return list.stream().map(SecurityGroupDO::toListRes).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public SecurityGroupDetailRes groupDetail(SecurityGroupDetailReq req) {
|
||||
SecurityGroupDO securityGroupDO = securityGroupMapper.selectById(req.getId());
|
||||
if (null != securityGroupDO) {
|
||||
return securityGroupDO.toDetailRes();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void createGroup(SecurityGroupCreateReq req) {
|
||||
SecurityGroupDO groupDO = new SecurityGroupDO();
|
||||
BeanUtil.copyProperties(req, groupDO);
|
||||
groupDO.setEnable(EnableStatusEnum.ENABLE.getStatus())
|
||||
.setUserId(SystemContextHolder.getUserId())
|
||||
.setCreateTime(new Date())
|
||||
.setUpdateTime(new Date());
|
||||
securityGroupMapper.insert(groupDO);
|
||||
init();
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新时不允许更新默认放行类型
|
||||
* @param req 安全组更新参数
|
||||
*/
|
||||
public void updateGroup(SecurityGroupUpdateReq req) {
|
||||
SecurityGroupDO groupDO = securityGroupMapper.selectById(req.getId());
|
||||
BeanUtil.copyProperties(req, groupDO, "defaultPassType");
|
||||
securityGroupMapper.updateById(groupDO);
|
||||
init();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除安全组,并级联删除安全组下的规则,删除后,需缓存
|
||||
* @param groupId 安全组Id
|
||||
*/
|
||||
public void deleteGroup(Integer groupId) {
|
||||
securityGroupMapper.deleteById(groupId);
|
||||
securityRuleMapper.delete(Wrappers.lambdaQuery(SecurityRuleDO.class)
|
||||
.eq(SecurityRuleDO::getGroupId, groupId));
|
||||
init();
|
||||
}
|
||||
|
||||
public SecurityGroupUpdateEnableStatueRes updateGroupEnableStatueReq(SecurityGroupUpdateEnableStatueReq req) {
|
||||
SecurityGroupDO groupDO = securityGroupMapper.selectById(req.getId());
|
||||
ParamCheckUtil.checkNotNull(groupDO, ExceptionConstant.SECURITY_GROUP_NOT_EXIST);
|
||||
|
||||
securityGroupMapper.updateEnableStatus(req.getId(), req.getEnable(), new Date());
|
||||
init();
|
||||
return new SecurityGroupUpdateEnableStatueRes();
|
||||
}
|
||||
|
||||
public PageInfo<SecurityRuleListRes> rulePage(PageQuery pageQuery, SecurityRuleListReq req) {
|
||||
if (StringUtils.isNotEmpty(req.getName())) {
|
||||
//在应用层处理,否则sqlite不支持
|
||||
req.setName("%" + req.getName() + "%");
|
||||
}
|
||||
if (StringUtils.isNotEmpty(req.getDescription())) {
|
||||
//在应用层处理,否则sqlite不支持
|
||||
req.setDescription("%" + req.getDescription() + "%");
|
||||
}
|
||||
Page<SecurityRuleDO> page = new Page<>(pageQuery.getCurrent(), pageQuery.getSize());
|
||||
List<SecurityRuleDO> list = securityRuleMapper.selectByCondition(page, req);
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return PageInfo.of(null, page.getTotal(), pageQuery.getCurrent(), pageQuery.getSize());
|
||||
}
|
||||
List<SecurityRuleListRes> respList = list.stream().map(SecurityRuleDO::toListRes).collect(Collectors.toList());
|
||||
return PageInfo.of(respList, page.getTotal(), pageQuery.getCurrent(), pageQuery.getSize());
|
||||
}
|
||||
|
||||
public List<SecurityRuleListRes> ruleList(SecurityRuleListReq req) {
|
||||
List<SecurityRuleDO> list = securityRuleMapper.selectList(new LambdaQueryWrapper<SecurityRuleDO>()
|
||||
.eq(null != req.getGroupId(), SecurityRuleDO::getGroupId, req.getGroupId())
|
||||
);
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return list.stream().map(SecurityRuleDO::toListRes).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public void createRule(SecurityRuleCreateReq req) {
|
||||
SecurityRuleDO ruleDO = new SecurityRuleDO();
|
||||
BeanUtil.copyProperties(req, ruleDO);
|
||||
ruleDO.setUserId(SystemContextHolder.getUserId())
|
||||
.setCreateTime(new Date())
|
||||
.setEnable(EnableStatusEnum.ENABLE.getStatus())
|
||||
.setUpdateTime(new Date());
|
||||
securityRuleMapper.insert(ruleDO);
|
||||
clearCache();
|
||||
}
|
||||
|
||||
public void updateRule(SecurityRuleUpdateReq req) {
|
||||
SecurityRuleDO ruleDO = securityRuleMapper.selectById(req.getId());
|
||||
BeanUtil.copyProperties(req, ruleDO);
|
||||
securityRuleMapper.updateById(ruleDO);
|
||||
clearCache();
|
||||
}
|
||||
|
||||
public void deleteRule(Integer ruleId) {
|
||||
securityRuleMapper.deleteById(ruleId);
|
||||
clearCache();
|
||||
}
|
||||
|
||||
public SecurityRuleUpdateEnableStatueRes updateRuleEnableStatueReq(SecurityRuleUpdateEnableStatueReq req) {
|
||||
SecurityRuleDO ruleDO = securityRuleMapper.selectById(req.getId());
|
||||
ParamCheckUtil.checkNotNull(ruleDO, ExceptionConstant.SECURITY_RULE_NOT_EXIST);
|
||||
|
||||
securityRuleMapper.updateEnableStatus(req.getId(), req.getEnable(), new Date());
|
||||
clearCache();
|
||||
return new SecurityRuleUpdateEnableStatueRes();
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断ip在该安全组下是否允许,如果安全组没有创建,则放行,默认黑名单规则
|
||||
* @param ip 被判断的IP地址
|
||||
* @param groupId 安全组Id
|
||||
* @return 是否放行
|
||||
*/
|
||||
public boolean judgeAllow(String ip, Integer groupId) {
|
||||
ip = ip.toLowerCase();
|
||||
// 不能判断当前连接的IP,保守处理,拒绝放行
|
||||
if (StrUtil.isEmpty(ip)) {
|
||||
log.debug("[SecurityGroup] cannot get remote ip,this pack be reject");
|
||||
return false;
|
||||
}
|
||||
|
||||
// 黑名单规则,没有该安全组,则放行
|
||||
if (groupId == null) {
|
||||
return true;
|
||||
}
|
||||
SecurityGroupDO groupDO = securityGroupMap.get(groupId);
|
||||
if (groupDO == null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Boolean allow = null;
|
||||
String judgeAllowMapKey = ip + groupId;
|
||||
if (ipAllowControlCache.containsKey(judgeAllowMapKey)) {
|
||||
allow = ipAllowControlCache.get(judgeAllowMapKey);
|
||||
log.debug("[SecurityGroup] ip:{} groupId:{} cached security strategy:{}", ip, groupId, allow ? "allow" : "reject");
|
||||
return allow;
|
||||
}
|
||||
|
||||
List<SecurityRuleDO> ruleDOList = securityRuleMapper.selectList(Wrappers.lambdaQuery(SecurityRuleDO.class)
|
||||
.eq(SecurityRuleDO::getGroupId, groupId)
|
||||
.eq(SecurityRuleDO::getEnable, EnableStatusEnum.ENABLE.getStatus())
|
||||
.orderByAsc(SecurityRuleDO::getPriority)
|
||||
);
|
||||
for (SecurityRuleDO ruleDO : ruleDOList) {
|
||||
SecurityRulePassTypeEnum passType = ruleDO.judge(ip);
|
||||
if (passType == SecurityRulePassTypeEnum.ALLOW) {
|
||||
allow = true;
|
||||
log.debug("[SecurityGroup] ip:{} groupId:{} ruleId:{} security strategy:{}", ip, groupId, ruleDO.getId(), "allow");
|
||||
break;
|
||||
}
|
||||
if (passType == SecurityRulePassTypeEnum.DENY) {
|
||||
allow = false;
|
||||
log.info("[SecurityGroup] ip:{} groupId:{} ruleId:{} security strategy:{}", ip, groupId, ruleDO.getId(), "reject");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// 当前IP没有匹配到任何一条规则,则使用安全组默认规则
|
||||
if (allow == null) {
|
||||
allow = SecurityRulePassTypeEnum.ALLOW.getType().equals(groupDO.getDefaultPassType());
|
||||
log.debug("[SecurityGroup] ip:{} groupId{} use security group default strategy:{}", ip, groupId, allow ? "allow" : "reject");
|
||||
}
|
||||
|
||||
ipAllowControlCache.put(judgeAllowMapKey, allow);
|
||||
|
||||
return allow;
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package org.dromara.neutrinoproxy.server.service;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.solon.plugins.pagination.Page;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.ibatis.solon.annotation.Db;
|
||||
import org.dromara.neutrinoproxy.core.util.DateUtil;
|
||||
import org.dromara.neutrinoproxy.server.base.page.PageInfo;
|
||||
@@ -131,6 +132,7 @@ public class UserService {
|
||||
|
||||
public PageInfo<UserListRes> page(PageQuery pageQuery, UserListReq req) {
|
||||
Page<UserDO> page = userMapper.selectPage(new Page<>(pageQuery.getCurrent(), pageQuery.getSize()), new LambdaQueryWrapper<UserDO>()
|
||||
.like(StringUtils.isNotBlank(req.getName()), UserDO::getName, req.getName())
|
||||
.orderByAsc(UserDO::getId)
|
||||
);
|
||||
List<UserListRes> respList = page.getRecords().stream().map(UserDO::toRes).collect(Collectors.toList());
|
||||
|
||||
@@ -15,17 +15,11 @@ import org.dromara.neutrinoproxy.server.dal.entity.LicenseDO;
|
||||
import org.dromara.neutrinoproxy.server.dal.entity.PortMappingDO;
|
||||
import org.dromara.neutrinoproxy.server.dal.entity.PortPoolDO;
|
||||
import org.dromara.neutrinoproxy.server.dal.entity.UserDO;
|
||||
import org.dromara.neutrinoproxy.server.proxy.core.BytesMetricsHandler;
|
||||
import org.dromara.neutrinoproxy.server.proxy.core.TcpVisitorChannelHandler;
|
||||
import org.dromara.neutrinoproxy.server.proxy.domain.CmdChannelAttachInfo;
|
||||
import org.dromara.neutrinoproxy.server.proxy.domain.ProxyMapping;
|
||||
import org.dromara.neutrinoproxy.server.util.ProxyUtil;
|
||||
import io.netty.bootstrap.ServerBootstrap;
|
||||
import io.netty.channel.Channel;
|
||||
import io.netty.channel.ChannelInitializer;
|
||||
import io.netty.channel.nio.NioEventLoopGroup;
|
||||
import io.netty.channel.socket.SocketChannel;
|
||||
import io.netty.channel.socket.nio.NioServerSocketChannel;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.ibatis.solon.annotation.Db;
|
||||
import org.noear.solon.annotation.Component;
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package org.dromara.neutrinoproxy.server.service.bo;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* @author: aoshiguchen
|
||||
* @date: 2023/12/15
|
||||
*/
|
||||
@Accessors(chain = true)
|
||||
@Data
|
||||
public class FlowLimitBO {
|
||||
private Long upLimitRate;
|
||||
private Long downLimitRate;
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package org.dromara.neutrinoproxy.server.service.bo;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.dromara.neutrinoproxy.server.constant.HttpsStatusEnum;
|
||||
|
||||
/**
|
||||
* 完整域名
|
||||
* @author: mirac
|
||||
* @date: 2024/8/8
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class FullDomainNameBO {
|
||||
/**
|
||||
* 域名端口映射id
|
||||
*/
|
||||
private Integer id;
|
||||
/**
|
||||
* 端口映射id
|
||||
*/
|
||||
private Integer portMappingId;
|
||||
/**
|
||||
* 子域名
|
||||
*/
|
||||
private String subdomain;
|
||||
/**
|
||||
* 域名id
|
||||
*/
|
||||
private Integer domainNameId;
|
||||
/**
|
||||
* 域名
|
||||
*/
|
||||
private String domain;
|
||||
/**
|
||||
* 强制使用HTTPS(1、是 2、否)
|
||||
* {@link HttpsStatusEnum}
|
||||
*/
|
||||
private Integer forceHttps;
|
||||
}
|
||||
@@ -1,24 +1,3 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package org.dromara.neutrinoproxy.server.util;
|
||||
|
||||
import java.math.BigInteger;
|
||||
|
||||
@@ -103,4 +103,20 @@ public class ParamCheckUtil {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验字节描述
|
||||
* @param str
|
||||
* @param params
|
||||
*/
|
||||
public static void checkBytesDesc(String str, Object... params) {
|
||||
// 允许为空
|
||||
if (StrUtil.isEmpty(str)) {
|
||||
return;
|
||||
}
|
||||
Long bytes = StringUtil.parseBytes(str);
|
||||
if (null == bytes || bytes <= 0) {
|
||||
throw ServiceException.create(ExceptionConstant.BYTES_DESC_INVALID, params);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -6,19 +6,25 @@ import org.apache.commons.lang3.StringUtils;
|
||||
import org.dromara.neutrinoproxy.core.ChannelAttribute;
|
||||
import org.dromara.neutrinoproxy.core.Constants;
|
||||
import org.dromara.neutrinoproxy.server.constant.NetworkProtocolEnum;
|
||||
import org.dromara.neutrinoproxy.server.controller.res.stats.StatsInfoRes;
|
||||
import org.dromara.neutrinoproxy.server.proxy.domain.CmdChannelAttachInfo;
|
||||
import org.dromara.neutrinoproxy.server.proxy.domain.ProxyAttachment;
|
||||
import org.dromara.neutrinoproxy.server.proxy.domain.ProxyMapping;
|
||||
import org.dromara.neutrinoproxy.server.proxy.domain.VisitorChannelAttachInfo;
|
||||
import io.netty.channel.Channel;
|
||||
import io.netty.util.AttributeKey;
|
||||
import org.dromara.solonplugins.job.CustomThreadFactory;
|
||||
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.SocketAddress;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
import java.util.concurrent.locks.ReadWriteLock;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -27,16 +33,16 @@ import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||
*/
|
||||
public class ProxyUtil {
|
||||
public static final AttributeKey<ChannelAttribute> CHANNEL_ATTR_KEY = AttributeKey.valueOf("netty.channel.attr");
|
||||
// /**
|
||||
// * license -> 服务端口映射
|
||||
// */
|
||||
// private static final Map<Integer, Set<Integer>> licenseToServerPortMap = new HashMap<>();
|
||||
/**
|
||||
* license -> 服务端口映射
|
||||
*/
|
||||
private static final Map<Integer, Set<Integer>> licenseToServerPortMap = new HashMap<>();
|
||||
/**
|
||||
* 代理信息映射
|
||||
* 代理信息映射 e.g.: 9104 -> 127.0.0.1:8848
|
||||
*/
|
||||
private static final Map<Integer, String> proxyInfoMap = new ConcurrentHashMap<>();
|
||||
/**
|
||||
* 服务端口 -> 指令通道映射
|
||||
* 服务端口 -> 指令通道映射proxyInfoMap
|
||||
*/
|
||||
private static Map<Integer, Channel> serverPortToCmdChannelMap = new ConcurrentHashMap<>();
|
||||
/**
|
||||
@@ -58,16 +64,74 @@ public class ProxyUtil {
|
||||
private static AtomicLong visitorIdProducer = new AtomicLong(0);
|
||||
/**
|
||||
* 代理 - connect附加映射
|
||||
* (TCP/HTTP场景下,已优化不是用这个。UDP由于无连接,暂时还是要用这个)
|
||||
* UDP场景时,需要记录最后读写时间,使用定时器定期检查,超时需要释放,待后续优化
|
||||
*/
|
||||
private static Map<String, ProxyAttachment> proxyConnectAttachmentMap = new HashMap<>();
|
||||
private static Map<String, Constants.ProxyAttachment> proxyConnectAttachmentMap = new HashMap<>();
|
||||
/**
|
||||
* 子域名 - 服务端端口映射
|
||||
* 完整域名 - 服务端端口映射
|
||||
*/
|
||||
private static Map<String, Integer> subdomainToServerPort = new HashMap<>();
|
||||
private static Map<String, Integer> fullDomainToServerPortMap = new ConcurrentHashMap<>();
|
||||
/**
|
||||
* 主域名 - 域名id映射
|
||||
*/
|
||||
private static Map<String, Integer> domainToDomainNameIdMap = new ConcurrentHashMap<>();
|
||||
/**
|
||||
* licenseId - 客户端Id映射
|
||||
*/
|
||||
private static Map<Integer, String> licenseIdToClientIdMap = new HashMap<>();
|
||||
/**
|
||||
* visitorId - SocketAddress映射
|
||||
*/
|
||||
private static Map<String, SocketAddress> visitorIdToSocketAddressMap = new HashMap<>();
|
||||
/**
|
||||
* SocketAddress - visitorId 映射
|
||||
*/
|
||||
private static Map<SocketAddress, String> socketAddressToVisitorIdMap = new HashMap<>();
|
||||
/**
|
||||
* visitorId - tunnelChannel 映射
|
||||
*/
|
||||
private static Map<String, Channel> visitorIdToTunnelChannelMap = new HashMap<>();
|
||||
|
||||
/**
|
||||
* cache扫描器
|
||||
*/
|
||||
private static final ScheduledExecutorService cacheScanner = Executors.newSingleThreadScheduledExecutor(new CustomThreadFactory("cacheScanner"));
|
||||
|
||||
|
||||
/**
|
||||
* 初始化,启动一个定时器,定时清理缓存
|
||||
*/
|
||||
public static void init() {
|
||||
cacheScanner.scheduleWithFixedDelay(ProxyUtil::cacheScan, 5, 5, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
public static synchronized void cacheScan() {
|
||||
for (Integer key : serverPortToCmdChannelMap.keySet()) {
|
||||
Channel channel = serverPortToCmdChannelMap.get(key);
|
||||
if (null == channel || !channel.isRegistered()) {
|
||||
serverPortToCmdChannelMap.remove(key);
|
||||
}
|
||||
}
|
||||
for (Integer key : licenseToCmdChannelMap.keySet()) {
|
||||
Channel channel = licenseToCmdChannelMap.get(key);
|
||||
if (null == channel || !channel.isRegistered()) {
|
||||
licenseToCmdChannelMap.remove(key);
|
||||
}
|
||||
}
|
||||
for (Integer key : serverPortToVisitorChannel.keySet()) {
|
||||
Channel channel = serverPortToVisitorChannel.get(key);
|
||||
if (null == channel || !channel.isRegistered()) {
|
||||
serverPortToVisitorChannel.remove(key);
|
||||
}
|
||||
}
|
||||
for (String key : visitorIdToTunnelChannelMap.keySet()) {
|
||||
Channel channel = visitorIdToTunnelChannelMap.get(key);
|
||||
if (null == channel || !channel.isRegistered()) {
|
||||
visitorIdToTunnelChannelMap.remove(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化代理信息
|
||||
@@ -75,14 +139,14 @@ public class ProxyUtil {
|
||||
* @param proxyMappingList 代理映射集合
|
||||
*/
|
||||
public static void initProxyInfo(Integer licenseId, List<ProxyMapping> proxyMappingList) {
|
||||
licenseToServerPortMap.put(licenseId, new HashSet<>());
|
||||
// licenseToServerPortMap.put(licenseId, new HashSet<>());
|
||||
addProxyInfo(licenseId, proxyMappingList);
|
||||
}
|
||||
|
||||
public static void addProxyInfo(Integer licenseId, List<ProxyMapping> proxyMappingList) {
|
||||
if (!CollectionUtil.isEmpty(proxyMappingList)) {
|
||||
for (ProxyMapping proxyMapping : proxyMappingList) {
|
||||
licenseToServerPortMap.get(licenseId).add(proxyMapping.getServerPort());
|
||||
// licenseToServerPortMap.get(licenseId).add(proxyMapping.getServerPort());
|
||||
proxyInfoMap.put(proxyMapping.getServerPort(), proxyMapping.getLanInfo());
|
||||
}
|
||||
}
|
||||
@@ -92,7 +156,7 @@ public class ProxyUtil {
|
||||
if (null == licenseId || null == proxyMapping) {
|
||||
return;
|
||||
}
|
||||
licenseToServerPortMap.get(licenseId).add(proxyMapping.getServerPort());
|
||||
// licenseToServerPortMap.get(licenseId).add(proxyMapping.getServerPort());
|
||||
proxyInfoMap.put(proxyMapping.getServerPort(), proxyMapping.getLanInfo());
|
||||
}
|
||||
|
||||
@@ -100,14 +164,14 @@ public class ProxyUtil {
|
||||
proxyInfoMap.remove(serverPort);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据licenseId获取服务端端口集合
|
||||
* @param licenseId licenseId
|
||||
* @return 服务端端口集合
|
||||
*/
|
||||
public static Set<Integer> getServerPortsByLicenseKey(Integer licenseId) {
|
||||
return licenseToServerPortMap.get(licenseId);
|
||||
}
|
||||
// /**
|
||||
// * 根据licenseId获取服务端端口集合
|
||||
// * @param licenseId licenseId
|
||||
// * @return 服务端端口集合
|
||||
// */
|
||||
// public static Set<Integer> getServerPortsByLicenseKey(Integer licenseId) {
|
||||
// return licenseToServerPortMap.get(licenseId);
|
||||
// }
|
||||
|
||||
/**
|
||||
* 根据服务端端口获取客户端代理信息
|
||||
@@ -317,7 +381,7 @@ public class ProxyUtil {
|
||||
* @param visitorId
|
||||
* @param proxyAttachment
|
||||
*/
|
||||
public static void addProxyConnectAttachment(String visitorId, ProxyAttachment proxyAttachment) {
|
||||
public static void addProxyConnectAttachment(String visitorId, Constants.ProxyAttachment proxyAttachment) {
|
||||
proxyConnectAttachmentMap.put(visitorId, proxyAttachment);
|
||||
}
|
||||
|
||||
@@ -326,7 +390,7 @@ public class ProxyUtil {
|
||||
* @param visitorId
|
||||
* @return
|
||||
*/
|
||||
public static ProxyAttachment getProxyConnectAttachment(String visitorId) {
|
||||
public static Constants.ProxyAttachment getProxyConnectAttachment(String visitorId) {
|
||||
return proxyConnectAttachmentMap.get(visitorId);
|
||||
}
|
||||
|
||||
@@ -339,32 +403,86 @@ public class ProxyUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置子域名到服务端端口的映射
|
||||
* @param subdomain
|
||||
* 设置完整域名到服务端端口的映射
|
||||
* @param fullDomain
|
||||
* @param serverPort
|
||||
*/
|
||||
public static void setSubdomainToServerPort(String subdomain, Integer serverPort) {
|
||||
subdomainToServerPort.put(subdomain, serverPort);
|
||||
public static void setFullDomainToServerPort(String fullDomain, Integer serverPort) {
|
||||
fullDomainToServerPortMap.put(fullDomain, serverPort);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除子域名到服务端端口的映射
|
||||
* @param subdomain
|
||||
* 删除完整域名到服务端端口的映射
|
||||
* @param fullDomain
|
||||
*/
|
||||
public static void removeSubdomainToServerPort(String subdomain) {
|
||||
subdomainToServerPort.remove(subdomain);
|
||||
public static void removeFullDomainToServerPort(String fullDomain) {
|
||||
fullDomainToServerPortMap.remove(fullDomain);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过服务器端口删除完整域名到服务端端口的映射
|
||||
* @param serverPort
|
||||
*/
|
||||
public static void removeFullDomainToServerPortByServerPort(Integer serverPort) {
|
||||
fullDomainToServerPortMap.entrySet().removeIf(entry -> Objects.equals(entry.getValue(), serverPort));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据子域名获取外网端口
|
||||
* @param subdomain
|
||||
* 根据完整域名获取外网端口
|
||||
* @param fullDomain
|
||||
* @return
|
||||
*/
|
||||
public static Integer getServerPortBySubdomain(String subdomain) {
|
||||
return subdomainToServerPort.get(subdomain);
|
||||
public static Integer getServerPortByFullDomain(String fullDomain) {
|
||||
return fullDomainToServerPortMap.get(fullDomain);
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* 添加域名到域名id的映射
|
||||
*/
|
||||
public static void setDomainToDomainNameId(String domain, Integer domainNameId) {
|
||||
domainToDomainNameIdMap.put(domain, domainNameId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除域名到域名id的映射
|
||||
*/
|
||||
public static void removeDomainToDomainNameId(String domain) {
|
||||
domainToDomainNameIdMap.remove(domain);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过主域名获取域名id
|
||||
*/
|
||||
public static Integer getDomainNameIdByDomain(String domain) {
|
||||
return domainToDomainNameIdMap.get(domain);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过完整域名获取域名id
|
||||
*/
|
||||
public static Integer getDomainNameIdByFullDomain(String fullDomain) {
|
||||
List<String> domains = domainToDomainNameIdMap.keySet().stream().sorted((a,b) -> b.length() - a.length()).filter(item -> fullDomain.endsWith(item)).collect(Collectors.toList());
|
||||
// 不存在,返回null
|
||||
if (CollectionUtil.isEmpty(domains)) {
|
||||
return null;
|
||||
}
|
||||
// 优先匹配最长的域名,默认取第一个,后续思考如何优化
|
||||
return getDomainNameIdByDomain(domains.get(0));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过完整域名获取域名
|
||||
*/
|
||||
public static String getDomainNameByFullDomain(String fullDomain) {
|
||||
List<String> domains = domainToDomainNameIdMap.keySet().stream().sorted((a,b) -> b.length() - a.length()).filter(item -> fullDomain.endsWith(item)).collect(Collectors.toList());
|
||||
// 不存在 或者 有多条记录,返回null
|
||||
if (CollectionUtil.isEmpty(domains)) {
|
||||
return null;
|
||||
}
|
||||
return domains.getFirst();
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭http响应channel
|
||||
* @param channel
|
||||
* @return
|
||||
@@ -378,7 +496,7 @@ public class ProxyUtil {
|
||||
if (StringUtils.isBlank(visitorId)) {
|
||||
return;
|
||||
}
|
||||
ProxyAttachment proxyAttachment = ProxyUtil.getProxyConnectAttachment(visitorId);
|
||||
Constants.ProxyAttachment proxyAttachment = ProxyUtil.getProxyConnectAttachment(visitorId);
|
||||
if (null != proxyAttachment) {
|
||||
tryClose(channel);
|
||||
}
|
||||
@@ -421,4 +539,50 @@ public class ProxyUtil {
|
||||
public static void removeClientIdByLicenseId(Integer licenseId) {
|
||||
licenseIdToClientIdMap.remove(licenseId);
|
||||
}
|
||||
|
||||
public static void setVisitorIdToSocketAddressMap(String visitorId, SocketAddress socketAddress) {
|
||||
visitorIdToSocketAddressMap.put(visitorId, socketAddress);
|
||||
socketAddressToVisitorIdMap.put(socketAddress, visitorId);
|
||||
}
|
||||
|
||||
public static SocketAddress getSocketAddressByVisitorId(String visitorId) {
|
||||
return visitorIdToSocketAddressMap.get(visitorId);
|
||||
}
|
||||
|
||||
public static void removeSocketAddressByVisitorId(String visitorId) {
|
||||
SocketAddress socketAddress = visitorIdToSocketAddressMap.get(visitorId);
|
||||
visitorIdToSocketAddressMap.remove(visitorId);
|
||||
socketAddressToVisitorIdMap.remove(socketAddress);
|
||||
|
||||
visitorIdToTunnelChannelMap.remove(visitorId);
|
||||
}
|
||||
|
||||
public static String getVisitorIdBySocketAddress(SocketAddress socketAddress) {
|
||||
return socketAddressToVisitorIdMap.get(socketAddress);
|
||||
}
|
||||
|
||||
public static void setVisitorIdToTunnelChannelMap(String visitorId, Channel tunnelChannel) {
|
||||
visitorIdToTunnelChannelMap.put(visitorId, tunnelChannel);
|
||||
}
|
||||
|
||||
public static Channel getTunnelChannelByVisitorId(String visitorId) {
|
||||
return visitorIdToTunnelChannelMap.get(visitorId);
|
||||
}
|
||||
|
||||
public static StatsInfoRes.CacheInfo getCacheInfo() {
|
||||
return new StatsInfoRes.CacheInfo()
|
||||
.setProxyInfoMapSize(proxyInfoMap.size())
|
||||
.setServerPortToCmdChannelMapSize(serverPortToCmdChannelMap.size())
|
||||
.setLicenseToCmdChannelMapSize(licenseToCmdChannelMap.size())
|
||||
.setServerPortToVisitorChannelMapSize(serverPortToVisitorChannel.size())
|
||||
.setProxyConnectAttachmentMapSize(proxyConnectAttachmentMap.size())
|
||||
.setFullDomainToServerPortMapSize(fullDomainToServerPortMap.size())
|
||||
.setDomainToDomainNameIdMapSize(domainToDomainNameIdMap.size())
|
||||
.setLicenseIdToClientIdMapSize(licenseIdToClientIdMap.size())
|
||||
.setVisitorIdToSocketAddressMapSize(visitorIdToSocketAddressMap.size())
|
||||
.setSocketAddressToVisitorIdMapSize(socketAddressToVisitorIdMap.size())
|
||||
.setVisitorIdToTunnelChannelMapSize(visitorIdToTunnelChannelMap.size())
|
||||
;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
package org.dromara.neutrinoproxy.server.util;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* @author: aoshiguchen
|
||||
* @date: 2023/12/15
|
||||
*/
|
||||
public class StringUtil {
|
||||
private static final Integer BYTES_MUL_KB = 1024;
|
||||
private static final Integer BYTES_MUL_MB = BYTES_MUL_KB * 1024;
|
||||
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+\\.*\\d*)\\s*(B|K|KB|M|MB|G|GB)\\s*";
|
||||
private static final Pattern BYTES_DESC_PATTERN = Pattern.compile(BYTES_DESC_REGEX);
|
||||
|
||||
/**
|
||||
* 校验是否符合字节描述
|
||||
* @param desc
|
||||
* @return
|
||||
*/
|
||||
public static boolean isBytesDesc(String desc) {
|
||||
if (StrUtil.isBlank(desc)) {
|
||||
return false;
|
||||
}
|
||||
return desc.toUpperCase().matches(BYTES_DESC_REGEX);
|
||||
}
|
||||
|
||||
/**
|
||||
* 解析字节数
|
||||
* 支持B、K、KB、M、MB、G、GB 忽略大小写、忽略首尾空格、忽略数字与单位之间的空格
|
||||
* @param desc
|
||||
* @return
|
||||
*/
|
||||
public static Long parseBytes(String desc) {
|
||||
try {
|
||||
if (!isBytesDesc(desc)) {
|
||||
return null;
|
||||
}
|
||||
Matcher matcher = BYTES_DESC_PATTERN.matcher(desc.toUpperCase());
|
||||
boolean found = matcher.find();
|
||||
if (!found) {
|
||||
return null;
|
||||
}
|
||||
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]);
|
||||
} catch (Exception e) {
|
||||
// ignore
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private static Integer getBytesUnitIndex(String unit) {
|
||||
if (StrUtil.isBlank(unit)) {
|
||||
return null;
|
||||
}
|
||||
for (int i = 0; i < BYTES_UNIT_STR.length; i++) {
|
||||
if (unit.equals(BYTES_UNIT_STR[i])) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
server:
|
||||
# 服务端web端口,用于支持HTTP接口,管理后台页面访问
|
||||
port: ${WEB_PORT:8888}
|
||||
# 日志级别
|
||||
solon.logging:
|
||||
logger:
|
||||
"root":
|
||||
level: info
|
||||
appender:
|
||||
file:
|
||||
level: info
|
||||
|
||||
neutrino:
|
||||
proxy:
|
||||
protocol:
|
||||
# 高低水位线,如:32KB/64KB、32KB/1MB、1MB/5MB
|
||||
# water-mark: 1MB/8MB
|
||||
# 隧道相关配置-用于维持服务端与客户端的通信
|
||||
tunnel:
|
||||
# 线程池相关配置,用于技术调优,可忽略
|
||||
boss-thread-count: 2
|
||||
work-thread-count: 10
|
||||
# 隧道非SSL端口
|
||||
port: ${OPEN_PORT:9000}
|
||||
# 隧道SSL端口
|
||||
ssl-port: ${SSL_PORT:9002}
|
||||
# 隧道SSL证书配置
|
||||
key-store-password: 123456
|
||||
key-manager-password: 123456
|
||||
jks-path: classpath:/test.jks
|
||||
# 是否开启隧道传输报文日志(日志级别为debug时开启才有效)
|
||||
transfer-log-enable: false
|
||||
# 是否开启心跳日志
|
||||
heartbeat-log-enable: false
|
||||
server:
|
||||
tcp:
|
||||
# 线程池相关配置,用于技术调优,可忽略
|
||||
boss-thread-count: 5
|
||||
work-thread-count: 20
|
||||
# http代理端口,默认80(不配置不支持)
|
||||
http-proxy-port: ${HTTP_PROXY_PORT:80}
|
||||
# https代理端口,默认443 (不配置不支持,同时需要配置域名、证书)
|
||||
https-proxy-port: ${HTTPS_PROXY_PORT:443}
|
||||
# 是否开启代理服务报文日志(日志级别为debug时开启才有效)
|
||||
transfer-log-enable: false
|
||||
udp:
|
||||
# 线程池相关配置,用于技术调优,可忽略
|
||||
boss-thread-count: 5
|
||||
work-thread-count: 20
|
||||
# 是否开启代理服务报文日志(日志级别为debug时开启才有效)
|
||||
transfer-log-enable: false
|
||||
data:
|
||||
db:
|
||||
# 数据库类型,目前支持h2、mysql、mariadb
|
||||
type: ${DB_TYPE:h2}
|
||||
# 数据库连接URL
|
||||
url: ${DB_URL:jdbc:h2:file:./data/db;MODE=MySQL;AUTO_SERVER=TRUE}
|
||||
# 数据库用户名
|
||||
username: ${DB_USER:}
|
||||
# 数据库密码
|
||||
password: ${DB_PASSWORD:}
|
||||
@@ -5,23 +5,22 @@ server:
|
||||
solon:
|
||||
app:
|
||||
name: neutrino-proxy-server
|
||||
# aot:
|
||||
# jvmArguments: --add-opens java.base/java.lang=ALL-UNNAMED
|
||||
version: 2.0.4
|
||||
config:
|
||||
add: ./app.yml
|
||||
# 日志级别
|
||||
solon.logging.appender:
|
||||
console:
|
||||
pattern: "%d{yyyy-MM-dd HH:mm:ss.SSS} %highlight(%-5level) %magenta(${PID:-}) --- %-15([%15.15thread]) %-56(%cyan(%-40.40logger{39}%L)) : %msg%n"
|
||||
file:
|
||||
enable: false
|
||||
enable: true
|
||||
pattern: "%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level ${PID:-} --- %-15([%15.15thread]) %-56(%-40.40logger{39}%L) : %msg%n"
|
||||
name: "logs/${solon.app.name}"
|
||||
rolling: "logs/${solon.app.name}_%d{yyyy-MM-dd}_%i.log"
|
||||
solon.logging.logger:
|
||||
"root":
|
||||
# level: ${LOG_LEVEL:info}
|
||||
level: info
|
||||
|
||||
|
||||
neutrino:
|
||||
proxy:
|
||||
protocol:
|
||||
@@ -33,6 +32,8 @@ neutrino:
|
||||
read-idle-time: 120
|
||||
write-idle-time: 20
|
||||
all-idle-time-seconds: 0
|
||||
# 高低水位线,如:32KB/64KB、32KB/1MB、1MB/5MB
|
||||
# water-mark: 1MB/8MB
|
||||
# 隧道相关配置-用于维持服务端与客户端的通信
|
||||
tunnel:
|
||||
# 线程池相关配置,用于技术调优,可忽略
|
||||
@@ -55,15 +56,10 @@ neutrino:
|
||||
# 线程池相关配置,用于技术调优,可忽略
|
||||
boss-thread-count: 5
|
||||
work-thread-count: 20
|
||||
# http代理端口,默认80
|
||||
# http代理端口,默认80(不配置不支持)
|
||||
http-proxy-port: ${HTTP_PROXY_PORT:80}
|
||||
# https代理端口,默认443 (需要配置域名、证书)
|
||||
# https代理端口,默认443 (不配置不支持,同时需要配置域名、证书)
|
||||
https-proxy-port: ${HTTPS_PROXY_PORT:443}
|
||||
# 如果不配置,则不支持域名映射
|
||||
domain-name: ${DOMAIN_NAME:}
|
||||
# https证书配置
|
||||
key-store-password: ${HTTPS_STORE_PASS:}
|
||||
jks-path: ${HTTPS_JKS_PATH:}
|
||||
# 是否开启代理服务报文日志(日志级别为debug时开启才有效)
|
||||
transfer-log-enable: ${SERVER_LOG:false}
|
||||
udp:
|
||||
@@ -77,7 +73,7 @@ neutrino:
|
||||
# 数据库类型,目前支持h2、mysql、mariadb
|
||||
type: ${DB_TYPE:h2}
|
||||
# 数据库连接URL
|
||||
url: ${DB_URL:jdbc:h2:file:~/.neutrino-proxy/data/db;MODE=MySQL;AUTO_SERVER=TRUE}
|
||||
url: ${DB_URL:jdbc:h2:file:./data/db;MODE=MySQL;AUTO_SERVER=TRUE}
|
||||
# 数据库用户名
|
||||
username: ${DB_USER:}
|
||||
# 数据库密码
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.dromara.neutrinoproxy.server.dal.DomainMapper">
|
||||
|
||||
<select id="selectFullDomainNameListByPortMappingIds" resultType="org.dromara.neutrinoproxy.server.service.bo.FullDomainNameBO">
|
||||
SELECT dpm.id as id, pm.id AS portMappingId, dpm.subdomain as subdomain, dn.domain AS domain, dn.id as domainNameId, dn.force_https as forceHttps
|
||||
FROM domain_port_mapping dpm
|
||||
LEFT JOIN port_mapping pm ON pm.id = dpm.port_mapping_id
|
||||
LEFT JOIN domain_name dn ON dn.id = dpm.domain_name_id
|
||||
WHERE pm.id IN
|
||||
<foreach item="item" index="index" collection="ids" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</select>
|
||||
<select id="selectFullDomainNameList"
|
||||
resultType="org.dromara.neutrinoproxy.server.service.bo.FullDomainNameBO">
|
||||
SELECT dpm.id as id, pm.id AS portMappingId, dpm.subdomain as subdomain, dn.domain AS domain, dn.id as domainNameId, dn.force_https as forceHttps
|
||||
FROM domain_port_mapping dpm
|
||||
LEFT JOIN port_mapping pm ON pm.id = dpm.port_mapping_id
|
||||
LEFT JOIN domain_name dn ON dn.id = dpm.domain_name_id
|
||||
</select>
|
||||
<select id="selectFullDomainNameListByDomainNameIds"
|
||||
resultType="org.dromara.neutrinoproxy.server.service.bo.FullDomainNameBO">
|
||||
SELECT dpm.id as id, pm.id AS portMappingId, dpm.subdomain as subdomain, dn.domain AS domain, dn.id as domainNameId, dn.force_https as forceHttps
|
||||
FROM domain_port_mapping dpm
|
||||
LEFT JOIN port_mapping pm ON pm.id = dpm.port_mapping_id
|
||||
LEFT JOIN domain_name dn ON dn.id = dpm.domain_name_id
|
||||
WHERE dn.id IN
|
||||
<foreach item="item" index="index" collection="ids" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -48,7 +48,7 @@
|
||||
LEFT JOIN `user` u ON l.user_id = u.id
|
||||
LEFT JOIN (SELECT license_id,sum(write_bytes) write_bytes,sum(read_bytes) read_bytes from flow_report_month GROUP BY license_id) frm ON l.id = frm.license_id
|
||||
LEFT JOIN (SELECT license_id,sum(write_bytes) write_bytes,sum(read_bytes) read_bytes from flow_report_day
|
||||
WHERE date >= #{curMonthBeginDate} AND #{curDayBeginDate}
|
||||
WHERE date >= #{curMonthBeginDate} AND date <= #{curDayBeginDate}
|
||||
GROUP BY license_id) frd ON l.id = frd.license_id
|
||||
LEFT JOIN (SELECT license_id,sum(write_bytes) write_bytes,sum(read_bytes) read_bytes from flow_report_minute
|
||||
WHERE date >= #{curDayBeginDate} AND date <= #{curDate}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.dromara.neutrinoproxy.server.dal.SecurityGroupMapper">
|
||||
|
||||
<select id="selectByCondition" resultType="org.dromara.neutrinoproxy.server.dal.entity.SecurityGroupDO">
|
||||
SELECT sg.* from security_group sg
|
||||
<where>
|
||||
<if test="req.name != null and req.name != '' ">
|
||||
AND sg.name like #{req.name}
|
||||
</if>
|
||||
<if test="req.description != null and req.description != '' ">
|
||||
AND sg.description like #{req.description}
|
||||
</if>
|
||||
<if test="req.defaultPassType != null">
|
||||
AND sg.default_pass_type like #{req.defaultPassType}
|
||||
</if>
|
||||
<if test="req.enable != null">
|
||||
AND sg.enable like #{req.enable}
|
||||
</if>
|
||||
</where>
|
||||
order by sg.id DESC
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.dromara.neutrinoproxy.server.dal.SecurityRuleMapper">
|
||||
|
||||
<select id="selectByCondition" resultType="org.dromara.neutrinoproxy.server.dal.entity.SecurityRuleDO">
|
||||
SELECT sr.* from security_rule sr
|
||||
<where>
|
||||
<if test="req.groupId != null">
|
||||
AND sr.group_id = ${req.groupId}
|
||||
</if>
|
||||
<if test="req.name != null and req.name != '' ">
|
||||
AND sr.name like #{req.name}
|
||||
</if>
|
||||
<if test="req.description != null and req.description != '' ">
|
||||
AND sr.description like #{req.description}
|
||||
</if>
|
||||
<if test="req.passType != null">
|
||||
AND sr.pass_type like #{req.passType}
|
||||
</if>
|
||||
<if test="req.enable != null">
|
||||
AND sr.enable like #{req.enable}
|
||||
</if>
|
||||
</where>
|
||||
order by sr.id DESC
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -45,6 +45,37 @@ CREATE TABLE IF NOT EXISTS `port_group` (
|
||||
`create_time` TIMESTAMP NOT NULL,
|
||||
`update_time` TIMESTAMP NOT NULL
|
||||
);
|
||||
|
||||
#安全组
|
||||
CREATE TABLE IF NOT EXISTS `security_group` (
|
||||
`id` INTEGER NOT NULL AUTO_INCREMENT,
|
||||
`name` VARCHAR(20) NOT NULL,
|
||||
`description` VARCHAR(255),
|
||||
`user_id` INTEGER NOT NULL,
|
||||
`enable` INTEGER NOT NULL,
|
||||
`default_pass_type` INTEGER NOT NULL,
|
||||
`create_time` TIMESTAMP NOT NULL,
|
||||
`update_time` TIMESTAMP NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
);
|
||||
|
||||
#安全组规则
|
||||
CREATE TABLE IF NOT EXISTS `security_rule` (
|
||||
`id` INTEGER NOT NULL AUTO_INCREMENT,
|
||||
`group_id` INTEGER NOT NULL,
|
||||
`name` VARCHAR(20) NOT NULL,
|
||||
`description` VARCHAR(255) NOT NULL,
|
||||
`rule` text NOT NULL,
|
||||
`pass_type` INTEGER NOT NULL,
|
||||
`priority` INTEGER NOT NULL,
|
||||
`user_id` INTEGER NOT NULL,
|
||||
`enable` INTEGER NOT NULL,
|
||||
`create_time` TIMESTAMP NOT NULL,
|
||||
`update_time` TIMESTAMP NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS I_security_rule_group_id ON security_rule(group_id);
|
||||
|
||||
#############################代理配置相关表#############################
|
||||
#license表
|
||||
CREATE TABLE IF NOT EXISTS `license` (
|
||||
@@ -52,6 +83,8 @@ CREATE TABLE IF NOT EXISTS `license` (
|
||||
`name` VARCHAR(50) NOT NULL,
|
||||
`key` VARCHAR(100) NOT NULL,
|
||||
`user_id` INTEGER NOT NULL,
|
||||
`up_limit_rate` VARCHAR(20) DEFAULT NULL,
|
||||
`down_limit_rate` VARCHAR(20) DEFAULT NULL,
|
||||
`is_online` INTEGER(2) NOT NULL,
|
||||
`enable` INTEGER(2) NOT NULL,
|
||||
`create_time` TIMESTAMP NOT NULL,
|
||||
@@ -64,20 +97,48 @@ CREATE TABLE IF NOT EXISTS `port_mapping` (
|
||||
`id` INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
||||
`license_id` INTEGER(20) NOT NULL,
|
||||
`protocal` VARCHAR(10) NOT NULL DEFAULT 'TCP',
|
||||
`subdomain` VARCHAR(50) DEFAULT NULL,
|
||||
`server_port` INTEGER NOT NULL,
|
||||
`client_ip` VARCHAR(20) NOT NULL,
|
||||
`client_ip` VARCHAR(255) NOT NULL,
|
||||
`client_port` INTEGER NOT NULL,
|
||||
`up_limit_rate` VARCHAR(20) DEFAULT NULL,
|
||||
`down_limit_rate` VARCHAR(20) DEFAULT NULL,
|
||||
`is_online` INTEGER(2) NOT NULL,
|
||||
`description` VARCHAR(100) DEFAULT NULL,
|
||||
`proxy_responses` INTEGER(20) NOT NULL DEFAULT 0,
|
||||
`proxy_timeout_ms` INTEGER(20) NOT NULL DEFAULT 0,
|
||||
`enable` INTEGER(2) NOT NULL,
|
||||
`security_group_id` INTEGER(20) NOT NULL DEFAULT 0,
|
||||
`create_time` TIMESTAMP NOT NULL,
|
||||
`update_time` TIMESTAMP NOT NULL
|
||||
);
|
||||
CREATE UNIQUE INDEX IF NOT EXISTS I_port_mapping_server_port ON port_mapping (server_port ASC);
|
||||
|
||||
#域名表
|
||||
CREATE TABLE IF NOT EXISTS `domain_name` (
|
||||
`id` INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
||||
`domain` VARCHAR(50) NOT NULL,
|
||||
`user_id` INTEGER NOT NULL,
|
||||
`jks` BLOB DEFAULT NULL,
|
||||
`key_store_password` varchar(255) DEFAULT NULL,
|
||||
`is_default` INTEGER(2) NOT NULL,
|
||||
`force_https` INTEGER(2) NOT NULL,
|
||||
`enable` INTEGER(2) NOT NULL,
|
||||
`create_time` TIMESTAMP NOT NULL,
|
||||
`update_time` TIMESTAMP NOT NULL
|
||||
);
|
||||
CREATE UNIQUE INDEX IF NOT EXISTS I_domain_name_domain ON domain_name (`domain` ASC);
|
||||
|
||||
#域名映射中间表
|
||||
CREATE TABLE IF NOT EXISTS `domain_port_mapping` (
|
||||
`id` INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
||||
`subdomain` VARCHAR(50) NOT NULL,
|
||||
`domain_name_id` INTEGER NOT NULL,
|
||||
`port_mapping_id` INTEGER NOT NULL
|
||||
);
|
||||
CREATE UNIQUE INDEX IF NOT EXISTS I_unique_domain_port_mapping ON domain_port_mapping (`domain_name_id` ASC, `subdomain` ASC);
|
||||
CREATE INDEX IF NOT EXISTS I_domain_port_mapping_domain_name_id ON domain_port_mapping (`domain_name_id` ASC);
|
||||
CREATE INDEX IF NOT EXISTS I_domain_port_mapping_port_mapping_id ON domain_port_mapping (`port_mapping_id` ASC);
|
||||
|
||||
#############################日志管理相关表#############################
|
||||
#用户登录记录表
|
||||
CREATE TABLE IF NOT EXISTS `user_login_record` (
|
||||
@@ -135,8 +196,8 @@ CREATE TABLE IF NOT EXISTS `flow_report_minute` (
|
||||
`id` INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
||||
`user_id` INTEGER(20) NOT NULL,
|
||||
`license_id` INTEGER(20) NOT NULL,
|
||||
`write_bytes` INTEGER(20) NOT NULL,
|
||||
`read_bytes` INTEGER(20) NOT NULL,
|
||||
`write_bytes` bigint NOT NULL,
|
||||
`read_bytes` bigint NOT NULL,
|
||||
`date` TIMESTAMP NOT NULL,
|
||||
`date_str` VARCHAR(20) NOT NULL,
|
||||
`create_time` TIMESTAMP NOT NULL
|
||||
@@ -151,8 +212,8 @@ CREATE TABLE IF NOT EXISTS `flow_report_hour` (
|
||||
`id` INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
||||
`user_id` INTEGER(20) NOT NULL,
|
||||
`license_id` INTEGER(20) NOT NULL,
|
||||
`write_bytes` INTEGER(20) NOT NULL,
|
||||
`read_bytes` INTEGER(20) NOT NULL,
|
||||
`write_bytes` bigint NOT NULL,
|
||||
`read_bytes` bigint NOT NULL,
|
||||
`date` TIMESTAMP NOT NULL,
|
||||
`date_str` VARCHAR(20) NOT NULL,
|
||||
`create_time` TIMESTAMP NOT NULL
|
||||
@@ -167,8 +228,8 @@ CREATE TABLE IF NOT EXISTS `flow_report_day` (
|
||||
`id` INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
||||
`user_id` INTEGER(20) NOT NULL,
|
||||
`license_id` INTEGER(20) NOT NULL,
|
||||
`write_bytes` INTEGER(20) NOT NULL,
|
||||
`read_bytes` INTEGER(20) NOT NULL,
|
||||
`write_bytes` bigint NOT NULL,
|
||||
`read_bytes` bigint NOT NULL,
|
||||
`date` TIMESTAMP NOT NULL,
|
||||
`date_str` VARCHAR(20) NOT NULL,
|
||||
`create_time` TIMESTAMP NOT NULL
|
||||
@@ -183,8 +244,8 @@ CREATE TABLE IF NOT EXISTS `flow_report_month` (
|
||||
`id` INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
||||
`user_id` INTEGER(20) NOT NULL,
|
||||
`license_id` INTEGER(20) NOT NULL,
|
||||
`write_bytes` INTEGER(20) NOT NULL,
|
||||
`read_bytes` INTEGER(20) NOT NULL,
|
||||
`write_bytes` bigint NOT NULL,
|
||||
`read_bytes` bigint NOT NULL,
|
||||
`date` TIMESTAMP NOT NULL,
|
||||
`date_str` VARCHAR(20) NOT NULL,
|
||||
`create_time` TIMESTAMP NOT NULL
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#port_mapping
|
||||
INSERT INTO port_mapping(`id`, `license_id`, `server_port`, `protocal`, `subdomain`,`client_ip`, `client_port`, `is_online`, `enable`,`description`,`create_time`, `update_time`) VALUES
|
||||
(1, 1, 9101, 'HTTP', 'test1', '127.0.0.1', 8080, 2, 1,'test1', now(), now());
|
||||
INSERT INTO port_mapping(`id`, `license_id`, `server_port`, `protocal`, `subdomain`, `client_ip`, `client_port`, `is_online`, `enable`,`description`, `create_time`, `update_time`) VALUES
|
||||
(2, 1, 9102, 'TCP', '', '127.0.0.1', 3306, 2, 1,'test2', now(), now());
|
||||
INSERT INTO port_mapping(`id`, `license_id`, `server_port`, `protocal`, `subdomain`, `client_ip`, `client_port`, `is_online`, `enable`,`description`, `create_time`, `update_time`) VALUES
|
||||
(3, 1, 9103, 'HTTP', 'test2', '127.0.0.1', 8081, 2, 1,'test3', now(), now());
|
||||
INSERT INTO port_mapping(`id`, `license_id`, `server_port`, `protocal`,`client_ip`, `client_port`, `is_online`, `enable`,`description`,`create_time`, `update_time`) VALUES
|
||||
(1, 1, 9101, 'HTTP', '127.0.0.1', 8080, 2, 1,'test1', now(), now());
|
||||
INSERT INTO port_mapping(`id`, `license_id`, `server_port`, `protocal`, `client_ip`, `client_port`, `is_online`, `enable`,`description`, `create_time`, `update_time`) VALUES
|
||||
(2, 1, 9102, 'TCP', '127.0.0.1', 3306, 2, 1,'test2', now(), now());
|
||||
INSERT INTO port_mapping(`id`, `license_id`, `server_port`, `protocal`, `client_ip`, `client_port`, `is_online`, `enable`,`description`, `create_time`, `update_time`) VALUES
|
||||
(3, 1, 9103, 'HTTP', '127.0.0.1', 8081, 2, 1,'test3', now(), now());
|
||||
@@ -0,0 +1,38 @@
|
||||
#安全组
|
||||
CREATE TABLE IF NOT EXISTS `security_group` (
|
||||
`id` INTEGER NOT NULL AUTO_INCREMENT,
|
||||
`name` VARCHAR(20) NOT NULL,
|
||||
`description` VARCHAR(255),
|
||||
`user_id` INTEGER NOT NULL,
|
||||
`enable` INTEGER NOT NULL,
|
||||
`default_pass_type` INTEGER NOT NULL,
|
||||
`create_time` TIMESTAMP NOT NULL,
|
||||
`update_time` TIMESTAMP NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
);
|
||||
|
||||
#安全组规则
|
||||
CREATE TABLE IF NOT EXISTS `security_rule` (
|
||||
`id` INTEGER NOT NULL AUTO_INCREMENT,
|
||||
`group_id` INTEGER NOT NULL,
|
||||
`name` VARCHAR(20) NOT NULL,
|
||||
`description` VARCHAR(255) NOT NULL,
|
||||
`rule` text NOT NULL,
|
||||
`pass_type` INTEGER NOT NULL,
|
||||
`priority` INTEGER NOT NULL,
|
||||
`user_id` INTEGER NOT NULL,
|
||||
`enable` INTEGER NOT NULL,
|
||||
`create_time` TIMESTAMP NOT NULL,
|
||||
`update_time` TIMESTAMP NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS I_security_rule_group_id ON security_rule(group_id);
|
||||
|
||||
# port_mapping表增加字段
|
||||
ALTER TABLE `port_mapping` ADD COLUMN `security_group_id` INTEGER DEFAULT 0;
|
||||
ALTER TABLE `port_mapping` ADD COLUMN `up_limit_rate` varchar(20) DEFAULT NULL;
|
||||
ALTER TABLE `port_mapping` ADD COLUMN `down_limit_rate` varchar(20) DEFAULT NULL;
|
||||
|
||||
# license表增加字段
|
||||
ALTER TABLE `license` ADD COLUMN `up_limit_rate` varchar(20) DEFAULT NULL;
|
||||
ALTER TABLE `license` ADD COLUMN `down_limit_rate` varchar(20) DEFAULT NULL;
|
||||
@@ -0,0 +1,28 @@
|
||||
#域名表
|
||||
CREATE TABLE IF NOT EXISTS `domain_name` (
|
||||
`id` INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
||||
`domain` VARCHAR(50) NOT NULL,
|
||||
`user_id` INTEGER NOT NULL,
|
||||
`jks` BLOB DEFAULT NULL,
|
||||
`key_store_password` varchar(255) DEFAULT NULL,
|
||||
`is_default` INTEGER(2) NOT NULL,
|
||||
`force_https` INTEGER(2) NOT NULL,
|
||||
`enable` INTEGER(2) NOT NULL,
|
||||
`create_time` TIMESTAMP NOT NULL,
|
||||
`update_time` TIMESTAMP NOT NULL
|
||||
);
|
||||
CREATE UNIQUE INDEX IF NOT EXISTS I_domain_name_domain ON domain_name (`domain` ASC);
|
||||
|
||||
#域名映射中间表
|
||||
CREATE TABLE IF NOT EXISTS `domain_port_mapping` (
|
||||
`id` INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
||||
`subdomain` VARCHAR(50) NOT NULL,
|
||||
`domain_name_id` INTEGER NOT NULL,
|
||||
`port_mapping_id` INTEGER NOT NULL
|
||||
);
|
||||
CREATE UNIQUE INDEX IF NOT EXISTS I_unique_domain_port_mapping ON domain_port_mapping (`domain_name_id` ASC, `subdomain` ASC);
|
||||
CREATE INDEX IF NOT EXISTS I_domain_port_mapping_domain_name_id ON domain_port_mapping (`domain_name_id` ASC);
|
||||
CREATE INDEX IF NOT EXISTS I_domain_port_mapping_port_mapping_id ON domain_port_mapping (`port_mapping_id` ASC);
|
||||
|
||||
# port_mapping表删除字段
|
||||
ALTER TABLE `port_mapping` DROP COLUMN `subdomain`;
|
||||
@@ -50,6 +50,36 @@ CREATE TABLE IF NOT EXISTS `port_group` (
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
#安全组
|
||||
CREATE TABLE IF NOT EXISTS `security_group` (
|
||||
`id` int NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||||
`name` varchar(20) NOT NULL COMMENT '安全组名称',
|
||||
`description` varchar(255) COMMENT '安全组描述',
|
||||
`user_id` int NOT NULL COMMENT '用户ID',
|
||||
`enable` int NOT NULL COMMENT '是否启用(1、启用 2、禁用)',
|
||||
`default_pass_type` int NOT NULL COMMENT '默认放行类型',
|
||||
`create_time` datetime(3) NOT NULL COMMENT '创建时间',
|
||||
`update_time` datetime(3) NOT NULL COMMENT '更新时间',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
#安全组规则
|
||||
CREATE TABLE IF NOT EXISTS `security_rule` (
|
||||
`id` int NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||||
`group_id` int NOT NULL COMMENT '关联安全组',
|
||||
`name` varchar(20) NOT NULL COMMENT '规则名称',
|
||||
`description` varchar(255) NOT NULL COMMENT '规则描述',
|
||||
`rule` text NOT NULL COMMENT '规则内容',
|
||||
`pass_type` int NOT NULL COMMENT '放行类型',
|
||||
`priority` int(1) NOT NULL COMMENT '优先级',
|
||||
`user_id` int NOT NULL COMMENT '用户ID',
|
||||
`enable` int NOT NULL COMMENT '是否启用(1、启用 2、禁用)',
|
||||
`create_time` datetime(3) NOT NULL COMMENT '创建时间',
|
||||
`update_time` datetime(3) NOT NULL COMMENT '更新时间',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `I_security_rule_group_id_priority` (`group_id`, `priority`) USING BTREE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
#############################代理配置相关表#############################
|
||||
#license表
|
||||
CREATE TABLE IF NOT EXISTS `license` (
|
||||
@@ -57,6 +87,8 @@ CREATE TABLE IF NOT EXISTS `license` (
|
||||
`name` varchar(50) NOT NULL COMMENT 'license名称',
|
||||
`key` varchar(100) NOT NULL COMMENT 'license key',
|
||||
`user_id` int NOT NULL COMMENT '用户ID',
|
||||
`up_limit_rate` varchar(20) DEFAULT NULL COMMENT '上传限速',
|
||||
`down_limit_rate` varchar(20) DEFAULT NULL COMMENT '下载限速',
|
||||
`is_online` int NOT NULL COMMENT '是否在线(1、在线 2、离线)',
|
||||
`enable` int NOT NULL COMMENT '是否启用(1、启用 2、禁用)',
|
||||
`create_time` datetime(3) NOT NULL COMMENT '创建时间',
|
||||
@@ -70,20 +102,50 @@ CREATE TABLE IF NOT EXISTS `port_mapping` (
|
||||
`id` int NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||||
`license_id` int NOT NULL COMMENT 'licenseID',
|
||||
`protocal` varchar(10) NOT NULL DEFAULT 'TCP' COMMENT '协议',
|
||||
`subdomain` varchar(50) DEFAULT NULL COMMENT '子域名(仅HTTP时有效)',
|
||||
`server_port` int NOT NULL COMMENT '服务端端口',
|
||||
`client_ip` varchar(20) NOT NULL COMMENT '客户端IP',
|
||||
`client_ip` varchar(255) NOT NULL COMMENT '客户端IP',
|
||||
`client_port` int NOT NULL COMMENT '客户端端口',
|
||||
`up_limit_rate` varchar(20) DEFAULT NULL COMMENT '上传限速',
|
||||
`down_limit_rate` varchar(20) DEFAULT NULL COMMENT '下载限速',
|
||||
`is_online` int NOT NULL COMMENT '是否在线(1、在线 2、离线)',
|
||||
`description` varchar(100) DEFAULT NULL COMMENT '描述',
|
||||
`proxy_responses` int NOT NULL DEFAULT 0 COMMENT '代理响应数据包数量',
|
||||
`proxy_timeout_ms` int NOT NULL DEFAULT 0 COMMENT '代理超时毫秒数',
|
||||
`enable` int NOT NULL COMMENT '是否启用(1、启用 2、禁用)',
|
||||
`security_group_id` int DEFAULT 0 COMMENT '安全组Id',
|
||||
`create_time` datetime(3) NOT NULL COMMENT '创建时间',
|
||||
`update_time` datetime(3) NOT NULL COMMENT '更新时间',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `I_port_mapping_server_port` (`server_port`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
#域名表
|
||||
CREATE TABLE IF NOT EXISTS `domain_name` (
|
||||
`id` int NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||||
`domain` varchar(50) NOT NULL COMMENT '域名',
|
||||
`user_id` int NOT NULL COMMENT '用户Id',
|
||||
`jks` BLOB DEFAULT NULL COMMENT 'jks文件',
|
||||
`key_store_password` varchar(255) DEFAULT NULL COMMENT 'jks密码',
|
||||
`is_default` int(2) NOT NULL COMMENT '是否开启默认域名(1、开启 2、关闭)',
|
||||
`force_https` int(2) NOT NULL COMMENT '是否启用强制https(1、开启 2、关闭)',
|
||||
`enable` int(2) NOT NULL COMMENT '是否启用(1、启用 2、禁用)',
|
||||
`create_time` datetime NOT NULL COMMENT '创建时间',
|
||||
`update_time` datetime NOT NULL COMMENT '更新时间',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE INDEX `I_domain_name_domain` (`domain` ASC)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
#域名映射中间表
|
||||
CREATE TABLE IF NOT EXISTS `domain_port_mapping` (
|
||||
`id` int NOT NULL AUTO_INCREMENT COMMENT '创建时间',
|
||||
`subdomain` varchar(50) NOT NULL COMMENT '子域名',
|
||||
`domain_name_id` int NOT NULL COMMENT '域名Id',
|
||||
`port_mapping_id` int NOT NULL COMMENT '端口映射Id',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE INDEX `I_unique_domain_port_mapping` (`domain_name_id` ASC, `subdomain` ASC),
|
||||
INDEX `I_domain_port_mapping_domain_name_id` (`domain_name_id` ASC),
|
||||
INDEX `I_domain_port_mapping_port_mapping_id` (`port_mapping_id` ASC)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
#############################日志管理相关表#############################
|
||||
#用户登录记录表
|
||||
CREATE TABLE IF NOT EXISTS `user_login_record` (
|
||||
@@ -145,8 +207,8 @@ CREATE TABLE IF NOT EXISTS `flow_report_minute` (
|
||||
`id` int NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||||
`user_id` int NOT NULL COMMENT '用户ID',
|
||||
`license_id` int NOT NULL COMMENT 'licenseId',
|
||||
`write_bytes` int NOT NULL COMMENT '写入流量',
|
||||
`read_bytes` int NOT NULL COMMENT '读取流量',
|
||||
`write_bytes` bigint NOT NULL COMMENT '写入流量',
|
||||
`read_bytes` bigint NOT NULL COMMENT '读取流量',
|
||||
`date` datetime(3) NOT NULL COMMENT '时间',
|
||||
`date_str` varchar(20) NOT NULL COMMENT '时间 yyyy-MM-dd HH:mm',
|
||||
`create_time` datetime(3) NOT NULL COMMENT '创建时间',
|
||||
@@ -162,8 +224,8 @@ CREATE TABLE IF NOT EXISTS `flow_report_hour` (
|
||||
`id` int NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||||
`user_id` int NOT NULL COMMENT '用户ID',
|
||||
`license_id` int NOT NULL COMMENT 'licenseId',
|
||||
`write_bytes` int NOT NULL COMMENT '写入流量',
|
||||
`read_bytes` int NOT NULL COMMENT '读取流量',
|
||||
`write_bytes` bigint NOT NULL COMMENT '写入流量',
|
||||
`read_bytes` bigint NOT NULL COMMENT '读取流量',
|
||||
`date` datetime(3) NOT NULL COMMENT '时间',
|
||||
`date_str` varchar(20) NOT NULL COMMENT '时间 yyyy-MM-dd HH',
|
||||
`create_time` datetime(3) NOT NULL COMMENT '创建时间',
|
||||
@@ -179,8 +241,8 @@ CREATE TABLE IF NOT EXISTS `flow_report_day` (
|
||||
`id` int NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||||
`user_id` int NOT NULL COMMENT '用户ID',
|
||||
`license_id` int NOT NULL COMMENT 'licenseId',
|
||||
`write_bytes` int NOT NULL COMMENT '写入流量',
|
||||
`read_bytes` int NOT NULL COMMENT '读取流量',
|
||||
`write_bytes` bigint NOT NULL COMMENT '写入流量',
|
||||
`read_bytes` bigint NOT NULL COMMENT '读取流量',
|
||||
`date` datetime(3) NOT NULL COMMENT '时间',
|
||||
`date_str` varchar(20) NOT NULL COMMENT '时间 yyyy-MM-dd',
|
||||
`create_time` datetime(3) NOT NULL COMMENT '创建时间',
|
||||
@@ -196,8 +258,8 @@ CREATE TABLE IF NOT EXISTS `flow_report_month` (
|
||||
`id` int NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||||
`user_id` int NOT NULL COMMENT '用户ID',
|
||||
`license_id` int NOT NULL COMMENT 'licenseId',
|
||||
`write_bytes` int NOT NULL COMMENT '写入流量',
|
||||
`read_bytes` int NOT NULL COMMENT '读取流量',
|
||||
`write_bytes` bigint NOT NULL COMMENT '写入流量',
|
||||
`read_bytes` bigint NOT NULL COMMENT '读取流量',
|
||||
`date` datetime(3) NOT NULL COMMENT '时间',
|
||||
`date_str` varchar(20) NOT NULL COMMENT '时间 yyyy-MM',
|
||||
`create_time` datetime(3) NOT NULL COMMENT '创建时间',
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#port_mapping
|
||||
INSERT INTO port_mapping(`id`, `license_id`, `server_port`, `protocal`, `subdomain`, `client_ip`, `client_port`, `is_online`, `enable`, `create_time`, `update_time`) VALUES
|
||||
(1, 1, 9101, 'HTTP', 'test1', '127.0.0.1', 8080, 2, 1, now(), now());
|
||||
INSERT INTO port_mapping(`id`, `license_id`, `server_port`, `protocal`, `subdomain`, `client_ip`, `client_port`, `is_online`, `enable`, `create_time`, `update_time`) VALUES
|
||||
(2, 1, 9102, 'TCP', '', '127.0.0.1', 3306, 2, 1, now(), now());
|
||||
INSERT INTO port_mapping(`id`, `license_id`, `server_port`, `protocal`, `subdomain`, `client_ip`, `client_port`, `is_online`, `enable`, `create_time`, `update_time`) VALUES
|
||||
(3, 1, 9103, 'HTTP', 'test2', '127.0.0.1', 8081, 2, 1, now(), now());
|
||||
INSERT INTO port_mapping(`id`, `license_id`, `server_port`, `protocal`, `client_ip`, `client_port`, `is_online`, `enable`, `create_time`, `update_time`) VALUES
|
||||
(1, 1, 9101, 'HTTP', '127.0.0.1', 8080, 2, 1, now(), now());
|
||||
INSERT INTO port_mapping(`id`, `license_id`, `server_port`, `protocal`, `client_ip`, `client_port`, `is_online`, `enable`, `create_time`, `update_time`) VALUES
|
||||
(2, 1, 9102, 'TCP', '127.0.0.1', 3306, 2, 1, now(), now());
|
||||
INSERT INTO port_mapping(`id`, `license_id`, `server_port`, `protocal`, `client_ip`, `client_port`, `is_online`, `enable`, `create_time`, `update_time`) VALUES
|
||||
(3, 1, 9103, 'HTTP', '127.0.0.1', 8081, 2, 1, now(), now());
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
#域名表
|
||||
INSERT INTO domain_name(`id`, `domain`, `user_id`, `jks`, `key_store_password`, `is_default`, `force_https`, `enable`,`create_time`, `update_time`) VALUES
|
||||
(1, 'default.fun', 1, null, null, 1, 2, 1, now(), now());
|
||||
@@ -50,6 +50,36 @@ CREATE TABLE IF NOT EXISTS `port_group` (
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
#安全组
|
||||
CREATE TABLE IF NOT EXISTS `security_group` (
|
||||
`id` int NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||||
`name` varchar(20) NOT NULL COMMENT '安全组名称',
|
||||
`description` varchar(255) COMMENT '安全组描述',
|
||||
`user_id` int NOT NULL COMMENT '用户ID',
|
||||
`enable` int NOT NULL COMMENT '是否启用(1、启用 2、禁用)',
|
||||
`default_pass_type` int NOT NULL COMMENT '默认放行类型',
|
||||
`create_time` datetime(3) NOT NULL COMMENT '创建时间',
|
||||
`update_time` datetime(3) NOT NULL COMMENT '更新时间',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
#安全组规则
|
||||
CREATE TABLE IF NOT EXISTS `security_rule` (
|
||||
`id` int NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||||
`group_id` int NOT NULL COMMENT '关联安全组',
|
||||
`name` varchar(20) NOT NULL COMMENT '规则名称',
|
||||
`description` varchar(255) NOT NULL COMMENT '规则描述',
|
||||
`rule` text NOT NULL COMMENT '规则内容',
|
||||
`pass_type` int NOT NULL COMMENT '放行类型',
|
||||
`priority` int(1) NOT NULL COMMENT '优先级',
|
||||
`user_id` int NOT NULL COMMENT '用户ID',
|
||||
`enable` int NOT NULL COMMENT '是否启用(1、启用 2、禁用)',
|
||||
`create_time` datetime(3) NOT NULL COMMENT '创建时间',
|
||||
`update_time` datetime(3) NOT NULL COMMENT '更新时间',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `I_security_rule_group_id_priority` (`group_id`, `priority`) USING BTREE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
#############################代理配置相关表#############################
|
||||
#license表
|
||||
CREATE TABLE IF NOT EXISTS `license` (
|
||||
@@ -57,6 +87,8 @@ CREATE TABLE IF NOT EXISTS `license` (
|
||||
`name` varchar(50) NOT NULL COMMENT 'license名称',
|
||||
`key` varchar(100) NOT NULL COMMENT 'license key',
|
||||
`user_id` int NOT NULL COMMENT '用户ID',
|
||||
`up_limit_rate` varchar(20) DEFAULT NULL COMMENT '上传限速',
|
||||
`down_limit_rate` varchar(20) DEFAULT NULL COMMENT '下载限速',
|
||||
`is_online` int NOT NULL COMMENT '是否在线(1、在线 2、离线)',
|
||||
`enable` int NOT NULL COMMENT '是否启用(1、启用 2、禁用)',
|
||||
`create_time` datetime(3) NOT NULL COMMENT '创建时间',
|
||||
@@ -70,20 +102,50 @@ CREATE TABLE IF NOT EXISTS `port_mapping` (
|
||||
`id` int NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||||
`license_id` int NOT NULL COMMENT 'licenseID',
|
||||
`protocal` varchar(10) NOT NULL DEFAULT 'TCP' COMMENT '协议',
|
||||
`subdomain` varchar(50) DEFAULT NULL COMMENT '子域名(仅HTTP时有效)',
|
||||
`server_port` int NOT NULL COMMENT '服务端端口',
|
||||
`client_ip` varchar(20) NOT NULL COMMENT '客户端IP',
|
||||
`client_ip` varchar(255) NOT NULL COMMENT '客户端IP',
|
||||
`client_port` int NOT NULL COMMENT '客户端端口',
|
||||
`up_limit_rate` varchar(20) DEFAULT NULL COMMENT '上传限速',
|
||||
`down_limit_rate` varchar(20) DEFAULT NULL COMMENT '下载限速',
|
||||
`is_online` int NOT NULL COMMENT '是否在线(1、在线 2、离线)',
|
||||
`description` varchar(100) DEFAULT NULL COMMENT '描述',
|
||||
`proxy_responses` int NOT NULL DEFAULT 0 COMMENT '代理响应数据包数量',
|
||||
`proxy_timeout_ms` int NOT NULL DEFAULT 0 COMMENT '代理超时毫秒数',
|
||||
`enable` int NOT NULL COMMENT '是否启用(1、启用 2、禁用)',
|
||||
`security_group_id` int DEFAULT 0 COMMENT '安全组Id',
|
||||
`create_time` datetime(3) NOT NULL COMMENT '创建时间',
|
||||
`update_time` datetime(3) NOT NULL COMMENT '更新时间',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `I_port_mapping_server_port` (`server_port`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
#域名表
|
||||
CREATE TABLE IF NOT EXISTS `domain_name` (
|
||||
`id` int NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||||
`domain` varchar(50) NOT NULL COMMENT '域名',
|
||||
`user_id` int NOT NULL COMMENT '用户Id',
|
||||
`jks` BLOB DEFAULT NULL COMMENT 'jks文件',
|
||||
`key_store_password` varchar(255) DEFAULT NULL COMMENT 'jks密码',
|
||||
`is_default` int(2) NOT NULL COMMENT '是否开启默认域名(1、开启 2、关闭)',
|
||||
`force_https` int(2) NOT NULL COMMENT '是否启用强制https(1、开启 2、关闭)',
|
||||
`enable` int(2) NOT NULL COMMENT '是否启用(1、启用 2、禁用)',
|
||||
`create_time` datetime NOT NULL COMMENT '创建时间',
|
||||
`update_time` datetime NOT NULL COMMENT '更新时间',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE INDEX `I_domain_name_domain` (`domain` ASC)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
#域名映射中间表
|
||||
CREATE TABLE IF NOT EXISTS `domain_port_mapping` (
|
||||
`id` int NOT NULL AUTO_INCREMENT COMMENT '创建时间',
|
||||
`subdomain` varchar(50) NOT NULL COMMENT '子域名',
|
||||
`domain_name_id` int NOT NULL COMMENT '域名Id',
|
||||
`port_mapping_id` int NOT NULL COMMENT '端口映射Id',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE INDEX `I_unique_domain_port_mapping` (`domain_name_id` ASC, `subdomain` ASC),
|
||||
INDEX `I_domain_port_mapping_domain_name_id` (`domain_name_id` ASC),
|
||||
INDEX `I_domain_port_mapping_port_mapping_id` (`port_mapping_id` ASC)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
#############################日志管理相关表#############################
|
||||
#用户登录记录表
|
||||
CREATE TABLE IF NOT EXISTS `user_login_record` (
|
||||
@@ -145,8 +207,8 @@ CREATE TABLE IF NOT EXISTS `flow_report_minute` (
|
||||
`id` int NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||||
`user_id` int NOT NULL COMMENT '用户ID',
|
||||
`license_id` int NOT NULL COMMENT 'licenseId',
|
||||
`write_bytes` int NOT NULL COMMENT '写入流量',
|
||||
`read_bytes` int NOT NULL COMMENT '读取流量',
|
||||
`write_bytes` bigint NOT NULL COMMENT '写入流量',
|
||||
`read_bytes` bigint NOT NULL COMMENT '读取流量',
|
||||
`date` datetime(3) NOT NULL COMMENT '时间',
|
||||
`date_str` varchar(20) NOT NULL COMMENT '时间 yyyy-MM-dd HH:mm',
|
||||
`create_time` datetime(3) NOT NULL COMMENT '创建时间',
|
||||
@@ -162,8 +224,8 @@ CREATE TABLE IF NOT EXISTS `flow_report_hour` (
|
||||
`id` int NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||||
`user_id` int NOT NULL COMMENT '用户ID',
|
||||
`license_id` int NOT NULL COMMENT 'licenseId',
|
||||
`write_bytes` int NOT NULL COMMENT '写入流量',
|
||||
`read_bytes` int NOT NULL COMMENT '读取流量',
|
||||
`write_bytes` bigint NOT NULL COMMENT '写入流量',
|
||||
`read_bytes` bigint NOT NULL COMMENT '读取流量',
|
||||
`date` datetime(3) NOT NULL COMMENT '时间',
|
||||
`date_str` varchar(20) NOT NULL COMMENT '时间 yyyy-MM-dd HH',
|
||||
`create_time` datetime(3) NOT NULL COMMENT '创建时间',
|
||||
@@ -179,8 +241,8 @@ CREATE TABLE IF NOT EXISTS `flow_report_day` (
|
||||
`id` int NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||||
`user_id` int NOT NULL COMMENT '用户ID',
|
||||
`license_id` int NOT NULL COMMENT 'licenseId',
|
||||
`write_bytes` int NOT NULL COMMENT '写入流量',
|
||||
`read_bytes` int NOT NULL COMMENT '读取流量',
|
||||
`write_bytes` bigint NOT NULL COMMENT '写入流量',
|
||||
`read_bytes` bigint NOT NULL COMMENT '读取流量',
|
||||
`date` datetime(3) NOT NULL COMMENT '时间',
|
||||
`date_str` varchar(20) NOT NULL COMMENT '时间 yyyy-MM-dd',
|
||||
`create_time` datetime(3) NOT NULL COMMENT '创建时间',
|
||||
@@ -196,8 +258,8 @@ CREATE TABLE IF NOT EXISTS `flow_report_month` (
|
||||
`id` int NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||||
`user_id` int NOT NULL COMMENT '用户ID',
|
||||
`license_id` int NOT NULL COMMENT 'licenseId',
|
||||
`write_bytes` int NOT NULL COMMENT '写入流量',
|
||||
`read_bytes` int NOT NULL COMMENT '读取流量',
|
||||
`write_bytes` bigint NOT NULL COMMENT '写入流量',
|
||||
`read_bytes` bigint NOT NULL COMMENT '读取流量',
|
||||
`date` datetime(3) NOT NULL COMMENT '时间',
|
||||
`date_str` varchar(20) NOT NULL COMMENT '时间 yyyy-MM',
|
||||
`create_time` datetime(3) NOT NULL COMMENT '创建时间',
|
||||
@@ -207,3 +269,4 @@ CREATE TABLE IF NOT EXISTS `flow_report_month` (
|
||||
KEY `I_flow_report_month_user_id` (`user_id`),
|
||||
KEY `I_flow_report_month_license_id` (`license_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#port_mapping
|
||||
INSERT INTO port_mapping(`id`, `license_id`, `server_port`, `protocal`, `subdomain`, `client_ip`, `client_port`, `is_online`, `enable`, `create_time`, `update_time`) VALUES
|
||||
(1, 1, 9101, 'HTTP', 'test1', '127.0.0.1', 8080, 2, 1, now(), now());
|
||||
INSERT INTO port_mapping(`id`, `license_id`, `server_port`, `protocal`, `subdomain`, `client_ip`, `client_port`, `is_online`, `enable`, `create_time`, `update_time`) VALUES
|
||||
(2, 1, 9102, 'TCP', '', '127.0.0.1', 3306, 2, 1, now(), now());
|
||||
INSERT INTO port_mapping(`id`, `license_id`, `server_port`, `protocal`, `subdomain`, `client_ip`, `client_port`, `is_online`, `enable`, `create_time`, `update_time`) VALUES
|
||||
(3, 1, 9103, 'HTTP', 'test2', '127.0.0.1', 8081, 2, 1, now(), now());
|
||||
INSERT INTO port_mapping(`id`, `license_id`, `server_port`, `protocal`, `client_ip`, `client_port`, `is_online`, `enable`, `create_time`, `update_time`) VALUES
|
||||
(1, 1, 9101, 'HTTP', '127.0.0.1', 8080, 2, 1, now(), now());
|
||||
INSERT INTO port_mapping(`id`, `license_id`, `server_port`, `protocal`, `client_ip`, `client_port`, `is_online`, `enable`, `create_time`, `update_time`) VALUES
|
||||
(2, 1, 9102, 'TCP', '127.0.0.1', 3306, 2, 1, now(), now());
|
||||
INSERT INTO port_mapping(`id`, `license_id`, `server_port`, `protocal`, `client_ip`, `client_port`, `is_online`, `enable`, `create_time`, `update_time`) VALUES
|
||||
(3, 1, 9103, 'HTTP', '127.0.0.1', 8081, 2, 1, now(), now());
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
ALTER TABLE `flow_report_minute` MODIFY COLUMN `read_bytes` BIGINT NOT NULL COMMENT '读取流量';
|
||||
ALTER TABLE `flow_report_minute` MODIFY COLUMN `write_bytes` BIGINT NOT NULL COMMENT '写入流量';
|
||||
ALTER TABLE `flow_report_hour` MODIFY COLUMN `read_bytes` BIGINT NOT NULL COMMENT '读取流量';
|
||||
ALTER TABLE `flow_report_hour` MODIFY COLUMN `write_bytes` BIGINT NOT NULL COMMENT '写入流量';
|
||||
ALTER TABLE `flow_report_day` MODIFY COLUMN `read_bytes` BIGINT NOT NULL COMMENT '读取流量';
|
||||
ALTER TABLE `flow_report_day` MODIFY COLUMN `write_bytes` BIGINT NOT NULL COMMENT '写入流量';
|
||||
ALTER TABLE `flow_report_month` MODIFY COLUMN `read_bytes` BIGINT NOT NULL COMMENT '读取流量';
|
||||
ALTER TABLE `flow_report_month` MODIFY COLUMN `write_bytes` BIGINT NOT NULL COMMENT '写入流量';
|
||||
@@ -0,0 +1,38 @@
|
||||
#安全组
|
||||
CREATE TABLE IF NOT EXISTS `security_group` (
|
||||
`id` int NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||||
`name` varchar(20) NOT NULL COMMENT '安全组名称',
|
||||
`description` varchar(255) COMMENT '安全组描述',
|
||||
`user_id` int NOT NULL COMMENT '用户ID',
|
||||
`enable` int NOT NULL COMMENT '是否启用(1、启用 2、禁用)',
|
||||
`default_pass_type` int NOT NULL COMMENT '默认放行类型',
|
||||
`create_time` datetime(3) NOT NULL COMMENT '创建时间',
|
||||
`update_time` datetime(3) NOT NULL COMMENT '更新时间',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
#安全组规则
|
||||
CREATE TABLE IF NOT EXISTS `security_rule` (
|
||||
`id` int NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||||
`group_id` int NOT NULL COMMENT '关联安全组',
|
||||
`name` varchar(20) NOT NULL COMMENT '规则名称',
|
||||
`description` varchar(255) NOT NULL COMMENT '规则描述',
|
||||
`rule` text NOT NULL COMMENT '规则内容',
|
||||
`pass_type`int NOT NULL COMMENT '放行类型',
|
||||
`priority` int(1) NOT NULL COMMENT '优先级',
|
||||
`user_id` int NOT NULL COMMENT '用户ID',
|
||||
`enable` int NOT NULL COMMENT '是否启用(1、启用 2、禁用)',
|
||||
`create_time` datetime(3) NOT NULL COMMENT '创建时间',
|
||||
`update_time` datetime(3) NOT NULL COMMENT '更新时间',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `I_security_rule_group_id_priority` (`group_id`, `priority`) USING BTREE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
# port_mapping表增加字段
|
||||
ALTER TABLE `port_mapping` ADD COLUMN `security_group_id` int DEFAULT 0 COMMENT '安全组Id';
|
||||
ALTER TABLE `port_mapping` ADD COLUMN `up_limit_rate` varchar(20) DEFAULT NULL COMMENT '上传限速';
|
||||
ALTER TABLE `port_mapping` ADD COLUMN `down_limit_rate` varchar(20) DEFAULT NULL COMMENT '下载限速';
|
||||
|
||||
# license表增加字段
|
||||
ALTER TABLE `license` ADD COLUMN `up_limit_rate` varchar(20) DEFAULT NULL COMMENT '上传限速';
|
||||
ALTER TABLE `license` ADD COLUMN `down_limit_rate` varchar(20) DEFAULT NULL COMMENT '下载限速';
|
||||
@@ -0,0 +1,30 @@
|
||||
#域名表
|
||||
CREATE TABLE IF NOT EXISTS `domain_name` (
|
||||
`id` int NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||||
`domain` varchar(50) NOT NULL COMMENT '域名',
|
||||
`user_id` int NOT NULL COMMENT '用户Id',
|
||||
`jks` BLOB DEFAULT NULL COMMENT 'jks文件',
|
||||
`key_store_password` varchar(255) DEFAULT NULL COMMENT 'jks密码',
|
||||
`is_default` int(2) NOT NULL COMMENT '是否开启默认域名(1、开启 2、关闭)',
|
||||
`force_https` int(2) NOT NULL COMMENT '是否启用强制https(1、开启 2、关闭)',
|
||||
`enable` int(2) NOT NULL COMMENT '是否启用(1、启用 2、禁用)',
|
||||
`create_time` datetime NOT NULL COMMENT '创建时间',
|
||||
`update_time` datetime NOT NULL COMMENT '更新时间',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE INDEX `I_domain_name_domain` (`domain` ASC)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
#域名映射中间表
|
||||
CREATE TABLE IF NOT EXISTS `domain_port_mapping` (
|
||||
`id` int NOT NULL AUTO_INCREMENT COMMENT '创建时间',
|
||||
`subdomain` varchar(50) NOT NULL COMMENT '子域名',
|
||||
`domain_name_id` int NOT NULL COMMENT '域名Id',
|
||||
`port_mapping_id` int NOT NULL COMMENT '端口映射Id',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE INDEX `I_unique_domain_port_mapping` (`domain_name_id` ASC, `subdomain` ASC),
|
||||
INDEX `I_domain_port_mapping_domain_name_id` (`domain_name_id` ASC),
|
||||
INDEX `I_domain_port_mapping_port_mapping_id` (`port_mapping_id` ASC)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
# port_mapping表删除字段
|
||||
ALTER TABLE `port_mapping` DROP COLUMN `subdomain`;
|
||||
@@ -8,3 +8,5 @@
|
||||
[主题仓库](https://github.com/xugaoyi/vuepress-theme-vdoing)
|
||||
|
||||
[本仓库的gitee镜像](https://gitee.com/xugaoyi/vuepress-theme-vdoing-doc)
|
||||
|
||||
hello11
|
||||
|
||||
@@ -9,7 +9,8 @@ module.exports = {
|
||||
|
||||
title: "中微子代理",
|
||||
description: '一个基于Netty的开源内网穿透神器',
|
||||
base: '/neutrino-proxy/', // 默认'/'。如果你想将你的网站部署到如 https://foo.github.io/bar/,那么 base 应该被设置成 "/bar/",(否则页面将失去样式等文件)
|
||||
// base: '/neutrino-proxy/', // 默认'/'。如果你想将你的网站部署到如 https://foo.github.io/bar/,那么 base 应该被设置成 "/bar/",(否则页面将失去样式等文件)
|
||||
base: '/',
|
||||
head: [ // 注入到页面<head> 中的标签,格式[tagName, { attrName: attrValue }, innerHTML?]
|
||||
['link', {rel: 'icon', href: '/img/favicon.ico'}], //favicons,资源放在public文件夹
|
||||
['meta', {name: 'keywords', content: 'vuepress,theme,blog,vdoing'}],
|
||||
@@ -30,7 +31,10 @@ module.exports = {
|
||||
{text: '后台操作指南', link: '/pages/793dcc/'},
|
||||
]
|
||||
},
|
||||
{text: '演示', link: '/pages/db78e2/'},
|
||||
{text: '案例', link: '/pages/5d571c/'},
|
||||
{text: '支持', link: '/pages/1ab20b/'},
|
||||
{text: '更新记录', link: '/pages/ff3519/'},
|
||||
{text: 'GitCode', link: 'https://gitcode.com/dromara/neutrino-proxy'},
|
||||
{text: 'Gitee', link: 'https://gitee.com/dromara/neutrino-proxy'},
|
||||
],
|
||||
sidebarDepth: 2, // 侧边栏显示深度,默认1,最大2(显示到h3标题)
|
||||
|
||||
|
After Width: | Height: | Size: 167 KiB |
|
After Width: | Height: | Size: 159 KiB |
|
After Width: | Height: | Size: 186 KiB |
|
After Width: | Height: | Size: 217 KiB |
|
After Width: | Height: | Size: 166 KiB |
|
After Width: | Height: | Size: 87 KiB |
|
After Width: | Height: | Size: 175 KiB |
|
After Width: | Height: | Size: 243 KiB |
|
After Width: | Height: | Size: 143 KiB |
|
After Width: | Height: | Size: 132 KiB |
|
After Width: | Height: | Size: 278 KiB |
|
After Width: | Height: | Size: 26 KiB |
|
After Width: | Height: | Size: 21 KiB |
@@ -0,0 +1,33 @@
|
||||
---
|
||||
title: 快速上手
|
||||
date: 2023-03-28 20:30:00
|
||||
permalink: /pages/793dcb
|
||||
article: false
|
||||
---
|
||||
|
||||
::: tip
|
||||
当前最新版本:2.0.3。从之前的版本升级过来,请参照:更新记录 > 版本记录.
|
||||
:::
|
||||
|
||||
## 1、快速上手须知
|
||||
- 所谓快速上手,就是针对从来没用过的新手编写的、快速完成从安装部署到首次使用的最简化流程
|
||||
- 该流程中请严格按照说明步骤执行,不要靠猜测自作聪明的修改配置
|
||||
- 如果的确需要修改,请先把安装部署、使用须知、常见问题全部仔细读一遍
|
||||
- 快速上手中涉及到的配置,仅仅是快速体验所必须的配置,完整的配置请参照使用须知中的`服务端配置`、`客户端配置`
|
||||
|
||||
## 2、部署服务
|
||||
- 根据需要自行选择宝塔面板、jar、docker、原生部署、docker-compose任意一种完成部署,分别参见对应的文档
|
||||
- 任何一种部署方式,不要求客户端与服务端一致。如:服务端采用docker部署,客户端可以用docker部署、也可以用jar、原生部署
|
||||
- 管理后台说明
|
||||
- 服务端部署成功后,访问http://{服务端IP}:8888打开后台管理页面。使用默认的管理员帐号登录:admin/123456
|
||||
- 打开代理配置>License管理页面,可以看到系统已经自动为管理员初始化了一条License记录,复制该LicenseKey备用,后续客户端配置需要。
|
||||
- 客户端说明
|
||||
- 客户端启动后,查看服务端License管理,刷新页面,对应的License在线状态为`在线`,则表明客户端已正常连接。
|
||||
|
||||
## 3、代理验证
|
||||
- 本地启动被代理服务,如:redis、本地web项目、本地mysql等等,假设被代理服务端口为:8080
|
||||
- 先确保本地能正常访问被代理服务,如果本地都不能访问,不用想代理更不可能!!!
|
||||
- 服务端管理后台端口映射管理,使用默认的licesne创建一条端口映射,如:9101 -> 127.0.0.1:8080
|
||||
- 通过服务端IP+9101(上面License配置的端口映射重的服务端端口)访问本地被代理服务
|
||||
|
||||
访问成功,至此首次完整的内网穿透体验完成。开源不易,请速至[Gitee仓库](https://gitee.com/dromara/neutrino-proxy)一键三连🤝
|
||||
@@ -0,0 +1,43 @@
|
||||
---
|
||||
title: 通过宝塔面板部署
|
||||
date: 2024-23-20 13:32:00
|
||||
permalink: /pages/9e0fde/
|
||||
article: false
|
||||
---
|
||||
|
||||
## 前提
|
||||
- 仅适用于宝塔面板9.2.0及以上版本
|
||||
- 安装宝塔面板,前往[宝塔面板](https://www.bt.cn/new/download.html?r=dk_neuproxy)官网,选择正式版的脚本下载安装
|
||||
|
||||
## 部署
|
||||
#### 1、登录宝塔面板,在左侧菜单栏中点击`Docker`
|
||||
|
||||
<img :src="$withBase('/img/baota/step1.png')"></img>
|
||||
|
||||
#### 2、首次会提示安装Docker和Docker Compose服务,点击立即安装,若已安装请忽略。
|
||||
|
||||
<img :src="$withBase('/img/baota/step2.png')"></img>
|
||||
|
||||
#### 3、安装完成后在Docker-应用商店中找到 中微子代理(搜索“NeutrinoProxy”),点击安装
|
||||
|
||||
<img :src="$withBase('/img/baota/step3.png')"></img>
|
||||
|
||||
#### 4、设置基本信息,点击确定
|
||||
- 名称:应用名称,默认`neuproxy_随机字符`
|
||||
- 版本:默认`latest`
|
||||
- 允许外部访问:如您需通过`IP+Port`直接访问,请勾选,如您已经设置了域名,请不要勾选此处
|
||||
- web管理端口:默认`9988`,可自行修改
|
||||
- 客户端连接端口:默认`9989`,可自行修改
|
||||
- 客户端SSL连接端口:默认`9990`,可自行修改
|
||||
|
||||
<img :src="$withBase('/img/baota/step4.png')"></img>
|
||||
|
||||
#### 5、提交后面板会自动进行应用初始化,大概需要`1-3`分钟,初始化完成后即可访问。
|
||||
- 如果部署失败,可能是从DockerHub拉取镜像失败,可以自行设置镜像加速。
|
||||
|
||||
<img :src="$withBase('/img/baota/step5.png')"></img>
|
||||
|
||||
#### 6、访问中微子代理管理后台
|
||||
<img :src="$withBase('/img/baota/step6.png')"></img>
|
||||
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
---
|
||||
title: 使用jar部署
|
||||
date: 2023-10-26 13:50:45
|
||||
permalink: /pages/eebea1/
|
||||
---
|
||||
|
||||
## 1、环境准备
|
||||
- 首先确保已安装Java21运行环境
|
||||
- 打开[发行版页面](https://gitee.com/dromara/neutrino-proxy/releases),下载最新的release包:`neutrino-proxy-server-jdk21-2.0.2-jar.zip`、`neutrino-proxy-client-jdk21-2.0.2-jar.zip`
|
||||
- 百度网盘下载速度慢?[点击这里加速](https://docs.xigexb.com/s/neutrino-proxy/doc/neutrino-proxy-CROFc0fdYh),此站点由[喜鸽小宝](https://www.xigexb.com)提供。
|
||||
|
||||
## 2、部署服务端
|
||||
- 在服务器上新建部署目录:`/work/projects/neutrino-proxy-server`
|
||||
- 将`neutrino-proxy-server-jdk21-2.0.2-jar.zip`上传至服务器部署目录,并解压
|
||||
- 执行命令`java -Dfile.encoding=utf-8 -jar neutrino-proxy-server.jar`启动服务端完成部署,默认使用h2数据库。
|
||||
- 若需要指定自己的mysql数据库,则需要在当前目录下的`app.yml`文件中,修改数据库配置如下:
|
||||
|
||||
```yml
|
||||
neutrino:
|
||||
data:
|
||||
db:
|
||||
type: mysql
|
||||
# 自己的数据库实例,创建一个空的名为'neutrino-proxy'的数据库即可,首次启动服务端会自动初始化
|
||||
url: jdbc:mysql://xxxx:3306/neutrino-proxy?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&useAffectedRows=true&useSSL=false
|
||||
driver-class: com.mysql.jdbc.Driver
|
||||
# 数据库帐号
|
||||
username: xxx
|
||||
# 数据库密码
|
||||
password: xxx
|
||||
```
|
||||
|
||||
- 可参照 https://gitee.com/dromara/neutrino-proxy/blob/master/scripts/unix/server_start.sh 使用shell脚本启动服务端。
|
||||
|
||||
## 3、部署客户端
|
||||
- 本地解压`neutrino-proxy-client-jdk21-2.0.2-jar.zip`文件
|
||||
- 修改`app.yml`文件中的server-ip为服务器公网ip,并配置license-key,以下是相关的部分配置:
|
||||
```yml
|
||||
neutrino:
|
||||
proxy:
|
||||
tunnel:
|
||||
# ssl证书密钥(使用jjar包内自带的证书,则此处无需修改)
|
||||
key-store-password: 123456
|
||||
# ssl证书管理密钥(使用jjar包内自带的证书,则此处无需修改。自定义证书,则此处配置对应的路径)
|
||||
jks-path: classpath:/test.jks
|
||||
# 代理服务端IP
|
||||
server-ip: xxxx
|
||||
# 代理服务端IP, 若是非ssl端口,则ssl-enable需要配置为false
|
||||
server-port: 9002
|
||||
# 是否启用ssl
|
||||
ssl-enable: true
|
||||
# licenseKey,客户端凭证。此处需要配置刚刚从管理后台复制的LicenseKey
|
||||
license-key: xxxx
|
||||
```
|
||||
- 执行命令`java -jar neutrino-proxy-client.jar`启动客户端
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
---
|
||||
title: 使用docker容器化部署
|
||||
date: 2023-10-26 13:51:29
|
||||
permalink: /pages/5b9bef/
|
||||
---
|
||||
|
||||
## 1、 部署服务端
|
||||
- dockerHub镜像地址:aoshiguchen/neutrino-proxy-server:latest
|
||||
- 阿里云镜像地址:registry.cn-hangzhou.aliyuncs.com/asgc/neutrino-proxy:latest
|
||||
### 使用默认h2数据库一键部署
|
||||
```shell
|
||||
docker run -it -p 9000-9200:9000-9200/tcp -p 8888:8888 \
|
||||
-d --restart=always --name neutrino-proxy \
|
||||
-v /root/neutrino-proxy-server/config:/root/neutrino-proxy/config \
|
||||
-v /root/neutrino-proxy-server/data:/root/neutrino-proxy/data \
|
||||
-v /root/neutrino-proxy-server/logs:/root/neutrino-proxy/logs \
|
||||
aoshiguchen/neutrino-proxy-server:latest
|
||||
```
|
||||
|
||||
### 指定自己的mysql数据库
|
||||
- 在服务器上创建目录:/root/neutrino-proxy/config
|
||||
- 在该目录下创建`app.yml`文本文件,并配置如下内容:
|
||||
```yml
|
||||
neutrino:
|
||||
data:
|
||||
db:
|
||||
type: mysql
|
||||
# 自己的数据库实例,创建一个空的名为'neutrino-proxy'的数据库即可,首次启动服务端会自动初始化
|
||||
url: jdbc:mysql://xxxx:3306/neutrino-proxy?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&useAffectedRows=true&useSSL=false
|
||||
driver-class: com.mysql.jdbc.Driver
|
||||
# 数据库帐号
|
||||
username: xxx
|
||||
# 数据库密码
|
||||
password: xxx
|
||||
```
|
||||
- 然后再执行上面的docker一键部署命令即可
|
||||
|
||||
## 2、部署客户端
|
||||
- dockerHub镜像地址:aoshiguchen/neutrino-proxy-client:latest
|
||||
- 阿里云镜像地址:registry.cn-hangzhou.aliyuncs.com/asgc/neutrino-proxy-client:latest
|
||||
- 命令中的服务端ip、license请自行补充
|
||||
- 若是首次使用,请仔细阅读快速上手,以确定license从哪里取得
|
||||
```shell
|
||||
docker run -it -d --restart=always --name npclient -e SERVER_IP=xxxx -e LICENSE_KEY=xxxx \
|
||||
aoshiguchen/neutrino-proxy-client:latest
|
||||
```
|
||||
@@ -0,0 +1,62 @@
|
||||
---
|
||||
title: 原生部署
|
||||
date: 2023-10-26 13:51:44
|
||||
permalink: /pages/69699a/
|
||||
---
|
||||
|
||||
::: tip
|
||||
1、目前的原生部署包支持mac、linux、windows三个平台
|
||||
|
||||
2、这三个平台的部署包均由作者分别测试通过
|
||||
|
||||
3、尽管如此,仍然可能存在有的机器不支持的情况,可自行拉取仓库源码编译出目标平台可执行文件、或换成其它部署方式
|
||||
|
||||
4、若linux/mac下提示文件没有执行权限,可执行`chmod +x {文件路径}`解决
|
||||
|
||||
5、若mac下运行提示移到废纸篓,可执行`sudo xattr -rd com.apple.quarantine {文件路径}`解决
|
||||
:::
|
||||
|
||||
## 1、安装包下载
|
||||
- 打开[发行版页面](https://gitee.com/dromara/neutrino-proxy/releases),下载所需的最新的release包:
|
||||
- 比如服务器为linux则可下载`neutrino-proxy-server-linux-2.0.2-native.zip`文件,客户端为windows则可下载`neutrino-proxy-client-windows-2.0.2-native.zip`
|
||||
- 百度网盘下载速度慢?[点击这里加速](https://docs.xigexb.com/s/neutrino-proxy/doc/neutrino-proxy-CROFc0fdYh),此站点由[喜鸽小宝](https://www.xigexb.com)提供。
|
||||
|
||||
## 2、部署服务端
|
||||
- 将服务端安装包上传至服务器,并解压
|
||||
- 服务端默认使用h2数据库,若需要改为mysql,则可修改安装包`app.yml`内的数据库配置,如下:
|
||||
```yml
|
||||
neutrino:
|
||||
data:
|
||||
db:
|
||||
type: mysql
|
||||
# 自己的数据库实例,创建一个空的名为'neutrino-proxy'的数据库即可,首次启动服务端会自动初始化
|
||||
url: jdbc:mysql://xxxx:3306/neutrino-proxy?useUnicode=true&allowMultiQueries=true&useAffectedRows=true&useSSL=false
|
||||
driver-class: com.mysql.jdbc.Driver
|
||||
# 数据库帐号
|
||||
username: xxx
|
||||
# 数据库密码
|
||||
password: xxx
|
||||
```
|
||||
- 然后直接启动服务端可执行程序即可
|
||||
|
||||
## 3、部署客户端
|
||||
- 本地解压客户端安装包
|
||||
- 修改`app.yml`文件中的server-ip为服务器公网ip,并配置license-key,以下是相关的部分配置:
|
||||
```yml
|
||||
neutrino:
|
||||
proxy:
|
||||
tunnel:
|
||||
# ssl证书密钥(使用jjar包内自带的证书,则此处无需修改)
|
||||
key-store-password: 123456
|
||||
# ssl证书管理密钥(使用jjar包内自带的证书,则此处无需修改。自定义证书,则此处配置对应的路径)
|
||||
jks-path: classpath:/test.jks
|
||||
# 代理服务端IP
|
||||
server-ip: xxxx
|
||||
# 代理服务端IP, 若是非ssl端口,则ssl-enable需要配置为false
|
||||
server-port: 9002
|
||||
# 是否启用ssl
|
||||
ssl-enable: true
|
||||
# licenseKey,客户端凭证。此处需要配置刚刚从管理后台复制的LicenseKey
|
||||
license-key: xxxx
|
||||
```
|
||||
- 然后直接启动客户端可执行程序即可
|
||||
@@ -0,0 +1,30 @@
|
||||
---
|
||||
title: 使用docker-compose部署
|
||||
date: 2024-12-07 14:40:50
|
||||
permalink: /pages/2d4123/
|
||||
---
|
||||
|
||||
## 1、 部署服务端
|
||||
### 使用默认h2数据库一键部署
|
||||
- 注意自行修改配置文件:config/app.yml
|
||||
```shell
|
||||
git clone https://gitee.com/dromara/neutrino-proxy.git
|
||||
cd neutrino-proxy/scripts/docker-compose/neutrino-proxy-server-h2
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
### 使用默认mysql数据库一键部署
|
||||
- 注意自行修改配置文件:config/app.yml
|
||||
```shell
|
||||
git clone https://gitee.com/dromara/neutrino-proxy.git
|
||||
cd neutrino-proxy/scripts/docker-compose/neutrino-proxy-server-mysql
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
## 2、部署客户端
|
||||
- 注意自行修改配置文件:config/app.yml
|
||||
```shell
|
||||
git clone https://gitee.com/dromara/neutrino-proxy.git
|
||||
cd neutrino-proxy/scripts/docker-compose/neutrino-proxy-client
|
||||
docker-compose up -d
|
||||
```
|
||||
@@ -1,123 +0,0 @@
|
||||
---
|
||||
title: 快速上手
|
||||
date: 2023-03-28 20:30:00
|
||||
permalink: /pages/793dcb
|
||||
article: false
|
||||
---
|
||||
|
||||
## 1、 部署服务端
|
||||
### 1.1、 Docker一键部署
|
||||
> 当前最新版本为1.9.0,下面的脚本中,可以使用:`registry.cn-hangzhou.aliyuncs.com/asgc/neutrino-proxy:1.9.0` 指定版本安装,推荐使用`latest`直接安装最新版。
|
||||
|
||||
#### 使用默认sqlite数据库
|
||||
```shell
|
||||
docker run -it -p 9000-9200:9000-9200/tcp -p 8888:8888 \
|
||||
-d --restart=always --name neutrino-proxy \
|
||||
registry.cn-hangzhou.aliyuncs.com/asgc/neutrino-proxy:latest
|
||||
```
|
||||
|
||||
#### 指定自己的mysql数据库
|
||||
- 在服务器上创建目录:/root/neutrino-proxy/config
|
||||
- 在该目录下创建`app.yml`文本文件,并配置如下内容:
|
||||
```yml
|
||||
neutrino:
|
||||
data:
|
||||
db:
|
||||
type: mysql
|
||||
# 自己的数据库实例,创建一个空的名为'neutrino-proxy'的数据库即可,首次启动服务端会自动初始化
|
||||
url: jdbc:mysql://xxxx:3306/neutrino-proxy?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&useAffectedRows=true&useSSL=false
|
||||
driver-class: com.mysql.jdbc.Driver
|
||||
# 数据库帐号
|
||||
username: xxx
|
||||
# 数据库密码
|
||||
password: xxx
|
||||
```
|
||||
- 然后执行如下命令:
|
||||
```shell
|
||||
docker run -it -p 9000-9200:9000-9200/tcp -p 8888:8888 \
|
||||
-v /root/neutrino-proxy/config:/root/neutrino-proxy/config \
|
||||
-d --restart=always --name neutrino \
|
||||
registry.cn-hangzhou.aliyuncs.com/asgc/neutrino-proxy:latest
|
||||
```
|
||||
|
||||
### 1.2、使用jar包自行部署
|
||||
- 首先确保服务器上已安装java8运行环境
|
||||
- 打开[发行版页面](https://gitee.com/dromara/neutrino-proxy/releases),下载最新的release包:`neutrino-proxy-server.jar`、`neutrino-proxy-admin.zip`
|
||||
- 在服务器上新建部署目录:`/work/projects/neutrino-proxy-server`
|
||||
- 将` neutrino-proxy-server.jar`、`neutrino-proxy-admin.zip`上传至服务器部署目录。
|
||||
- 解压`neutrino-proxy-admin.zip`文件
|
||||
- 执行命令`java -Dfile.encoding=utf-8 -jar neutrino-proxy-server.jar`启动服务端完成部署,默认使用sqlite数据库。
|
||||
- 若需要指定自己的mysql数据库,同样的需要在当前目录下新建`app.yml`文件,文件内容同上。执行命令`java -Dfile.encoding=utf-8 -jar neutrino-proxy-server.jar config=app.yml`启动服务端完成部署
|
||||
- 可参照 https://gitee.com/dromara/neutrino-proxy/blob/master/scripts/unix/server_start.sh 使用shell脚本启动服务端。
|
||||
|
||||
## 2、管理后台配置
|
||||
- 服务端部署成功后,访问`http://{服务端IP}:8888`打开后台管理页面。
|
||||
- 使用默认的管理员帐号登录:admin/123456
|
||||
- 打开`代理配置>License管理`页面,可以看到系统已经自动为管理员初始化了一条License记录,复制该`LicenseKey`备用,后续客户端配置需要。
|
||||
- 打开`代理配置>端口映射`页面,可以看到系统已经自动为初始化了几条端口映射。可根据需要自行添加、修改。这里我们以`9101 -> 127.0.0.1:8080`映射为例
|
||||
|
||||
## 3、启动客户端
|
||||
- 首先确保本地已安装java8运行环境
|
||||
- 打开[发行版页面](https://gitee.com/dromara/neutrino-proxy/releases),下载最新的release包:`neutrino-proxy-client.jar`
|
||||
- 在本地`neutrino-proxy-client.jar`同级别目录下新建`app.yml`文件,并配置如下内容:
|
||||
```yml
|
||||
neutrino:
|
||||
proxy:
|
||||
tunnel:
|
||||
# ssl证书密钥(使用jjar包内自带的证书,则此处无需修改)
|
||||
key-store-password: 123456
|
||||
# ssl证书管理密钥(使用jjar包内自带的证书,则此处无需修改。自定义证书,则此处配置对应的路径)
|
||||
jks-path: classpath:/test.jks
|
||||
# 代理服务端IP
|
||||
server-ip: localhost
|
||||
# 代理服务端IP, 若是非ssl端口,则ssl-enable需要配置为false
|
||||
server-port: 9002
|
||||
# 是否启用ssl
|
||||
ssl-enable: true
|
||||
# licenseKey,客户端凭证。此处需要配置刚刚从管理后台复制的LicenseKey
|
||||
license-key: xxxx
|
||||
```
|
||||
- 执行命令`java -jar neutrino-proxy-client.jar config=app.yml`启动客户端
|
||||
- 查看服务端License管理,刷新页面,对应的License在线状态为`在线`,则表明客户端已正常连接。
|
||||
|
||||
## 4、代理验证
|
||||
- 本地启动被代理服务,如:redis、本地web项目、本地mysql等等
|
||||
- 先确保本地能正常访问被代理服务,如果本地都不能访问,不用想代理更不可能!!!
|
||||
- 通过服务端IP+9101(上面License配置的端口映射重的服务端端口)访问本地被代理服务
|
||||
|
||||
访问成功,至此首次完整的内网穿透体验完成。开源不易,请速至[Gitee仓库](https://gitee.com/dromara/neutrino-proxy)一键三连🤝
|
||||
|
||||
## 5、客户端Docker部署
|
||||
> 因为一些原因,官方不推荐客户端使用Docker方式部署,但有不少朋友希望采用这种方式,因此从1.9.0版本开始维护了客户端镜像,版本号同服务端,也可使用`latest`直接安装最新版。
|
||||
- 客户端镜像地址:registry.cn-hangzhou.aliyuncs.com/asgc/neutrino-proxy-client:latest
|
||||
- 注意:客户端采用docker部署时,服务端端口映射客户端ip请不要配置127.0.0.1应该配置为容器访问宿主机的ip或者hostname,具体请自行百度
|
||||
|
||||
<!--
|
||||
## 4.开发&调试
|
||||
|
||||
::: tip
|
||||
1. 不建议在原默认vuepress项目上单独安装使用本主题包,而是clone我的整个项目再替换你自己的内容即可。
|
||||
2. 修改`config.js`配置后需要重新启动项目才会生效。
|
||||
3. 更多关于项目上手的问题,请查阅 [问答](/pages/9cc27d/)。
|
||||
:::
|
||||
|
||||
|
||||
## 版本升级
|
||||
|
||||
主题的版本会不定期更新,你只需更新npm主题包即可:
|
||||
```sh
|
||||
npm update vuepress-theme-vdoing
|
||||
```
|
||||
|
||||
::: tip
|
||||
1. 如更新后没起作用或报错,尝试把`node_modules`文件夹删除再`npm i`重新安装。
|
||||
2. 在.vuepress/config.js中,设置`theme: 'vdoing'`才是使用npm主题依赖包:
|
||||
```js
|
||||
// config.js
|
||||
module.exports = {
|
||||
theme: 'vdoing', // npm主题依赖包
|
||||
// theme: require.resolve('../../vdoing'), // 使用本地主题包
|
||||
}
|
||||
```
|
||||
:::
|
||||
-->
|
||||
@@ -1,58 +0,0 @@
|
||||
---
|
||||
title: 常见问题汇总
|
||||
date: 2023-07-01 13:35:00
|
||||
permalink: /pages/a00001/
|
||||
---
|
||||
|
||||
## 1. 客户端启动后连不上服务端,一直在重连
|
||||
### 1.1. 启动日志包含`not found license-key config`相关字样
|
||||
出现这种情况,说明客户端没获取到配置的license,可按如下检查:
|
||||
- 客户端是否有配置app.yml,app.yml中是否有配置`license-key`
|
||||
- 客户端启动参数是否指定app.yml配置,若未指定客户端不会加载任何jar外部的配置文件
|
||||
- 客户端启动参数指定的配置文件路径是否正确?如:`java -jar neutrino-proxy-client.jar config=app.yml`,代表`app.yml`文件与jar在同级别目录下,如果不在同级别目录,请使用绝对/相对路径指定
|
||||
- 除此之外license还可以用以下方法直接在启动参数中指定:
|
||||
- `java -jar -DLICENSE_KEY=xxxx -DSERVER_IP=x.x.x.x -DSERVER_PORT=9000 -DSSL_ENABLE=false neutrino-proxy-client.jar`
|
||||
- `java -jar neutrino-proxy-client.jar serverIp=x.x.x.x serverPort=9000 sslEnable=false licenseKey=xxxx`
|
||||
|
||||
### 1.2. 配置文件确定都已经配置,且启动参数正确指定了,但是没有出现`认证成功日志`
|
||||
- 确认客户端配置的`server-ip`,必须是服务端所在机器的ip,且保证客户端所在机器能正常ping通
|
||||
- 确认客户端配置的`server-port`与`ssl-enable`,默认情况应配置为9000、false或9002、true,除非服务端app.yml有改动隧道对外端口
|
||||
- 确认服务端对外的9000、9002端口是否已经放开
|
||||
- 服务端如果采用docker部署,需要确保容器的9000、9002端口映射到宿主机
|
||||
|
||||
## 2. 关于中微子代理涉及的2类SSL证书
|
||||
### 2.1. HTTPS证书
|
||||
该证书用于服务端支持HTTPS,若需要在服务端`app.yml`中配置即可
|
||||
|
||||
### 2.2. 隧道SSL证书
|
||||
该证书用于对客户端-服务端之间的数据通信进行加密,因此客户端/服务端均需要配置该证书。可参考如下命令生成:
|
||||
```
|
||||
keytool -genkey -alias test1 -keyalg RSA -keysize 1024 -validity 3650 -keypass 123456 -storepass 123456 -keystore "./test.jks"
|
||||
```
|
||||
|
||||
## 3. 1.9.0 版本udp代理无效
|
||||
### 问题描述
|
||||
代理本地udp端口9231,公网访问代理端口无效,代理端口测试发送成功,但是本地服务没有收到,使用路由器的ddns功能也可以成功代理。
|
||||
### 解决方案
|
||||
+ 防火墙开放端口的时候一定要指定udp协议
|
||||
+ 还有如果想收到回复需要配置两个响应参数
|
||||
+ 响应数量根据实际响应数量配置,可以配置的大一些,但是不能比实际小
|
||||
+ 超时时间根据实际响应时间配置,比如正常响应时间是10s,这里就可以配置15000毫秒等
|
||||
<img :src="$withBase('/img/run-example/question_3_1.png')"></img>
|
||||
+ 相关链接:[1.9.0版本udp代理无效 · Issue #I83XOI · dromara/neutrino-proxy - Gitee.com](https://gitee.com/dromara/neutrino-proxy/issues/I83XOI)
|
||||
+ 贡献者:gitee:眉黛如画
|
||||
|
||||
## 4. Vue项目出现Invalid Host header 的解决方案
|
||||
### 问题描述
|
||||
内网穿透 Vue项目出现Invalid Host header 的解决方案
|
||||
### 解决方案
|
||||
manifest.json中配置
|
||||
```
|
||||
"h5":{
|
||||
"devServer":{
|
||||
"disableHostCheck":true
|
||||
}
|
||||
},
|
||||
```
|
||||
+ 相关链接:[内网穿透 Vue项目出现Invalid Host header 的解决方案](https://blog.csdn.net/weixin_41549915/article/details/96132925)
|
||||
+ 贡献者:wx:明天会更好
|
||||
@@ -17,8 +17,23 @@ 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 +59,4 @@ article: false
|
||||
- 登录日志:管理后端登录、退出登录的日志
|
||||
- 客户端连接日志:客户端连接、断开的日志
|
||||
|
||||
<img :src="$withBase('/img/run-example/login-log1.png')"></img>
|
||||
<img :src="$withBase('/img/run-example/login-log1.png')"></img>
|
||||
@@ -6,6 +6,7 @@ permalink: /pages/269a2e/
|
||||
|
||||
# 什么是域名映射?
|
||||
域名映射是将指定端口映射绑定到某一个子域名上,通过直接访问域名的方式,达到访问被代理服务的目的。
|
||||
支持维护多个主域名并为多个主域名配置不同的子域名实现域名映射。
|
||||
|
||||
# 域名映射能解决什么问题?
|
||||
- 1、当服务端端口需要经常变动的时候,可以通过固定域名的方式,使得开发调试能够长期稳定的进行,不用每次更改访问地址。
|
||||
@@ -17,8 +18,8 @@ permalink: /pages/269a2e/
|
||||
|
||||
## 情况1:代理服务端使用80端口
|
||||
- 1、DNS解析配置泛域名解析 proxy.asgc.fun 指向代理服务端IP
|
||||
- 2、代理服务端app.yml配置域名:proxy.asgc.fun,部署
|
||||
- 3、服务端管理后台新建端口映射,协议选择:HTTP,设置好子域名,如:test1
|
||||
- 2、服务端管理后台域名管理新建域名,如:asgc.fun
|
||||
- 3、服务端管理后台新建端口映射,协议选择:HTTP(S),选择主域名并设置好子域名,如:test1.proxy
|
||||
- 4、配置好客户端并启动,代理映射完成
|
||||
- 5、通过访问: http://test1.proxy.asgc.fun 实现访问被代理服务
|
||||
|
||||
@@ -27,8 +28,8 @@ permalink: /pages/269a2e/
|
||||
|
||||
- 1、DNS解析配置泛域名解析 proxy.asgc.fun 指向代理服务端IP
|
||||
- 2、nginx 80端口下将 *.proxy.asgc.fun 请求转到82端口,并附带原有请求头(特别是`Host`)
|
||||
- 3、代理服务端app.yml配置域名:proxy.asgc.fun,部署
|
||||
- 4、服务端管理后台新建端口映射,协议选择:HTTP,设置好子域名,如:test1
|
||||
- 3、服务端管理后台域名管理新建域名,如:asgc.fun
|
||||
- 4、服务端管理后台新建端口映射,协议选择:HTTP(S),设置好子域名,如:test1.proxy
|
||||
- 5、配置好客户端并启动,代理映射完成
|
||||
- 6、通过访问: http://test1.proxy.asgc.fun 实现访问被代理服务
|
||||
|
||||
@@ -36,6 +37,13 @@ permalink: /pages/269a2e/
|
||||
不行的。之所以能实现域名绑定,原因是HTTP请求附带了Host请求头,包含了请求的域名信息,代理服务端能根据请求的域名做分发。而TCP协议本身并不包含域名,因此无法实现。
|
||||
所以,目前只有HTTP(涵盖HTTPS)协议能支持。
|
||||
|
||||
# 域名映射支持HTTPS吗?
|
||||
支持的。在服务端管理后台-域名管理中新建域名并上传域名对应的服务器证书,可以选择强制HTTPS,这样会拦截所有HTTP请求,只支持通过HTTPS访问。
|
||||
如果上传后的证书仍不支持HTTPS访问,请确保上传证书有效并且和配置的主域名或完整域名映射匹配。
|
||||
|
||||
# 上传服务器证书的文件有要求吗?
|
||||
有的。目前只支持通过jks文件上传服务器证书,jks文件中只包含服务器证书(如:.cer文件),并设置密码。
|
||||
|
||||
# 代理服务端使用非80端口时,nginx配置示例
|
||||
```
|
||||
server {
|
||||
@@ -18,7 +18,8 @@ permalink: /pages/99a300/
|
||||
|
||||
## HTTPS配置流程
|
||||
- 按照域名映射流程,完成域名的配置
|
||||
- 在服务端配置域名的HTTPS证书信息(此处应该是通配符证书)
|
||||
- 在服务端管理后台上传对应域名的HTTPS证书信息(此处应该是通配符证书)
|
||||
|
||||
|
||||
## HTTPS端口问题
|
||||
- 与HTTP类似,HTTPS也有一个默认端口:443,默认情况下需要占用服务端443端口
|
||||
@@ -1,12 +1,12 @@
|
||||
---
|
||||
title: 服务端配置
|
||||
date: 2023-05-27 11:41:44
|
||||
date: 2024-09-22 11:41:44
|
||||
permalink: /pages/f2d0f1/
|
||||
---
|
||||
|
||||
::: tip
|
||||
|
||||
1.9.0版本,服务端配置格式有所调整。从之前的版本升级的,需要注意
|
||||
2.0.2版本,服务端配置格式有所调整。从之前的版本升级的,需要注意
|
||||
|
||||
:::
|
||||
|
||||
@@ -46,11 +46,6 @@ neutrino:
|
||||
http-proxy-port: ${HTTP_PROXY_PORT:80}
|
||||
# https代理端口,默认443 (需要配置域名、证书)
|
||||
https-proxy-port: ${HTTPS_PROXY_PORT:443}
|
||||
# 如果不配置,则不支持域名映射
|
||||
domain-name: ${DOMAIN_NAME:}
|
||||
# https证书配置
|
||||
key-store-password: ${HTTPS_STORE_PASS:}
|
||||
jks-path: ${HTTPS_JKS_PATH:}
|
||||
# 是否开启代理服务报文日志(日志级别为debug时开启才有效)
|
||||
transfer-log-enable: ${SERVER_LOG:false}
|
||||
udp:
|
||||
@@ -62,9 +57,9 @@ neutrino:
|
||||
data:
|
||||
db:
|
||||
# 数据库类型,目前支持sqlite、mysql、mariadb
|
||||
type: ${DB_TYPE:sqlite}
|
||||
type: ${DB_TYPE:h2}
|
||||
# 数据库连接URL
|
||||
url: ${DB_URL:jdbc:sqlite:data.db}
|
||||
url: ${DB_URL:jdbc:h2:file:./data/db;MODE=MySQL;AUTO_SERVER=TRUE}
|
||||
# 数据库用户名
|
||||
username: ${DB_USER:}
|
||||
# 数据库密码
|
||||
@@ -12,11 +12,13 @@ permalink: /pages/50ce10/
|
||||
|
||||
# 以下是最新的客户端配置格式(app.yml)
|
||||
```yml
|
||||
# 日志级别
|
||||
solon.logging.logger:
|
||||
"root":
|
||||
level: info
|
||||
|
||||
neutrino:
|
||||
proxy:
|
||||
logger:
|
||||
# 日志级别
|
||||
level: ${LOG_LEVEL:info}
|
||||
tunnel:
|
||||
# 线程池相关配置,用于技术调优,可忽略
|
||||
thread-count: 50
|
||||
@@ -35,6 +37,8 @@ neutrino:
|
||||
client-id: ${CLIENT_ID:}
|
||||
# 是否开启隧道传输报文日志(日志级别为debug时开启才有效)
|
||||
transfer-log-enable: ${CLIENT_LOG:false}
|
||||
# 是否开启心跳日志
|
||||
heartbeat-log-enable: ${HEARTBEAT_LOG:false}
|
||||
# 重连设置
|
||||
reconnection:
|
||||
# 重连间隔(秒)
|
||||
@@ -1,39 +0,0 @@
|
||||
---
|
||||
title: 项目结构
|
||||
date: 2020-05-11 13:54:56
|
||||
permalink: /pages/2f674a
|
||||
article: false
|
||||
---
|
||||
|
||||
# 主要目录、文件
|
||||
|
||||
```
|
||||
├── data.db (为配置mysql时,项目启动默认初始化生成的本地sqlite数据库文件)
|
||||
├── docs (项目相关的一些文档)
|
||||
├── neutrino-proxy-admin (管理后台前端项目,基于vue-element-admin)
|
||||
├── neutrino-proxy-client (基于netty的代理客户端,用于和服务端交互、转发内网数据)
|
||||
├── neutrino-proxy-core (代理相关的公共代码(协议、常量))
|
||||
├── neutrino-proxy-server (基于netty的代理服务端,用于和客户段交互,将客户端转发的内网数据转发至外网端口)
|
||||
└── todolist.MD (近期的开发计划)
|
||||
```
|
||||
|
||||
# 代理服务端 `neutrino-proxy-server`
|
||||
- base:基础的配置、初始化代码
|
||||
- constant:服务端常量、枚举定义
|
||||
- dal:持久层mapper、实体
|
||||
- job:定时任务执行入口
|
||||
- proxy:代理核心实现
|
||||
- service:基础业务
|
||||
- util:基础工具封装
|
||||
- resource/mapper:mybatis SQL文件
|
||||
- resource/sql:维护mysql/sqlite的初始化SQL、SQL变更记录
|
||||
- resource/app.yml:项目默认配置
|
||||
- resource/test.jks:默认的SSL证书
|
||||
|
||||
# 代理客户端 `neutrino-proxy-client`
|
||||
- config:基础配置
|
||||
- core:客户端代理核心入口
|
||||
- handler:客户端代理数据处理逻辑
|
||||
- util:基础工具封装
|
||||
- resource/app.yml:项目默认配置
|
||||
- resource/test.jks:默认的SSL证书
|
||||
@@ -1,15 +0,0 @@
|
||||
---
|
||||
title: 演示环境
|
||||
date: 2020-05-12 15:10:15
|
||||
permalink: /pages/db78e2
|
||||
article: false
|
||||
---
|
||||
|
||||
### 演示环境
|
||||
> 由于部分用户使用演示环境代理非法网站导致演示环境服务器被封禁,因此不再提供演示服务。
|
||||
|
||||
可使用分配好的游客license试用。服务器带宽较低,仅供学习使用!
|
||||
|
||||
管理后台地址:<a href="http://103.163.47.16:9527" target="_blank">http://103.163.47.16:9527</a>
|
||||
|
||||
游客账号:visitor/123456
|
||||
@@ -0,0 +1,20 @@
|
||||
---
|
||||
title: 客户端连接服务端失败
|
||||
date: 2023-10-25 17:55:20
|
||||
permalink: /pages/31d253/
|
||||
---
|
||||
|
||||
## 1.1. 启动日志包含`not found license-key config`相关字样
|
||||
出现这种情况,说明客户端没获取到配置的license,可按如下检查:
|
||||
- 客户端是否有配置app.yml,app.yml中是否有配置`license-key`
|
||||
- 客户端启动参数是否指定app.yml配置,若未指定客户端不会加载任何jar外部的配置文件
|
||||
- 客户端启动参数指定的配置文件路径是否正确?如:`java -jar neutrino-proxy-client.jar config=app.yml`,代表`app.yml`文件与jar在同级别目录下,如果不在同级别目录,请使用绝对/相对路径指定
|
||||
- 除此之外license还可以用以下方法直接在启动参数中指定:
|
||||
- `java -jar -DLICENSE_KEY=xxxx -DSERVER_IP=x.x.x.x -DSERVER_PORT=9000 -DSSL_ENABLE=false neutrino-proxy-client.jar`
|
||||
- `java -jar neutrino-proxy-client.jar serverIp=x.x.x.x serverPort=9000 sslEnable=false licenseKey=xxxx`
|
||||
|
||||
## 1.2. 配置文件确定都已经配置,且启动参数正确指定了,但是没有出现`认证成功日志`
|
||||
- 确认客户端配置的`server-ip`,必须是服务端所在机器的ip,且保证客户端所在机器能正常ping通
|
||||
- 确认客户端配置的`server-port`与`ssl-enable`,默认情况应配置为9000、false或9002、true,除非服务端app.yml有改动隧道对外端口
|
||||
- 确认服务端对外的9000、9002端口是否已经放开
|
||||
- 服务端如果采用docker部署,需要确保容器的9000、9002端口映射到宿主机
|
||||
@@ -0,0 +1,14 @@
|
||||
---
|
||||
title: 易混淆的2类证书
|
||||
date: 2023-10-25 17:56:59
|
||||
permalink: /pages/e4c3d7/
|
||||
---
|
||||
|
||||
## 2.1. HTTPS证书
|
||||
该证书用于服务端支持HTTPS,若需要在服务端`app.yml`中配置即可
|
||||
|
||||
## 2.2. 隧道SSL证书
|
||||
该证书用于对客户端-服务端之间的数据通信进行加密,因此客户端/服务端均需要配置该证书。可参考如下命令生成:
|
||||
```
|
||||
keytool -genkey -alias test1 -keyalg RSA -keysize 1024 -validity 3650 -keypass 123456 -storepass 123456 -keystore "./test.jks"
|
||||
```
|
||||
@@ -0,0 +1,16 @@
|
||||
---
|
||||
title: udp代理无效
|
||||
date: 2023-10-25 17:58:35
|
||||
permalink: /pages/7b990f/
|
||||
---
|
||||
|
||||
## 问题描述
|
||||
代理本地udp端口9231,公网访问代理端口无效,代理端口测试发送成功,但是本地服务没有收到,使用路由器的ddns功能也可以成功代理。
|
||||
## 解决方案
|
||||
+ 防火墙开放端口的时候一定要指定udp协议
|
||||
+ 还有如果想收到回复需要配置两个响应参数
|
||||
+ 响应数量根据实际响应数量配置,可以配置的大一些,但是不能比实际小
|
||||
+ 超时时间根据实际响应时间配置,比如正常响应时间是10s,这里就可以配置15000毫秒等
|
||||
<img :src="$withBase('/img/run-example/question_3_1.png')"></img>
|
||||
+ 相关链接:[1.9.0版本udp代理无效 · Issue #I83XOI · dromara/neutrino-proxy - Gitee.com](https://gitee.com/dromara/neutrino-proxy/issues/I83XOI)
|
||||
+ 贡献者:gitee:眉黛如画
|
||||
@@ -0,0 +1,19 @@
|
||||
---
|
||||
title: Vue项目出现Invalid Host header 的解决方案
|
||||
date: 2023-10-25 17:59:29
|
||||
permalink: /pages/441163/
|
||||
---
|
||||
|
||||
## 问题描述
|
||||
内网穿透 Vue项目出现Invalid Host header 的解决方案
|
||||
## 解决方案
|
||||
manifest.json中配置
|
||||
```
|
||||
"h5":{
|
||||
"devServer":{
|
||||
"disableHostCheck":true
|
||||
}
|
||||
},
|
||||
```
|
||||
+ 相关链接:[内网穿透 Vue项目出现Invalid Host header 的解决方案](https://blog.csdn.net/weixin_41549915/article/details/96132925)
|
||||
+ 贡献者:wx:明天会更好
|
||||
@@ -0,0 +1,8 @@
|
||||
---
|
||||
title: 服务端原声包启动,db初始化异常
|
||||
date: 2024-11-09 15:28:37
|
||||
permalink: /pages/7dcba8/
|
||||
---
|
||||
|
||||
## 1.1、报错“Data truncation: Data too long for column 'name' at row 1”
|
||||
配置文件中配置的mysql连接地址,去掉“characterEncoding=UTF-8”参数
|
||||
@@ -0,0 +1,39 @@
|
||||
---
|
||||
title: 个人赞赏
|
||||
date: 2023-10-26 13:08:02
|
||||
permalink: /pages/1ab20b/
|
||||
---
|
||||
|
||||
## 个人赞赏说明
|
||||
随着用户增加,需要协助解决的问题也多种多样,为了能给用户提供 `更优质`、`更准确` 的 疑难问题 解答我们推出赞赏咨询服务
|
||||
|
||||
| 赞赏金额 | 服务时长 | 服务说明 |
|
||||
|:-----|:-----|:----------------------|
|
||||
| 任意金额 | - | 您将获得赞助者列表的永久留名。 |
|
||||
| 30 | 一个月 | 您在群内反馈的问题将优先得到作者响应 |
|
||||
| 120 | 三个月 | 获得微信一对一的咨询服务 |
|
||||
| 399 | 六个月 | 获得官网首页特别赞助席位一个,一次远程协助 |
|
||||
| 更多金额 | - | 您将获得私人定制服务 |
|
||||
|
||||
> 注意1:服务项目是逐级叠加:如,您赞赏的金额是 80 员那么您将享受:任意金额、一个月、三个月的服务内容
|
||||
|
||||
> 注意2:二开问题不在个人赞赏支持服务范畴内,如需咨询二开问题或者二开方案请找作者协商
|
||||
|
||||
## 赞赏途径
|
||||
> 除4以外,赞赏后请及时通过官网首页微信二维码与作者取得联系
|
||||
|
||||
- 1、微信赞赏
|
||||
- 2、支付宝转账
|
||||
- 3、Gitee项目捐赠:[点击这里](https://gitee.com/dromara/neutrino-proxy)打开后拉到最底部点击捐赠
|
||||
- 4、微信好友转账
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td align="center">微信赞赏</td><td align="center">支付宝转账</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><img width="300px" src="./a1.png"></td><td><img width="300px" src="./a2.png"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -36,8 +36,8 @@ permalink: /pages/a3f096/
|
||||
- 注释完备,尤其每个新增的方法应按照Java文档规范标明方法说明、参数说明、返回值说明等信息,必要时请添加单元测试,如果愿意,也可以加上你的大名。
|
||||
- 原则上,不允许自行添加第三方依赖库。若确有必要,请先和项目负责人沟通达成一致。
|
||||
- 对现有代码的优化,请在注释中说明原因。
|
||||
- 如果涉及到数据库的变更,则至少需要做到以下绩点:
|
||||
- sqlite、mysql下均测试通过
|
||||
- 如果涉及到数据库的变更,则至少需要做到以下几点:
|
||||
- h2、mysql下均测试通过
|
||||
- 在`./neutrino-proxy-server/src/main/resource/sql`下维护更新对应的表结构sql文件
|
||||
- 对于新增的表,维护必要的初始化数据
|
||||
- 在对应的mysql、sqlite的update目录下,维护SQL变更记录,确保SQL执行测试通过
|
||||
- 在对应的mysql、h2的update目录下,维护SQL变更记录,确保SQL执行测试通过
|
||||
@@ -0,0 +1,28 @@
|
||||
---
|
||||
title: 项目结构
|
||||
date: 2020-05-11 13:54:56
|
||||
permalink: /pages/2f674a
|
||||
article: false
|
||||
---
|
||||
|
||||
# 主要目录、文件
|
||||
|
||||
```
|
||||
├── assets (资源文件)
|
||||
├── docs (项目相关的一些文档)
|
||||
├── neutrino-proxy-admin (管理后台前端项目,基于vue-element-admin)
|
||||
├── neutrino-proxy-client (基于netty的代理客户端,用于和服务端交互、转发内网数据)
|
||||
├── neutrino-proxy-core (代理相关的公共代码(协议、常量))
|
||||
├── neutrino-proxy-server (基于netty的代理服务端,用于和客户段交互,将客户端转发的内网数据转发至外网端口)
|
||||
├── neutrino-proxy-vuepress (中微子代理官网文档)
|
||||
├── scripts (常用的编译、打包脚本)
|
||||
├── Milestone.md (里程碑事件节点)
|
||||
├── VLog.md (版本变更记录)
|
||||
└── todolist.MD (近期的开发计划)
|
||||
```
|
||||
|
||||
# 代码分支说明
|
||||
- dev:常规开发分支,日常的开发、Bug修复、提交PR都在此分支
|
||||
- feature/xxx:特征分支,一些试验性开发、提交PR都在此分支,xxx可自行取一个有意义的名称
|
||||
- release/xxx:发行版分支,作为阶段性成果、重大更新的版本固化分支。受保护,不允许任何提交。
|
||||
- master:主分支,定期同步最新代码,目前仅支持本人(傲世孤尘/雨韵诗泽)提交。
|
||||
@@ -6,8 +6,24 @@ permalink: /pages/cded59/
|
||||
|
||||
| 日期 | 渠道 | 金额 |昵称| 备注 |
|
||||
|:-----------|:---|:-----|:-|:-----------------|
|
||||
|2023-10-11|微信红包|50|喜鸽小宝||
|
||||
|2023-10-10|微信红包|20|海洋||
|
||||
|2023-12-28|微信红包|50|雪猫|请大佬吃肯德基|
|
||||
|2023-12-27|微信红包|50|D|请大佬喝杯茶|
|
||||
|2023-12-25|微信赞赏码|30|Simen|伟大的项目,尽点绵薄之力|
|
||||
|2023-12-25|微信红包|50|KAI|大佬加油|
|
||||
|2023-12-22|微信赞赏|30|walking|好东西必须支持一下|
|
||||
|2023-12-21|微信红包|100|洗最大的碗|中微子越来越强大,雨哥越来越富有|
|
||||
|2023-12-15|Gitee捐助|10|一杯香梨||
|
||||
|2023-12-12|微信红包|50|喜鸽小宝||
|
||||
|2023-11-30|支付宝收款码|30|*平|大佬继续加油|
|
||||
|2023-11-30|Gitee捐助|10|26263|感谢您的开源项目!|
|
||||
|2023-11-30|微信红包|10|姫野永遠||
|
||||
| 2023-11-26 |微信转账|180|Teacher Du||
|
||||
| 2023-11-10 |微信红包|50|喜鸽小宝||
|
||||
| 2023-11-01 |微信红包|20|Sun|感谢大佬,请你喝杯奶茶[微笑]|
|
||||
| 2023-10-30 |微信赞赏|50|杨娃娃||
|
||||
| 2023-10-16 |微信转账|50|Mark Isaac赵方丈|金额不大,开源感恩。|
|
||||
| 2023-10-11 |微信红包|50|喜鸽小宝||
|
||||
| 2023-10-10 |微信红包|20|海洋||
|
||||
| 2023-07-31 |Gitee捐助| 50 |失败女神| 感谢您的开源项目! |
|
||||
| 2023-07-28 |微信转账| 50 |AdrianPteLtd.com-咨询| |
|
||||
| 2023-07-12 |微信红包| 100 |MaxKeyTop| 请大佬抽包烟 |
|
||||
@@ -0,0 +1,28 @@
|
||||
---
|
||||
title: 2024年
|
||||
date: 2024-04-16 19:22:05
|
||||
permalink: /pages/acdf0a/
|
||||
---
|
||||
|
||||
|
||||
| 日期 | 渠道 | 金额 |昵称| 备注 |
|
||||
|:-----------|:---|:-----|:-|:--------------------------------------|
|
||||
| 2024-11-19|支付宝收款码|2|*亮||
|
||||
| 2024-10-06 |Gitee捐助|100|碧云天|感谢您的开源项目!|
|
||||
| 2024-10-14 |微信红包|5|泛微eteams刘新东17699059661|
|
||||
| 2024-09-04 |Gitee捐助|8.88|lusen998|感谢您的开源项目!|
|
||||
| 2024-08-30 | 微信转账|100|吴忧吴虑|
|
||||
| 2024-07-29 |Gitee捐助|10|QuanJWS|感谢您的开源项目!看着很不错的样子,加油! |
|
||||
| 2024-07-29 |微信赞赏码|120|陈某| |
|
||||
| 2024-05-07 |微信转账|100|仲秀| |
|
||||
| 2024-04-16 |微信转账|100|暮光:城中城| |
|
||||
| 2024-04-03 |微信转账|100|仲秀| 大神,非常感谢 |
|
||||
| 2024-03-24 |Gitee捐助|10|include|
|
||||
| 2024-03-24 |微信赞赏码|9|宗| 麻烦了,最好能加一个返回公网IP。<br/>不知道有没有几乎通用的方案 |
|
||||
| 2024-03-22 |微信红包|20|不允| 请你吃外卖 |
|
||||
| 2024-03-12 |微信红包|50|喜鸽小宝|
|
||||
| 2024-02-12 |微信红包|50|喜鸽小宝|
|
||||
| 2024-02-02 |微信红包|38.88|不请自来君|
|
||||
| 2024-01-24 |Gitee捐助|30|唐吉诃德| 感谢您的开源项目!是一个不错的项目!<br/>希望继续完善界面UI的设计。 |
|
||||
| 2024-01-20 |微信红包|shiyongsway|8.88|
|
||||
| 2024-01-17 |微信红包|50|喜鸽小宝| |
|
||||
|
After Width: | Height: | Size: 418 KiB |
|
After Width: | Height: | Size: 296 KiB |
@@ -1,428 +0,0 @@
|
||||
---
|
||||
title: 案例
|
||||
date: 2020-05-14 11:39:45
|
||||
permalink: /pages/5d571c
|
||||
# sidebar: false
|
||||
article: false
|
||||
---
|
||||
## 特别用户
|
||||
::: cardImgList 3
|
||||
```yaml
|
||||
config:
|
||||
imgHeight: 140px
|
||||
|
||||
data:
|
||||
# - img: https://fastly.jsdelivr.net/gh/xugaoyi/image_store@master/blog/QQ20210729-233554@2x.22bdqeiem2sg.png
|
||||
# link: https://docs.openharmony.cn/pages/000000/
|
||||
# name: OpenHarmony
|
||||
# desc: 开放原子开源基金会
|
||||
# author: OpenHarmony
|
||||
# avatar: https://www.openharmony.cn/static/img/core-card-item2.a72a0d10.png
|
||||
- img: https://fastly.jsdelivr.net/gh/xugaoyi/image_store@master/blog/QQ20211215-144040.hgt2875r2zc.webp
|
||||
link: https://baomidou.com/
|
||||
name: MyBatis-Plus官网
|
||||
desc: 🚀为简化开发而生
|
||||
author: 青苗
|
||||
avatar: https://baomidou.com/img/logo.svg
|
||||
- img: https://fastly.jsdelivr.net/gh/xugaoyi/image_store@master/blog/QQ20210729-235804@2x.75e9lfd65t40.png
|
||||
link: https://docs.deepin.org
|
||||
name: Deepin 社区文档
|
||||
desc: Deepin 应用开发技术分享、DTK开发经验等
|
||||
author: Deepin
|
||||
avatar: https://fastly.jsdelivr.net/gh/xmuli/xmuliPic@pic/2021/deepin.png
|
||||
- img: https://ks3-cn-beijing.ksyuncs.com/vform-static/img/vform_website.png
|
||||
link: http://www.vform666.com
|
||||
name: VForm官网
|
||||
desc: 低代码表单优选方案,拖拽式设计,一键生成源码
|
||||
author: vformAdmin
|
||||
avatar: https://www.vform666.com/vform-logo.png
|
||||
- img: https://fastly.jsdelivr.net/gh/xugaoyi/blog-gitalk-comment@master/img/xxx.7feub7n1y0g0.png
|
||||
link: https://liteflow.yomahub.com
|
||||
name: LiteFlow官网
|
||||
desc: 轻量,快速,稳定可编排的组件式规则引擎
|
||||
author: 铂赛东
|
||||
avatar: https://portrait.gitee.com/uploads/avatars/user/367/1102362_bryan31_1578940308.png!avatar60
|
||||
- img: https://fastly.jsdelivr.net/gh/xugaoyi/blog-gitalk-comment@master/img/176866696-743faf44-4afd-4c12-9728-f982ea885836.2205nb3vf5mo.webp
|
||||
link: https://easy-es.cn/
|
||||
name: Easy-Es官网
|
||||
desc: 傻瓜级ElasticSearch搜索引擎ORM框架
|
||||
author: 老汉
|
||||
avatar: https://iknow.hs.net/9fa0407f-30ff-4d8b-82da-a4990e41a04b.png
|
||||
```
|
||||
:::
|
||||
|
||||
## 知识库兼博客
|
||||
::: cardImgList 4
|
||||
```yaml
|
||||
config:
|
||||
imgHeight: 140px
|
||||
|
||||
data:
|
||||
- img: https://fastly.jsdelivr.net/gh/xugaoyi/image_store/blog/20200530114033.png
|
||||
link: https://xugaoyi.com/
|
||||
name: Evan's blog
|
||||
desc: Web前端技术博客,积跬步以至千里,致敬每个爱学习的你。
|
||||
author: Evan Xu
|
||||
avatar: https://fastly.jsdelivr.net/gh/xugaoyi/image_store/blog/20200103123203.jpg
|
||||
- img: https://fastly.jsdelivr.net/gh/xugaoyi/image_store/blog/20200727170555.jpg
|
||||
link: https://miluluyo.github.io/vdoingBlog/
|
||||
name: 麋鹿鲁哟
|
||||
desc: 运气交给锦鲤,</br>你只管努力就好。 (●ˇ∀ˇ●)
|
||||
author: 麋鹿鲁哟
|
||||
avatar: https://fastly.jsdelivr.net/gh/xugaoyi/image_store/blog/20200122153807.jpg
|
||||
- img: https://i.loli.net/2020/07/26/BUCplirGIq9YTNA.png
|
||||
link: https://lingze.xyz/
|
||||
name: Lingze's blog
|
||||
desc: 少侠, 别来无恙?
|
||||
author: 令则
|
||||
avatar: https://i.loli.net/2020/07/11/XhqR7Idnk5LD8bC.jpg
|
||||
- img: https://fastly.jsdelivr.net/gh/xugaoyi/image_store@master/blog/QQ20210730-000829@2x.6pjgy10flk00.png
|
||||
link: https://www.xswsym.online/
|
||||
name: summer's blog
|
||||
desc: Devops运维技术博客,分享运维技术
|
||||
author: 夏苏文
|
||||
avatar: https://fastly.jsdelivr.net/gh/summerking1/image@main/tx.png
|
||||
- img: https://fastly.jsdelivr.net/gh/xugaoyi/image_store/blog/20201110221457.png
|
||||
link: https://gocifer.github.io
|
||||
name: Gocifer's DB & Blog
|
||||
desc: 一个中二少年,专注于计算机基础架构、云原生、网络、云计算的所学、所思、所行、所想。
|
||||
author: gocifer.jay
|
||||
avatar: https://gocifer.github.io/img/avatar/gocifer.png
|
||||
- img: https://dra-m.com/images/thumbnail.png
|
||||
link: https://dra-m.com/
|
||||
name: Dra-M
|
||||
desc: JAVA后端
|
||||
author: 莫小龙
|
||||
avatar: https://q1.qlogo.cn/g?b=qq&nk=975425198&s=640
|
||||
- img: https://fastly.jsdelivr.net/gh/xugaoyi/image_store/blog/20200905142134.png
|
||||
link: https://www.coder163.com/
|
||||
name: 跟着老侯玩编程
|
||||
desc: 一个乐于编程知识分享的站点
|
||||
author: 舞动的代码
|
||||
avatar: https://www.coder163.com/img/qun.png
|
||||
|
||||
- img: https://fastly.jsdelivr.net/gh/xugaoyi/image_store/blog/20210119213748.jpg
|
||||
link: https://haijunit.top/
|
||||
name: 学习笔记
|
||||
desc: 平时的技术积累|分享交流技术心得|温故而知新
|
||||
author: 爱做梦的奋斗青年
|
||||
avatar: https://haijunit.top/images/avatar.png
|
||||
- img: https://fastly.jsdelivr.net/gh/yxw839841231/images/studying-icu/20210120110320.png
|
||||
link: https://www.studying.icu/
|
||||
name: 研究院
|
||||
desc: 一万年太久,只争朝夕
|
||||
author: xwyang
|
||||
avatar: https://avatars1.githubusercontent.com/u/13757119?s=80&v=4
|
||||
- img: https://fastly.jsdelivr.net/gh/xugaoyi/image_store@master/blog/QQ20210704-230751@2x.3pw80u1fo6u0.png
|
||||
link: https://blog.kimen.com.cn/
|
||||
name: Kimen's Blog
|
||||
desc: 全沾攻城狮
|
||||
author: Kimen
|
||||
avatar: https://avatars.githubusercontent.com/u/25970284?s=460&u=69b419ad6de33eaa1d6b73d7f065f710076d6c55&v=4
|
||||
- img: https://fastly.jsdelivr.net/gh/xugaoyi/image_store@master/blog/QQ20211101-165045-(1).4b4axinii160.png
|
||||
link: https://lixianglong3210.gitee.io/xlong-vdoing/
|
||||
name: XLONG's blog
|
||||
desc: 蒸汽波、咖啡
|
||||
author: lixianglong3210
|
||||
avatar: http://www.lixianglong.cn/bg_store/img/avatar/default.jpg
|
||||
- img: https://fastly.jsdelivr.net/gh/Awrtiger/mirrorfile/img/web.png
|
||||
link: https://www.ool.cool/
|
||||
name: 偷吃了鸡蛋的梨
|
||||
desc: 捣鼓这,捣鼓那。
|
||||
author: Awrtiger
|
||||
avatar: https://fastly.jsdelivr.net/gh/Awrtiger/mirrorfile/img/avatar.jpg
|
||||
- img: https://image-1302577725.cos.ap-beijing.myqcloud.com/img/20210402183053.png
|
||||
link: https://f4de-bak.github.io/
|
||||
name: Xinghai's Blog
|
||||
desc: Web Security | Java Security
|
||||
author: Xinghai
|
||||
avatar: https://image-1302577725.cos.ap-beijing.myqcloud.com/img/20210328234543.jpg
|
||||
- img: https://fastly.jsdelivr.net/gh/xugaoyi/image_store@master/blog/eyjf.png
|
||||
link: https://wiki.eryajf.net
|
||||
name: 二丫讲梵
|
||||
desc: 学习,记录,分享。(运维生活编程)
|
||||
author: 二丫讲梵
|
||||
avatar: https://wiki.eryajf.net/img/logo.png
|
||||
- img: https://fastly.jsdelivr.net/gh/xugaoyi/image_store@master/blog/ss.2tev477ruza0.png
|
||||
link: https://masongsong.cn
|
||||
name: 松松的一尺三分地
|
||||
desc: 记录工作和学习中的所得
|
||||
author: masongsong
|
||||
avatar: https://fastly.jsdelivr.net/gh/MssText/learn@master/images/49203535.35emn5vryma0.png
|
||||
- img: https://fastly.jsdelivr.net/gh/Kele-Bingtang/static/user/20211218235045.png
|
||||
link: https://notes.youngkbt.cn/
|
||||
name: Young Kbt Blog
|
||||
desc: 记录学习Java, Web, 框架, 工具, 前端等相关知识, 记录生活和技术路程, 分享编程技巧。
|
||||
author: Ship Liu
|
||||
avatar: https://fastly.jsdelivr.net/gh/Kele-Bingtang/static/user/avatar2.png
|
||||
- img: https://fastly.jsdelivr.net/gh/xugaoyi/image_store@master/blog/123.57gcfayi85k0.webp
|
||||
link: https://blog.dragon1573.wang/
|
||||
name: 断桥烟雨の学习笔记
|
||||
desc: 学习爱我,我爱学习~
|
||||
author: べ断桥烟雨ミ
|
||||
avatar: https://avatars.githubusercontent.com/u/49941141
|
||||
- img: https://fastly.jsdelivr.net/gh/xugaoyi/blog-gitalk-comment@master/img/20220210094650.3q09d26tigc0.webp
|
||||
link: https://chuck6.github.io/blog/
|
||||
name: 梵一的博客
|
||||
desc: 个人博客和知识分享
|
||||
author: 梵一
|
||||
avatar: https://chuck6.github.io/blog/img/paizhao.jpg
|
||||
- img: https://fastly.jsdelivr.net/gh/niumoo/cdn-assets/2021/20220316145528.png
|
||||
link: https://www.wdbyte.com
|
||||
name: 未读代码
|
||||
desc: Java 开发知识库,分享原创文章
|
||||
author: 程序猿阿朗
|
||||
avatar: https://avatars.githubusercontent.com/u/26371673?v=4
|
||||
- img: https://fastly.jsdelivr.net/gh/simonzhangs/image-hosting@master/vue-plugin-example/blog.qg2buhe5h4g.webp
|
||||
link: https://simonzhangs.github.io/
|
||||
name: 松本松的博客儿
|
||||
desc: Web前端技术博客,积跬步以至千里。
|
||||
author: simonzhangs
|
||||
avatar: https://fastly.jsdelivr.net/gh/simonzhangs/image-hosting@master/20220319/image.4x708q9wzse0.webp
|
||||
- img: https://fastly.jsdelivr.net/gh/terwer/upload/img/image-20220422000045653.png
|
||||
link: http://terwergreen.com
|
||||
name: 远方的灯塔
|
||||
desc: 专注于服务端技术分享
|
||||
author: terwer
|
||||
avatar: https://fastly.jsdelivr.net/gh/terwer/upload/img/photo.jpg
|
||||
- img: https://fastly.jsdelivr.net/gh/nksuya/image_store@main/suyablog_home.5iou2ogjrm80.webp
|
||||
link: https://suyaspace.com/
|
||||
name: Suya's blog
|
||||
desc: 个人博客,分享技术文章,学习笔记,植物相关知识等。
|
||||
author: Suya
|
||||
avatar: https://fastly.jsdelivr.net/gh/nksuya/image_store@master/tech/avatar.2tycyyc1ebr4.jpg
|
||||
- img: https://fastly.jsdelivr.net/gh/xugaoyi/image_store2@master/img/QQ20220526-224620@2x.44o82ibj9qq0.png
|
||||
link: https://colorpanda.aifan.jp/
|
||||
name: ColorPanda
|
||||
desc: 日语中文英文学习网站
|
||||
author: ColorPanda
|
||||
avatar: https://fastly.jsdelivr.net/gh/xugaoyi/image_store2@master/img/image.3qr8m501tl20.png
|
||||
- img: https://fastly.jsdelivr.net/gh/xugaoyi/blog-gitalk-comment@master/img/asdf.23jsekfejla8.jpeg
|
||||
link: https://inannan423.github.io/
|
||||
name: Zihanio
|
||||
desc: Zihan的学习博客
|
||||
author: Zihan
|
||||
avatar: https://fastly.jsdelivr.net/gh/xugaoyi/blog-gitalk-comment@master/img/xxx.67b3ygadagk0.jpeg
|
||||
- img: https://user-images.githubusercontent.com/866409/175853573-28ded198-2348-4a82-8ddd-05088161e3fe.png
|
||||
link: https://xingcxb.com
|
||||
name: 不器小窝
|
||||
desc: 但知行好事,莫要问前程
|
||||
author: 不器
|
||||
avatar: https://avatars.githubusercontent.com/u/866409?v=4
|
||||
- img: https://cdn.staticaly.com/gh/xugaoyi/blog-gitalk-comment@master/img/QQ20220722-141037.22uk9ow7ary.png
|
||||
link: https://eryajf.github.io/vdoing-template/
|
||||
name: Vdoing主题博客模板
|
||||
desc: Vdoing主题博客模板
|
||||
author: eryajf
|
||||
avatar: https://cdn.staticaly.com/gh/xugaoyi/blog-gitalk-comment@master/img/33259379.277tur21ir40.jpeg
|
||||
- img: https://cdn.jsdelivr.net/gh/FireHH/github_img_repository/logo/微信截图_20220810164903.png
|
||||
link: https://javaessay.cn/
|
||||
name: Java essay
|
||||
desc: Java散文知识库,Spring全家桶,SpringCloud全家桶,高可用高并发架构,面试等
|
||||
author: Mr.Fire
|
||||
avatar: https://cdn.jsdelivr.net/gh/FireHH/github_img_repository/logo/huge.jpg
|
||||
- img: https://chendapeng.cn/images/about/blog_image.png
|
||||
link: https://chendapeng.cn
|
||||
name: 行百里er
|
||||
desc: Java,个人技术博客,后端开发,技术架构,分布式技术,Spring Cloud Alibaba,Elasticsearch,Redis,算法,数据结构,Git
|
||||
author: 行百里er
|
||||
avatar: https://chendapeng.cn/images/about/avatar.png
|
||||
- img: http://xyhwh-nav.cn/img/index.png
|
||||
link: http://xyhwh-nav.cn
|
||||
name: Captain
|
||||
desc: 学习技术,Java基础、面试知识点、项目经验总结和一些学习笔记
|
||||
author: Captain
|
||||
avatar: http://xyhwh-nav.cn/img/logo.png
|
||||
- img: https://xiaoxue-images.oss-cn-shenzhen.aliyuncs.com/blog/202212271108541.jpg
|
||||
link: https://blog.xueqimiao.com/
|
||||
name: 小薛博客
|
||||
desc: 小薛博客,专注IT技术分享,助力人人成为架构师
|
||||
author: xueqimiao
|
||||
avatar: https://xiaoxue-images.oss-cn-shenzhen.aliyuncs.com/blog/202212271110209.png
|
||||
- img: https://cdn.jsdelivr.net/gh/su-dd/cdn/博客/202301311644669.png
|
||||
link: https://blog.addai.cn/
|
||||
name: 呆呆的博客
|
||||
desc: 个人博客
|
||||
author: 呆呆
|
||||
avatar: https://cdn.addai.cn/博客/网站使用/呆呆.webp
|
||||
- img: https://raw.githubusercontent.com/jorgen-zhao/blog/master/images/snapshot.png
|
||||
link: https://jorgen.website
|
||||
name: Jorgen's blog
|
||||
desc: 🚀个人知识库兼博客🚀
|
||||
author: jorgen
|
||||
avatar: https://jorgen.website/img/avatar.jpg
|
||||
```
|
||||
:::
|
||||
|
||||
## 知识库
|
||||
::: cardImgList 4
|
||||
```yaml
|
||||
config:
|
||||
imgHeight: 150px
|
||||
|
||||
data:
|
||||
- img: https://fastly.jsdelivr.net/gh/xugaoyi/image_store/blog/20200530114035.png
|
||||
link: https://xugaoyi.github.io/vdoing-demo-repository/
|
||||
name: 知识库演示
|
||||
desc: Vdoing主题演示-知识库
|
||||
author: Evan Xu
|
||||
avatar: https://fastly.jsdelivr.net/gh/xugaoyi/image_store/blog/20200103123203.jpg
|
||||
- img: https://fastly.jsdelivr.net/gh/xugaoyi/image_store/blog/20201219205536.jpg
|
||||
link: https://wiki.router86.com/
|
||||
name: X86软路由和NAS
|
||||
desc: 记录X86软路由和NAS的一些知识
|
||||
author: MonoLogueChi
|
||||
avatar: https://blog.xxwhite.com/assets/img/avatar.jpg
|
||||
- img: https://fastly.jsdelivr.net/gh/xugaoyi/image_store/blog/20201219205318.jpg
|
||||
link: https://blog.northword.cn/dft-learning
|
||||
name: 计算模拟学习笔记
|
||||
desc: 《能源环境材料计算模拟方法》学习笔记,涉及密度泛函理论、第一性原理等和Materials Studio、VASP等的使用。
|
||||
author: Northword
|
||||
avatar: https://storage.live.com/items/28C1032A24A9C53B!25785?authkey=AHAx3GOYEKGqm8I
|
||||
- img: https://singerwimg-1300001977.cos.accelerate.myqcloud.com/20211008/WccSrJ0s.png
|
||||
link: https://repository.singerw.com
|
||||
name: Singerw's Repository
|
||||
desc: 技术的风花雪月之事,有个存档的地方,对于复盘,回忆,都是一个极好的方谭。
|
||||
author: Singerw
|
||||
avatar: https://singerwimg-1300001977.cos.accelerate.myqcloud.com/2021/09/20/76f29482ffc9b.png
|
||||
- img: https://fastly.jsdelivr.net/gh/xugaoyi/image_store@master/QQ20220113-114927.5oha7j06c580.webp
|
||||
link: https://hippox.cn
|
||||
name: hippo4j
|
||||
desc: 🔥 动态线程池框架,附带监控报警功能,轻量级的运维监控平台
|
||||
author: Acmenlt
|
||||
avatar: https://hippox.cn/img/web.png
|
||||
- img: https://pics.landcover100.com/pics/624e63f4c82b8.png
|
||||
link: https://www.gisrsdata.com
|
||||
name: 地信遥感数据汇
|
||||
desc: 解决目前地信遥感方向数据混杂,资源难以寻找的问题,构建一个地信遥感学习、讨论、交流的平台。
|
||||
author: 锐多宝
|
||||
avatar: https://pics.landcover100.com/pics/624e6469cbb8a.jpg
|
||||
- img: https://img.de7v.com/img/site-pic.jpg
|
||||
link: https://www.de7v.com
|
||||
name: De7v
|
||||
desc: 专注于安卓领域的技术传播
|
||||
author: wresource
|
||||
avatar: https://img.de7v.com/img/wresource.png
|
||||
- img: https://cdn.staticaly.com/gh/xugaoyi/blog-gitalk-comment@master/img/11123.1aljpnjyr074.png
|
||||
link: https://eryajf.github.io/HowToStartOpenSource/
|
||||
name: HowToStartOpenSource
|
||||
desc: GitHub开源项目维护协作指南
|
||||
author: eryajf
|
||||
avatar: https://cdn.staticaly.com/gh/xugaoyi/blog-gitalk-comment@master/img/33259379.277tur21ir40.jpeg
|
||||
```
|
||||
:::
|
||||
## 社区类
|
||||
:::cardImgList
|
||||
```yaml
|
||||
config:
|
||||
imgHeight: 150px
|
||||
|
||||
data:
|
||||
- img: https://fastly.jsdelivr.net/gh/xugaoyi/image_store/blog/20200921220111.png
|
||||
link: https://course.yiwiz.com/
|
||||
name: 奕维投资教程站
|
||||
desc: 股票投资
|
||||
author: 奕维
|
||||
avatar: https://course.yiwiz.com/img/logo.png
|
||||
```
|
||||
:::
|
||||
|
||||
## 博客类
|
||||
::: cardImgList
|
||||
```yaml
|
||||
config:
|
||||
imgHeight: 150px
|
||||
|
||||
data:
|
||||
- img: https://fastly.jsdelivr.net/gh/xugaoyi/image_store/blog/20200530114034.png
|
||||
link: https://xugaoyi.github.io/vdoing-demo-blog/
|
||||
name: Vdoing's blog
|
||||
desc: Vdoing主题演示-博客
|
||||
author: Evan Xu
|
||||
avatar: https://fastly.jsdelivr.net/gh/xugaoyi/image_store/blog/20200103123203.jpg
|
||||
- img: https://s4.ax1x.com/2022/02/25/bAjINF.png
|
||||
link: https://fangweilong.github.io/
|
||||
name: Teler的日常
|
||||
desc: 好好学习,天天向上
|
||||
author: Teler
|
||||
avatar: https://s4.ax1x.com/2022/02/25/bAva8J.jpg
|
||||
- img: https://user-images.githubusercontent.com/53399655/163007243-1b99b96b-cac3-49ca-9950-03a1e877a6d8.png
|
||||
link: https://xustudyxu.github.io/
|
||||
name: xustudyxu's Blog
|
||||
desc: 一起学习编程!
|
||||
author: xustudyxu
|
||||
avatar: https://xustudyxu.github.io/img/01.png
|
||||
```
|
||||
:::
|
||||
|
||||
## 文档类
|
||||
::: cardImgList 4
|
||||
```yaml
|
||||
config:
|
||||
imgHeight: 150px
|
||||
|
||||
data:
|
||||
- img: https://fastly.jsdelivr.net/gh/xugaoyi/image_store/blog/20200530114036.png
|
||||
link: https://xugaoyi.github.io/vuepress-theme-vdoing-doc/
|
||||
name: vdoing(本站)
|
||||
desc: 🚀一款简洁高效的VuePress 知识管理&博客 主题
|
||||
author: Evan Xu
|
||||
avatar: https://fastly.jsdelivr.net/gh/xugaoyi/image_store/blog/20200103123203.jpg
|
||||
- img: https://fastly.jsdelivr.net/gh/xugaoyi/image_store@master/blog/QQ20210925-124836@2x (1).6ogvf85maog0.png
|
||||
link: https://justauth.plus/
|
||||
name: JA Plus 开发者文档
|
||||
desc: 一款开源的登录认证中间件
|
||||
author: yadong,zhang
|
||||
avatar: https://portrait.gitee.com/uploads/avatars/user/261/784199_yadong.zhang_1578932767.png!avatar200
|
||||
- img: https://assets.imgradeone.com/docsdokimod-pv.png
|
||||
link: https://docs.dokimod.cn
|
||||
name: DokiMod 开发文档
|
||||
desc: 为 DDLC Mod 开发提供的完善文档
|
||||
author: imgradeone
|
||||
avatar: https://docs.dokimod.cn/logo_128x128.png
|
||||
# - img: http://yogoyun.oss-cn-beijing.aliyuncs.com/help/public/other/20200630125515.png
|
||||
# link: http://help.yogoyun.com/
|
||||
# name: 柚果云服务
|
||||
# desc: 智能商业应用程序服务商。
|
||||
# author: 柚果云服务
|
||||
# avatar: http://yogoyun.oss-cn-beijing.aliyuncs.com/admin/console/logo.png
|
||||
- img: https://jeesite.com/docs/img/docs.png
|
||||
link: http://docs.jeesite.com
|
||||
name: JeeSite 在线文档
|
||||
desc: JeeSite 快速开发平台 - 在线文档
|
||||
author: ThinkGem
|
||||
avatar: https://jeesite.com/docs/img/logo.png
|
||||
- img: https://fastly.jsdelivr.net/gh/dreamncn/picBed@master/uPic/2022_05_12_20_40_04_1652359204_1652359204449_9mVkaR.png
|
||||
link: https://cleanphp.ankio.net/
|
||||
name: CleanPHP
|
||||
desc: CleanPHP开发者文档
|
||||
author: ankio
|
||||
avatar: https://fastly.jsdelivr.net/gh/dreamncn/picBed@master/uPic/2022_04_04_19_48_51_1649072931_1649072931346_h4BGpQ.jpg
|
||||
- img: https://cdn.staticaly.com/gh/xugaoyi/blog-gitalk-comment@master/img/28284d.56bkx9qvhc00.webp
|
||||
link: https://jpom-docs.keepbx.cn/
|
||||
name: Jpom
|
||||
desc: 简而轻的低侵入式在线构建、自动部署、日常运维、项目监控软件
|
||||
author: 不忘初心
|
||||
avatar: https://jpom-docs.keepbx.cn/images/jpom_logo.png
|
||||
- img: https://wumei.live/kerwincui/document/raw/branch/master/images/img.png
|
||||
link: https://wumei.live/doc/
|
||||
name: 物美智能
|
||||
desc: 物美智能开源物联网平台,简单易用,可用于搭建物联网平台以及二次开发和学习。适用于智能家居、智慧办公、智慧社区、农业监测、水利监测、工业控制等。
|
||||
author: 随遇而安 / kerwincui
|
||||
avatar: https://portrait.gitee.com/uploads/avatars/user/611/1834441_kerwincui_1581523162.png!avatar200
|
||||
- img: https://pic.imgdb.cn/item/637c92ef16f2c2beb11293c7.jpg
|
||||
link: https://trace-recorder.xusc.cn
|
||||
name: trace-recorder官网
|
||||
desc: 简单的, 可伸缩的, 高性能的跟踪记录仪
|
||||
author: 蔡旺
|
||||
avatar: https://pic.imgdb.cn/item/637c933516f2c2beb112ed43.jpg
|
||||
```
|
||||
:::
|
||||
|
||||
</br></br>
|
||||
|
||||
## 申请加入案例
|
||||
|
||||
::: tip 你想在这个页面展示你的站点吗?
|
||||
欢迎使用Vdoing主题的小伙伴到 [**这里**](https://github.com/xugaoyi/vuepress-theme-vdoing/issues/new?assignees=&labels=&template=+join_case.md) 留下你的站点信息,你的站点将有机会出现在这个页面里~
|
||||
:::
|
||||
@@ -0,0 +1,21 @@
|
||||
---
|
||||
title: 企业登记案例
|
||||
date: 2020-05-14 11:39:45
|
||||
permalink: /pages/5d571c
|
||||
---
|
||||
|
||||
## 企业登记
|
||||
如果您所在的企业使用到了中微子代理,麻烦抽出宝贵的时间[点击这里](https://gitee.com/dromara/neutrino-proxy/issues/I6WC71)进行登记,这将会助力中微子代理走得更远。
|
||||
|
||||
## 案例展示
|
||||
|企业名称| logo | 官网地址 | 使用人数 |用途|
|
||||
|:-|:-----------------------------------------------------------------------------------------------------------|:-------------------------|:-----|:-|
|
||||
|北京吉威空间信息股份有限公司|  | http://www.geoway.com.cn | 10 |开发环境的session会话同步与开发环境的对接测试华为云与微信等云端回调接口|
|
||||
|悦邻供应链科技有限公司|| https://yinghecloud.com | 10 |开发及生产环境内网服务器VPN搭建,本地开发服务端口调试|
|
||||
|阿依瓦(北京)技术有限公司|| https://www.alva.com.cn | 50 |开发及生产环境内网服务器VPN搭建,本地开发服务端口调试,云端同步数据等|
|
||||
|常州裕景信息科技有限公司|| 无 | 5 |远程管理虚拟机,接口、数据库等功能调试|
|
||||
|湖北楚商联盟金融信息服务有限公司|| http://www.chually.cn | 10 |开发及生产环境内网服务器VPN搭建,本地开发服务端口调试,云端同步数据等|
|
||||
|中科元景智能(深圳)有限公司|| https://yjupi.com | 20 |本地开发连接测试环境及生产环境内网服务器,包含数据库、redis、模块服务等|
|
||||
|长沙小蜂科技有限公司|| 无 | 1~3人 |主要用于测试环境内网服务器,包含数据库,远程桌面等|
|
||||
|江西六湛科技|| http://www.liuzhankj.com | 12 |主要用于部署一些使用时长较短的项目|
|
||||
|杭州艾佳智能科技有限公司|| http://www.ajaiot.com | 12-16人 |公司部分设备是通过udp通信的,对接调试设备,搭建测试环境服务网关的时候需要|
|
||||
@@ -0,0 +1,46 @@
|
||||
---
|
||||
title: 2.x
|
||||
date: 2023-10-26 17:43:43
|
||||
permalink: /pages/ff3519/
|
||||
---
|
||||
|
||||
## 2.0.3
|
||||
- 紧急bug修复:解决http请求拆包情况下域名映射失效的问题
|
||||
|
||||
## 2.0.2
|
||||
- bug修复
|
||||
- 解决安全组在ipv6场景下误拦截导致域名映射访问不通的问题
|
||||
- 解决native编译后,端口池批量删除报错的问题
|
||||
- 解决客户端docker方式部署环境变量指定参数不生效的问题
|
||||
- 服务端解决native下清理日志定时任务报错的问题
|
||||
- 解决后台分页查询的已知问题
|
||||
- 端口映射中的客户端ip字段加长一点,解决配置阿里云数据库域名字段不够的问题
|
||||
- 解决服务端native部署时,访问后台用户列表,日志警告“you should use: nativeMetadata.registerField(field) at aot runtime”的问题
|
||||
- 新增功能
|
||||
- 新增后台域名管理,⽀持新增、修改、删除、禁⽤主域名,支持添加多级域名。
|
||||
- 域名管理支持上传域名对应的SSL证书、⽀持设置强制HTTPS、⽀持域名映射⾃动加载对应的服务器证书。
|
||||
- 端口映射支持选择切换不同的主域名,⽀持绑定多个⼦域名,单个端⼝⽀持绑定多个不同的主域名。
|
||||
- 升级须知:
|
||||
- **域名和SSL证书的配置由配置文件配置改为后台域名管理页面配置。**
|
||||
- 去掉了配置文件声明服务器端域名和证书的方式,改为通过页面进行管理,请注意自行进行数据迁移。
|
||||
- 数据库新增`域名表`和`域名映射中间表`,修改了`端口映射表`,涉及到表结构变更,执行[增量SQL](https://gitee.com/dromara/neutrino-proxy/blob/master/neutrino-proxy-server/src/main/resources/sql/mysql/update/UPDATE-20240808.SQL)
|
||||
|
||||
## 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
|
||||
- 支持原生编译改造
|
||||
- 默认支持的数据库由sqlite改为h2
|
||||
- 升级须知:
|
||||
- jdk版本升级为了jdk17,jar部署时请注意
|
||||
- 去掉了默认的sqlite数据库,改为了h2。如果之前使用sqlite,请自行处理数据迁移
|
||||
- 配置文件做了较大调整,请参照官网使用须知中的`服务端配置`、`客户端配置`进行更新
|
||||
@@ -0,0 +1,72 @@
|
||||
---
|
||||
title: 1.x
|
||||
date: 2023-10-26 17:43:34
|
||||
permalink: /pages/dda8e5/
|
||||
---
|
||||
|
||||
## 1.9.0
|
||||
- 端口映射支持UDP协议
|
||||
- 端口映射HTTP(S)新增打开网页按钮,优先使用域名打开
|
||||
- 新增/编辑端口映射时端口占用检测功能屏蔽,解决docker下使用的各种问题
|
||||
|
||||
## 1.8.6
|
||||
- 端口映射选择端口支持分页
|
||||
- 新增/更新端口映射,增加端口占用检测(端口映射编辑时,如果端口号没有变动,则不验证。避免出现端口映射正在使用时,无法更新端口映射其他信息的问题)
|
||||
- 下拉搜索license,支持模糊搜索
|
||||
- license下拉用户搜索,支持模糊搜索
|
||||
- 端口映射HTTP(S)新增打开网页按钮
|
||||
- 客户端断开连接时,记录日志空指针异常问题修复
|
||||
|
||||
## 1.8.5
|
||||
- 后台端口池管理支持批量删除
|
||||
- 端口映射下拉选择端口支持搜索
|
||||
- 客户端/服务端配置增加心跳日志开关,有需要时开启,方便排查问题
|
||||
- 客户端/服务端读写超时逻辑微调
|
||||
|
||||
## 1.8.4
|
||||
- 增加对mariadb的支持
|
||||
- 服务端/客户端,支持配置文件、启动参数指定日志级别
|
||||
- 客户端支持配置文件指定重连间隔,是否开启无限重连
|
||||
|
||||
## 1.8.3
|
||||
- 客户端重连优化
|
||||
- 服务端验证客户端身份逻辑优化
|
||||
|
||||
## 1.8.2
|
||||
- 增加HTTPS的支持。
|
||||
|
||||
## 1.8.0
|
||||
- 端口映射支持选择协议
|
||||
- HTTP协议下映射支持配置子域名(前提是server端配置了域名)
|
||||
|
||||
## 1.7.1
|
||||
- 针对管理后台各页面的排序、搜索条件的优化
|
||||
- 增加端口池分组、相关的端口映射优化
|
||||
- 增加了报表管理模块:用户流量报表、license流量报表、用户流量月度明细、license流量月度明细
|
||||
- 完成首页图表展示:license统计、端口映射统计、今日流量统计、汇总流量统计、最近15日流量折线图
|
||||
|
||||
## 1.7.0
|
||||
- 底层框架更换为Solon + MybatisPlus
|
||||
|
||||
## 1.6.4
|
||||
- 支持代理服务端用户(删除/禁用)、端口池(删除/禁用/启用)、License(删除/禁用/启用)、端口映射(新增/删除/禁用/启用)实时生效
|
||||
- 启动参数优化
|
||||
- 服务端静态资源服务支持缓存、gzip压缩,提升响应速度
|
||||
|
||||
## 1.6.0
|
||||
- 新增日志管理模块,调度日志迁移至日志管理
|
||||
- 管理后台新增登录日志
|
||||
- 新增首页流量统计
|
||||
|
||||
## 1.5.0
|
||||
- 管理后台新增用户管理、License管理、端口映射、调度管理、客户端连接日志、调度日志
|
||||
- 支持默认sqlite数据库
|
||||
- 底层框架Aop、Banner、SqlMapper、Ioc、@Value注解、Yml配置加载、静态资源服务等优化
|
||||
- 底层框架新增@Async、@Singleton等注解
|
||||
- 新增AsgcCompiler、ApplicationEvent机制封装
|
||||
|
||||
## 1.0.0
|
||||
> 第一个基本可用版本
|
||||
- 基于自研底层应用框架、Netty
|
||||
- 纯配置实现、无管理后台
|
||||
- 支持TCP代理
|
||||
@@ -0,0 +1,28 @@
|
||||
---
|
||||
title: 里程碑
|
||||
date: 2023-10-26 17:41:26
|
||||
permalink: /pages/e406dd/
|
||||
---
|
||||
- 2025-08-14 中微子代理Gitee Star数突破2000
|
||||
- 2024-12-20 中微子代理服务端支持宝塔面板一件部署
|
||||
- 2024-12-10 2.0.2版本发布,新增域名管理,端口映射支持绑定多个域名
|
||||
- 2024-08-12 中微子代理Gitcode 荣获G-Star认证
|
||||
- 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协议
|
||||
- 2023-09-07 1.8.6版本发布,后台若干细节优化
|
||||
- 2023-07-04 1.8.5版本发布,后台若干细节优化、配置文件优化
|
||||
- 2023-06-08 1.8.4版本发布,增加对mariadb的支持、配置文件支持指定日志级别、重连参数
|
||||
- 2023-06-03 1.8.3版本发布,客户端重连优化、服务端验证客户端身份逻辑优化
|
||||
- 2023-05-27 1.8.2版本发布,增加HTTPS支持
|
||||
- 2023-04-03 1.8.0版本发布,端口映射支持选择协议,HTTP映射支持子域名
|
||||
- 2023-03-26 1.7.1版本发布,新增端口池分组、新增报表管理模块、首页图表优化
|
||||
- 2023-03-12 1.7.0版本发布,底层框架更换为Solon + MybatisPlus
|
||||
- 2023-02-23 1.6.4版本发布,管理后台增、删、改、禁用实时生效,启动参数、GZip优化
|
||||
- 2023-01-16 加入Dromara组织
|
||||
- 2023-01-08 中微子代理Gitee Star突破100
|
||||
- 2022-11-23 1.6.0版本发布,新增日志管理模块,新增首页流量统计
|
||||
- 2022-10-12 1.5.0版本发布,底层框架优化,新增管理后台
|
||||
- 2022-06-16 1.0.0版本发布,基于自研应用框架、纯配置无管理后台
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
---
|
||||
title: 最近更新
|
||||
date: 2020-05-25 12:01:52
|
||||
permalink: /pages/9cc27d
|
||||
# sidebar: false
|
||||
article: false
|
||||
---
|
||||
|
||||
# TODO
|
||||
|
||||
### 1.x剩余规划
|
||||
- [ ] 参考鹊桥,增加对域名的支持
|
||||
- [ ] 官网上线
|
||||
|
||||
#### Bug
|
||||
- windows环境下直接运行发布版的jar包,日志输出乱码
|
||||
- 代理mysql时,使用未开启远程访问的账号走代理访问mysql,代理客户端出现断开现象
|
||||
|
||||
### 2.x规划
|
||||
- 插件开发
|
||||
- [ ] neutrino-proxy-solon-plugin
|
||||
- [ ] neutrino-proxy-jetbrains-plugin
|
||||
- [ ] neutrino-proxy-starter (SpringBoot)
|
||||
- 基础优化
|
||||
- [ ] 支持批量端口映射
|
||||
- [ ] 代理协议规范化,方便后续更好扩展、支持不同语言客户端接入
|
||||
- 监控运维
|
||||
- [ ] 监控服务端状态
|
||||
- [ ] 支持调整服务端端口、证书
|
||||
- [ ] 服务端版本、协议版本、客户端版本管理
|
||||
- [ ] 服务端日志
|
||||
- client+计划启动
|
||||
- [ ] 安卓客户端
|
||||
- [ ] 基于electron-egg的多平台客户端
|
||||
|
||||
### 3.x规划
|
||||
- [ ] 支持针对用户限速、限流
|
||||
- [ ] 支持P2P穿透
|
||||
- [ ] 支持原生编译
|
||||
@@ -1,45 +0,0 @@
|
||||
---
|
||||
title: 如何贡献
|
||||
date: 2023-03-29 12:55:44
|
||||
permalink: /pages/69a632/
|
||||
---
|
||||
# 🎋代码分支说明
|
||||
- dev:常规开发分支,日常的开发、Bug修复、提交PR都在此分支
|
||||
- feature/xxx:特征分支,一些试验性开发、提交PR都在此分支,xxx可自行取一个有意义的名称
|
||||
- release/xxx:发行版分支,作为阶段性成果、重大更新的版本固化分支。受保护,不允许任何提交。
|
||||
- master:主分支,定期同步最新代码,目前仅支持本人(傲世孤尘/雨韵诗泽)提交。
|
||||
|
||||
|
||||
# ✊贡献的方式
|
||||
包括,但不限于以下形式:
|
||||
- 提交[issues](https://gitee.com/dromara/neutrino-proxy/issues)
|
||||
- 参与[issues](https://gitee.com/dromara/neutrino-proxy/issues)解决的必要性、解决方案的讨论、给出建设性的意见
|
||||
- 领取[issues](https://gitee.com/dromara/neutrino-proxy/issues) 并完成开发、提交PR
|
||||
- 为[本项目](https://gitee.com/dromara/neutrino-proxy)完善代码注释
|
||||
- 为[本项目](https://gitee.com/dromara/neutrino-proxy)增加测试代码
|
||||
- 为[本项目](https://gitee.com/dromara/neutrino-proxy)优化现有代码
|
||||
- 为[本项目](https://gitee.com/dromara/neutrino-proxy)优化操作体验
|
||||
- 通过公众号、博客、贴吧、论坛等形式分享/宣传中微子代理
|
||||
- 丰富项目文档,包括使用过程中踩过的坑、需要优化的点、具体问题的解决方法等
|
||||
|
||||
# 🧬贡献代码的步骤
|
||||
- 在Gitee或者Github上fork项目到自己的repo,fork,一定要把项目fork一份。
|
||||
- 把fork过去的项目也就是你的项目clone到你的本地
|
||||
- 同步feature/1.7.1最新代码
|
||||
- 修改代码
|
||||
- 开发完成后,不忙着提PR,再拉一遍最新代码,如果有冲突、解决冲突
|
||||
- commit后push到自己的库
|
||||
- 登录Gitee在你首页可以看到一个 pull request 按钮,点击它,填写一些说明信息,然后提交即可。
|
||||
- 等待维护者合并
|
||||
|
||||
# 📐PR的规范
|
||||
> 你可能发现有的代码并不符合这个规范,但我们后续都会朝着这个方向迈进。后续我们会逐步全面规范化,请先保证新提交的代码满足以下要求:
|
||||
|
||||
- 注释完备,尤其每个新增的方法应按照Java文档规范标明方法说明、参数说明、返回值说明等信息,必要时请添加单元测试,如果愿意,也可以加上你的大名。
|
||||
- 原则上,不允许自行添加第三方依赖库。若确有必要,请先和项目负责人沟通达成一致。
|
||||
- 对现有代码的优化,请在注释中说明原因。
|
||||
- 如果涉及到数据库的变更,则至少需要做到以下绩点:
|
||||
- sqlite、mysql下均测试通过
|
||||
- 在`./neutrino-proxy-server/src/main/resource/sql`下维护更新对应的表结构sql文件
|
||||
- 对于新增的表,维护必要的初始化数据
|
||||
- 在对应的mysql、sqlite的update目录下,维护SQL变更记录,确保SQL执行测试通过
|
||||
@@ -13,20 +13,20 @@ 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一键部署。
|
||||
details: 服务端/客户端支持Docker一键部署。
|
||||
- title: 隧道SSL加密
|
||||
details: 隧道通信支持SSL,保护您的数据安全
|
||||
- title: HTTPS
|
||||
details: 支持HTTPS
|
||||
- title: 多客户端支持
|
||||
details: 暂未支持
|
||||
- title: 多种协议
|
||||
details: 支持TCP、HTTP、HTTPS、UDP
|
||||
- title: 原生部署
|
||||
details: 支持原生部署,更简单、性能更好的使用体验
|
||||
|
||||
# 文章列表显示方式: detailed 默认,显示详细版文章列表(包括作者、分类、标签、摘要、分页等)| simple => 显示简约版文章列表(仅标题和日期)| none 不显示文章列表
|
||||
postList: none
|
||||
@@ -137,7 +137,7 @@ postList: none
|
||||
或者加入我们的交流群:
|
||||
<div align="center">
|
||||
<img :src="$withBase('/img/qrcode/wxq.png')" class="no-zoom" style="width:200px;margin: 10px;">
|
||||
<p>中微子 微信群(添加我微信备注"进群")</p>
|
||||
<p>中微子 微信群(添加我微信备注"中微子进群")</p>
|
||||
</div>
|
||||
<br/>
|
||||
|
||||
@@ -146,9 +146,17 @@ postList: none
|
||||
|
||||
<div class="cardListContainer">
|
||||
<div class="card-list">
|
||||
<a href="https://www.xigexb.com" target="_blank" class="card-item row-3" style="background-color:#102863;--random-color:#102863;color:#FFFFFF;">
|
||||
<a href="https://www.xigexb.com?from=neutrino-proxy" target="_blank" class="card-item row-3" style="background-color:#102863;--random-color:#102863;color:#FFFFFF;">
|
||||
<img src="img/sponsor/xigexiaobao.jpg" class="no-zoom">
|
||||
<div><p class="name">喜鸽小宝</p> <p class="desc">一个爱好写代码的同学</p></div>
|
||||
<div><p class="name">喜鸽小宝</p> <p class="desc">一个爱好写代码的同学。<br/> </p></div>
|
||||
</a>
|
||||
<a href="https://7bu.top?from=neutrino-proxy" target="_blank" class="card-item row-3" style="background-color:#c6ddff;--random-color:#c6ddff;color:#000000;">
|
||||
<img src="img/sponsor/7bu.ico" class="no-zoom">
|
||||
<div><p class="name">去不图床</p> <p class="desc">杜老师说旗下付费图片外链平台。<br/> </p></div>
|
||||
</a>
|
||||
<a href="http://doc.zyplayer.com/#/integrate/zyplayer-doc?utm=neutrino-proxy" target="_blank" class="card-item row-3" style="background-color:#486898;--random-color:#c6ddff;color:#FFFFFF;">
|
||||
<img src="img/sponsor/zyplayer-doc.png" class="no-zoom">
|
||||
<div><p class="name">zyplayer-doc</p> <p class="desc">私有化部署的企业级文档管理与知识库AI问答平台。</p></div>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
"scripts": {
|
||||
"dev": "vuepress dev docs",
|
||||
"build": "vuepress build docs",
|
||||
"buildAndDeploy": "vuepress build docs && bash deploy.sh",
|
||||
"deploy": "bash deploy.sh",
|
||||
"buildAndDeploy": "vuepress build docs && bash deploy/deploy1.sh",
|
||||
"deploy": "bash deploy/deploy1.sh",
|
||||
"updateTheme": "yarn remove vuepress-theme-vdoing && rm -rf node_modules && yarn && yarn add vuepress-theme-vdoing -D",
|
||||
"editFm": "node utils/editFrontmatter.js"
|
||||
},
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.noear</groupId>
|
||||
<artifactId>solon-parent</artifactId>
|
||||
<version>2.5.11</version>
|
||||
<version>2.7.6</version>
|
||||
<relativePath />
|
||||
</parent>
|
||||
|
||||
@@ -26,11 +26,10 @@
|
||||
<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>1.1-SNAPSHOT</revision>
|
||||
<revision>2.0.3</revision>
|
||||
|
||||
<native.version>0.9.28</native.version>
|
||||
|
||||
<java.version>17</java.version>
|
||||
<java.version>21</java.version>
|
||||
<maven-compiler-plugin.version>3.8.0</maven-compiler-plugin.version>
|
||||
<maven-flatten.version>1.1.0</maven-flatten.version>
|
||||
</properties>
|
||||
@@ -76,7 +75,7 @@
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>5.1.49</version>
|
||||
<version>8.0.33</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mariadb.jdbc</groupId>
|
||||
@@ -110,6 +109,7 @@
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
@@ -121,8 +121,8 @@
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<groupId>org.noear</groupId>
|
||||
<artifactId>solon-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
@@ -216,7 +216,7 @@
|
||||
<plugin>
|
||||
<groupId>org.noear</groupId>
|
||||
<artifactId>solon-maven-plugin</artifactId>
|
||||
<version>${solon-maven-plugin.version}</version>
|
||||
<version>${solon.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>process-aot</id>
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
## 项目简介
|
||||
- [中微子代理(neutrino-proxy)](https://gitee.com/dromara/neutrino-proxy) 是一款基于Solon、Netty的内网穿透神器。该项目采用最为宽松的MIT协议,因此您可以对它进行复制、修改、传播并用于任何个人或商业行为。
|
||||
- 市面上基于内网穿透的常见产品有:花生壳、TeamView、cpolar等。
|
||||
- 常见的使用场景:
|
||||
- 本地开发调试第三方回调
|
||||
- 本地开发异地接口连调
|
||||
- 远程登录内网windows机器
|
||||
- 将本地服务映射到外网,用于演示
|
||||
- Gitee仓库:https://gitee.com/dromara/neutrino-proxy
|
||||
- GitCode仓库:https://gitcode.com/dromara/neutrino-proxy
|
||||
- GitHub仓库:https://github.com/dromara/neutrino-proxy
|
||||
- 官网地址: https://neutrino-proxy.dromara.org
|
||||
|
||||
## 主要特点:
|
||||
- 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协议,免去你的后顾之忧
|
||||
|
||||
## 镜像版本&地址
|
||||
- 版本:当前最新版本为`2.0.1`,可直接使用`latest`拉取最新镜像
|
||||
- neutrino-proxy-server
|
||||
- DockerHub镜像地址:aoshiguchen/neutrino-proxy-server:latest
|
||||
- 阿里云镜像地址:neutrino-proxy registry.cn-hangzhou.aliyuncs.com/asgc/neutrino-proxy:latest
|
||||
- neutrino-proxy-client
|
||||
- DockerHub镜像地址:aoshiguchen/neutrino-proxy-client:latest
|
||||
- 阿里云镜像地址:registry.cn-hangzhou.aliyuncs.com/asgc/neutrino-proxy-client:latest
|
||||
@@ -0,0 +1,41 @@
|
||||
solon.logging.logger:
|
||||
"root":
|
||||
level: info
|
||||
|
||||
neutrino:
|
||||
proxy:
|
||||
tunnel:
|
||||
# 线程池相关配置,用于技术调优,可忽略
|
||||
thread-count: 50
|
||||
# 隧道SSL证书配置
|
||||
key-store-password: 123456
|
||||
jks-path: classpath:/test.jks
|
||||
# 服务端IP
|
||||
server-ip: host.docker.internal
|
||||
# 服务端端口(对应服务端app.yml中的tunnel.port、tunnel.ssl-port)
|
||||
server-port: 9002
|
||||
# 是否启用SSL(注意:该配置必须和server-port对应上)
|
||||
ssl-enable: true
|
||||
# 客户端连接唯一凭证
|
||||
license-key: b0a907332b474b25897c4dcb31fc7eb6
|
||||
# 客户端唯一身份标识(可忽略,若不设置首次启动会自动生成)
|
||||
client-id:
|
||||
# 是否开启隧道传输报文日志(日志级别为debug时开启才有效)
|
||||
transfer-log-enable: false
|
||||
# 是否开启心跳日志
|
||||
heartbeat-log-enable: false
|
||||
# 重连设置
|
||||
reconnection:
|
||||
# 重连间隔(秒)
|
||||
interval-seconds: 10
|
||||
# 是否开启无限重连(未开启时,客户端license不合法会自动停止应用,开启了则不会,请谨慎开启)
|
||||
unlimited: false
|
||||
client:
|
||||
udp:
|
||||
# 线程池相关配置,用于技术调优,可忽略
|
||||
boss-thread-count: 5
|
||||
work-thread-count: 20
|
||||
# udp傀儡端口范围
|
||||
puppet-port-range: 10000-10500
|
||||
# 是否开启隧道传输报文日志(日志级别为debug时开启才有效)
|
||||
transfer-log-enable: false
|
||||
@@ -0,0 +1,21 @@
|
||||
version: '3.8'
|
||||
|
||||
networks:
|
||||
npClient:
|
||||
driver: bridge
|
||||
services:
|
||||
npClient:
|
||||
image: aoshiguchen/neutrino-proxy-client:latest
|
||||
container_name: compose-npClient
|
||||
hostname: npClient
|
||||
restart: always
|
||||
environment:
|
||||
TZ: Asia/Shanghai
|
||||
LANG: zh_CN.UTF-8
|
||||
volumes:
|
||||
- ./config:/root/neutrino-proxy/config
|
||||
- ./logs:/root/neutrino-proxy/logs
|
||||
ports:
|
||||
- "10000-10500:10000-10500/udp"
|
||||
networks:
|
||||
- npClient
|
||||
@@ -0,0 +1,58 @@
|
||||
server:
|
||||
# 服务端web端口,用于支持HTTP接口,管理后台页面访问
|
||||
port: 8888
|
||||
# 日志级别
|
||||
solon.logging:
|
||||
logger:
|
||||
"root":
|
||||
level: info
|
||||
appender:
|
||||
file:
|
||||
level: info
|
||||
|
||||
neutrino:
|
||||
proxy:
|
||||
# 隧道相关配置-用于维持服务端与客户端的通信
|
||||
tunnel:
|
||||
# 线程池相关配置,用于技术调优,可忽略
|
||||
boss-thread-count: 2
|
||||
work-thread-count: 10
|
||||
# 隧道非SSL端口
|
||||
port: 9000
|
||||
# 隧道SSL端口
|
||||
ssl-port: 9002
|
||||
# 隧道SSL证书配置
|
||||
key-store-password: 123456
|
||||
key-manager-password: 123456
|
||||
jks-path: classpath:/test.jks
|
||||
# 是否开启隧道传输报文日志(日志级别为debug时开启才有效)
|
||||
transfer-log-enable: false
|
||||
# 是否开启心跳日志
|
||||
heartbeat-log-enable: false
|
||||
server:
|
||||
tcp:
|
||||
# 线程池相关配置,用于技术调优,可忽略
|
||||
boss-thread-count: 5
|
||||
work-thread-count: 20
|
||||
# http代理端口,默认80(不配置不支持)
|
||||
http-proxy-port: 80
|
||||
# https代理端口,默认443 (不配置不支持,同时需要配置域名、证书)
|
||||
https-proxy-port: 443
|
||||
# 是否开启代理服务报文日志(日志级别为debug时开启才有效)
|
||||
transfer-log-enable: false
|
||||
udp:
|
||||
# 线程池相关配置,用于技术调优,可忽略
|
||||
boss-thread-count: 5
|
||||
work-thread-count: 20
|
||||
# 是否开启代理服务报文日志(日志级别为debug时开启才有效)
|
||||
transfer-log-enable: false
|
||||
data:
|
||||
db:
|
||||
# 数据库类型,目前支持h2、mysql、mariadb
|
||||
type: h2
|
||||
# 数据库连接URL
|
||||
url: jdbc:h2:file:./data/db;MODE=MySQL;AUTO_SERVER=TRUE
|
||||
# 数据库用户名
|
||||
username:
|
||||
# 数据库密码
|
||||
password:
|
||||
@@ -0,0 +1,25 @@
|
||||
version: '3.8'
|
||||
|
||||
networks:
|
||||
npServer:
|
||||
driver: bridge
|
||||
services:
|
||||
npServer:
|
||||
image: aoshiguchen/neutrino-proxy-server:latest
|
||||
container_name: compose-npServer
|
||||
hostname: npServer
|
||||
restart: always
|
||||
environment:
|
||||
TZ: Asia/Shanghai
|
||||
LANG: zh_CN.UTF-8
|
||||
volumes:
|
||||
- ./config:/root/neutrino-proxy/config
|
||||
- ./data:/root/neutrino-proxy/data
|
||||
- ./logs:/root/neutrino-proxy/logs
|
||||
ports:
|
||||
- "8888:8888"
|
||||
- "9000:9000"
|
||||
- "9002:9002"
|
||||
- "9101-9120:9101-9120"
|
||||
networks:
|
||||
- npServer
|
||||
@@ -0,0 +1,58 @@
|
||||
server:
|
||||
# 服务端web端口,用于支持HTTP接口,管理后台页面访问
|
||||
port: 8888
|
||||
# 日志级别
|
||||
solon.logging:
|
||||
logger:
|
||||
"root":
|
||||
level: info
|
||||
appender:
|
||||
file:
|
||||
level: info
|
||||
|
||||
neutrino:
|
||||
proxy:
|
||||
# 隧道相关配置-用于维持服务端与客户端的通信
|
||||
tunnel:
|
||||
# 线程池相关配置,用于技术调优,可忽略
|
||||
boss-thread-count: 2
|
||||
work-thread-count: 10
|
||||
# 隧道非SSL端口
|
||||
port: 9000
|
||||
# 隧道SSL端口
|
||||
ssl-port: 9002
|
||||
# 隧道SSL证书配置
|
||||
key-store-password: 123456
|
||||
key-manager-password: 123456
|
||||
jks-path: classpath:/test.jks
|
||||
# 是否开启隧道传输报文日志(日志级别为debug时开启才有效)
|
||||
transfer-log-enable: false
|
||||
# 是否开启心跳日志
|
||||
heartbeat-log-enable: false
|
||||
server:
|
||||
tcp:
|
||||
# 线程池相关配置,用于技术调优,可忽略
|
||||
boss-thread-count: 5
|
||||
work-thread-count: 20
|
||||
# http代理端口,默认80(不配置不支持)
|
||||
http-proxy-port: 80
|
||||
# https代理端口,默认443 (不配置不支持,同时需要配置域名、证书)
|
||||
https-proxy-port: 443
|
||||
# 是否开启代理服务报文日志(日志级别为debug时开启才有效)
|
||||
transfer-log-enable: false
|
||||
udp:
|
||||
# 线程池相关配置,用于技术调优,可忽略
|
||||
boss-thread-count: 5
|
||||
work-thread-count: 20
|
||||
# 是否开启代理服务报文日志(日志级别为debug时开启才有效)
|
||||
transfer-log-enable: false
|
||||
data:
|
||||
db:
|
||||
# 数据库类型,目前支持h2、mysql、mariadb
|
||||
type: mysql
|
||||
# 数据库连接URL
|
||||
url: jdbc:mysql://mysql:3306/neutrino-proxy?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&useAffectedRows=true&useSSL=false&allowPublicKeyRetrieval=true
|
||||
# 数据库用户名
|
||||
username: root
|
||||
# 数据库密码
|
||||
password: 123456
|
||||
@@ -0,0 +1,21 @@
|
||||
-- Licensed to the Apache Software Foundation (ASF) under one
|
||||
-- or more contributor license agreements. See the NOTICE file
|
||||
-- distributed with this work for additional information
|
||||
-- regarding copyright ownership. The ASF licenses this file
|
||||
-- to you under the Apache License, Version 2.0 (the
|
||||
-- "License"); you may not use this file except in compliance
|
||||
-- with the License. You may obtain a copy of the License at
|
||||
--
|
||||
-- http://www.apache.org/licenses/LICENSE-2.0
|
||||
--
|
||||
-- Unless required by applicable law or agreed to in writing, software
|
||||
-- distributed under the License is distributed on an "AS IS" BASIS,
|
||||
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
-- See the License for the specific language governing permissions and
|
||||
-- limitations under the License.
|
||||
|
||||
-- this file works for MySQL.
|
||||
|
||||
set names utf8mb4;
|
||||
create database if not exists `neutrino-proxy` default charset utf8mb4 collate utf8mb4_general_ci;
|
||||
commit;
|
||||
@@ -0,0 +1,48 @@
|
||||
version: '3.8'
|
||||
|
||||
networks:
|
||||
npServer:
|
||||
driver: bridge
|
||||
services:
|
||||
mysql:
|
||||
image: mysql:8
|
||||
container_name: compose-mysql
|
||||
hostname: mysql
|
||||
restart: always
|
||||
healthcheck:
|
||||
test: ['CMD-SHELL', 'mysqladmin ping -h 127.0.0.1 --silent']
|
||||
interval: 3s
|
||||
retries: 5
|
||||
start_period: 3m
|
||||
ports:
|
||||
- "3308:3306"
|
||||
environment:
|
||||
TZ: Asia/Shanghai
|
||||
MYSQL_ROOT_PASSWORD: 123456
|
||||
volumes:
|
||||
- ./data/mysqldata:/var/lib/mysql/
|
||||
- ./config/sql:/docker-entrypoint-initdb.d/
|
||||
networks:
|
||||
- npServer
|
||||
npServer:
|
||||
image: aoshiguchen/neutrino-proxy-server:latest
|
||||
container_name: compose-npServer
|
||||
hostname: npServer
|
||||
restart: always
|
||||
environment:
|
||||
TZ: Asia/Shanghai
|
||||
LANG: zh_CN.UTF-8
|
||||
depends_on:
|
||||
mysql:
|
||||
condition: service_healthy
|
||||
volumes:
|
||||
- ./config:/root/neutrino-proxy/config
|
||||
- ./data:/root/neutrino-proxy/data
|
||||
- ./logs:/root/neutrino-proxy/logs
|
||||
ports:
|
||||
- "8888:8888"
|
||||
- "9000:9000"
|
||||
- "9002:9002"
|
||||
- "9101-9120:9101-9120"
|
||||
networks:
|
||||
- npServer
|
||||
@@ -44,3 +44,9 @@ cp -rf ./neutrino-proxy-admin/dist $adminDeployDir/
|
||||
cp -rf ./neutrino-proxy-admin/dist/ $giteePagesDir
|
||||
cd $serverDeployDir
|
||||
zip -r neutrino-proxy-admin.zip "neutrino-proxy-admin/"
|
||||
|
||||
#拷贝到neutrino-proxy-server项目静态资源目录下
|
||||
cd ../..
|
||||
rm -rf ./neutrino-proxy-server/src/main/resources/static
|
||||
mkdir -p neutrino-proxy-server/src/main/resources/static
|
||||
cp -rf ./neutrino-proxy-admin/dist/ ./neutrino-proxy-server/src/main/resources/static
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
#!/bin/sh
|
||||
# 中微子代理客户端编译打包脚本,基础参数请自行修改
|
||||
|
||||
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_151.jdk/Contents/Home
|
||||
export JAVA_HOME=/Users/yangwen/my/service/graalvm/graalvm-community-openjdk-21.0.1+12.1/Contents/Home
|
||||
#export JAVA_HOME=/Users/yangwen/my/service/jdk/jdk17/jdk-17.0.4.1.jdk/Contents/Home
|
||||
export MAVEN_HOME=/Users/yangwen/my/service/maven/apache-maven-3.8.1
|
||||
export PATH=:$PATH:$JAVA_HOME/bin:$MAVEN_HOME/bin
|
||||
|
||||
@@ -11,14 +12,20 @@ clientDeployDir=$deployDir"/client"
|
||||
#切到项目根目录
|
||||
cd ../..
|
||||
#初始化文件夹
|
||||
if [ ! -d "$deployDir" ];then
|
||||
mkdir $deployDir
|
||||
fi
|
||||
if [ ! -d "$clientDeployDir" ];then
|
||||
mkdir $clientDeployDir
|
||||
fi
|
||||
mkdir -p $clientDeployDir
|
||||
rm -rf $clientDeployDir/neutrino-proxy-client.jar
|
||||
rm -rf $clientDeployDir/neutrino-proxy-client-jar
|
||||
rm -rf $clientDeployDir/neutrino-proxy-client-jar.zip
|
||||
|
||||
#客户端打包
|
||||
mvn clean install -U -pl neutrino-proxy-client -am -Dmaven.test.skip=true
|
||||
# 拷贝到deploy目录下
|
||||
cp ./neutrino-proxy-client/target/neutrino-proxy-client.jar $clientDeployDir/neutrino-proxy-client.jar
|
||||
|
||||
#打zip包,用于发版
|
||||
cd $clientDeployDir
|
||||
mkdir neutrino-proxy-client-jar
|
||||
cp ../../neutrino-proxy-client/target/neutrino-proxy-client.jar ./neutrino-proxy-client-jar/neutrino-proxy-client.jar
|
||||
cp ../../neutrino-proxy-client/src/main/resources/app-copy.yml ./neutrino-proxy-client-jar/app.yml
|
||||
zip -r neutrino-proxy-client-jar.zip ./neutrino-proxy-client-jar
|
||||
rm -rf $clientDeployDir/neutrino-proxy-client-jar
|
||||
|
||||
@@ -1,29 +1,29 @@
|
||||
#!/bin/sh
|
||||
|
||||
# 镜像版本,每次更新版本时需要调整
|
||||
ImageVer=1.8.5
|
||||
ImageVer=2.0.2
|
||||
ImageName=neutrino-proxy-client
|
||||
DockerFilePath=$PWD/../../neutrino-proxy-client/Dockerfile
|
||||
DockerFilePath=$PWD/../../neutrino-proxy-client
|
||||
|
||||
deployDir=$PWD/../../"deploy"
|
||||
clientDeployDir=$deployDir"/client"
|
||||
|
||||
#切到项目根目录
|
||||
#初始化文件夹
|
||||
if [ ! -d "$deployDir" ];then
|
||||
mkdir $deployDir
|
||||
fi
|
||||
if [ ! -d "$clientDeployDir" ];then
|
||||
mkdir $clientDeployDir
|
||||
fi
|
||||
rm -rf $clientDeployDir/$ImageName.tar
|
||||
##初始化文件夹
|
||||
#deployDir=$PWD/../../"deploy"
|
||||
#clientDeployDir=$deployDir"/client"
|
||||
#if [ ! -d "$deployDir" ];then
|
||||
# mkdir $deployDir
|
||||
#fi
|
||||
#if [ ! -d "$clientDeployDir" ];then
|
||||
# mkdir $clientDeployDir
|
||||
#fi
|
||||
#rm -rf $clientDeployDir/$ImageName.tar
|
||||
|
||||
#echo '打包jar...'
|
||||
sh ./client_build.sh
|
||||
#sh ./client_build.sh
|
||||
|
||||
# 删除老的本地镜像
|
||||
docker rmi -f $(docker images | grep $ImageName | awk '{print $3}')
|
||||
# 构建镜像
|
||||
docker build -t $ImageName:$ImageVer -t $ImageName:latest -f $DockerFilePath $PWD/../..
|
||||
docker build -t $ImageName:$ImageVer -t $ImageName:latest $DockerFilePath
|
||||
# 保存镜像到本地
|
||||
docker save -o $clientDeployDir/$ImageName.tar $ImageName:$ImageVer
|
||||
#docker save -o $clientDeployDir/$ImageName.tar $ImageName:$ImageVer
|
||||
|
||||
# docker run -it -e LICENSE_KEY=b0a907332b474b25897c4dcb31fc7eb6 -e SERVER_IP=host.docker.internal --name np-client neutrino-proxy-client:2.0.0
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
#!/bin/sh
|
||||
# 中微子代理客户端编译打包脚本,基础参数请自行修改
|
||||
|
||||
export JAVA_HOME=/Users/yangwen/my/service/graalvm/graalvm-community-openjdk-17.0.8+7.1/Contents/Home
|
||||
export JAVA_HOME=/Users/yangwen/my/service/graalvm/graalvm-community-openjdk-21.0.1+12.1/Contents/Home
|
||||
export MAVEN_HOME=/Users/yangwen/my/service/maven/apache-maven-3.8.1
|
||||
export PATH=:$PATH:$JAVA_HOME/bin:$MAVEN_HOME/bin
|
||||
|
||||
MODULE_NAME=neutrino-proxy-client
|
||||
deployDir="deploy"
|
||||
clientDeployDir=$deployDir"/client"
|
||||
machine=macos
|
||||
VER=2.0.3
|
||||
|
||||
#切到项目根目录
|
||||
cd ../..
|
||||
@@ -14,16 +17,38 @@ cd ../..
|
||||
mkdir -p $clientDeployDir
|
||||
|
||||
# 删除原来的编译文件
|
||||
rm -rf $clientDeployDir/neutrino-proxy-client.jar
|
||||
rm -rf $clientDeployDir/neutrino-proxy-client
|
||||
rm -rf $clientDeployDir/$MODULE_NAME.jar
|
||||
rm -rf $clientDeployDir/$MODULE_NAME
|
||||
rm -rf $clientDeployDir/$MODULE_NAME-jdk21-$VER-jar
|
||||
rm -rf $clientDeployDir/$MODULE_NAME-jdk21-$VER-jar.zip
|
||||
rm -rf $clientDeployDir/$MODULE_NAME-$machine-$VER-native
|
||||
rm -rf $clientDeployDir/$MODULE_NAME-$machine-$VER-native.zip
|
||||
|
||||
#客户端打包
|
||||
mvn clean install -U -pl neutrino-proxy-client -am -Dmaven.test.skip=true
|
||||
cd neutrino-proxy-client
|
||||
mvn clean install -U -pl $MODULE_NAME -am -Dmaven.test.skip=true
|
||||
cd $MODULE_NAME
|
||||
mvn clean native:compile -P native -DskipTests
|
||||
cd ..
|
||||
|
||||
# 拷贝到deploy目录下
|
||||
cp ./neutrino-proxy-client/target/neutrino-proxy-client.jar $clientDeployDir/neutrino-proxy-client.jar
|
||||
cp ./neutrino-proxy-client/target/neutrino-proxy-client $clientDeployDir/neutrino-proxy-client
|
||||
# 给执行权限
|
||||
chmod +x ./$MODULE_NAME/target/$MODULE_NAME
|
||||
|
||||
# 拷贝到deploy目录下
|
||||
cp ./$MODULE_NAME/target/$MODULE_NAME.jar $clientDeployDir/$MODULE_NAME.jar
|
||||
cp ./$MODULE_NAME/target/$MODULE_NAME $clientDeployDir/$MODULE_NAME
|
||||
|
||||
#打zip包,用于发版
|
||||
cd $clientDeployDir
|
||||
## jar
|
||||
mkdir $MODULE_NAME-jdk21-$VER-jar
|
||||
cp ../../$MODULE_NAME/target/$MODULE_NAME.jar ./$MODULE_NAME-jdk21-$VER-jar/$MODULE_NAME.jar
|
||||
cp ../../$MODULE_NAME/src/main/resources/app-copy.yml ./$MODULE_NAME-jdk21-$VER-jar/app.yml
|
||||
zip -r $MODULE_NAME-jdk21-$VER-jar.zip ./$MODULE_NAME-jdk21-$VER-jar
|
||||
rm -rf ./$MODULE_NAME-jdk21-$VER-jar
|
||||
|
||||
## native
|
||||
mkdir $MODULE_NAME-$machine-$VER-native
|
||||
cp ../../$MODULE_NAME/target/$MODULE_NAME ./$MODULE_NAME-$machine-$VER-native/$MODULE_NAME
|
||||
cp ../../$MODULE_NAME/src/main/resources/app-copy.yml ./$MODULE_NAME-$machine-$VER-native/app.yml
|
||||
zip -r $MODULE_NAME-$machine-$VER-native.zip ./$MODULE_NAME-$machine-$VER-native
|
||||
rm -rf ./$MODULE_NAME-$machine-$VER-native
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#!/bin/sh
|
||||
# 中微子代理客户端启动脚本,基础参数请自行修改
|
||||
|
||||
JAVA_OPS="-server -Xms256m -Xmx512m -XX:PermSize=128M -XX:MaxPermSize=256M -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/work/$NAME/heapError/"
|
||||
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_151.jdk/Contents/Home
|
||||
JAVA_OPS="-server -Xms256m -Xmx512m -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/work/$NAME/heapError/"
|
||||
export JAVA_HOME=/Users/yangwen/my/service/graalvm/graalvm-community-openjdk-21.0.1+12.1/Contents/Home
|
||||
export PATH=:$PATH:$JAVA_HOME/bin
|
||||
export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
|
||||
mkdir -p /work/$NAME/heapError/
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
#!/bin/sh
|
||||
# 中微子代理服务端编译打包脚本,基础参数请自行修改
|
||||
|
||||
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_151.jdk/Contents/Home
|
||||
export JAVA_HOME=/Users/yangwen/my/service/graalvm/graalvm-community-openjdk-21.0.1+12.1/Contents/Home
|
||||
#export JAVA_HOME=/Users/yangwen/my/service/jdk/jdk17/jdk-17.0.4.1.jdk/Contents/Home
|
||||
export MAVEN_HOME=/Users/yangwen/my/service/maven/apache-maven-3.8.1
|
||||
export PATH=:$PATH:$JAVA_HOME/bin:$MAVEN_HOME/bin
|
||||
|
||||
@@ -11,15 +12,20 @@ serverDeployDir=$deployDir"/server"
|
||||
#切到项目根目录
|
||||
cd ../..
|
||||
#初始化文件夹
|
||||
if [ ! -d "$deployDir" ];then
|
||||
mkdir $deployDir
|
||||
fi
|
||||
if [ ! -d "$serverDeployDir" ];then
|
||||
mkdir $serverDeployDir
|
||||
fi
|
||||
mkdir -p $serverDeployDir
|
||||
rm -rf $serverDeployDir/neutrino-proxy-server.jar
|
||||
rm -rf $serverDeployDir/neutrino-proxy-server-jar
|
||||
rm -rf $serverDeployDir/neutrino-proxy-server-jar.zip
|
||||
|
||||
#服务端打包
|
||||
mvn clean install -U -pl neutrino-proxy-server -am -Dmaven.test.skip=true
|
||||
# 拷贝到deploy目录下
|
||||
cp ./neutrino-proxy-server/target/neutrino-proxy-server.jar $serverDeployDir/neutrino-proxy-server.jar
|
||||
|
||||
#打zip包,用于发版
|
||||
cd $serverDeployDir
|
||||
mkdir neutrino-proxy-server-jar
|
||||
cp ../../neutrino-proxy-server/target/neutrino-proxy-server.jar ./neutrino-proxy-server-jar/neutrino-proxy-server.jar
|
||||
cp ../../neutrino-proxy-server/src/main/resources/app-copy.yml ./neutrino-proxy-server-jar/app.yml
|
||||
zip -r neutrino-proxy-server-jar.zip ./neutrino-proxy-server-jar
|
||||
rm -rf $serverDeployDir/neutrino-proxy-server-jar
|
||||
|
||||
@@ -1,17 +1,18 @@
|
||||
#!/bin/sh
|
||||
|
||||
# 镜像版本,每次更新版本时需要调整
|
||||
ImageVer=1.0.0
|
||||
ImageVer=2.0.2
|
||||
ImageName=neutrino-proxy
|
||||
DockerFilePath=$PWD/../..
|
||||
DockerFilePath=$PWD/../../neutrino-proxy-server
|
||||
|
||||
#echo '打包jar...'
|
||||
sh ./server_build.sh
|
||||
#echo '打包管理后台...'
|
||||
sh ./admin_build_docker.sh
|
||||
#echo '打包jar...'
|
||||
sh ./server_build.sh
|
||||
|
||||
# 删除老的本地镜像
|
||||
docker rmi -f $(docker images | grep $ImageName | awk '{print $3}')
|
||||
# 构建镜像
|
||||
docker build -t $ImageName:$ImageVer -t $ImageName:latest $DockerFilePath
|
||||
|
||||
# docker run -it -p 9000-9200:9000-9200/tcp -p 8888:8888 --name np-server neutrino-proxy:2.0.0
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
#!/bin/sh
|
||||
# 中微子代理服务端编译打包脚本,基础参数请自行修改
|
||||
|
||||
export JAVA_HOME=/Users/yangwen/my/service/graalvm/graalvm-community-openjdk-17.0.8+7.1/Contents/Home
|
||||
export JAVA_HOME=/Users/yangwen/my/service/graalvm/graalvm-community-openjdk-21.0.1+12.1/Contents/Home
|
||||
export MAVEN_HOME=/Users/yangwen/my/service/maven/apache-maven-3.8.1
|
||||
export PATH=:$PATH:$JAVA_HOME/bin:$MAVEN_HOME/bin
|
||||
|
||||
MODULE_NAME=neutrino-proxy-server
|
||||
deployDir="deploy"
|
||||
serverDeployDir=$deployDir"/server"
|
||||
machine=macos
|
||||
VER=2.0.3
|
||||
|
||||
#切到项目根目录
|
||||
cd ../..
|
||||
@@ -14,8 +17,12 @@ cd ../..
|
||||
mkdir -p $serverDeployDir
|
||||
|
||||
# 删除原来的编译文件
|
||||
rm -rf $serverDeployDir/neutrino-proxy-server.jar
|
||||
rm -rf $serverDeployDir/neutrino-proxy-server
|
||||
rm -rf $serverDeployDir/$MODULE_NAME.jar
|
||||
rm -rf $serverDeployDir/$MODULE_NAME
|
||||
rm -rf $serverDeployDir/$MODULE_NAME-jdk21-$VER-jar
|
||||
rm -rf $serverDeployDir/$MODULE_NAME-jdk21-$VER-jar.zip
|
||||
rm -rf $serverDeployDir/$MODULE_NAME-$machine-$VER-native
|
||||
rm -rf $serverDeployDir/$MODULE_NAME-$machine-$VER-native.zip
|
||||
|
||||
# 不需要每次都重新编译一次前端代码,如果前端代码有变更,编译前需要手动执行`admin_build_docker.sh`
|
||||
##前端页面打包
|
||||
@@ -27,12 +34,30 @@ rm -rf $serverDeployDir/neutrino-proxy-server
|
||||
#cp -rf ./neutrino-proxy-admin/dist/ ./neutrino-proxy-server/src/main/resources/static
|
||||
|
||||
#服务端打包
|
||||
mvn clean install -U -pl neutrino-proxy-server -am -Dmaven.test.skip=true
|
||||
cd neutrino-proxy-server
|
||||
mvn clean install -U -pl $MODULE_NAME -am -Dmaven.test.skip=true
|
||||
cd $MODULE_NAME
|
||||
mvn clean native:compile -P native -DskipTests
|
||||
cd ..
|
||||
|
||||
# 拷贝到deploy目录下
|
||||
cp ./neutrino-proxy-server/target/neutrino-proxy-server.jar $serverDeployDir/neutrino-proxy-server.jar
|
||||
cp ./neutrino-proxy-server/target/neutrino-proxy-server $serverDeployDir/neutrino-proxy-server
|
||||
# 给执行权限
|
||||
chmod +x ./$MODULE_NAME/target/$MODULE_NAME
|
||||
|
||||
# 拷贝到deploy目录下
|
||||
cp ./$MODULE_NAME/target/$MODULE_NAME.jar $serverDeployDir/$MODULE_NAME.jar
|
||||
cp ./$MODULE_NAME/target/$MODULE_NAME $serverDeployDir/$MODULE_NAME
|
||||
|
||||
#打zip包,用于发版
|
||||
cd $serverDeployDir
|
||||
## jar
|
||||
mkdir $MODULE_NAME-jdk21-$VER-jar
|
||||
cp ../../$MODULE_NAME/target/$MODULE_NAME.jar ./$MODULE_NAME-jdk21-$VER-jar/$MODULE_NAME.jar
|
||||
cp ../../$MODULE_NAME/src/main/resources/app-copy.yml ./$MODULE_NAME-jdk21-$VER-jar/app.yml
|
||||
zip -r $MODULE_NAME-jdk21-$VER-jar.zip ./$MODULE_NAME-jdk21-$VER-jar
|
||||
rm -rf ./$MODULE_NAME-jdk21-$VER-jar
|
||||
|
||||
## native
|
||||
mkdir $MODULE_NAME-$machine-$VER-native
|
||||
cp ../../$MODULE_NAME/target/$MODULE_NAME ./$MODULE_NAME-$machine-$VER-native/$MODULE_NAME
|
||||
cp ../../$MODULE_NAME/src/main/resources/app-copy.yml ./$MODULE_NAME-$machine-$VER-native/app.yml
|
||||
zip -r $MODULE_NAME-$machine-$VER-native.zip ./$MODULE_NAME-$machine-$VER-native
|
||||
rm -rf ./$MODULE_NAME-$machine-$VER-native
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#!/bin/sh
|
||||
# 中微子代理服务端启动脚本,基础参数请自行修改
|
||||
|
||||
JAVA_OPS="-server -Xms256m -Xmx1024m -XX:PermSize=128M -XX:MaxPermSize=256M -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/work/$NAME/heapError/"
|
||||
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_151.jdk/Contents/Home
|
||||
JAVA_OPS="-server -Xms256m -Xmx1024m -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/work/$NAME/heapError/"
|
||||
export JAVA_HOME=/Users/yangwen/my/service/graalvm/graalvm-community-openjdk-21.0.1+12.1/Contents/Home
|
||||
export PATH=:$PATH:$JAVA_HOME/bin
|
||||
export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
|
||||
mkdir -p /work/$NAME/heapError/
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo 'hello'
|
||||
@@ -1,29 +0,0 @@
|
||||
@echo off
|
||||
@rem basic params
|
||||
set ENV=dev
|
||||
set NODE_VERSION=v13.12.0
|
||||
set MODULE_NAME=neutrino-proxy-admin
|
||||
@rem 判断当前node版本是否符合,如果不符合切换node版本
|
||||
for /f "tokens=1" %%v in ('node -v') do set v=%%v
|
||||
if not "%v%" == "%NODE_VERSION%" (
|
||||
echo Node.js version is not %NODE_VERSION%.
|
||||
@rem 判断是否安装nvm
|
||||
set "nvm_home=%NVM_HOME%"
|
||||
set "nvm_symlink=%NVM_SYMLINK%"
|
||||
if not defined nvm_home (
|
||||
echo nvm is not installed,then use nvm to install node %NODE_VERSION%.
|
||||
) else if not defined nvm_symlink (
|
||||
echo nvm is not installed,then use nvm to install node %NODE_VERSION%.
|
||||
) else (
|
||||
echo nvm is installed.
|
||||
nvm use %NODE_VERSION%
|
||||
)
|
||||
)
|
||||
cd %~dp0 && cd ../../%MODULE_NAME%
|
||||
@rem 检查dist文件夹是否存在,存在就删除,/s选项表示将目录及其所有子目录一起删除,/q选项表示不需要确认操作
|
||||
if exist dist (
|
||||
rmdir /s /q dist
|
||||
)
|
||||
@rem 等待npm执行完毕
|
||||
call npm install
|
||||
npm run build:%ENV% && pause
|
||||
@@ -24,6 +24,17 @@ cd %~dp0 && cd ../../%MODULE_NAME%
|
||||
if exist dist (
|
||||
rmdir /s /q dist
|
||||
)
|
||||
@rem 等待npm执行完毕
|
||||
@rem 编译
|
||||
call npm install
|
||||
npm run build:%ENV% && pause
|
||||
call npm run build:%ENV%
|
||||
|
||||
echo 开始拷贝
|
||||
@rem 拷贝
|
||||
cd ..
|
||||
del /Q /F .\neutrino-proxy-server\src\main\resources\static
|
||||
rd /S /Q .\neutrino-proxy-server\src\main\resources\static
|
||||
mkdir .\neutrino-proxy-server\src\main\resources\static
|
||||
xcopy /S /E neutrino-proxy-admin\dist neutrino-proxy-server\src\main\resources\static
|
||||
|
||||
@rem 回到脚本目录
|
||||
cd scripts\win
|
||||
@@ -0,0 +1,63 @@
|
||||
@echo off
|
||||
@rem console output code changed to UTF-8
|
||||
chcp 65001
|
||||
@rem basic params
|
||||
set MODULE_NAME=neutrino-proxy-client
|
||||
@rem step
|
||||
cd %~dp0 && cd ../../
|
||||
|
||||
SET VS_HOME=C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519
|
||||
SET JAVA_HOME=C:\my\package\jdk\graalvm-community-openjdk-21.0.2
|
||||
SET MAVEN_HOME=C:\my\package\maven\apache-maven-3.9.6
|
||||
SET WIN_RAR_HOME=C:\Program Files\WinRAR
|
||||
SET PATH=%PATH%;%JAVA_HOME%\bin;%MAVEN_HOME%\bin;%VS_HOME%\bin;%WIN_RAR_HOME%
|
||||
SET INCLUDE=%INCLUDE%;%VS_HOME%\include;
|
||||
SET LIB=%LIB%;%VS_HOME%\lib;
|
||||
|
||||
SET deployDir=deploy
|
||||
SET clientDeployDir=%deployDir%\client
|
||||
SET machine=windows
|
||||
SET VER=2.0.1
|
||||
|
||||
@rem 初始化文件夹
|
||||
mkdir -p %clientDeployDir%
|
||||
|
||||
@rem 删除原来的编译文件
|
||||
del /S /Q /F %clientDeployDir%\%MODULE_NAME%.jar
|
||||
del /S /Q /F %clientDeployDir%\%MODULE_NAME%.exe
|
||||
del /S /Q /F %clientDeployDir%\%MODULE_NAME%-jdk21-%VER%-jar
|
||||
del /S /Q /F %clientDeployDir%\%MODULE_NAME%-jdk21-%VER%-jar.zip
|
||||
del /S /Q /F %clientDeployDir%\%MODULE_NAME%-%machine%-%VER%-native
|
||||
del /S /Q /F %clientDeployDir%\%MODULE_NAME%-%machine%-%VER%-native.zip
|
||||
rd /S /Q %clientDeployDir%\%MODULE_NAME%-jdk21-%VER%-jar
|
||||
rd /S /Q %clientDeployDir%\%MODULE_NAME%-%machine%-%VER%-native
|
||||
|
||||
@rem 客户端打包
|
||||
call mvn clean install -U -pl %MODULE_NAME% -am -Dmaven.test.skip=true
|
||||
cd %MODULE_NAME%
|
||||
call mvn clean native:compile -P native -DskipTests
|
||||
cd ..
|
||||
|
||||
@rem 拷贝到deploy目录下
|
||||
copy .\%MODULE_NAME%\target\%MODULE_NAME%.jar .\%clientDeployDir%\%MODULE_NAME%.jar
|
||||
copy .\%MODULE_NAME%\target\%MODULE_NAME%.exe .\%clientDeployDir%\%MODULE_NAME%.exe
|
||||
|
||||
@rem 打zip包,用于发版
|
||||
cd %clientDeployDir%
|
||||
@rem jar
|
||||
mkdir %MODULE_NAME%-jdk21-%VER%-jar
|
||||
copy %MODULE_NAME%.jar %MODULE_NAME%-jdk21-%VER%-jar
|
||||
copy ..\..\%MODULE_NAME%\src\main\resources\app-copy.yml %MODULE_NAME%-jdk21-%VER%-jar\app.yml
|
||||
Rar a %MODULE_NAME%-jdk21-%VER%-jar.zip %MODULE_NAME%-jdk21-%VER%-jar
|
||||
|
||||
@rem native
|
||||
mkdir %MODULE_NAME%-%machine%-%VER%-native
|
||||
copy %MODULE_NAME%.exe %MODULE_NAME%-%machine%-%VER%-native
|
||||
copy ..\..\%MODULE_NAME%\src\main\resources\app-copy.yml %MODULE_NAME%-%machine%-%VER%-native\app.yml
|
||||
Rar a %MODULE_NAME%-%machine%-%VER%-native.zip %MODULE_NAME%-%machine%-%VER%-native
|
||||
|
||||
@rem 删除临时文件
|
||||
|
||||
|
||||
@rem 回到脚本目录
|
||||
cd ..\..\scripts\win
|
||||
@@ -0,0 +1,63 @@
|
||||
@echo off
|
||||
@rem console output code changed to UTF-8
|
||||
chcp 65001
|
||||
@rem basic params
|
||||
set MODULE_NAME=neutrino-proxy-server
|
||||
@rem step
|
||||
cd %~dp0 && cd ../../
|
||||
|
||||
SET VS_HOME=C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519
|
||||
SET JAVA_HOME=C:\my\package\jdk\graalvm-community-openjdk-21.0.2
|
||||
SET MAVEN_HOME=C:\my\package\maven\apache-maven-3.9.6
|
||||
SET WIN_RAR_HOME=C:\Program Files\WinRAR
|
||||
SET PATH=%PATH%;%JAVA_HOME%\bin;%MAVEN_HOME%\bin;%VS_HOME%\bin;%WIN_RAR_HOME%
|
||||
SET INCLUDE=%INCLUDE%;%VS_HOME%\include;
|
||||
SET LIB=%LIB%;%VS_HOME%\lib;
|
||||
|
||||
SET deployDir=deploy
|
||||
SET serverDeployDir=%deployDir%\server
|
||||
SET machine=windows
|
||||
SET VER=2.0.1
|
||||
|
||||
@rem 初始化文件夹
|
||||
mkdir -p %serverDeployDir%
|
||||
|
||||
@rem 删除原来的编译文件
|
||||
del /S /Q /F %serverDeployDir%\%MODULE_NAME%.jar
|
||||
del /S /Q /F %serverDeployDir%\%MODULE_NAME%.exe
|
||||
del /S /Q /F %serverDeployDir%\%MODULE_NAME%-jdk21-%VER%-jar
|
||||
del /S /Q /F %serverDeployDir%\%MODULE_NAME%-jdk21-%VER%-jar.zip
|
||||
del /S /Q /F %serverDeployDir%\%MODULE_NAME%-%machine%-%VER%-native
|
||||
del /S /Q /F %serverDeployDir%\%MODULE_NAME%-%machine%-%VER%-native.zip
|
||||
rd /S /Q %serverDeployDir%\%MODULE_NAME%-jdk21-%VER%-jar
|
||||
rd /S /Q %serverDeployDir%\%MODULE_NAME%-%machine%-%VER%-native
|
||||
|
||||
@rem 服务端打包
|
||||
call mvn clean install -U -pl %MODULE_NAME% -am -Dmaven.test.skip=true
|
||||
cd %MODULE_NAME%
|
||||
call mvn clean native:compile -P native -DskipTests
|
||||
cd ..
|
||||
|
||||
@rem 拷贝到deploy目录下
|
||||
copy .\%MODULE_NAME%\target\%MODULE_NAME%.jar .\%serverDeployDir%\%MODULE_NAME%.jar
|
||||
copy .\%MODULE_NAME%\target\%MODULE_NAME%.exe .\%serverDeployDir%\%MODULE_NAME%.exe
|
||||
|
||||
@rem 打zip包,用于发版
|
||||
cd %serverDeployDir%
|
||||
@rem jar
|
||||
mkdir %MODULE_NAME%-jdk21-%VER%-jar
|
||||
copy %MODULE_NAME%.jar %MODULE_NAME%-jdk21-%VER%-jar
|
||||
copy ..\..\%MODULE_NAME%\src\main\resources\app-copy.yml %MODULE_NAME%-jdk21-%VER%-jar\app.yml
|
||||
Rar a %MODULE_NAME%-jdk21-%VER%-jar.zip %MODULE_NAME%-jdk21-%VER%-jar
|
||||
|
||||
@rem native
|
||||
mkdir %MODULE_NAME%-%machine%-%VER%-native
|
||||
copy %MODULE_NAME%.exe %MODULE_NAME%-%machine%-%VER%-native
|
||||
copy ..\..\%MODULE_NAME%\src\main\resources\app-copy.yml %MODULE_NAME%-%machine%-%VER%-native\app.yml
|
||||
Rar a %MODULE_NAME%-%machine%-%VER%-native.zip %MODULE_NAME%-%machine%-%VER%-native
|
||||
|
||||
@rem 删除临时文件
|
||||
|
||||
|
||||
@rem 回到脚本目录
|
||||
cd ..\..\scripts\win
|
||||
@@ -1,54 +1,21 @@
|
||||
# 1.x规划
|
||||
- Bug
|
||||
- 优化
|
||||
- 添加端口映射时,验证端口是否被其他服务占用
|
||||
- 拉下搜索license,支持模糊搜索
|
||||
- license下拉用户搜索,支持模糊搜索
|
||||
- UDP支持
|
||||
- 官网文档完善
|
||||
- HTTPS配置说明
|
||||
- 协议重构
|
||||
- 代码重构
|
||||
|
||||
# 1.8.6
|
||||
- [x] 端口映射选择端口支持分页
|
||||
- [x] 新增/更新端口映射,增加端口占用检测
|
||||
- [x] 拉下搜索license,支持模糊搜索
|
||||
- [x] license下拉用户搜索,支持模糊搜索
|
||||
- [x] 端口映射编辑时,如果端口号没有变动,则不验证。避免出现端口映射正在使用时,无法更新端口映射其他信息的问题
|
||||
- [x] 端口映射HTTP(S)新增打开网页按钮
|
||||
- [x] 客户端断开连接时,记录日志空指针异常问题修复
|
||||
|
||||
# 1.9.0
|
||||
- [x] 支持UDP
|
||||
- 服务端
|
||||
- 原`neutrino.proxy.server`配置移到`neutrino.proxy.server.tcp`下
|
||||
- 客户端
|
||||
- 原`neutrino.proxy.client`配置移到`neutrino.proxy.tunnel`下
|
||||
- [x] 端口映射HTTP(S)新增打开网页按钮,优先使用域名打开
|
||||
- [x] 新增/编辑端口映射时端口占用检测功能屏蔽,解决docker下使用的各种问题
|
||||
|
||||
# 1.9.1
|
||||
- [ ] 如果UDP映射服务端端口变动,流量统计似乎不准,转发功能或许也受到影响,需要评估、测试、思考如何优化
|
||||
- [ ] 增加服务端/客户端jar式一键部署脚本
|
||||
- [ ] 排查解决问题:https://gitee.com/dromara/neutrino-proxy/issues/I7LGLB
|
||||
- [ ] 访问白名单
|
||||
- [ ] 端口映射分组
|
||||
|
||||
# Bug
|
||||
- 指令通达被close的问题,org.dromara.neutrinoproxy.server.proxy.core.ProxyTunnelChannelHandler.channelInactive
|
||||
- windows环境下直接运行发布版的jar包,日志输出乱码
|
||||
- 代理mysql时,使用未开启远程访问的账号走代理访问mysql,代理客户端出现断开现象
|
||||
- 客户端连接映射某个端口以后,如果在服务器端禁用了,没有立刻反映出来,要灯客户端重连以后才会屏蔽被禁用的端口。
|
||||
|
||||
# 2.x规划
|
||||
- 插件开发
|
||||
- [ ] neutrino-proxy-solon-plugin
|
||||
- [ ] neutrino-proxy-jetbrains-plugin
|
||||
- [ ] neutrino-proxy-starter (SpringBoot)
|
||||
- 思考
|
||||
- 流量编排
|
||||
- 插件化定制
|
||||
- 重构
|
||||
- 代码重构
|
||||
- 多租户支持
|
||||
- 多个代理服务端节点支持
|
||||
- 协议重构
|
||||
- 支持多个隧道协议,支持扩展(TCP、KCP、QUIC)
|
||||
- 支持不同语言客户端、服务端接入
|
||||
- 基础优化
|
||||
- [ ] 访问白名单
|
||||
- [ ] 端口映射分组
|
||||
- [ ] 支持批量端口映射
|
||||
- [ ] 代理协议规范化,方便后续更好扩展、支持不同语言客户端接入
|
||||
- [ ] 如果UDP映射服务端端口变动,流量统计似乎不准,转发功能或许也受到影响,需要评估、测试、思考如何优化
|
||||
- [ ] 排查解决问题:https://gitee.com/dromara/neutrino-proxy/issues/I7LGLB
|
||||
- 监控运维
|
||||
- [ ] 监控服务端状态
|
||||
- [ ] 支持调整服务端端口、证书
|
||||
@@ -56,11 +23,14 @@
|
||||
- [ ] 服务端日志
|
||||
- [ ] 支持持管理后台动态调整日志级别。
|
||||
- [ ] 动态调整转发、报文、心跳输出
|
||||
- client+计划启动
|
||||
- [ ] 安卓客户端
|
||||
- [ ] 基于electron-egg的多平台客户端
|
||||
|
||||
# 3.x规划
|
||||
- [ ] 支持针对用户限速、限流
|
||||
- [ ] 支持P2P穿透
|
||||
- [ ] 支持原生编译
|
||||
- 插件开发
|
||||
- [ ] neutrino-proxy-solon-plugin
|
||||
- [ ] neutrino-proxy-jetbrains-plugin
|
||||
- [ ] neutrino-proxy-starter (SpringBoot)
|
||||
- client+计划启动
|
||||
- [ ] 安卓客户端
|
||||
- [ ] 基于electron-egg的多平台客户端
|
||||
|
||||