mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-03-19 17:15:49 +00:00
Compare commits
164 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
020bc9d77c | ||
|
|
5620d739c6 | ||
|
|
d518979e4f | ||
|
|
83f8a03b50 | ||
|
|
b45e63a14a | ||
|
|
3007bcff97 | ||
|
|
55f1d72af5 | ||
|
|
806ecbd7c5 | ||
|
|
ae79b43cdb | ||
|
|
e64e6327ef | ||
|
|
9f024b9e6a | ||
|
|
eacfbc86b5 | ||
|
|
37c17357fc | ||
|
|
b35d339665 | ||
|
|
5e7a3db873 | ||
|
|
6ced549dea | ||
|
|
f60682a6b7 | ||
|
|
50bd7a8040 | ||
|
|
7465768ff7 | ||
|
|
5b00a52c65 | ||
|
|
151f1173a1 | ||
|
|
e262132b9d | ||
|
|
ca0a7aeb5a | ||
|
|
7447cec17e | ||
|
|
0ffd27c0aa | ||
|
|
054cb1dea0 | ||
|
|
3757ae0b11 | ||
|
|
e3883fca87 | ||
|
|
b46a0b404b | ||
|
|
0ce58a095a | ||
|
|
59ea2645db | ||
|
|
8c8d280f14 | ||
|
|
c720008187 | ||
|
|
170d24499e | ||
|
|
99c79d4056 | ||
|
|
fcdeb1fc79 | ||
|
|
0a58b5e745 | ||
|
|
db7e7dcd29 | ||
|
|
01b8a27996 | ||
|
|
3764ece26c | ||
|
|
d7efc2aef9 | ||
|
|
2eb8abf61e | ||
|
|
299572a4c2 | ||
|
|
22afa50901 | ||
|
|
bc274d1e1f | ||
|
|
dc21f41932 | ||
|
|
f137b1af76 | ||
|
|
c4871ef8fe | ||
|
|
ecfffa882a | ||
|
|
3af5026abe | ||
|
|
1de7accd7c | ||
|
|
76afff2a6f | ||
|
|
9623e87511 | ||
|
|
bc0518391e | ||
|
|
5408a2f82c | ||
|
|
c8d71ea748 | ||
|
|
46de886b53 | ||
|
|
6d41320ed7 | ||
|
|
bf9d2e6aeb | ||
|
|
ed96fa090b | ||
|
|
3ac1d7f546 | ||
|
|
10025ffa66 | ||
|
|
5ee62b25ca | ||
|
|
311d11a3c1 | ||
|
|
40b6d7707a | ||
|
|
cbf316db31 | ||
|
|
33a36ada4b | ||
|
|
82ddd10627 | ||
|
|
2401c99817 | ||
|
|
2f36a4047c | ||
|
|
dc3b0d218a | ||
|
|
610d29765a | ||
|
|
b1ea8005e4 | ||
|
|
3f0bfa2472 | ||
|
|
1e2ff650ad | ||
|
|
c2d6dd923f | ||
|
|
723ec25fb2 | ||
|
|
7dc52e9a53 | ||
|
|
fe9f0d1d0e | ||
|
|
18d74d54ca | ||
|
|
c7ba6ae909 | ||
|
|
3edf79e589 | ||
|
|
5420e643cf | ||
|
|
9fcd0387ca | ||
|
|
7b039d219e | ||
|
|
dbec28b915 | ||
|
|
e5126806d7 | ||
|
|
b008ff4ad2 | ||
|
|
da6b89fdcd | ||
|
|
d7882c25d1 | ||
|
|
ed2a0a0bcf | ||
|
|
4a0914cb1e | ||
|
|
664269d513 | ||
|
|
d0796b26c9 | ||
|
|
2750f46c01 | ||
|
|
023eb513e4 | ||
|
|
0c7b59ed47 | ||
|
|
3087c1b123 | ||
|
|
2198397197 | ||
|
|
d10c312e62 | ||
|
|
24a3411465 | ||
|
|
2198e7a28f | ||
|
|
6b23b416a7 | ||
|
|
16f53ce4c2 | ||
|
|
27445b30e9 | ||
|
|
3d0212c21d | ||
|
|
978755960f | ||
|
|
9b51e9a5c5 | ||
|
|
6879a8fbcb | ||
|
|
7258841491 | ||
|
|
23dd80fbb0 | ||
|
|
6556884c7f | ||
|
|
d5c532c64f | ||
|
|
ad5f774a1e | ||
|
|
aa285914fa | ||
|
|
4d02756e1e | ||
|
|
825d93d95f | ||
|
|
5ea6386815 | ||
|
|
d064e85ecd | ||
|
|
9fc03bd10a | ||
|
|
ae08a29cde | ||
|
|
4f25eb230e | ||
|
|
ce72d53d1a | ||
|
|
5e641ff9e8 | ||
|
|
58898e5758 | ||
|
|
569550d5f6 | ||
|
|
419ea63dd0 | ||
|
|
6a17285935 | ||
|
|
4b03e9d919 | ||
|
|
7e9c3bdbaf | ||
|
|
957f3dbb54 | ||
|
|
05e60af283 | ||
|
|
5e40458116 | ||
|
|
baf6fdd29d | ||
|
|
45f78d3521 | ||
|
|
01f984e054 | ||
|
|
e4ba5ba53a | ||
|
|
6ff555c8bb | ||
|
|
3c1634ca7c | ||
|
|
561c4810be | ||
|
|
eb1b96643d | ||
|
|
de5314c01f | ||
|
|
1088d1faf3 | ||
|
|
267024c43f | ||
|
|
0d595f56e4 | ||
|
|
a4c4f9efb3 | ||
|
|
73a5722cca | ||
|
|
30264043f8 | ||
|
|
c6062eb15c | ||
|
|
f1b7944828 | ||
|
|
7a57b31ff3 | ||
|
|
6e1b949081 | ||
|
|
0ad708b1b6 | ||
|
|
71f13ebcbd | ||
|
|
f5f4a530cc | ||
|
|
702f03e4b7 | ||
|
|
487ec74e0b | ||
|
|
b4dae36345 | ||
|
|
761728255c | ||
|
|
b1ab156e42 | ||
|
|
fa45bf87de | ||
|
|
75416eebd7 | ||
|
|
87042d77ba | ||
|
|
011e0f309a |
4
.github/FUNDING.yml
vendored
4
.github/FUNDING.yml
vendored
@@ -1,6 +1,6 @@
|
|||||||
# These are supported funding model platforms
|
# These are supported funding model platforms
|
||||||
|
|
||||||
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
|
github: MHSanaei
|
||||||
patreon: # Replace with a single Patreon username
|
patreon: # Replace with a single Patreon username
|
||||||
open_collective: # Replace with a single Open Collective username
|
open_collective: # Replace with a single Open Collective username
|
||||||
ko_fi: # Replace with a single Ko-fi username
|
ko_fi: # Replace with a single Ko-fi username
|
||||||
@@ -11,4 +11,4 @@ issuehunt: # Replace with a single IssueHunt username
|
|||||||
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
|
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
|
||||||
polar: # Replace with a single Polar username
|
polar: # Replace with a single Polar username
|
||||||
buy_me_a_coffee: mhsanaei
|
buy_me_a_coffee: mhsanaei
|
||||||
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
custom: https://nowpayments.io/donation/hsanaei
|
||||||
|
|||||||
7
.github/workflows/docker.yml
vendored
7
.github/workflows/docker.yml
vendored
@@ -1,4 +1,7 @@
|
|||||||
name: Release 3X-UI for Docker
|
name: Release 3X-UI for Docker
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
packages: write
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
push:
|
push:
|
||||||
@@ -7,10 +10,10 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v5
|
||||||
with:
|
with:
|
||||||
submodules: true
|
submodules: true
|
||||||
|
|
||||||
|
|||||||
159
.github/workflows/release.yml
vendored
159
.github/workflows/release.yml
vendored
@@ -7,6 +7,8 @@ on:
|
|||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
|
tags:
|
||||||
|
- "v*.*.*"
|
||||||
paths:
|
paths:
|
||||||
- '**.js'
|
- '**.js'
|
||||||
- '**.css'
|
- '**.css'
|
||||||
@@ -31,62 +33,48 @@ jobs:
|
|||||||
- 386
|
- 386
|
||||||
- armv5
|
- armv5
|
||||||
- s390x
|
- s390x
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v5
|
||||||
|
|
||||||
- name: Setup Go
|
- name: Setup Go
|
||||||
uses: actions/setup-go@v5
|
uses: actions/setup-go@v6
|
||||||
with:
|
with:
|
||||||
go-version-file: go.mod
|
go-version-file: go.mod
|
||||||
check-latest: true
|
check-latest: true
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Build 3X-UI
|
||||||
run: |
|
|
||||||
sudo apt-get update
|
|
||||||
if [ "${{ matrix.platform }}" == "arm64" ]; then
|
|
||||||
sudo apt install gcc-aarch64-linux-gnu
|
|
||||||
elif [ "${{ matrix.platform }}" == "armv7" ]; then
|
|
||||||
sudo apt install gcc-arm-linux-gnueabihf
|
|
||||||
elif [ "${{ matrix.platform }}" == "armv6" ]; then
|
|
||||||
sudo apt install gcc-arm-linux-gnueabihf
|
|
||||||
elif [ "${{ matrix.platform }}" == "386" ]; then
|
|
||||||
sudo apt install gcc-i686-linux-gnu
|
|
||||||
elif [ "${{ matrix.platform }}" == "armv5" ]; then
|
|
||||||
sudo apt install gcc-arm-linux-gnueabi
|
|
||||||
elif [ "${{ matrix.platform }}" == "s390x" ]; then
|
|
||||||
sudo apt install gcc-s390x-linux-gnu
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Build 3x-ui
|
|
||||||
run: |
|
run: |
|
||||||
export CGO_ENABLED=1
|
export CGO_ENABLED=1
|
||||||
export GOOS=linux
|
export GOOS=linux
|
||||||
export GOARCH=${{ matrix.platform }}
|
export GOARCH=${{ matrix.platform }}
|
||||||
if [ "${{ matrix.platform }}" == "arm64" ]; then
|
# Use Bootlin prebuilt cross-toolchains (musl 1.2.5 in stable series)
|
||||||
export GOARCH=arm64
|
case "${{ matrix.platform }}" in
|
||||||
export CC=aarch64-linux-gnu-gcc
|
amd64) BOOTLIN_ARCH="x86-64" ;;
|
||||||
elif [ "${{ matrix.platform }}" == "armv7" ]; then
|
arm64) BOOTLIN_ARCH="aarch64" ;;
|
||||||
export GOARCH=arm
|
armv7) BOOTLIN_ARCH="armv7-eabihf"; export GOARCH=arm GOARM=7 ;;
|
||||||
export GOARM=7
|
armv6) BOOTLIN_ARCH="armv6-eabihf"; export GOARCH=arm GOARM=6 ;;
|
||||||
export CC=arm-linux-gnueabihf-gcc
|
armv5) BOOTLIN_ARCH="armv5-eabi"; export GOARCH=arm GOARM=5 ;;
|
||||||
elif [ "${{ matrix.platform }}" == "armv6" ]; then
|
386) BOOTLIN_ARCH="x86-i686" ;;
|
||||||
export GOARCH=arm
|
s390x) BOOTLIN_ARCH="s390x-z13" ;;
|
||||||
export GOARM=6
|
esac
|
||||||
export CC=arm-linux-gnueabihf-gcc
|
echo "Resolving Bootlin musl toolchain for arch=$BOOTLIN_ARCH (platform=${{ matrix.platform }})"
|
||||||
elif [ "${{ matrix.platform }}" == "386" ]; then
|
TARBALL_BASE="https://toolchains.bootlin.com/downloads/releases/toolchains/$BOOTLIN_ARCH/tarballs/"
|
||||||
export GOARCH=386
|
TARBALL_URL=$(curl -fsSL "$TARBALL_BASE" | grep -oE "${BOOTLIN_ARCH}--musl--stable-[^\"]+\\.tar\\.xz" | sort -r | head -n1)
|
||||||
export CC=i686-linux-gnu-gcc
|
[ -z "$TARBALL_URL" ] && { echo "Failed to locate Bootlin musl toolchain for arch=$BOOTLIN_ARCH" >&2; exit 1; }
|
||||||
elif [ "${{ matrix.platform }}" == "armv5" ]; then
|
echo "Downloading: $TARBALL_URL"
|
||||||
export GOARCH=arm
|
cd /tmp
|
||||||
export GOARM=5
|
curl -fL -sS -o "$(basename "$TARBALL_URL")" "$TARBALL_BASE/$TARBALL_URL"
|
||||||
export CC=arm-linux-gnueabi-gcc
|
tar -xf "$(basename "$TARBALL_URL")"
|
||||||
elif [ "${{ matrix.platform }}" == "s390x" ]; then
|
TOOLCHAIN_DIR=$(find . -maxdepth 1 -type d -name "${BOOTLIN_ARCH}--musl--stable-*" | head -n1)
|
||||||
export GOARCH=s390x
|
export PATH="$(realpath "$TOOLCHAIN_DIR")/bin:$PATH"
|
||||||
export CC=s390x-linux-gnu-gcc
|
export CC=$(realpath "$(find "$TOOLCHAIN_DIR/bin" -name '*-gcc.br_real' -type f -executable | head -n1)")
|
||||||
fi
|
[ -z "$CC" ] && { echo "No gcc.br_real found in $TOOLCHAIN_DIR/bin" >&2; exit 1; }
|
||||||
go build -ldflags "-w -s" -o xui-release -v main.go
|
cd -
|
||||||
|
go build -ldflags "-w -s -linkmode external -extldflags '-static'" -o xui-release -v main.go
|
||||||
|
file xui-release
|
||||||
|
ldd xui-release || echo "Static binary confirmed"
|
||||||
|
|
||||||
mkdir x-ui
|
mkdir x-ui
|
||||||
cp xui-release x-ui/
|
cp xui-release x-ui/
|
||||||
@@ -97,7 +85,7 @@ jobs:
|
|||||||
cd x-ui/bin
|
cd x-ui/bin
|
||||||
|
|
||||||
# Download dependencies
|
# Download dependencies
|
||||||
Xray_URL="https://github.com/XTLS/Xray-core/releases/download/v25.6.8/"
|
Xray_URL="https://github.com/XTLS/Xray-core/releases/download/v25.9.11/"
|
||||||
if [ "${{ matrix.platform }}" == "amd64" ]; then
|
if [ "${{ matrix.platform }}" == "amd64" ]; then
|
||||||
wget -q ${Xray_URL}Xray-linux-64.zip
|
wget -q ${Xray_URL}Xray-linux-64.zip
|
||||||
unzip Xray-linux-64.zip
|
unzip Xray-linux-64.zip
|
||||||
@@ -148,10 +136,89 @@ jobs:
|
|||||||
|
|
||||||
- name: Upload files to GH release
|
- name: Upload files to GH release
|
||||||
uses: svenstaro/upload-release-action@v2
|
uses: svenstaro/upload-release-action@v2
|
||||||
if: github.event_name == 'release' && github.event.action == 'published'
|
if: |
|
||||||
|
(github.event_name == 'release' && github.event.action == 'published') ||
|
||||||
|
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/'))
|
||||||
with:
|
with:
|
||||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
tag: ${{ github.ref }}
|
tag: ${{ github.ref }}
|
||||||
file: x-ui-linux-${{ matrix.platform }}.tar.gz
|
file: x-ui-linux-${{ matrix.platform }}.tar.gz
|
||||||
asset_name: x-ui-linux-${{ matrix.platform }}.tar.gz
|
asset_name: x-ui-linux-${{ matrix.platform }}.tar.gz
|
||||||
|
overwrite: true
|
||||||
prerelease: true
|
prerelease: true
|
||||||
|
|
||||||
|
# =================================
|
||||||
|
# Windows Build
|
||||||
|
# =================================
|
||||||
|
build-windows:
|
||||||
|
name: Build for Windows
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
platform:
|
||||||
|
- amd64
|
||||||
|
runs-on: windows-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v5
|
||||||
|
|
||||||
|
- name: Setup Go
|
||||||
|
uses: actions/setup-go@v6
|
||||||
|
with:
|
||||||
|
go-version-file: go.mod
|
||||||
|
check-latest: true
|
||||||
|
|
||||||
|
- name: Build 3X-UI for Windows
|
||||||
|
shell: pwsh
|
||||||
|
run: |
|
||||||
|
$env:CGO_ENABLED="1"
|
||||||
|
$env:GOOS="windows"
|
||||||
|
$env:GOARCH="amd64"
|
||||||
|
go build -ldflags "-w -s" -o xui-release.exe -v main.go
|
||||||
|
|
||||||
|
mkdir x-ui
|
||||||
|
Copy-Item xui-release.exe x-ui\
|
||||||
|
mkdir x-ui\bin
|
||||||
|
cd x-ui\bin
|
||||||
|
|
||||||
|
# Download Xray for Windows
|
||||||
|
$Xray_URL = "https://github.com/XTLS/Xray-core/releases/download/v25.9.11/"
|
||||||
|
Invoke-WebRequest -Uri "${Xray_URL}Xray-windows-64.zip" -OutFile "Xray-windows-64.zip"
|
||||||
|
Expand-Archive -Path "Xray-windows-64.zip" -DestinationPath .
|
||||||
|
Remove-Item "Xray-windows-64.zip"
|
||||||
|
Remove-Item geoip.dat, geosite.dat -ErrorAction SilentlyContinue
|
||||||
|
Invoke-WebRequest -Uri "https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geoip.dat" -OutFile "geoip.dat"
|
||||||
|
Invoke-WebRequest -Uri "https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geosite.dat" -OutFile "geosite.dat"
|
||||||
|
Invoke-WebRequest -Uri "https://github.com/chocolate4u/Iran-v2ray-rules/releases/latest/download/geoip.dat" -OutFile "geoip_IR.dat"
|
||||||
|
Invoke-WebRequest -Uri "https://github.com/chocolate4u/Iran-v2ray-rules/releases/latest/download/geosite.dat" -OutFile "geosite_IR.dat"
|
||||||
|
Invoke-WebRequest -Uri "https://github.com/runetfreedom/russia-v2ray-rules-dat/releases/latest/download/geoip.dat" -OutFile "geoip_RU.dat"
|
||||||
|
Invoke-WebRequest -Uri "https://github.com/runetfreedom/russia-v2ray-rules-dat/releases/latest/download/geosite.dat" -OutFile "geosite_RU.dat"
|
||||||
|
Rename-Item xray.exe xray-windows-amd64.exe
|
||||||
|
cd ..
|
||||||
|
Copy-Item -Path ..\windows_files\* -Destination . -Recurse
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
- name: Package to Zip
|
||||||
|
shell: pwsh
|
||||||
|
run: |
|
||||||
|
Compress-Archive -Path .\x-ui -DestinationPath "x-ui-windows-amd64.zip"
|
||||||
|
|
||||||
|
- name: Upload files to Artifacts
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: x-ui-windows-amd64
|
||||||
|
path: ./x-ui-windows-amd64.zip
|
||||||
|
|
||||||
|
- name: Upload files to GH release
|
||||||
|
uses: svenstaro/upload-release-action@v2
|
||||||
|
if: |
|
||||||
|
(github.event_name == 'release' && github.event.action == 'published') ||
|
||||||
|
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/'))
|
||||||
|
with:
|
||||||
|
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
tag: ${{ github.ref }}
|
||||||
|
file: x-ui-windows-amd64.zip
|
||||||
|
asset_name: x-ui-windows-amd64.zip
|
||||||
|
overwrite: true
|
||||||
|
prerelease: true
|
||||||
4
.gitignore
vendored
4
.gitignore
vendored
@@ -29,9 +29,9 @@ main
|
|||||||
.DS_Store
|
.DS_Store
|
||||||
Thumbs.db
|
Thumbs.db
|
||||||
|
|
||||||
# Ignore Go specific files
|
# Ignore Go build files
|
||||||
*.exe
|
*.exe
|
||||||
*.exe~
|
x-ui.db
|
||||||
|
|
||||||
# Ignore Docker specific files
|
# Ignore Docker specific files
|
||||||
docker-compose.override.yml
|
docker-compose.override.yml
|
||||||
|
|||||||
35
.vscode/launch.json
vendored
Normal file
35
.vscode/launch.json
vendored
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
{
|
||||||
|
"$schema": "vscode://schemas/launch",
|
||||||
|
"version": "0.2.0",
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"name": "Run 3x-ui (Debug)",
|
||||||
|
"type": "go",
|
||||||
|
"request": "launch",
|
||||||
|
"mode": "auto",
|
||||||
|
"program": "${workspaceFolder}",
|
||||||
|
"cwd": "${workspaceFolder}",
|
||||||
|
"env": {
|
||||||
|
"XUI_DEBUG": "true"
|
||||||
|
},
|
||||||
|
"console": "integratedTerminal"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Run 3x-ui (Debug, custom env)",
|
||||||
|
"type": "go",
|
||||||
|
"request": "launch",
|
||||||
|
"mode": "auto",
|
||||||
|
"program": "${workspaceFolder}",
|
||||||
|
"cwd": "${workspaceFolder}",
|
||||||
|
"env": {
|
||||||
|
// Set to true to serve assets/templates directly from disk for development
|
||||||
|
"XUI_DEBUG": "true",
|
||||||
|
// Uncomment to override DB folder location (by default uses working dir on Windows when debug)
|
||||||
|
// "XUI_DB_FOLDER": "${workspaceFolder}",
|
||||||
|
// Example: override log level (debug|info|notice|warn|error)
|
||||||
|
// "XUI_LOG_LEVEL": "debug"
|
||||||
|
},
|
||||||
|
"console": "integratedTerminal"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
40
.vscode/tasks.json
vendored
Normal file
40
.vscode/tasks.json
vendored
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
{
|
||||||
|
"version": "2.0.0",
|
||||||
|
"tasks": [
|
||||||
|
{
|
||||||
|
"label": "go: build",
|
||||||
|
"type": "shell",
|
||||||
|
"command": "go",
|
||||||
|
"args": ["build", "-o", "bin/3x-ui.exe", "./main.go"],
|
||||||
|
"options": {
|
||||||
|
"cwd": "${workspaceFolder}"
|
||||||
|
},
|
||||||
|
"problemMatcher": ["$go"],
|
||||||
|
"group": { "kind": "build", "isDefault": true }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "go: run",
|
||||||
|
"type": "shell",
|
||||||
|
"command": "go",
|
||||||
|
"args": ["run", "./main.go"],
|
||||||
|
"options": {
|
||||||
|
"cwd": "${workspaceFolder}",
|
||||||
|
"env": {
|
||||||
|
"XUI_DEBUG": "true"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"problemMatcher": ["$go"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "go: test",
|
||||||
|
"type": "shell",
|
||||||
|
"command": "go",
|
||||||
|
"args": ["test", "./..."],
|
||||||
|
"options": {
|
||||||
|
"cwd": "${workspaceFolder}"
|
||||||
|
},
|
||||||
|
"problemMatcher": ["$go"],
|
||||||
|
"group": "test"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -27,7 +27,7 @@ case $1 in
|
|||||||
esac
|
esac
|
||||||
mkdir -p build/bin
|
mkdir -p build/bin
|
||||||
cd build/bin
|
cd build/bin
|
||||||
wget -q "https://github.com/XTLS/Xray-core/releases/download/v25.6.8/Xray-linux-${ARCH}.zip"
|
wget -q "https://github.com/XTLS/Xray-core/releases/download/v25.9.11/Xray-linux-${ARCH}.zip"
|
||||||
unzip "Xray-linux-${ARCH}.zip"
|
unzip "Xray-linux-${ARCH}.zip"
|
||||||
rm -f "Xray-linux-${ARCH}.zip" geoip.dat geosite.dat
|
rm -f "Xray-linux-${ARCH}.zip" geoip.dat geosite.dat
|
||||||
mv xray "xray-linux-${FNAME}"
|
mv xray "xray-linux-${FNAME}"
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# ========================================================
|
# ========================================================
|
||||||
# Stage: Builder
|
# Stage: Builder
|
||||||
# ========================================================
|
# ========================================================
|
||||||
FROM golang:1.24-alpine AS builder
|
FROM golang:1.25-alpine AS builder
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
ARG TARGETARCH
|
ARG TARGETARCH
|
||||||
|
|
||||||
@@ -49,6 +49,7 @@ RUN chmod +x \
|
|||||||
/usr/bin/x-ui
|
/usr/bin/x-ui
|
||||||
|
|
||||||
ENV XUI_ENABLE_FAIL2BAN="true"
|
ENV XUI_ENABLE_FAIL2BAN="true"
|
||||||
|
EXPOSE 2053
|
||||||
VOLUME [ "/etc/x-ui" ]
|
VOLUME [ "/etc/x-ui" ]
|
||||||
CMD [ "./x-ui" ]
|
CMD [ "./x-ui" ]
|
||||||
ENTRYPOINT [ "/app/DockerEntrypoint.sh" ]
|
ENTRYPOINT [ "/app/DockerEntrypoint.sh" ]
|
||||||
|
|||||||
@@ -7,11 +7,13 @@
|
|||||||
</picture>
|
</picture>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
[](https://github.com/MHSanaei/3x-ui/releases)
|
[](https://github.com/MHSanaei/3x-ui/releases)
|
||||||
[](https://github.com/MHSanaei/3x-ui/actions)
|
[](https://github.com/MHSanaei/3x-ui/actions)
|
||||||
[](#)
|
[](#)
|
||||||
[](https://github.com/MHSanaei/3x-ui/releases/latest)
|
[](https://github.com/MHSanaei/3x-ui/releases/latest)
|
||||||
[](https://www.gnu.org/licenses/gpl-3.0.en.html)
|
[](https://www.gnu.org/licenses/gpl-3.0.en.html)
|
||||||
|
[](https://pkg.go.dev/github.com/mhsanaei/3x-ui/v2)
|
||||||
|
[](https://goreportcard.com/report/github.com/mhsanaei/3x-ui/v2)
|
||||||
|
|
||||||
**3X-UI** — لوحة تحكم متقدمة مفتوحة المصدر تعتمد على الويب مصممة لإدارة خادم Xray-core. توفر واجهة سهلة الاستخدام لتكوين ومراقبة بروتوكولات VPN والوكيل المختلفة.
|
**3X-UI** — لوحة تحكم متقدمة مفتوحة المصدر تعتمد على الويب مصممة لإدارة خادم Xray-core. توفر واجهة سهلة الاستخدام لتكوين ومراقبة بروتوكولات VPN والوكيل المختلفة.
|
||||||
|
|
||||||
@@ -41,15 +43,13 @@ bash <(curl -Ls https://raw.githubusercontent.com/mhsanaei/3x-ui/master/install.
|
|||||||
|
|
||||||
**إذا كان هذا المشروع مفيدًا لك، فقد ترغب في إعطائه**:star2:
|
**إذا كان هذا المشروع مفيدًا لك، فقد ترغب في إعطائه**:star2:
|
||||||
|
|
||||||
<p align="left">
|
<a href="https://www.buymeacoffee.com/MHSanaei" target="_blank">
|
||||||
<a href="https://buymeacoffee.com/mhsanaei" target="_blank">
|
<img src="./media/default-yellow.png" alt="Buy Me A Coffee" style="height: 70px !important;width: 277px !important;" >
|
||||||
<img src="./media/buymeacoffe.png" alt="Image">
|
</a>
|
||||||
</a>
|
</br>
|
||||||
</p>
|
<a href="https://nowpayments.io/donation/hsanaei" target="_blank" rel="noreferrer noopener">
|
||||||
|
<img src="./media/donation-button-black.svg" alt="Crypto donation button by NOWPayments">
|
||||||
- USDT (TRC20): `TXncxkvhkDWGts487Pjqq1qT9JmwRUz8CC`
|
</a>
|
||||||
- MATIC (polygon): `0x41C9548675D044c6Bfb425786C765bc37427256A`
|
|
||||||
- LTC (Litecoin): `ltc1q2ach7x6d2zq0n4l0t4zl7d7xe2s6fs7a3vspwv`
|
|
||||||
|
|
||||||
## النجوم عبر الزمن
|
## النجوم عبر الزمن
|
||||||
|
|
||||||
|
|||||||
@@ -7,11 +7,13 @@
|
|||||||
</picture>
|
</picture>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
[](https://github.com/MHSanaei/3x-ui/releases)
|
[](https://github.com/MHSanaei/3x-ui/releases)
|
||||||
[](https://github.com/MHSanaei/3x-ui/actions)
|
[](https://github.com/MHSanaei/3x-ui/actions)
|
||||||
[](#)
|
[](#)
|
||||||
[](https://github.com/MHSanaei/3x-ui/releases/latest)
|
[](https://github.com/MHSanaei/3x-ui/releases/latest)
|
||||||
[](https://www.gnu.org/licenses/gpl-3.0.en.html)
|
[](https://www.gnu.org/licenses/gpl-3.0.en.html)
|
||||||
|
[](https://pkg.go.dev/github.com/mhsanaei/3x-ui/v2)
|
||||||
|
[](https://goreportcard.com/report/github.com/mhsanaei/3x-ui/v2)
|
||||||
|
|
||||||
**3X-UI** — panel de control avanzado basado en web de código abierto diseñado para gestionar el servidor Xray-core. Ofrece una interfaz fácil de usar para configurar y monitorear varios protocolos VPN y proxy.
|
**3X-UI** — panel de control avanzado basado en web de código abierto diseñado para gestionar el servidor Xray-core. Ofrece una interfaz fácil de usar para configurar y monitorear varios protocolos VPN y proxy.
|
||||||
|
|
||||||
@@ -41,15 +43,14 @@ Para documentación completa, visita la [Wiki del proyecto](https://github.com/M
|
|||||||
|
|
||||||
**Si este proyecto te es útil, puedes darle una**:star2:
|
**Si este proyecto te es útil, puedes darle una**:star2:
|
||||||
|
|
||||||
<p align="left">
|
<a href="https://www.buymeacoffee.com/MHSanaei" target="_blank">
|
||||||
<a href="https://buymeacoffee.com/mhsanaei" target="_blank">
|
<img src="./media/default-yellow.png" alt="Buy Me A Coffee" style="height: 70px !important;width: 277px !important;" >
|
||||||
<img src="./media/buymeacoffe.png" alt="Image">
|
</a>
|
||||||
</a>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
- USDT (TRC20): `TXncxkvhkDWGts487Pjqq1qT9JmwRUz8CC`
|
</br>
|
||||||
- MATIC (polygon): `0x41C9548675D044c6Bfb425786C765bc37427256A`
|
<a href="https://nowpayments.io/donation/hsanaei" target="_blank" rel="noreferrer noopener">
|
||||||
- LTC (Litecoin): `ltc1q2ach7x6d2zq0n4l0t4zl7d7xe2s6fs7a3vspwv`
|
<img src="./media/donation-button-black.svg" alt="Crypto donation button by NOWPayments">
|
||||||
|
</a>
|
||||||
|
|
||||||
## Estrellas a lo Largo del Tiempo
|
## Estrellas a lo Largo del Tiempo
|
||||||
|
|
||||||
|
|||||||
@@ -7,11 +7,13 @@
|
|||||||
</picture>
|
</picture>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
[](https://github.com/MHSanaei/3x-ui/releases)
|
[](https://github.com/MHSanaei/3x-ui/releases)
|
||||||
[](https://github.com/MHSanaei/3x-ui/actions)
|
[](https://github.com/MHSanaei/3x-ui/actions)
|
||||||
[](#)
|
[](#)
|
||||||
[](https://github.com/MHSanaei/3x-ui/releases/latest)
|
[](https://github.com/MHSanaei/3x-ui/releases/latest)
|
||||||
[](https://www.gnu.org/licenses/gpl-3.0.en.html)
|
[](https://www.gnu.org/licenses/gpl-3.0.en.html)
|
||||||
|
[](https://pkg.go.dev/github.com/mhsanaei/3x-ui/v2)
|
||||||
|
[](https://goreportcard.com/report/github.com/mhsanaei/3x-ui/v2)
|
||||||
|
|
||||||
**3X-UI** — یک پنل کنترل پیشرفته مبتنی بر وب با کد باز که برای مدیریت سرور Xray-core طراحی شده است. این پنل یک رابط کاربری آسان برای پیکربندی و نظارت بر پروتکلهای مختلف VPN و پراکسی ارائه میدهد.
|
**3X-UI** — یک پنل کنترل پیشرفته مبتنی بر وب با کد باز که برای مدیریت سرور Xray-core طراحی شده است. این پنل یک رابط کاربری آسان برای پیکربندی و نظارت بر پروتکلهای مختلف VPN و پراکسی ارائه میدهد.
|
||||||
|
|
||||||
@@ -41,15 +43,14 @@ bash <(curl -Ls https://raw.githubusercontent.com/mhsanaei/3x-ui/master/install.
|
|||||||
|
|
||||||
**اگر این پروژه برای شما مفید است، میتوانید به آن یک**:star2: بدهید
|
**اگر این پروژه برای شما مفید است، میتوانید به آن یک**:star2: بدهید
|
||||||
|
|
||||||
<p align="left">
|
<a href="https://www.buymeacoffee.com/MHSanaei" target="_blank">
|
||||||
<a href="https://buymeacoffee.com/mhsanaei" target="_blank">
|
<img src="./media/default-yellow.png" alt="Buy Me A Coffee" style="height: 70px !important;width: 277px !important;" >
|
||||||
<img src="./media/buymeacoffe.png" alt="Image">
|
</a>
|
||||||
</a>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
- USDT (TRC20): `TXncxkvhkDWGts487Pjqq1qT9JmwRUz8CC`
|
</br>
|
||||||
- MATIC (polygon): `0x41C9548675D044c6Bfb425786C765bc37427256A`
|
<a href="https://nowpayments.io/donation/hsanaei" target="_blank" rel="noreferrer noopener">
|
||||||
- LTC (Litecoin): `ltc1q2ach7x6d2zq0n4l0t4zl7d7xe2s6fs7a3vspwv`
|
<img src="./media/donation-button-black.svg" alt="Crypto donation button by NOWPayments">
|
||||||
|
</a>
|
||||||
|
|
||||||
## ستارهها در طول زمان
|
## ستارهها در طول زمان
|
||||||
|
|
||||||
|
|||||||
27
README.md
27
README.md
@@ -7,11 +7,13 @@
|
|||||||
</picture>
|
</picture>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
[](https://github.com/MHSanaei/3x-ui/releases)
|
[](https://github.com/MHSanaei/3x-ui/releases)
|
||||||
[](https://github.com/MHSanaei/3x-ui/actions)
|
[](https://github.com/MHSanaei/3x-ui/actions)
|
||||||
[](#)
|
[](#)
|
||||||
[](https://github.com/MHSanaei/3x-ui/releases/latest)
|
[](https://github.com/MHSanaei/3x-ui/releases/latest)
|
||||||
[](https://www.gnu.org/licenses/gpl-3.0.en.html)
|
[](https://www.gnu.org/licenses/gpl-3.0.en.html)
|
||||||
|
[](https://pkg.go.dev/github.com/mhsanaei/3x-ui/v2)
|
||||||
|
[](https://goreportcard.com/report/github.com/mhsanaei/3x-ui/v2)
|
||||||
|
|
||||||
**3X-UI** — advanced, open-source web-based control panel designed for managing Xray-core server. It offers a user-friendly interface for configuring and monitoring various VPN and proxy protocols.
|
**3X-UI** — advanced, open-source web-based control panel designed for managing Xray-core server. It offers a user-friendly interface for configuring and monitoring various VPN and proxy protocols.
|
||||||
|
|
||||||
@@ -41,15 +43,14 @@ For full documentation, please visit the [project Wiki](https://github.com/MHSan
|
|||||||
|
|
||||||
**If this project is helpful to you, you may wish to give it a**:star2:
|
**If this project is helpful to you, you may wish to give it a**:star2:
|
||||||
|
|
||||||
<p align="left">
|
<a href="https://www.buymeacoffee.com/MHSanaei" target="_blank">
|
||||||
<a href="https://buymeacoffee.com/mhsanaei" target="_blank">
|
<img src="./media/default-yellow.png" alt="Buy Me A Coffee" style="height: 70px !important;width: 277px !important;" >
|
||||||
<img src="./media/buymeacoffe.png" alt="Image">
|
</a>
|
||||||
</a>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
- USDT (TRC20): `TXncxkvhkDWGts487Pjqq1qT9JmwRUz8CC`
|
</br>
|
||||||
- MATIC (polygon): `0x41C9548675D044c6Bfb425786C765bc37427256A`
|
<a href="https://nowpayments.io/donation/hsanaei" target="_blank" rel="noreferrer noopener">
|
||||||
- LTC (Litecoin): `ltc1q2ach7x6d2zq0n4l0t4zl7d7xe2s6fs7a3vspwv`
|
<img src="./media/donation-button-black.svg" alt="Crypto donation button by NOWPayments">
|
||||||
|
</a>
|
||||||
|
|
||||||
## Stargazers over Time
|
## Stargazers over Time
|
||||||
|
|
||||||
|
|||||||
@@ -7,11 +7,13 @@
|
|||||||
</picture>
|
</picture>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
[](https://github.com/MHSanaei/3x-ui/releases)
|
[](https://github.com/MHSanaei/3x-ui/releases)
|
||||||
[](https://github.com/MHSanaei/3x-ui/actions)
|
[](https://github.com/MHSanaei/3x-ui/actions)
|
||||||
[](#)
|
[](#)
|
||||||
[](https://github.com/MHSanaei/3x-ui/releases/latest)
|
[](https://github.com/MHSanaei/3x-ui/releases/latest)
|
||||||
[](https://www.gnu.org/licenses/gpl-3.0.en.html)
|
[](https://www.gnu.org/licenses/gpl-3.0.en.html)
|
||||||
|
[](https://pkg.go.dev/github.com/mhsanaei/3x-ui/v2)
|
||||||
|
[](https://goreportcard.com/report/github.com/mhsanaei/3x-ui/v2)
|
||||||
|
|
||||||
**3X-UI** — продвинутая панель управления с открытым исходным кодом на основе веб-интерфейса, разработанная для управления сервером Xray-core. Предоставляет удобный интерфейс для настройки и мониторинга различных VPN и прокси-протоколов.
|
**3X-UI** — продвинутая панель управления с открытым исходным кодом на основе веб-интерфейса, разработанная для управления сервером Xray-core. Предоставляет удобный интерфейс для настройки и мониторинга различных VPN и прокси-протоколов.
|
||||||
|
|
||||||
@@ -41,15 +43,14 @@ bash <(curl -Ls https://raw.githubusercontent.com/mhsanaei/3x-ui/master/install.
|
|||||||
|
|
||||||
**Если этот проект полезен для вас, вы можете поставить ему**:star2:
|
**Если этот проект полезен для вас, вы можете поставить ему**:star2:
|
||||||
|
|
||||||
<p align="left">
|
<a href="https://www.buymeacoffee.com/MHSanaei" target="_blank">
|
||||||
<a href="https://buymeacoffee.com/mhsanaei" target="_blank">
|
<img src="./media/default-yellow.png" alt="Buy Me A Coffee" style="height: 70px !important;width: 277px !important;" >
|
||||||
<img src="./media/buymeacoffe.png" alt="Image">
|
</a>
|
||||||
</a>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
- USDT (TRC20): `TXncxkvhkDWGts487Pjqq1qT9JmwRUz8CC`
|
</br>
|
||||||
- MATIC (polygon): `0x41C9548675D044c6Bfb425786C765bc37427256A`
|
<a href="https://nowpayments.io/donation/hsanaei" target="_blank" rel="noreferrer noopener">
|
||||||
- LTC (Litecoin): `ltc1q2ach7x6d2zq0n4l0t4zl7d7xe2s6fs7a3vspwv`
|
<img src="./media/donation-button-black.svg" alt="Crypto donation button by NOWPayments">
|
||||||
|
</a>
|
||||||
|
|
||||||
## Звезды с течением времени
|
## Звезды с течением времени
|
||||||
|
|
||||||
|
|||||||
@@ -7,11 +7,13 @@
|
|||||||
</picture>
|
</picture>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
[](https://github.com/MHSanaei/3x-ui/releases)
|
[](https://github.com/MHSanaei/3x-ui/releases)
|
||||||
[](https://github.com/MHSanaei/3x-ui/actions)
|
[](https://github.com/MHSanaei/3x-ui/actions)
|
||||||
[](#)
|
[](#)
|
||||||
[](https://github.com/MHSanaei/3x-ui/releases/latest)
|
[](https://github.com/MHSanaei/3x-ui/releases/latest)
|
||||||
[](https://www.gnu.org/licenses/gpl-3.0.en.html)
|
[](https://www.gnu.org/licenses/gpl-3.0.en.html)
|
||||||
|
[](https://pkg.go.dev/github.com/mhsanaei/3x-ui/v2)
|
||||||
|
[](https://goreportcard.com/report/github.com/mhsanaei/3x-ui/v2)
|
||||||
|
|
||||||
**3X-UI** — 一个基于网页的高级开源控制面板,专为管理 Xray-core 服务器而设计。它提供了用户友好的界面,用于配置和监控各种 VPN 和代理协议。
|
**3X-UI** — 一个基于网页的高级开源控制面板,专为管理 Xray-core 服务器而设计。它提供了用户友好的界面,用于配置和监控各种 VPN 和代理协议。
|
||||||
|
|
||||||
@@ -41,15 +43,14 @@ bash <(curl -Ls https://raw.githubusercontent.com/mhsanaei/3x-ui/master/install.
|
|||||||
|
|
||||||
**如果这个项目对您有帮助,您可以给它一个**:star2:
|
**如果这个项目对您有帮助,您可以给它一个**:star2:
|
||||||
|
|
||||||
<p align="left">
|
<a href="https://www.buymeacoffee.com/MHSanaei" target="_blank">
|
||||||
<a href="https://buymeacoffee.com/mhsanaei" target="_blank">
|
<img src="./media/default-yellow.png" alt="Buy Me A Coffee" style="height: 70px !important;width: 277px !important;" >
|
||||||
<img src="./media/buymeacoffe.png" alt="Image">
|
</a>
|
||||||
</a>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
- USDT (TRC20): `TXncxkvhkDWGts487Pjqq1qT9JmwRUz8CC`
|
</br>
|
||||||
- MATIC (polygon): `0x41C9548675D044c6Bfb425786C765bc37427256A`
|
<a href="https://nowpayments.io/donation/hsanaei" target="_blank" rel="noreferrer noopener">
|
||||||
- LTC (Litecoin): `ltc1q2ach7x6d2zq0n4l0t4zl7d7xe2s6fs7a3vspwv`
|
<img src="./media/donation-button-black.svg" alt="Crypto donation button by NOWPayments">
|
||||||
|
</a>
|
||||||
|
|
||||||
## 随时间变化的星标数
|
## 随时间变化的星标数
|
||||||
|
|
||||||
|
|||||||
107
config/config.go
107
config/config.go
@@ -1,9 +1,14 @@
|
|||||||
|
// Package config provides configuration management utilities for the 3x-ui panel,
|
||||||
|
// including version information, logging levels, database paths, and environment variable handling.
|
||||||
package config
|
package config
|
||||||
|
|
||||||
import (
|
import (
|
||||||
_ "embed"
|
_ "embed"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"io"
|
||||||
"os"
|
"os"
|
||||||
|
"path/filepath"
|
||||||
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -13,24 +18,29 @@ var version string
|
|||||||
//go:embed name
|
//go:embed name
|
||||||
var name string
|
var name string
|
||||||
|
|
||||||
|
// LogLevel represents the logging level for the application.
|
||||||
type LogLevel string
|
type LogLevel string
|
||||||
|
|
||||||
|
// Logging level constants
|
||||||
const (
|
const (
|
||||||
Debug LogLevel = "debug"
|
Debug LogLevel = "debug"
|
||||||
Info LogLevel = "info"
|
Info LogLevel = "info"
|
||||||
Notice LogLevel = "notice"
|
Notice LogLevel = "notice"
|
||||||
Warn LogLevel = "warn"
|
Warning LogLevel = "warning"
|
||||||
Error LogLevel = "error"
|
Error LogLevel = "error"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// GetVersion returns the version string of the 3x-ui application.
|
||||||
func GetVersion() string {
|
func GetVersion() string {
|
||||||
return strings.TrimSpace(version)
|
return strings.TrimSpace(version)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetName returns the name of the 3x-ui application.
|
||||||
func GetName() string {
|
func GetName() string {
|
||||||
return strings.TrimSpace(name)
|
return strings.TrimSpace(name)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetLogLevel returns the current logging level based on environment variables or defaults to Info.
|
||||||
func GetLogLevel() LogLevel {
|
func GetLogLevel() LogLevel {
|
||||||
if IsDebug() {
|
if IsDebug() {
|
||||||
return Debug
|
return Debug
|
||||||
@@ -42,10 +52,12 @@ func GetLogLevel() LogLevel {
|
|||||||
return LogLevel(logLevel)
|
return LogLevel(logLevel)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// IsDebug returns true if debug mode is enabled via the XUI_DEBUG environment variable.
|
||||||
func IsDebug() bool {
|
func IsDebug() bool {
|
||||||
return os.Getenv("XUI_DEBUG") == "true"
|
return os.Getenv("XUI_DEBUG") == "true"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetBinFolderPath returns the path to the binary folder, defaulting to "bin" if not set via XUI_BIN_FOLDER.
|
||||||
func GetBinFolderPath() string {
|
func GetBinFolderPath() string {
|
||||||
binFolderPath := os.Getenv("XUI_BIN_FOLDER")
|
binFolderPath := os.Getenv("XUI_BIN_FOLDER")
|
||||||
if binFolderPath == "" {
|
if binFolderPath == "" {
|
||||||
@@ -54,22 +66,91 @@ func GetBinFolderPath() string {
|
|||||||
return binFolderPath
|
return binFolderPath
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetDBFolderPath() string {
|
func getBaseDir() string {
|
||||||
dbFolderPath := os.Getenv("XUI_DB_FOLDER")
|
exePath, err := os.Executable()
|
||||||
if dbFolderPath == "" {
|
if err != nil {
|
||||||
dbFolderPath = "/etc/x-ui"
|
return "."
|
||||||
}
|
}
|
||||||
return dbFolderPath
|
exeDir := filepath.Dir(exePath)
|
||||||
|
exeDirLower := strings.ToLower(filepath.ToSlash(exeDir))
|
||||||
|
if strings.Contains(exeDirLower, "/appdata/local/temp/") || strings.Contains(exeDirLower, "/go-build") {
|
||||||
|
wd, err := os.Getwd()
|
||||||
|
if err != nil {
|
||||||
|
return "."
|
||||||
|
}
|
||||||
|
return wd
|
||||||
|
}
|
||||||
|
return exeDir
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetDBFolderPath returns the path to the database folder based on environment variables or platform defaults.
|
||||||
|
func GetDBFolderPath() string {
|
||||||
|
dbFolderPath := os.Getenv("XUI_DB_FOLDER")
|
||||||
|
if dbFolderPath != "" {
|
||||||
|
return dbFolderPath
|
||||||
|
}
|
||||||
|
if runtime.GOOS == "windows" {
|
||||||
|
return getBaseDir()
|
||||||
|
}
|
||||||
|
return "/etc/x-ui"
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetDBPath returns the full path to the database file.
|
||||||
func GetDBPath() string {
|
func GetDBPath() string {
|
||||||
return fmt.Sprintf("%s/%s.db", GetDBFolderPath(), GetName())
|
return fmt.Sprintf("%s/%s.db", GetDBFolderPath(), GetName())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetLogFolder returns the path to the log folder based on environment variables or platform defaults.
|
||||||
func GetLogFolder() string {
|
func GetLogFolder() string {
|
||||||
logFolderPath := os.Getenv("XUI_LOG_FOLDER")
|
logFolderPath := os.Getenv("XUI_LOG_FOLDER")
|
||||||
if logFolderPath == "" {
|
if logFolderPath != "" {
|
||||||
logFolderPath = "/var/log"
|
return logFolderPath
|
||||||
}
|
}
|
||||||
return logFolderPath
|
if runtime.GOOS == "windows" {
|
||||||
|
return filepath.Join(".", "log")
|
||||||
|
}
|
||||||
|
return "/var/log"
|
||||||
|
}
|
||||||
|
|
||||||
|
func copyFile(src, dst string) error {
|
||||||
|
in, err := os.Open(src)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer in.Close()
|
||||||
|
|
||||||
|
out, err := os.Create(dst)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer out.Close()
|
||||||
|
|
||||||
|
_, err = io.Copy(out, in)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return out.Sync()
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
if runtime.GOOS != "windows" {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if os.Getenv("XUI_DB_FOLDER") != "" {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
oldDBFolder := "/etc/x-ui"
|
||||||
|
oldDBPath := fmt.Sprintf("%s/%s.db", oldDBFolder, GetName())
|
||||||
|
newDBFolder := GetDBFolderPath()
|
||||||
|
newDBPath := fmt.Sprintf("%s/%s.db", newDBFolder, GetName())
|
||||||
|
_, err := os.Stat(newDBPath)
|
||||||
|
if err == nil {
|
||||||
|
return // new exists
|
||||||
|
}
|
||||||
|
_, err = os.Stat(oldDBPath)
|
||||||
|
if os.IsNotExist(err) {
|
||||||
|
return // old does not exist
|
||||||
|
}
|
||||||
|
_ = copyFile(oldDBPath, newDBPath) // ignore error
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
2.6.2
|
2.8.3
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
|
// Package database provides database initialization, migration, and management utilities
|
||||||
|
// for the 3x-ui panel using GORM with SQLite.
|
||||||
package database
|
package database
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@@ -9,10 +11,10 @@ import (
|
|||||||
"path"
|
"path"
|
||||||
"slices"
|
"slices"
|
||||||
|
|
||||||
"x-ui/config"
|
"github.com/mhsanaei/3x-ui/v2/config"
|
||||||
"x-ui/database/model"
|
"github.com/mhsanaei/3x-ui/v2/database/model"
|
||||||
"x-ui/util/crypto"
|
"github.com/mhsanaei/3x-ui/v2/util/crypto"
|
||||||
"x-ui/xray"
|
"github.com/mhsanaei/3x-ui/v2/xray"
|
||||||
|
|
||||||
"gorm.io/driver/sqlite"
|
"gorm.io/driver/sqlite"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
@@ -45,6 +47,7 @@ func initModels() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// initUser creates a default admin user if the users table is empty.
|
||||||
func initUser() error {
|
func initUser() error {
|
||||||
empty, err := isTableEmpty("users")
|
empty, err := isTableEmpty("users")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -68,6 +71,7 @@ func initUser() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// runSeeders migrates user passwords to bcrypt and records seeder execution to prevent re-running.
|
||||||
func runSeeders(isUsersEmpty bool) error {
|
func runSeeders(isUsersEmpty bool) error {
|
||||||
empty, err := isTableEmpty("history_of_seeders")
|
empty, err := isTableEmpty("history_of_seeders")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -107,12 +111,14 @@ func runSeeders(isUsersEmpty bool) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// isTableEmpty returns true if the named table contains zero rows.
|
||||||
func isTableEmpty(tableName string) (bool, error) {
|
func isTableEmpty(tableName string) (bool, error) {
|
||||||
var count int64
|
var count int64
|
||||||
err := db.Table(tableName).Count(&count).Error
|
err := db.Table(tableName).Count(&count).Error
|
||||||
return count == 0, err
|
return count == 0, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// InitDB sets up the database connection, migrates models, and runs seeders.
|
||||||
func InitDB(dbPath string) error {
|
func InitDB(dbPath string) error {
|
||||||
dir := path.Dir(dbPath)
|
dir := path.Dir(dbPath)
|
||||||
err := os.MkdirAll(dir, fs.ModePerm)
|
err := os.MkdirAll(dir, fs.ModePerm)
|
||||||
@@ -141,6 +147,9 @@ func InitDB(dbPath string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
isUsersEmpty, err := isTableEmpty("users")
|
isUsersEmpty, err := isTableEmpty("users")
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
if err := initUser(); err != nil {
|
if err := initUser(); err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -148,6 +157,7 @@ func InitDB(dbPath string) error {
|
|||||||
return runSeeders(isUsersEmpty)
|
return runSeeders(isUsersEmpty)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CloseDB closes the database connection if it exists.
|
||||||
func CloseDB() error {
|
func CloseDB() error {
|
||||||
if db != nil {
|
if db != nil {
|
||||||
sqlDB, err := db.DB()
|
sqlDB, err := db.DB()
|
||||||
@@ -159,14 +169,17 @@ func CloseDB() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetDB returns the global GORM database instance.
|
||||||
func GetDB() *gorm.DB {
|
func GetDB() *gorm.DB {
|
||||||
return db
|
return db
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// IsNotFound checks if the given error is a GORM record not found error.
|
||||||
func IsNotFound(err error) bool {
|
func IsNotFound(err error) bool {
|
||||||
return err == gorm.ErrRecordNotFound
|
return err == gorm.ErrRecordNotFound
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// IsSQLiteDB checks if the given file is a valid SQLite database by reading its signature.
|
||||||
func IsSQLiteDB(file io.ReaderAt) (bool, error) {
|
func IsSQLiteDB(file io.ReaderAt) (bool, error) {
|
||||||
signature := []byte("SQLite format 3\x00")
|
signature := []byte("SQLite format 3\x00")
|
||||||
buf := make([]byte, len(signature))
|
buf := make([]byte, len(signature))
|
||||||
@@ -177,6 +190,7 @@ func IsSQLiteDB(file io.ReaderAt) (bool, error) {
|
|||||||
return bytes.Equal(buf, signature), nil
|
return bytes.Equal(buf, signature), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Checkpoint performs a WAL checkpoint on the SQLite database to ensure data consistency.
|
||||||
func Checkpoint() error {
|
func Checkpoint() error {
|
||||||
// Update WAL
|
// Update WAL
|
||||||
err := db.Exec("PRAGMA wal_checkpoint;").Error
|
err := db.Exec("PRAGMA wal_checkpoint;").Error
|
||||||
|
|||||||
@@ -1,43 +1,51 @@
|
|||||||
|
// Package model defines the database models and data structures used by the 3x-ui panel.
|
||||||
package model
|
package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"x-ui/util/json_util"
|
"github.com/mhsanaei/3x-ui/v2/util/json_util"
|
||||||
"x-ui/xray"
|
"github.com/mhsanaei/3x-ui/v2/xray"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Protocol represents the protocol type for Xray inbounds.
|
||||||
type Protocol string
|
type Protocol string
|
||||||
|
|
||||||
|
// Protocol constants for different Xray inbound protocols
|
||||||
const (
|
const (
|
||||||
VMESS Protocol = "vmess"
|
VMESS Protocol = "vmess"
|
||||||
VLESS Protocol = "vless"
|
VLESS Protocol = "vless"
|
||||||
DOKODEMO Protocol = "dokodemo-door"
|
Tunnel Protocol = "tunnel"
|
||||||
HTTP Protocol = "http"
|
HTTP Protocol = "http"
|
||||||
Trojan Protocol = "trojan"
|
Trojan Protocol = "trojan"
|
||||||
Shadowsocks Protocol = "shadowsocks"
|
Shadowsocks Protocol = "shadowsocks"
|
||||||
Socks Protocol = "socks"
|
Mixed Protocol = "mixed"
|
||||||
WireGuard Protocol = "wireguard"
|
WireGuard Protocol = "wireguard"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// User represents a user account in the 3x-ui panel.
|
||||||
type User struct {
|
type User struct {
|
||||||
Id int `json:"id" gorm:"primaryKey;autoIncrement"`
|
Id int `json:"id" gorm:"primaryKey;autoIncrement"`
|
||||||
Username string `json:"username"`
|
Username string `json:"username"`
|
||||||
Password string `json:"password"`
|
Password string `json:"password"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Inbound represents an Xray inbound configuration with traffic statistics and settings.
|
||||||
type Inbound struct {
|
type Inbound struct {
|
||||||
Id int `json:"id" form:"id" gorm:"primaryKey;autoIncrement"`
|
Id int `json:"id" form:"id" gorm:"primaryKey;autoIncrement"` // Unique identifier
|
||||||
UserId int `json:"-"`
|
UserId int `json:"-"` // Associated user ID
|
||||||
Up int64 `json:"up" form:"up"`
|
Up int64 `json:"up" form:"up"` // Upload traffic in bytes
|
||||||
Down int64 `json:"down" form:"down"`
|
Down int64 `json:"down" form:"down"` // Download traffic in bytes
|
||||||
Total int64 `json:"total" form:"total"`
|
Total int64 `json:"total" form:"total"` // Total traffic limit in bytes
|
||||||
Remark string `json:"remark" form:"remark"`
|
AllTime int64 `json:"allTime" form:"allTime" gorm:"default:0"` // All-time traffic usage
|
||||||
Enable bool `json:"enable" form:"enable"`
|
Remark string `json:"remark" form:"remark"` // Human-readable remark
|
||||||
ExpiryTime int64 `json:"expiryTime" form:"expiryTime"`
|
Enable bool `json:"enable" form:"enable" gorm:"index:idx_enable_traffic_reset,priority:1"` // Whether the inbound is enabled
|
||||||
ClientStats []xray.ClientTraffic `gorm:"foreignKey:InboundId;references:Id" json:"clientStats" form:"clientStats"`
|
ExpiryTime int64 `json:"expiryTime" form:"expiryTime"` // Expiration timestamp
|
||||||
|
TrafficReset string `json:"trafficReset" form:"trafficReset" gorm:"default:never;index:idx_enable_traffic_reset,priority:2"` // Traffic reset schedule
|
||||||
|
LastTrafficResetTime int64 `json:"lastTrafficResetTime" form:"lastTrafficResetTime" gorm:"default:0"` // Last traffic reset timestamp
|
||||||
|
ClientStats []xray.ClientTraffic `gorm:"foreignKey:InboundId;references:Id" json:"clientStats" form:"clientStats"` // Client traffic statistics
|
||||||
|
|
||||||
// config part
|
// Xray configuration fields
|
||||||
Listen string `json:"listen" form:"listen"`
|
Listen string `json:"listen" form:"listen"`
|
||||||
Port int `json:"port" form:"port"`
|
Port int `json:"port" form:"port"`
|
||||||
Protocol Protocol `json:"protocol" form:"protocol"`
|
Protocol Protocol `json:"protocol" form:"protocol"`
|
||||||
@@ -45,9 +53,9 @@ type Inbound struct {
|
|||||||
StreamSettings string `json:"streamSettings" form:"streamSettings"`
|
StreamSettings string `json:"streamSettings" form:"streamSettings"`
|
||||||
Tag string `json:"tag" form:"tag" gorm:"unique"`
|
Tag string `json:"tag" form:"tag" gorm:"unique"`
|
||||||
Sniffing string `json:"sniffing" form:"sniffing"`
|
Sniffing string `json:"sniffing" form:"sniffing"`
|
||||||
Allocate string `json:"allocate" form:"allocate"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// OutboundTraffics tracks traffic statistics for Xray outbound connections.
|
||||||
type OutboundTraffics struct {
|
type OutboundTraffics struct {
|
||||||
Id int `json:"id" form:"id" gorm:"primaryKey;autoIncrement"`
|
Id int `json:"id" form:"id" gorm:"primaryKey;autoIncrement"`
|
||||||
Tag string `json:"tag" form:"tag" gorm:"unique"`
|
Tag string `json:"tag" form:"tag" gorm:"unique"`
|
||||||
@@ -56,17 +64,20 @@ type OutboundTraffics struct {
|
|||||||
Total int64 `json:"total" form:"total" gorm:"default:0"`
|
Total int64 `json:"total" form:"total" gorm:"default:0"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// InboundClientIps stores IP addresses associated with inbound clients for access control.
|
||||||
type InboundClientIps struct {
|
type InboundClientIps struct {
|
||||||
Id int `json:"id" gorm:"primaryKey;autoIncrement"`
|
Id int `json:"id" gorm:"primaryKey;autoIncrement"`
|
||||||
ClientEmail string `json:"clientEmail" form:"clientEmail" gorm:"unique"`
|
ClientEmail string `json:"clientEmail" form:"clientEmail" gorm:"unique"`
|
||||||
Ips string `json:"ips" form:"ips"`
|
Ips string `json:"ips" form:"ips"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// HistoryOfSeeders tracks which database seeders have been executed to prevent re-running.
|
||||||
type HistoryOfSeeders struct {
|
type HistoryOfSeeders struct {
|
||||||
Id int `json:"id" gorm:"primaryKey;autoIncrement"`
|
Id int `json:"id" gorm:"primaryKey;autoIncrement"`
|
||||||
SeederName string `json:"seederName"`
|
SeederName string `json:"seederName"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GenXrayInboundConfig generates an Xray inbound configuration from the Inbound model.
|
||||||
func (i *Inbound) GenXrayInboundConfig() *xray.InboundConfig {
|
func (i *Inbound) GenXrayInboundConfig() *xray.InboundConfig {
|
||||||
listen := i.Listen
|
listen := i.Listen
|
||||||
if listen != "" {
|
if listen != "" {
|
||||||
@@ -80,28 +91,31 @@ func (i *Inbound) GenXrayInboundConfig() *xray.InboundConfig {
|
|||||||
StreamSettings: json_util.RawMessage(i.StreamSettings),
|
StreamSettings: json_util.RawMessage(i.StreamSettings),
|
||||||
Tag: i.Tag,
|
Tag: i.Tag,
|
||||||
Sniffing: json_util.RawMessage(i.Sniffing),
|
Sniffing: json_util.RawMessage(i.Sniffing),
|
||||||
Allocate: json_util.RawMessage(i.Allocate),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Setting stores key-value configuration settings for the 3x-ui panel.
|
||||||
type Setting struct {
|
type Setting struct {
|
||||||
Id int `json:"id" form:"id" gorm:"primaryKey;autoIncrement"`
|
Id int `json:"id" form:"id" gorm:"primaryKey;autoIncrement"`
|
||||||
Key string `json:"key" form:"key"`
|
Key string `json:"key" form:"key"`
|
||||||
Value string `json:"value" form:"value"`
|
Value string `json:"value" form:"value"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Client represents a client configuration for Xray inbounds with traffic limits and settings.
|
||||||
type Client struct {
|
type Client struct {
|
||||||
ID string `json:"id"`
|
ID string `json:"id"` // Unique client identifier
|
||||||
Security string `json:"security"`
|
Security string `json:"security"` // Security method (e.g., "auto", "aes-128-gcm")
|
||||||
Password string `json:"password"`
|
Password string `json:"password"` // Client password
|
||||||
Flow string `json:"flow"`
|
Flow string `json:"flow"` // Flow control (XTLS)
|
||||||
Email string `json:"email"`
|
Email string `json:"email"` // Client email identifier
|
||||||
LimitIP int `json:"limitIp"`
|
LimitIP int `json:"limitIp"` // IP limit for this client
|
||||||
TotalGB int64 `json:"totalGB" form:"totalGB"`
|
TotalGB int64 `json:"totalGB" form:"totalGB"` // Total traffic limit in GB
|
||||||
ExpiryTime int64 `json:"expiryTime" form:"expiryTime"`
|
ExpiryTime int64 `json:"expiryTime" form:"expiryTime"` // Expiration timestamp
|
||||||
Enable bool `json:"enable" form:"enable"`
|
Enable bool `json:"enable" form:"enable"` // Whether the client is enabled
|
||||||
TgID int64 `json:"tgId" form:"tgId"`
|
TgID int64 `json:"tgId" form:"tgId"` // Telegram user ID for notifications
|
||||||
SubID string `json:"subId" form:"subId"`
|
SubID string `json:"subId" form:"subId"` // Subscription identifier
|
||||||
Comment string `json:"comment" form:"comment"`
|
Comment string `json:"comment" form:"comment"` // Client comment
|
||||||
Reset int `json:"reset" form:"reset"`
|
Reset int `json:"reset" form:"reset"` // Reset period in days
|
||||||
|
CreatedAt int64 `json:"created_at,omitempty"` // Creation timestamp
|
||||||
|
UpdatedAt int64 `json:"updated_at,omitempty"` // Last update timestamp
|
||||||
}
|
}
|
||||||
|
|||||||
84
go.mod
84
go.mod
@@ -1,49 +1,50 @@
|
|||||||
module x-ui
|
module github.com/mhsanaei/3x-ui/v2
|
||||||
|
|
||||||
go 1.24.4
|
go 1.25.1
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/gin-contrib/gzip v1.2.3
|
github.com/gin-contrib/gzip v1.2.3
|
||||||
github.com/gin-contrib/sessions v1.0.4
|
github.com/gin-contrib/sessions v1.0.4
|
||||||
github.com/gin-gonic/gin v1.10.1
|
github.com/gin-gonic/gin v1.11.0
|
||||||
github.com/goccy/go-json v0.10.5
|
github.com/goccy/go-json v0.10.5
|
||||||
github.com/google/uuid v1.6.0
|
github.com/google/uuid v1.6.0
|
||||||
github.com/joho/godotenv v1.5.1
|
github.com/joho/godotenv v1.5.1
|
||||||
github.com/mymmrac/telego v0.32.0
|
github.com/mymmrac/telego v1.3.0
|
||||||
github.com/nicksnyder/go-i18n/v2 v2.6.0
|
github.com/nicksnyder/go-i18n/v2 v2.6.0
|
||||||
github.com/op/go-logging v0.0.0-20160315200505-970db520ece7
|
github.com/op/go-logging v0.0.0-20160315200505-970db520ece7
|
||||||
github.com/pelletier/go-toml/v2 v2.2.4
|
github.com/pelletier/go-toml/v2 v2.2.4
|
||||||
github.com/robfig/cron/v3 v3.0.1
|
github.com/robfig/cron/v3 v3.0.1
|
||||||
github.com/shirou/gopsutil/v4 v4.25.6
|
github.com/shirou/gopsutil/v4 v4.25.8
|
||||||
github.com/valyala/fasthttp v1.63.0
|
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e
|
||||||
|
github.com/valyala/fasthttp v1.66.0
|
||||||
github.com/xlzd/gotp v0.1.0
|
github.com/xlzd/gotp v0.1.0
|
||||||
github.com/xtls/xray-core v1.250608.0
|
github.com/xtls/xray-core v1.250911.0
|
||||||
go.uber.org/atomic v1.11.0
|
go.uber.org/atomic v1.11.0
|
||||||
golang.org/x/crypto v0.39.0
|
golang.org/x/crypto v0.42.0
|
||||||
golang.org/x/text v0.26.0
|
golang.org/x/sys v0.36.0
|
||||||
google.golang.org/grpc v1.73.0
|
golang.org/x/text v0.29.0
|
||||||
|
google.golang.org/grpc v1.75.1
|
||||||
gorm.io/driver/sqlite v1.6.0
|
gorm.io/driver/sqlite v1.6.0
|
||||||
gorm.io/gorm v1.30.0
|
gorm.io/gorm v1.31.0
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/andybalholm/brotli v1.2.0 // indirect
|
github.com/andybalholm/brotli v1.2.0 // indirect
|
||||||
github.com/bytedance/sonic v1.13.3 // indirect
|
github.com/bytedance/gopkg v0.1.3 // indirect
|
||||||
github.com/bytedance/sonic/loader v0.2.4 // indirect
|
github.com/bytedance/sonic v1.14.1 // indirect
|
||||||
|
github.com/bytedance/sonic/loader v0.3.0 // indirect
|
||||||
github.com/cloudflare/circl v1.6.1 // indirect
|
github.com/cloudflare/circl v1.6.1 // indirect
|
||||||
github.com/cloudwego/base64x v0.1.5 // indirect
|
github.com/cloudwego/base64x v0.1.6 // indirect
|
||||||
github.com/dgryski/go-metro v0.0.0-20250106013310-edb8663e5e33 // indirect
|
github.com/dgryski/go-metro v0.0.0-20250106013310-edb8663e5e33 // indirect
|
||||||
github.com/ebitengine/purego v0.8.4 // indirect
|
github.com/ebitengine/purego v0.9.0 // indirect
|
||||||
github.com/fasthttp/router v1.5.4 // indirect
|
github.com/gabriel-vasile/mimetype v1.4.10 // indirect
|
||||||
github.com/gabriel-vasile/mimetype v1.4.9 // indirect
|
|
||||||
github.com/gin-contrib/sse v1.1.0 // indirect
|
github.com/gin-contrib/sse v1.1.0 // indirect
|
||||||
github.com/go-ole/go-ole v1.3.0 // indirect
|
github.com/go-ole/go-ole v1.3.0 // indirect
|
||||||
github.com/go-playground/locales v0.14.1 // indirect
|
github.com/go-playground/locales v0.14.1 // indirect
|
||||||
github.com/go-playground/universal-translator v0.18.1 // indirect
|
github.com/go-playground/universal-translator v0.18.1 // indirect
|
||||||
github.com/go-playground/validator/v10 v10.27.0 // indirect
|
github.com/go-playground/validator/v10 v10.27.0 // indirect
|
||||||
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
|
github.com/goccy/go-yaml v1.18.0 // indirect
|
||||||
github.com/google/btree v1.1.3 // indirect
|
github.com/google/btree v1.1.3 // indirect
|
||||||
github.com/google/pprof v0.0.0-20250630185457-6e76a2b096b5 // indirect
|
|
||||||
github.com/gorilla/context v1.1.2 // indirect
|
github.com/gorilla/context v1.1.2 // indirect
|
||||||
github.com/gorilla/securecookie v1.1.2 // indirect
|
github.com/gorilla/securecookie v1.1.2 // indirect
|
||||||
github.com/gorilla/sessions v1.4.0 // indirect
|
github.com/gorilla/sessions v1.4.0 // indirect
|
||||||
@@ -54,24 +55,24 @@ require (
|
|||||||
github.com/json-iterator/go v1.1.12 // indirect
|
github.com/json-iterator/go v1.1.12 // indirect
|
||||||
github.com/juju/ratelimit v1.0.2 // indirect
|
github.com/juju/ratelimit v1.0.2 // indirect
|
||||||
github.com/klauspost/compress v1.18.0 // indirect
|
github.com/klauspost/compress v1.18.0 // indirect
|
||||||
github.com/klauspost/cpuid/v2 v2.2.11 // indirect
|
github.com/klauspost/cpuid/v2 v2.3.0 // indirect
|
||||||
|
github.com/kr/text v0.2.0 // indirect
|
||||||
github.com/leodido/go-urn v1.4.0 // indirect
|
github.com/leodido/go-urn v1.4.0 // indirect
|
||||||
github.com/lufia/plan9stats v0.0.0-20250317134145-8bc96cf8fc35 // indirect
|
github.com/lufia/plan9stats v0.0.0-20250827001030-24949be3fa54 // indirect
|
||||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||||
github.com/mattn/go-sqlite3 v1.14.28 // indirect
|
github.com/mattn/go-sqlite3 v1.14.32 // indirect
|
||||||
|
github.com/miekg/dns v1.1.68 // indirect
|
||||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||||
github.com/onsi/ginkgo/v2 v2.23.4 // indirect
|
|
||||||
github.com/pires/go-proxyproto v0.8.1 // indirect
|
github.com/pires/go-proxyproto v0.8.1 // indirect
|
||||||
github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 // indirect
|
github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 // indirect
|
||||||
github.com/quic-go/qpack v0.5.1 // indirect
|
github.com/quic-go/qpack v0.5.1 // indirect
|
||||||
github.com/quic-go/quic-go v0.52.0 // indirect
|
github.com/quic-go/quic-go v0.54.0 // indirect
|
||||||
github.com/refraction-networking/utls v1.7.3 // indirect
|
github.com/refraction-networking/utls v1.8.0 // indirect
|
||||||
github.com/riobard/go-bloom v0.0.0-20200614022211-cdc8013cb5b3 // indirect
|
github.com/riobard/go-bloom v0.0.0-20200614022211-cdc8013cb5b3 // indirect
|
||||||
github.com/rogpeppe/go-internal v1.14.1 // indirect
|
github.com/rogpeppe/go-internal v1.14.1 // indirect
|
||||||
github.com/sagernet/sing v0.6.6 // indirect
|
github.com/sagernet/sing v0.7.10 // indirect
|
||||||
github.com/sagernet/sing-shadowsocks v0.2.7 // indirect
|
github.com/sagernet/sing-shadowsocks v0.2.9 // indirect
|
||||||
github.com/savsgio/gotils v0.0.0-20250408102913-196191ec6287 // indirect
|
|
||||||
github.com/seiflotfy/cuckoofilter v0.0.0-20240715131351-a2f2c23f1771 // indirect
|
github.com/seiflotfy/cuckoofilter v0.0.0-20240715131351-a2f2c23f1771 // indirect
|
||||||
github.com/tklauser/go-sysconf v0.3.15 // indirect
|
github.com/tklauser/go-sysconf v0.3.15 // indirect
|
||||||
github.com/tklauser/numcpus v0.10.0 // indirect
|
github.com/tklauser/numcpus v0.10.0 // indirect
|
||||||
@@ -82,23 +83,20 @@ require (
|
|||||||
github.com/valyala/fastjson v1.6.4 // indirect
|
github.com/valyala/fastjson v1.6.4 // indirect
|
||||||
github.com/vishvananda/netlink v1.3.1 // indirect
|
github.com/vishvananda/netlink v1.3.1 // indirect
|
||||||
github.com/vishvananda/netns v0.0.5 // indirect
|
github.com/vishvananda/netns v0.0.5 // indirect
|
||||||
github.com/xtls/reality v0.0.0-20250627141458-e62c4aed0d57 // indirect
|
github.com/xtls/reality v0.0.0-20250904214705-431b6ff8c67c // indirect
|
||||||
github.com/yusufpapurcu/wmi v1.2.4 // indirect
|
github.com/yusufpapurcu/wmi v1.2.4 // indirect
|
||||||
go.uber.org/automaxprocs v1.6.0 // indirect
|
go.uber.org/mock v0.6.0 // indirect
|
||||||
go.uber.org/mock v0.5.2 // indirect
|
|
||||||
go4.org/netipx v0.0.0-20231129151722-fdeea329fbba // indirect
|
go4.org/netipx v0.0.0-20231129151722-fdeea329fbba // indirect
|
||||||
golang.org/x/arch v0.18.0 // indirect
|
golang.org/x/arch v0.21.0 // indirect
|
||||||
golang.org/x/mod v0.25.0 // indirect
|
golang.org/x/mod v0.28.0 // indirect
|
||||||
golang.org/x/net v0.41.0 // indirect
|
golang.org/x/net v0.44.0 // indirect
|
||||||
golang.org/x/sync v0.15.0 // indirect
|
golang.org/x/sync v0.17.0 // indirect
|
||||||
golang.org/x/sys v0.33.0 // indirect
|
golang.org/x/time v0.13.0 // indirect
|
||||||
golang.org/x/time v0.12.0 // indirect
|
golang.org/x/tools v0.37.0 // indirect
|
||||||
golang.org/x/tools v0.34.0 // indirect
|
|
||||||
golang.zx2c4.com/wintun v0.0.0-20230126152724-0fa3db229ce2 // indirect
|
golang.zx2c4.com/wintun v0.0.0-20230126152724-0fa3db229ce2 // indirect
|
||||||
golang.zx2c4.com/wireguard v0.0.0-20231211153847-12269c276173 // indirect
|
golang.zx2c4.com/wireguard v0.0.0-20250521234502-f333402bd9cb // indirect
|
||||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20250603155806-513f23925822 // indirect
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20250908214217-97024824d090 // indirect
|
||||||
google.golang.org/protobuf v1.36.6 // indirect
|
google.golang.org/protobuf v1.36.9 // indirect
|
||||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
gvisor.dev/gvisor v0.0.0-20250503011706-39ed1f5ac29c // indirect
|
||||||
gvisor.dev/gvisor v0.0.0-20250428193742-2d800c3129d5 // indirect
|
|
||||||
lukechampine.com/blake3 v1.4.1 // indirect
|
lukechampine.com/blake3 v1.4.1 // indirect
|
||||||
)
|
)
|
||||||
|
|||||||
201
go.sum
201
go.sum
@@ -1,31 +1,28 @@
|
|||||||
github.com/BurntSushi/toml v1.5.0 h1:W5quZX/G/csjUnuI8SUYlsHs9M38FC7znL0lIO+DvMg=
|
github.com/BurntSushi/toml v1.5.0 h1:W5quZX/G/csjUnuI8SUYlsHs9M38FC7znL0lIO+DvMg=
|
||||||
github.com/BurntSushi/toml v1.5.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho=
|
github.com/BurntSushi/toml v1.5.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho=
|
||||||
github.com/OmarTariq612/goech v0.0.0-20240405204721-8e2e1dafd3a0 h1:Wo41lDOevRJSGpevP+8Pk5bANX7fJacO2w04aqLiC5I=
|
|
||||||
github.com/OmarTariq612/goech v0.0.0-20240405204721-8e2e1dafd3a0/go.mod h1:FVGavL/QEBQDcBpr3fAojoK17xX5k9bicBphrOpP7uM=
|
|
||||||
github.com/andybalholm/brotli v1.2.0 h1:ukwgCxwYrmACq68yiUqwIWnGY0cTPox/M94sVwToPjQ=
|
github.com/andybalholm/brotli v1.2.0 h1:ukwgCxwYrmACq68yiUqwIWnGY0cTPox/M94sVwToPjQ=
|
||||||
github.com/andybalholm/brotli v1.2.0/go.mod h1:rzTDkvFWvIrjDXZHkuS16NPggd91W3kUSvPlQ1pLaKY=
|
github.com/andybalholm/brotli v1.2.0/go.mod h1:rzTDkvFWvIrjDXZHkuS16NPggd91W3kUSvPlQ1pLaKY=
|
||||||
github.com/bytedance/sonic v1.13.3 h1:MS8gmaH16Gtirygw7jV91pDCN33NyMrPbN7qiYhEsF0=
|
github.com/bytedance/gopkg v0.1.3 h1:TPBSwH8RsouGCBcMBktLt1AymVo2TVsBVCY4b6TnZ/M=
|
||||||
github.com/bytedance/sonic v1.13.3/go.mod h1:o68xyaF9u2gvVBuGHPlUVCy+ZfmNNO5ETf1+KgkJhz4=
|
github.com/bytedance/gopkg v0.1.3/go.mod h1:576VvJ+eJgyCzdjS+c4+77QF3p7ubbtiKARP3TxducM=
|
||||||
github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU=
|
github.com/bytedance/sonic v1.14.1 h1:FBMC0zVz5XUmE4z9wF4Jey0An5FueFvOsTKKKtwIl7w=
|
||||||
github.com/bytedance/sonic/loader v0.2.4 h1:ZWCw4stuXUsn1/+zQDqeE7JKP+QO47tz7QCNan80NzY=
|
github.com/bytedance/sonic v1.14.1/go.mod h1:gi6uhQLMbTdeP0muCnrjHLeCUPyb70ujhnNlhOylAFc=
|
||||||
github.com/bytedance/sonic/loader v0.2.4/go.mod h1:N8A3vUdtUebEY2/VQC0MyhYeKUFosQU6FxH2JmUe6VI=
|
github.com/bytedance/sonic/loader v0.3.0 h1:dskwH8edlzNMctoruo8FPTJDF3vLtDT0sXZwvZJyqeA=
|
||||||
|
github.com/bytedance/sonic/loader v0.3.0/go.mod h1:N8A3vUdtUebEY2/VQC0MyhYeKUFosQU6FxH2JmUe6VI=
|
||||||
github.com/cloudflare/circl v1.6.1 h1:zqIqSPIndyBh1bjLVVDHMPpVKqp8Su/V+6MeDzzQBQ0=
|
github.com/cloudflare/circl v1.6.1 h1:zqIqSPIndyBh1bjLVVDHMPpVKqp8Su/V+6MeDzzQBQ0=
|
||||||
github.com/cloudflare/circl v1.6.1/go.mod h1:uddAzsPgqdMAYatqJ0lsjX1oECcQLIlRpzZh3pJrofs=
|
github.com/cloudflare/circl v1.6.1/go.mod h1:uddAzsPgqdMAYatqJ0lsjX1oECcQLIlRpzZh3pJrofs=
|
||||||
github.com/cloudwego/base64x v0.1.5 h1:XPciSp1xaq2VCSt6lF0phncD4koWyULpl5bUxbfCyP4=
|
github.com/cloudwego/base64x v0.1.6 h1:t11wG9AECkCDk5fMSoxmufanudBtJ+/HemLstXDLI2M=
|
||||||
github.com/cloudwego/base64x v0.1.5/go.mod h1:0zlkT4Wn5C6NdauXdJRhSKRlJvmclQ1hhJgA0rcu/8w=
|
github.com/cloudwego/base64x v0.1.6/go.mod h1:OFcloc187FXDaYHvrNIjxSe8ncn0OOM8gEHfghB2IPU=
|
||||||
github.com/cloudwego/iasm v0.2.0/go.mod h1:8rXZaNYT2n95jn+zTI1sDr+IgcD2GVs0nlbbQPiEFhY=
|
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
||||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/dgryski/go-metro v0.0.0-20200812162917-85c65e2d0165/go.mod h1:c9O8+fpSOX1DM8cPNSkX/qsBWdkD4yd2dpciOWQjpBw=
|
github.com/dgryski/go-metro v0.0.0-20200812162917-85c65e2d0165/go.mod h1:c9O8+fpSOX1DM8cPNSkX/qsBWdkD4yd2dpciOWQjpBw=
|
||||||
github.com/dgryski/go-metro v0.0.0-20250106013310-edb8663e5e33 h1:ucRHb6/lvW/+mTEIGbvhcYU3S8+uSNkuMjx/qZFfhtM=
|
github.com/dgryski/go-metro v0.0.0-20250106013310-edb8663e5e33 h1:ucRHb6/lvW/+mTEIGbvhcYU3S8+uSNkuMjx/qZFfhtM=
|
||||||
github.com/dgryski/go-metro v0.0.0-20250106013310-edb8663e5e33/go.mod h1:c9O8+fpSOX1DM8cPNSkX/qsBWdkD4yd2dpciOWQjpBw=
|
github.com/dgryski/go-metro v0.0.0-20250106013310-edb8663e5e33/go.mod h1:c9O8+fpSOX1DM8cPNSkX/qsBWdkD4yd2dpciOWQjpBw=
|
||||||
github.com/ebitengine/purego v0.8.4 h1:CF7LEKg5FFOsASUj0+QwaXf8Ht6TlFxg09+S9wz0omw=
|
github.com/ebitengine/purego v0.9.0 h1:mh0zpKBIXDceC63hpvPuGLiJ8ZAa3DfrFTudmfi8A4k=
|
||||||
github.com/ebitengine/purego v0.8.4/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ=
|
github.com/ebitengine/purego v0.9.0/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ=
|
||||||
github.com/fasthttp/router v1.5.4 h1:oxdThbBwQgsDIYZ3wR1IavsNl6ZS9WdjKukeMikOnC8=
|
github.com/gabriel-vasile/mimetype v1.4.10 h1:zyueNbySn/z8mJZHLt6IPw0KoZsiQNszIpU+bX4+ZK0=
|
||||||
github.com/fasthttp/router v1.5.4/go.mod h1:3/hysWq6cky7dTfzaaEPZGdptwjwx0qzTgFCKEWRjgc=
|
github.com/gabriel-vasile/mimetype v1.4.10/go.mod h1:d+9Oxyo1wTzWdyVUPMmXFvp4F9tea18J8ufA774AB3s=
|
||||||
github.com/gabriel-vasile/mimetype v1.4.9 h1:5k+WDwEsD9eTLL8Tz3L0VnmVh9QxGjRmjBvAG7U/oYY=
|
|
||||||
github.com/gabriel-vasile/mimetype v1.4.9/go.mod h1:WnSQhFKJuBlRyLiKohA/2DtIlPFAbguNaG7QCHcyGok=
|
|
||||||
github.com/ghodss/yaml v1.0.1-0.20220118164431-d8423dcdf344 h1:Arcl6UOIS/kgO2nW3A65HN+7CMjSDP/gofXL4CZt1V4=
|
github.com/ghodss/yaml v1.0.1-0.20220118164431-d8423dcdf344 h1:Arcl6UOIS/kgO2nW3A65HN+7CMjSDP/gofXL4CZt1V4=
|
||||||
github.com/ghodss/yaml v1.0.1-0.20220118164431-d8423dcdf344/go.mod h1:GIjDIg/heH5DOkXY3YJ/wNhfHsQHoXGjl8G8amsYQ1I=
|
github.com/ghodss/yaml v1.0.1-0.20220118164431-d8423dcdf344/go.mod h1:GIjDIg/heH5DOkXY3YJ/wNhfHsQHoXGjl8G8amsYQ1I=
|
||||||
github.com/gin-contrib/gzip v1.2.3 h1:dAhT722RuEG330ce2agAs75z7yB+NKvX/ZM1r8w0u2U=
|
github.com/gin-contrib/gzip v1.2.3 h1:dAhT722RuEG330ce2agAs75z7yB+NKvX/ZM1r8w0u2U=
|
||||||
@@ -34,10 +31,10 @@ github.com/gin-contrib/sessions v1.0.4 h1:ha6CNdpYiTOK/hTp05miJLbpTSNfOnFg5Jm2kb
|
|||||||
github.com/gin-contrib/sessions v1.0.4/go.mod h1:ccmkrb2z6iU2osiAHZG3x3J4suJK+OU27oqzlWOqQgs=
|
github.com/gin-contrib/sessions v1.0.4/go.mod h1:ccmkrb2z6iU2osiAHZG3x3J4suJK+OU27oqzlWOqQgs=
|
||||||
github.com/gin-contrib/sse v1.1.0 h1:n0w2GMuUpWDVp7qSpvze6fAu9iRxJY4Hmj6AmBOU05w=
|
github.com/gin-contrib/sse v1.1.0 h1:n0w2GMuUpWDVp7qSpvze6fAu9iRxJY4Hmj6AmBOU05w=
|
||||||
github.com/gin-contrib/sse v1.1.0/go.mod h1:hxRZ5gVpWMT7Z0B0gSNYqqsSCNIJMjzvm6fqCz9vjwM=
|
github.com/gin-contrib/sse v1.1.0/go.mod h1:hxRZ5gVpWMT7Z0B0gSNYqqsSCNIJMjzvm6fqCz9vjwM=
|
||||||
github.com/gin-gonic/gin v1.10.1 h1:T0ujvqyCSqRopADpgPgiTT63DUQVSfojyME59Ei63pQ=
|
github.com/gin-gonic/gin v1.11.0 h1:OW/6PLjyusp2PPXtyxKHU0RbX6I/l28FTdDlae5ueWk=
|
||||||
github.com/gin-gonic/gin v1.10.1/go.mod h1:4PMNQiOhvDRa013RKVbsiNwoyezlm2rm0uX/T7kzp5Y=
|
github.com/gin-gonic/gin v1.11.0/go.mod h1:+iq/FyxlGzII0KHiBGjuNn4UNENUlKbGlNmc+W50Dls=
|
||||||
github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY=
|
github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI=
|
||||||
github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
|
github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
|
||||||
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
|
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
|
||||||
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
|
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
|
||||||
github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
|
github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
|
||||||
@@ -51,10 +48,10 @@ github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJn
|
|||||||
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
|
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
|
||||||
github.com/go-playground/validator/v10 v10.27.0 h1:w8+XrWVMhGkxOaaowyKH35gFydVHOvC0/uWoy2Fzwn4=
|
github.com/go-playground/validator/v10 v10.27.0 h1:w8+XrWVMhGkxOaaowyKH35gFydVHOvC0/uWoy2Fzwn4=
|
||||||
github.com/go-playground/validator/v10 v10.27.0/go.mod h1:I5QpIEbmr8On7W0TktmJAumgzX4CA1XNl4ZmDuVHKKo=
|
github.com/go-playground/validator/v10 v10.27.0/go.mod h1:I5QpIEbmr8On7W0TktmJAumgzX4CA1XNl4ZmDuVHKKo=
|
||||||
github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI=
|
|
||||||
github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8=
|
|
||||||
github.com/goccy/go-json v0.10.5 h1:Fq85nIqj+gXn/S5ahsiTlK3TmC85qgirsdTP/+DeaC4=
|
github.com/goccy/go-json v0.10.5 h1:Fq85nIqj+gXn/S5ahsiTlK3TmC85qgirsdTP/+DeaC4=
|
||||||
github.com/goccy/go-json v0.10.5/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M=
|
github.com/goccy/go-json v0.10.5/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M=
|
||||||
|
github.com/goccy/go-yaml v1.18.0 h1:8W7wMFS12Pcas7KU+VVkaiCng+kG8QiFeFwzFb+rwuw=
|
||||||
|
github.com/goccy/go-yaml v1.18.0/go.mod h1:XBurs7gK8ATbW4ZPGKgcbrY1Br56PdM69F7LkFRi1kA=
|
||||||
github.com/golang/mock v1.7.0-rc.1 h1:YojYx61/OLFsiv6Rw1Z96LpldJIy31o+UHmwAUMJ6/U=
|
github.com/golang/mock v1.7.0-rc.1 h1:YojYx61/OLFsiv6Rw1Z96LpldJIy31o+UHmwAUMJ6/U=
|
||||||
github.com/golang/mock v1.7.0-rc.1/go.mod h1:s42URUywIqd+OcERslBJvOjepvNymP31m3q8d/GkuRs=
|
github.com/golang/mock v1.7.0-rc.1/go.mod h1:s42URUywIqd+OcERslBJvOjepvNymP31m3q8d/GkuRs=
|
||||||
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
|
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
|
||||||
@@ -66,8 +63,6 @@ github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX
|
|||||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||||
github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0=
|
github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0=
|
||||||
github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||||
github.com/google/pprof v0.0.0-20250630185457-6e76a2b096b5 h1:xhMrHhTJ6zxu3gA4enFM9MLn9AY7613teCdFnlUVbSQ=
|
|
||||||
github.com/google/pprof v0.0.0-20250630185457-6e76a2b096b5/go.mod h1:5hDyRhoBCxViHszMt12TnOpEI4VVi+U8Gm9iphldiMA=
|
|
||||||
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
||||||
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||||
github.com/gorilla/context v1.1.2 h1:WRkNAv2uoa03QNIc1A6u4O7DAGMUVoopZhkiXWA2V1o=
|
github.com/gorilla/context v1.1.2 h1:WRkNAv2uoa03QNIc1A6u4O7DAGMUVoopZhkiXWA2V1o=
|
||||||
@@ -92,37 +87,31 @@ github.com/juju/ratelimit v1.0.2 h1:sRxmtRiajbvrcLQT7S+JbqU0ntsb9W2yhSdNN8tWfaI=
|
|||||||
github.com/juju/ratelimit v1.0.2/go.mod h1:qapgC/Gy+xNh9UxzV13HGGl/6UXNN+ct+vwSgWNm/qk=
|
github.com/juju/ratelimit v1.0.2/go.mod h1:qapgC/Gy+xNh9UxzV13HGGl/6UXNN+ct+vwSgWNm/qk=
|
||||||
github.com/klauspost/compress v1.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zttxdo=
|
github.com/klauspost/compress v1.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zttxdo=
|
||||||
github.com/klauspost/compress v1.18.0/go.mod h1:2Pp+KzxcywXVXMr50+X0Q/Lsb43OQHYWRCY2AiWywWQ=
|
github.com/klauspost/compress v1.18.0/go.mod h1:2Pp+KzxcywXVXMr50+X0Q/Lsb43OQHYWRCY2AiWywWQ=
|
||||||
github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
|
github.com/klauspost/cpuid/v2 v2.3.0 h1:S4CRMLnYUhGeDFDqkGriYKdfoFlDnMtqTiI/sFzhA9Y=
|
||||||
github.com/klauspost/cpuid/v2 v2.2.11 h1:0OwqZRYI2rFrjS4kvkDnqJkKHdHaRnCm68/DY4OxRzU=
|
github.com/klauspost/cpuid/v2 v2.3.0/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0=
|
||||||
github.com/klauspost/cpuid/v2 v2.2.11/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0=
|
|
||||||
github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M=
|
|
||||||
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
|
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
|
||||||
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
|
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
|
||||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||||
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||||
github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ=
|
github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ=
|
||||||
github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI=
|
github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI=
|
||||||
github.com/lufia/plan9stats v0.0.0-20250317134145-8bc96cf8fc35 h1:PpXWgLPs+Fqr325bN2FD2ISlRRztXibcX6e8f5FR5Dc=
|
github.com/lufia/plan9stats v0.0.0-20250827001030-24949be3fa54 h1:mFWunSatvkQQDhpdyuFAYwyAan3hzCuma+Pz8sqvOfg=
|
||||||
github.com/lufia/plan9stats v0.0.0-20250317134145-8bc96cf8fc35/go.mod h1:autxFIvghDt3jPTLoqZ9OZ7s9qTGNAWmYCjVFWPX/zg=
|
github.com/lufia/plan9stats v0.0.0-20250827001030-24949be3fa54/go.mod h1:autxFIvghDt3jPTLoqZ9OZ7s9qTGNAWmYCjVFWPX/zg=
|
||||||
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
|
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
|
||||||
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
||||||
github.com/mattn/go-sqlite3 v1.14.28 h1:ThEiQrnbtumT+QMknw63Befp/ce/nUPgBPMlRFEum7A=
|
github.com/mattn/go-sqlite3 v1.14.32 h1:JD12Ag3oLy1zQA+BNn74xRgaBbdhbNIDYvQUEuuErjs=
|
||||||
github.com/mattn/go-sqlite3 v1.14.28/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=
|
github.com/mattn/go-sqlite3 v1.14.32/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=
|
||||||
github.com/miekg/dns v1.1.66 h1:FeZXOS3VCVsKnEAd+wBkjMC3D2K+ww66Cq3VnCINuJE=
|
github.com/miekg/dns v1.1.68 h1:jsSRkNozw7G/mnmXULynzMNIsgY2dHC8LO6U6Ij2JEA=
|
||||||
github.com/miekg/dns v1.1.66/go.mod h1:jGFzBsSNbJw6z1HYut1RKBKHA9PBdxeHrZG8J+gC2WE=
|
github.com/miekg/dns v1.1.68/go.mod h1:fujopn7TB3Pu3JM69XaawiU0wqjpL9/8xGop5UrTPps=
|
||||||
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
|
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
|
||||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||||
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
|
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
|
||||||
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
|
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
|
||||||
github.com/mymmrac/telego v0.32.0 h1:4X8C1l3k+opkk86r95+eQE8DxiS2LYlR61L/G7yreDY=
|
github.com/mymmrac/telego v1.3.0 h1:y2bDDCioLgkcs+5luUaPgTNHKel1Qh30iUxFcMUrowg=
|
||||||
github.com/mymmrac/telego v0.32.0/go.mod h1:qS6NaRhJgcuEEBEMVCV79S2xCAuHq9O+ixwfLuRW31M=
|
github.com/mymmrac/telego v1.3.0/go.mod h1:0D2l/IA/gUFn4oqsi1O4/tSnlezw5jNV/ReFRDUEKk8=
|
||||||
github.com/nicksnyder/go-i18n/v2 v2.6.0 h1:C/m2NNWNiTB6SK4Ao8df5EWm3JETSTIGNXBpMJTxzxQ=
|
github.com/nicksnyder/go-i18n/v2 v2.6.0 h1:C/m2NNWNiTB6SK4Ao8df5EWm3JETSTIGNXBpMJTxzxQ=
|
||||||
github.com/nicksnyder/go-i18n/v2 v2.6.0/go.mod h1:88sRqr0C6OPyJn0/KRNaEz1uWorjxIKP7rUUcvycecE=
|
github.com/nicksnyder/go-i18n/v2 v2.6.0/go.mod h1:88sRqr0C6OPyJn0/KRNaEz1uWorjxIKP7rUUcvycecE=
|
||||||
github.com/onsi/ginkgo/v2 v2.23.4 h1:ktYTpKJAVZnDT4VjxSbiBenUjmlL/5QkBEocaWXiQus=
|
|
||||||
github.com/onsi/ginkgo/v2 v2.23.4/go.mod h1:Bt66ApGPBFzHyR+JO10Zbt0Gsp4uWxu5mIOTusL46e8=
|
|
||||||
github.com/onsi/gomega v1.36.3 h1:hID7cr8t3Wp26+cYnfcjR6HpJ00fdogN6dqZ1t6IylU=
|
|
||||||
github.com/onsi/gomega v1.36.3/go.mod h1:8D9+Txp43QWKhM24yyOBEdpkzN8FvJyAwecBgsU4KU0=
|
|
||||||
github.com/op/go-logging v0.0.0-20160315200505-970db520ece7 h1:lDH9UUVJtmYCjyT0CI4q8xvlXPxeZ0gYCVvWbmPlp88=
|
github.com/op/go-logging v0.0.0-20160315200505-970db520ece7 h1:lDH9UUVJtmYCjyT0CI4q8xvlXPxeZ0gYCVvWbmPlp88=
|
||||||
github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk=
|
github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk=
|
||||||
github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8=
|
github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8=
|
||||||
@@ -135,41 +124,38 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb
|
|||||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU=
|
github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU=
|
||||||
github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE=
|
github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE=
|
||||||
github.com/prashantv/gostub v1.1.0 h1:BTyx3RfQjRHnUWaGF9oQos79AlQ5k8WNktv7VGvVH4g=
|
|
||||||
github.com/prashantv/gostub v1.1.0/go.mod h1:A5zLQHz7ieHGG7is6LLXLz7I8+3LZzsrV0P1IAHhP5U=
|
|
||||||
github.com/quic-go/qpack v0.5.1 h1:giqksBPnT/HDtZ6VhtFKgoLOWmlyo9Ei6u9PqzIMbhI=
|
github.com/quic-go/qpack v0.5.1 h1:giqksBPnT/HDtZ6VhtFKgoLOWmlyo9Ei6u9PqzIMbhI=
|
||||||
github.com/quic-go/qpack v0.5.1/go.mod h1:+PC4XFrEskIVkcLzpEkbLqq1uCoxPhQuvK5rH1ZgaEg=
|
github.com/quic-go/qpack v0.5.1/go.mod h1:+PC4XFrEskIVkcLzpEkbLqq1uCoxPhQuvK5rH1ZgaEg=
|
||||||
github.com/quic-go/quic-go v0.52.0 h1:/SlHrCRElyaU6MaEPKqKr9z83sBg2v4FLLvWM+Z47pA=
|
github.com/quic-go/quic-go v0.54.0 h1:6s1YB9QotYI6Ospeiguknbp2Znb/jZYjZLRXn9kMQBg=
|
||||||
github.com/quic-go/quic-go v0.52.0/go.mod h1:MFlGGpcpJqRAfmYi6NC2cptDPSxRWTOGNuP4wqrWmzQ=
|
github.com/quic-go/quic-go v0.54.0/go.mod h1:e68ZEaCdyviluZmy44P6Iey98v/Wfz6HCjQEm+l8zTY=
|
||||||
github.com/refraction-networking/utls v1.7.3 h1:L0WRhHY7Oq1T0zkdzVZMR6zWZv+sXbHB9zcuvsAEqCo=
|
github.com/refraction-networking/utls v1.8.0 h1:L38krhiTAyj9EeiQQa2sg+hYb4qwLCqdMcpZrRfbONE=
|
||||||
github.com/refraction-networking/utls v1.7.3/go.mod h1:TUhh27RHMGtQvjQq+RyO11P6ZNQNBb3N0v7wsEjKAIQ=
|
github.com/refraction-networking/utls v1.8.0/go.mod h1:jkSOEkLqn+S/jtpEHPOsVv/4V4EVnelwbMQl4vCWXAM=
|
||||||
github.com/riobard/go-bloom v0.0.0-20200614022211-cdc8013cb5b3 h1:f/FNXud6gA3MNr8meMVVGxhp+QBTqY91tM8HjEuMjGg=
|
github.com/riobard/go-bloom v0.0.0-20200614022211-cdc8013cb5b3 h1:f/FNXud6gA3MNr8meMVVGxhp+QBTqY91tM8HjEuMjGg=
|
||||||
github.com/riobard/go-bloom v0.0.0-20200614022211-cdc8013cb5b3/go.mod h1:HgjTstvQsPGkxUsCd2KWxErBblirPizecHcpD3ffK+s=
|
github.com/riobard/go-bloom v0.0.0-20200614022211-cdc8013cb5b3/go.mod h1:HgjTstvQsPGkxUsCd2KWxErBblirPizecHcpD3ffK+s=
|
||||||
github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs=
|
github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs=
|
||||||
github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro=
|
github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro=
|
||||||
github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ=
|
github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ=
|
||||||
github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc=
|
github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc=
|
||||||
github.com/sagernet/sing v0.6.6 h1:3JkvJ0vqDj/jJcx0a+ve/6lMOrSzZm30I3wrIuZtmRE=
|
github.com/sagernet/sing v0.7.10 h1:2yPhZFx+EkyHPH8hXNezgyRSHyGY12CboId7CtwLROw=
|
||||||
github.com/sagernet/sing v0.6.6/go.mod h1:ARkL0gM13/Iv5VCZmci/NuoOlePoIsW0m7BWfln/Hak=
|
github.com/sagernet/sing v0.7.10/go.mod h1:ARkL0gM13/Iv5VCZmci/NuoOlePoIsW0m7BWfln/Hak=
|
||||||
github.com/sagernet/sing-shadowsocks v0.2.7 h1:zaopR1tbHEw5Nk6FAkM05wCslV6ahVegEZaKMv9ipx8=
|
github.com/sagernet/sing-shadowsocks v0.2.9 h1:Paep5zCszRKsEn8587O0MnhFWKJwDW1Y4zOYYlIxMkM=
|
||||||
github.com/sagernet/sing-shadowsocks v0.2.7/go.mod h1:0rIKJZBR65Qi0zwdKezt4s57y/Tl1ofkaq6NlkzVuyE=
|
github.com/sagernet/sing-shadowsocks v0.2.9/go.mod h1:TE/Z6401Pi8tgr0nBZcM/xawAI6u3F6TTbz4nH/qw+8=
|
||||||
github.com/savsgio/gotils v0.0.0-20250408102913-196191ec6287 h1:qIQ0tWF9vxGtkJa24bR+2i53WBCz1nW/Pc47oVYauC4=
|
|
||||||
github.com/savsgio/gotils v0.0.0-20250408102913-196191ec6287/go.mod h1:sM7Mt7uEoCeFSCBM+qBrqvEo+/9vdmj19wzp3yzUhmg=
|
|
||||||
github.com/seiflotfy/cuckoofilter v0.0.0-20240715131351-a2f2c23f1771 h1:emzAzMZ1L9iaKCTxdy3Em8Wv4ChIAGnfiz18Cda70g4=
|
github.com/seiflotfy/cuckoofilter v0.0.0-20240715131351-a2f2c23f1771 h1:emzAzMZ1L9iaKCTxdy3Em8Wv4ChIAGnfiz18Cda70g4=
|
||||||
github.com/seiflotfy/cuckoofilter v0.0.0-20240715131351-a2f2c23f1771/go.mod h1:bR6DqgcAl1zTcOX8/pE2Qkj9XO00eCNqmKb7lXP8EAg=
|
github.com/seiflotfy/cuckoofilter v0.0.0-20240715131351-a2f2c23f1771/go.mod h1:bR6DqgcAl1zTcOX8/pE2Qkj9XO00eCNqmKb7lXP8EAg=
|
||||||
github.com/shirou/gopsutil/v4 v4.25.6 h1:kLysI2JsKorfaFPcYmcJqbzROzsBWEOAtw6A7dIfqXs=
|
github.com/shirou/gopsutil/v4 v4.25.8 h1:NnAsw9lN7587WHxjJA9ryDnqhJpFH6A+wagYWTOH970=
|
||||||
github.com/shirou/gopsutil/v4 v4.25.6/go.mod h1:PfybzyydfZcN+JMMjkF6Zb8Mq1A/VcogFFg7hj50W9c=
|
github.com/shirou/gopsutil/v4 v4.25.8/go.mod h1:q9QdMmfAOVIw7a+eF86P7ISEU6ka+NLgkUxlopV4RwI=
|
||||||
|
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e h1:MRM5ITcdelLK2j1vwZ3Je0FKVCfqOLp5zO6trqMLYs0=
|
||||||
|
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e/go.mod h1:XV66xRDqSt+GTGFMVlhk3ULuV0y9ZmzeVGR4mloJI3M=
|
||||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
||||||
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
|
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
|
||||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||||
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
|
||||||
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||||
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||||
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||||
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
|
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
|
||||||
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
|
||||||
github.com/tklauser/go-sysconf v0.3.15 h1:VE89k0criAymJ/Os65CSn1IXaol+1wrsFHEB8Ol49K4=
|
github.com/tklauser/go-sysconf v0.3.15 h1:VE89k0criAymJ/Os65CSn1IXaol+1wrsFHEB8Ol49K4=
|
||||||
github.com/tklauser/go-sysconf v0.3.15/go.mod h1:Dmjwr6tYFIseJw7a3dRLJfsHAMXZ3nEnL/aZY+0IuI4=
|
github.com/tklauser/go-sysconf v0.3.15/go.mod h1:Dmjwr6tYFIseJw7a3dRLJfsHAMXZ3nEnL/aZY+0IuI4=
|
||||||
github.com/tklauser/numcpus v0.10.0 h1:18njr6LDBk1zuna922MgdjQuJFjrdppsZG60sHGfjso=
|
github.com/tklauser/numcpus v0.10.0 h1:18njr6LDBk1zuna922MgdjQuJFjrdppsZG60sHGfjso=
|
||||||
@@ -182,8 +168,8 @@ github.com/v2fly/ss-bloomring v0.0.0-20210312155135-28617310f63e h1:5QefA066A1tF
|
|||||||
github.com/v2fly/ss-bloomring v0.0.0-20210312155135-28617310f63e/go.mod h1:5t19P9LBIrNamL6AcMQOncg/r10y3Pc01AbHeMhwlpU=
|
github.com/v2fly/ss-bloomring v0.0.0-20210312155135-28617310f63e/go.mod h1:5t19P9LBIrNamL6AcMQOncg/r10y3Pc01AbHeMhwlpU=
|
||||||
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
|
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
|
||||||
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
|
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
|
||||||
github.com/valyala/fasthttp v1.63.0 h1:DisIL8OjB7ul2d7cBaMRcKTQDYnrGy56R4FCiuDP0Ns=
|
github.com/valyala/fasthttp v1.66.0 h1:M87A0Z7EayeyNaV6pfO3tUTUiYO0dZfEJnRGXTVNuyU=
|
||||||
github.com/valyala/fasthttp v1.63.0/go.mod h1:REc4IeW+cAEyLrRPa5A81MIjvz0QE1laoTX2EaPHKJM=
|
github.com/valyala/fasthttp v1.66.0/go.mod h1:Y4eC+zwoocmXSVCB1JmhNbYtS7tZPRI2ztPB72EVObs=
|
||||||
github.com/valyala/fastjson v1.6.4 h1:uAUNq9Z6ymTgGhcm0UynUAB6tlbakBrz6CQFax3BXVQ=
|
github.com/valyala/fastjson v1.6.4 h1:uAUNq9Z6ymTgGhcm0UynUAB6tlbakBrz6CQFax3BXVQ=
|
||||||
github.com/valyala/fastjson v1.6.4/go.mod h1:CLCAqky6SMuOcxStkYQvblddUtoRxhYMGLrsQns1aXY=
|
github.com/valyala/fastjson v1.6.4/go.mod h1:CLCAqky6SMuOcxStkYQvblddUtoRxhYMGLrsQns1aXY=
|
||||||
github.com/vishvananda/netlink v1.3.1 h1:3AEMt62VKqz90r0tmNhog0r/PpWKmrEShJU0wJW6bV0=
|
github.com/vishvananda/netlink v1.3.1 h1:3AEMt62VKqz90r0tmNhog0r/PpWKmrEShJU0wJW6bV0=
|
||||||
@@ -192,68 +178,68 @@ github.com/vishvananda/netns v0.0.5 h1:DfiHV+j8bA32MFM7bfEunvT8IAqQ/NzSJHtcmW5zd
|
|||||||
github.com/vishvananda/netns v0.0.5/go.mod h1:SpkAiCQRtJ6TvvxPnOSyH3BMl6unz3xZlaprSwhNNJM=
|
github.com/vishvananda/netns v0.0.5/go.mod h1:SpkAiCQRtJ6TvvxPnOSyH3BMl6unz3xZlaprSwhNNJM=
|
||||||
github.com/xlzd/gotp v0.1.0 h1:37blvlKCh38s+fkem+fFh7sMnceltoIEBYTVXyoa5Po=
|
github.com/xlzd/gotp v0.1.0 h1:37blvlKCh38s+fkem+fFh7sMnceltoIEBYTVXyoa5Po=
|
||||||
github.com/xlzd/gotp v0.1.0/go.mod h1:ndLJ3JKzi3xLmUProq4LLxCuECL93dG9WASNLpHz8qg=
|
github.com/xlzd/gotp v0.1.0/go.mod h1:ndLJ3JKzi3xLmUProq4LLxCuECL93dG9WASNLpHz8qg=
|
||||||
github.com/xtls/reality v0.0.0-20250627141458-e62c4aed0d57 h1:CJzC54UytAYnNbJSlAFi9MXOofSUAtpoQTKIA3hUpj8=
|
github.com/xtls/reality v0.0.0-20250904214705-431b6ff8c67c h1:LHLhQY3mKXSpTcQAkjFR4/6ar3rXjQryNeM7khK3AHU=
|
||||||
github.com/xtls/reality v0.0.0-20250627141458-e62c4aed0d57/go.mod h1:yD47RN65bDLZgyHWMfFDiqlzrq4usDMt/Xzsk6tMbhw=
|
github.com/xtls/reality v0.0.0-20250904214705-431b6ff8c67c/go.mod h1:XxvnCCgBee4WWE0bc4E+a7wbk8gkJ/rS0vNVNtC5qp0=
|
||||||
github.com/xtls/xray-core v1.250608.0 h1:/M0LwzFeFAZf+vdZQhqNYjUXDfPv5hOeYw6jsiAdgWI=
|
github.com/xtls/xray-core v1.250911.0 h1:KMN8zVurAjHFixiUoFV/jwmzYohf27dQRntjV+8LQno=
|
||||||
github.com/xtls/xray-core v1.250608.0/go.mod h1:MkfIs2WZ5VLtZHAwDKosSS05Kx5zFFOzvly7Hy6pfPs=
|
github.com/xtls/xray-core v1.250911.0/go.mod h1:LkqA/BFVtPS2e5fRzg/bkYas9nQu4Uztlx+/fjlLM9k=
|
||||||
github.com/xyproto/randomstring v1.0.5 h1:YtlWPoRdgMu3NZtP45drfy1GKoojuR7hmRcnhZqKjWU=
|
github.com/xyproto/randomstring v1.0.5 h1:YtlWPoRdgMu3NZtP45drfy1GKoojuR7hmRcnhZqKjWU=
|
||||||
github.com/xyproto/randomstring v1.0.5/go.mod h1:rgmS5DeNXLivK7YprL0pY+lTuhNQW3iGxZ18UQApw/E=
|
github.com/xyproto/randomstring v1.0.5/go.mod h1:rgmS5DeNXLivK7YprL0pY+lTuhNQW3iGxZ18UQApw/E=
|
||||||
github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo0=
|
github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo0=
|
||||||
github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0=
|
github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0=
|
||||||
go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA=
|
go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA=
|
||||||
go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A=
|
go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A=
|
||||||
go.opentelemetry.io/otel v1.35.0 h1:xKWKPxrxB6OtMCbmMY021CqC45J+3Onta9MqjhnusiQ=
|
go.opentelemetry.io/otel v1.37.0 h1:9zhNfelUvx0KBfu/gb+ZgeAfAgtWrfHJZcAqFC228wQ=
|
||||||
go.opentelemetry.io/otel v1.35.0/go.mod h1:UEqy8Zp11hpkUrL73gSlELM0DupHoiq72dR+Zqel/+Y=
|
go.opentelemetry.io/otel v1.37.0/go.mod h1:ehE/umFRLnuLa/vSccNq9oS1ErUlkkK71gMcN34UG8I=
|
||||||
go.opentelemetry.io/otel/metric v1.35.0 h1:0znxYu2SNyuMSQT4Y9WDWej0VpcsxkuklLa4/siN90M=
|
go.opentelemetry.io/otel/metric v1.37.0 h1:mvwbQS5m0tbmqML4NqK+e3aDiO02vsf/WgbsdpcPoZE=
|
||||||
go.opentelemetry.io/otel/metric v1.35.0/go.mod h1:nKVFgxBZ2fReX6IlyW28MgZojkoAkJGaE8CpgeAU3oE=
|
go.opentelemetry.io/otel/metric v1.37.0/go.mod h1:04wGrZurHYKOc+RKeye86GwKiTb9FKm1WHtO+4EVr2E=
|
||||||
go.opentelemetry.io/otel/sdk v1.35.0 h1:iPctf8iprVySXSKJffSS79eOjl9pvxV9ZqOWT0QejKY=
|
go.opentelemetry.io/otel/sdk v1.37.0 h1:ItB0QUqnjesGRvNcmAcU0LyvkVyGJ2xftD29bWdDvKI=
|
||||||
go.opentelemetry.io/otel/sdk v1.35.0/go.mod h1:+ga1bZliga3DxJ3CQGg3updiaAJoNECOgJREo9KHGQg=
|
go.opentelemetry.io/otel/sdk v1.37.0/go.mod h1:VredYzxUvuo2q3WRcDnKDjbdvmO0sCzOvVAiY+yUkAg=
|
||||||
go.opentelemetry.io/otel/sdk/metric v1.35.0 h1:1RriWBmCKgkeHEhM7a2uMjMUfP7MsOF5JpUCaEqEI9o=
|
go.opentelemetry.io/otel/sdk/metric v1.37.0 h1:90lI228XrB9jCMuSdA0673aubgRobVZFhbjxHHspCPc=
|
||||||
go.opentelemetry.io/otel/sdk/metric v1.35.0/go.mod h1:is6XYCUMpcKi+ZsOvfluY5YstFnhW0BidkR+gL+qN+w=
|
go.opentelemetry.io/otel/sdk/metric v1.37.0/go.mod h1:cNen4ZWfiD37l5NhS+Keb5RXVWZWpRE+9WyVCpbo5ps=
|
||||||
go.opentelemetry.io/otel/trace v1.35.0 h1:dPpEfJu1sDIqruz7BHFG3c7528f6ddfSWfFDVt/xgMs=
|
go.opentelemetry.io/otel/trace v1.37.0 h1:HLdcFNbRQBE2imdSEgm/kwqmQj1Or1l/7bW6mxVK7z4=
|
||||||
go.opentelemetry.io/otel/trace v1.35.0/go.mod h1:WUk7DtFp1Aw2MkvqGdwiXYDZZNvA/1J8o6xRXLrIkyc=
|
go.opentelemetry.io/otel/trace v1.37.0/go.mod h1:TlgrlQ+PtQO5XFerSPUYG0JSgGyryXewPGyayAWSBS0=
|
||||||
go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE=
|
go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE=
|
||||||
go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0=
|
go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0=
|
||||||
go.uber.org/automaxprocs v1.6.0 h1:O3y2/QNTOdbF+e/dpXNNW7Rx2hZ4sTIPyybbxyNqTUs=
|
go.uber.org/mock v0.6.0 h1:hyF9dfmbgIX5EfOdasqLsWD6xqpNZlXblLB/Dbnwv3Y=
|
||||||
go.uber.org/automaxprocs v1.6.0/go.mod h1:ifeIMSnPZuznNm6jmdzmU3/bfk01Fe2fotchwEFJ8r8=
|
go.uber.org/mock v0.6.0/go.mod h1:KiVJ4BqZJaMj4svdfmHM0AUx4NJYO8ZNpPnZn1Z+BBU=
|
||||||
go.uber.org/mock v0.5.2 h1:LbtPTcP8A5k9WPXj54PPPbjcI4Y6lhyOZXn+VS7wNko=
|
|
||||||
go.uber.org/mock v0.5.2/go.mod h1:wLlUxC2vVTPTaE3UD51E0BGOAElKrILxhVSDYQLld5o=
|
|
||||||
go4.org/netipx v0.0.0-20231129151722-fdeea329fbba h1:0b9z3AuHCjxk0x/opv64kcgZLBseWJUpBw5I82+2U4M=
|
go4.org/netipx v0.0.0-20231129151722-fdeea329fbba h1:0b9z3AuHCjxk0x/opv64kcgZLBseWJUpBw5I82+2U4M=
|
||||||
go4.org/netipx v0.0.0-20231129151722-fdeea329fbba/go.mod h1:PLyyIXexvUFg3Owu6p/WfdlivPbZJsZdgWZlrGope/Y=
|
go4.org/netipx v0.0.0-20231129151722-fdeea329fbba/go.mod h1:PLyyIXexvUFg3Owu6p/WfdlivPbZJsZdgWZlrGope/Y=
|
||||||
golang.org/x/arch v0.18.0 h1:WN9poc33zL4AzGxqf8VtpKUnGvMi8O9lhNyBMF/85qc=
|
golang.org/x/arch v0.21.0 h1:iTC9o7+wP6cPWpDWkivCvQFGAHDQ59SrSxsLPcnkArw=
|
||||||
golang.org/x/arch v0.18.0/go.mod h1:bdwinDaKcfZUGpH09BB7ZmOfhalA8lQdzl62l8gGWsk=
|
golang.org/x/arch v0.21.0/go.mod h1:dNHoOeKiyja7GTvF9NJS1l3Z2yntpQNzgrjh1cU103A=
|
||||||
golang.org/x/crypto v0.39.0 h1:SHs+kF4LP+f+p14esP5jAoDpHU8Gu/v9lFRK6IT5imM=
|
golang.org/x/crypto v0.42.0 h1:chiH31gIWm57EkTXpwnqf8qeuMUi0yekh6mT2AvFlqI=
|
||||||
golang.org/x/crypto v0.39.0/go.mod h1:L+Xg3Wf6HoL4Bn4238Z6ft6KfEpN0tJGo53AAPC632U=
|
golang.org/x/crypto v0.42.0/go.mod h1:4+rDnOTJhQCx2q7/j6rAN5XDw8kPjeaXEUR2eL94ix8=
|
||||||
golang.org/x/mod v0.25.0 h1:n7a+ZbQKQA/Ysbyb0/6IbB1H/X41mKgbhfv7AfG/44w=
|
golang.org/x/mod v0.28.0 h1:gQBtGhjxykdjY9YhZpSlZIsbnaE2+PgjfLWUQTnoZ1U=
|
||||||
golang.org/x/mod v0.25.0/go.mod h1:IXM97Txy2VM4PJ3gI61r1YEk/gAj6zAHN3AdZt6S9Ww=
|
golang.org/x/mod v0.28.0/go.mod h1:yfB/L0NOf/kmEbXjzCPOx1iK1fRutOydrCMsqRhEBxI=
|
||||||
golang.org/x/net v0.41.0 h1:vBTly1HeNPEn3wtREYfy4GZ/NECgw2Cnl+nK6Nz3uvw=
|
golang.org/x/net v0.44.0 h1:evd8IRDyfNBMBTTY5XRF1vaZlD+EmWx6x8PkhR04H/I=
|
||||||
golang.org/x/net v0.41.0/go.mod h1:B/K4NNqkfmg07DQYrbwvSluqCJOOXwUjeb/5lOisjbA=
|
golang.org/x/net v0.44.0/go.mod h1:ECOoLqd5U3Lhyeyo/QDCEVQ4sNgYsqvCZ722XogGieY=
|
||||||
golang.org/x/sync v0.15.0 h1:KWH3jNZsfyT6xfAfKiz6MRNmd46ByHDYaZ7KSkCtdW8=
|
golang.org/x/sync v0.17.0 h1:l60nONMj9l5drqw6jlhIELNv9I0A4OFgRsG9k2oT9Ug=
|
||||||
golang.org/x/sync v0.15.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
|
golang.org/x/sync v0.17.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
|
||||||
golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw=
|
golang.org/x/sys v0.36.0 h1:KVRy2GtZBrk1cBYA7MKu5bEZFxQk4NIDV6RLVcC8o0k=
|
||||||
golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
|
golang.org/x/sys v0.36.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
|
||||||
golang.org/x/text v0.26.0 h1:P42AVeLghgTYr4+xUnTRKDMqpar+PtX7KWuNQL21L8M=
|
golang.org/x/text v0.29.0 h1:1neNs90w9YzJ9BocxfsQNHKuAT4pkghyXc4nhZ6sJvk=
|
||||||
golang.org/x/text v0.26.0/go.mod h1:QK15LZJUUQVJxhz7wXgxSy/CJaTFjd0G+YLonydOVQA=
|
golang.org/x/text v0.29.0/go.mod h1:7MhJOA9CD2qZyOKYazxdYMF85OwPdEr9jTtBpO7ydH4=
|
||||||
golang.org/x/time v0.12.0 h1:ScB/8o8olJvc+CQPWrK3fPZNfh7qgwCrY0zJmoEQLSE=
|
golang.org/x/time v0.13.0 h1:eUlYslOIt32DgYD6utsuUeHs4d7AsEYLuIAdg7FlYgI=
|
||||||
golang.org/x/time v0.12.0/go.mod h1:CDIdPxbZBQxdj6cxyCIdrNogrJKMJ7pr37NYpMcMDSg=
|
golang.org/x/time v0.13.0/go.mod h1:eL/Oa2bBBK0TkX57Fyni+NgnyQQN4LitPmob2Hjnqw4=
|
||||||
golang.org/x/tools v0.34.0 h1:qIpSLOxeCYGg9TrcJokLBG4KFA6d795g0xkBkiESGlo=
|
golang.org/x/tools v0.37.0 h1:DVSRzp7FwePZW356yEAChSdNcQo6Nsp+fex1SUW09lE=
|
||||||
golang.org/x/tools v0.34.0/go.mod h1:pAP9OwEaY1CAW3HOmg3hLZC5Z0CCmzjAF2UQMSqNARg=
|
golang.org/x/tools v0.37.0/go.mod h1:MBN5QPQtLMHVdvsbtarmTNukZDdgwdwlO5qGacAzF0w=
|
||||||
golang.zx2c4.com/wintun v0.0.0-20230126152724-0fa3db229ce2 h1:B82qJJgjvYKsXS9jeunTOisW56dUokqW/FOteYJJ/yg=
|
golang.zx2c4.com/wintun v0.0.0-20230126152724-0fa3db229ce2 h1:B82qJJgjvYKsXS9jeunTOisW56dUokqW/FOteYJJ/yg=
|
||||||
golang.zx2c4.com/wintun v0.0.0-20230126152724-0fa3db229ce2/go.mod h1:deeaetjYA+DHMHg+sMSMI58GrEteJUUzzw7en6TJQcI=
|
golang.zx2c4.com/wintun v0.0.0-20230126152724-0fa3db229ce2/go.mod h1:deeaetjYA+DHMHg+sMSMI58GrEteJUUzzw7en6TJQcI=
|
||||||
golang.zx2c4.com/wireguard v0.0.0-20231211153847-12269c276173 h1:/jFs0duh4rdb8uIfPMv78iAJGcPKDeqAFnaLBropIC4=
|
golang.zx2c4.com/wireguard v0.0.0-20250521234502-f333402bd9cb h1:whnFRlWMcXI9d+ZbWg+4sHnLp52d5yiIPUxMBSt4X9A=
|
||||||
golang.zx2c4.com/wireguard v0.0.0-20231211153847-12269c276173/go.mod h1:tkCQ4FQXmpAgYVh++1cq16/dH4QJtmvpRv19DWGAHSA=
|
golang.zx2c4.com/wireguard v0.0.0-20250521234502-f333402bd9cb/go.mod h1:rpwXGsirqLqN2L0JDJQlwOboGHmptD5ZD6T2VmcqhTw=
|
||||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20250603155806-513f23925822 h1:fc6jSaCT0vBduLYZHYrBBNY4dsWuvgyff9noRNDdBeE=
|
gonum.org/v1/gonum v0.16.0 h1:5+ul4Swaf3ESvrOnidPp4GZbzf0mxVQpDCYUQE7OJfk=
|
||||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20250603155806-513f23925822/go.mod h1:qQ0YXyHHx3XkvlzUtpXDkS29lDSafHMZBAZDc03LQ3A=
|
gonum.org/v1/gonum v0.16.0/go.mod h1:fef3am4MQ93R2HHpKnLk4/Tbh/s0+wqD5nfa6Pnwy4E=
|
||||||
google.golang.org/grpc v1.73.0 h1:VIWSmpI2MegBtTuFt5/JWy2oXxtjJ/e89Z70ImfD2ok=
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20250908214217-97024824d090 h1:/OQuEa4YWtDt7uQWHd3q3sUMb+QOLQUg1xa8CEsRv5w=
|
||||||
google.golang.org/grpc v1.73.0/go.mod h1:50sbHOUqWoCQGI8V2HQLJM0B+LMlIUjNSZmow7EVBQc=
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20250908214217-97024824d090/go.mod h1:GmFNa4BdJZ2a8G+wCe9Bg3wwThLrJun751XstdJt5Og=
|
||||||
google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY=
|
google.golang.org/grpc v1.75.1 h1:/ODCNEuf9VghjgO3rqLcfg8fiOP0nSluljWFlDxELLI=
|
||||||
google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY=
|
google.golang.org/grpc v1.75.1/go.mod h1:JtPAzKiq4v1xcAB2hydNlWI2RnF85XXcV0mhKXr2ecQ=
|
||||||
|
google.golang.org/protobuf v1.36.9 h1:w2gp2mA27hUeUzj9Ex9FBjsBm40zfaDtEWow293U7Iw=
|
||||||
|
google.golang.org/protobuf v1.36.9/go.mod h1:fuxRtAxBytpl4zzqUh6/eyUujkJdNiuEkXntxiD/uRU=
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
|
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
|
||||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
|
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
|
||||||
@@ -265,10 +251,9 @@ gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
|||||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
gorm.io/driver/sqlite v1.6.0 h1:WHRRrIiulaPiPFmDcod6prc4l2VGVWHz80KspNsxSfQ=
|
gorm.io/driver/sqlite v1.6.0 h1:WHRRrIiulaPiPFmDcod6prc4l2VGVWHz80KspNsxSfQ=
|
||||||
gorm.io/driver/sqlite v1.6.0/go.mod h1:AO9V1qIQddBESngQUKWL9yoH93HIeA1X6V633rBwyT8=
|
gorm.io/driver/sqlite v1.6.0/go.mod h1:AO9V1qIQddBESngQUKWL9yoH93HIeA1X6V633rBwyT8=
|
||||||
gorm.io/gorm v1.30.0 h1:qbT5aPv1UH8gI99OsRlvDToLxW5zR7FzS9acZDOZcgs=
|
gorm.io/gorm v1.31.0 h1:0VlycGreVhK7RF/Bwt51Fk8v0xLiiiFdbGDPIZQ7mJY=
|
||||||
gorm.io/gorm v1.30.0/go.mod h1:8Z33v652h4//uMA76KjeDH8mJXPm1QNCYrMeatR0DOE=
|
gorm.io/gorm v1.31.0/go.mod h1:XyQVbO2k6YkOis7C2437jSit3SsDK72s7n7rsSHd+Gs=
|
||||||
gvisor.dev/gvisor v0.0.0-20250428193742-2d800c3129d5 h1:sfK5nHuG7lRFZ2FdTT3RimOqWBg8IrVm+/Vko1FVOsk=
|
gvisor.dev/gvisor v0.0.0-20250503011706-39ed1f5ac29c h1:m/r7OM+Y2Ty1sgBQ7Qb27VgIMBW8ZZhT4gLnUyDIhzI=
|
||||||
gvisor.dev/gvisor v0.0.0-20250428193742-2d800c3129d5/go.mod h1:3r5CMtNQMKIvBlrmM9xWUNamjKBYPOWyXOjmg5Kts3g=
|
gvisor.dev/gvisor v0.0.0-20250503011706-39ed1f5ac29c/go.mod h1:3r5CMtNQMKIvBlrmM9xWUNamjKBYPOWyXOjmg5Kts3g=
|
||||||
lukechampine.com/blake3 v1.4.1 h1:I3Smz7gso8w4/TunLKec6K2fn+kyKtDxr/xcQEN84Wg=
|
lukechampine.com/blake3 v1.4.1 h1:I3Smz7gso8w4/TunLKec6K2fn+kyKtDxr/xcQEN84Wg=
|
||||||
lukechampine.com/blake3 v1.4.1/go.mod h1:QFosUxmjB8mnrWFSNwKmvxHpfY72bmD2tQ0kBMM3kwo=
|
lukechampine.com/blake3 v1.4.1/go.mod h1:QFosUxmjB8mnrWFSNwKmvxHpfY72bmD2tQ0kBMM3kwo=
|
||||||
nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50=
|
|
||||||
|
|||||||
52
install.sh
52
install.sh
@@ -39,19 +39,6 @@ arch() {
|
|||||||
|
|
||||||
echo "Arch: $(arch)"
|
echo "Arch: $(arch)"
|
||||||
|
|
||||||
check_glibc_version() {
|
|
||||||
glibc_version=$(ldd --version | head -n1 | awk '{print $NF}')
|
|
||||||
|
|
||||||
required_version="2.32"
|
|
||||||
if [[ "$(printf '%s\n' "$required_version" "$glibc_version" | sort -V | head -n1)" != "$required_version" ]]; then
|
|
||||||
echo -e "${red}GLIBC version $glibc_version is too old! Required: 2.32 or higher${plain}"
|
|
||||||
echo "Please upgrade to a newer version of your operating system to get a higher GLIBC version."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
echo "GLIBC version: $glibc_version (meets requirement of 2.32+)"
|
|
||||||
}
|
|
||||||
check_glibc_version
|
|
||||||
|
|
||||||
install_base() {
|
install_base() {
|
||||||
case "${release}" in
|
case "${release}" in
|
||||||
ubuntu | debian | armbian)
|
ubuntu | debian | armbian)
|
||||||
@@ -70,7 +57,7 @@ install_base() {
|
|||||||
zypper refresh && zypper -q install -y wget curl tar timezone
|
zypper refresh && zypper -q install -y wget curl tar timezone
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
apt-get update && apt install -y -q wget curl tar tzdata
|
apt-get update && apt-get install -y -q wget curl tar tzdata
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
@@ -85,14 +72,25 @@ config_after_install() {
|
|||||||
local existing_hasDefaultCredential=$(/usr/local/x-ui/x-ui setting -show true | grep -Eo 'hasDefaultCredential: .+' | awk '{print $2}')
|
local existing_hasDefaultCredential=$(/usr/local/x-ui/x-ui setting -show true | grep -Eo 'hasDefaultCredential: .+' | awk '{print $2}')
|
||||||
local existing_webBasePath=$(/usr/local/x-ui/x-ui setting -show true | grep -Eo 'webBasePath: .+' | awk '{print $2}')
|
local existing_webBasePath=$(/usr/local/x-ui/x-ui setting -show true | grep -Eo 'webBasePath: .+' | awk '{print $2}')
|
||||||
local existing_port=$(/usr/local/x-ui/x-ui setting -show true | grep -Eo 'port: .+' | awk '{print $2}')
|
local existing_port=$(/usr/local/x-ui/x-ui setting -show true | grep -Eo 'port: .+' | awk '{print $2}')
|
||||||
local server_ip=$(curl -s --max-time 3 https://api.ipify.org)
|
local URL_lists=(
|
||||||
if [ -z "$server_ip" ]; then
|
"https://api4.ipify.org"
|
||||||
server_ip=$(curl -s --max-time 3 https://4.ident.me)
|
"https://ipv4.icanhazip.com"
|
||||||
fi
|
"https://v4.api.ipinfo.io/ip"
|
||||||
|
"https://ipv4.myexternalip.com/raw"
|
||||||
|
"https://4.ident.me"
|
||||||
|
"https://check-host.net/ip"
|
||||||
|
)
|
||||||
|
local server_ip=""
|
||||||
|
for ip_address in "${URL_lists[@]}"; do
|
||||||
|
server_ip=$(curl -s --max-time 3 "${ip_address}" 2>/dev/null | tr -d '[:space:]')
|
||||||
|
if [[ -n "${server_ip}" ]]; then
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
if [[ ${#existing_webBasePath} -lt 4 ]]; then
|
if [[ ${#existing_webBasePath} -lt 4 ]]; then
|
||||||
if [[ "$existing_hasDefaultCredential" == "true" ]]; then
|
if [[ "$existing_hasDefaultCredential" == "true" ]]; then
|
||||||
local config_webBasePath=$(gen_random_string 15)
|
local config_webBasePath=$(gen_random_string 18)
|
||||||
local config_username=$(gen_random_string 10)
|
local config_username=$(gen_random_string 10)
|
||||||
local config_password=$(gen_random_string 10)
|
local config_password=$(gen_random_string 10)
|
||||||
|
|
||||||
@@ -115,7 +113,7 @@ config_after_install() {
|
|||||||
echo -e "${green}Access URL: http://${server_ip}:${config_port}/${config_webBasePath}${plain}"
|
echo -e "${green}Access URL: http://${server_ip}:${config_port}/${config_webBasePath}${plain}"
|
||||||
echo -e "###############################################"
|
echo -e "###############################################"
|
||||||
else
|
else
|
||||||
local config_webBasePath=$(gen_random_string 15)
|
local config_webBasePath=$(gen_random_string 18)
|
||||||
echo -e "${yellow}WebBasePath is missing or too short. Generating a new one...${plain}"
|
echo -e "${yellow}WebBasePath is missing or too short. Generating a new one...${plain}"
|
||||||
/usr/local/x-ui/x-ui setting -webBasePath "${config_webBasePath}"
|
/usr/local/x-ui/x-ui setting -webBasePath "${config_webBasePath}"
|
||||||
echo -e "${green}New WebBasePath: ${config_webBasePath}${plain}"
|
echo -e "${green}New WebBasePath: ${config_webBasePath}${plain}"
|
||||||
@@ -144,6 +142,7 @@ config_after_install() {
|
|||||||
install_x-ui() {
|
install_x-ui() {
|
||||||
cd /usr/local/
|
cd /usr/local/
|
||||||
|
|
||||||
|
# Download resources
|
||||||
if [ $# == 0 ]; then
|
if [ $# == 0 ]; then
|
||||||
tag_version=$(curl -Ls "https://api.github.com/repos/MHSanaei/3x-ui/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
|
tag_version=$(curl -Ls "https://api.github.com/repos/MHSanaei/3x-ui/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
|
||||||
if [[ ! -n "$tag_version" ]]; then
|
if [[ ! -n "$tag_version" ]]; then
|
||||||
@@ -174,30 +173,35 @@ install_x-ui() {
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
wget -O /usr/bin/x-ui-temp https://raw.githubusercontent.com/MHSanaei/3x-ui/main/x-ui.sh
|
||||||
|
|
||||||
|
# Stop x-ui service and remove old resources
|
||||||
if [[ -e /usr/local/x-ui/ ]]; then
|
if [[ -e /usr/local/x-ui/ ]]; then
|
||||||
systemctl stop x-ui
|
systemctl stop x-ui
|
||||||
rm /usr/local/x-ui/ -rf
|
rm /usr/local/x-ui/ -rf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Extract resources and set permissions
|
||||||
tar zxvf x-ui-linux-$(arch).tar.gz
|
tar zxvf x-ui-linux-$(arch).tar.gz
|
||||||
rm x-ui-linux-$(arch).tar.gz -f
|
rm x-ui-linux-$(arch).tar.gz -f
|
||||||
|
|
||||||
cd x-ui
|
cd x-ui
|
||||||
chmod +x x-ui
|
chmod +x x-ui
|
||||||
|
chmod +x x-ui.sh
|
||||||
|
|
||||||
# Check the system's architecture and rename the file accordingly
|
# Check the system's architecture and rename the file accordingly
|
||||||
if [[ $(arch) == "armv5" || $(arch) == "armv6" || $(arch) == "armv7" ]]; then
|
if [[ $(arch) == "armv5" || $(arch) == "armv6" || $(arch) == "armv7" ]]; then
|
||||||
mv bin/xray-linux-$(arch) bin/xray-linux-arm
|
mv bin/xray-linux-$(arch) bin/xray-linux-arm
|
||||||
chmod +x bin/xray-linux-arm
|
chmod +x bin/xray-linux-arm
|
||||||
fi
|
fi
|
||||||
|
|
||||||
chmod +x x-ui bin/xray-linux-$(arch)
|
chmod +x x-ui bin/xray-linux-$(arch)
|
||||||
cp -f x-ui.service /etc/systemd/system/
|
|
||||||
wget -O /usr/bin/x-ui https://raw.githubusercontent.com/MHSanaei/3x-ui/main/x-ui.sh
|
# Update x-ui cli and se set permission
|
||||||
chmod +x /usr/local/x-ui/x-ui.sh
|
mv -f /usr/bin/x-ui-temp /usr/bin/x-ui
|
||||||
chmod +x /usr/bin/x-ui
|
chmod +x /usr/bin/x-ui
|
||||||
config_after_install
|
config_after_install
|
||||||
|
|
||||||
|
cp -f x-ui.service /etc/systemd/system/
|
||||||
systemctl daemon-reload
|
systemctl daemon-reload
|
||||||
systemctl enable x-ui
|
systemctl enable x-ui
|
||||||
systemctl start x-ui
|
systemctl start x-ui
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
// Package logger provides logging functionality for the 3x-ui panel with
|
||||||
|
// buffered log storage and multiple log levels.
|
||||||
package logger
|
package logger
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@@ -9,7 +11,11 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
logger *logging.Logger
|
logger *logging.Logger
|
||||||
|
|
||||||
|
// addToBuffer appends a log entry into the in-memory ring buffer used for
|
||||||
|
// retrieving recent logs via the web UI. It keeps the buffer bounded to avoid
|
||||||
|
// uncontrolled growth.
|
||||||
logBuffer []struct {
|
logBuffer []struct {
|
||||||
time string
|
time string
|
||||||
level logging.Level
|
level logging.Level
|
||||||
@@ -21,6 +27,7 @@ func init() {
|
|||||||
InitLogger(logging.INFO)
|
InitLogger(logging.INFO)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// InitLogger initializes the logger with the specified logging level.
|
||||||
func InitLogger(level logging.Level) {
|
func InitLogger(level logging.Level) {
|
||||||
newLogger := logging.MustGetLogger("x-ui")
|
newLogger := logging.MustGetLogger("x-ui")
|
||||||
var err error
|
var err error
|
||||||
@@ -47,51 +54,61 @@ func InitLogger(level logging.Level) {
|
|||||||
logger = newLogger
|
logger = newLogger
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Debug logs a debug message and adds it to the log buffer.
|
||||||
func Debug(args ...any) {
|
func Debug(args ...any) {
|
||||||
logger.Debug(args...)
|
logger.Debug(args...)
|
||||||
addToBuffer("DEBUG", fmt.Sprint(args...))
|
addToBuffer("DEBUG", fmt.Sprint(args...))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Debugf logs a formatted debug message and adds it to the log buffer.
|
||||||
func Debugf(format string, args ...any) {
|
func Debugf(format string, args ...any) {
|
||||||
logger.Debugf(format, args...)
|
logger.Debugf(format, args...)
|
||||||
addToBuffer("DEBUG", fmt.Sprintf(format, args...))
|
addToBuffer("DEBUG", fmt.Sprintf(format, args...))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Info logs an info message and adds it to the log buffer.
|
||||||
func Info(args ...any) {
|
func Info(args ...any) {
|
||||||
logger.Info(args...)
|
logger.Info(args...)
|
||||||
addToBuffer("INFO", fmt.Sprint(args...))
|
addToBuffer("INFO", fmt.Sprint(args...))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Infof logs a formatted info message and adds it to the log buffer.
|
||||||
func Infof(format string, args ...any) {
|
func Infof(format string, args ...any) {
|
||||||
logger.Infof(format, args...)
|
logger.Infof(format, args...)
|
||||||
addToBuffer("INFO", fmt.Sprintf(format, args...))
|
addToBuffer("INFO", fmt.Sprintf(format, args...))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Notice logs a notice message and adds it to the log buffer.
|
||||||
func Notice(args ...any) {
|
func Notice(args ...any) {
|
||||||
logger.Notice(args...)
|
logger.Notice(args...)
|
||||||
addToBuffer("NOTICE", fmt.Sprint(args...))
|
addToBuffer("NOTICE", fmt.Sprint(args...))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Noticef logs a formatted notice message and adds it to the log buffer.
|
||||||
func Noticef(format string, args ...any) {
|
func Noticef(format string, args ...any) {
|
||||||
logger.Noticef(format, args...)
|
logger.Noticef(format, args...)
|
||||||
addToBuffer("NOTICE", fmt.Sprintf(format, args...))
|
addToBuffer("NOTICE", fmt.Sprintf(format, args...))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Warning logs a warning message and adds it to the log buffer.
|
||||||
func Warning(args ...any) {
|
func Warning(args ...any) {
|
||||||
logger.Warning(args...)
|
logger.Warning(args...)
|
||||||
addToBuffer("WARNING", fmt.Sprint(args...))
|
addToBuffer("WARNING", fmt.Sprint(args...))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Warningf logs a formatted warning message and adds it to the log buffer.
|
||||||
func Warningf(format string, args ...any) {
|
func Warningf(format string, args ...any) {
|
||||||
logger.Warningf(format, args...)
|
logger.Warningf(format, args...)
|
||||||
addToBuffer("WARNING", fmt.Sprintf(format, args...))
|
addToBuffer("WARNING", fmt.Sprintf(format, args...))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Error logs an error message and adds it to the log buffer.
|
||||||
func Error(args ...any) {
|
func Error(args ...any) {
|
||||||
logger.Error(args...)
|
logger.Error(args...)
|
||||||
addToBuffer("ERROR", fmt.Sprint(args...))
|
addToBuffer("ERROR", fmt.Sprint(args...))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Errorf logs a formatted error message and adds it to the log buffer.
|
||||||
func Errorf(format string, args ...any) {
|
func Errorf(format string, args ...any) {
|
||||||
logger.Errorf(format, args...)
|
logger.Errorf(format, args...)
|
||||||
addToBuffer("ERROR", fmt.Sprintf(format, args...))
|
addToBuffer("ERROR", fmt.Sprintf(format, args...))
|
||||||
@@ -115,6 +132,7 @@ func addToBuffer(level string, newLog string) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetLogs retrieves up to c log entries from the buffer that are at or below the specified level.
|
||||||
func GetLogs(c int, level string) []string {
|
func GetLogs(c int, level string) []string {
|
||||||
var output []string
|
var output []string
|
||||||
logLevel, _ := logging.LogLevel(level)
|
logLevel, _ := logging.LogLevel(level)
|
||||||
|
|||||||
32
main.go
32
main.go
@@ -1,3 +1,5 @@
|
|||||||
|
// Package main is the entry point for the 3x-ui web panel application.
|
||||||
|
// It initializes the database, web server, and handles command-line operations for managing the panel.
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@@ -9,19 +11,20 @@ import (
|
|||||||
"syscall"
|
"syscall"
|
||||||
_ "unsafe"
|
_ "unsafe"
|
||||||
|
|
||||||
"x-ui/config"
|
"github.com/mhsanaei/3x-ui/v2/config"
|
||||||
"x-ui/database"
|
"github.com/mhsanaei/3x-ui/v2/database"
|
||||||
"x-ui/logger"
|
"github.com/mhsanaei/3x-ui/v2/logger"
|
||||||
"x-ui/sub"
|
"github.com/mhsanaei/3x-ui/v2/sub"
|
||||||
"x-ui/util/crypto"
|
"github.com/mhsanaei/3x-ui/v2/util/crypto"
|
||||||
"x-ui/web"
|
"github.com/mhsanaei/3x-ui/v2/web"
|
||||||
"x-ui/web/global"
|
"github.com/mhsanaei/3x-ui/v2/web/global"
|
||||||
"x-ui/web/service"
|
"github.com/mhsanaei/3x-ui/v2/web/service"
|
||||||
|
|
||||||
"github.com/joho/godotenv"
|
"github.com/joho/godotenv"
|
||||||
"github.com/op/go-logging"
|
"github.com/op/go-logging"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// runWebServer initializes and starts the web server for the 3x-ui panel.
|
||||||
func runWebServer() {
|
func runWebServer() {
|
||||||
log.Printf("Starting %v %v", config.GetName(), config.GetVersion())
|
log.Printf("Starting %v %v", config.GetName(), config.GetVersion())
|
||||||
|
|
||||||
@@ -32,7 +35,7 @@ func runWebServer() {
|
|||||||
logger.InitLogger(logging.INFO)
|
logger.InitLogger(logging.INFO)
|
||||||
case config.Notice:
|
case config.Notice:
|
||||||
logger.InitLogger(logging.NOTICE)
|
logger.InitLogger(logging.NOTICE)
|
||||||
case config.Warn:
|
case config.Warning:
|
||||||
logger.InitLogger(logging.WARNING)
|
logger.InitLogger(logging.WARNING)
|
||||||
case config.Error:
|
case config.Error:
|
||||||
logger.InitLogger(logging.ERROR)
|
logger.InitLogger(logging.ERROR)
|
||||||
@@ -111,6 +114,7 @@ func runWebServer() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// resetSetting resets all panel settings to their default values.
|
||||||
func resetSetting() {
|
func resetSetting() {
|
||||||
err := database.InitDB(config.GetDBPath())
|
err := database.InitDB(config.GetDBPath())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -127,6 +131,7 @@ func resetSetting() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// showSetting displays the current panel settings if show is true.
|
||||||
func showSetting(show bool) {
|
func showSetting(show bool) {
|
||||||
if show {
|
if show {
|
||||||
settingService := service.SettingService{}
|
settingService := service.SettingService{}
|
||||||
@@ -176,6 +181,7 @@ func showSetting(show bool) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// updateTgbotEnableSts enables or disables the Telegram bot notifications based on the status parameter.
|
||||||
func updateTgbotEnableSts(status bool) {
|
func updateTgbotEnableSts(status bool) {
|
||||||
settingService := service.SettingService{}
|
settingService := service.SettingService{}
|
||||||
currentTgSts, err := settingService.GetTgbotEnabled()
|
currentTgSts, err := settingService.GetTgbotEnabled()
|
||||||
@@ -195,6 +201,7 @@ func updateTgbotEnableSts(status bool) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// updateTgbotSetting updates Telegram bot settings including token, chat ID, and runtime schedule.
|
||||||
func updateTgbotSetting(tgBotToken string, tgBotChatid string, tgBotRuntime string) {
|
func updateTgbotSetting(tgBotToken string, tgBotChatid string, tgBotRuntime string) {
|
||||||
err := database.InitDB(config.GetDBPath())
|
err := database.InitDB(config.GetDBPath())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -232,6 +239,7 @@ func updateTgbotSetting(tgBotToken string, tgBotChatid string, tgBotRuntime stri
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// updateSetting updates various panel settings including port, credentials, base path, listen IP, and two-factor authentication.
|
||||||
func updateSetting(port int, username string, password string, webBasePath string, listenIP string, resetTwoFactor bool) {
|
func updateSetting(port int, username string, password string, webBasePath string, listenIP string, resetTwoFactor bool) {
|
||||||
err := database.InitDB(config.GetDBPath())
|
err := database.InitDB(config.GetDBPath())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -290,6 +298,7 @@ func updateSetting(port int, username string, password string, webBasePath strin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// updateCert updates the SSL certificate files for the panel.
|
||||||
func updateCert(publicKey string, privateKey string) {
|
func updateCert(publicKey string, privateKey string) {
|
||||||
err := database.InitDB(config.GetDBPath())
|
err := database.InitDB(config.GetDBPath())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -317,6 +326,7 @@ func updateCert(publicKey string, privateKey string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetCertificate displays the current SSL certificate settings if getCert is true.
|
||||||
func GetCertificate(getCert bool) {
|
func GetCertificate(getCert bool) {
|
||||||
if getCert {
|
if getCert {
|
||||||
settingService := service.SettingService{}
|
settingService := service.SettingService{}
|
||||||
@@ -334,6 +344,7 @@ func GetCertificate(getCert bool) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetListenIP displays the current panel listen IP address if getListen is true.
|
||||||
func GetListenIP(getListen bool) {
|
func GetListenIP(getListen bool) {
|
||||||
if getListen {
|
if getListen {
|
||||||
|
|
||||||
@@ -348,6 +359,7 @@ func GetListenIP(getListen bool) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// migrateDb performs database migration operations for the 3x-ui panel.
|
||||||
func migrateDb() {
|
func migrateDb() {
|
||||||
inboundService := service.InboundService{}
|
inboundService := service.InboundService{}
|
||||||
|
|
||||||
@@ -360,6 +372,8 @@ func migrateDb() {
|
|||||||
fmt.Println("Migration done!")
|
fmt.Println("Migration done!")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// main is the entry point of the 3x-ui application.
|
||||||
|
// It parses command-line arguments to run the web server, migrate database, or update settings.
|
||||||
func main() {
|
func main() {
|
||||||
if len(os.Args) < 2 {
|
if len(os.Args) < 2 {
|
||||||
runWebServer()
|
runWebServer()
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 6.1 KiB |
BIN
media/default-yellow.png
Normal file
BIN
media/default-yellow.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.7 KiB |
1
media/donation-button-black.svg
Normal file
1
media/donation-button-black.svg
Normal file
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 10 KiB |
@@ -13,7 +13,7 @@
|
|||||||
"inbounds": [
|
"inbounds": [
|
||||||
{
|
{
|
||||||
"port": 10808,
|
"port": 10808,
|
||||||
"protocol": "socks",
|
"protocol": "mixed",
|
||||||
"settings": {
|
"settings": {
|
||||||
"auth": "noauth",
|
"auth": "noauth",
|
||||||
"udp": true,
|
"udp": true,
|
||||||
@@ -28,7 +28,7 @@
|
|||||||
],
|
],
|
||||||
"enabled": true
|
"enabled": true
|
||||||
},
|
},
|
||||||
"tag": "socks"
|
"tag": "mixed"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"port": 10809,
|
"port": 10809,
|
||||||
|
|||||||
138
sub/sub.go
138
sub/sub.go
@@ -1,23 +1,47 @@
|
|||||||
|
// Package sub provides subscription server functionality for the 3x-ui panel,
|
||||||
|
// including HTTP/HTTPS servers for serving subscription links and JSON configurations.
|
||||||
package sub
|
package sub
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
|
"html/template"
|
||||||
"io"
|
"io"
|
||||||
|
"io/fs"
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"os"
|
||||||
|
"path/filepath"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"x-ui/config"
|
"github.com/mhsanaei/3x-ui/v2/logger"
|
||||||
"x-ui/logger"
|
"github.com/mhsanaei/3x-ui/v2/util/common"
|
||||||
"x-ui/util/common"
|
webpkg "github.com/mhsanaei/3x-ui/v2/web"
|
||||||
"x-ui/web/middleware"
|
"github.com/mhsanaei/3x-ui/v2/web/locale"
|
||||||
"x-ui/web/network"
|
"github.com/mhsanaei/3x-ui/v2/web/middleware"
|
||||||
"x-ui/web/service"
|
"github.com/mhsanaei/3x-ui/v2/web/network"
|
||||||
|
"github.com/mhsanaei/3x-ui/v2/web/service"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// setEmbeddedTemplates parses and sets embedded templates on the engine
|
||||||
|
func setEmbeddedTemplates(engine *gin.Engine) error {
|
||||||
|
t, err := template.New("").Funcs(engine.FuncMap).ParseFS(
|
||||||
|
webpkg.EmbeddedHTML(),
|
||||||
|
"html/common/page.html",
|
||||||
|
"html/component/aThemeSwitch.html",
|
||||||
|
"html/settings/panel/subscription/subpage.html",
|
||||||
|
)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
engine.SetHTMLTemplate(t)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Server represents the subscription server that serves subscription links and JSON configurations.
|
||||||
type Server struct {
|
type Server struct {
|
||||||
httpServer *http.Server
|
httpServer *http.Server
|
||||||
listener net.Listener
|
listener net.Listener
|
||||||
@@ -29,6 +53,7 @@ type Server struct {
|
|||||||
cancel context.CancelFunc
|
cancel context.CancelFunc
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NewServer creates a new subscription server instance with a cancellable context.
|
||||||
func NewServer() *Server {
|
func NewServer() *Server {
|
||||||
ctx, cancel := context.WithCancel(context.Background())
|
ctx, cancel := context.WithCancel(context.Background())
|
||||||
return &Server{
|
return &Server{
|
||||||
@@ -37,14 +62,13 @@ func NewServer() *Server {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// initRouter configures the subscription server's Gin engine, middleware,
|
||||||
|
// templates and static assets and returns the ready-to-use engine.
|
||||||
func (s *Server) initRouter() (*gin.Engine, error) {
|
func (s *Server) initRouter() (*gin.Engine, error) {
|
||||||
if config.IsDebug() {
|
// Always run in release mode for the subscription server
|
||||||
gin.SetMode(gin.DebugMode)
|
gin.DefaultWriter = io.Discard
|
||||||
} else {
|
gin.DefaultErrorWriter = io.Discard
|
||||||
gin.DefaultWriter = io.Discard
|
gin.SetMode(gin.ReleaseMode)
|
||||||
gin.DefaultErrorWriter = io.Discard
|
|
||||||
gin.SetMode(gin.ReleaseMode)
|
|
||||||
}
|
|
||||||
|
|
||||||
engine := gin.Default()
|
engine := gin.Default()
|
||||||
|
|
||||||
@@ -67,6 +91,17 @@ func (s *Server) initRouter() (*gin.Engine, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Determine if JSON subscription endpoint is enabled
|
||||||
|
subJsonEnable, err := s.settingService.GetSubJsonEnable()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set base_path based on LinksPath for template rendering
|
||||||
|
engine.Use(func(c *gin.Context) {
|
||||||
|
c.Set("base_path", LinksPath)
|
||||||
|
})
|
||||||
|
|
||||||
Encrypt, err := s.settingService.GetSubEncrypt()
|
Encrypt, err := s.settingService.GetSubEncrypt()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@@ -112,15 +147,88 @@ func (s *Server) initRouter() (*gin.Engine, error) {
|
|||||||
SubTitle = ""
|
SubTitle = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// set per-request localizer from headers/cookies
|
||||||
|
engine.Use(locale.LocalizerMiddleware())
|
||||||
|
|
||||||
|
// register i18n function similar to web server
|
||||||
|
i18nWebFunc := func(key string, params ...string) string {
|
||||||
|
return locale.I18n(locale.Web, key, params...)
|
||||||
|
}
|
||||||
|
engine.SetFuncMap(map[string]any{"i18n": i18nWebFunc})
|
||||||
|
|
||||||
|
// Templates: prefer embedded; fallback to disk if necessary
|
||||||
|
if err := setEmbeddedTemplates(engine); err != nil {
|
||||||
|
logger.Warning("sub: failed to parse embedded templates:", err)
|
||||||
|
if files, derr := s.getHtmlFiles(); derr == nil {
|
||||||
|
engine.LoadHTMLFiles(files...)
|
||||||
|
} else {
|
||||||
|
logger.Error("sub: no templates available (embedded parse and disk load failed)", err, derr)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Assets: use disk if present, fallback to embedded
|
||||||
|
// Serve under both root (/assets) and under the subscription path prefix (LinksPath + "assets")
|
||||||
|
// so reverse proxies with a URI prefix can load assets correctly.
|
||||||
|
// Determine LinksPath earlier to compute prefixed assets mount.
|
||||||
|
// Note: LinksPath always starts and ends with "/" (validated in settings).
|
||||||
|
var linksPathForAssets string
|
||||||
|
if LinksPath == "/" {
|
||||||
|
linksPathForAssets = "/assets"
|
||||||
|
} else {
|
||||||
|
// ensure single slash join
|
||||||
|
linksPathForAssets = strings.TrimRight(LinksPath, "/") + "/assets"
|
||||||
|
}
|
||||||
|
|
||||||
|
if _, err := os.Stat("web/assets"); err == nil {
|
||||||
|
engine.StaticFS("/assets", http.FS(os.DirFS("web/assets")))
|
||||||
|
if linksPathForAssets != "/assets" {
|
||||||
|
engine.StaticFS(linksPathForAssets, http.FS(os.DirFS("web/assets")))
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if subFS, err := fs.Sub(webpkg.EmbeddedAssets(), "assets"); err == nil {
|
||||||
|
engine.StaticFS("/assets", http.FS(subFS))
|
||||||
|
if linksPathForAssets != "/assets" {
|
||||||
|
engine.StaticFS(linksPathForAssets, http.FS(subFS))
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
logger.Error("sub: failed to mount embedded assets:", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
g := engine.Group("/")
|
g := engine.Group("/")
|
||||||
|
|
||||||
s.sub = NewSUBController(
|
s.sub = NewSUBController(
|
||||||
g, LinksPath, JsonPath, Encrypt, ShowInfo, RemarkModel, SubUpdates,
|
g, LinksPath, JsonPath, subJsonEnable, Encrypt, ShowInfo, RemarkModel, SubUpdates,
|
||||||
SubJsonFragment, SubJsonNoises, SubJsonMux, SubJsonRules, SubTitle)
|
SubJsonFragment, SubJsonNoises, SubJsonMux, SubJsonRules, SubTitle)
|
||||||
|
|
||||||
return engine, nil
|
return engine, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// getHtmlFiles loads templates from local folder (used in debug mode)
|
||||||
|
func (s *Server) getHtmlFiles() ([]string, error) {
|
||||||
|
dir, _ := os.Getwd()
|
||||||
|
files := []string{}
|
||||||
|
// common layout
|
||||||
|
common := filepath.Join(dir, "web", "html", "common", "page.html")
|
||||||
|
if _, err := os.Stat(common); err == nil {
|
||||||
|
files = append(files, common)
|
||||||
|
}
|
||||||
|
// components used
|
||||||
|
theme := filepath.Join(dir, "web", "html", "component", "aThemeSwitch.html")
|
||||||
|
if _, err := os.Stat(theme); err == nil {
|
||||||
|
files = append(files, theme)
|
||||||
|
}
|
||||||
|
// page itself
|
||||||
|
page := filepath.Join(dir, "web", "html", "subpage.html")
|
||||||
|
if _, err := os.Stat(page); err == nil {
|
||||||
|
files = append(files, page)
|
||||||
|
} else {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return files, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Start initializes and starts the subscription server with configured settings.
|
||||||
func (s *Server) Start() (err error) {
|
func (s *Server) Start() (err error) {
|
||||||
// This is an anonymous function, no function name
|
// This is an anonymous function, no function name
|
||||||
defer func() {
|
defer func() {
|
||||||
@@ -194,6 +302,7 @@ func (s *Server) Start() (err error) {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Stop gracefully shuts down the subscription server and closes the listener.
|
||||||
func (s *Server) Stop() error {
|
func (s *Server) Stop() error {
|
||||||
s.cancel()
|
s.cancel()
|
||||||
|
|
||||||
@@ -208,6 +317,7 @@ func (s *Server) Stop() error {
|
|||||||
return common.Combine(err1, err2)
|
return common.Combine(err1, err2)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetCtx returns the server's context for cancellation and deadline management.
|
||||||
func (s *Server) GetCtx() context.Context {
|
func (s *Server) GetCtx() context.Context {
|
||||||
return s.ctx
|
return s.ctx
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,16 +2,20 @@ package sub
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
"net"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/mhsanaei/3x-ui/v2/config"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// SUBController handles HTTP requests for subscription links and JSON configurations.
|
||||||
type SUBController struct {
|
type SUBController struct {
|
||||||
subTitle string
|
subTitle string
|
||||||
subPath string
|
subPath string
|
||||||
subJsonPath string
|
subJsonPath string
|
||||||
|
jsonEnabled bool
|
||||||
subEncrypt bool
|
subEncrypt bool
|
||||||
updateInterval string
|
updateInterval string
|
||||||
|
|
||||||
@@ -19,10 +23,12 @@ type SUBController struct {
|
|||||||
subJsonService *SubJsonService
|
subJsonService *SubJsonService
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NewSUBController creates a new subscription controller with the given configuration.
|
||||||
func NewSUBController(
|
func NewSUBController(
|
||||||
g *gin.RouterGroup,
|
g *gin.RouterGroup,
|
||||||
subPath string,
|
subPath string,
|
||||||
jsonPath string,
|
jsonPath string,
|
||||||
|
jsonEnabled bool,
|
||||||
encrypt bool,
|
encrypt bool,
|
||||||
showInfo bool,
|
showInfo bool,
|
||||||
rModel string,
|
rModel string,
|
||||||
@@ -38,6 +44,7 @@ func NewSUBController(
|
|||||||
subTitle: subTitle,
|
subTitle: subTitle,
|
||||||
subPath: subPath,
|
subPath: subPath,
|
||||||
subJsonPath: jsonPath,
|
subJsonPath: jsonPath,
|
||||||
|
jsonEnabled: jsonEnabled,
|
||||||
subEncrypt: encrypt,
|
subEncrypt: encrypt,
|
||||||
updateInterval: update,
|
updateInterval: update,
|
||||||
|
|
||||||
@@ -48,32 +55,22 @@ func NewSUBController(
|
|||||||
return a
|
return a
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// initRouter registers HTTP routes for subscription links and JSON endpoints
|
||||||
|
// on the provided router group.
|
||||||
func (a *SUBController) initRouter(g *gin.RouterGroup) {
|
func (a *SUBController) initRouter(g *gin.RouterGroup) {
|
||||||
gLink := g.Group(a.subPath)
|
gLink := g.Group(a.subPath)
|
||||||
gJson := g.Group(a.subJsonPath)
|
|
||||||
|
|
||||||
gLink.GET(":subid", a.subs)
|
gLink.GET(":subid", a.subs)
|
||||||
|
if a.jsonEnabled {
|
||||||
gJson.GET(":subid", a.subJsons)
|
gJson := g.Group(a.subJsonPath)
|
||||||
|
gJson.GET(":subid", a.subJsons)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// subs handles HTTP requests for subscription links, returning either HTML page or base64-encoded subscription data.
|
||||||
func (a *SUBController) subs(c *gin.Context) {
|
func (a *SUBController) subs(c *gin.Context) {
|
||||||
subId := c.Param("subid")
|
subId := c.Param("subid")
|
||||||
var host string
|
scheme, host, hostWithPort, hostHeader := a.subService.ResolveRequest(c)
|
||||||
if h, err := getHostFromXFH(c.GetHeader("X-Forwarded-Host")); err == nil {
|
subs, lastOnline, traffic, err := a.subService.GetSubs(subId, host)
|
||||||
host = h
|
|
||||||
}
|
|
||||||
if host == "" {
|
|
||||||
host = c.GetHeader("X-Real-IP")
|
|
||||||
}
|
|
||||||
if host == "" {
|
|
||||||
var err error
|
|
||||||
host, _, err = net.SplitHostPort(c.Request.Host)
|
|
||||||
if err != nil {
|
|
||||||
host = c.Request.Host
|
|
||||||
}
|
|
||||||
}
|
|
||||||
subs, header, err := a.subService.GetSubs(subId, host)
|
|
||||||
if err != nil || len(subs) == 0 {
|
if err != nil || len(subs) == 0 {
|
||||||
c.String(400, "Error!")
|
c.String(400, "Error!")
|
||||||
} else {
|
} else {
|
||||||
@@ -82,10 +79,42 @@ func (a *SUBController) subs(c *gin.Context) {
|
|||||||
result += sub + "\n"
|
result += sub + "\n"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If the request expects HTML (e.g., browser) or explicitly asked (?html=1 or ?view=html), render the info page here
|
||||||
|
accept := c.GetHeader("Accept")
|
||||||
|
if strings.Contains(strings.ToLower(accept), "text/html") || c.Query("html") == "1" || strings.EqualFold(c.Query("view"), "html") {
|
||||||
|
// Build page data in service
|
||||||
|
subURL, subJsonURL := a.subService.BuildURLs(scheme, hostWithPort, a.subPath, a.subJsonPath, subId)
|
||||||
|
if !a.jsonEnabled {
|
||||||
|
subJsonURL = ""
|
||||||
|
}
|
||||||
|
page := a.subService.BuildPageData(subId, hostHeader, traffic, lastOnline, subs, subURL, subJsonURL)
|
||||||
|
c.HTML(200, "subpage.html", gin.H{
|
||||||
|
"title": "subscription.title",
|
||||||
|
"cur_ver": config.GetVersion(),
|
||||||
|
"host": page.Host,
|
||||||
|
"base_path": page.BasePath,
|
||||||
|
"sId": page.SId,
|
||||||
|
"download": page.Download,
|
||||||
|
"upload": page.Upload,
|
||||||
|
"total": page.Total,
|
||||||
|
"used": page.Used,
|
||||||
|
"remained": page.Remained,
|
||||||
|
"expire": page.Expire,
|
||||||
|
"lastOnline": page.LastOnline,
|
||||||
|
"datepicker": page.Datepicker,
|
||||||
|
"downloadByte": page.DownloadByte,
|
||||||
|
"uploadByte": page.UploadByte,
|
||||||
|
"totalByte": page.TotalByte,
|
||||||
|
"subUrl": page.SubUrl,
|
||||||
|
"subJsonUrl": page.SubJsonUrl,
|
||||||
|
"result": page.Result,
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// Add headers
|
// Add headers
|
||||||
c.Writer.Header().Set("Subscription-Userinfo", header)
|
header := fmt.Sprintf("upload=%d; download=%d; total=%d; expire=%d", traffic.Up, traffic.Down, traffic.Total, traffic.ExpiryTime/1000)
|
||||||
c.Writer.Header().Set("Profile-Update-Interval", a.updateInterval)
|
a.ApplyCommonHeaders(c, header, a.updateInterval, a.subTitle)
|
||||||
c.Writer.Header().Set("Profile-Title", "base64:" + base64.StdEncoding.EncodeToString([]byte(a.subTitle)))
|
|
||||||
|
|
||||||
if a.subEncrypt {
|
if a.subEncrypt {
|
||||||
c.String(200, base64.StdEncoding.EncodeToString([]byte(result)))
|
c.String(200, base64.StdEncoding.EncodeToString([]byte(result)))
|
||||||
@@ -95,43 +124,25 @@ func (a *SUBController) subs(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// subJsons handles HTTP requests for JSON subscription configurations.
|
||||||
func (a *SUBController) subJsons(c *gin.Context) {
|
func (a *SUBController) subJsons(c *gin.Context) {
|
||||||
subId := c.Param("subid")
|
subId := c.Param("subid")
|
||||||
var host string
|
_, host, _, _ := a.subService.ResolveRequest(c)
|
||||||
if h, err := getHostFromXFH(c.GetHeader("X-Forwarded-Host")); err == nil {
|
|
||||||
host = h
|
|
||||||
}
|
|
||||||
if host == "" {
|
|
||||||
host = c.GetHeader("X-Real-IP")
|
|
||||||
}
|
|
||||||
if host == "" {
|
|
||||||
var err error
|
|
||||||
host, _, err = net.SplitHostPort(c.Request.Host)
|
|
||||||
if err != nil {
|
|
||||||
host = c.Request.Host
|
|
||||||
}
|
|
||||||
}
|
|
||||||
jsonSub, header, err := a.subJsonService.GetJson(subId, host)
|
jsonSub, header, err := a.subJsonService.GetJson(subId, host)
|
||||||
if err != nil || len(jsonSub) == 0 {
|
if err != nil || len(jsonSub) == 0 {
|
||||||
c.String(400, "Error!")
|
c.String(400, "Error!")
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// Add headers
|
// Add headers
|
||||||
c.Writer.Header().Set("Subscription-Userinfo", header)
|
a.ApplyCommonHeaders(c, header, a.updateInterval, a.subTitle)
|
||||||
c.Writer.Header().Set("Profile-Update-Interval", a.updateInterval)
|
|
||||||
c.Writer.Header().Set("Profile-Title", "base64:" + base64.StdEncoding.EncodeToString([]byte(a.subTitle)))
|
|
||||||
|
|
||||||
c.String(200, jsonSub)
|
c.String(200, jsonSub)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func getHostFromXFH(s string) (string, error) {
|
// ApplyCommonHeaders sets common HTTP headers for subscription responses including user info, update interval, and profile title.
|
||||||
if strings.Contains(s, ":") {
|
func (a *SUBController) ApplyCommonHeaders(c *gin.Context, header, updateInterval, profileTitle string) {
|
||||||
realHost, _, err := net.SplitHostPort(s)
|
c.Writer.Header().Set("Subscription-Userinfo", header)
|
||||||
if err != nil {
|
c.Writer.Header().Set("Profile-Update-Interval", updateInterval)
|
||||||
return "", err
|
c.Writer.Header().Set("Profile-Title", "base64:"+base64.StdEncoding.EncodeToString([]byte(profileTitle)))
|
||||||
}
|
|
||||||
return realHost, nil
|
|
||||||
}
|
|
||||||
return s, nil
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,17 +6,18 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"x-ui/database/model"
|
"github.com/mhsanaei/3x-ui/v2/database/model"
|
||||||
"x-ui/logger"
|
"github.com/mhsanaei/3x-ui/v2/logger"
|
||||||
"x-ui/util/json_util"
|
"github.com/mhsanaei/3x-ui/v2/util/json_util"
|
||||||
"x-ui/util/random"
|
"github.com/mhsanaei/3x-ui/v2/util/random"
|
||||||
"x-ui/web/service"
|
"github.com/mhsanaei/3x-ui/v2/web/service"
|
||||||
"x-ui/xray"
|
"github.com/mhsanaei/3x-ui/v2/xray"
|
||||||
)
|
)
|
||||||
|
|
||||||
//go:embed default.json
|
//go:embed default.json
|
||||||
var defaultJson string
|
var defaultJson string
|
||||||
|
|
||||||
|
// SubJsonService handles JSON subscription configuration generation and management.
|
||||||
type SubJsonService struct {
|
type SubJsonService struct {
|
||||||
configJson map[string]any
|
configJson map[string]any
|
||||||
defaultOutbounds []json_util.RawMessage
|
defaultOutbounds []json_util.RawMessage
|
||||||
@@ -28,6 +29,7 @@ type SubJsonService struct {
|
|||||||
SubService *SubService
|
SubService *SubService
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NewSubJsonService creates a new JSON subscription service with the given configuration.
|
||||||
func NewSubJsonService(fragment string, noises string, mux string, rules string, subService *SubService) *SubJsonService {
|
func NewSubJsonService(fragment string, noises string, mux string, rules string, subService *SubService) *SubJsonService {
|
||||||
var configJson map[string]any
|
var configJson map[string]any
|
||||||
var defaultOutbounds []json_util.RawMessage
|
var defaultOutbounds []json_util.RawMessage
|
||||||
@@ -67,6 +69,7 @@ func NewSubJsonService(fragment string, noises string, mux string, rules string,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetJson generates a JSON subscription configuration for the given subscription ID and host.
|
||||||
func (s *SubJsonService) GetJson(subId string, host string) (string, string, error) {
|
func (s *SubJsonService) GetJson(subId string, host string) (string, string, error) {
|
||||||
inbounds, err := s.SubService.getInboundsBySubId(subId)
|
inbounds, err := s.SubService.getInboundsBySubId(subId)
|
||||||
if err != nil || len(inbounds) == 0 {
|
if err != nil || len(inbounds) == 0 {
|
||||||
@@ -171,12 +174,12 @@ func (s *SubJsonService) getConfig(inbound *model.Inbound, client model.Client,
|
|||||||
case "tls":
|
case "tls":
|
||||||
if newStream["security"] != "tls" {
|
if newStream["security"] != "tls" {
|
||||||
newStream["security"] = "tls"
|
newStream["security"] = "tls"
|
||||||
newStream["tslSettings"] = map[string]any{}
|
newStream["tlsSettings"] = map[string]any{}
|
||||||
}
|
}
|
||||||
case "none":
|
case "none":
|
||||||
if newStream["security"] != "none" {
|
if newStream["security"] != "none" {
|
||||||
newStream["security"] = "none"
|
newStream["security"] = "none"
|
||||||
delete(newStream, "tslSettings")
|
delete(newStream, "tlsSettings")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
streamSettings, _ := json.MarshalIndent(newStream, "", " ")
|
streamSettings, _ := json.MarshalIndent(newStream, "", " ")
|
||||||
@@ -184,8 +187,10 @@ func (s *SubJsonService) getConfig(inbound *model.Inbound, client model.Client,
|
|||||||
var newOutbounds []json_util.RawMessage
|
var newOutbounds []json_util.RawMessage
|
||||||
|
|
||||||
switch inbound.Protocol {
|
switch inbound.Protocol {
|
||||||
case "vmess", "vless":
|
case "vmess":
|
||||||
newOutbounds = append(newOutbounds, s.genVnext(inbound, streamSettings, client))
|
newOutbounds = append(newOutbounds, s.genVnext(inbound, streamSettings, client))
|
||||||
|
case "vless":
|
||||||
|
newOutbounds = append(newOutbounds, s.genVless(inbound, streamSettings, client))
|
||||||
case "trojan", "shadowsocks":
|
case "trojan", "shadowsocks":
|
||||||
newOutbounds = append(newOutbounds, s.genServer(inbound, streamSettings, client))
|
newOutbounds = append(newOutbounds, s.genServer(inbound, streamSettings, client))
|
||||||
}
|
}
|
||||||
@@ -209,9 +214,10 @@ func (s *SubJsonService) streamData(stream string) map[string]any {
|
|||||||
var streamSettings map[string]any
|
var streamSettings map[string]any
|
||||||
json.Unmarshal([]byte(stream), &streamSettings)
|
json.Unmarshal([]byte(stream), &streamSettings)
|
||||||
security, _ := streamSettings["security"].(string)
|
security, _ := streamSettings["security"].(string)
|
||||||
if security == "tls" {
|
switch security {
|
||||||
|
case "tls":
|
||||||
streamSettings["tlsSettings"] = s.tlsData(streamSettings["tlsSettings"].(map[string]any))
|
streamSettings["tlsSettings"] = s.tlsData(streamSettings["tlsSettings"].(map[string]any))
|
||||||
} else if security == "reality" {
|
case "reality":
|
||||||
streamSettings["realitySettings"] = s.realityData(streamSettings["realitySettings"].(map[string]any))
|
streamSettings["realitySettings"] = s.realityData(streamSettings["realitySettings"].(map[string]any))
|
||||||
}
|
}
|
||||||
delete(streamSettings, "sockopt")
|
delete(streamSettings, "sockopt")
|
||||||
@@ -263,6 +269,7 @@ func (s *SubJsonService) realityData(rData map[string]any) map[string]any {
|
|||||||
rltyData["show"] = false
|
rltyData["show"] = false
|
||||||
rltyData["publicKey"] = rltyClientSettings["publicKey"]
|
rltyData["publicKey"] = rltyClientSettings["publicKey"]
|
||||||
rltyData["fingerprint"] = rltyClientSettings["fingerprint"]
|
rltyData["fingerprint"] = rltyClientSettings["fingerprint"]
|
||||||
|
rltyData["mldsa65Verify"] = rltyClientSettings["mldsa65Verify"]
|
||||||
|
|
||||||
// Set random data
|
// Set random data
|
||||||
rltyData["spiderX"] = "/" + random.Seq(15)
|
rltyData["spiderX"] = "/" + random.Seq(15)
|
||||||
@@ -287,15 +294,8 @@ func (s *SubJsonService) genVnext(inbound *model.Inbound, streamSettings json_ut
|
|||||||
usersData := make([]UserVnext, 1)
|
usersData := make([]UserVnext, 1)
|
||||||
|
|
||||||
usersData[0].ID = client.ID
|
usersData[0].ID = client.ID
|
||||||
usersData[0].Level = 8
|
usersData[0].Email = client.Email
|
||||||
if inbound.Protocol == model.VMESS {
|
usersData[0].Security = client.Security
|
||||||
usersData[0].Security = client.Security
|
|
||||||
}
|
|
||||||
if inbound.Protocol == model.VLESS {
|
|
||||||
usersData[0].Flow = client.Flow
|
|
||||||
usersData[0].Encryption = "none"
|
|
||||||
}
|
|
||||||
|
|
||||||
vnextData := make([]VnextSetting, 1)
|
vnextData := make([]VnextSetting, 1)
|
||||||
vnextData[0] = VnextSetting{
|
vnextData[0] = VnextSetting{
|
||||||
Address: inbound.Listen,
|
Address: inbound.Listen,
|
||||||
@@ -309,14 +309,42 @@ func (s *SubJsonService) genVnext(inbound *model.Inbound, streamSettings json_ut
|
|||||||
outbound.Mux = json_util.RawMessage(s.mux)
|
outbound.Mux = json_util.RawMessage(s.mux)
|
||||||
}
|
}
|
||||||
outbound.StreamSettings = streamSettings
|
outbound.StreamSettings = streamSettings
|
||||||
outbound.Settings = OutboundSettings{
|
outbound.Settings = map[string]any{
|
||||||
Vnext: vnextData,
|
"vnext": vnextData,
|
||||||
}
|
}
|
||||||
|
|
||||||
result, _ := json.MarshalIndent(outbound, "", " ")
|
result, _ := json.MarshalIndent(outbound, "", " ")
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *SubJsonService) genVless(inbound *model.Inbound, streamSettings json_util.RawMessage, client model.Client) json_util.RawMessage {
|
||||||
|
outbound := Outbound{}
|
||||||
|
outbound.Protocol = string(inbound.Protocol)
|
||||||
|
outbound.Tag = "proxy"
|
||||||
|
if s.mux != "" {
|
||||||
|
outbound.Mux = json_util.RawMessage(s.mux)
|
||||||
|
}
|
||||||
|
outbound.StreamSettings = streamSettings
|
||||||
|
settings := make(map[string]any)
|
||||||
|
settings["address"] = inbound.Listen
|
||||||
|
settings["port"] = inbound.Port
|
||||||
|
settings["id"] = client.ID
|
||||||
|
if client.Flow != "" {
|
||||||
|
settings["flow"] = client.Flow
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add encryption for VLESS outbound from inbound settings
|
||||||
|
var inboundSettings map[string]any
|
||||||
|
json.Unmarshal([]byte(inbound.Settings), &inboundSettings)
|
||||||
|
if encryption, ok := inboundSettings["encryption"].(string); ok {
|
||||||
|
settings["encryption"] = encryption
|
||||||
|
}
|
||||||
|
|
||||||
|
outbound.Settings = settings
|
||||||
|
result, _ := json.MarshalIndent(outbound, "", " ")
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
func (s *SubJsonService) genServer(inbound *model.Inbound, streamSettings json_util.RawMessage, client model.Client) json_util.RawMessage {
|
func (s *SubJsonService) genServer(inbound *model.Inbound, streamSettings json_util.RawMessage, client model.Client) json_util.RawMessage {
|
||||||
outbound := Outbound{}
|
outbound := Outbound{}
|
||||||
|
|
||||||
@@ -348,8 +376,8 @@ func (s *SubJsonService) genServer(inbound *model.Inbound, streamSettings json_u
|
|||||||
outbound.Mux = json_util.RawMessage(s.mux)
|
outbound.Mux = json_util.RawMessage(s.mux)
|
||||||
}
|
}
|
||||||
outbound.StreamSettings = streamSettings
|
outbound.StreamSettings = streamSettings
|
||||||
outbound.Settings = OutboundSettings{
|
outbound.Settings = map[string]any{
|
||||||
Servers: serverData,
|
"servers": serverData,
|
||||||
}
|
}
|
||||||
|
|
||||||
result, _ := json.MarshalIndent(outbound, "", " ")
|
result, _ := json.MarshalIndent(outbound, "", " ")
|
||||||
@@ -361,13 +389,7 @@ type Outbound struct {
|
|||||||
Tag string `json:"tag"`
|
Tag string `json:"tag"`
|
||||||
StreamSettings json_util.RawMessage `json:"streamSettings"`
|
StreamSettings json_util.RawMessage `json:"streamSettings"`
|
||||||
Mux json_util.RawMessage `json:"mux,omitempty"`
|
Mux json_util.RawMessage `json:"mux,omitempty"`
|
||||||
ProxySettings map[string]any `json:"proxySettings,omitempty"`
|
Settings map[string]any `json:"settings,omitempty"`
|
||||||
Settings OutboundSettings `json:"settings,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type OutboundSettings struct {
|
|
||||||
Vnext []VnextSetting `json:"vnext,omitempty"`
|
|
||||||
Servers []ServerSetting `json:"servers,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type VnextSetting struct {
|
type VnextSetting struct {
|
||||||
@@ -377,11 +399,9 @@ type VnextSetting struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type UserVnext struct {
|
type UserVnext struct {
|
||||||
Encryption string `json:"encryption,omitempty"`
|
ID string `json:"id"`
|
||||||
Flow string `json:"flow,omitempty"`
|
Email string `json:"email,omitempty"`
|
||||||
ID string `json:"id"`
|
Security string `json:"security,omitempty"`
|
||||||
Security string `json:"security,omitempty"`
|
|
||||||
Level int `json:"level"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type ServerSetting struct {
|
type ServerSetting struct {
|
||||||
|
|||||||
@@ -3,21 +3,24 @@ package sub
|
|||||||
import (
|
import (
|
||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"net"
|
||||||
"net/url"
|
"net/url"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"x-ui/database"
|
"github.com/gin-gonic/gin"
|
||||||
"x-ui/database/model"
|
|
||||||
"x-ui/logger"
|
|
||||||
"x-ui/util/common"
|
|
||||||
"x-ui/util/random"
|
|
||||||
"x-ui/web/service"
|
|
||||||
"x-ui/xray"
|
|
||||||
|
|
||||||
"github.com/goccy/go-json"
|
"github.com/goccy/go-json"
|
||||||
|
|
||||||
|
"github.com/mhsanaei/3x-ui/v2/database"
|
||||||
|
"github.com/mhsanaei/3x-ui/v2/database/model"
|
||||||
|
"github.com/mhsanaei/3x-ui/v2/logger"
|
||||||
|
"github.com/mhsanaei/3x-ui/v2/util/common"
|
||||||
|
"github.com/mhsanaei/3x-ui/v2/util/random"
|
||||||
|
"github.com/mhsanaei/3x-ui/v2/web/service"
|
||||||
|
"github.com/mhsanaei/3x-ui/v2/xray"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// SubService provides business logic for generating subscription links and managing subscription data.
|
||||||
type SubService struct {
|
type SubService struct {
|
||||||
address string
|
address string
|
||||||
showInfo bool
|
showInfo bool
|
||||||
@@ -27,6 +30,7 @@ type SubService struct {
|
|||||||
settingService service.SettingService
|
settingService service.SettingService
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NewSubService creates a new subscription service with the given configuration.
|
||||||
func NewSubService(showInfo bool, remarkModel string) *SubService {
|
func NewSubService(showInfo bool, remarkModel string) *SubService {
|
||||||
return &SubService{
|
return &SubService{
|
||||||
showInfo: showInfo,
|
showInfo: showInfo,
|
||||||
@@ -34,19 +38,20 @@ func NewSubService(showInfo bool, remarkModel string) *SubService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *SubService) GetSubs(subId string, host string) ([]string, string, error) {
|
// GetSubs retrieves subscription links for a given subscription ID and host.
|
||||||
|
func (s *SubService) GetSubs(subId string, host string) ([]string, int64, xray.ClientTraffic, error) {
|
||||||
s.address = host
|
s.address = host
|
||||||
var result []string
|
var result []string
|
||||||
var header string
|
|
||||||
var traffic xray.ClientTraffic
|
var traffic xray.ClientTraffic
|
||||||
|
var lastOnline int64
|
||||||
var clientTraffics []xray.ClientTraffic
|
var clientTraffics []xray.ClientTraffic
|
||||||
inbounds, err := s.getInboundsBySubId(subId)
|
inbounds, err := s.getInboundsBySubId(subId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, "", err
|
return nil, 0, traffic, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(inbounds) == 0 {
|
if len(inbounds) == 0 {
|
||||||
return nil, "", common.NewError("No inbounds found with ", subId)
|
return nil, 0, traffic, common.NewError("No inbounds found with ", subId)
|
||||||
}
|
}
|
||||||
|
|
||||||
s.datepicker, err = s.settingService.GetDatepicker()
|
s.datepicker, err = s.settingService.GetDatepicker()
|
||||||
@@ -73,7 +78,11 @@ func (s *SubService) GetSubs(subId string, host string) ([]string, string, error
|
|||||||
if client.Enable && client.SubID == subId {
|
if client.Enable && client.SubID == subId {
|
||||||
link := s.getLink(inbound, client.Email)
|
link := s.getLink(inbound, client.Email)
|
||||||
result = append(result, link)
|
result = append(result, link)
|
||||||
clientTraffics = append(clientTraffics, s.getClientTraffics(inbound.ClientStats, client.Email))
|
ct := s.getClientTraffics(inbound.ClientStats, client.Email)
|
||||||
|
clientTraffics = append(clientTraffics, ct)
|
||||||
|
if ct.LastOnline > lastOnline {
|
||||||
|
lastOnline = ct.LastOnline
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -100,8 +109,7 @@ func (s *SubService) GetSubs(subId string, host string) ([]string, string, error
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
header = fmt.Sprintf("upload=%d; download=%d; total=%d; expire=%d", traffic.Up, traffic.Down, traffic.Total, traffic.ExpiryTime/1000)
|
return result, lastOnline, traffic, nil
|
||||||
return result, header, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *SubService) getInboundsBySubId(subId string) ([]*model.Inbound, error) {
|
func (s *SubService) getInboundsBySubId(subId string) ([]*model.Inbound, error) {
|
||||||
@@ -329,6 +337,13 @@ func (s *SubService) genVlessLink(inbound *model.Inbound, email string) string {
|
|||||||
params := make(map[string]string)
|
params := make(map[string]string)
|
||||||
params["type"] = streamNetwork
|
params["type"] = streamNetwork
|
||||||
|
|
||||||
|
// Add encryption parameter for VLESS from inbound settings
|
||||||
|
var settings map[string]any
|
||||||
|
json.Unmarshal([]byte(inbound.Settings), &settings)
|
||||||
|
if encryption, ok := settings["encryption"].(string); ok {
|
||||||
|
params["encryption"] = encryption
|
||||||
|
}
|
||||||
|
|
||||||
switch streamNetwork {
|
switch streamNetwork {
|
||||||
case "tcp":
|
case "tcp":
|
||||||
tcp, _ := stream["tcpSettings"].(map[string]any)
|
tcp, _ := stream["tcpSettings"].(map[string]any)
|
||||||
@@ -437,6 +452,11 @@ func (s *SubService) genVlessLink(inbound *model.Inbound, email string) string {
|
|||||||
params["fp"] = fp
|
params["fp"] = fp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if pqvValue, ok := searchKey(realitySettings, "mldsa65Verify"); ok {
|
||||||
|
if pqv, ok := pqvValue.(string); ok && len(pqv) > 0 {
|
||||||
|
params["pqv"] = pqv
|
||||||
|
}
|
||||||
|
}
|
||||||
params["spx"] = "/" + random.Seq(15)
|
params["spx"] = "/" + random.Seq(15)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -627,6 +647,11 @@ func (s *SubService) genTrojanLink(inbound *model.Inbound, email string) string
|
|||||||
params["fp"] = fp
|
params["fp"] = fp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if pqvValue, ok := searchKey(realitySettings, "mldsa65Verify"); ok {
|
||||||
|
if pqv, ok := pqvValue.(string); ok && len(pqv) > 0 {
|
||||||
|
params["pqv"] = pqv
|
||||||
|
}
|
||||||
|
}
|
||||||
params["spx"] = "/" + random.Seq(15)
|
params["spx"] = "/" + random.Seq(15)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -985,3 +1010,189 @@ func searchHost(headers any) string {
|
|||||||
|
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PageData is a view model for subpage.html
|
||||||
|
// PageData contains data for rendering the subscription information page.
|
||||||
|
type PageData struct {
|
||||||
|
Host string
|
||||||
|
BasePath string
|
||||||
|
SId string
|
||||||
|
Download string
|
||||||
|
Upload string
|
||||||
|
Total string
|
||||||
|
Used string
|
||||||
|
Remained string
|
||||||
|
Expire int64
|
||||||
|
LastOnline int64
|
||||||
|
Datepicker string
|
||||||
|
DownloadByte int64
|
||||||
|
UploadByte int64
|
||||||
|
TotalByte int64
|
||||||
|
SubUrl string
|
||||||
|
SubJsonUrl string
|
||||||
|
Result []string
|
||||||
|
}
|
||||||
|
|
||||||
|
// ResolveRequest extracts scheme and host info from request/headers consistently.
|
||||||
|
// ResolveRequest extracts scheme, host, and header information from an HTTP request.
|
||||||
|
func (s *SubService) ResolveRequest(c *gin.Context) (scheme string, host string, hostWithPort string, hostHeader string) {
|
||||||
|
// scheme
|
||||||
|
scheme = "http"
|
||||||
|
if c.Request.TLS != nil || strings.EqualFold(c.GetHeader("X-Forwarded-Proto"), "https") {
|
||||||
|
scheme = "https"
|
||||||
|
}
|
||||||
|
|
||||||
|
// base host (no port)
|
||||||
|
if h, err := getHostFromXFH(c.GetHeader("X-Forwarded-Host")); err == nil && h != "" {
|
||||||
|
host = h
|
||||||
|
}
|
||||||
|
if host == "" {
|
||||||
|
host = c.GetHeader("X-Real-IP")
|
||||||
|
}
|
||||||
|
if host == "" {
|
||||||
|
var err error
|
||||||
|
host, _, err = net.SplitHostPort(c.Request.Host)
|
||||||
|
if err != nil {
|
||||||
|
host = c.Request.Host
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// host:port for URLs
|
||||||
|
hostWithPort = c.GetHeader("X-Forwarded-Host")
|
||||||
|
if hostWithPort == "" {
|
||||||
|
hostWithPort = c.Request.Host
|
||||||
|
}
|
||||||
|
if hostWithPort == "" {
|
||||||
|
hostWithPort = host
|
||||||
|
}
|
||||||
|
|
||||||
|
// header display host
|
||||||
|
hostHeader = c.GetHeader("X-Forwarded-Host")
|
||||||
|
if hostHeader == "" {
|
||||||
|
hostHeader = c.GetHeader("X-Real-IP")
|
||||||
|
}
|
||||||
|
if hostHeader == "" {
|
||||||
|
hostHeader = host
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// BuildURLs constructs absolute subscription and JSON subscription URLs for a given subscription ID.
|
||||||
|
// It prioritizes configured URIs, then individual settings, and finally falls back to request-derived components.
|
||||||
|
func (s *SubService) BuildURLs(scheme, hostWithPort, subPath, subJsonPath, subId string) (subURL, subJsonURL string) {
|
||||||
|
// Input validation
|
||||||
|
if subId == "" {
|
||||||
|
return "", ""
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get configured URIs first (highest priority)
|
||||||
|
configuredSubURI, _ := s.settingService.GetSubURI()
|
||||||
|
configuredSubJsonURI, _ := s.settingService.GetSubJsonURI()
|
||||||
|
|
||||||
|
// Determine base scheme and host (cached to avoid duplicate calls)
|
||||||
|
var baseScheme, baseHostWithPort string
|
||||||
|
if configuredSubURI == "" || configuredSubJsonURI == "" {
|
||||||
|
baseScheme, baseHostWithPort = s.getBaseSchemeAndHost(scheme, hostWithPort)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Build subscription URL
|
||||||
|
subURL = s.buildSingleURL(configuredSubURI, baseScheme, baseHostWithPort, subPath, subId)
|
||||||
|
|
||||||
|
// Build JSON subscription URL
|
||||||
|
subJsonURL = s.buildSingleURL(configuredSubJsonURI, baseScheme, baseHostWithPort, subJsonPath, subId)
|
||||||
|
|
||||||
|
return subURL, subJsonURL
|
||||||
|
}
|
||||||
|
|
||||||
|
// getBaseSchemeAndHost determines the base scheme and host from settings or falls back to request values
|
||||||
|
func (s *SubService) getBaseSchemeAndHost(requestScheme, requestHostWithPort string) (string, string) {
|
||||||
|
subDomain, err := s.settingService.GetSubDomain()
|
||||||
|
if err != nil || subDomain == "" {
|
||||||
|
return requestScheme, requestHostWithPort
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get port and TLS settings
|
||||||
|
subPort, _ := s.settingService.GetSubPort()
|
||||||
|
subKeyFile, _ := s.settingService.GetSubKeyFile()
|
||||||
|
subCertFile, _ := s.settingService.GetSubCertFile()
|
||||||
|
|
||||||
|
// Determine scheme from TLS configuration
|
||||||
|
scheme := "http"
|
||||||
|
if subKeyFile != "" && subCertFile != "" {
|
||||||
|
scheme = "https"
|
||||||
|
}
|
||||||
|
|
||||||
|
// Build host:port, always include port for clarity
|
||||||
|
hostWithPort := fmt.Sprintf("%s:%d", subDomain, subPort)
|
||||||
|
|
||||||
|
return scheme, hostWithPort
|
||||||
|
}
|
||||||
|
|
||||||
|
// buildSingleURL constructs a single URL using configured URI or base components
|
||||||
|
func (s *SubService) buildSingleURL(configuredURI, baseScheme, baseHostWithPort, basePath, subId string) string {
|
||||||
|
if configuredURI != "" {
|
||||||
|
return s.joinPathWithID(configuredURI, subId)
|
||||||
|
}
|
||||||
|
|
||||||
|
baseURL := fmt.Sprintf("%s://%s", baseScheme, baseHostWithPort)
|
||||||
|
return s.joinPathWithID(baseURL+basePath, subId)
|
||||||
|
}
|
||||||
|
|
||||||
|
// joinPathWithID safely joins a base path with a subscription ID
|
||||||
|
func (s *SubService) joinPathWithID(basePath, subId string) string {
|
||||||
|
if strings.HasSuffix(basePath, "/") {
|
||||||
|
return basePath + subId
|
||||||
|
}
|
||||||
|
return basePath + "/" + subId
|
||||||
|
}
|
||||||
|
|
||||||
|
// BuildPageData parses header and prepares the template view model.
|
||||||
|
// BuildPageData constructs page data for rendering the subscription information page.
|
||||||
|
func (s *SubService) BuildPageData(subId string, hostHeader string, traffic xray.ClientTraffic, lastOnline int64, subs []string, subURL, subJsonURL string) PageData {
|
||||||
|
download := common.FormatTraffic(traffic.Down)
|
||||||
|
upload := common.FormatTraffic(traffic.Up)
|
||||||
|
total := "∞"
|
||||||
|
used := common.FormatTraffic(traffic.Up + traffic.Down)
|
||||||
|
remained := ""
|
||||||
|
if traffic.Total > 0 {
|
||||||
|
total = common.FormatTraffic(traffic.Total)
|
||||||
|
left := max(traffic.Total-(traffic.Up+traffic.Down), 0)
|
||||||
|
remained = common.FormatTraffic(left)
|
||||||
|
}
|
||||||
|
|
||||||
|
datepicker := s.datepicker
|
||||||
|
if datepicker == "" {
|
||||||
|
datepicker = "gregorian"
|
||||||
|
}
|
||||||
|
|
||||||
|
return PageData{
|
||||||
|
Host: hostHeader,
|
||||||
|
BasePath: "/", // kept as "/"; templates now use context base_path injected from router
|
||||||
|
SId: subId,
|
||||||
|
Download: download,
|
||||||
|
Upload: upload,
|
||||||
|
Total: total,
|
||||||
|
Used: used,
|
||||||
|
Remained: remained,
|
||||||
|
Expire: traffic.ExpiryTime / 1000,
|
||||||
|
LastOnline: lastOnline,
|
||||||
|
Datepicker: datepicker,
|
||||||
|
DownloadByte: traffic.Down,
|
||||||
|
UploadByte: traffic.Up,
|
||||||
|
TotalByte: traffic.Total,
|
||||||
|
SubUrl: subURL,
|
||||||
|
SubJsonUrl: subJsonURL,
|
||||||
|
Result: subs,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func getHostFromXFH(s string) (string, error) {
|
||||||
|
if strings.Contains(s, ":") {
|
||||||
|
realHost, _, err := net.SplitHostPort(s)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
return realHost, nil
|
||||||
|
}
|
||||||
|
return s, nil
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,22 +1,26 @@
|
|||||||
|
// Package common provides common utility functions for error handling, formatting, and multi-error management.
|
||||||
package common
|
package common
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"x-ui/logger"
|
"github.com/mhsanaei/3x-ui/v2/logger"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// NewErrorf creates a new error with formatted message.
|
||||||
func NewErrorf(format string, a ...any) error {
|
func NewErrorf(format string, a ...any) error {
|
||||||
msg := fmt.Sprintf(format, a...)
|
msg := fmt.Sprintf(format, a...)
|
||||||
return errors.New(msg)
|
return errors.New(msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NewError creates a new error from the given arguments.
|
||||||
func NewError(a ...any) error {
|
func NewError(a ...any) error {
|
||||||
msg := fmt.Sprintln(a...)
|
msg := fmt.Sprintln(a...)
|
||||||
return errors.New(msg)
|
return errors.New(msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Recover handles panic recovery and logs the panic error if a message is provided.
|
||||||
func Recover(msg string) any {
|
func Recover(msg string) any {
|
||||||
panicErr := recover()
|
panicErr := recover()
|
||||||
if panicErr != nil {
|
if panicErr != nil {
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// FormatTraffic formats traffic bytes into human-readable units (B, KB, MB, GB, TB, PB).
|
||||||
func FormatTraffic(trafficBytes int64) string {
|
func FormatTraffic(trafficBytes int64) string {
|
||||||
units := []string{"B", "KB", "MB", "GB", "TB", "PB"}
|
units := []string{"B", "KB", "MB", "GB", "TB", "PB"}
|
||||||
unitIndex := 0
|
unitIndex := 0
|
||||||
|
|||||||
@@ -4,8 +4,10 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// multiError represents a collection of errors.
|
||||||
type multiError []error
|
type multiError []error
|
||||||
|
|
||||||
|
// Error returns a string representation of all errors joined with " | ".
|
||||||
func (e multiError) Error() string {
|
func (e multiError) Error() string {
|
||||||
var r strings.Builder
|
var r strings.Builder
|
||||||
r.WriteString("multierr: ")
|
r.WriteString("multierr: ")
|
||||||
@@ -16,6 +18,7 @@ func (e multiError) Error() string {
|
|||||||
return r.String()
|
return r.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Combine combines multiple errors into a single error, filtering out nil errors.
|
||||||
func Combine(maybeError ...error) error {
|
func Combine(maybeError ...error) error {
|
||||||
var errs multiError
|
var errs multiError
|
||||||
for _, err := range maybeError {
|
for _, err := range maybeError {
|
||||||
|
|||||||
@@ -1,14 +1,17 @@
|
|||||||
|
// Package crypto provides cryptographic utilities for password hashing and verification.
|
||||||
package crypto
|
package crypto
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"golang.org/x/crypto/bcrypt"
|
"golang.org/x/crypto/bcrypt"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// HashPasswordAsBcrypt generates a bcrypt hash of the given password.
|
||||||
func HashPasswordAsBcrypt(password string) (string, error) {
|
func HashPasswordAsBcrypt(password string) (string, error) {
|
||||||
hash, err := bcrypt.GenerateFromPassword([]byte(password), bcrypt.DefaultCost)
|
hash, err := bcrypt.GenerateFromPassword([]byte(password), bcrypt.DefaultCost)
|
||||||
return string(hash), err
|
return string(hash), err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CheckPasswordHash verifies if the given password matches the bcrypt hash.
|
||||||
func CheckPasswordHash(hash, password string) bool {
|
func CheckPasswordHash(hash, password string) bool {
|
||||||
err := bcrypt.CompareHashAndPassword([]byte(hash), []byte(password))
|
err := bcrypt.CompareHashAndPassword([]byte(hash), []byte(password))
|
||||||
return err == nil
|
return err == nil
|
||||||
|
|||||||
@@ -1,12 +1,15 @@
|
|||||||
|
// Package json_util provides JSON utilities including a custom RawMessage type.
|
||||||
package json_util
|
package json_util
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// RawMessage is a custom JSON raw message type that marshals empty slices as "null".
|
||||||
type RawMessage []byte
|
type RawMessage []byte
|
||||||
|
|
||||||
// MarshalJSON: Customize json.RawMessage default behavior
|
// MarshalJSON customizes the JSON marshaling behavior for RawMessage.
|
||||||
|
// Empty RawMessage values are marshaled as "null" instead of "[]".
|
||||||
func (m RawMessage) MarshalJSON() ([]byte, error) {
|
func (m RawMessage) MarshalJSON() ([]byte, error) {
|
||||||
if len(m) == 0 {
|
if len(m) == 0 {
|
||||||
return []byte("null"), nil
|
return []byte("null"), nil
|
||||||
@@ -14,7 +17,7 @@ func (m RawMessage) MarshalJSON() ([]byte, error) {
|
|||||||
return m, nil
|
return m, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnmarshalJSON: sets *m to a copy of data.
|
// UnmarshalJSON sets *m to a copy of the JSON data.
|
||||||
func (m *RawMessage) UnmarshalJSON(data []byte) error {
|
func (m *RawMessage) UnmarshalJSON(data []byte) error {
|
||||||
if m == nil {
|
if m == nil {
|
||||||
return errors.New("json.RawMessage: UnmarshalJSON on nil pointer")
|
return errors.New("json.RawMessage: UnmarshalJSON on nil pointer")
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
|
// Package random provides utilities for generating random strings and numbers.
|
||||||
package random
|
package random
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"math/rand"
|
"crypto/rand"
|
||||||
|
"math/big"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@@ -13,6 +15,8 @@ var (
|
|||||||
allSeq [62]rune
|
allSeq [62]rune
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// init initializes the character sequences used for random string generation.
|
||||||
|
// It sets up arrays for numbers, lowercase letters, uppercase letters, and combinations.
|
||||||
func init() {
|
func init() {
|
||||||
for i := 0; i < 10; i++ {
|
for i := 0; i < 10; i++ {
|
||||||
numSeq[i] = rune('0' + i)
|
numSeq[i] = rune('0' + i)
|
||||||
@@ -33,14 +37,25 @@ func init() {
|
|||||||
copy(allSeq[len(numSeq)+len(lowerSeq):], upperSeq[:])
|
copy(allSeq[len(numSeq)+len(lowerSeq):], upperSeq[:])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Seq generates a random string of length n containing alphanumeric characters (numbers, lowercase and uppercase letters).
|
||||||
func Seq(n int) string {
|
func Seq(n int) string {
|
||||||
runes := make([]rune, n)
|
runes := make([]rune, n)
|
||||||
for i := 0; i < n; i++ {
|
for i := 0; i < n; i++ {
|
||||||
runes[i] = allSeq[rand.Intn(len(allSeq))]
|
idx, err := rand.Int(rand.Reader, big.NewInt(int64(len(allSeq))))
|
||||||
|
if err != nil {
|
||||||
|
panic("crypto/rand failed: " + err.Error())
|
||||||
|
}
|
||||||
|
runes[i] = allSeq[idx.Int64()]
|
||||||
}
|
}
|
||||||
return string(runes)
|
return string(runes)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Num generates a random integer between 0 and n-1.
|
||||||
func Num(n int) int {
|
func Num(n int) int {
|
||||||
return rand.Intn(n)
|
bn := big.NewInt(int64(n))
|
||||||
|
r, err := rand.Int(rand.Reader, bn)
|
||||||
|
if err != nil {
|
||||||
|
panic("crypto/rand failed: " + err.Error())
|
||||||
|
}
|
||||||
|
return int(r.Int64())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
|
// Package reflect_util provides reflection utilities for working with struct fields and values.
|
||||||
package reflect_util
|
package reflect_util
|
||||||
|
|
||||||
import "reflect"
|
import "reflect"
|
||||||
|
|
||||||
|
// GetFields returns all struct fields of the given reflect.Type.
|
||||||
func GetFields(t reflect.Type) []reflect.StructField {
|
func GetFields(t reflect.Type) []reflect.StructField {
|
||||||
num := t.NumField()
|
num := t.NumField()
|
||||||
fields := make([]reflect.StructField, 0, num)
|
fields := make([]reflect.StructField, 0, num)
|
||||||
@@ -11,6 +13,7 @@ func GetFields(t reflect.Type) []reflect.StructField {
|
|||||||
return fields
|
return fields
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetFieldValues returns all field values of the given reflect.Value.
|
||||||
func GetFieldValues(v reflect.Value) []reflect.Value {
|
func GetFieldValues(v reflect.Value) []reflect.Value {
|
||||||
num := v.NumField()
|
num := v.NumField()
|
||||||
fields := make([]reflect.Value, 0, num)
|
fields := make([]reflect.Value, 0, num)
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
// Package sys provides system utilities for monitoring network connections and CPU usage.
|
||||||
|
// Platform-specific implementations are provided for Windows, Linux, and macOS.
|
||||||
package sys
|
package sys
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|||||||
@@ -4,7 +4,12 @@
|
|||||||
package sys
|
package sys
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/binary"
|
||||||
|
"fmt"
|
||||||
|
"sync"
|
||||||
|
|
||||||
"github.com/shirou/gopsutil/v4/net"
|
"github.com/shirou/gopsutil/v4/net"
|
||||||
|
"golang.org/x/sys/unix"
|
||||||
)
|
)
|
||||||
|
|
||||||
func GetTCPCount() (int, error) {
|
func GetTCPCount() (int, error) {
|
||||||
@@ -22,3 +27,69 @@ func GetUDPCount() (int, error) {
|
|||||||
}
|
}
|
||||||
return len(stats), nil
|
return len(stats), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// --- CPU Utilization (macOS native) ---
|
||||||
|
|
||||||
|
// sysctl kern.cp_time returns an array of 5 longs: user, nice, sys, idle, intr.
|
||||||
|
// We compute utilization deltas without cgo.
|
||||||
|
var (
|
||||||
|
cpuMu sync.Mutex
|
||||||
|
lastTotals [5]uint64
|
||||||
|
hasLastCPUT bool
|
||||||
|
)
|
||||||
|
|
||||||
|
func CPUPercentRaw() (float64, error) {
|
||||||
|
raw, err := unix.SysctlRaw("kern.cp_time")
|
||||||
|
if err != nil {
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
// Expect either 5*8 bytes (uint64) or 5*4 bytes (uint32)
|
||||||
|
var out [5]uint64
|
||||||
|
switch len(raw) {
|
||||||
|
case 5 * 8:
|
||||||
|
for i := 0; i < 5; i++ {
|
||||||
|
out[i] = binary.LittleEndian.Uint64(raw[i*8 : (i+1)*8])
|
||||||
|
}
|
||||||
|
case 5 * 4:
|
||||||
|
for i := 0; i < 5; i++ {
|
||||||
|
out[i] = uint64(binary.LittleEndian.Uint32(raw[i*4 : (i+1)*4]))
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
return 0, fmt.Errorf("unexpected kern.cp_time size: %d", len(raw))
|
||||||
|
}
|
||||||
|
|
||||||
|
// user, nice, sys, idle, intr
|
||||||
|
user := out[0]
|
||||||
|
nice := out[1]
|
||||||
|
sysv := out[2]
|
||||||
|
idle := out[3]
|
||||||
|
intr := out[4]
|
||||||
|
|
||||||
|
cpuMu.Lock()
|
||||||
|
defer cpuMu.Unlock()
|
||||||
|
|
||||||
|
if !hasLastCPUT {
|
||||||
|
lastTotals = out
|
||||||
|
hasLastCPUT = true
|
||||||
|
return 0, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
dUser := user - lastTotals[0]
|
||||||
|
dNice := nice - lastTotals[1]
|
||||||
|
dSys := sysv - lastTotals[2]
|
||||||
|
dIdle := idle - lastTotals[3]
|
||||||
|
dIntr := intr - lastTotals[4]
|
||||||
|
|
||||||
|
lastTotals = out
|
||||||
|
|
||||||
|
totald := dUser + dNice + dSys + dIdle + dIntr
|
||||||
|
if totald == 0 {
|
||||||
|
return 0, nil
|
||||||
|
}
|
||||||
|
busy := totald - dIdle
|
||||||
|
pct := float64(busy) / float64(totald) * 100.0
|
||||||
|
if pct > 100 {
|
||||||
|
pct = 100
|
||||||
|
}
|
||||||
|
return pct, nil
|
||||||
|
}
|
||||||
|
|||||||
@@ -4,10 +4,14 @@
|
|||||||
package sys
|
package sys
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bufio"
|
||||||
"bytes"
|
"bytes"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
|
"strconv"
|
||||||
|
"strings"
|
||||||
|
"sync"
|
||||||
)
|
)
|
||||||
|
|
||||||
func getLinesNum(filename string) (int, error) {
|
func getLinesNum(filename string) (int, error) {
|
||||||
@@ -41,6 +45,8 @@ func getLinesNum(filename string) (int, error) {
|
|||||||
return sum, nil
|
return sum, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetTCPCount returns the number of active TCP connections by reading
|
||||||
|
// /proc/net/tcp and /proc/net/tcp6 when available.
|
||||||
func GetTCPCount() (int, error) {
|
func GetTCPCount() (int, error) {
|
||||||
root := HostProc()
|
root := HostProc()
|
||||||
|
|
||||||
@@ -71,6 +77,8 @@ func GetUDPCount() (int, error) {
|
|||||||
return udp4 + udp6, nil
|
return udp4 + udp6, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// safeGetLinesNum returns 0 if the file does not exist, otherwise forwards
|
||||||
|
// to getLinesNum to count the number of lines.
|
||||||
func safeGetLinesNum(path string) (int, error) {
|
func safeGetLinesNum(path string) (int, error) {
|
||||||
if _, err := os.Stat(path); os.IsNotExist(err) {
|
if _, err := os.Stat(path); os.IsNotExist(err) {
|
||||||
return 0, nil
|
return 0, nil
|
||||||
@@ -79,3 +87,99 @@ func safeGetLinesNum(path string) (int, error) {
|
|||||||
}
|
}
|
||||||
return getLinesNum(path)
|
return getLinesNum(path)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// --- CPU Utilization (Linux native) ---
|
||||||
|
|
||||||
|
var (
|
||||||
|
cpuMu sync.Mutex
|
||||||
|
lastTotal uint64
|
||||||
|
lastIdleAll uint64
|
||||||
|
hasLast bool
|
||||||
|
)
|
||||||
|
|
||||||
|
// CPUPercentRaw returns instantaneous total CPU utilization by reading /proc/stat.
|
||||||
|
// First call initializes and returns 0; subsequent calls return busy/total * 100.
|
||||||
|
func CPUPercentRaw() (float64, error) {
|
||||||
|
f, err := os.Open("/proc/stat")
|
||||||
|
if err != nil {
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
defer f.Close()
|
||||||
|
|
||||||
|
rd := bufio.NewReader(f)
|
||||||
|
line, err := rd.ReadString('\n')
|
||||||
|
if err != nil && err != io.EOF {
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
// Expect line like: cpu user nice system idle iowait irq softirq steal guest guest_nice
|
||||||
|
fields := strings.Fields(line)
|
||||||
|
if len(fields) < 5 || fields[0] != "cpu" {
|
||||||
|
return 0, fmt.Errorf("unexpected /proc/stat format")
|
||||||
|
}
|
||||||
|
|
||||||
|
var nums []uint64
|
||||||
|
for i := 1; i < len(fields); i++ {
|
||||||
|
v, err := strconv.ParseUint(fields[i], 10, 64)
|
||||||
|
if err != nil {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
nums = append(nums, v)
|
||||||
|
}
|
||||||
|
if len(nums) < 4 { // need at least user,nice,system,idle
|
||||||
|
return 0, fmt.Errorf("insufficient cpu fields")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Conform with standard Linux CPU accounting
|
||||||
|
var user, nice, system, idle, iowait, irq, softirq, steal uint64
|
||||||
|
user = nums[0]
|
||||||
|
if len(nums) > 1 {
|
||||||
|
nice = nums[1]
|
||||||
|
}
|
||||||
|
if len(nums) > 2 {
|
||||||
|
system = nums[2]
|
||||||
|
}
|
||||||
|
if len(nums) > 3 {
|
||||||
|
idle = nums[3]
|
||||||
|
}
|
||||||
|
if len(nums) > 4 {
|
||||||
|
iowait = nums[4]
|
||||||
|
}
|
||||||
|
if len(nums) > 5 {
|
||||||
|
irq = nums[5]
|
||||||
|
}
|
||||||
|
if len(nums) > 6 {
|
||||||
|
softirq = nums[6]
|
||||||
|
}
|
||||||
|
if len(nums) > 7 {
|
||||||
|
steal = nums[7]
|
||||||
|
}
|
||||||
|
|
||||||
|
idleAll := idle + iowait
|
||||||
|
nonIdle := user + nice + system + irq + softirq + steal
|
||||||
|
total := idleAll + nonIdle
|
||||||
|
|
||||||
|
cpuMu.Lock()
|
||||||
|
defer cpuMu.Unlock()
|
||||||
|
|
||||||
|
if !hasLast {
|
||||||
|
lastTotal = total
|
||||||
|
lastIdleAll = idleAll
|
||||||
|
hasLast = true
|
||||||
|
return 0, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
totald := total - lastTotal
|
||||||
|
idled := idleAll - lastIdleAll
|
||||||
|
lastTotal = total
|
||||||
|
lastIdleAll = idleAll
|
||||||
|
|
||||||
|
if totald == 0 {
|
||||||
|
return 0, nil
|
||||||
|
}
|
||||||
|
busy := totald - idled
|
||||||
|
pct := float64(busy) / float64(totald) * 100.0
|
||||||
|
if pct > 100 {
|
||||||
|
pct = 100
|
||||||
|
}
|
||||||
|
return pct, nil
|
||||||
|
}
|
||||||
|
|||||||
@@ -5,10 +5,14 @@ package sys
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
"sync"
|
||||||
|
"syscall"
|
||||||
|
"unsafe"
|
||||||
|
|
||||||
"github.com/shirou/gopsutil/v4/net"
|
"github.com/shirou/gopsutil/v4/net"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// GetConnectionCount returns the number of active connections for the specified protocol ("tcp" or "udp").
|
||||||
func GetConnectionCount(proto string) (int, error) {
|
func GetConnectionCount(proto string) (int, error) {
|
||||||
if proto != "tcp" && proto != "udp" {
|
if proto != "tcp" && proto != "udp" {
|
||||||
return 0, errors.New("invalid protocol")
|
return 0, errors.New("invalid protocol")
|
||||||
@@ -21,10 +25,92 @@ func GetConnectionCount(proto string) (int, error) {
|
|||||||
return len(stats), nil
|
return len(stats), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetTCPCount returns the number of active TCP connections.
|
||||||
func GetTCPCount() (int, error) {
|
func GetTCPCount() (int, error) {
|
||||||
return GetConnectionCount("tcp")
|
return GetConnectionCount("tcp")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetUDPCount returns the number of active UDP connections.
|
||||||
func GetUDPCount() (int, error) {
|
func GetUDPCount() (int, error) {
|
||||||
return GetConnectionCount("udp")
|
return GetConnectionCount("udp")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// --- CPU Utilization (Windows native) ---
|
||||||
|
|
||||||
|
var (
|
||||||
|
modKernel32 = syscall.NewLazyDLL("kernel32.dll")
|
||||||
|
procGetSystemTimes = modKernel32.NewProc("GetSystemTimes")
|
||||||
|
|
||||||
|
cpuMu sync.Mutex
|
||||||
|
lastIdle uint64
|
||||||
|
lastKernel uint64
|
||||||
|
lastUser uint64
|
||||||
|
hasLast bool
|
||||||
|
)
|
||||||
|
|
||||||
|
type filetime struct {
|
||||||
|
LowDateTime uint32
|
||||||
|
HighDateTime uint32
|
||||||
|
}
|
||||||
|
|
||||||
|
// ftToUint64 converts a Windows FILETIME-like struct to a uint64 for
|
||||||
|
// arithmetic and delta calculations used by CPUPercentRaw.
|
||||||
|
func ftToUint64(ft filetime) uint64 {
|
||||||
|
return (uint64(ft.HighDateTime) << 32) | uint64(ft.LowDateTime)
|
||||||
|
}
|
||||||
|
|
||||||
|
// CPUPercentRaw returns the instantaneous total CPU utilization percentage using
|
||||||
|
// Windows GetSystemTimes across all logical processors. The first call returns 0
|
||||||
|
// as it initializes the baseline. Subsequent calls compute deltas.
|
||||||
|
func CPUPercentRaw() (float64, error) {
|
||||||
|
var idleFT, kernelFT, userFT filetime
|
||||||
|
r1, _, e1 := procGetSystemTimes.Call(
|
||||||
|
uintptr(unsafe.Pointer(&idleFT)),
|
||||||
|
uintptr(unsafe.Pointer(&kernelFT)),
|
||||||
|
uintptr(unsafe.Pointer(&userFT)),
|
||||||
|
)
|
||||||
|
if r1 == 0 { // failure
|
||||||
|
if e1 != nil {
|
||||||
|
return 0, e1
|
||||||
|
}
|
||||||
|
return 0, syscall.GetLastError()
|
||||||
|
}
|
||||||
|
|
||||||
|
idle := ftToUint64(idleFT)
|
||||||
|
kernel := ftToUint64(kernelFT)
|
||||||
|
user := ftToUint64(userFT)
|
||||||
|
|
||||||
|
cpuMu.Lock()
|
||||||
|
defer cpuMu.Unlock()
|
||||||
|
|
||||||
|
if !hasLast {
|
||||||
|
lastIdle = idle
|
||||||
|
lastKernel = kernel
|
||||||
|
lastUser = user
|
||||||
|
hasLast = true
|
||||||
|
return 0, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
idleDelta := idle - lastIdle
|
||||||
|
kernelDelta := kernel - lastKernel
|
||||||
|
userDelta := user - lastUser
|
||||||
|
|
||||||
|
// Update for next call
|
||||||
|
lastIdle = idle
|
||||||
|
lastKernel = kernel
|
||||||
|
lastUser = user
|
||||||
|
|
||||||
|
total := kernelDelta + userDelta
|
||||||
|
if total == 0 {
|
||||||
|
return 0, nil
|
||||||
|
}
|
||||||
|
// On Windows, kernel time includes idle time; busy = total - idle
|
||||||
|
busy := total - idleDelta
|
||||||
|
|
||||||
|
pct := float64(busy) / float64(total) * 100.0
|
||||||
|
// lower bound not needed; ratios of uint64 are non-negative
|
||||||
|
if pct > 100 {
|
||||||
|
pct = 100
|
||||||
|
}
|
||||||
|
return pct, nil
|
||||||
|
}
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -1,7 +0,0 @@
|
|||||||
@import "../lib/style/index.less";
|
|
||||||
@import "../lib/style/components.less";
|
|
||||||
|
|
||||||
@green-6: #008771;
|
|
||||||
@primary-color: @green-6;
|
|
||||||
@border-radius-base: 1rem;
|
|
||||||
@progress-remaining-color: #EDEDED;
|
|
||||||
File diff suppressed because one or more lines are too long
4
web/assets/axios/axios.min.js
vendored
4
web/assets/axios/axios.min.js
vendored
File diff suppressed because one or more lines are too long
2
web/assets/css/custom.min.css
vendored
2
web/assets/css/custom.min.css
vendored
File diff suppressed because one or more lines are too long
@@ -6,9 +6,12 @@ class DBInbound {
|
|||||||
this.up = 0;
|
this.up = 0;
|
||||||
this.down = 0;
|
this.down = 0;
|
||||||
this.total = 0;
|
this.total = 0;
|
||||||
|
this.allTime = 0;
|
||||||
this.remark = "";
|
this.remark = "";
|
||||||
this.enable = true;
|
this.enable = true;
|
||||||
this.expiryTime = 0;
|
this.expiryTime = 0;
|
||||||
|
this.trafficReset = "never";
|
||||||
|
this.lastTrafficResetTime = 0;
|
||||||
|
|
||||||
this.listen = "";
|
this.listen = "";
|
||||||
this.port = 0;
|
this.port = 0;
|
||||||
@@ -48,8 +51,8 @@ class DBInbound {
|
|||||||
return this.protocol === Protocols.SHADOWSOCKS;
|
return this.protocol === Protocols.SHADOWSOCKS;
|
||||||
}
|
}
|
||||||
|
|
||||||
get isSocks() {
|
get isMixed() {
|
||||||
return this.protocol === Protocols.SOCKS;
|
return this.protocol === Protocols.MIXED;
|
||||||
}
|
}
|
||||||
|
|
||||||
get isHTTP() {
|
get isHTTP() {
|
||||||
|
|||||||
@@ -3,18 +3,16 @@ const Protocols = {
|
|||||||
VLESS: 'vless',
|
VLESS: 'vless',
|
||||||
TROJAN: 'trojan',
|
TROJAN: 'trojan',
|
||||||
SHADOWSOCKS: 'shadowsocks',
|
SHADOWSOCKS: 'shadowsocks',
|
||||||
DOKODEMO: 'dokodemo-door',
|
TUNNEL: 'tunnel',
|
||||||
SOCKS: 'socks',
|
MIXED: 'mixed',
|
||||||
HTTP: 'http',
|
HTTP: 'http',
|
||||||
WIREGUARD: 'wireguard',
|
WIREGUARD: 'wireguard',
|
||||||
};
|
};
|
||||||
|
|
||||||
const SSMethods = {
|
const SSMethods = {
|
||||||
AES_256_GCM: 'aes-256-gcm',
|
AES_256_GCM: 'aes-256-gcm',
|
||||||
AES_128_GCM: 'aes-128-gcm',
|
|
||||||
CHACHA20_POLY1305: 'chacha20-poly1305',
|
CHACHA20_POLY1305: 'chacha20-poly1305',
|
||||||
CHACHA20_IETF_POLY1305: 'chacha20-ietf-poly1305',
|
CHACHA20_IETF_POLY1305: 'chacha20-ietf-poly1305',
|
||||||
XCHACHA20_POLY1305: 'xchacha20-poly1305',
|
|
||||||
XCHACHA20_IETF_POLY1305: 'xchacha20-ietf-poly1305',
|
XCHACHA20_IETF_POLY1305: 'xchacha20-ietf-poly1305',
|
||||||
BLAKE3_AES_128_GCM: '2022-blake3-aes-128-gcm',
|
BLAKE3_AES_128_GCM: '2022-blake3-aes-128-gcm',
|
||||||
BLAKE3_AES_256_GCM: '2022-blake3-aes-256-gcm',
|
BLAKE3_AES_256_GCM: '2022-blake3-aes-256-gcm',
|
||||||
@@ -559,7 +557,9 @@ class TlsStreamSettings extends XrayCommonClass {
|
|||||||
disableSystemRoot = false,
|
disableSystemRoot = false,
|
||||||
enableSessionResumption = false,
|
enableSessionResumption = false,
|
||||||
certificates = [new TlsStreamSettings.Cert()],
|
certificates = [new TlsStreamSettings.Cert()],
|
||||||
alpn = [ALPN_OPTION.H3, ALPN_OPTION.H2, ALPN_OPTION.HTTP1],
|
alpn = [ALPN_OPTION.H2, ALPN_OPTION.HTTP1],
|
||||||
|
echServerKeys = '',
|
||||||
|
echForceQuery = 'none',
|
||||||
settings = new TlsStreamSettings.Settings()
|
settings = new TlsStreamSettings.Settings()
|
||||||
) {
|
) {
|
||||||
super();
|
super();
|
||||||
@@ -573,6 +573,8 @@ class TlsStreamSettings extends XrayCommonClass {
|
|||||||
this.enableSessionResumption = enableSessionResumption;
|
this.enableSessionResumption = enableSessionResumption;
|
||||||
this.certs = certificates;
|
this.certs = certificates;
|
||||||
this.alpn = alpn;
|
this.alpn = alpn;
|
||||||
|
this.echServerKeys = echServerKeys;
|
||||||
|
this.echForceQuery = echForceQuery;
|
||||||
this.settings = settings;
|
this.settings = settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -592,7 +594,7 @@ class TlsStreamSettings extends XrayCommonClass {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!ObjectUtil.isEmpty(json.settings)) {
|
if (!ObjectUtil.isEmpty(json.settings)) {
|
||||||
settings = new TlsStreamSettings.Settings(json.settings.allowInsecure, json.settings.fingerprint, json.settings.serverName, json.settings.domains);
|
settings = new TlsStreamSettings.Settings(json.settings.allowInsecure, json.settings.fingerprint, json.settings.echConfigList);
|
||||||
}
|
}
|
||||||
return new TlsStreamSettings(
|
return new TlsStreamSettings(
|
||||||
json.serverName,
|
json.serverName,
|
||||||
@@ -605,6 +607,8 @@ class TlsStreamSettings extends XrayCommonClass {
|
|||||||
json.enableSessionResumption,
|
json.enableSessionResumption,
|
||||||
certs,
|
certs,
|
||||||
json.alpn,
|
json.alpn,
|
||||||
|
json.echServerKeys,
|
||||||
|
json.echForceQuery,
|
||||||
settings,
|
settings,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -621,6 +625,8 @@ class TlsStreamSettings extends XrayCommonClass {
|
|||||||
enableSessionResumption: this.enableSessionResumption,
|
enableSessionResumption: this.enableSessionResumption,
|
||||||
certificates: TlsStreamSettings.toJsonArray(this.certs),
|
certificates: TlsStreamSettings.toJsonArray(this.certs),
|
||||||
alpn: this.alpn,
|
alpn: this.alpn,
|
||||||
|
echServerKeys: this.echServerKeys,
|
||||||
|
echForceQuery: this.echForceQuery,
|
||||||
settings: this.settings,
|
settings: this.settings,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -633,7 +639,6 @@ TlsStreamSettings.Cert = class extends XrayCommonClass {
|
|||||||
keyFile = '',
|
keyFile = '',
|
||||||
certificate = '',
|
certificate = '',
|
||||||
key = '',
|
key = '',
|
||||||
ocspStapling = 3600,
|
|
||||||
oneTimeLoading = false,
|
oneTimeLoading = false,
|
||||||
usage = USAGE_OPTION.ENCIPHERMENT,
|
usage = USAGE_OPTION.ENCIPHERMENT,
|
||||||
buildChain = false,
|
buildChain = false,
|
||||||
@@ -644,7 +649,6 @@ TlsStreamSettings.Cert = class extends XrayCommonClass {
|
|||||||
this.keyFile = keyFile;
|
this.keyFile = keyFile;
|
||||||
this.cert = Array.isArray(certificate) ? certificate.join('\n') : certificate;
|
this.cert = Array.isArray(certificate) ? certificate.join('\n') : certificate;
|
||||||
this.key = Array.isArray(key) ? key.join('\n') : key;
|
this.key = Array.isArray(key) ? key.join('\n') : key;
|
||||||
this.ocspStapling = ocspStapling;
|
|
||||||
this.oneTimeLoading = oneTimeLoading;
|
this.oneTimeLoading = oneTimeLoading;
|
||||||
this.usage = usage;
|
this.usage = usage;
|
||||||
this.buildChain = buildChain
|
this.buildChain = buildChain
|
||||||
@@ -656,7 +660,6 @@ TlsStreamSettings.Cert = class extends XrayCommonClass {
|
|||||||
true,
|
true,
|
||||||
json.certificateFile,
|
json.certificateFile,
|
||||||
json.keyFile, '', '',
|
json.keyFile, '', '',
|
||||||
json.ocspStapling,
|
|
||||||
json.oneTimeLoading,
|
json.oneTimeLoading,
|
||||||
json.usage,
|
json.usage,
|
||||||
json.buildChain,
|
json.buildChain,
|
||||||
@@ -666,7 +669,6 @@ TlsStreamSettings.Cert = class extends XrayCommonClass {
|
|||||||
false, '', '',
|
false, '', '',
|
||||||
json.certificate.join('\n'),
|
json.certificate.join('\n'),
|
||||||
json.key.join('\n'),
|
json.key.join('\n'),
|
||||||
json.ocspStapling,
|
|
||||||
json.oneTimeLoading,
|
json.oneTimeLoading,
|
||||||
json.usage,
|
json.usage,
|
||||||
json.buildChain,
|
json.buildChain,
|
||||||
@@ -679,7 +681,6 @@ TlsStreamSettings.Cert = class extends XrayCommonClass {
|
|||||||
return {
|
return {
|
||||||
certificateFile: this.certFile,
|
certificateFile: this.certFile,
|
||||||
keyFile: this.keyFile,
|
keyFile: this.keyFile,
|
||||||
ocspStapling: this.ocspStapling,
|
|
||||||
oneTimeLoading: this.oneTimeLoading,
|
oneTimeLoading: this.oneTimeLoading,
|
||||||
usage: this.usage,
|
usage: this.usage,
|
||||||
buildChain: this.buildChain,
|
buildChain: this.buildChain,
|
||||||
@@ -688,7 +689,6 @@ TlsStreamSettings.Cert = class extends XrayCommonClass {
|
|||||||
return {
|
return {
|
||||||
certificate: this.cert.split('\n'),
|
certificate: this.cert.split('\n'),
|
||||||
key: this.key.split('\n'),
|
key: this.key.split('\n'),
|
||||||
ocspStapling: this.ocspStapling,
|
|
||||||
oneTimeLoading: this.oneTimeLoading,
|
oneTimeLoading: this.oneTimeLoading,
|
||||||
usage: this.usage,
|
usage: this.usage,
|
||||||
buildChain: this.buildChain,
|
buildChain: this.buildChain,
|
||||||
@@ -701,21 +701,25 @@ TlsStreamSettings.Settings = class extends XrayCommonClass {
|
|||||||
constructor(
|
constructor(
|
||||||
allowInsecure = false,
|
allowInsecure = false,
|
||||||
fingerprint = UTLS_FINGERPRINT.UTLS_CHROME,
|
fingerprint = UTLS_FINGERPRINT.UTLS_CHROME,
|
||||||
|
echConfigList = '',
|
||||||
) {
|
) {
|
||||||
super();
|
super();
|
||||||
this.allowInsecure = allowInsecure;
|
this.allowInsecure = allowInsecure;
|
||||||
this.fingerprint = fingerprint;
|
this.fingerprint = fingerprint;
|
||||||
|
this.echConfigList = echConfigList;
|
||||||
}
|
}
|
||||||
static fromJson(json = {}) {
|
static fromJson(json = {}) {
|
||||||
return new TlsStreamSettings.Settings(
|
return new TlsStreamSettings.Settings(
|
||||||
json.allowInsecure,
|
json.allowInsecure,
|
||||||
json.fingerprint,
|
json.fingerprint,
|
||||||
|
json.echConfigList,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
toJson() {
|
toJson() {
|
||||||
return {
|
return {
|
||||||
allowInsecure: this.allowInsecure,
|
allowInsecure: this.allowInsecure,
|
||||||
fingerprint: this.fingerprint,
|
fingerprint: this.fingerprint,
|
||||||
|
echConfigList: this.echConfigList
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -725,25 +729,27 @@ class RealityStreamSettings extends XrayCommonClass {
|
|||||||
constructor(
|
constructor(
|
||||||
show = false,
|
show = false,
|
||||||
xver = 0,
|
xver = 0,
|
||||||
dest = 'yahoo.com:443',
|
target = 'google.com:443',
|
||||||
serverNames = 'yahoo.com,www.yahoo.com',
|
serverNames = 'google.com,www.google.com',
|
||||||
privateKey = '',
|
privateKey = '',
|
||||||
minClient = '',
|
minClientVer = '',
|
||||||
maxClient = '',
|
maxClientVer = '',
|
||||||
maxTimediff = 0,
|
maxTimediff = 0,
|
||||||
shortIds = RandomUtil.randomShortIds(),
|
shortIds = RandomUtil.randomShortIds(),
|
||||||
|
mldsa65Seed = '',
|
||||||
settings = new RealityStreamSettings.Settings()
|
settings = new RealityStreamSettings.Settings()
|
||||||
) {
|
) {
|
||||||
super();
|
super();
|
||||||
this.show = show;
|
this.show = show;
|
||||||
this.xver = xver;
|
this.xver = xver;
|
||||||
this.dest = dest;
|
this.target = target;
|
||||||
this.serverNames = Array.isArray(serverNames) ? serverNames.join(",") : serverNames;
|
this.serverNames = Array.isArray(serverNames) ? serverNames.join(",") : serverNames;
|
||||||
this.privateKey = privateKey;
|
this.privateKey = privateKey;
|
||||||
this.minClient = minClient;
|
this.minClientVer = minClientVer;
|
||||||
this.maxClient = maxClient;
|
this.maxClientVer = maxClientVer;
|
||||||
this.maxTimediff = maxTimediff;
|
this.maxTimediff = maxTimediff;
|
||||||
this.shortIds = Array.isArray(shortIds) ? shortIds.join(",") : shortIds;
|
this.shortIds = Array.isArray(shortIds) ? shortIds.join(",") : shortIds;
|
||||||
|
this.mldsa65Seed = mldsa65Seed;
|
||||||
this.settings = settings;
|
this.settings = settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -754,19 +760,21 @@ class RealityStreamSettings extends XrayCommonClass {
|
|||||||
json.settings.publicKey,
|
json.settings.publicKey,
|
||||||
json.settings.fingerprint,
|
json.settings.fingerprint,
|
||||||
json.settings.serverName,
|
json.settings.serverName,
|
||||||
json.settings.spiderX
|
json.settings.spiderX,
|
||||||
|
json.settings.mldsa65Verify,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return new RealityStreamSettings(
|
return new RealityStreamSettings(
|
||||||
json.show,
|
json.show,
|
||||||
json.xver,
|
json.xver,
|
||||||
json.dest,
|
json.target,
|
||||||
json.serverNames,
|
json.serverNames,
|
||||||
json.privateKey,
|
json.privateKey,
|
||||||
json.minClient,
|
json.minClientVer,
|
||||||
json.maxClient,
|
json.maxClientVer,
|
||||||
json.maxTimediff,
|
json.maxTimediff,
|
||||||
json.shortIds,
|
json.shortIds,
|
||||||
|
json.mldsa65Seed,
|
||||||
settings,
|
settings,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -775,13 +783,14 @@ class RealityStreamSettings extends XrayCommonClass {
|
|||||||
return {
|
return {
|
||||||
show: this.show,
|
show: this.show,
|
||||||
xver: this.xver,
|
xver: this.xver,
|
||||||
dest: this.dest,
|
target: this.target,
|
||||||
serverNames: this.serverNames.split(","),
|
serverNames: this.serverNames.split(","),
|
||||||
privateKey: this.privateKey,
|
privateKey: this.privateKey,
|
||||||
minClient: this.minClient,
|
minClientVer: this.minClientVer,
|
||||||
maxClient: this.maxClient,
|
maxClientVer: this.maxClientVer,
|
||||||
maxTimediff: this.maxTimediff,
|
maxTimediff: this.maxTimediff,
|
||||||
shortIds: this.shortIds.split(","),
|
shortIds: this.shortIds.split(","),
|
||||||
|
mldsa65Seed: this.mldsa65Seed,
|
||||||
settings: this.settings,
|
settings: this.settings,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -792,13 +801,15 @@ RealityStreamSettings.Settings = class extends XrayCommonClass {
|
|||||||
publicKey = '',
|
publicKey = '',
|
||||||
fingerprint = UTLS_FINGERPRINT.UTLS_CHROME,
|
fingerprint = UTLS_FINGERPRINT.UTLS_CHROME,
|
||||||
serverName = '',
|
serverName = '',
|
||||||
spiderX = '/'
|
spiderX = '/',
|
||||||
|
mldsa65Verify = ''
|
||||||
) {
|
) {
|
||||||
super();
|
super();
|
||||||
this.publicKey = publicKey;
|
this.publicKey = publicKey;
|
||||||
this.fingerprint = fingerprint;
|
this.fingerprint = fingerprint;
|
||||||
this.serverName = serverName;
|
this.serverName = serverName;
|
||||||
this.spiderX = spiderX;
|
this.spiderX = spiderX;
|
||||||
|
this.mldsa65Verify = mldsa65Verify;
|
||||||
}
|
}
|
||||||
static fromJson(json = {}) {
|
static fromJson(json = {}) {
|
||||||
return new RealityStreamSettings.Settings(
|
return new RealityStreamSettings.Settings(
|
||||||
@@ -806,6 +817,7 @@ RealityStreamSettings.Settings = class extends XrayCommonClass {
|
|||||||
json.fingerprint,
|
json.fingerprint,
|
||||||
json.serverName,
|
json.serverName,
|
||||||
json.spiderX,
|
json.spiderX,
|
||||||
|
json.mldsa65Verify
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
toJson() {
|
toJson() {
|
||||||
@@ -814,6 +826,7 @@ RealityStreamSettings.Settings = class extends XrayCommonClass {
|
|||||||
fingerprint: this.fingerprint,
|
fingerprint: this.fingerprint,
|
||||||
serverName: this.serverName,
|
serverName: this.serverName,
|
||||||
spiderX: this.spiderX,
|
spiderX: this.spiderX,
|
||||||
|
mldsa65Verify: this.mldsa65Verify
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -1027,27 +1040,6 @@ class Sniffing extends XrayCommonClass {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class Allocate extends XrayCommonClass {
|
|
||||||
constructor(
|
|
||||||
strategy = "always",
|
|
||||||
refresh = 5,
|
|
||||||
concurrency = 3,
|
|
||||||
) {
|
|
||||||
super();
|
|
||||||
this.strategy = strategy;
|
|
||||||
this.refresh = refresh;
|
|
||||||
this.concurrency = concurrency;
|
|
||||||
}
|
|
||||||
|
|
||||||
static fromJson(json = {}) {
|
|
||||||
return new Allocate(
|
|
||||||
json.strategy,
|
|
||||||
json.refresh,
|
|
||||||
json.concurrency,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class Inbound extends XrayCommonClass {
|
class Inbound extends XrayCommonClass {
|
||||||
constructor(
|
constructor(
|
||||||
port = RandomUtil.randomInteger(10000, 60000),
|
port = RandomUtil.randomInteger(10000, 60000),
|
||||||
@@ -1057,7 +1049,6 @@ class Inbound extends XrayCommonClass {
|
|||||||
streamSettings = new StreamSettings(),
|
streamSettings = new StreamSettings(),
|
||||||
tag = '',
|
tag = '',
|
||||||
sniffing = new Sniffing(),
|
sniffing = new Sniffing(),
|
||||||
allocate = new Allocate(),
|
|
||||||
clientStats = '',
|
clientStats = '',
|
||||||
) {
|
) {
|
||||||
super();
|
super();
|
||||||
@@ -1068,7 +1059,6 @@ class Inbound extends XrayCommonClass {
|
|||||||
this.stream = streamSettings;
|
this.stream = streamSettings;
|
||||||
this.tag = tag;
|
this.tag = tag;
|
||||||
this.sniffing = sniffing;
|
this.sniffing = sniffing;
|
||||||
this.allocate = allocate;
|
|
||||||
this.clientStats = clientStats;
|
this.clientStats = clientStats;
|
||||||
}
|
}
|
||||||
getClientStats() {
|
getClientStats() {
|
||||||
@@ -1233,7 +1223,6 @@ class Inbound extends XrayCommonClass {
|
|||||||
this.stream = new StreamSettings();
|
this.stream = new StreamSettings();
|
||||||
this.tag = '';
|
this.tag = '';
|
||||||
this.sniffing = new Sniffing();
|
this.sniffing = new Sniffing();
|
||||||
this.allocate = new Allocate();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
genVmessLink(address = '', port = this.port, forceTls, remark = '', clientId, security) {
|
genVmessLink(address = '', port = this.port, forceTls, remark = '', clientId, security) {
|
||||||
@@ -1310,6 +1299,7 @@ class Inbound extends XrayCommonClass {
|
|||||||
const security = forceTls == 'same' ? this.stream.security : forceTls;
|
const security = forceTls == 'same' ? this.stream.security : forceTls;
|
||||||
const params = new Map();
|
const params = new Map();
|
||||||
params.set("type", this.stream.network);
|
params.set("type", this.stream.network);
|
||||||
|
params.set("encryption", this.settings.encryption);
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case "tcp":
|
case "tcp":
|
||||||
const tcp = this.stream.tcp;
|
const tcp = this.stream.tcp;
|
||||||
@@ -1366,6 +1356,9 @@ class Inbound extends XrayCommonClass {
|
|||||||
if (!ObjectUtil.isEmpty(this.stream.tls.sni)) {
|
if (!ObjectUtil.isEmpty(this.stream.tls.sni)) {
|
||||||
params.set("sni", this.stream.tls.sni);
|
params.set("sni", this.stream.tls.sni);
|
||||||
}
|
}
|
||||||
|
if (this.stream.tls.settings.echConfigList?.length > 0) {
|
||||||
|
params.set("ech", this.stream.tls.settings.echConfigList);
|
||||||
|
}
|
||||||
if (type == "tcp" && !ObjectUtil.isEmpty(flow)) {
|
if (type == "tcp" && !ObjectUtil.isEmpty(flow)) {
|
||||||
params.set("flow", flow);
|
params.set("flow", flow);
|
||||||
}
|
}
|
||||||
@@ -1385,6 +1378,9 @@ class Inbound extends XrayCommonClass {
|
|||||||
if (!ObjectUtil.isEmpty(this.stream.reality.settings.spiderX)) {
|
if (!ObjectUtil.isEmpty(this.stream.reality.settings.spiderX)) {
|
||||||
params.set("spx", this.stream.reality.settings.spiderX);
|
params.set("spx", this.stream.reality.settings.spiderX);
|
||||||
}
|
}
|
||||||
|
if (!ObjectUtil.isEmpty(this.stream.reality.settings.mldsa65Verify)) {
|
||||||
|
params.set("pqv", this.stream.reality.settings.mldsa65Verify);
|
||||||
|
}
|
||||||
if (type == 'tcp' && !ObjectUtil.isEmpty(flow)) {
|
if (type == 'tcp' && !ObjectUtil.isEmpty(flow)) {
|
||||||
params.set("flow", flow);
|
params.set("flow", flow);
|
||||||
}
|
}
|
||||||
@@ -1462,6 +1458,9 @@ class Inbound extends XrayCommonClass {
|
|||||||
if (this.stream.tls.settings.allowInsecure) {
|
if (this.stream.tls.settings.allowInsecure) {
|
||||||
params.set("allowInsecure", "1");
|
params.set("allowInsecure", "1");
|
||||||
}
|
}
|
||||||
|
if (this.stream.tls.settings.echConfigList?.length > 0) {
|
||||||
|
params.set("ech", this.stream.tls.settings.echConfigList);
|
||||||
|
}
|
||||||
if (!ObjectUtil.isEmpty(this.stream.tls.sni)) {
|
if (!ObjectUtil.isEmpty(this.stream.tls.sni)) {
|
||||||
params.set("sni", this.stream.tls.sni);
|
params.set("sni", this.stream.tls.sni);
|
||||||
}
|
}
|
||||||
@@ -1540,6 +1539,9 @@ class Inbound extends XrayCommonClass {
|
|||||||
if (this.stream.tls.settings.allowInsecure) {
|
if (this.stream.tls.settings.allowInsecure) {
|
||||||
params.set("allowInsecure", "1");
|
params.set("allowInsecure", "1");
|
||||||
}
|
}
|
||||||
|
if (this.stream.tls.settings.echConfigList?.length > 0) {
|
||||||
|
params.set("ech", this.stream.tls.settings.echConfigList);
|
||||||
|
}
|
||||||
if (!ObjectUtil.isEmpty(this.stream.tls.sni)) {
|
if (!ObjectUtil.isEmpty(this.stream.tls.sni)) {
|
||||||
params.set("sni", this.stream.tls.sni);
|
params.set("sni", this.stream.tls.sni);
|
||||||
}
|
}
|
||||||
@@ -1559,6 +1561,9 @@ class Inbound extends XrayCommonClass {
|
|||||||
if (!ObjectUtil.isEmpty(this.stream.reality.settings.spiderX)) {
|
if (!ObjectUtil.isEmpty(this.stream.reality.settings.spiderX)) {
|
||||||
params.set("spx", this.stream.reality.settings.spiderX);
|
params.set("spx", this.stream.reality.settings.spiderX);
|
||||||
}
|
}
|
||||||
|
if (!ObjectUtil.isEmpty(this.stream.reality.settings.mldsa65Verify)) {
|
||||||
|
params.set("pqv", this.stream.reality.settings.mldsa65Verify);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
@@ -1673,14 +1678,13 @@ class Inbound extends XrayCommonClass {
|
|||||||
StreamSettings.fromJson(json.streamSettings),
|
StreamSettings.fromJson(json.streamSettings),
|
||||||
json.tag,
|
json.tag,
|
||||||
Sniffing.fromJson(json.sniffing),
|
Sniffing.fromJson(json.sniffing),
|
||||||
Allocate.fromJson(json.allocate),
|
|
||||||
json.clientStats
|
json.clientStats
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
toJson() {
|
toJson() {
|
||||||
let streamSettings;
|
let streamSettings;
|
||||||
if (this.canEnableStream()) {
|
if (this.canEnableStream() || this.stream?.sockopt) {
|
||||||
streamSettings = this.stream.toJson();
|
streamSettings = this.stream.toJson();
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
@@ -1691,7 +1695,6 @@ class Inbound extends XrayCommonClass {
|
|||||||
streamSettings: streamSettings,
|
streamSettings: streamSettings,
|
||||||
tag: this.tag,
|
tag: this.tag,
|
||||||
sniffing: this.sniffing.toJson(),
|
sniffing: this.sniffing.toJson(),
|
||||||
allocate: this.allocate.toJson(),
|
|
||||||
clientStats: this.clientStats
|
clientStats: this.clientStats
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -1709,8 +1712,8 @@ Inbound.Settings = class extends XrayCommonClass {
|
|||||||
case Protocols.VLESS: return new Inbound.VLESSSettings(protocol);
|
case Protocols.VLESS: return new Inbound.VLESSSettings(protocol);
|
||||||
case Protocols.TROJAN: return new Inbound.TrojanSettings(protocol);
|
case Protocols.TROJAN: return new Inbound.TrojanSettings(protocol);
|
||||||
case Protocols.SHADOWSOCKS: return new Inbound.ShadowsocksSettings(protocol);
|
case Protocols.SHADOWSOCKS: return new Inbound.ShadowsocksSettings(protocol);
|
||||||
case Protocols.DOKODEMO: return new Inbound.DokodemoSettings(protocol);
|
case Protocols.TUNNEL: return new Inbound.TunnelSettings(protocol);
|
||||||
case Protocols.SOCKS: return new Inbound.SocksSettings(protocol);
|
case Protocols.MIXED: return new Inbound.MixedSettings(protocol);
|
||||||
case Protocols.HTTP: return new Inbound.HttpSettings(protocol);
|
case Protocols.HTTP: return new Inbound.HttpSettings(protocol);
|
||||||
case Protocols.WIREGUARD: return new Inbound.WireguardSettings(protocol);
|
case Protocols.WIREGUARD: return new Inbound.WireguardSettings(protocol);
|
||||||
default: return null;
|
default: return null;
|
||||||
@@ -1723,8 +1726,8 @@ Inbound.Settings = class extends XrayCommonClass {
|
|||||||
case Protocols.VLESS: return Inbound.VLESSSettings.fromJson(json);
|
case Protocols.VLESS: return Inbound.VLESSSettings.fromJson(json);
|
||||||
case Protocols.TROJAN: return Inbound.TrojanSettings.fromJson(json);
|
case Protocols.TROJAN: return Inbound.TrojanSettings.fromJson(json);
|
||||||
case Protocols.SHADOWSOCKS: return Inbound.ShadowsocksSettings.fromJson(json);
|
case Protocols.SHADOWSOCKS: return Inbound.ShadowsocksSettings.fromJson(json);
|
||||||
case Protocols.DOKODEMO: return Inbound.DokodemoSettings.fromJson(json);
|
case Protocols.TUNNEL: return Inbound.TunnelSettings.fromJson(json);
|
||||||
case Protocols.SOCKS: return Inbound.SocksSettings.fromJson(json);
|
case Protocols.MIXED: return Inbound.MixedSettings.fromJson(json);
|
||||||
case Protocols.HTTP: return Inbound.HttpSettings.fromJson(json);
|
case Protocols.HTTP: return Inbound.HttpSettings.fromJson(json);
|
||||||
case Protocols.WIREGUARD: return Inbound.WireguardSettings.fromJson(json);
|
case Protocols.WIREGUARD: return Inbound.WireguardSettings.fromJson(json);
|
||||||
default: return null;
|
default: return null;
|
||||||
@@ -1787,7 +1790,9 @@ Inbound.VmessSettings.VMESS = class extends XrayCommonClass {
|
|||||||
tgId = '',
|
tgId = '',
|
||||||
subId = RandomUtil.randomLowerAndNum(16),
|
subId = RandomUtil.randomLowerAndNum(16),
|
||||||
comment = '',
|
comment = '',
|
||||||
reset = 0
|
reset = 0,
|
||||||
|
created_at = undefined,
|
||||||
|
updated_at = undefined
|
||||||
) {
|
) {
|
||||||
super();
|
super();
|
||||||
this.id = id;
|
this.id = id;
|
||||||
@@ -1801,6 +1806,8 @@ Inbound.VmessSettings.VMESS = class extends XrayCommonClass {
|
|||||||
this.subId = subId;
|
this.subId = subId;
|
||||||
this.comment = comment;
|
this.comment = comment;
|
||||||
this.reset = reset;
|
this.reset = reset;
|
||||||
|
this.created_at = created_at;
|
||||||
|
this.updated_at = updated_at;
|
||||||
}
|
}
|
||||||
|
|
||||||
static fromJson(json = {}) {
|
static fromJson(json = {}) {
|
||||||
@@ -1816,6 +1823,8 @@ Inbound.VmessSettings.VMESS = class extends XrayCommonClass {
|
|||||||
json.subId,
|
json.subId,
|
||||||
json.comment,
|
json.comment,
|
||||||
json.reset,
|
json.reset,
|
||||||
|
json.created_at,
|
||||||
|
json.updated_at,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
get _expiryTime() {
|
get _expiryTime() {
|
||||||
@@ -1849,13 +1858,17 @@ Inbound.VLESSSettings = class extends Inbound.Settings {
|
|||||||
constructor(
|
constructor(
|
||||||
protocol,
|
protocol,
|
||||||
vlesses = [new Inbound.VLESSSettings.VLESS()],
|
vlesses = [new Inbound.VLESSSettings.VLESS()],
|
||||||
decryption = 'none',
|
decryption = "none",
|
||||||
fallbacks = []
|
encryption = "none",
|
||||||
|
fallbacks = [],
|
||||||
|
selectedAuth = undefined,
|
||||||
) {
|
) {
|
||||||
super(protocol);
|
super(protocol);
|
||||||
this.vlesses = vlesses;
|
this.vlesses = vlesses;
|
||||||
this.decryption = decryption;
|
this.decryption = decryption;
|
||||||
|
this.encryption = encryption;
|
||||||
this.fallbacks = fallbacks;
|
this.fallbacks = fallbacks;
|
||||||
|
this.selectedAuth = selectedAuth;
|
||||||
}
|
}
|
||||||
|
|
||||||
addFallback() {
|
addFallback() {
|
||||||
@@ -1866,22 +1879,43 @@ Inbound.VLESSSettings = class extends Inbound.Settings {
|
|||||||
this.fallbacks.splice(index, 1);
|
this.fallbacks.splice(index, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// decryption should be set to static value
|
|
||||||
static fromJson(json = {}) {
|
static fromJson(json = {}) {
|
||||||
return new Inbound.VLESSSettings(
|
const obj = new Inbound.VLESSSettings(
|
||||||
Protocols.VLESS,
|
Protocols.VLESS,
|
||||||
json.clients.map(client => Inbound.VLESSSettings.VLESS.fromJson(client)),
|
(json.clients || []).map(client => Inbound.VLESSSettings.VLESS.fromJson(client)),
|
||||||
json.decryption || 'none',
|
json.decryption,
|
||||||
Inbound.VLESSSettings.Fallback.fromJson(json.fallbacks),);
|
json.encryption,
|
||||||
|
Inbound.VLESSSettings.Fallback.fromJson(json.fallbacks || []),
|
||||||
|
json.selectedAuth
|
||||||
|
);
|
||||||
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
toJson() {
|
toJson() {
|
||||||
return {
|
const json = {
|
||||||
clients: Inbound.VLESSSettings.toJsonArray(this.vlesses),
|
clients: Inbound.VLESSSettings.toJsonArray(this.vlesses),
|
||||||
decryption: this.decryption,
|
|
||||||
fallbacks: Inbound.VLESSSettings.toJsonArray(this.fallbacks),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (this.decryption) {
|
||||||
|
json.decryption = this.decryption;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.encryption) {
|
||||||
|
json.encryption = this.encryption;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.fallbacks && this.fallbacks.length > 0) {
|
||||||
|
json.fallbacks = Inbound.VLESSSettings.toJsonArray(this.fallbacks);
|
||||||
|
}
|
||||||
|
if (this.selectedAuth) {
|
||||||
|
json.selectedAuth = this.selectedAuth;
|
||||||
|
}
|
||||||
|
|
||||||
|
return json;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Inbound.VLESSSettings.VLESS = class extends XrayCommonClass {
|
Inbound.VLESSSettings.VLESS = class extends XrayCommonClass {
|
||||||
@@ -1896,7 +1930,9 @@ Inbound.VLESSSettings.VLESS = class extends XrayCommonClass {
|
|||||||
tgId = '',
|
tgId = '',
|
||||||
subId = RandomUtil.randomLowerAndNum(16),
|
subId = RandomUtil.randomLowerAndNum(16),
|
||||||
comment = '',
|
comment = '',
|
||||||
reset = 0
|
reset = 0,
|
||||||
|
created_at = undefined,
|
||||||
|
updated_at = undefined
|
||||||
) {
|
) {
|
||||||
super();
|
super();
|
||||||
this.id = id;
|
this.id = id;
|
||||||
@@ -1910,6 +1946,8 @@ Inbound.VLESSSettings.VLESS = class extends XrayCommonClass {
|
|||||||
this.subId = subId;
|
this.subId = subId;
|
||||||
this.comment = comment;
|
this.comment = comment;
|
||||||
this.reset = reset;
|
this.reset = reset;
|
||||||
|
this.created_at = created_at;
|
||||||
|
this.updated_at = updated_at;
|
||||||
}
|
}
|
||||||
|
|
||||||
static fromJson(json = {}) {
|
static fromJson(json = {}) {
|
||||||
@@ -1925,6 +1963,8 @@ Inbound.VLESSSettings.VLESS = class extends XrayCommonClass {
|
|||||||
json.subId,
|
json.subId,
|
||||||
json.comment,
|
json.comment,
|
||||||
json.reset,
|
json.reset,
|
||||||
|
json.created_at,
|
||||||
|
json.updated_at,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2035,7 +2075,9 @@ Inbound.TrojanSettings.Trojan = class extends XrayCommonClass {
|
|||||||
tgId = '',
|
tgId = '',
|
||||||
subId = RandomUtil.randomLowerAndNum(16),
|
subId = RandomUtil.randomLowerAndNum(16),
|
||||||
comment = '',
|
comment = '',
|
||||||
reset = 0
|
reset = 0,
|
||||||
|
created_at = undefined,
|
||||||
|
updated_at = undefined
|
||||||
) {
|
) {
|
||||||
super();
|
super();
|
||||||
this.password = password;
|
this.password = password;
|
||||||
@@ -2048,6 +2090,8 @@ Inbound.TrojanSettings.Trojan = class extends XrayCommonClass {
|
|||||||
this.subId = subId;
|
this.subId = subId;
|
||||||
this.comment = comment;
|
this.comment = comment;
|
||||||
this.reset = reset;
|
this.reset = reset;
|
||||||
|
this.created_at = created_at;
|
||||||
|
this.updated_at = updated_at;
|
||||||
}
|
}
|
||||||
|
|
||||||
toJson() {
|
toJson() {
|
||||||
@@ -2062,6 +2106,8 @@ Inbound.TrojanSettings.Trojan = class extends XrayCommonClass {
|
|||||||
subId: this.subId,
|
subId: this.subId,
|
||||||
comment: this.comment,
|
comment: this.comment,
|
||||||
reset: this.reset,
|
reset: this.reset,
|
||||||
|
created_at: this.created_at,
|
||||||
|
updated_at: this.updated_at,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2077,6 +2123,8 @@ Inbound.TrojanSettings.Trojan = class extends XrayCommonClass {
|
|||||||
json.subId,
|
json.subId,
|
||||||
json.comment,
|
json.comment,
|
||||||
json.reset,
|
json.reset,
|
||||||
|
json.created_at,
|
||||||
|
json.updated_at,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2196,7 +2244,9 @@ Inbound.ShadowsocksSettings.Shadowsocks = class extends XrayCommonClass {
|
|||||||
tgId = '',
|
tgId = '',
|
||||||
subId = RandomUtil.randomLowerAndNum(16),
|
subId = RandomUtil.randomLowerAndNum(16),
|
||||||
comment = '',
|
comment = '',
|
||||||
reset = 0
|
reset = 0,
|
||||||
|
created_at = undefined,
|
||||||
|
updated_at = undefined
|
||||||
) {
|
) {
|
||||||
super();
|
super();
|
||||||
this.method = method;
|
this.method = method;
|
||||||
@@ -2210,6 +2260,8 @@ Inbound.ShadowsocksSettings.Shadowsocks = class extends XrayCommonClass {
|
|||||||
this.subId = subId;
|
this.subId = subId;
|
||||||
this.comment = comment;
|
this.comment = comment;
|
||||||
this.reset = reset;
|
this.reset = reset;
|
||||||
|
this.created_at = created_at;
|
||||||
|
this.updated_at = updated_at;
|
||||||
}
|
}
|
||||||
|
|
||||||
toJson() {
|
toJson() {
|
||||||
@@ -2225,6 +2277,8 @@ Inbound.ShadowsocksSettings.Shadowsocks = class extends XrayCommonClass {
|
|||||||
subId: this.subId,
|
subId: this.subId,
|
||||||
comment: this.comment,
|
comment: this.comment,
|
||||||
reset: this.reset,
|
reset: this.reset,
|
||||||
|
created_at: this.created_at,
|
||||||
|
updated_at: this.updated_at,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2241,6 +2295,8 @@ Inbound.ShadowsocksSettings.Shadowsocks = class extends XrayCommonClass {
|
|||||||
json.subId,
|
json.subId,
|
||||||
json.comment,
|
json.comment,
|
||||||
json.reset,
|
json.reset,
|
||||||
|
json.created_at,
|
||||||
|
json.updated_at,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2271,26 +2327,29 @@ Inbound.ShadowsocksSettings.Shadowsocks = class extends XrayCommonClass {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Inbound.DokodemoSettings = class extends Inbound.Settings {
|
Inbound.TunnelSettings = class extends Inbound.Settings {
|
||||||
constructor(
|
constructor(
|
||||||
protocol,
|
protocol,
|
||||||
address,
|
address,
|
||||||
port,
|
port,
|
||||||
|
portMap = [],
|
||||||
network = 'tcp,udp',
|
network = 'tcp,udp',
|
||||||
followRedirect = false
|
followRedirect = false
|
||||||
) {
|
) {
|
||||||
super(protocol);
|
super(protocol);
|
||||||
this.address = address;
|
this.address = address;
|
||||||
this.port = port;
|
this.port = port;
|
||||||
|
this.portMap = portMap;
|
||||||
this.network = network;
|
this.network = network;
|
||||||
this.followRedirect = followRedirect;
|
this.followRedirect = followRedirect;
|
||||||
}
|
}
|
||||||
|
|
||||||
static fromJson(json = {}) {
|
static fromJson(json = {}) {
|
||||||
return new Inbound.DokodemoSettings(
|
return new Inbound.TunnelSettings(
|
||||||
Protocols.DOKODEMO,
|
Protocols.TUNNEL,
|
||||||
json.address,
|
json.address,
|
||||||
json.port,
|
json.port,
|
||||||
|
XrayCommonClass.toHeaders(json.portMap),
|
||||||
json.network,
|
json.network,
|
||||||
json.followRedirect,
|
json.followRedirect,
|
||||||
);
|
);
|
||||||
@@ -2300,14 +2359,15 @@ Inbound.DokodemoSettings = class extends Inbound.Settings {
|
|||||||
return {
|
return {
|
||||||
address: this.address,
|
address: this.address,
|
||||||
port: this.port,
|
port: this.port,
|
||||||
|
portMap: XrayCommonClass.toV2Headers(this.portMap, false),
|
||||||
network: this.network,
|
network: this.network,
|
||||||
followRedirect: this.followRedirect,
|
followRedirect: this.followRedirect,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Inbound.SocksSettings = class extends Inbound.Settings {
|
Inbound.MixedSettings = class extends Inbound.Settings {
|
||||||
constructor(protocol, auth = 'password', accounts = [new Inbound.SocksSettings.SocksAccount()], udp = false, ip = '127.0.0.1') {
|
constructor(protocol, auth = 'password', accounts = [new Inbound.MixedSettings.SocksAccount()], udp = false, ip = '127.0.0.1') {
|
||||||
super(protocol);
|
super(protocol);
|
||||||
this.auth = auth;
|
this.auth = auth;
|
||||||
this.accounts = accounts;
|
this.accounts = accounts;
|
||||||
@@ -2327,11 +2387,11 @@ Inbound.SocksSettings = class extends Inbound.Settings {
|
|||||||
let accounts;
|
let accounts;
|
||||||
if (json.auth === 'password') {
|
if (json.auth === 'password') {
|
||||||
accounts = json.accounts.map(
|
accounts = json.accounts.map(
|
||||||
account => Inbound.SocksSettings.SocksAccount.fromJson(account)
|
account => Inbound.MixedSettings.SocksAccount.fromJson(account)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
return new Inbound.SocksSettings(
|
return new Inbound.MixedSettings(
|
||||||
Protocols.SOCKS,
|
Protocols.MIXED,
|
||||||
json.auth,
|
json.auth,
|
||||||
accounts,
|
accounts,
|
||||||
json.udp,
|
json.udp,
|
||||||
@@ -2348,7 +2408,7 @@ Inbound.SocksSettings = class extends Inbound.Settings {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Inbound.SocksSettings.SocksAccount = class extends XrayCommonClass {
|
Inbound.MixedSettings.SocksAccount = class extends XrayCommonClass {
|
||||||
constructor(user = RandomUtil.randomSeq(10), pass = RandomUtil.randomSeq(10)) {
|
constructor(user = RandomUtil.randomSeq(10), pass = RandomUtil.randomSeq(10)) {
|
||||||
super();
|
super();
|
||||||
this.user = user;
|
this.user = user;
|
||||||
@@ -2356,7 +2416,7 @@ Inbound.SocksSettings.SocksAccount = class extends XrayCommonClass {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static fromJson(json = {}) {
|
static fromJson(json = {}) {
|
||||||
return new Inbound.SocksSettings.SocksAccount(json.user, json.pass);
|
return new Inbound.MixedSettings.SocksAccount(json.user, json.pass);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -219,7 +219,7 @@ class KcpStreamSettings extends CommonClass {
|
|||||||
|
|
||||||
class WsStreamSettings extends CommonClass {
|
class WsStreamSettings extends CommonClass {
|
||||||
constructor(
|
constructor(
|
||||||
path = '/',
|
path = '/',
|
||||||
host = '',
|
host = '',
|
||||||
heartbeatPeriod = 0,
|
heartbeatPeriod = 0,
|
||||||
|
|
||||||
@@ -354,13 +354,15 @@ class TlsStreamSettings extends CommonClass {
|
|||||||
serverName = '',
|
serverName = '',
|
||||||
alpn = [],
|
alpn = [],
|
||||||
fingerprint = '',
|
fingerprint = '',
|
||||||
allowInsecure = false
|
allowInsecure = false,
|
||||||
|
echConfigList = '',
|
||||||
) {
|
) {
|
||||||
super();
|
super();
|
||||||
this.serverName = serverName;
|
this.serverName = serverName;
|
||||||
this.alpn = alpn;
|
this.alpn = alpn;
|
||||||
this.fingerprint = fingerprint;
|
this.fingerprint = fingerprint;
|
||||||
this.allowInsecure = allowInsecure;
|
this.allowInsecure = allowInsecure;
|
||||||
|
this.echConfigList = echConfigList;
|
||||||
}
|
}
|
||||||
|
|
||||||
static fromJson(json = {}) {
|
static fromJson(json = {}) {
|
||||||
@@ -369,6 +371,7 @@ class TlsStreamSettings extends CommonClass {
|
|||||||
json.alpn,
|
json.alpn,
|
||||||
json.fingerprint,
|
json.fingerprint,
|
||||||
json.allowInsecure,
|
json.allowInsecure,
|
||||||
|
json.echConfigList,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -378,6 +381,7 @@ class TlsStreamSettings extends CommonClass {
|
|||||||
alpn: this.alpn,
|
alpn: this.alpn,
|
||||||
fingerprint: this.fingerprint,
|
fingerprint: this.fingerprint,
|
||||||
allowInsecure: this.allowInsecure,
|
allowInsecure: this.allowInsecure,
|
||||||
|
echConfigList: this.echConfigList
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -388,7 +392,8 @@ class RealityStreamSettings extends CommonClass {
|
|||||||
fingerprint = '',
|
fingerprint = '',
|
||||||
serverName = '',
|
serverName = '',
|
||||||
shortId = '',
|
shortId = '',
|
||||||
spiderX = '/'
|
spiderX = '',
|
||||||
|
mldsa65Verify = ''
|
||||||
) {
|
) {
|
||||||
super();
|
super();
|
||||||
this.publicKey = publicKey;
|
this.publicKey = publicKey;
|
||||||
@@ -396,6 +401,7 @@ class RealityStreamSettings extends CommonClass {
|
|||||||
this.serverName = serverName;
|
this.serverName = serverName;
|
||||||
this.shortId = shortId
|
this.shortId = shortId
|
||||||
this.spiderX = spiderX;
|
this.spiderX = spiderX;
|
||||||
|
this.mldsa65Verify = mldsa65Verify;
|
||||||
}
|
}
|
||||||
static fromJson(json = {}) {
|
static fromJson(json = {}) {
|
||||||
return new RealityStreamSettings(
|
return new RealityStreamSettings(
|
||||||
@@ -404,6 +410,7 @@ class RealityStreamSettings extends CommonClass {
|
|||||||
json.serverName,
|
json.serverName,
|
||||||
json.shortId,
|
json.shortId,
|
||||||
json.spiderX,
|
json.spiderX,
|
||||||
|
json.mldsa65Verify
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
toJson() {
|
toJson() {
|
||||||
@@ -413,6 +420,7 @@ class RealityStreamSettings extends CommonClass {
|
|||||||
serverName: this.serverName,
|
serverName: this.serverName,
|
||||||
shortId: this.shortId,
|
shortId: this.shortId,
|
||||||
spiderX: this.spiderX,
|
spiderX: this.spiderX,
|
||||||
|
mldsa65Verify: this.mldsa65Verify
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -639,10 +647,6 @@ class Outbound extends CommonClass {
|
|||||||
].includes(this.protocol);
|
].includes(this.protocol);
|
||||||
}
|
}
|
||||||
|
|
||||||
hasVnext() {
|
|
||||||
return [Protocols.VMess, Protocols.VLESS].includes(this.protocol);
|
|
||||||
}
|
|
||||||
|
|
||||||
hasServers() {
|
hasServers() {
|
||||||
return [Protocols.Trojan, Protocols.Shadowsocks, Protocols.Socks, Protocols.HTTP].includes(this.protocol);
|
return [Protocols.Trojan, Protocols.Shadowsocks, Protocols.Socks, Protocols.HTTP].includes(this.protocol);
|
||||||
}
|
}
|
||||||
@@ -682,13 +686,15 @@ class Outbound extends CommonClass {
|
|||||||
if (this.stream?.sockopt)
|
if (this.stream?.sockopt)
|
||||||
stream = { sockopt: this.stream.sockopt.toJson() };
|
stream = { sockopt: this.stream.sockopt.toJson() };
|
||||||
}
|
}
|
||||||
|
let settingsOut = this.settings instanceof CommonClass ? this.settings.toJson() : this.settings;
|
||||||
return {
|
return {
|
||||||
tag: this.tag == '' ? undefined : this.tag,
|
|
||||||
protocol: this.protocol,
|
protocol: this.protocol,
|
||||||
settings: this.settings instanceof CommonClass ? this.settings.toJson() : this.settings,
|
settings: settingsOut,
|
||||||
streamSettings: stream,
|
// Only include tag, streamSettings, sendThrough, mux if present and not empty
|
||||||
sendThrough: this.sendThrough != "" ? this.sendThrough : undefined,
|
...(this.tag ? { tag: this.tag } : {}),
|
||||||
mux: this.mux?.enabled ? this.mux : undefined,
|
...(stream ? { streamSettings: stream } : {}),
|
||||||
|
...(this.sendThrough ? { sendThrough: this.sendThrough } : {}),
|
||||||
|
...(this.mux?.enabled ? { mux: this.mux } : {}),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -778,7 +784,8 @@ class Outbound extends CommonClass {
|
|||||||
let alpn = url.searchParams.get('alpn');
|
let alpn = url.searchParams.get('alpn');
|
||||||
let allowInsecure = url.searchParams.get('allowInsecure');
|
let allowInsecure = url.searchParams.get('allowInsecure');
|
||||||
let sni = url.searchParams.get('sni') ?? '';
|
let sni = url.searchParams.get('sni') ?? '';
|
||||||
stream.tls = new TlsStreamSettings(sni, alpn ? alpn.split(',') : [], fp, allowInsecure == 1);
|
let ech = url.searchParams.get('ech') ?? '';
|
||||||
|
stream.tls = new TlsStreamSettings(sni, alpn ? alpn.split(',') : [], fp, allowInsecure == 1, ech);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (security == 'reality') {
|
if (security == 'reality') {
|
||||||
@@ -787,7 +794,8 @@ class Outbound extends CommonClass {
|
|||||||
let sni = url.searchParams.get('sni') ?? '';
|
let sni = url.searchParams.get('sni') ?? '';
|
||||||
let sid = url.searchParams.get('sid') ?? '';
|
let sid = url.searchParams.get('sid') ?? '';
|
||||||
let spx = url.searchParams.get('spx') ?? '';
|
let spx = url.searchParams.get('spx') ?? '';
|
||||||
stream.reality = new RealityStreamSettings(pbk, fp, sni, sid, spx);
|
let pqv = url.searchParams.get('pqv') ?? '';
|
||||||
|
stream.reality = new RealityStreamSettings(pbk, fp, sni, sid, spx, pqv);
|
||||||
}
|
}
|
||||||
|
|
||||||
const regex = /([^@]+):\/\/([^@]+)@(.+):(\d+)(.*)$/;
|
const regex = /([^@]+):\/\/([^@]+)@(.+):(\d+)(.*)$/;
|
||||||
@@ -803,7 +811,7 @@ class Outbound extends CommonClass {
|
|||||||
var settings;
|
var settings;
|
||||||
switch (protocol) {
|
switch (protocol) {
|
||||||
case Protocols.VLESS:
|
case Protocols.VLESS:
|
||||||
settings = new Outbound.VLESSSettings(address, port, userData, url.searchParams.get('flow') ?? '');
|
settings = new Outbound.VLESSSettings(address, port, userData, url.searchParams.get('flow') ?? '', url.searchParams.get('encryption') ?? 'none');
|
||||||
break;
|
break;
|
||||||
case Protocols.Trojan:
|
case Protocols.Trojan:
|
||||||
settings = new Outbound.TrojanSettings(address, port, userData);
|
settings = new Outbound.TrojanSettings(address, port, userData);
|
||||||
@@ -898,7 +906,7 @@ Outbound.FreedomSettings = class extends CommonClass {
|
|||||||
toJson() {
|
toJson() {
|
||||||
return {
|
return {
|
||||||
domainStrategy: ObjectUtil.isEmpty(this.domainStrategy) ? undefined : this.domainStrategy,
|
domainStrategy: ObjectUtil.isEmpty(this.domainStrategy) ? undefined : this.domainStrategy,
|
||||||
redirect: ObjectUtil.isEmpty(this.redirect) ? undefined: this.redirect,
|
redirect: ObjectUtil.isEmpty(this.redirect) ? undefined : this.redirect,
|
||||||
fragment: Object.keys(this.fragment).length === 0 ? undefined : this.fragment,
|
fragment: Object.keys(this.fragment).length === 0 ? undefined : this.fragment,
|
||||||
noises: this.noises.length === 0 ? undefined : Outbound.FreedomSettings.Noise.toJsonArray(this.noises),
|
noises: this.noises.length === 0 ? undefined : Outbound.FreedomSettings.Noise.toJsonArray(this.noises),
|
||||||
};
|
};
|
||||||
@@ -909,12 +917,14 @@ Outbound.FreedomSettings.Fragment = class extends CommonClass {
|
|||||||
constructor(
|
constructor(
|
||||||
packets = '1-3',
|
packets = '1-3',
|
||||||
length = '',
|
length = '',
|
||||||
interval = ''
|
interval = '',
|
||||||
|
maxSplit = ''
|
||||||
) {
|
) {
|
||||||
super();
|
super();
|
||||||
this.packets = packets;
|
this.packets = packets;
|
||||||
this.length = length;
|
this.length = length;
|
||||||
this.interval = interval;
|
this.interval = interval;
|
||||||
|
this.maxSplit = maxSplit;
|
||||||
}
|
}
|
||||||
|
|
||||||
static fromJson(json = {}) {
|
static fromJson(json = {}) {
|
||||||
@@ -922,6 +932,7 @@ Outbound.FreedomSettings.Fragment = class extends CommonClass {
|
|||||||
json.packets,
|
json.packets,
|
||||||
json.length,
|
json.length,
|
||||||
json.interval,
|
json.interval,
|
||||||
|
json.maxSplit
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -930,12 +941,14 @@ Outbound.FreedomSettings.Noise = class extends CommonClass {
|
|||||||
constructor(
|
constructor(
|
||||||
type = 'rand',
|
type = 'rand',
|
||||||
packet = '10-20',
|
packet = '10-20',
|
||||||
delay = '10-16'
|
delay = '10-16',
|
||||||
|
applyTo = 'ip'
|
||||||
) {
|
) {
|
||||||
super();
|
super();
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.packet = packet;
|
this.packet = packet;
|
||||||
this.delay = delay;
|
this.delay = delay;
|
||||||
|
this.applyTo = applyTo;
|
||||||
}
|
}
|
||||||
|
|
||||||
static fromJson(json = {}) {
|
static fromJson(json = {}) {
|
||||||
@@ -943,6 +956,7 @@ Outbound.FreedomSettings.Noise = class extends CommonClass {
|
|||||||
json.type,
|
json.type,
|
||||||
json.packet,
|
json.packet,
|
||||||
json.delay,
|
json.delay,
|
||||||
|
json.applyTo
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -951,6 +965,7 @@ Outbound.FreedomSettings.Noise = class extends CommonClass {
|
|||||||
type: this.type,
|
type: this.type,
|
||||||
packet: this.packet,
|
packet: this.packet,
|
||||||
delay: this.delay,
|
delay: this.delay,
|
||||||
|
applyTo: this.applyTo
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -978,7 +993,7 @@ Outbound.DNSSettings = class extends CommonClass {
|
|||||||
network = 'udp',
|
network = 'udp',
|
||||||
address = '',
|
address = '',
|
||||||
port = 53,
|
port = 53,
|
||||||
nonIPQuery = 'drop',
|
nonIPQuery = 'reject',
|
||||||
blockTypes = []
|
blockTypes = []
|
||||||
) {
|
) {
|
||||||
super();
|
super();
|
||||||
@@ -1009,13 +1024,16 @@ Outbound.VmessSettings = class extends CommonClass {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static fromJson(json = {}) {
|
static fromJson(json = {}) {
|
||||||
if (ObjectUtil.isArrEmpty(json.vnext)) return new Outbound.VmessSettings();
|
if (!ObjectUtil.isArrEmpty(json.vnext)) {
|
||||||
return new Outbound.VmessSettings(
|
const v = json.vnext[0] || {};
|
||||||
json.vnext[0].address,
|
const u = ObjectUtil.isArrEmpty(v.users) ? {} : v.users[0];
|
||||||
json.vnext[0].port,
|
return new Outbound.VmessSettings(
|
||||||
json.vnext[0].users[0].id,
|
v.address,
|
||||||
json.vnext[0].users[0].security,
|
v.port,
|
||||||
);
|
u.id,
|
||||||
|
u.security,
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
toJson() {
|
toJson() {
|
||||||
@@ -1023,39 +1041,42 @@ Outbound.VmessSettings = class extends CommonClass {
|
|||||||
vnext: [{
|
vnext: [{
|
||||||
address: this.address,
|
address: this.address,
|
||||||
port: this.port,
|
port: this.port,
|
||||||
users: [{ id: this.id, security: this.security }],
|
users: [{
|
||||||
}],
|
id: this.id,
|
||||||
|
security: this.security
|
||||||
|
}]
|
||||||
|
}]
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Outbound.VLESSSettings = class extends CommonClass {
|
Outbound.VLESSSettings = class extends CommonClass {
|
||||||
constructor(address, port, id, flow, encryption = 'none') {
|
constructor(address, port, id, flow, encryption) {
|
||||||
super();
|
super();
|
||||||
this.address = address;
|
this.address = address;
|
||||||
this.port = port;
|
this.port = port;
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.flow = flow;
|
this.flow = flow;
|
||||||
this.encryption = encryption
|
this.encryption = encryption;
|
||||||
}
|
}
|
||||||
|
|
||||||
static fromJson(json = {}) {
|
static fromJson(json = {}) {
|
||||||
if (ObjectUtil.isArrEmpty(json.vnext)) return new Outbound.VLESSSettings();
|
if (ObjectUtil.isEmpty(json.address) || ObjectUtil.isEmpty(json.port)) return new Outbound.VLESSSettings();
|
||||||
return new Outbound.VLESSSettings(
|
return new Outbound.VLESSSettings(
|
||||||
json.vnext[0].address,
|
json.address,
|
||||||
json.vnext[0].port,
|
json.port,
|
||||||
json.vnext[0].users[0].id,
|
json.id,
|
||||||
json.vnext[0].users[0].flow,
|
json.flow,
|
||||||
json.vnext[0].users[0].encryption,
|
json.encryption
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
toJson() {
|
toJson() {
|
||||||
return {
|
return {
|
||||||
vnext: [{
|
address: this.address,
|
||||||
address: this.address,
|
port: this.port,
|
||||||
port: this.port,
|
id: this.id,
|
||||||
users: [{ id: this.id, flow: this.flow, encryption: 'none', }],
|
flow: this.flow,
|
||||||
}],
|
encryption: this.encryption,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ class AllSetting {
|
|||||||
this.webCertFile = "";
|
this.webCertFile = "";
|
||||||
this.webKeyFile = "";
|
this.webKeyFile = "";
|
||||||
this.webBasePath = "/";
|
this.webBasePath = "/";
|
||||||
this.sessionMaxAge = 60;
|
this.sessionMaxAge = 360;
|
||||||
this.pageSize = 50;
|
this.pageSize = 25;
|
||||||
this.expireDiff = 0;
|
this.expireDiff = 0;
|
||||||
this.trafficDiff = 0;
|
this.trafficDiff = 0;
|
||||||
this.remarkModel = "-ieo";
|
this.remarkModel = "-ieo";
|
||||||
@@ -26,7 +26,8 @@ class AllSetting {
|
|||||||
this.twoFactorEnable = false;
|
this.twoFactorEnable = false;
|
||||||
this.twoFactorToken = "";
|
this.twoFactorToken = "";
|
||||||
this.xrayTemplateConfig = "";
|
this.xrayTemplateConfig = "";
|
||||||
this.subEnable = false;
|
this.subEnable = true;
|
||||||
|
this.subJsonEnable = false;
|
||||||
this.subTitle = "";
|
this.subTitle = "";
|
||||||
this.subListen = "";
|
this.subListen = "";
|
||||||
this.subPort = 2096;
|
this.subPort = 2096;
|
||||||
|
|||||||
157
web/assets/js/subscription.js
Normal file
157
web/assets/js/subscription.js
Normal file
@@ -0,0 +1,157 @@
|
|||||||
|
(function () {
|
||||||
|
// Vue app for Subscription page
|
||||||
|
const el = document.getElementById('subscription-data');
|
||||||
|
if (!el) return;
|
||||||
|
const textarea = document.getElementById('subscription-links');
|
||||||
|
const rawLinks = (textarea?.value || '').split('\n').filter(Boolean);
|
||||||
|
|
||||||
|
const data = {
|
||||||
|
sId: el.getAttribute('data-sid') || '',
|
||||||
|
subUrl: el.getAttribute('data-sub-url') || '',
|
||||||
|
subJsonUrl: el.getAttribute('data-subjson-url') || '',
|
||||||
|
download: el.getAttribute('data-download') || '',
|
||||||
|
upload: el.getAttribute('data-upload') || '',
|
||||||
|
used: el.getAttribute('data-used') || '',
|
||||||
|
total: el.getAttribute('data-total') || '',
|
||||||
|
remained: el.getAttribute('data-remained') || '',
|
||||||
|
expireMs: (parseInt(el.getAttribute('data-expire') || '0', 10) || 0) * 1000,
|
||||||
|
lastOnlineMs: (parseInt(el.getAttribute('data-lastonline') || '0', 10) || 0),
|
||||||
|
downloadByte: parseInt(el.getAttribute('data-downloadbyte') || '0', 10) || 0,
|
||||||
|
uploadByte: parseInt(el.getAttribute('data-uploadbyte') || '0', 10) || 0,
|
||||||
|
totalByte: parseInt(el.getAttribute('data-totalbyte') || '0', 10) || 0,
|
||||||
|
datepicker: el.getAttribute('data-datepicker') || 'gregorian',
|
||||||
|
};
|
||||||
|
|
||||||
|
// Normalize lastOnline to milliseconds if it looks like seconds
|
||||||
|
if (data.lastOnlineMs && data.lastOnlineMs < 10_000_000_000) {
|
||||||
|
data.lastOnlineMs *= 1000;
|
||||||
|
}
|
||||||
|
|
||||||
|
function renderLink(item) {
|
||||||
|
return (
|
||||||
|
Vue.h('a-list-item', {}, [
|
||||||
|
Vue.h('a-space', { props: { size: 'small' } }, [
|
||||||
|
Vue.h('a-button', { props: { size: 'small' }, on: { click: () => copy(item) } }, [Vue.h('a-icon', { props: { type: 'copy' } })]),
|
||||||
|
Vue.h('span', { class: 'break-all' }, item)
|
||||||
|
])
|
||||||
|
])
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function copy(text) {
|
||||||
|
ClipboardManager.copyText(text).then(ok => {
|
||||||
|
const messageType = ok ? 'success' : 'error';
|
||||||
|
Vue.prototype.$message[messageType](ok ? 'Copied' : 'Copy failed');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function open(url) {
|
||||||
|
window.location.href = url;
|
||||||
|
}
|
||||||
|
|
||||||
|
function drawQR(value) {
|
||||||
|
try {
|
||||||
|
new QRious({ element: document.getElementById('qrcode'), value, size: 220 });
|
||||||
|
} catch (e) {
|
||||||
|
console.warn(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Try to extract a human label (email/ps) from different link types
|
||||||
|
function linkName(link, idx) {
|
||||||
|
try {
|
||||||
|
if (link.startsWith('vmess://')) {
|
||||||
|
const json = JSON.parse(atob(link.replace('vmess://', '')));
|
||||||
|
if (json.ps) return json.ps;
|
||||||
|
if (json.add && json.id) return json.add; // fallback host
|
||||||
|
} else if (link.startsWith('vless://') || link.startsWith('trojan://')) {
|
||||||
|
const hashIdx = link.indexOf('#');
|
||||||
|
if (hashIdx !== -1) return decodeURIComponent(link.substring(hashIdx + 1));
|
||||||
|
const qIdx = link.indexOf('?');
|
||||||
|
if (qIdx !== -1) {
|
||||||
|
const qs = new URL('http://x/?' + link.substring(qIdx + 1, hashIdx !== -1 ? hashIdx : undefined)).searchParams;
|
||||||
|
if (qs.get('remark')) return qs.get('remark');
|
||||||
|
if (qs.get('email')) return qs.get('email');
|
||||||
|
}
|
||||||
|
const at = link.indexOf('@');
|
||||||
|
const protSep = link.indexOf('://');
|
||||||
|
if (at !== -1 && protSep !== -1) return link.substring(protSep + 3, at);
|
||||||
|
} else if (link.startsWith('ss://')) {
|
||||||
|
const hashIdx = link.indexOf('#');
|
||||||
|
if (hashIdx !== -1) return decodeURIComponent(link.substring(hashIdx + 1));
|
||||||
|
}
|
||||||
|
} catch (e) { /* ignore and fallback */ }
|
||||||
|
return 'Link ' + (idx + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
const app = new Vue({
|
||||||
|
delimiters: ['[[', ']]'],
|
||||||
|
el: '#app',
|
||||||
|
data: {
|
||||||
|
themeSwitcher,
|
||||||
|
app: data,
|
||||||
|
links: rawLinks,
|
||||||
|
lang: '',
|
||||||
|
viewportWidth: (typeof window !== 'undefined' ? window.innerWidth : 1024),
|
||||||
|
},
|
||||||
|
async mounted() {
|
||||||
|
this.lang = LanguageManager.getLanguage();
|
||||||
|
const tpl = document.getElementById('subscription-data');
|
||||||
|
const sj = tpl ? tpl.getAttribute('data-subjson-url') : '';
|
||||||
|
if (sj) this.app.subJsonUrl = sj;
|
||||||
|
drawQR(this.app.subUrl);
|
||||||
|
try {
|
||||||
|
const elJson = document.getElementById('qrcode-subjson');
|
||||||
|
if (elJson && this.app.subJsonUrl) {
|
||||||
|
new QRious({ element: elJson, value: this.app.subJsonUrl, size: 220 });
|
||||||
|
}
|
||||||
|
} catch (e) { /* ignore */ }
|
||||||
|
this._onResize = () => { this.viewportWidth = window.innerWidth; };
|
||||||
|
window.addEventListener('resize', this._onResize);
|
||||||
|
},
|
||||||
|
beforeDestroy() {
|
||||||
|
if (this._onResize) window.removeEventListener('resize', this._onResize);
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
isMobile() {
|
||||||
|
return this.viewportWidth < 576;
|
||||||
|
},
|
||||||
|
isUnlimited() {
|
||||||
|
return !this.app.totalByte;
|
||||||
|
},
|
||||||
|
isActive() {
|
||||||
|
const now = Date.now();
|
||||||
|
const expiryOk = !this.app.expireMs || this.app.expireMs >= now;
|
||||||
|
const trafficOk = !this.app.totalByte || (this.app.uploadByte + this.app.downloadByte) <= this.app.totalByte;
|
||||||
|
return expiryOk && trafficOk;
|
||||||
|
},
|
||||||
|
shadowrocketUrl() {
|
||||||
|
const rawUrl = this.app.subUrl + '?flag=shadowrocket';
|
||||||
|
const base64Url = btoa(rawUrl);
|
||||||
|
const remark = encodeURIComponent(this.app.sId || 'Subscription');
|
||||||
|
return `shadowrocket://add/sub/${base64Url}?remark=${remark}`;
|
||||||
|
},
|
||||||
|
v2boxUrl() {
|
||||||
|
return `v2box://install-sub?url=${encodeURIComponent(this.app.subUrl)}&name=${encodeURIComponent(this.app.sId)}`;
|
||||||
|
},
|
||||||
|
streisandUrl() {
|
||||||
|
return `streisand://import/${encodeURIComponent(this.app.subUrl)}`;
|
||||||
|
},
|
||||||
|
v2raytunUrl() {
|
||||||
|
return this.app.subUrl;
|
||||||
|
},
|
||||||
|
npvtunUrl() {
|
||||||
|
return this.app.subUrl;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
renderLink,
|
||||||
|
copy,
|
||||||
|
open,
|
||||||
|
linkName,
|
||||||
|
i18nLabel(key) {
|
||||||
|
return '{{ i18n "' + key + '" }}';
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
})();
|
||||||
@@ -134,7 +134,7 @@ class DateUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static formatMillis(millis) {
|
static formatMillis(millis) {
|
||||||
return moment(millis).format('YYYY-M-D H:m:s');
|
return moment(millis).format('YYYY-M-D HH:mm:ss');
|
||||||
}
|
}
|
||||||
|
|
||||||
static firstDayOfMonth() {
|
static firstDayOfMonth() {
|
||||||
|
|||||||
@@ -326,6 +326,14 @@ class ObjectUtil {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for (const key in b) {
|
||||||
|
if (!b.hasOwnProperty(key)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (!a.hasOwnProperty(key)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,5 +0,0 @@
|
|||||||
if (process.env.NODE_ENV === 'production') {
|
|
||||||
module.exports = require('./vue.common.prod.js')
|
|
||||||
} else {
|
|
||||||
module.exports = require('./vue.common.dev.js')
|
|
||||||
}
|
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
6
web/assets/vue/vue.esm.browser.min.js
vendored
6
web/assets/vue/vue.esm.browser.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
11932
web/assets/vue/vue.js
11932
web/assets/vue/vue.js
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,5 +0,0 @@
|
|||||||
if (process.env.NODE_ENV === 'production') {
|
|
||||||
module.exports = require('./vue.runtime.common.prod.js')
|
|
||||||
} else {
|
|
||||||
module.exports = require('./vue.runtime.common.dev.js')
|
|
||||||
}
|
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
6
web/assets/vue/vue.runtime.min.js
vendored
6
web/assets/vue/vue.runtime.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -1,76 +0,0 @@
|
|||||||
import Vue from './vue.runtime.common.js'
|
|
||||||
export default Vue
|
|
||||||
|
|
||||||
// this should be kept in sync with src/v3/index.ts
|
|
||||||
export const {
|
|
||||||
version,
|
|
||||||
|
|
||||||
// refs
|
|
||||||
ref,
|
|
||||||
shallowRef,
|
|
||||||
isRef,
|
|
||||||
toRef,
|
|
||||||
toRefs,
|
|
||||||
unref,
|
|
||||||
proxyRefs,
|
|
||||||
customRef,
|
|
||||||
triggerRef,
|
|
||||||
computed,
|
|
||||||
|
|
||||||
// reactive
|
|
||||||
reactive,
|
|
||||||
isReactive,
|
|
||||||
isReadonly,
|
|
||||||
isShallow,
|
|
||||||
isProxy,
|
|
||||||
shallowReactive,
|
|
||||||
markRaw,
|
|
||||||
toRaw,
|
|
||||||
readonly,
|
|
||||||
shallowReadonly,
|
|
||||||
|
|
||||||
// watch
|
|
||||||
watch,
|
|
||||||
watchEffect,
|
|
||||||
watchPostEffect,
|
|
||||||
watchSyncEffect,
|
|
||||||
|
|
||||||
// effectScope
|
|
||||||
effectScope,
|
|
||||||
onScopeDispose,
|
|
||||||
getCurrentScope,
|
|
||||||
|
|
||||||
// provide / inject
|
|
||||||
provide,
|
|
||||||
inject,
|
|
||||||
|
|
||||||
// lifecycle
|
|
||||||
onBeforeMount,
|
|
||||||
onMounted,
|
|
||||||
onBeforeUpdate,
|
|
||||||
onUpdated,
|
|
||||||
onBeforeUnmount,
|
|
||||||
onUnmounted,
|
|
||||||
onErrorCaptured,
|
|
||||||
onActivated,
|
|
||||||
onDeactivated,
|
|
||||||
onServerPrefetch,
|
|
||||||
onRenderTracked,
|
|
||||||
onRenderTriggered,
|
|
||||||
|
|
||||||
// v2 only
|
|
||||||
set,
|
|
||||||
del,
|
|
||||||
|
|
||||||
// v3 compat
|
|
||||||
h,
|
|
||||||
getCurrentInstance,
|
|
||||||
useSlots,
|
|
||||||
useAttrs,
|
|
||||||
mergeDefaults,
|
|
||||||
nextTick,
|
|
||||||
useCssModule,
|
|
||||||
useCssVars,
|
|
||||||
defineComponent,
|
|
||||||
defineAsyncComponent
|
|
||||||
} = Vue
|
|
||||||
@@ -1,59 +1,45 @@
|
|||||||
package controller
|
package controller
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"x-ui/web/service"
|
"github.com/mhsanaei/3x-ui/v2/web/service"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// APIController handles the main API routes for the 3x-ui panel, including inbounds and server management.
|
||||||
type APIController struct {
|
type APIController struct {
|
||||||
BaseController
|
BaseController
|
||||||
inboundController *InboundController
|
inboundController *InboundController
|
||||||
|
serverController *ServerController
|
||||||
Tgbot service.Tgbot
|
Tgbot service.Tgbot
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NewAPIController creates a new APIController instance and initializes its routes.
|
||||||
func NewAPIController(g *gin.RouterGroup) *APIController {
|
func NewAPIController(g *gin.RouterGroup) *APIController {
|
||||||
a := &APIController{}
|
a := &APIController{}
|
||||||
a.initRouter(g)
|
a.initRouter(g)
|
||||||
return a
|
return a
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// initRouter sets up the API routes for inbounds, server, and other endpoints.
|
||||||
func (a *APIController) initRouter(g *gin.RouterGroup) {
|
func (a *APIController) initRouter(g *gin.RouterGroup) {
|
||||||
g = g.Group("/panel/api/inbounds")
|
// Main API group
|
||||||
g.Use(a.checkLogin)
|
api := g.Group("/panel/api")
|
||||||
|
api.Use(a.checkLogin)
|
||||||
|
|
||||||
a.inboundController = NewInboundController(g)
|
// Inbounds API
|
||||||
|
inbounds := api.Group("/inbounds")
|
||||||
|
a.inboundController = NewInboundController(inbounds)
|
||||||
|
|
||||||
inboundRoutes := []struct {
|
// Server API
|
||||||
Method string
|
server := api.Group("/server")
|
||||||
Path string
|
a.serverController = NewServerController(server)
|
||||||
Handler gin.HandlerFunc
|
|
||||||
}{
|
|
||||||
{"GET", "/createbackup", a.createBackup},
|
|
||||||
{"GET", "/list", a.inboundController.getInbounds},
|
|
||||||
{"GET", "/get/:id", a.inboundController.getInbound},
|
|
||||||
{"GET", "/getClientTraffics/:email", a.inboundController.getClientTraffics},
|
|
||||||
{"GET", "/getClientTrafficsById/:id", a.inboundController.getClientTrafficsById},
|
|
||||||
{"POST", "/add", a.inboundController.addInbound},
|
|
||||||
{"POST", "/del/:id", a.inboundController.delInbound},
|
|
||||||
{"POST", "/update/:id", a.inboundController.updateInbound},
|
|
||||||
{"POST", "/clientIps/:email", a.inboundController.getClientIps},
|
|
||||||
{"POST", "/clearClientIps/:email", a.inboundController.clearClientIps},
|
|
||||||
{"POST", "/addClient", a.inboundController.addInboundClient},
|
|
||||||
{"POST", "/:id/delClient/:clientId", a.inboundController.delInboundClient},
|
|
||||||
{"POST", "/updateClient/:clientId", a.inboundController.updateInboundClient},
|
|
||||||
{"POST", "/:id/resetClientTraffic/:email", a.inboundController.resetClientTraffic},
|
|
||||||
{"POST", "/resetAllTraffics", a.inboundController.resetAllTraffics},
|
|
||||||
{"POST", "/resetAllClientTraffics/:id", a.inboundController.resetAllClientTraffics},
|
|
||||||
{"POST", "/delDepletedClients/:id", a.inboundController.delDepletedClients},
|
|
||||||
{"POST", "/onlines", a.inboundController.onlines},
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, route := range inboundRoutes {
|
// Extra routes
|
||||||
g.Handle(route.Method, route.Path, route.Handler)
|
api.GET("/backuptotgbot", a.BackuptoTgbot)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *APIController) createBackup(c *gin.Context) {
|
// BackuptoTgbot sends a backup of the panel data to Telegram bot admins.
|
||||||
|
func (a *APIController) BackuptoTgbot(c *gin.Context) {
|
||||||
a.Tgbot.SendBackupToAdmins()
|
a.Tgbot.SendBackupToAdmins()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,17 +1,21 @@
|
|||||||
|
// Package controller provides HTTP request handlers and controllers for the 3x-ui web management panel.
|
||||||
|
// It handles routing, authentication, and API endpoints for managing Xray inbounds, settings, and more.
|
||||||
package controller
|
package controller
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"x-ui/logger"
|
"github.com/mhsanaei/3x-ui/v2/logger"
|
||||||
"x-ui/web/locale"
|
"github.com/mhsanaei/3x-ui/v2/web/locale"
|
||||||
"x-ui/web/session"
|
"github.com/mhsanaei/3x-ui/v2/web/session"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// BaseController provides common functionality for all controllers, including authentication checks.
|
||||||
type BaseController struct{}
|
type BaseController struct{}
|
||||||
|
|
||||||
|
// checkLogin is a middleware that verifies user authentication and handles unauthorized access.
|
||||||
func (a *BaseController) checkLogin(c *gin.Context) {
|
func (a *BaseController) checkLogin(c *gin.Context) {
|
||||||
if !session.IsLogin(c) {
|
if !session.IsLogin(c) {
|
||||||
if isAjax(c) {
|
if isAjax(c) {
|
||||||
@@ -25,6 +29,7 @@ func (a *BaseController) checkLogin(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// I18nWeb retrieves an internationalized message for the web interface based on the current locale.
|
||||||
func I18nWeb(c *gin.Context, name string, params ...string) string {
|
func I18nWeb(c *gin.Context, name string, params ...string) string {
|
||||||
anyfunc, funcExists := c.Get("I18n")
|
anyfunc, funcExists := c.Get("I18n")
|
||||||
if !funcExists {
|
if !funcExists {
|
||||||
|
|||||||
@@ -5,28 +5,34 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"x-ui/database/model"
|
"github.com/mhsanaei/3x-ui/v2/database/model"
|
||||||
"x-ui/web/service"
|
"github.com/mhsanaei/3x-ui/v2/web/service"
|
||||||
"x-ui/web/session"
|
"github.com/mhsanaei/3x-ui/v2/web/session"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// InboundController handles HTTP requests related to Xray inbounds management.
|
||||||
type InboundController struct {
|
type InboundController struct {
|
||||||
inboundService service.InboundService
|
inboundService service.InboundService
|
||||||
xrayService service.XrayService
|
xrayService service.XrayService
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NewInboundController creates a new InboundController and sets up its routes.
|
||||||
func NewInboundController(g *gin.RouterGroup) *InboundController {
|
func NewInboundController(g *gin.RouterGroup) *InboundController {
|
||||||
a := &InboundController{}
|
a := &InboundController{}
|
||||||
a.initRouter(g)
|
a.initRouter(g)
|
||||||
return a
|
return a
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// initRouter initializes the routes for inbound-related operations.
|
||||||
func (a *InboundController) initRouter(g *gin.RouterGroup) {
|
func (a *InboundController) initRouter(g *gin.RouterGroup) {
|
||||||
g = g.Group("/inbound")
|
|
||||||
|
|
||||||
g.POST("/list", a.getInbounds)
|
g.GET("/list", a.getInbounds)
|
||||||
|
g.GET("/get/:id", a.getInbound)
|
||||||
|
g.GET("/getClientTraffics/:email", a.getClientTraffics)
|
||||||
|
g.GET("/getClientTrafficsById/:id", a.getClientTrafficsById)
|
||||||
|
|
||||||
g.POST("/add", a.addInbound)
|
g.POST("/add", a.addInbound)
|
||||||
g.POST("/del/:id", a.delInbound)
|
g.POST("/del/:id", a.delInbound)
|
||||||
g.POST("/update/:id", a.updateInbound)
|
g.POST("/update/:id", a.updateInbound)
|
||||||
@@ -41,8 +47,12 @@ func (a *InboundController) initRouter(g *gin.RouterGroup) {
|
|||||||
g.POST("/delDepletedClients/:id", a.delDepletedClients)
|
g.POST("/delDepletedClients/:id", a.delDepletedClients)
|
||||||
g.POST("/import", a.importInbound)
|
g.POST("/import", a.importInbound)
|
||||||
g.POST("/onlines", a.onlines)
|
g.POST("/onlines", a.onlines)
|
||||||
|
g.POST("/lastOnline", a.lastOnline)
|
||||||
|
g.POST("/updateClientTraffic/:email", a.updateClientTraffic)
|
||||||
|
g.POST("/:id/delClientByEmail/:email", a.delInboundClientByEmail)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// getInbounds retrieves the list of inbounds for the logged-in user.
|
||||||
func (a *InboundController) getInbounds(c *gin.Context) {
|
func (a *InboundController) getInbounds(c *gin.Context) {
|
||||||
user := session.GetLoginUser(c)
|
user := session.GetLoginUser(c)
|
||||||
inbounds, err := a.inboundService.GetInbounds(user.Id)
|
inbounds, err := a.inboundService.GetInbounds(user.Id)
|
||||||
@@ -53,6 +63,7 @@ func (a *InboundController) getInbounds(c *gin.Context) {
|
|||||||
jsonObj(c, inbounds, nil)
|
jsonObj(c, inbounds, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// getInbound retrieves a specific inbound by its ID.
|
||||||
func (a *InboundController) getInbound(c *gin.Context) {
|
func (a *InboundController) getInbound(c *gin.Context) {
|
||||||
id, err := strconv.Atoi(c.Param("id"))
|
id, err := strconv.Atoi(c.Param("id"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -67,6 +78,7 @@ func (a *InboundController) getInbound(c *gin.Context) {
|
|||||||
jsonObj(c, inbound, nil)
|
jsonObj(c, inbound, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// getClientTraffics retrieves client traffic information by email.
|
||||||
func (a *InboundController) getClientTraffics(c *gin.Context) {
|
func (a *InboundController) getClientTraffics(c *gin.Context) {
|
||||||
email := c.Param("email")
|
email := c.Param("email")
|
||||||
clientTraffics, err := a.inboundService.GetClientTrafficByEmail(email)
|
clientTraffics, err := a.inboundService.GetClientTrafficByEmail(email)
|
||||||
@@ -77,6 +89,7 @@ func (a *InboundController) getClientTraffics(c *gin.Context) {
|
|||||||
jsonObj(c, clientTraffics, nil)
|
jsonObj(c, clientTraffics, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// getClientTrafficsById retrieves client traffic information by inbound ID.
|
||||||
func (a *InboundController) getClientTrafficsById(c *gin.Context) {
|
func (a *InboundController) getClientTrafficsById(c *gin.Context) {
|
||||||
id := c.Param("id")
|
id := c.Param("id")
|
||||||
clientTraffics, err := a.inboundService.GetClientTrafficByID(id)
|
clientTraffics, err := a.inboundService.GetClientTrafficByID(id)
|
||||||
@@ -87,6 +100,7 @@ func (a *InboundController) getClientTrafficsById(c *gin.Context) {
|
|||||||
jsonObj(c, clientTraffics, nil)
|
jsonObj(c, clientTraffics, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// addInbound creates a new inbound configuration.
|
||||||
func (a *InboundController) addInbound(c *gin.Context) {
|
func (a *InboundController) addInbound(c *gin.Context) {
|
||||||
inbound := &model.Inbound{}
|
inbound := &model.Inbound{}
|
||||||
err := c.ShouldBind(inbound)
|
err := c.ShouldBind(inbound)
|
||||||
@@ -102,36 +116,36 @@ func (a *InboundController) addInbound(c *gin.Context) {
|
|||||||
inbound.Tag = fmt.Sprintf("inbound-%v:%v", inbound.Listen, inbound.Port)
|
inbound.Tag = fmt.Sprintf("inbound-%v:%v", inbound.Listen, inbound.Port)
|
||||||
}
|
}
|
||||||
|
|
||||||
needRestart := false
|
inbound, needRestart, err := a.inboundService.AddInbound(inbound)
|
||||||
inbound, needRestart, err = a.inboundService.AddInbound(inbound)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
jsonMsg(c, I18nWeb(c, "somethingWentWrong"), err)
|
jsonMsg(c, I18nWeb(c, "somethingWentWrong"), err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
jsonMsgObj(c, I18nWeb(c, "pages.inbounds.toasts.inboundCreateSuccess"), inbound, err)
|
jsonMsgObj(c, I18nWeb(c, "pages.inbounds.toasts.inboundCreateSuccess"), inbound, nil)
|
||||||
if err == nil && needRestart {
|
if needRestart {
|
||||||
a.xrayService.SetToNeedRestart()
|
a.xrayService.SetToNeedRestart()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// delInbound deletes an inbound configuration by its ID.
|
||||||
func (a *InboundController) delInbound(c *gin.Context) {
|
func (a *InboundController) delInbound(c *gin.Context) {
|
||||||
id, err := strconv.Atoi(c.Param("id"))
|
id, err := strconv.Atoi(c.Param("id"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
jsonMsg(c, I18nWeb(c, "pages.inbounds.toasts.inboundDeleteSuccess"), err)
|
jsonMsg(c, I18nWeb(c, "pages.inbounds.toasts.inboundDeleteSuccess"), err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
needRestart := true
|
needRestart, err := a.inboundService.DelInbound(id)
|
||||||
needRestart, err = a.inboundService.DelInbound(id)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
jsonMsg(c, I18nWeb(c, "somethingWentWrong"), err)
|
jsonMsg(c, I18nWeb(c, "somethingWentWrong"), err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
jsonMsgObj(c, I18nWeb(c, "pages.inbounds.toasts.inboundDeleteSuccess"), id, err)
|
jsonMsgObj(c, I18nWeb(c, "pages.inbounds.toasts.inboundDeleteSuccess"), id, nil)
|
||||||
if err == nil && needRestart {
|
if needRestart {
|
||||||
a.xrayService.SetToNeedRestart()
|
a.xrayService.SetToNeedRestart()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// updateInbound updates an existing inbound configuration.
|
||||||
func (a *InboundController) updateInbound(c *gin.Context) {
|
func (a *InboundController) updateInbound(c *gin.Context) {
|
||||||
id, err := strconv.Atoi(c.Param("id"))
|
id, err := strconv.Atoi(c.Param("id"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -146,18 +160,18 @@ func (a *InboundController) updateInbound(c *gin.Context) {
|
|||||||
jsonMsg(c, I18nWeb(c, "pages.inbounds.toasts.inboundUpdateSuccess"), err)
|
jsonMsg(c, I18nWeb(c, "pages.inbounds.toasts.inboundUpdateSuccess"), err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
needRestart := true
|
inbound, needRestart, err := a.inboundService.UpdateInbound(inbound)
|
||||||
inbound, needRestart, err = a.inboundService.UpdateInbound(inbound)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
jsonMsg(c, I18nWeb(c, "somethingWentWrong"), err)
|
jsonMsg(c, I18nWeb(c, "somethingWentWrong"), err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
jsonMsgObj(c, I18nWeb(c, "pages.inbounds.toasts.inboundUpdateSuccess"), inbound, err)
|
jsonMsgObj(c, I18nWeb(c, "pages.inbounds.toasts.inboundUpdateSuccess"), inbound, nil)
|
||||||
if err == nil && needRestart {
|
if needRestart {
|
||||||
a.xrayService.SetToNeedRestart()
|
a.xrayService.SetToNeedRestart()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// getClientIps retrieves the IP addresses associated with a client by email.
|
||||||
func (a *InboundController) getClientIps(c *gin.Context) {
|
func (a *InboundController) getClientIps(c *gin.Context) {
|
||||||
email := c.Param("email")
|
email := c.Param("email")
|
||||||
|
|
||||||
@@ -170,6 +184,7 @@ func (a *InboundController) getClientIps(c *gin.Context) {
|
|||||||
jsonObj(c, ips, nil)
|
jsonObj(c, ips, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// clearClientIps clears the IP addresses for a client by email.
|
||||||
func (a *InboundController) clearClientIps(c *gin.Context) {
|
func (a *InboundController) clearClientIps(c *gin.Context) {
|
||||||
email := c.Param("email")
|
email := c.Param("email")
|
||||||
|
|
||||||
@@ -181,6 +196,7 @@ func (a *InboundController) clearClientIps(c *gin.Context) {
|
|||||||
jsonMsg(c, I18nWeb(c, "pages.inbounds.toasts.logCleanSuccess"), nil)
|
jsonMsg(c, I18nWeb(c, "pages.inbounds.toasts.logCleanSuccess"), nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// addInboundClient adds a new client to an existing inbound.
|
||||||
func (a *InboundController) addInboundClient(c *gin.Context) {
|
func (a *InboundController) addInboundClient(c *gin.Context) {
|
||||||
data := &model.Inbound{}
|
data := &model.Inbound{}
|
||||||
err := c.ShouldBind(data)
|
err := c.ShouldBind(data)
|
||||||
@@ -189,9 +205,7 @@ func (a *InboundController) addInboundClient(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
needRestart := true
|
needRestart, err := a.inboundService.AddInboundClient(data)
|
||||||
|
|
||||||
needRestart, err = a.inboundService.AddInboundClient(data)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
jsonMsg(c, I18nWeb(c, "somethingWentWrong"), err)
|
jsonMsg(c, I18nWeb(c, "somethingWentWrong"), err)
|
||||||
return
|
return
|
||||||
@@ -202,6 +216,7 @@ func (a *InboundController) addInboundClient(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// delInboundClient deletes a client from an inbound by inbound ID and client ID.
|
||||||
func (a *InboundController) delInboundClient(c *gin.Context) {
|
func (a *InboundController) delInboundClient(c *gin.Context) {
|
||||||
id, err := strconv.Atoi(c.Param("id"))
|
id, err := strconv.Atoi(c.Param("id"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -210,9 +225,7 @@ func (a *InboundController) delInboundClient(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
clientId := c.Param("clientId")
|
clientId := c.Param("clientId")
|
||||||
|
|
||||||
needRestart := true
|
needRestart, err := a.inboundService.DelInboundClient(id, clientId)
|
||||||
|
|
||||||
needRestart, err = a.inboundService.DelInboundClient(id, clientId)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
jsonMsg(c, I18nWeb(c, "somethingWentWrong"), err)
|
jsonMsg(c, I18nWeb(c, "somethingWentWrong"), err)
|
||||||
return
|
return
|
||||||
@@ -223,6 +236,7 @@ func (a *InboundController) delInboundClient(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// updateInboundClient updates a client's configuration in an inbound.
|
||||||
func (a *InboundController) updateInboundClient(c *gin.Context) {
|
func (a *InboundController) updateInboundClient(c *gin.Context) {
|
||||||
clientId := c.Param("clientId")
|
clientId := c.Param("clientId")
|
||||||
|
|
||||||
@@ -233,9 +247,7 @@ func (a *InboundController) updateInboundClient(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
needRestart := true
|
needRestart, err := a.inboundService.UpdateInboundClient(inbound, clientId)
|
||||||
|
|
||||||
needRestart, err = a.inboundService.UpdateInboundClient(inbound, clientId)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
jsonMsg(c, I18nWeb(c, "somethingWentWrong"), err)
|
jsonMsg(c, I18nWeb(c, "somethingWentWrong"), err)
|
||||||
return
|
return
|
||||||
@@ -246,6 +258,7 @@ func (a *InboundController) updateInboundClient(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// resetClientTraffic resets the traffic counter for a specific client in an inbound.
|
||||||
func (a *InboundController) resetClientTraffic(c *gin.Context) {
|
func (a *InboundController) resetClientTraffic(c *gin.Context) {
|
||||||
id, err := strconv.Atoi(c.Param("id"))
|
id, err := strconv.Atoi(c.Param("id"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -265,6 +278,7 @@ func (a *InboundController) resetClientTraffic(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// resetAllTraffics resets all traffic counters across all inbounds.
|
||||||
func (a *InboundController) resetAllTraffics(c *gin.Context) {
|
func (a *InboundController) resetAllTraffics(c *gin.Context) {
|
||||||
err := a.inboundService.ResetAllTraffics()
|
err := a.inboundService.ResetAllTraffics()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -276,6 +290,7 @@ func (a *InboundController) resetAllTraffics(c *gin.Context) {
|
|||||||
jsonMsg(c, I18nWeb(c, "pages.inbounds.toasts.resetAllTrafficSuccess"), nil)
|
jsonMsg(c, I18nWeb(c, "pages.inbounds.toasts.resetAllTrafficSuccess"), nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// resetAllClientTraffics resets traffic counters for all clients in a specific inbound.
|
||||||
func (a *InboundController) resetAllClientTraffics(c *gin.Context) {
|
func (a *InboundController) resetAllClientTraffics(c *gin.Context) {
|
||||||
id, err := strconv.Atoi(c.Param("id"))
|
id, err := strconv.Atoi(c.Param("id"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -293,6 +308,7 @@ func (a *InboundController) resetAllClientTraffics(c *gin.Context) {
|
|||||||
jsonMsg(c, I18nWeb(c, "pages.inbounds.toasts.resetAllClientTrafficSuccess"), nil)
|
jsonMsg(c, I18nWeb(c, "pages.inbounds.toasts.resetAllClientTrafficSuccess"), nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// importInbound imports an inbound configuration from provided data.
|
||||||
func (a *InboundController) importInbound(c *gin.Context) {
|
func (a *InboundController) importInbound(c *gin.Context) {
|
||||||
inbound := &model.Inbound{}
|
inbound := &model.Inbound{}
|
||||||
err := json.Unmarshal([]byte(c.PostForm("data")), inbound)
|
err := json.Unmarshal([]byte(c.PostForm("data")), inbound)
|
||||||
@@ -322,6 +338,7 @@ func (a *InboundController) importInbound(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// delDepletedClients deletes clients in an inbound who have exhausted their traffic limits.
|
||||||
func (a *InboundController) delDepletedClients(c *gin.Context) {
|
func (a *InboundController) delDepletedClients(c *gin.Context) {
|
||||||
id, err := strconv.Atoi(c.Param("id"))
|
id, err := strconv.Atoi(c.Param("id"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -336,6 +353,60 @@ func (a *InboundController) delDepletedClients(c *gin.Context) {
|
|||||||
jsonMsg(c, I18nWeb(c, "pages.inbounds.toasts.delDepletedClientsSuccess"), nil)
|
jsonMsg(c, I18nWeb(c, "pages.inbounds.toasts.delDepletedClientsSuccess"), nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// onlines retrieves the list of currently online clients.
|
||||||
func (a *InboundController) onlines(c *gin.Context) {
|
func (a *InboundController) onlines(c *gin.Context) {
|
||||||
jsonObj(c, a.inboundService.GetOnlineClients(), nil)
|
jsonObj(c, a.inboundService.GetOnlineClients(), nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// lastOnline retrieves the last online timestamps for clients.
|
||||||
|
func (a *InboundController) lastOnline(c *gin.Context) {
|
||||||
|
data, err := a.inboundService.GetClientsLastOnline()
|
||||||
|
jsonObj(c, data, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// updateClientTraffic updates the traffic statistics for a client by email.
|
||||||
|
func (a *InboundController) updateClientTraffic(c *gin.Context) {
|
||||||
|
email := c.Param("email")
|
||||||
|
|
||||||
|
// Define the request structure for traffic update
|
||||||
|
type TrafficUpdateRequest struct {
|
||||||
|
Upload int64 `json:"upload"`
|
||||||
|
Download int64 `json:"download"`
|
||||||
|
}
|
||||||
|
|
||||||
|
var request TrafficUpdateRequest
|
||||||
|
err := c.ShouldBindJSON(&request)
|
||||||
|
if err != nil {
|
||||||
|
jsonMsg(c, I18nWeb(c, "pages.inbounds.toasts.inboundUpdateSuccess"), err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
err = a.inboundService.UpdateClientTrafficByEmail(email, request.Upload, request.Download)
|
||||||
|
if err != nil {
|
||||||
|
jsonMsg(c, I18nWeb(c, "somethingWentWrong"), err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
jsonMsg(c, I18nWeb(c, "pages.inbounds.toasts.inboundClientUpdateSuccess"), nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
// delInboundClientByEmail deletes a client from an inbound by email address.
|
||||||
|
func (a *InboundController) delInboundClientByEmail(c *gin.Context) {
|
||||||
|
inboundId, err := strconv.Atoi(c.Param("id"))
|
||||||
|
if err != nil {
|
||||||
|
jsonMsg(c, "Invalid inbound ID", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
email := c.Param("email")
|
||||||
|
needRestart, err := a.inboundService.DelInboundClientByEmail(inboundId, email)
|
||||||
|
if err != nil {
|
||||||
|
jsonMsg(c, "Failed to delete client by email", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
jsonMsg(c, "Client deleted successfully", nil)
|
||||||
|
if needRestart {
|
||||||
|
a.xrayService.SetToNeedRestart()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -5,20 +5,22 @@ import (
|
|||||||
"text/template"
|
"text/template"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"x-ui/logger"
|
"github.com/mhsanaei/3x-ui/v2/logger"
|
||||||
"x-ui/web/service"
|
"github.com/mhsanaei/3x-ui/v2/web/service"
|
||||||
"x-ui/web/session"
|
"github.com/mhsanaei/3x-ui/v2/web/session"
|
||||||
|
|
||||||
"github.com/gin-contrib/sessions"
|
"github.com/gin-contrib/sessions"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// LoginForm represents the login request structure.
|
||||||
type LoginForm struct {
|
type LoginForm struct {
|
||||||
Username string `json:"username" form:"username"`
|
Username string `json:"username" form:"username"`
|
||||||
Password string `json:"password" form:"password"`
|
Password string `json:"password" form:"password"`
|
||||||
TwoFactorCode string `json:"twoFactorCode" form:"twoFactorCode"`
|
TwoFactorCode string `json:"twoFactorCode" form:"twoFactorCode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// IndexController handles the main index and login-related routes.
|
||||||
type IndexController struct {
|
type IndexController struct {
|
||||||
BaseController
|
BaseController
|
||||||
|
|
||||||
@@ -27,12 +29,14 @@ type IndexController struct {
|
|||||||
tgbot service.Tgbot
|
tgbot service.Tgbot
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NewIndexController creates a new IndexController and initializes its routes.
|
||||||
func NewIndexController(g *gin.RouterGroup) *IndexController {
|
func NewIndexController(g *gin.RouterGroup) *IndexController {
|
||||||
a := &IndexController{}
|
a := &IndexController{}
|
||||||
a.initRouter(g)
|
a.initRouter(g)
|
||||||
return a
|
return a
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// initRouter sets up the routes for index, login, logout, and two-factor authentication.
|
||||||
func (a *IndexController) initRouter(g *gin.RouterGroup) {
|
func (a *IndexController) initRouter(g *gin.RouterGroup) {
|
||||||
g.GET("/", a.index)
|
g.GET("/", a.index)
|
||||||
g.POST("/login", a.login)
|
g.POST("/login", a.login)
|
||||||
@@ -40,6 +44,7 @@ func (a *IndexController) initRouter(g *gin.RouterGroup) {
|
|||||||
g.POST("/getTwoFactorEnable", a.getTwoFactorEnable)
|
g.POST("/getTwoFactorEnable", a.getTwoFactorEnable)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// index handles the root route, redirecting logged-in users to the panel or showing the login page.
|
||||||
func (a *IndexController) index(c *gin.Context) {
|
func (a *IndexController) index(c *gin.Context) {
|
||||||
if session.IsLogin(c) {
|
if session.IsLogin(c) {
|
||||||
c.Redirect(http.StatusTemporaryRedirect, "panel/")
|
c.Redirect(http.StatusTemporaryRedirect, "panel/")
|
||||||
@@ -48,6 +53,7 @@ func (a *IndexController) index(c *gin.Context) {
|
|||||||
html(c, "login.html", "pages.login.title", nil)
|
html(c, "login.html", "pages.login.title", nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// login handles user authentication and session creation.
|
||||||
func (a *IndexController) login(c *gin.Context) {
|
func (a *IndexController) login(c *gin.Context) {
|
||||||
var form LoginForm
|
var form LoginForm
|
||||||
|
|
||||||
@@ -95,6 +101,7 @@ func (a *IndexController) login(c *gin.Context) {
|
|||||||
jsonMsg(c, I18nWeb(c, "pages.login.toasts.successLogin"), nil)
|
jsonMsg(c, I18nWeb(c, "pages.login.toasts.successLogin"), nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// logout handles user logout by clearing the session and redirecting to the login page.
|
||||||
func (a *IndexController) logout(c *gin.Context) {
|
func (a *IndexController) logout(c *gin.Context) {
|
||||||
user := session.GetLoginUser(c)
|
user := session.GetLoginUser(c)
|
||||||
if user != nil {
|
if user != nil {
|
||||||
@@ -107,6 +114,7 @@ func (a *IndexController) logout(c *gin.Context) {
|
|||||||
c.Redirect(http.StatusTemporaryRedirect, c.GetString("base_path"))
|
c.Redirect(http.StatusTemporaryRedirect, c.GetString("base_path"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// getTwoFactorEnable retrieves the current status of two-factor authentication.
|
||||||
func (a *IndexController) getTwoFactorEnable(c *gin.Context) {
|
func (a *IndexController) getTwoFactorEnable(c *gin.Context) {
|
||||||
status, err := a.settingService.GetTwoFactorEnable()
|
status, err := a.settingService.GetTwoFactorEnable()
|
||||||
if err == nil {
|
if err == nil {
|
||||||
|
|||||||
@@ -4,79 +4,114 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"regexp"
|
"regexp"
|
||||||
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"x-ui/web/global"
|
"github.com/mhsanaei/3x-ui/v2/web/global"
|
||||||
"x-ui/web/service"
|
"github.com/mhsanaei/3x-ui/v2/web/service"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
)
|
)
|
||||||
|
|
||||||
var filenameRegex = regexp.MustCompile(`^[a-zA-Z0-9_\-.]+$`)
|
var filenameRegex = regexp.MustCompile(`^[a-zA-Z0-9_\-.]+$`)
|
||||||
|
|
||||||
|
// ServerController handles server management and status-related operations.
|
||||||
type ServerController struct {
|
type ServerController struct {
|
||||||
BaseController
|
BaseController
|
||||||
|
|
||||||
serverService service.ServerService
|
serverService service.ServerService
|
||||||
|
settingService service.SettingService
|
||||||
|
|
||||||
lastStatus *service.Status
|
lastStatus *service.Status
|
||||||
lastGetStatusTime time.Time
|
|
||||||
|
|
||||||
lastVersions []string
|
lastVersions []string
|
||||||
lastGetVersionsTime time.Time
|
lastGetVersionsTime int64 // unix seconds
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NewServerController creates a new ServerController, initializes routes, and starts background tasks.
|
||||||
func NewServerController(g *gin.RouterGroup) *ServerController {
|
func NewServerController(g *gin.RouterGroup) *ServerController {
|
||||||
a := &ServerController{
|
a := &ServerController{}
|
||||||
lastGetStatusTime: time.Now(),
|
|
||||||
}
|
|
||||||
a.initRouter(g)
|
a.initRouter(g)
|
||||||
a.startTask()
|
a.startTask()
|
||||||
return a
|
return a
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// initRouter sets up the routes for server status, Xray management, and utility endpoints.
|
||||||
func (a *ServerController) initRouter(g *gin.RouterGroup) {
|
func (a *ServerController) initRouter(g *gin.RouterGroup) {
|
||||||
g = g.Group("/server")
|
|
||||||
|
|
||||||
g.Use(a.checkLogin)
|
g.GET("/status", a.status)
|
||||||
g.POST("/status", a.status)
|
g.GET("/cpuHistory/:bucket", a.getCpuHistoryBucket)
|
||||||
g.POST("/getXrayVersion", a.getXrayVersion)
|
g.GET("/getXrayVersion", a.getXrayVersion)
|
||||||
|
g.GET("/getConfigJson", a.getConfigJson)
|
||||||
|
g.GET("/getDb", a.getDb)
|
||||||
|
g.GET("/getNewUUID", a.getNewUUID)
|
||||||
|
g.GET("/getNewX25519Cert", a.getNewX25519Cert)
|
||||||
|
g.GET("/getNewmldsa65", a.getNewmldsa65)
|
||||||
|
g.GET("/getNewmlkem768", a.getNewmlkem768)
|
||||||
|
g.GET("/getNewVlessEnc", a.getNewVlessEnc)
|
||||||
|
|
||||||
g.POST("/stopXrayService", a.stopXrayService)
|
g.POST("/stopXrayService", a.stopXrayService)
|
||||||
g.POST("/restartXrayService", a.restartXrayService)
|
g.POST("/restartXrayService", a.restartXrayService)
|
||||||
g.POST("/installXray/:version", a.installXray)
|
g.POST("/installXray/:version", a.installXray)
|
||||||
|
g.POST("/updateGeofile", a.updateGeofile)
|
||||||
g.POST("/updateGeofile/:fileName", a.updateGeofile)
|
g.POST("/updateGeofile/:fileName", a.updateGeofile)
|
||||||
g.POST("/logs/:count", a.getLogs)
|
g.POST("/logs/:count", a.getLogs)
|
||||||
g.POST("/getConfigJson", a.getConfigJson)
|
g.POST("/xraylogs/:count", a.getXrayLogs)
|
||||||
g.GET("/getDb", a.getDb)
|
|
||||||
g.POST("/importDB", a.importDB)
|
g.POST("/importDB", a.importDB)
|
||||||
g.POST("/getNewX25519Cert", a.getNewX25519Cert)
|
g.POST("/getNewEchCert", a.getNewEchCert)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// refreshStatus updates the cached server status and collects CPU history.
|
||||||
func (a *ServerController) refreshStatus() {
|
func (a *ServerController) refreshStatus() {
|
||||||
a.lastStatus = a.serverService.GetStatus(a.lastStatus)
|
a.lastStatus = a.serverService.GetStatus(a.lastStatus)
|
||||||
|
// collect cpu history when status is fresh
|
||||||
|
if a.lastStatus != nil {
|
||||||
|
a.serverService.AppendCpuSample(time.Now(), a.lastStatus.Cpu)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// startTask initiates background tasks for continuous status monitoring.
|
||||||
func (a *ServerController) startTask() {
|
func (a *ServerController) startTask() {
|
||||||
webServer := global.GetWebServer()
|
webServer := global.GetWebServer()
|
||||||
c := webServer.GetCron()
|
c := webServer.GetCron()
|
||||||
c.AddFunc("@every 2s", func() {
|
c.AddFunc("@every 2s", func() {
|
||||||
now := time.Now()
|
// Always refresh to keep CPU history collected continuously.
|
||||||
if now.Sub(a.lastGetStatusTime) > time.Minute*3 {
|
// Sampling is lightweight and capped to ~6 hours in memory.
|
||||||
return
|
|
||||||
}
|
|
||||||
a.refreshStatus()
|
a.refreshStatus()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *ServerController) status(c *gin.Context) {
|
// status returns the current server status information.
|
||||||
a.lastGetStatusTime = time.Now()
|
func (a *ServerController) status(c *gin.Context) { jsonObj(c, a.lastStatus, nil) }
|
||||||
|
|
||||||
jsonObj(c, a.lastStatus, nil)
|
// getCpuHistoryBucket retrieves aggregated CPU usage history based on the specified time bucket.
|
||||||
|
func (a *ServerController) getCpuHistoryBucket(c *gin.Context) {
|
||||||
|
bucketStr := c.Param("bucket")
|
||||||
|
bucket, err := strconv.Atoi(bucketStr)
|
||||||
|
if err != nil || bucket <= 0 {
|
||||||
|
jsonMsg(c, "invalid bucket", fmt.Errorf("bad bucket"))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
allowed := map[int]bool{
|
||||||
|
2: true, // Real-time view
|
||||||
|
30: true, // 30s intervals
|
||||||
|
60: true, // 1m intervals
|
||||||
|
120: true, // 2m intervals
|
||||||
|
180: true, // 3m intervals
|
||||||
|
300: true, // 5m intervals
|
||||||
|
}
|
||||||
|
if !allowed[bucket] {
|
||||||
|
jsonMsg(c, "invalid bucket", fmt.Errorf("unsupported bucket"))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
points := a.serverService.AggregateCpuHistory(bucket, 60)
|
||||||
|
jsonObj(c, points, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// getXrayVersion retrieves available Xray versions, with caching for 1 minute.
|
||||||
func (a *ServerController) getXrayVersion(c *gin.Context) {
|
func (a *ServerController) getXrayVersion(c *gin.Context) {
|
||||||
now := time.Now()
|
now := time.Now().Unix()
|
||||||
if now.Sub(a.lastGetVersionsTime) <= time.Minute {
|
if now-a.lastGetVersionsTime <= 60 { // 1 minute cache
|
||||||
jsonObj(c, a.lastVersions, nil)
|
jsonObj(c, a.lastVersions, nil)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -88,25 +123,35 @@ func (a *ServerController) getXrayVersion(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
a.lastVersions = versions
|
a.lastVersions = versions
|
||||||
a.lastGetVersionsTime = time.Now()
|
a.lastGetVersionsTime = now
|
||||||
|
|
||||||
jsonObj(c, versions, nil)
|
jsonObj(c, versions, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// installXray installs or updates Xray to the specified version.
|
||||||
func (a *ServerController) installXray(c *gin.Context) {
|
func (a *ServerController) installXray(c *gin.Context) {
|
||||||
version := c.Param("version")
|
version := c.Param("version")
|
||||||
err := a.serverService.UpdateXray(version)
|
err := a.serverService.UpdateXray(version)
|
||||||
jsonMsg(c, I18nWeb(c, "pages.index.xraySwitchVersionPopover"), err)
|
jsonMsg(c, I18nWeb(c, "pages.index.xraySwitchVersionPopover"), err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// updateGeofile updates the specified geo file for Xray.
|
||||||
func (a *ServerController) updateGeofile(c *gin.Context) {
|
func (a *ServerController) updateGeofile(c *gin.Context) {
|
||||||
fileName := c.Param("fileName")
|
fileName := c.Param("fileName")
|
||||||
|
|
||||||
|
// Validate the filename for security (prevent path traversal attacks)
|
||||||
|
if fileName != "" && !a.serverService.IsValidGeofileName(fileName) {
|
||||||
|
jsonMsg(c, I18nWeb(c, "pages.index.geofileUpdatePopover"),
|
||||||
|
fmt.Errorf("invalid filename: contains unsafe characters or path traversal patterns"))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
err := a.serverService.UpdateGeofile(fileName)
|
err := a.serverService.UpdateGeofile(fileName)
|
||||||
jsonMsg(c, I18nWeb(c, "pages.index.geofileUpdatePopover"), err)
|
jsonMsg(c, I18nWeb(c, "pages.index.geofileUpdatePopover"), err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// stopXrayService stops the Xray service.
|
||||||
func (a *ServerController) stopXrayService(c *gin.Context) {
|
func (a *ServerController) stopXrayService(c *gin.Context) {
|
||||||
a.lastGetStatusTime = time.Now()
|
|
||||||
err := a.serverService.StopXrayService()
|
err := a.serverService.StopXrayService()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
jsonMsg(c, I18nWeb(c, "pages.xray.stopError"), err)
|
jsonMsg(c, I18nWeb(c, "pages.xray.stopError"), err)
|
||||||
@@ -115,6 +160,7 @@ func (a *ServerController) stopXrayService(c *gin.Context) {
|
|||||||
jsonMsg(c, I18nWeb(c, "pages.xray.stopSuccess"), err)
|
jsonMsg(c, I18nWeb(c, "pages.xray.stopSuccess"), err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// restartXrayService restarts the Xray service.
|
||||||
func (a *ServerController) restartXrayService(c *gin.Context) {
|
func (a *ServerController) restartXrayService(c *gin.Context) {
|
||||||
err := a.serverService.RestartXrayService()
|
err := a.serverService.RestartXrayService()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -124,6 +170,7 @@ func (a *ServerController) restartXrayService(c *gin.Context) {
|
|||||||
jsonMsg(c, I18nWeb(c, "pages.xray.restartSuccess"), err)
|
jsonMsg(c, I18nWeb(c, "pages.xray.restartSuccess"), err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// getLogs retrieves the application logs based on count, level, and syslog filters.
|
||||||
func (a *ServerController) getLogs(c *gin.Context) {
|
func (a *ServerController) getLogs(c *gin.Context) {
|
||||||
count := c.Param("count")
|
count := c.Param("count")
|
||||||
level := c.PostForm("level")
|
level := c.PostForm("level")
|
||||||
@@ -132,6 +179,52 @@ func (a *ServerController) getLogs(c *gin.Context) {
|
|||||||
jsonObj(c, logs, nil)
|
jsonObj(c, logs, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// getXrayLogs retrieves Xray logs with filtering options for direct, blocked, and proxy traffic.
|
||||||
|
func (a *ServerController) getXrayLogs(c *gin.Context) {
|
||||||
|
count := c.Param("count")
|
||||||
|
filter := c.PostForm("filter")
|
||||||
|
showDirect := c.PostForm("showDirect")
|
||||||
|
showBlocked := c.PostForm("showBlocked")
|
||||||
|
showProxy := c.PostForm("showProxy")
|
||||||
|
|
||||||
|
var freedoms []string
|
||||||
|
var blackholes []string
|
||||||
|
|
||||||
|
//getting tags for freedom and blackhole outbounds
|
||||||
|
config, err := a.settingService.GetDefaultXrayConfig()
|
||||||
|
if err == nil && config != nil {
|
||||||
|
if cfgMap, ok := config.(map[string]interface{}); ok {
|
||||||
|
if outbounds, ok := cfgMap["outbounds"].([]interface{}); ok {
|
||||||
|
for _, outbound := range outbounds {
|
||||||
|
if obMap, ok := outbound.(map[string]interface{}); ok {
|
||||||
|
switch obMap["protocol"] {
|
||||||
|
case "freedom":
|
||||||
|
if tag, ok := obMap["tag"].(string); ok {
|
||||||
|
freedoms = append(freedoms, tag)
|
||||||
|
}
|
||||||
|
case "blackhole":
|
||||||
|
if tag, ok := obMap["tag"].(string); ok {
|
||||||
|
blackholes = append(blackholes, tag)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(freedoms) == 0 {
|
||||||
|
freedoms = []string{"direct"}
|
||||||
|
}
|
||||||
|
if len(blackholes) == 0 {
|
||||||
|
blackholes = []string{"blocked"}
|
||||||
|
}
|
||||||
|
|
||||||
|
logs := a.serverService.GetXrayLogs(count, filter, showDirect, showBlocked, showProxy, freedoms, blackholes)
|
||||||
|
jsonObj(c, logs, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
// getConfigJson retrieves the Xray configuration as JSON.
|
||||||
func (a *ServerController) getConfigJson(c *gin.Context) {
|
func (a *ServerController) getConfigJson(c *gin.Context) {
|
||||||
configJson, err := a.serverService.GetConfigJson()
|
configJson, err := a.serverService.GetConfigJson()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -141,6 +234,7 @@ func (a *ServerController) getConfigJson(c *gin.Context) {
|
|||||||
jsonObj(c, configJson, nil)
|
jsonObj(c, configJson, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// getDb downloads the database file.
|
||||||
func (a *ServerController) getDb(c *gin.Context) {
|
func (a *ServerController) getDb(c *gin.Context) {
|
||||||
db, err := a.serverService.GetDb()
|
db, err := a.serverService.GetDb()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -168,6 +262,7 @@ func isValidFilename(filename string) bool {
|
|||||||
return filenameRegex.MatchString(filename)
|
return filenameRegex.MatchString(filename)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// importDB imports a database file and restarts the Xray service.
|
||||||
func (a *ServerController) importDB(c *gin.Context) {
|
func (a *ServerController) importDB(c *gin.Context) {
|
||||||
// Get the file from the request body
|
// Get the file from the request body
|
||||||
file, _, err := c.Request.FormFile("db")
|
file, _, err := c.Request.FormFile("db")
|
||||||
@@ -178,9 +273,7 @@ func (a *ServerController) importDB(c *gin.Context) {
|
|||||||
defer file.Close()
|
defer file.Close()
|
||||||
// Always restart Xray before return
|
// Always restart Xray before return
|
||||||
defer a.serverService.RestartXrayService()
|
defer a.serverService.RestartXrayService()
|
||||||
defer func() {
|
// lastGetStatusTime removed; no longer needed
|
||||||
a.lastGetStatusTime = time.Now()
|
|
||||||
}()
|
|
||||||
// Import it
|
// Import it
|
||||||
err = a.serverService.ImportDB(file)
|
err = a.serverService.ImportDB(file)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -190,6 +283,7 @@ func (a *ServerController) importDB(c *gin.Context) {
|
|||||||
jsonObj(c, I18nWeb(c, "pages.index.importDatabaseSuccess"), nil)
|
jsonObj(c, I18nWeb(c, "pages.index.importDatabaseSuccess"), nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// getNewX25519Cert generates a new X25519 certificate.
|
||||||
func (a *ServerController) getNewX25519Cert(c *gin.Context) {
|
func (a *ServerController) getNewX25519Cert(c *gin.Context) {
|
||||||
cert, err := a.serverService.GetNewX25519Cert()
|
cert, err := a.serverService.GetNewX25519Cert()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -198,3 +292,55 @@ func (a *ServerController) getNewX25519Cert(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
jsonObj(c, cert, nil)
|
jsonObj(c, cert, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// getNewmldsa65 generates a new ML-DSA-65 key.
|
||||||
|
func (a *ServerController) getNewmldsa65(c *gin.Context) {
|
||||||
|
cert, err := a.serverService.GetNewmldsa65()
|
||||||
|
if err != nil {
|
||||||
|
jsonMsg(c, I18nWeb(c, "pages.inbounds.toasts.getNewmldsa65Error"), err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
jsonObj(c, cert, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
// getNewEchCert generates a new ECH certificate for the given SNI.
|
||||||
|
func (a *ServerController) getNewEchCert(c *gin.Context) {
|
||||||
|
sni := c.PostForm("sni")
|
||||||
|
cert, err := a.serverService.GetNewEchCert(sni)
|
||||||
|
if err != nil {
|
||||||
|
jsonMsg(c, "get ech certificate", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
jsonObj(c, cert, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
// getNewVlessEnc generates a new VLESS encryption key.
|
||||||
|
func (a *ServerController) getNewVlessEnc(c *gin.Context) {
|
||||||
|
out, err := a.serverService.GetNewVlessEnc()
|
||||||
|
if err != nil {
|
||||||
|
jsonMsg(c, I18nWeb(c, "pages.inbounds.toasts.getNewVlessEncError"), err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
jsonObj(c, out, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
// getNewUUID generates a new UUID.
|
||||||
|
func (a *ServerController) getNewUUID(c *gin.Context) {
|
||||||
|
uuidResp, err := a.serverService.GetNewUUID()
|
||||||
|
if err != nil {
|
||||||
|
jsonMsg(c, "Failed to generate UUID", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
jsonObj(c, uuidResp, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
// getNewmlkem768 generates a new ML-KEM-768 key.
|
||||||
|
func (a *ServerController) getNewmlkem768(c *gin.Context) {
|
||||||
|
out, err := a.serverService.GetNewmlkem768()
|
||||||
|
if err != nil {
|
||||||
|
jsonMsg(c, "Failed to generate mlkem768 keys", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
jsonObj(c, out, nil)
|
||||||
|
}
|
||||||
|
|||||||
@@ -4,14 +4,15 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"x-ui/util/crypto"
|
"github.com/mhsanaei/3x-ui/v2/util/crypto"
|
||||||
"x-ui/web/entity"
|
"github.com/mhsanaei/3x-ui/v2/web/entity"
|
||||||
"x-ui/web/service"
|
"github.com/mhsanaei/3x-ui/v2/web/service"
|
||||||
"x-ui/web/session"
|
"github.com/mhsanaei/3x-ui/v2/web/session"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// updateUserForm represents the form for updating user credentials.
|
||||||
type updateUserForm struct {
|
type updateUserForm struct {
|
||||||
OldUsername string `json:"oldUsername" form:"oldUsername"`
|
OldUsername string `json:"oldUsername" form:"oldUsername"`
|
||||||
OldPassword string `json:"oldPassword" form:"oldPassword"`
|
OldPassword string `json:"oldPassword" form:"oldPassword"`
|
||||||
@@ -19,18 +20,21 @@ type updateUserForm struct {
|
|||||||
NewPassword string `json:"newPassword" form:"newPassword"`
|
NewPassword string `json:"newPassword" form:"newPassword"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SettingController handles settings and user management operations.
|
||||||
type SettingController struct {
|
type SettingController struct {
|
||||||
settingService service.SettingService
|
settingService service.SettingService
|
||||||
userService service.UserService
|
userService service.UserService
|
||||||
panelService service.PanelService
|
panelService service.PanelService
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NewSettingController creates a new SettingController and initializes its routes.
|
||||||
func NewSettingController(g *gin.RouterGroup) *SettingController {
|
func NewSettingController(g *gin.RouterGroup) *SettingController {
|
||||||
a := &SettingController{}
|
a := &SettingController{}
|
||||||
a.initRouter(g)
|
a.initRouter(g)
|
||||||
return a
|
return a
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// initRouter sets up the routes for settings management.
|
||||||
func (a *SettingController) initRouter(g *gin.RouterGroup) {
|
func (a *SettingController) initRouter(g *gin.RouterGroup) {
|
||||||
g = g.Group("/setting")
|
g = g.Group("/setting")
|
||||||
|
|
||||||
@@ -42,6 +46,7 @@ func (a *SettingController) initRouter(g *gin.RouterGroup) {
|
|||||||
g.GET("/getDefaultJsonConfig", a.getDefaultXrayConfig)
|
g.GET("/getDefaultJsonConfig", a.getDefaultXrayConfig)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// getAllSetting retrieves all current settings.
|
||||||
func (a *SettingController) getAllSetting(c *gin.Context) {
|
func (a *SettingController) getAllSetting(c *gin.Context) {
|
||||||
allSetting, err := a.settingService.GetAllSetting()
|
allSetting, err := a.settingService.GetAllSetting()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -51,6 +56,7 @@ func (a *SettingController) getAllSetting(c *gin.Context) {
|
|||||||
jsonObj(c, allSetting, nil)
|
jsonObj(c, allSetting, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// getDefaultSettings retrieves the default settings based on the host.
|
||||||
func (a *SettingController) getDefaultSettings(c *gin.Context) {
|
func (a *SettingController) getDefaultSettings(c *gin.Context) {
|
||||||
result, err := a.settingService.GetDefaultSettings(c.Request.Host)
|
result, err := a.settingService.GetDefaultSettings(c.Request.Host)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -60,6 +66,7 @@ func (a *SettingController) getDefaultSettings(c *gin.Context) {
|
|||||||
jsonObj(c, result, nil)
|
jsonObj(c, result, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// updateSetting updates all settings with the provided data.
|
||||||
func (a *SettingController) updateSetting(c *gin.Context) {
|
func (a *SettingController) updateSetting(c *gin.Context) {
|
||||||
allSetting := &entity.AllSetting{}
|
allSetting := &entity.AllSetting{}
|
||||||
err := c.ShouldBind(allSetting)
|
err := c.ShouldBind(allSetting)
|
||||||
@@ -71,6 +78,7 @@ func (a *SettingController) updateSetting(c *gin.Context) {
|
|||||||
jsonMsg(c, I18nWeb(c, "pages.settings.toasts.modifySettings"), err)
|
jsonMsg(c, I18nWeb(c, "pages.settings.toasts.modifySettings"), err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// updateUser updates the current user's username and password.
|
||||||
func (a *SettingController) updateUser(c *gin.Context) {
|
func (a *SettingController) updateUser(c *gin.Context) {
|
||||||
form := &updateUserForm{}
|
form := &updateUserForm{}
|
||||||
err := c.ShouldBind(form)
|
err := c.ShouldBind(form)
|
||||||
@@ -96,11 +104,13 @@ func (a *SettingController) updateUser(c *gin.Context) {
|
|||||||
jsonMsg(c, I18nWeb(c, "pages.settings.toasts.modifyUser"), err)
|
jsonMsg(c, I18nWeb(c, "pages.settings.toasts.modifyUser"), err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// restartPanel restarts the panel service after a delay.
|
||||||
func (a *SettingController) restartPanel(c *gin.Context) {
|
func (a *SettingController) restartPanel(c *gin.Context) {
|
||||||
err := a.panelService.RestartPanel(time.Second * 3)
|
err := a.panelService.RestartPanel(time.Second * 3)
|
||||||
jsonMsg(c, I18nWeb(c, "pages.settings.restartPanelSuccess"), err)
|
jsonMsg(c, I18nWeb(c, "pages.settings.restartPanelSuccess"), err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// getDefaultXrayConfig retrieves the default Xray configuration.
|
||||||
func (a *SettingController) getDefaultXrayConfig(c *gin.Context) {
|
func (a *SettingController) getDefaultXrayConfig(c *gin.Context) {
|
||||||
defaultJsonConfig, err := a.settingService.GetDefaultXrayConfig()
|
defaultJsonConfig, err := a.settingService.GetDefaultXrayConfig()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -5,13 +5,14 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"x-ui/config"
|
"github.com/mhsanaei/3x-ui/v2/config"
|
||||||
"x-ui/logger"
|
"github.com/mhsanaei/3x-ui/v2/logger"
|
||||||
"x-ui/web/entity"
|
"github.com/mhsanaei/3x-ui/v2/web/entity"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// getRemoteIp extracts the real IP address from the request headers or remote address.
|
||||||
func getRemoteIp(c *gin.Context) string {
|
func getRemoteIp(c *gin.Context) string {
|
||||||
value := c.GetHeader("X-Real-IP")
|
value := c.GetHeader("X-Real-IP")
|
||||||
if value != "" {
|
if value != "" {
|
||||||
@@ -27,14 +28,17 @@ func getRemoteIp(c *gin.Context) string {
|
|||||||
return ip
|
return ip
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// jsonMsg sends a JSON response with a message and error status.
|
||||||
func jsonMsg(c *gin.Context, msg string, err error) {
|
func jsonMsg(c *gin.Context, msg string, err error) {
|
||||||
jsonMsgObj(c, msg, nil, err)
|
jsonMsgObj(c, msg, nil, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// jsonObj sends a JSON response with an object and error status.
|
||||||
func jsonObj(c *gin.Context, obj any, err error) {
|
func jsonObj(c *gin.Context, obj any, err error) {
|
||||||
jsonMsgObj(c, "", obj, err)
|
jsonMsgObj(c, "", obj, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// jsonMsgObj sends a JSON response with a message, object, and error status.
|
||||||
func jsonMsgObj(c *gin.Context, msg string, obj any, err error) {
|
func jsonMsgObj(c *gin.Context, msg string, obj any, err error) {
|
||||||
m := entity.Msg{
|
m := entity.Msg{
|
||||||
Obj: obj,
|
Obj: obj,
|
||||||
@@ -52,6 +56,7 @@ func jsonMsgObj(c *gin.Context, msg string, obj any, err error) {
|
|||||||
c.JSON(http.StatusOK, m)
|
c.JSON(http.StatusOK, m)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// pureJsonMsg sends a pure JSON message response with custom status code.
|
||||||
func pureJsonMsg(c *gin.Context, statusCode int, success bool, msg string) {
|
func pureJsonMsg(c *gin.Context, statusCode int, success bool, msg string) {
|
||||||
c.JSON(statusCode, entity.Msg{
|
c.JSON(statusCode, entity.Msg{
|
||||||
Success: success,
|
Success: success,
|
||||||
@@ -59,6 +64,7 @@ func pureJsonMsg(c *gin.Context, statusCode int, success bool, msg string) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// html renders an HTML template with the provided data and title.
|
||||||
func html(c *gin.Context, name string, title string, data gin.H) {
|
func html(c *gin.Context, name string, title string, data gin.H) {
|
||||||
if data == nil {
|
if data == nil {
|
||||||
data = gin.H{}
|
data = gin.H{}
|
||||||
@@ -81,6 +87,7 @@ func html(c *gin.Context, name string, title string, data gin.H) {
|
|||||||
c.HTML(http.StatusOK, name, getContext(data))
|
c.HTML(http.StatusOK, name, getContext(data))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// getContext adds version and other context data to the provided gin.H.
|
||||||
func getContext(h gin.H) gin.H {
|
func getContext(h gin.H) gin.H {
|
||||||
a := gin.H{
|
a := gin.H{
|
||||||
"cur_ver": config.GetVersion(),
|
"cur_ver": config.GetVersion(),
|
||||||
@@ -91,6 +98,7 @@ func getContext(h gin.H) gin.H {
|
|||||||
return a
|
return a
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// isAjax checks if the request is an AJAX request.
|
||||||
func isAjax(c *gin.Context) bool {
|
func isAjax(c *gin.Context) bool {
|
||||||
return c.GetHeader("X-Requested-With") == "XMLHttpRequest"
|
return c.GetHeader("X-Requested-With") == "XMLHttpRequest"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
package controller
|
package controller
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"x-ui/web/service"
|
"github.com/mhsanaei/3x-ui/v2/web/service"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// XraySettingController handles Xray configuration and settings operations.
|
||||||
type XraySettingController struct {
|
type XraySettingController struct {
|
||||||
XraySettingService service.XraySettingService
|
XraySettingService service.XraySettingService
|
||||||
SettingService service.SettingService
|
SettingService service.SettingService
|
||||||
@@ -15,24 +16,27 @@ type XraySettingController struct {
|
|||||||
WarpService service.WarpService
|
WarpService service.WarpService
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NewXraySettingController creates a new XraySettingController and initializes its routes.
|
||||||
func NewXraySettingController(g *gin.RouterGroup) *XraySettingController {
|
func NewXraySettingController(g *gin.RouterGroup) *XraySettingController {
|
||||||
a := &XraySettingController{}
|
a := &XraySettingController{}
|
||||||
a.initRouter(g)
|
a.initRouter(g)
|
||||||
return a
|
return a
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// initRouter sets up the routes for Xray settings management.
|
||||||
func (a *XraySettingController) initRouter(g *gin.RouterGroup) {
|
func (a *XraySettingController) initRouter(g *gin.RouterGroup) {
|
||||||
g = g.Group("/xray")
|
g = g.Group("/xray")
|
||||||
|
g.GET("/getDefaultJsonConfig", a.getDefaultXrayConfig)
|
||||||
|
g.GET("/getOutboundsTraffic", a.getOutboundsTraffic)
|
||||||
|
g.GET("/getXrayResult", a.getXrayResult)
|
||||||
|
|
||||||
g.POST("/", a.getXraySetting)
|
g.POST("/", a.getXraySetting)
|
||||||
g.POST("/update", a.updateSetting)
|
|
||||||
g.GET("/getXrayResult", a.getXrayResult)
|
|
||||||
g.GET("/getDefaultJsonConfig", a.getDefaultXrayConfig)
|
|
||||||
g.POST("/warp/:action", a.warp)
|
g.POST("/warp/:action", a.warp)
|
||||||
g.GET("/getOutboundsTraffic", a.getOutboundsTraffic)
|
g.POST("/update", a.updateSetting)
|
||||||
g.POST("/resetOutboundsTraffic", a.resetOutboundsTraffic)
|
g.POST("/resetOutboundsTraffic", a.resetOutboundsTraffic)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// getXraySetting retrieves the Xray configuration template and inbound tags.
|
||||||
func (a *XraySettingController) getXraySetting(c *gin.Context) {
|
func (a *XraySettingController) getXraySetting(c *gin.Context) {
|
||||||
xraySetting, err := a.SettingService.GetXrayConfigTemplate()
|
xraySetting, err := a.SettingService.GetXrayConfigTemplate()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -48,12 +52,14 @@ func (a *XraySettingController) getXraySetting(c *gin.Context) {
|
|||||||
jsonObj(c, xrayResponse, nil)
|
jsonObj(c, xrayResponse, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// updateSetting updates the Xray configuration settings.
|
||||||
func (a *XraySettingController) updateSetting(c *gin.Context) {
|
func (a *XraySettingController) updateSetting(c *gin.Context) {
|
||||||
xraySetting := c.PostForm("xraySetting")
|
xraySetting := c.PostForm("xraySetting")
|
||||||
err := a.XraySettingService.SaveXraySetting(xraySetting)
|
err := a.XraySettingService.SaveXraySetting(xraySetting)
|
||||||
jsonMsg(c, I18nWeb(c, "pages.settings.toasts.modifySettings"), err)
|
jsonMsg(c, I18nWeb(c, "pages.settings.toasts.modifySettings"), err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// getDefaultXrayConfig retrieves the default Xray configuration.
|
||||||
func (a *XraySettingController) getDefaultXrayConfig(c *gin.Context) {
|
func (a *XraySettingController) getDefaultXrayConfig(c *gin.Context) {
|
||||||
defaultJsonConfig, err := a.SettingService.GetDefaultXrayConfig()
|
defaultJsonConfig, err := a.SettingService.GetDefaultXrayConfig()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -63,10 +69,12 @@ func (a *XraySettingController) getDefaultXrayConfig(c *gin.Context) {
|
|||||||
jsonObj(c, defaultJsonConfig, nil)
|
jsonObj(c, defaultJsonConfig, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// getXrayResult retrieves the current Xray service result.
|
||||||
func (a *XraySettingController) getXrayResult(c *gin.Context) {
|
func (a *XraySettingController) getXrayResult(c *gin.Context) {
|
||||||
jsonObj(c, a.XrayService.GetXrayResult(), nil)
|
jsonObj(c, a.XrayService.GetXrayResult(), nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// warp handles Warp-related operations based on the action parameter.
|
||||||
func (a *XraySettingController) warp(c *gin.Context) {
|
func (a *XraySettingController) warp(c *gin.Context) {
|
||||||
action := c.Param("action")
|
action := c.Param("action")
|
||||||
var resp string
|
var resp string
|
||||||
@@ -90,6 +98,7 @@ func (a *XraySettingController) warp(c *gin.Context) {
|
|||||||
jsonObj(c, resp, err)
|
jsonObj(c, resp, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// getOutboundsTraffic retrieves the traffic statistics for outbounds.
|
||||||
func (a *XraySettingController) getOutboundsTraffic(c *gin.Context) {
|
func (a *XraySettingController) getOutboundsTraffic(c *gin.Context) {
|
||||||
outboundsTraffic, err := a.OutboundService.GetOutboundsTraffic()
|
outboundsTraffic, err := a.OutboundService.GetOutboundsTraffic()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -99,6 +108,7 @@ func (a *XraySettingController) getOutboundsTraffic(c *gin.Context) {
|
|||||||
jsonObj(c, outboundsTraffic, nil)
|
jsonObj(c, outboundsTraffic, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// resetOutboundsTraffic resets the traffic statistics for the specified outbound tag.
|
||||||
func (a *XraySettingController) resetOutboundsTraffic(c *gin.Context) {
|
func (a *XraySettingController) resetOutboundsTraffic(c *gin.Context) {
|
||||||
tag := c.PostForm("tag")
|
tag := c.PostForm("tag")
|
||||||
err := a.OutboundService.ResetOutboundTraffic(tag)
|
err := a.OutboundService.ResetOutboundTraffic(tag)
|
||||||
|
|||||||
@@ -4,20 +4,24 @@ import (
|
|||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// XUIController is the main controller for the X-UI panel, managing sub-controllers.
|
||||||
type XUIController struct {
|
type XUIController struct {
|
||||||
BaseController
|
BaseController
|
||||||
|
|
||||||
inboundController *InboundController
|
inboundController *InboundController
|
||||||
|
serverController *ServerController
|
||||||
settingController *SettingController
|
settingController *SettingController
|
||||||
xraySettingController *XraySettingController
|
xraySettingController *XraySettingController
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NewXUIController creates a new XUIController and initializes its routes.
|
||||||
func NewXUIController(g *gin.RouterGroup) *XUIController {
|
func NewXUIController(g *gin.RouterGroup) *XUIController {
|
||||||
a := &XUIController{}
|
a := &XUIController{}
|
||||||
a.initRouter(g)
|
a.initRouter(g)
|
||||||
return a
|
return a
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// initRouter sets up the main panel routes and initializes sub-controllers.
|
||||||
func (a *XUIController) initRouter(g *gin.RouterGroup) {
|
func (a *XUIController) initRouter(g *gin.RouterGroup) {
|
||||||
g = g.Group("/panel")
|
g = g.Group("/panel")
|
||||||
g.Use(a.checkLogin)
|
g.Use(a.checkLogin)
|
||||||
@@ -28,22 +32,27 @@ func (a *XUIController) initRouter(g *gin.RouterGroup) {
|
|||||||
g.GET("/xray", a.xraySettings)
|
g.GET("/xray", a.xraySettings)
|
||||||
|
|
||||||
a.inboundController = NewInboundController(g)
|
a.inboundController = NewInboundController(g)
|
||||||
|
a.serverController = NewServerController(g)
|
||||||
a.settingController = NewSettingController(g)
|
a.settingController = NewSettingController(g)
|
||||||
a.xraySettingController = NewXraySettingController(g)
|
a.xraySettingController = NewXraySettingController(g)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// index renders the main panel index page.
|
||||||
func (a *XUIController) index(c *gin.Context) {
|
func (a *XUIController) index(c *gin.Context) {
|
||||||
html(c, "index.html", "pages.index.title", nil)
|
html(c, "index.html", "pages.index.title", nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// inbounds renders the inbounds management page.
|
||||||
func (a *XUIController) inbounds(c *gin.Context) {
|
func (a *XUIController) inbounds(c *gin.Context) {
|
||||||
html(c, "inbounds.html", "pages.inbounds.title", nil)
|
html(c, "inbounds.html", "pages.inbounds.title", nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// settings renders the settings management page.
|
||||||
func (a *XUIController) settings(c *gin.Context) {
|
func (a *XUIController) settings(c *gin.Context) {
|
||||||
html(c, "settings.html", "pages.settings.title", nil)
|
html(c, "settings.html", "pages.settings.title", nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// xraySettings renders the Xray settings page.
|
||||||
func (a *XUIController) xraySettings(c *gin.Context) {
|
func (a *XUIController) xraySettings(c *gin.Context) {
|
||||||
html(c, "xray.html", "pages.xray.title", nil)
|
html(c, "xray.html", "pages.xray.title", nil)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,69 +1,83 @@
|
|||||||
|
// Package entity defines data structures and entities used by the web layer of the 3x-ui panel.
|
||||||
package entity
|
package entity
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
|
"math"
|
||||||
"net"
|
"net"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
"math"
|
|
||||||
|
|
||||||
"x-ui/util/common"
|
"github.com/mhsanaei/3x-ui/v2/util/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Msg represents a standard API response message with success status, message text, and optional data object.
|
||||||
type Msg struct {
|
type Msg struct {
|
||||||
Success bool `json:"success"`
|
Success bool `json:"success"` // Indicates if the operation was successful
|
||||||
Msg string `json:"msg"`
|
Msg string `json:"msg"` // Response message text
|
||||||
Obj any `json:"obj"`
|
Obj any `json:"obj"` // Optional data object
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AllSetting contains all configuration settings for the 3x-ui panel including web server, Telegram bot, and subscription settings.
|
||||||
type AllSetting struct {
|
type AllSetting struct {
|
||||||
WebListen string `json:"webListen" form:"webListen"`
|
// Web server settings
|
||||||
WebDomain string `json:"webDomain" form:"webDomain"`
|
WebListen string `json:"webListen" form:"webListen"` // Web server listen IP address
|
||||||
WebPort int `json:"webPort" form:"webPort"`
|
WebDomain string `json:"webDomain" form:"webDomain"` // Web server domain for domain validation
|
||||||
WebCertFile string `json:"webCertFile" form:"webCertFile"`
|
WebPort int `json:"webPort" form:"webPort"` // Web server port number
|
||||||
WebKeyFile string `json:"webKeyFile" form:"webKeyFile"`
|
WebCertFile string `json:"webCertFile" form:"webCertFile"` // Path to SSL certificate file for web server
|
||||||
WebBasePath string `json:"webBasePath" form:"webBasePath"`
|
WebKeyFile string `json:"webKeyFile" form:"webKeyFile"` // Path to SSL private key file for web server
|
||||||
SessionMaxAge int `json:"sessionMaxAge" form:"sessionMaxAge"`
|
WebBasePath string `json:"webBasePath" form:"webBasePath"` // Base path for web panel URLs
|
||||||
PageSize int `json:"pageSize" form:"pageSize"`
|
SessionMaxAge int `json:"sessionMaxAge" form:"sessionMaxAge"` // Session maximum age in minutes
|
||||||
ExpireDiff int `json:"expireDiff" form:"expireDiff"`
|
|
||||||
TrafficDiff int `json:"trafficDiff" form:"trafficDiff"`
|
// UI settings
|
||||||
RemarkModel string `json:"remarkModel" form:"remarkModel"`
|
PageSize int `json:"pageSize" form:"pageSize"` // Number of items per page in lists
|
||||||
TgBotEnable bool `json:"tgBotEnable" form:"tgBotEnable"`
|
ExpireDiff int `json:"expireDiff" form:"expireDiff"` // Expiration warning threshold in days
|
||||||
TgBotToken string `json:"tgBotToken" form:"tgBotToken"`
|
TrafficDiff int `json:"trafficDiff" form:"trafficDiff"` // Traffic warning threshold percentage
|
||||||
TgBotProxy string `json:"tgBotProxy" form:"tgBotProxy"`
|
RemarkModel string `json:"remarkModel" form:"remarkModel"` // Remark model pattern for inbounds
|
||||||
TgBotAPIServer string `json:"tgBotAPIServer" form:"tgBotAPIServer"`
|
Datepicker string `json:"datepicker" form:"datepicker"` // Date picker format
|
||||||
TgBotChatId string `json:"tgBotChatId" form:"tgBotChatId"`
|
|
||||||
TgRunTime string `json:"tgRunTime" form:"tgRunTime"`
|
// Telegram bot settings
|
||||||
TgBotBackup bool `json:"tgBotBackup" form:"tgBotBackup"`
|
TgBotEnable bool `json:"tgBotEnable" form:"tgBotEnable"` // Enable Telegram bot notifications
|
||||||
TgBotLoginNotify bool `json:"tgBotLoginNotify" form:"tgBotLoginNotify"`
|
TgBotToken string `json:"tgBotToken" form:"tgBotToken"` // Telegram bot token
|
||||||
TgCpu int `json:"tgCpu" form:"tgCpu"`
|
TgBotProxy string `json:"tgBotProxy" form:"tgBotProxy"` // Proxy URL for Telegram bot
|
||||||
TgLang string `json:"tgLang" form:"tgLang"`
|
TgBotAPIServer string `json:"tgBotAPIServer" form:"tgBotAPIServer"` // Custom API server for Telegram bot
|
||||||
TimeLocation string `json:"timeLocation" form:"timeLocation"`
|
TgBotChatId string `json:"tgBotChatId" form:"tgBotChatId"` // Telegram chat ID for notifications
|
||||||
TwoFactorEnable bool `json:"twoFactorEnable" form:"twoFactorEnable"`
|
TgRunTime string `json:"tgRunTime" form:"tgRunTime"` // Cron schedule for Telegram notifications
|
||||||
TwoFactorToken string `json:"twoFactorToken" form:"twoFactorToken"`
|
TgBotBackup bool `json:"tgBotBackup" form:"tgBotBackup"` // Enable database backup via Telegram
|
||||||
SubEnable bool `json:"subEnable" form:"subEnable"`
|
TgBotLoginNotify bool `json:"tgBotLoginNotify" form:"tgBotLoginNotify"` // Send login notifications
|
||||||
SubTitle string `json:"subTitle" form:"subTitle"`
|
TgCpu int `json:"tgCpu" form:"tgCpu"` // CPU usage threshold for alerts
|
||||||
SubListen string `json:"subListen" form:"subListen"`
|
TgLang string `json:"tgLang" form:"tgLang"` // Telegram bot language
|
||||||
SubPort int `json:"subPort" form:"subPort"`
|
|
||||||
SubPath string `json:"subPath" form:"subPath"`
|
// Security settings
|
||||||
SubDomain string `json:"subDomain" form:"subDomain"`
|
TimeLocation string `json:"timeLocation" form:"timeLocation"` // Time zone location
|
||||||
SubCertFile string `json:"subCertFile" form:"subCertFile"`
|
TwoFactorEnable bool `json:"twoFactorEnable" form:"twoFactorEnable"` // Enable two-factor authentication
|
||||||
SubKeyFile string `json:"subKeyFile" form:"subKeyFile"`
|
TwoFactorToken string `json:"twoFactorToken" form:"twoFactorToken"` // Two-factor authentication token
|
||||||
SubUpdates int `json:"subUpdates" form:"subUpdates"`
|
|
||||||
ExternalTrafficInformEnable bool `json:"externalTrafficInformEnable" form:"externalTrafficInformEnable"`
|
// Subscription server settings
|
||||||
ExternalTrafficInformURI string `json:"externalTrafficInformURI" form:"externalTrafficInformURI"`
|
SubEnable bool `json:"subEnable" form:"subEnable"` // Enable subscription server
|
||||||
SubEncrypt bool `json:"subEncrypt" form:"subEncrypt"`
|
SubJsonEnable bool `json:"subJsonEnable" form:"subJsonEnable"` // Enable JSON subscription endpoint
|
||||||
SubShowInfo bool `json:"subShowInfo" form:"subShowInfo"`
|
SubTitle string `json:"subTitle" form:"subTitle"` // Subscription title
|
||||||
SubURI string `json:"subURI" form:"subURI"`
|
SubListen string `json:"subListen" form:"subListen"` // Subscription server listen IP
|
||||||
SubJsonPath string `json:"subJsonPath" form:"subJsonPath"`
|
SubPort int `json:"subPort" form:"subPort"` // Subscription server port
|
||||||
SubJsonURI string `json:"subJsonURI" form:"subJsonURI"`
|
SubPath string `json:"subPath" form:"subPath"` // Base path for subscription URLs
|
||||||
SubJsonFragment string `json:"subJsonFragment" form:"subJsonFragment"`
|
SubDomain string `json:"subDomain" form:"subDomain"` // Domain for subscription server validation
|
||||||
SubJsonNoises string `json:"subJsonNoises" form:"subJsonNoises"`
|
SubCertFile string `json:"subCertFile" form:"subCertFile"` // SSL certificate file for subscription server
|
||||||
SubJsonMux string `json:"subJsonMux" form:"subJsonMux"`
|
SubKeyFile string `json:"subKeyFile" form:"subKeyFile"` // SSL private key file for subscription server
|
||||||
SubJsonRules string `json:"subJsonRules" form:"subJsonRules"`
|
SubUpdates int `json:"subUpdates" form:"subUpdates"` // Subscription update interval in minutes
|
||||||
Datepicker string `json:"datepicker" form:"datepicker"`
|
ExternalTrafficInformEnable bool `json:"externalTrafficInformEnable" form:"externalTrafficInformEnable"` // Enable external traffic reporting
|
||||||
|
ExternalTrafficInformURI string `json:"externalTrafficInformURI" form:"externalTrafficInformURI"` // URI for external traffic reporting
|
||||||
|
SubEncrypt bool `json:"subEncrypt" form:"subEncrypt"` // Encrypt subscription responses
|
||||||
|
SubShowInfo bool `json:"subShowInfo" form:"subShowInfo"` // Show client information in subscriptions
|
||||||
|
SubURI string `json:"subURI" form:"subURI"` // Subscription server URI
|
||||||
|
SubJsonPath string `json:"subJsonPath" form:"subJsonPath"` // Path for JSON subscription endpoint
|
||||||
|
SubJsonURI string `json:"subJsonURI" form:"subJsonURI"` // JSON subscription server URI
|
||||||
|
SubJsonFragment string `json:"subJsonFragment" form:"subJsonFragment"` // JSON subscription fragment configuration
|
||||||
|
SubJsonNoises string `json:"subJsonNoises" form:"subJsonNoises"` // JSON subscription noise configuration
|
||||||
|
SubJsonMux string `json:"subJsonMux" form:"subJsonMux"` // JSON subscription mux configuration
|
||||||
|
SubJsonRules string `json:"subJsonRules" form:"subJsonRules"` // JSON subscription routing rules
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CheckValid validates all settings in the AllSetting struct, checking IP addresses, ports, SSL certificates, and other configuration values.
|
||||||
func (s *AllSetting) CheckValid() error {
|
func (s *AllSetting) CheckValid() error {
|
||||||
if s.WebListen != "" {
|
if s.WebListen != "" {
|
||||||
ip := net.ParseIP(s.WebListen)
|
ip := net.ParseIP(s.WebListen)
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// Package global provides global variables and interfaces for accessing web and subscription servers.
|
||||||
package global
|
package global
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@@ -12,27 +13,33 @@ var (
|
|||||||
subServer SubServer
|
subServer SubServer
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// WebServer interface defines methods for accessing the web server instance.
|
||||||
type WebServer interface {
|
type WebServer interface {
|
||||||
GetCron() *cron.Cron
|
GetCron() *cron.Cron // Get the cron scheduler
|
||||||
GetCtx() context.Context
|
GetCtx() context.Context // Get the server context
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SubServer interface defines methods for accessing the subscription server instance.
|
||||||
type SubServer interface {
|
type SubServer interface {
|
||||||
GetCtx() context.Context
|
GetCtx() context.Context // Get the server context
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SetWebServer sets the global web server instance.
|
||||||
func SetWebServer(s WebServer) {
|
func SetWebServer(s WebServer) {
|
||||||
webServer = s
|
webServer = s
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetWebServer returns the global web server instance.
|
||||||
func GetWebServer() WebServer {
|
func GetWebServer() WebServer {
|
||||||
return webServer
|
return webServer
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SetSubServer sets the global subscription server instance.
|
||||||
func SetSubServer(s SubServer) {
|
func SetSubServer(s SubServer) {
|
||||||
subServer = s
|
subServer = s
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetSubServer returns the global subscription server instance.
|
||||||
func GetSubServer() SubServer {
|
func GetSubServer() SubServer {
|
||||||
return subServer
|
return subServer
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,18 +8,21 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// HashEntry represents a stored hash entry with its value and timestamp.
|
||||||
type HashEntry struct {
|
type HashEntry struct {
|
||||||
Hash string
|
Hash string // MD5 hash string
|
||||||
Value string
|
Value string // Original value
|
||||||
Timestamp time.Time
|
Timestamp time.Time // Time when the hash was created
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// HashStorage provides thread-safe storage for hash-value pairs with expiration.
|
||||||
type HashStorage struct {
|
type HashStorage struct {
|
||||||
sync.RWMutex
|
sync.RWMutex
|
||||||
Data map[string]HashEntry
|
Data map[string]HashEntry // Map of hash to entry
|
||||||
Expiration time.Duration
|
Expiration time.Duration // Expiration duration for entries
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NewHashStorage creates a new HashStorage instance with the specified expiration duration.
|
||||||
func NewHashStorage(expiration time.Duration) *HashStorage {
|
func NewHashStorage(expiration time.Duration) *HashStorage {
|
||||||
return &HashStorage{
|
return &HashStorage{
|
||||||
Data: make(map[string]HashEntry),
|
Data: make(map[string]HashEntry),
|
||||||
@@ -27,6 +30,7 @@ func NewHashStorage(expiration time.Duration) *HashStorage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SaveHash generates an MD5 hash for the given query string and stores it with a timestamp.
|
||||||
func (h *HashStorage) SaveHash(query string) string {
|
func (h *HashStorage) SaveHash(query string) string {
|
||||||
h.Lock()
|
h.Lock()
|
||||||
defer h.Unlock()
|
defer h.Unlock()
|
||||||
@@ -45,6 +49,7 @@ func (h *HashStorage) SaveHash(query string) string {
|
|||||||
return md5HashString
|
return md5HashString
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetValue retrieves the original value for the given hash, returning true if found.
|
||||||
func (h *HashStorage) GetValue(hash string) (string, bool) {
|
func (h *HashStorage) GetValue(hash string) (string, bool) {
|
||||||
h.RLock()
|
h.RLock()
|
||||||
defer h.RUnlock()
|
defer h.RUnlock()
|
||||||
@@ -54,11 +59,13 @@ func (h *HashStorage) GetValue(hash string) (string, bool) {
|
|||||||
return entry.Value, exists
|
return entry.Value, exists
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// IsMD5 checks if the given string is a valid 32-character MD5 hash.
|
||||||
func (h *HashStorage) IsMD5(hash string) bool {
|
func (h *HashStorage) IsMD5(hash string) bool {
|
||||||
match, _ := regexp.MatchString("^[a-f0-9]{32}$", hash)
|
match, _ := regexp.MatchString("^[a-f0-9]{32}$", hash)
|
||||||
return match
|
return match
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// RemoveExpiredHashes removes all hash entries that have exceeded the expiration duration.
|
||||||
func (h *HashStorage) RemoveExpiredHashes() {
|
func (h *HashStorage) RemoveExpiredHashes() {
|
||||||
h.Lock()
|
h.Lock()
|
||||||
defer h.Unlock()
|
defer h.Unlock()
|
||||||
@@ -72,6 +79,7 @@ func (h *HashStorage) RemoveExpiredHashes() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Reset clears all stored hash entries.
|
||||||
func (h *HashStorage) Reset() {
|
func (h *HashStorage) Reset() {
|
||||||
h.Lock()
|
h.Lock()
|
||||||
defer h.Unlock()
|
defer h.Unlock()
|
||||||
|
|||||||
@@ -2,21 +2,21 @@
|
|||||||
<template slot="actions" slot-scope="text, client, index">
|
<template slot="actions" slot-scope="text, client, index">
|
||||||
<a-tooltip>
|
<a-tooltip>
|
||||||
<template slot="title">{{ i18n "qrCode" }}</template>
|
<template slot="title">{{ i18n "qrCode" }}</template>
|
||||||
<a-icon :style="{ fontSize: '24px' }" class="normal-icon" type="qrcode" v-if="record.hasLink()" @click="showQrcode(record.id,client);"></a-icon>
|
<a-icon :style="{ fontSize: '22px', marginInlineStart: '14px' }" class="normal-icon" type="qrcode" v-if="record.hasLink()" @click="showQrcode(record.id,client);"></a-icon>
|
||||||
</a-tooltip>
|
</a-tooltip>
|
||||||
<a-tooltip>
|
<a-tooltip>
|
||||||
<template slot="title">{{ i18n "pages.client.edit" }}</template>
|
<template slot="title">{{ i18n "pages.client.edit" }}</template>
|
||||||
<a-icon :style="{ fontSize: '24px' }" class="normal-icon" type="edit" @click="openEditClient(record.id,client);"></a-icon>
|
<a-icon :style="{ fontSize: '22px' }" class="normal-icon" type="edit" @click="openEditClient(record.id,client);"></a-icon>
|
||||||
</a-tooltip>
|
</a-tooltip>
|
||||||
<a-tooltip>
|
<a-tooltip>
|
||||||
<template slot="title">{{ i18n "info" }}</template>
|
<template slot="title">{{ i18n "info" }}</template>
|
||||||
<a-icon :style="{ fontSize: '24px' }" class="normal-icon" type="info-circle" @click="showInfo(record.id,client);"></a-icon>
|
<a-icon :style="{ fontSize: '22px' }" class="normal-icon" type="info-circle" @click="showInfo(record.id,client);"></a-icon>
|
||||||
</a-tooltip>
|
</a-tooltip>
|
||||||
<a-tooltip>
|
<a-tooltip>
|
||||||
<template slot="title">{{ i18n "pages.inbounds.resetTraffic" }}</template>
|
<template slot="title">{{ i18n "pages.inbounds.resetTraffic" }}</template>
|
||||||
<a-popconfirm @confirm="resetClientTraffic(client,record.id,false)" title='{{ i18n "pages.inbounds.resetTrafficContent"}}' :overlay-class-name="themeSwitcher.currentTheme" ok-text='{{ i18n "reset"}}' cancel-text='{{ i18n "cancel"}}'>
|
<a-popconfirm @confirm="resetClientTraffic(client,record.id,false)" title='{{ i18n "pages.inbounds.resetTrafficContent"}}' :overlay-class-name="themeSwitcher.currentTheme" ok-text='{{ i18n "reset"}}' cancel-text='{{ i18n "cancel"}}'>
|
||||||
<a-icon slot="icon" type="question-circle-o" :style="{ color: 'var(--color-primary-100)'}"></a-icon>
|
<a-icon slot="icon" type="question-circle-o" :style="{ color: 'var(--color-primary-100)'}"></a-icon>
|
||||||
<a-icon :style="{ fontSize: '24px', cursor: 'pointer' }" class="normal-icon" type="retweet" v-if="client.email.length > 0"></a-icon>
|
<a-icon :style="{ fontSize: '22px', cursor: 'pointer' }" class="normal-icon" type="retweet" v-if="client.email.length > 0"></a-icon>
|
||||||
</a-popconfirm>
|
</a-popconfirm>
|
||||||
</a-tooltip>
|
</a-tooltip>
|
||||||
<a-tooltip>
|
<a-tooltip>
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
</template>
|
</template>
|
||||||
<a-popconfirm @confirm="delClient(record.id,client,false)" title='{{ i18n "pages.inbounds.deleteClientContent"}}' :overlay-class-name="themeSwitcher.currentTheme" ok-text='{{ i18n "delete"}}' ok-type="danger" cancel-text='{{ i18n "cancel"}}'>
|
<a-popconfirm @confirm="delClient(record.id,client,false)" title='{{ i18n "pages.inbounds.deleteClientContent"}}' :overlay-class-name="themeSwitcher.currentTheme" ok-text='{{ i18n "delete"}}' ok-type="danger" cancel-text='{{ i18n "cancel"}}'>
|
||||||
<a-icon slot="icon" type="question-circle-o" :style="{ color: '#e04141' }"></a-icon>
|
<a-icon slot="icon" type="question-circle-o" :style="{ color: '#e04141' }"></a-icon>
|
||||||
<a-icon :style="{ fontSize: '24px', cursor: 'pointer' }" class="delete-icon" type="delete" v-if="isRemovable(record.id)"></a-icon>
|
<a-icon :style="{ fontSize: '22px', cursor: 'pointer' }" class="delete-icon" type="delete" v-if="isRemovable(record.id)"></a-icon>
|
||||||
</a-popconfirm>
|
</a-popconfirm>
|
||||||
</a-tooltip>
|
</a-tooltip>
|
||||||
</template>
|
</template>
|
||||||
@@ -33,18 +33,23 @@
|
|||||||
<a-switch v-model="client.enable" @change="switchEnableClient(record.id,client)"></a-switch>
|
<a-switch v-model="client.enable" @change="switchEnableClient(record.id,client)"></a-switch>
|
||||||
</template>
|
</template>
|
||||||
<template slot="online" slot-scope="text, client, index">
|
<template slot="online" slot-scope="text, client, index">
|
||||||
<template v-if="client.enable && isClientOnline(client.email)">
|
<a-popover :overlay-class-name="themeSwitcher.currentTheme">
|
||||||
<a-tag color="green">{{ i18n "online" }}</a-tag>
|
<template slot="content" >
|
||||||
</template>
|
{{ i18n "lastOnline" }}: [[ formatLastOnline(client.email) ]]
|
||||||
<template v-else>
|
</template>
|
||||||
<a-tag>{{ i18n "offline" }}</a-tag>
|
<template v-if="client.enable && isClientOnline(client.email)">
|
||||||
</template>
|
<a-tag color="green">{{ i18n "online" }}</a-tag>
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<a-tag>{{ i18n "offline" }}</a-tag>
|
||||||
|
</template>
|
||||||
|
</a-popover>
|
||||||
</template>
|
</template>
|
||||||
<template slot="client" slot-scope="text, client">
|
<template slot="client" slot-scope="text, client">
|
||||||
<a-space direction="horizontal" :size="2">
|
<a-space direction="horizontal" :size="2">
|
||||||
<a-tooltip>
|
<a-tooltip>
|
||||||
<template slot="title">
|
<template slot="title">
|
||||||
<template v-if="!isClientEnabled(record, client.email)">{{ i18n "depleted" }}</template>
|
<template v-if="isClientDepleted(record, client.email)">{{ i18n "depleted" }}</template>
|
||||||
<template v-else-if="!client.enable">{{ i18n "disabled" }}</template>
|
<template v-else-if="!client.enable">{{ i18n "disabled" }}</template>
|
||||||
<template v-else-if="client.enable && isClientOnline(client.email)">{{ i18n "online" }}</template>
|
<template v-else-if="client.enable && isClientOnline(client.email)">{{ i18n "online" }}</template>
|
||||||
</template>
|
</template>
|
||||||
@@ -85,7 +90,7 @@
|
|||||||
<a-progress :stroke-color="themeSwitcher.isDarkTheme ? 'rgb(72 84 105)' : '#bcbcbc'" :show-info="false" :percent="statsProgress(record, client.email)" />
|
<a-progress :stroke-color="themeSwitcher.isDarkTheme ? 'rgb(72 84 105)' : '#bcbcbc'" :show-info="false" :percent="statsProgress(record, client.email)" />
|
||||||
</td>
|
</td>
|
||||||
<td class="tr-table-bar" v-else-if="client.totalGB > 0">
|
<td class="tr-table-bar" v-else-if="client.totalGB > 0">
|
||||||
<a-progress :stroke-color="clientStatsColor(record, client.email)" :show-info="false" :status="isClientEnabled(record, client.email)? 'exception' : ''" :percent="statsProgress(record, client.email)" />
|
<a-progress :stroke-color="clientStatsColor(record, client.email)" :show-info="false" :status="isClientDepleted(record, client.email)? 'exception' : ''" :percent="statsProgress(record, client.email)" />
|
||||||
</td>
|
</td>
|
||||||
<td v-else class="infinite-bar tr-table-bar">
|
<td v-else class="infinite-bar tr-table-bar">
|
||||||
<a-progress :show-info="false" :percent="100"></a-progress>
|
<a-progress :show-info="false" :percent="100"></a-progress>
|
||||||
@@ -98,6 +103,10 @@
|
|||||||
</table>
|
</table>
|
||||||
</a-popover>
|
</a-popover>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<template slot="allTime" slot-scope="text, client">
|
||||||
|
<a-tag>[[ SizeFormatter.sizeFormat(getAllTimeClient(record, client.email)) ]]</a-tag>
|
||||||
|
</template>
|
||||||
<template slot="expiryTime" slot-scope="text, client, index">
|
<template slot="expiryTime" slot-scope="text, client, index">
|
||||||
<template v-if="client.expiryTime !=0 && client.reset >0">
|
<template v-if="client.expiryTime !=0 && client.reset >0">
|
||||||
<a-popover :overlay-class-name="themeSwitcher.currentTheme">
|
<a-popover :overlay-class-name="themeSwitcher.currentTheme">
|
||||||
@@ -117,7 +126,7 @@
|
|||||||
<tr class="tr-table-box">
|
<tr class="tr-table-box">
|
||||||
<td class="tr-table-rt"> [[ remainedDays(client.expiryTime) ]] </td>
|
<td class="tr-table-rt"> [[ remainedDays(client.expiryTime) ]] </td>
|
||||||
<td class="infinite-bar tr-table-bar">
|
<td class="infinite-bar tr-table-bar">
|
||||||
<a-progress :show-info="false" :status="isClientEnabled(record, client.email)? 'exception' : ''" :percent="expireProgress(client.expiryTime, client.reset)" />
|
<a-progress :show-info="false" :status="isClientDepleted(record, client.email)? 'exception' : ''" :percent="expireProgress(client.expiryTime, client.reset)" />
|
||||||
</td>
|
</td>
|
||||||
<td class="tr-table-lt">[[ client.reset + "d" ]]</td>
|
<td class="tr-table-lt">[[ client.reset + "d" ]]</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -204,7 +213,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</template>
|
</template>
|
||||||
<a-progress :stroke-color="clientStatsColor(record, client.email)" :show-info="false" :status="isClientEnabled(record, client.email)? 'exception' : ''" :percent="statsProgress(record, client.email)" />
|
<a-progress :stroke-color="clientStatsColor(record, client.email)" :show-info="false" :status="isClientDepleted(record, client.email)? 'exception' : ''" :percent="statsProgress(record, client.email)" />
|
||||||
</a-popover>
|
</a-popover>
|
||||||
</td>
|
</td>
|
||||||
<td width="120px" v-else class="infinite-bar">
|
<td width="120px" v-else class="infinite-bar">
|
||||||
@@ -238,7 +247,7 @@
|
|||||||
</template>
|
</template>
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
<a-progress :show-info="false" :status="isClientEnabled(record, client.email)? 'exception' : ''" :percent="expireProgress(client.expiryTime, client.reset)" />
|
<a-progress :show-info="false" :status="isClientDepleted(record, client.email)? 'exception' : ''" :percent="expireProgress(client.expiryTime, client.reset)" />
|
||||||
</a-popover>
|
</a-popover>
|
||||||
</td>
|
</td>
|
||||||
<td width="60px">[[ client.reset + "d" ]]</td>
|
<td width="60px">[[ client.reset + "d" ]]</td>
|
||||||
@@ -278,4 +287,30 @@
|
|||||||
</a-badge>
|
</a-badge>
|
||||||
</a-popover>
|
</a-popover>
|
||||||
</template>
|
</template>
|
||||||
|
<template slot="createdAt" slot-scope="text, client, index">
|
||||||
|
<template v-if="client.created_at">
|
||||||
|
<template v-if="app.datepicker === 'gregorian'">
|
||||||
|
[[ DateUtil.formatMillis(client.created_at) ]]
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
[[ DateUtil.convertToJalalian(moment(client.created_at)) ]]
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
-
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
|
<template slot="updatedAt" slot-scope="text, client, index">
|
||||||
|
<template v-if="client.updated_at">
|
||||||
|
<template v-if="app.datepicker === 'gregorian'">
|
||||||
|
[[ DateUtil.formatMillis(client.updated_at) ]]
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
[[ DateUtil.convertToJalalian(moment(client.updated_at)) ]]
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
-
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|||||||
@@ -1,15 +0,0 @@
|
|||||||
{{define "form/allocate"}}
|
|
||||||
<a-form :colon="false" :label-col="{ md: {span:8} }" :wrapper-col="{ md: {span:14} }">
|
|
||||||
<a-form-item label='Strategy'>
|
|
||||||
<a-select v-model="inbound.allocate.strategy" :dropdown-class-name="themeSwitcher.currentTheme">
|
|
||||||
<a-select-option v-for="s in ['always','random']" :value="s">[[ s ]]</a-select-option>
|
|
||||||
</a-select>
|
|
||||||
</a-form-item>
|
|
||||||
<a-form-item label='Refresh'>
|
|
||||||
<a-input-number v-model.number="inbound.allocate.refresh" min="0"></a-input-number>
|
|
||||||
</a-form-item>
|
|
||||||
<a-form-item label='Concurrency'>
|
|
||||||
<a-input-number v-model.number="inbound.allocate.concurrency" min="0"></a-input-number>
|
|
||||||
</a-form-item>
|
|
||||||
</a-form>
|
|
||||||
{{end}}
|
|
||||||
@@ -44,7 +44,7 @@
|
|||||||
<a-select-option v-for="key in USERS_SECURITY" :value="key">[[ key ]]</a-select-option>
|
<a-select-option v-for="key in USERS_SECURITY" :value="key">[[ key ]]</a-select-option>
|
||||||
</a-select>
|
</a-select>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item v-if="client.email && app.subSettings.enable">
|
<a-form-item v-if="client.email && app.subSettings?.enable">
|
||||||
<template slot="label">
|
<template slot="label">
|
||||||
<a-tooltip>
|
<a-tooltip>
|
||||||
<template slot="title">
|
<template slot="title">
|
||||||
|
|||||||
@@ -44,6 +44,30 @@
|
|||||||
<a-input-number v-model.number="dbInbound.totalGB" :min="0"></a-input-number>
|
<a-input-number v-model.number="dbInbound.totalGB" :min="0"></a-input-number>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
|
|
||||||
|
<a-form-item>
|
||||||
|
<template slot="label">
|
||||||
|
<a-tooltip>
|
||||||
|
<template slot="title">
|
||||||
|
<span>{{ i18n "pages.inbounds.periodicTrafficResetDesc" }}</span>
|
||||||
|
<br v-if="dbInbound.lastTrafficResetTime && dbInbound.lastTrafficResetTime > 0">
|
||||||
|
<span v-if="dbInbound.lastTrafficResetTime && dbInbound.lastTrafficResetTime > 0">
|
||||||
|
<strong>{{ i18n "pages.inbounds.lastReset" }}:</strong>
|
||||||
|
<span v-if="datepicker == 'gregorian'">[[ moment(dbInbound.lastTrafficResetTime).format('YYYY-MM-DD HH:mm:ss') ]]</span>
|
||||||
|
<span v-else>[[ DateUtil.convertToJalalian(moment(dbInbound.lastTrafficResetTime)) ]]</span>
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
{{ i18n "pages.inbounds.periodicTrafficResetTitle" }}
|
||||||
|
<a-icon type="question-circle"></a-icon>
|
||||||
|
</a-tooltip>
|
||||||
|
</template>
|
||||||
|
<a-select v-model="dbInbound.trafficReset" :dropdown-class-name="themeSwitcher.currentTheme">
|
||||||
|
<a-select-option value="never">{{ i18n "pages.inbounds.periodicTrafficReset.never" }}</a-select-option>
|
||||||
|
<a-select-option value="daily">{{ i18n "pages.inbounds.periodicTrafficReset.daily" }}</a-select-option>
|
||||||
|
<a-select-option value="weekly">{{ i18n "pages.inbounds.periodicTrafficReset.weekly" }}</a-select-option>
|
||||||
|
<a-select-option value="monthly">{{ i18n "pages.inbounds.periodicTrafficReset.monthly" }}</a-select-option>
|
||||||
|
</a-select>
|
||||||
|
</a-form-item>
|
||||||
|
|
||||||
<a-form-item>
|
<a-form-item>
|
||||||
<template slot="label">
|
<template slot="label">
|
||||||
<a-tooltip>
|
<a-tooltip>
|
||||||
@@ -83,14 +107,14 @@
|
|||||||
{{template "form/shadowsocks"}}
|
{{template "form/shadowsocks"}}
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<!-- dokodemo-door -->
|
<!-- tunnel -->
|
||||||
<template v-if="inbound.protocol === Protocols.DOKODEMO">
|
<template v-if="inbound.protocol === Protocols.TUNNEL">
|
||||||
{{template "form/dokodemo"}}
|
{{template "form/tunnel"}}
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<!-- socks -->
|
<!-- mixed -->
|
||||||
<template v-if="inbound.protocol === Protocols.SOCKS">
|
<template v-if="inbound.protocol === Protocols.MIXED">
|
||||||
{{template "form/socks"}}
|
{{template "form/mixed"}}
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<!-- http -->
|
<!-- http -->
|
||||||
@@ -121,13 +145,4 @@
|
|||||||
</a-collapse-panel>
|
</a-collapse-panel>
|
||||||
</a-collapse>
|
</a-collapse>
|
||||||
|
|
||||||
<!-- allocate -->
|
|
||||||
<!-- Temporarily disabled until we accepts range for port allocation
|
|
||||||
<a-collapse>
|
|
||||||
<a-collapse-panel header='Allocate'>
|
|
||||||
{{template "form/allocate"}}
|
|
||||||
</a-collapse-panel>
|
|
||||||
</a-collapse>
|
|
||||||
-->
|
|
||||||
|
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|||||||
@@ -42,6 +42,9 @@
|
|||||||
<a-form-item label='Interval'>
|
<a-form-item label='Interval'>
|
||||||
<a-input v-model.trim="outbound.settings.fragment.interval"></a-input>
|
<a-input v-model.trim="outbound.settings.fragment.interval"></a-input>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
|
<a-form-item label='Max Split'>
|
||||||
|
<a-input v-model.trim="outbound.settings.fragment.maxSplit"></a-input>
|
||||||
|
</a-form-item>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<!-- Switch for Noises -->
|
<!-- Switch for Noises -->
|
||||||
@@ -75,6 +78,11 @@
|
|||||||
<a-form-item label='Delay'>
|
<a-form-item label='Delay'>
|
||||||
<a-input v-model.trim="noise.delay"></a-input>
|
<a-input v-model.trim="noise.delay"></a-input>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
|
<a-form-item label='Apply To'>
|
||||||
|
<a-select v-model="noise.applyTo" :dropdown-class-name="themeSwitcher.currentTheme">
|
||||||
|
<a-select-option v-for="s in ['ip','ipv4','ipv6']" :value="s">[[ s ]]</a-select-option>
|
||||||
|
</a-select>
|
||||||
|
</a-form-item>
|
||||||
</a-form>
|
</a-form>
|
||||||
</template>
|
</template>
|
||||||
</template>
|
</template>
|
||||||
@@ -97,7 +105,7 @@
|
|||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item label='non-IP queries'>
|
<a-form-item label='non-IP queries'>
|
||||||
<a-select v-model="outbound.settings.nonIPQuery" :dropdown-class-name="themeSwitcher.currentTheme">
|
<a-select v-model="outbound.settings.nonIPQuery" :dropdown-class-name="themeSwitcher.currentTheme">
|
||||||
<a-select-option v-for="s in ['drop','skip']" :value="s">[[ s ]]</a-select-option>
|
<a-select-option v-for="s in ['reject','drop','skip']" :value="s">[[ s ]]</a-select-option>
|
||||||
</a-select>
|
</a-select>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item v-if="outbound.settings.nonIPQuery === 'skip'" label='Block Types' >
|
<a-form-item v-if="outbound.settings.nonIPQuery === 'skip'" label='Block Types' >
|
||||||
@@ -202,7 +210,7 @@
|
|||||||
</a-form-item>
|
</a-form-item>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<!-- Vnext (vless/vmess) settings -->
|
<!-- VLESS/VMess user settings -->
|
||||||
<template v-if="[Protocols.VMess, Protocols.VLESS].includes(outbound.protocol)">
|
<template v-if="[Protocols.VMess, Protocols.VLESS].includes(outbound.protocol)">
|
||||||
<a-form-item label='ID'>
|
<a-form-item label='ID'>
|
||||||
<a-input v-model.trim="outbound.settings.id"></a-input>
|
<a-input v-model.trim="outbound.settings.id"></a-input>
|
||||||
@@ -218,6 +226,11 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<!-- vless settings -->
|
<!-- vless settings -->
|
||||||
|
<template v-if="outbound.protocol === Protocols.VLESS">
|
||||||
|
<a-form-item label='encryption'>
|
||||||
|
<a-input v-model.trim="outbound.settings.encryption"></a-input>
|
||||||
|
</a-form-item>
|
||||||
|
</template>
|
||||||
<template v-if="outbound.canEnableTlsFlow()">
|
<template v-if="outbound.canEnableTlsFlow()">
|
||||||
<a-form-item label='Flow'>
|
<a-form-item label='Flow'>
|
||||||
<a-select v-model="outbound.settings.flow" :dropdown-class-name="themeSwitcher.currentTheme">
|
<a-select v-model="outbound.settings.flow" :dropdown-class-name="themeSwitcher.currentTheme">
|
||||||
@@ -428,6 +441,9 @@
|
|||||||
<a-select-option v-for="alpn in ALPN_OPTION" :value="alpn">[[ alpn ]]</a-select-option>
|
<a-select-option v-for="alpn in ALPN_OPTION" :value="alpn">[[ alpn ]]</a-select-option>
|
||||||
</a-select>
|
</a-select>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
|
<a-form-item label="ECH Config List">
|
||||||
|
<a-input v-model.trim="outbound.stream.tls.echConfigList"></a-input>
|
||||||
|
</a-form-item>
|
||||||
<a-form-item label="Allow Insecure">
|
<a-form-item label="Allow Insecure">
|
||||||
<a-switch v-model="outbound.stream.tls.allowInsecure"></a-switch>
|
<a-switch v-model="outbound.stream.tls.allowInsecure"></a-switch>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
@@ -444,13 +460,16 @@
|
|||||||
</a-select>
|
</a-select>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item label="Short ID">
|
<a-form-item label="Short ID">
|
||||||
<a-input v-model.trim="outbound.stream.reality.shortId" :style="{ width: '250px' }"></a-input>
|
<a-input v-model.trim="outbound.stream.reality.shortId"></a-input>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item label="SpiderX">
|
<a-form-item label="SpiderX">
|
||||||
<a-input v-model.trim="outbound.stream.reality.spiderX" :style="{ width: '250px' }"></a-input>
|
<a-input v-model.trim="outbound.stream.reality.spiderX"></a-input>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item label="Public Key">
|
<a-form-item label="Public Key">
|
||||||
<a-input v-model.trim="outbound.stream.reality.publicKey"></a-input>
|
<a-textarea v-model.trim="outbound.stream.reality.publicKey"></a-textarea>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="mldsa65 Verify">
|
||||||
|
<a-textarea v-model.trim="outbound.stream.reality.mldsa65Verify"></a-textarea>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</template>
|
</template>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
{{define "form/dokodemo"}}
|
{{define "form/tunnel"}}
|
||||||
<a-form :colon="false" :label-col="{ md: {span:8} }" :wrapper-col="{ md: {span:14} }">
|
<a-form :colon="false" :label-col="{ md: {span:8} }" :wrapper-col="{ md: {span:14} }">
|
||||||
<a-form-item label='{{ i18n "pages.inbounds.targetAddress"}}'>
|
<a-form-item label='{{ i18n "pages.inbounds.targetAddress"}}'>
|
||||||
<a-input v-model.trim="inbound.settings.address"></a-input>
|
<a-input v-model.trim="inbound.settings.address"></a-input>
|
||||||
@@ -6,6 +6,19 @@
|
|||||||
<a-form-item label='{{ i18n "pages.inbounds.destinationPort"}}'>
|
<a-form-item label='{{ i18n "pages.inbounds.destinationPort"}}'>
|
||||||
<a-input-number v-model.number="inbound.settings.port"></a-input-number>
|
<a-input-number v-model.number="inbound.settings.port"></a-input-number>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
|
<a-form-item label='{{ i18n "pages.inbounds.portMap"}}'>
|
||||||
|
<a-button size="small" @click="inbound.settings.portMap.push({name: '', value: ''})">+</a-button>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item :wrapper-col="{span:24}">
|
||||||
|
<a-input-group compact v-for="(pm, index) in inbound.settings.portMap">
|
||||||
|
<a-input style="width: 50%" v-model.trim="pm.name" placeholder='{{ i18n "pages.inbounds.port"}}'>
|
||||||
|
<template slot="addonBefore" style="margin: 0;">[[ index+1 ]]</template>
|
||||||
|
</a-input>
|
||||||
|
<a-input style="width: 50%" v-model.trim="pm.value" placeholder='{{ i18n "pages.inbounds.targetAddress" }}'>
|
||||||
|
<a-button slot="addonAfter" size="small" @click="inbound.settings.portMap.splice(index,1)">-</a-button>
|
||||||
|
</a-input>
|
||||||
|
</a-input-group>
|
||||||
|
</a-form-item>
|
||||||
<a-form-item label='{{ i18n "pages.inbounds.network"}}'>
|
<a-form-item label='{{ i18n "pages.inbounds.network"}}'>
|
||||||
<a-select v-model="inbound.settings.network" :dropdown-class-name="themeSwitcher.currentTheme">
|
<a-select v-model="inbound.settings.network" :dropdown-class-name="themeSwitcher.currentTheme">
|
||||||
<a-select-option value="tcp,udp">TCP,UDP</a-select-option>
|
<a-select-option value="tcp,udp">TCP,UDP</a-select-option>
|
||||||
@@ -17,4 +30,8 @@
|
|||||||
<a-switch v-model="inbound.settings.followRedirect"></a-switch>
|
<a-switch v-model="inbound.settings.followRedirect"></a-switch>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-form>
|
</a-form>
|
||||||
|
<!-- sockopt -->
|
||||||
|
<template>
|
||||||
|
{{template "form/streamSockopt"}}
|
||||||
|
</template>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
{{define "form/socks"}}
|
{{define "form/mixed"}}
|
||||||
<a-form :colon="false" :label-col="{ md: {span:8} }" :wrapper-col="{ md: {span:14} }">
|
<a-form :colon="false" :label-col="{ md: {span:8} }" :wrapper-col="{ md: {span:14} }">
|
||||||
<a-form-item label='{{ i18n "pages.inbounds.enable" }} UDP'>
|
<a-form-item label='{{ i18n "pages.inbounds.enable" }} UDP'>
|
||||||
<a-switch v-model="inbound.settings.udp"></a-switch>
|
<a-switch v-model="inbound.settings.udp"></a-switch>
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
<td width="45%">{{ i18n "username" }}</td>
|
<td width="45%">{{ i18n "username" }}</td>
|
||||||
<td width="45%">{{ i18n "password" }}</td>
|
<td width="45%">{{ i18n "password" }}</td>
|
||||||
<td>
|
<td>
|
||||||
<a-button icon="plus" size="small" @click="inbound.settings.addAccount(new Inbound.SocksSettings.SocksAccount())"></a-button>
|
<a-button icon="plus" size="small" @click="inbound.settings.addAccount(new Inbound.MixedSettings.SocksAccount())"></a-button>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
@@ -18,7 +18,29 @@
|
|||||||
</table>
|
</table>
|
||||||
</a-collapse-panel>
|
</a-collapse-panel>
|
||||||
</a-collapse>
|
</a-collapse>
|
||||||
<template v-if="inbound.isTcp">
|
<template v-if="!inbound.stream.isTLS || !inbound.stream.isReality">
|
||||||
|
<a-form :colon="false" :label-col="{ md: {span:8} }" :wrapper-col="{ md: {span:14} }">
|
||||||
|
<a-form-item label="Authentication">
|
||||||
|
<a-select v-model="inbound.settings.selectedAuth" @change="getNewVlessEnc" :dropdown-class-name="themeSwitcher.currentTheme">
|
||||||
|
<a-select-option value="X25519, not Post-Quantum">X25519 (not Post-Quantum)</a-select-option>
|
||||||
|
<a-select-option value="ML-KEM-768, Post-Quantum">ML-KEM-768 (Post-Quantum)</a-select-option>
|
||||||
|
</a-select>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="decryption">
|
||||||
|
<a-input v-model.trim="inbound.settings.decryption"></a-input>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="encryption">
|
||||||
|
<a-input v-model="inbound.settings.encryption"></a-input>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label=" ">
|
||||||
|
<a-space>
|
||||||
|
<a-button type="primary" icon="import" @click="getNewVlessEnc">Get New keys</a-button>
|
||||||
|
<a-button danger @click="clearVlessEnc">Clear</a-button>
|
||||||
|
</a-space>
|
||||||
|
</a-form-item>
|
||||||
|
</a-form>
|
||||||
|
</template>
|
||||||
|
<template v-if="inbound.isTcp && !inbound.settings.selectedAuth">
|
||||||
<a-form :colon="false" :label-col="{ md: {span:8} }" :wrapper-col="{ md: {span:14} }">
|
<a-form :colon="false" :label-col="{ md: {span:8} }" :wrapper-col="{ md: {span:14} }">
|
||||||
<a-form-item label="Fallbacks">
|
<a-form-item label="Fallbacks">
|
||||||
<a-button icon="plus" type="primary" size="small" @click="inbound.settings.addFallback()"></a-button>
|
<a-button icon="plus" type="primary" size="small" @click="inbound.settings.addFallback()"></a-button>
|
||||||
|
|||||||
@@ -12,8 +12,8 @@
|
|||||||
<a-select-option v-for="key in UTLS_FINGERPRINT" :value="key">[[ key ]]</a-select-option>
|
<a-select-option v-for="key in UTLS_FINGERPRINT" :value="key">[[ key ]]</a-select-option>
|
||||||
</a-select>
|
</a-select>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item label='Dest (Target)'>
|
<a-form-item label='Target'>
|
||||||
<a-input v-model.trim="inbound.stream.reality.dest"></a-input>
|
<a-input v-model.trim="inbound.stream.reality.target"></a-input>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item label='SNI'>
|
<a-form-item label='SNI'>
|
||||||
<a-input v-model.trim="inbound.stream.reality.serverNames"></a-input>
|
<a-input v-model.trim="inbound.stream.reality.serverNames"></a-input>
|
||||||
@@ -21,14 +21,12 @@
|
|||||||
<a-form-item label='Max Time Diff (ms)'>
|
<a-form-item label='Max Time Diff (ms)'>
|
||||||
<a-input-number v-model.number="inbound.stream.reality.maxTimediff" :min="0"></a-input-number>
|
<a-input-number v-model.number="inbound.stream.reality.maxTimediff" :min="0"></a-input-number>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<!-- we also have this but i think it's not necessary
|
<a-form-item label='Min Client Ver'>
|
||||||
<a-form-item label='Min Client'>
|
<a-input v-model.trim="inbound.stream.reality.minClientVer" placeholder='25.9.11'></a-input>
|
||||||
<a-input v-model.trim="inbound.stream.reality.minClient"></a-input>
|
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item label='Max Client'>
|
<a-form-item label='Max Client Ver'>
|
||||||
<a-input v-model.trim="inbound.stream.reality.maxClient"></a-input>
|
<a-input v-model.trim="inbound.stream.reality.maxClientVer" placeholder='25.9.11'></a-input>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
-->
|
|
||||||
<a-form-item>
|
<a-form-item>
|
||||||
<template slot="label">
|
<template slot="label">
|
||||||
<a-tooltip>
|
<a-tooltip>
|
||||||
@@ -38,19 +36,34 @@
|
|||||||
type="sync"></a-icon>
|
type="sync"></a-icon>
|
||||||
</a-tooltip>
|
</a-tooltip>
|
||||||
</template>
|
</template>
|
||||||
<a-input v-model.trim="inbound.stream.reality.shortIds"></a-input>
|
<a-textarea v-model.trim="inbound.stream.reality.shortIds"></a-textarea>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item label='SpiderX'>
|
<a-form-item label='SpiderX'>
|
||||||
<a-input v-model.trim="inbound.stream.reality.settings.spiderX"></a-input>
|
<a-input v-model.trim="inbound.stream.reality.settings.spiderX"></a-input>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item label='{{ i18n "pages.inbounds.publicKey" }}'>
|
<a-form-item label='{{ i18n "pages.inbounds.publicKey" }}'>
|
||||||
<a-input v-model="inbound.stream.reality.settings.publicKey"></a-input>
|
<a-textarea v-model="inbound.stream.reality.settings.publicKey"></a-textarea>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item label='{{ i18n "pages.inbounds.privatekey" }}'>
|
<a-form-item label='{{ i18n "pages.inbounds.privatekey" }}'>
|
||||||
<a-input type="password" v-model="inbound.stream.reality.privateKey"></a-input>
|
<a-textarea v-model="inbound.stream.reality.privateKey"></a-textarea>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item label=" ">
|
<a-form-item label=" ">
|
||||||
<a-button type="primary" icon="import" @click="getNewX25519Cert">Get New Cert</a-button>
|
<a-space>
|
||||||
|
<a-button type="primary" icon="import" @click="getNewX25519Cert">Get New Cert</a-button>
|
||||||
|
<a-button danger @click="clearX25519Cert">Clear</a-button>
|
||||||
|
</a-space>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="mldsa65 Seed">
|
||||||
|
<a-textarea v-model="inbound.stream.reality.mldsa65Seed"></a-textarea>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="mldsa65 Verify">
|
||||||
|
<a-textarea v-model="inbound.stream.reality.settings.mldsa65Verify"></a-textarea>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label=" ">
|
||||||
|
<a-space>
|
||||||
|
<a-button type="primary" icon="import" @click="getNewmldsa65">Get New Seed</a-button>
|
||||||
|
<a-button danger @click="clearMldsa65">Clear</a-button>
|
||||||
|
</a-space>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</template>
|
</template>
|
||||||
{{end}}
|
{{end}}
|
||||||
@@ -85,15 +85,12 @@
|
|||||||
</template>
|
</template>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<a-form-item label='{{ i18n "pages.inbounds.publicKey" }}'>
|
<a-form-item label='{{ i18n "pages.inbounds.publicKey" }}'>
|
||||||
<a-input v-model="cert.cert"></a-input>
|
<a-textarea v-model="cert.cert"></a-textarea>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item label='{{ i18n "pages.inbounds.privatekey" }}'>
|
<a-form-item label='{{ i18n "pages.inbounds.privatekey" }}'>
|
||||||
<a-input type="password" v-model="cert.key"></a-input>
|
<a-textarea v-model="cert.key"></a-textarea>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</template>
|
</template>
|
||||||
<a-form-item label='OCSP stapling'>
|
|
||||||
<a-input-number v-model.number="cert.ocspStapling" :min="0"></a-input-number>
|
|
||||||
</a-form-item>
|
|
||||||
<a-form-item label="One Time Loading">
|
<a-form-item label="One Time Loading">
|
||||||
<a-switch v-model="cert.oneTimeLoading"></a-switch>
|
<a-switch v-model="cert.oneTimeLoading"></a-switch>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
@@ -106,6 +103,24 @@
|
|||||||
<a-switch v-model="cert.buildChain"></a-switch>
|
<a-switch v-model="cert.buildChain"></a-switch>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</template>
|
</template>
|
||||||
|
<a-form-item label='ECH key'>
|
||||||
|
<a-input v-model="inbound.stream.tls.echServerKeys"></a-input>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label='ECH config'>
|
||||||
|
<a-input v-model="inbound.stream.tls.settings.echConfigList"></a-input>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label='ECH force query'>
|
||||||
|
<a-select v-model="inbound.stream.tls.echForceQuery"
|
||||||
|
:dropdown-class-name="themeSwitcher.currentTheme">
|
||||||
|
<a-select-option v-for="key in ['none', 'half', 'full']" :value="key">[[ key ]]</a-select-option>
|
||||||
|
</a-select>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label=" ">
|
||||||
|
<a-space>
|
||||||
|
<a-button type="primary" icon="import" @click="getNewEchCert">Get New ECH Cert</a-button>
|
||||||
|
<a-button danger @click="clearEchCert">Clear</a-button>
|
||||||
|
</a-space>
|
||||||
|
</a-form-item>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<!-- reality settings -->
|
<!-- reality settings -->
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
1268
web/html/index.html
1268
web/html/index.html
File diff suppressed because it is too large
Load Diff
@@ -1,456 +1,10 @@
|
|||||||
{{ template "page/head_start" .}}
|
{{ template "page/head_start" .}}
|
||||||
<style>
|
|
||||||
html * {
|
|
||||||
-webkit-font-smoothing: antialiased;
|
|
||||||
-moz-osx-font-smoothing: grayscale;
|
|
||||||
}
|
|
||||||
|
|
||||||
h1 {
|
|
||||||
text-align: center;
|
|
||||||
/*margin: 20px 0 50px 0;*/
|
|
||||||
height: 110px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ant-form-item-children .ant-btn,
|
|
||||||
.ant-input {
|
|
||||||
height: 50px;
|
|
||||||
border-radius: 30px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ant-input-group-addon {
|
|
||||||
border-radius: 0 30px 30px 0;
|
|
||||||
width: 50px;
|
|
||||||
font-size: 18px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ant-input-affix-wrapper .ant-input-prefix {
|
|
||||||
left: 23px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ant-input-affix-wrapper .ant-input:not(:first-child) {
|
|
||||||
padding-left: 50px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.centered {
|
|
||||||
display: flex;
|
|
||||||
text-align: center;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.title {
|
|
||||||
font-size: 2rem;
|
|
||||||
margin-block-end: 2rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.title b {
|
|
||||||
font-weight: bold !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
#app {
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
#login {
|
|
||||||
animation: charge 0.5s both;
|
|
||||||
background-color: #fff;
|
|
||||||
border-radius: 2rem;
|
|
||||||
padding: 4rem 3rem;
|
|
||||||
transition: all 0.3s;
|
|
||||||
user-select: none;
|
|
||||||
-webkit-user-select: none;
|
|
||||||
-moz-user-select: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
#login:hover {
|
|
||||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.09);
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes charge {
|
|
||||||
from {
|
|
||||||
transform: translateY(5rem);
|
|
||||||
opacity: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
to {
|
|
||||||
transform: translateY(0);
|
|
||||||
opacity: 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.under {
|
|
||||||
background-color: #c7ebe2;
|
|
||||||
z-index: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.dark .under {
|
|
||||||
background-color: var(--dark-color-login-wave);
|
|
||||||
}
|
|
||||||
|
|
||||||
.dark #login {
|
|
||||||
background-color: var(--dark-color-surface-100);
|
|
||||||
}
|
|
||||||
|
|
||||||
.dark h1 {
|
|
||||||
color: rgba(255, 255, 255);
|
|
||||||
}
|
|
||||||
|
|
||||||
.ant-btn-primary-login {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ant-btn-primary-login:focus,
|
|
||||||
.ant-btn-primary-login:hover {
|
|
||||||
color: #fff;
|
|
||||||
background-color: #006655;
|
|
||||||
border-color: #006655;
|
|
||||||
background-image: linear-gradient(270deg,
|
|
||||||
rgba(123, 199, 77, 0) 30%,
|
|
||||||
#009980,
|
|
||||||
rgba(123, 199, 77, 0) 100%);
|
|
||||||
background-repeat: no-repeat;
|
|
||||||
animation: ma-bg-move ease-in-out 5s infinite;
|
|
||||||
background-position-x: -500px;
|
|
||||||
width: 95%;
|
|
||||||
animation-delay: -0.5s;
|
|
||||||
box-shadow: 0 2px 0 rgba(0, 0, 0, 0.045);
|
|
||||||
}
|
|
||||||
|
|
||||||
.ant-btn-primary-login.active,
|
|
||||||
.ant-btn-primary-login:active {
|
|
||||||
color: #fff;
|
|
||||||
background-color: #006655;
|
|
||||||
border-color: #006655;
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes ma-bg-move {
|
|
||||||
0% {
|
|
||||||
background-position: -500px 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
50% {
|
|
||||||
background-position: 1000px 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
100% {
|
|
||||||
background-position: 1000px 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.wave-btn-bg {
|
|
||||||
position: relative;
|
|
||||||
border-radius: 25px;
|
|
||||||
width: 100%;
|
|
||||||
transition: all 0.3s cubic-bezier(.645, .045, .355, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
.dark .wave-btn-bg {
|
|
||||||
color: #fff;
|
|
||||||
position: relative;
|
|
||||||
background-color: #0a7557;
|
|
||||||
border: 2px double transparent;
|
|
||||||
background-origin: border-box;
|
|
||||||
background-clip: padding-box, border-box;
|
|
||||||
background-size: 300%;
|
|
||||||
width: 100%;
|
|
||||||
z-index: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.dark .wave-btn-bg:hover {
|
|
||||||
animation: wave-btn-tara 4s ease infinite;
|
|
||||||
}
|
|
||||||
|
|
||||||
.dark .wave-btn-bg-cl {
|
|
||||||
background-image: linear-gradient(rgba(13, 14, 33, 0), rgba(13, 14, 33, 0)),
|
|
||||||
radial-gradient(circle at left top, #006655, #009980, #006655) !important;
|
|
||||||
border-radius: 3em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.dark .wave-btn-bg-cl:hover {
|
|
||||||
width: 95%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.dark .wave-btn-bg-cl:before {
|
|
||||||
position: absolute;
|
|
||||||
content: "";
|
|
||||||
top: -5px;
|
|
||||||
left: -5px;
|
|
||||||
bottom: -5px;
|
|
||||||
right: -5px;
|
|
||||||
z-index: -1;
|
|
||||||
background: inherit;
|
|
||||||
background-size: inherit;
|
|
||||||
border-radius: 4em;
|
|
||||||
opacity: 0;
|
|
||||||
transition: 0.5s;
|
|
||||||
}
|
|
||||||
|
|
||||||
.dark .wave-btn-bg-cl:hover::before {
|
|
||||||
opacity: 1;
|
|
||||||
filter: blur(20px);
|
|
||||||
animation: wave-btn-tara 8s linear infinite;
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes wave-btn-tara {
|
|
||||||
to {
|
|
||||||
background-position: 300%;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.dark .ant-btn-primary-login {
|
|
||||||
font-size: 14px;
|
|
||||||
color: #fff;
|
|
||||||
text-align: center;
|
|
||||||
background-image: linear-gradient(rgba(13, 14, 33, 0.45),
|
|
||||||
rgba(13, 14, 33, 0.35));
|
|
||||||
border-radius: 2rem;
|
|
||||||
border: none;
|
|
||||||
outline: none;
|
|
||||||
background-color: transparent;
|
|
||||||
height: 46px;
|
|
||||||
position: relative;
|
|
||||||
white-space: nowrap;
|
|
||||||
cursor: pointer;
|
|
||||||
touch-action: manipulation;
|
|
||||||
padding: 0 15px;
|
|
||||||
width: 100%;
|
|
||||||
animation: none;
|
|
||||||
background-position-x: 0;
|
|
||||||
box-shadow: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.waves-header {
|
|
||||||
position: fixed;
|
|
||||||
width: 100%;
|
|
||||||
text-align: center;
|
|
||||||
background-color: #dbf5ed;
|
|
||||||
color: white;
|
|
||||||
z-index: -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.dark .waves-header {
|
|
||||||
background-color: var(--dark-color-login-background);
|
|
||||||
}
|
|
||||||
|
|
||||||
.waves-inner-header {
|
|
||||||
height: 50vh;
|
|
||||||
width: 100%;
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.waves {
|
|
||||||
position: relative;
|
|
||||||
width: 100%;
|
|
||||||
height: 15vh;
|
|
||||||
margin-bottom: -8px;
|
|
||||||
/*Fix for safari gap*/
|
|
||||||
min-height: 100px;
|
|
||||||
max-height: 150px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.parallax>use {
|
|
||||||
animation: move-forever 25s cubic-bezier(0.55, 0.5, 0.45, 0.5) infinite;
|
|
||||||
}
|
|
||||||
|
|
||||||
.dark .parallax>use {
|
|
||||||
fill: var(--dark-color-login-wave);
|
|
||||||
}
|
|
||||||
|
|
||||||
.parallax>use:nth-child(1) {
|
|
||||||
animation-delay: -2s;
|
|
||||||
animation-duration: 4s;
|
|
||||||
opacity: 0.2;
|
|
||||||
}
|
|
||||||
|
|
||||||
.parallax>use:nth-child(2) {
|
|
||||||
animation-delay: -3s;
|
|
||||||
animation-duration: 7s;
|
|
||||||
opacity: 0.4;
|
|
||||||
}
|
|
||||||
|
|
||||||
.parallax>use:nth-child(3) {
|
|
||||||
animation-delay: -4s;
|
|
||||||
animation-duration: 10s;
|
|
||||||
opacity: 0.6;
|
|
||||||
}
|
|
||||||
|
|
||||||
.parallax>use:nth-child(4) {
|
|
||||||
animation-delay: -5s;
|
|
||||||
animation-duration: 13s;
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes move-forever {
|
|
||||||
0% {
|
|
||||||
transform: translate3d(-90px, 0, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
100% {
|
|
||||||
transform: translate3d(85px, 0, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (max-width: 768px) {
|
|
||||||
.waves {
|
|
||||||
height: 40px;
|
|
||||||
min-height: 40px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.words-wrapper {
|
|
||||||
width: 100%;
|
|
||||||
display: inline-block;
|
|
||||||
position: relative;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.words-wrapper b {
|
|
||||||
width: 100%;
|
|
||||||
display: inline-block;
|
|
||||||
position: absolute;
|
|
||||||
left: 0;
|
|
||||||
top: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.words-wrapper b.is-visible {
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
|
|
||||||
.headline.zoom .words-wrapper {
|
|
||||||
-webkit-perspective: 300px;
|
|
||||||
-moz-perspective: 300px;
|
|
||||||
perspective: 300px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.headline {
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.headline.zoom b {
|
|
||||||
opacity: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.headline.zoom b.is-visible {
|
|
||||||
opacity: 1;
|
|
||||||
-webkit-animation: zoom-in 0.8s;
|
|
||||||
-moz-animation: zoom-in 0.8s;
|
|
||||||
animation: cubic-bezier(0.215, 0.610, 0.355, 1.000) zoom-in 0.8s;
|
|
||||||
}
|
|
||||||
|
|
||||||
.headline.zoom b.is-hidden {
|
|
||||||
-webkit-animation: zoom-out 0.8s;
|
|
||||||
-moz-animation: zoom-out 0.8s;
|
|
||||||
animation: cubic-bezier(0.215, 0.610, 0.355, 1.000) zoom-out 0.4s;
|
|
||||||
}
|
|
||||||
|
|
||||||
@-webkit-keyframes zoom-in {
|
|
||||||
0% {
|
|
||||||
opacity: 0;
|
|
||||||
-webkit-transform: translateZ(100px);
|
|
||||||
}
|
|
||||||
|
|
||||||
100% {
|
|
||||||
opacity: 1;
|
|
||||||
-webkit-transform: translateZ(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@-moz-keyframes zoom-in {
|
|
||||||
0% {
|
|
||||||
opacity: 0;
|
|
||||||
-moz-transform: translateZ(100px);
|
|
||||||
}
|
|
||||||
|
|
||||||
100% {
|
|
||||||
opacity: 1;
|
|
||||||
-moz-transform: translateZ(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes zoom-in {
|
|
||||||
0% {
|
|
||||||
opacity: 0;
|
|
||||||
-webkit-transform: translateZ(100px);
|
|
||||||
-moz-transform: translateZ(100px);
|
|
||||||
-ms-transform: translateZ(100px);
|
|
||||||
-o-transform: translateZ(100px);
|
|
||||||
transform: translateZ(100px);
|
|
||||||
}
|
|
||||||
|
|
||||||
100% {
|
|
||||||
opacity: 1;
|
|
||||||
-webkit-transform: translateZ(0);
|
|
||||||
-moz-transform: translateZ(0);
|
|
||||||
-ms-transform: translateZ(0);
|
|
||||||
-o-transform: translateZ(0);
|
|
||||||
transform: translateZ(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@-webkit-keyframes zoom-out {
|
|
||||||
0% {
|
|
||||||
opacity: 1;
|
|
||||||
-webkit-transform: translateZ(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
100% {
|
|
||||||
opacity: 0;
|
|
||||||
-webkit-transform: translateZ(-100px);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@-moz-keyframes zoom-out {
|
|
||||||
0% {
|
|
||||||
opacity: 1;
|
|
||||||
-moz-transform: translateZ(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
100% {
|
|
||||||
opacity: 0;
|
|
||||||
-moz-transform: translateZ(-100px);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes zoom-out {
|
|
||||||
0% {
|
|
||||||
opacity: 1;
|
|
||||||
-webkit-transform: translateZ(0);
|
|
||||||
-moz-transform: translateZ(0);
|
|
||||||
-ms-transform: translateZ(0);
|
|
||||||
-o-transform: translateZ(0);
|
|
||||||
transform: translateZ(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
100% {
|
|
||||||
opacity: 0;
|
|
||||||
-webkit-transform: translateZ(-100px);
|
|
||||||
-moz-transform: translateZ(-100px);
|
|
||||||
-ms-transform: translateZ(-100px);
|
|
||||||
-o-transform: translateZ(-100px);
|
|
||||||
transform: translateZ(-100px);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.setting-section {
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
right: 0;
|
|
||||||
padding: 22px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ant-space-item .ant-switch {
|
|
||||||
margin: 2px 0 4px;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
{{ template "page/head_end" .}}
|
{{ template "page/head_end" .}}
|
||||||
|
|
||||||
{{ template "page/body_start" .}}
|
{{ template "page/body_start" .}}
|
||||||
<a-layout id="app" v-cloak :class="themeSwitcher.currentTheme">
|
<a-layout id="app" v-cloak :class="themeSwitcher.currentTheme + ' login-app'">
|
||||||
<transition name="list" appear>
|
<transition name="list" appear>
|
||||||
<a-layout-content class="under" :style="{ minHeight: '0' }">
|
<a-layout-content class="under min-h-0">
|
||||||
<div class="waves-header">
|
<div class="waves-header">
|
||||||
<div class="waves-inner-header"></div>
|
<div class="waves-inner-header"></div>
|
||||||
<svg class="waves" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
|
<svg class="waves" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||||
@@ -466,71 +20,80 @@
|
|||||||
</g>
|
</g>
|
||||||
</svg>
|
</svg>
|
||||||
</div>
|
</div>
|
||||||
<a-row type="flex" justify="center" align="middle" :style="{ height: '100%', overflow: 'auto', overflowX: 'hidden' }">
|
<a-row type="flex" justify="center" align="middle" class="h-100 overflow-y-auto overflow-x-hidden">
|
||||||
<a-col :xs="22" :sm="12" :md="10" :lg="8" :xl="6" :xxl="5" id="login" :style="{ margin: '3rem 0' }">
|
<a-col :xs="22" :sm="12" :md="10" :lg="8" :xl="6" :xxl="5" id="login" class="my-3rem">
|
||||||
<div class="setting-section">
|
<template v-if="!loadingStates.fetched">
|
||||||
<a-popover :overlay-class-name="themeSwitcher.currentTheme" title='{{ i18n "menu.settings" }}' placement="bottomRight" trigger="click">
|
<div class="text-center">
|
||||||
<template slot="content">
|
<a-spin size="large" />
|
||||||
<a-space direction="vertical" :size="10">
|
</div>
|
||||||
<a-theme-switch-login></a-theme-switch-login>
|
</template>
|
||||||
<span>{{ i18n "pages.settings.language" }}</span>
|
<template v-else>
|
||||||
<a-select ref="selectLang" :style="{ width: '100%' }" v-model="lang" @change="LanguageManager.setLanguage(lang)" :dropdown-class-name="themeSwitcher.currentTheme">
|
<div class="setting-section">
|
||||||
<a-select-option :value="l.value" label="English" v-for="l in LanguageManager.supportedLanguages">
|
<a-popover :overlay-class-name="themeSwitcher.currentTheme" title='{{ i18n "menu.settings" }}'
|
||||||
<span role="img" aria-label="l.name" v-text="l.icon"></span>
|
placement="bottomRight" trigger="click">
|
||||||
<span v-text="l.name"></span>
|
<template slot="content">
|
||||||
</a-select-option>
|
<a-space direction="vertical" :size="10">
|
||||||
</a-select>
|
<a-theme-switch-login></a-theme-switch-login>
|
||||||
</a-space>
|
<span>{{ i18n "pages.settings.language" }}</span>
|
||||||
</template>
|
<a-select ref="selectLang" class="w-100" v-model="lang"
|
||||||
<a-button shape="circle" icon="setting"></a-button>
|
@change="LanguageManager.setLanguage(lang)" :dropdown-class-name="themeSwitcher.currentTheme">
|
||||||
</a-popover>
|
<a-select-option :value="l.value" label="English" v-for="l in LanguageManager.supportedLanguages">
|
||||||
</div>
|
<span role="img" aria-label="l.name" v-text="l.icon"></span>
|
||||||
<a-row type="flex" justify="center">
|
<span v-text="l.name"></span>
|
||||||
<a-col :style="{ width: '100%' }">
|
</a-select-option>
|
||||||
<h2 class="title headline zoom">
|
</a-select>
|
||||||
<span class="words-wrapper">
|
</a-space>
|
||||||
<b class="is-visible">{{ i18n "pages.login.hello" }}</b>
|
</template>
|
||||||
<b>{{ i18n "pages.login.title" }}</b>
|
<a-button shape="circle" icon="setting"></a-button>
|
||||||
</span>
|
</a-popover>
|
||||||
</h2>
|
</div>
|
||||||
</a-col>
|
<a-row type="flex" justify="center">
|
||||||
</a-row>
|
<a-col :style="{ width: '100%' }">
|
||||||
<a-row type="flex" justify="center">
|
<h2 class="title headline zoom">
|
||||||
<a-col span="24">
|
<span class="words-wrapper">
|
||||||
<a-form>
|
<b class="is-visible">{{ i18n "pages.login.hello" }}</b>
|
||||||
<a-space direction="vertical" size="middle">
|
<b>{{ i18n "pages.login.title" }}</b>
|
||||||
<a-form-item>
|
</span>
|
||||||
<a-input autocomplete="username" name="username" v-model.trim="user.username"
|
</h2>
|
||||||
placeholder='{{ i18n "username" }}' @keydown.enter.native="login" autofocus>
|
</a-col>
|
||||||
<a-icon slot="prefix" type="user" :style="{ fontSize: '1rem' }"></a-icon>
|
</a-row>
|
||||||
</a-input>
|
<a-row type="flex" justify="center">
|
||||||
</a-form-item>
|
<a-col span="24">
|
||||||
<a-form-item>
|
<a-form @submit.prevent="login">
|
||||||
<a-input-password autocomplete="password" name="password" v-model.trim="user.password"
|
<a-space direction="vertical" size="middle">
|
||||||
placeholder='{{ i18n "password" }}' @keydown.enter.native="login">
|
<a-form-item>
|
||||||
<a-icon slot="prefix" type="lock" :style="{ fontSize: '1rem' }"></a-icon>
|
<a-input autocomplete="username" name="username" v-model.trim="user.username"
|
||||||
</a-input-password>
|
placeholder='{{ i18n "username" }}' autofocus required>
|
||||||
</a-form-item>
|
<a-icon slot="prefix" type="user" class="fs-1rem"></a-icon>
|
||||||
<a-form-item v-if="twoFactorEnable">
|
</a-input>
|
||||||
<a-input autocomplete="totp" name="twoFactorCode" v-model.trim="user.twoFactorCode"
|
</a-form-item>
|
||||||
placeholder='{{ i18n "twoFactorCode" }}' @keydown.enter.native="login">
|
<a-form-item>
|
||||||
<a-icon slot="prefix" type="key" :style="{ fontSize: '1rem' }"></a-icon>
|
<a-input-password autocomplete="password" name="password" v-model.trim="user.password"
|
||||||
</a-input>
|
placeholder='{{ i18n "password" }}' required>
|
||||||
</a-form-item>
|
<a-icon slot="prefix" type="lock" class="fs-1rem"></a-icon>
|
||||||
<a-form-item>
|
</a-input-password>
|
||||||
<a-row justify="center" class="centered">
|
</a-form-item>
|
||||||
<div :style="{ height: '50px', marginTop: '1rem', ...loading ? { width: '52px' } : { display: 'inline-block' } }" class="wave-btn-bg wave-btn-bg-cl">
|
<a-form-item v-if="twoFactorEnable">
|
||||||
<a-button class="ant-btn-primary-login" type="primary" :loading="loading" @click="login"
|
<a-input autocomplete="one-time-code" name="twoFactorCode" v-model.trim="user.twoFactorCode"
|
||||||
:icon="loading ? 'poweroff' : undefined">
|
placeholder='{{ i18n "twoFactorCode" }}' required>
|
||||||
[[ loading ? '' : '{{ i18n "login" }}' ]]
|
<a-icon slot="prefix" type="key" class="fs-1rem"></a-icon>
|
||||||
</a-button>
|
</a-input>
|
||||||
</div>
|
</a-form-item>
|
||||||
</a-row>
|
<a-form-item>
|
||||||
</a-form-item>
|
<a-row justify="center" class="centered">
|
||||||
</a-space>
|
<div class="wave-btn-bg wave-btn-bg-cl h-50px mt-1rem" :style="loadingStates.spinning ? 'width: 52px' : 'display: inline-block'">
|
||||||
</a-form>
|
<a-button class="ant-btn-primary-login" type="primary" :loading="loadingStates.spinning"
|
||||||
</a-col>
|
:icon="loadingStates.spinning ? 'poweroff' : undefined" html-type="submit">
|
||||||
</a-row>
|
[[ loadingStates.spinning ? '' : '{{ i18n "login" }}' ]]
|
||||||
|
</a-button>
|
||||||
|
</div>
|
||||||
|
</a-row>
|
||||||
|
</a-form-item>
|
||||||
|
</a-space>
|
||||||
|
</a-form>
|
||||||
|
</a-col>
|
||||||
|
</a-row>
|
||||||
|
</template>
|
||||||
</a-col>
|
</a-col>
|
||||||
</a-row>
|
</a-row>
|
||||||
</a-layout-content>
|
</a-layout-content>
|
||||||
@@ -544,7 +107,10 @@
|
|||||||
el: '#app',
|
el: '#app',
|
||||||
data: {
|
data: {
|
||||||
themeSwitcher,
|
themeSwitcher,
|
||||||
loading: false,
|
loadingStates: {
|
||||||
|
fetched: false,
|
||||||
|
spinning: false
|
||||||
|
},
|
||||||
user: {
|
user: {
|
||||||
username: "",
|
username: "",
|
||||||
password: "",
|
password: "",
|
||||||
@@ -559,19 +125,23 @@
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async login() {
|
async login() {
|
||||||
this.loading = true;
|
this.loadingStates.spinning = true;
|
||||||
|
|
||||||
const msg = await HttpUtil.post('/login', this.user);
|
const msg = await HttpUtil.post('/login', this.user);
|
||||||
this.loading = false;
|
|
||||||
if (msg.success) {
|
if (msg.success) {
|
||||||
location.href = basePath + 'panel/';
|
location.href = basePath + 'panel/';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.loadingStates.spinning = false;
|
||||||
},
|
},
|
||||||
async getTwoFactorEnable() {
|
async getTwoFactorEnable() {
|
||||||
this.loading = true;
|
|
||||||
const msg = await HttpUtil.post('/getTwoFactorEnable');
|
const msg = await HttpUtil.post('/getTwoFactorEnable');
|
||||||
this.loading = false;
|
|
||||||
if (msg.success) {
|
if (msg.success) {
|
||||||
this.twoFactorEnable = msg.obj;
|
this.twoFactorEnable = msg.obj;
|
||||||
|
this.loadingStates.fetched = true;
|
||||||
|
|
||||||
return msg.obj;
|
return msg.obj;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -614,5 +184,80 @@
|
|||||||
newWord.classList.add('is-visible');
|
newWord.classList.add('is-visible');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const pm_input_selector = 'input.ant-input, textarea.ant-input';
|
||||||
|
const pm_strip_props = [
|
||||||
|
'background',
|
||||||
|
'background-color',
|
||||||
|
'background-image',
|
||||||
|
'color'
|
||||||
|
];
|
||||||
|
|
||||||
|
const pm_observed_forms = new WeakSet();
|
||||||
|
|
||||||
|
function pm_strip_inline(el) {
|
||||||
|
if (!el || el.nodeType !== 1 || !el.matches?.(pm_input_selector)) return;
|
||||||
|
|
||||||
|
let did_change = false;
|
||||||
|
for (const prop of pm_strip_props) {
|
||||||
|
if (el.style.getPropertyValue(prop)) {
|
||||||
|
el.style.removeProperty(prop);
|
||||||
|
did_change = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (did_change && el.style.length === 0) {
|
||||||
|
el.removeAttribute('style');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function pm_attach_observer(form) {
|
||||||
|
if (pm_observed_forms.has(form)) return;
|
||||||
|
pm_observed_forms.add(form);
|
||||||
|
|
||||||
|
form.querySelectorAll(pm_input_selector).forEach(pm_strip_inline);
|
||||||
|
|
||||||
|
const pm_mo = new MutationObserver(mutations => {
|
||||||
|
for (const m of mutations) {
|
||||||
|
if (m.type === 'attributes') {
|
||||||
|
pm_strip_inline(m.target);
|
||||||
|
} else if (m.type === 'childList') {
|
||||||
|
for (const n of m.addedNodes) {
|
||||||
|
if (n.nodeType !== 1) continue;
|
||||||
|
if (n.matches?.(pm_input_selector)) pm_strip_inline(n);
|
||||||
|
n.querySelectorAll?.(pm_input_selector).forEach(pm_strip_inline);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
pm_mo.observe(form, {
|
||||||
|
attributes: true,
|
||||||
|
attributeFilter: ['style'],
|
||||||
|
childList: true,
|
||||||
|
subtree: true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function pm_init() {
|
||||||
|
document.querySelectorAll('form.ant-form').forEach(pm_attach_observer);
|
||||||
|
const pm_host = document.getElementById('login') || document.body;
|
||||||
|
const pm_wait_for_forms = new MutationObserver(mutations => {
|
||||||
|
for (const m of mutations) {
|
||||||
|
for (const n of m.addedNodes) {
|
||||||
|
if (n.nodeType !== 1) continue;
|
||||||
|
if (n.matches?.('form.ant-form')) pm_attach_observer(n);
|
||||||
|
n.querySelectorAll?.('form.ant-form').forEach(pm_attach_observer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
pm_wait_for_forms.observe(pm_host, { childList: true, subtree: true });
|
||||||
|
}
|
||||||
|
|
||||||
|
if (document.readyState === 'loading') {
|
||||||
|
document.addEventListener('DOMContentLoaded', pm_init, { once: true });
|
||||||
|
} else {
|
||||||
|
pm_init();
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
{{ template "page/body_end" .}}
|
{{ template "page/body_end" .}}
|
||||||
@@ -39,7 +39,7 @@
|
|||||||
<a-select-option v-for="key in TLS_FLOW_CONTROL" :value="key">[[ key ]]</a-select-option>
|
<a-select-option v-for="key in TLS_FLOW_CONTROL" :value="key">[[ key ]]</a-select-option>
|
||||||
</a-select>
|
</a-select>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item v-if="app.subSettings.enable">
|
<a-form-item v-if="app.subSettings?.enable">
|
||||||
<template slot="label">
|
<template slot="label">
|
||||||
<a-tooltip>
|
<a-tooltip>
|
||||||
<template slot="title">
|
<template slot="title">
|
||||||
|
|||||||
@@ -121,7 +121,7 @@
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async getDBClientIps(email) {
|
async getDBClientIps(email) {
|
||||||
const msg = await HttpUtil.post(`/panel/inbound/clientIps/${email}`);
|
const msg = await HttpUtil.post(`/panel/api/inbounds/clientIps/${email}`);
|
||||||
if (!msg.success) {
|
if (!msg.success) {
|
||||||
document.getElementById("clientIPs").value = msg.obj;
|
document.getElementById("clientIPs").value = msg.obj;
|
||||||
return;
|
return;
|
||||||
@@ -139,7 +139,7 @@
|
|||||||
},
|
},
|
||||||
async clearDBClientIps(email) {
|
async clearDBClientIps(email) {
|
||||||
try {
|
try {
|
||||||
const msg = await HttpUtil.post(`/panel/inbound/clearClientIps/${email}`);
|
const msg = await HttpUtil.post(`/panel/api/inbounds/clearClientIps/${email}`);
|
||||||
if (!msg.success) {
|
if (!msg.success) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -156,7 +156,7 @@
|
|||||||
cancelText: '{{ i18n "cancel"}}',
|
cancelText: '{{ i18n "cancel"}}',
|
||||||
onOk: async () => {
|
onOk: async () => {
|
||||||
iconElement.disabled = true;
|
iconElement.disabled = true;
|
||||||
const msg = await HttpUtil.postWithModal('/panel/inbound/' + dbInboundId + '/resetClientTraffic/' + email);
|
const msg = await HttpUtil.postWithModal('/panel/api/inbounds/' + dbInboundId + '/resetClientTraffic/' + email);
|
||||||
if (msg.success) {
|
if (msg.success) {
|
||||||
this.clientModal.clientStats.up = 0;
|
this.clientModal.clientStats.up = 0;
|
||||||
this.clientModal.clientStats.down = 0;
|
this.clientModal.clientStats.down = 0;
|
||||||
|
|||||||
@@ -3,22 +3,29 @@
|
|||||||
:mask-closable="false" :footer="null" :class="themeSwitcher.currentTheme">
|
:mask-closable="false" :footer="null" :class="themeSwitcher.currentTheme">
|
||||||
<a-list class="ant-dns-presets-list" bordered :style="{ width: '100%' }">
|
<a-list class="ant-dns-presets-list" bordered :style="{ width: '100%' }">
|
||||||
<a-list-item v-for="dns in dnsPresetsDatabase" :style="{ padding: '12px 16px' }">
|
<a-list-item v-for="dns in dnsPresetsDatabase" :style="{ padding: '12px 16px' }">
|
||||||
<a-row justify="space-between" align="middle">
|
<div class="ant-dns-presets-line">
|
||||||
<a-col :span="12">
|
<a-space direction="horizontal" size="small" align="center">
|
||||||
<a-space direction="vertical" size="small">
|
<a-tag :color="dns.family ? 'purple' : 'green'">[[ dns.family ? '{{ i18n "pages.xray.dns.dnsPresetFamily" }}' : 'DNS' ]]</a-tag>
|
||||||
<span class="ant-dns-presets-list-name">[[ dns.name ]]</span>
|
<span class="ant-dns-presets-list-name">[[ dns.name ]]</span>
|
||||||
<a-tag :color="dns.family ? 'purple' : 'green'">[[ dns.family ? '{{ i18n "pages.xray.dns.dnsPresetFamily" }}' : 'DNS' ]]</a-tag>
|
</a-space>
|
||||||
</a-space>
|
<a-button class="ant-dns-presets-install" type="primary" @click="dnsPresetsModal.install(dns.data)">{{ i18n "install" }}</a-button>
|
||||||
</a-col>
|
</div>
|
||||||
<a-col :span="12" :style="{ textAlign: 'right' }">
|
|
||||||
<a-button type="primary" @click="dnsPresetsModal.install(dns.data)">{{ i18n "install" }}</a-button>
|
|
||||||
</a-col>
|
|
||||||
</a-row>
|
|
||||||
</a-list-item>
|
</a-list-item>
|
||||||
</a-list>
|
</a-list>
|
||||||
</a-modal>
|
</a-modal>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
.ant-dns-presets-line {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ant-dns-presets-install {
|
||||||
|
margin-left: auto;
|
||||||
|
}
|
||||||
|
|
||||||
.dark .ant-dns-presets-list {
|
.dark .ant-dns-presets-list {
|
||||||
border-color: var(--dark-color-stroke)
|
border-color: var(--dark-color-stroke)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -101,9 +101,19 @@
|
|||||||
{{ i18n "security" }}
|
{{ i18n "security" }}
|
||||||
<a-tag :color="inbound.stream.security == 'none' ? 'red' : 'green'">[[ inbound.stream.security ]]</a-tag>
|
<a-tag :color="inbound.stream.security == 'none' ? 'red' : 'green'">[[ inbound.stream.security ]]</a-tag>
|
||||||
<br />
|
<br />
|
||||||
|
<td>Authentication</td>
|
||||||
|
<a-tag v-if="inbound.settings.selectedAuth" color="green">[[ inbound.settings.selectedAuth ? inbound.settings.selectedAuth : '' ]]</a-tag>
|
||||||
|
<a-tag v-else color="red">{{ i18n "none" }}</a-tag>
|
||||||
|
<br />
|
||||||
|
{{ i18n "encryption" }}
|
||||||
|
<a-tag class="info-large-tag" :color="inbound.settings.encryption ? 'green' : 'red'">[[ inbound.settings.encryption ? inbound.settings.encryption : '' ]]</a-tag>
|
||||||
|
<a-tooltip title='{{ i18n "copy" }}'>
|
||||||
|
<a-button size="small" icon="snippets" @click="copy(inbound.settings.encryption)"></a-button>
|
||||||
|
</a-tooltip>
|
||||||
|
<br />
|
||||||
<template v-if="inbound.stream.security != 'none'">
|
<template v-if="inbound.stream.security != 'none'">
|
||||||
{{ i18n "domainName" }}
|
{{ i18n "domainName" }}
|
||||||
<a-tag v-if="inbound.serverName" :color="inbound.serverName ? 'green' : 'orange'">[[ inbound.serverName ? inbound.serverName : '' ]]</a-tag>
|
<a-tag v-if="inbound.serverName" color="green">[[ inbound.serverName ? inbound.serverName : '' ]]</a-tag>
|
||||||
<a-tag v-else color="orange">{{ i18n "none" }}</a-tag>
|
<a-tag v-else color="orange">{{ i18n "none" }}</a-tag>
|
||||||
</template>
|
</template>
|
||||||
</template>
|
</template>
|
||||||
@@ -173,9 +183,9 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td>{{ i18n "status" }}</td>
|
<td>{{ i18n "status" }}</td>
|
||||||
<td>
|
<td>
|
||||||
<a-tag v-if="isEnable" color="green">{{ i18n "enabled" }}</a-tag>
|
<a-tag v-if="isDepleted" color="red">{{ i18n "depleted" }}</a-tag>
|
||||||
|
<a-tag v-else-if="isEnable" color="green">{{ i18n "enabled" }}</a-tag>
|
||||||
<a-tag v-else>{{ i18n "disabled" }}</a-tag>
|
<a-tag v-else>{{ i18n "disabled" }}</a-tag>
|
||||||
<a-tag v-if="!isActive" color="red">{{ i18n "depleted" }}</a-tag>
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr v-if="infoModal.clientStats">
|
<tr v-if="infoModal.clientStats">
|
||||||
@@ -185,6 +195,44 @@
|
|||||||
<a-tag>↑ [[ SizeFormatter.sizeFormat(infoModal.clientStats.up) ]] / [[ SizeFormatter.sizeFormat(infoModal.clientStats.down) ]] ↓</a-tag>
|
<a-tag>↑ [[ SizeFormatter.sizeFormat(infoModal.clientStats.up) ]] / [[ SizeFormatter.sizeFormat(infoModal.clientStats.down) ]] ↓</a-tag>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>{{ i18n "pages.inbounds.createdAt" }}</td>
|
||||||
|
<td>
|
||||||
|
<template v-if="infoModal.clientSettings && infoModal.clientSettings.created_at">
|
||||||
|
<template v-if="app.datepicker === 'gregorian'">
|
||||||
|
<a-tag>[[ DateUtil.formatMillis(infoModal.clientSettings.created_at) ]]</a-tag>
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<a-tag>[[ DateUtil.convertToJalalian(moment(infoModal.clientSettings.created_at)) ]]</a-tag>
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<a-tag>-</a-tag>
|
||||||
|
</template>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>{{ i18n "pages.inbounds.updatedAt" }}</td>
|
||||||
|
<td>
|
||||||
|
<template v-if="infoModal.clientSettings && infoModal.clientSettings.updated_at">
|
||||||
|
<template v-if="app.datepicker === 'gregorian'">
|
||||||
|
<a-tag>[[ DateUtil.formatMillis(infoModal.clientSettings.updated_at) ]]</a-tag>
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<a-tag>[[ DateUtil.convertToJalalian(moment(infoModal.clientSettings.updated_at)) ]]</a-tag>
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<a-tag>-</a-tag>
|
||||||
|
</template>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>{{ i18n "lastOnline" }}</td>
|
||||||
|
<td>
|
||||||
|
<a-tag>[[ app.formatLastOnline(infoModal.clientSettings && infoModal.clientSettings.email ? infoModal.clientSettings.email : '') ]]</a-tag>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr v-if="infoModal.clientSettings.comment">
|
<tr v-if="infoModal.clientSettings.comment">
|
||||||
<td>{{ i18n "comment" }}</td>
|
<td>{{ i18n "comment" }}</td>
|
||||||
<td>
|
<td>
|
||||||
@@ -199,7 +247,7 @@
|
|||||||
<a-tag>[[ infoModal.clientSettings.limitIp ]]</a-tag>
|
<a-tag>[[ infoModal.clientSettings.limitIp ]]</a-tag>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr v-if="app.ipLimitEnable">
|
<tr v-if="app.ipLimitEnable && infoModal.clientSettings.limitIp > 0">
|
||||||
<td>{{ i18n "pages.inbounds.IPLimitlog" }}</td>
|
<td>{{ i18n "pages.inbounds.IPLimitlog" }}</td>
|
||||||
<td>
|
<td>
|
||||||
<a-tag>[[ infoModal.clientIps ]]</a-tag>
|
<a-tag>[[ infoModal.clientIps ]]</a-tag>
|
||||||
@@ -263,7 +311,7 @@
|
|||||||
</tr-info-title>
|
</tr-info-title>
|
||||||
<a :href="[[ infoModal.subLink ]]" target="_blank">[[ infoModal.subLink ]]</a>
|
<a :href="[[ infoModal.subLink ]]" target="_blank">[[ infoModal.subLink ]]</a>
|
||||||
</tr-info-row>
|
</tr-info-row>
|
||||||
<tr-info-row class="tr-info-row">
|
<tr-info-row class="tr-info-row" v-if="app.subSettings.subJsonEnable">
|
||||||
<tr-info-title class="tr-info-title">
|
<tr-info-title class="tr-info-title">
|
||||||
<a-tag color="purple">Json Link</a-tag>
|
<a-tag color="purple">Json Link</a-tag>
|
||||||
<a-tooltip title='{{ i18n "copy" }}'>
|
<a-tooltip title='{{ i18n "copy" }}'>
|
||||||
@@ -310,7 +358,7 @@
|
|||||||
<code>[[ link.link ]]</code>
|
<code>[[ link.link ]]</code>
|
||||||
</tr-info-row>
|
</tr-info-row>
|
||||||
</template>
|
</template>
|
||||||
<table v-if="inbound.protocol == Protocols.DOKODEMO" class="tr-info-table">
|
<table v-if="inbound.protocol == Protocols.TUNNEL" class="tr-info-table">
|
||||||
<tr>
|
<tr>
|
||||||
<th>{{ i18n "pages.inbounds.targetAddress" }}</th>
|
<th>{{ i18n "pages.inbounds.targetAddress" }}</th>
|
||||||
<th>{{ i18n "pages.inbounds.destinationPort" }}</th>
|
<th>{{ i18n "pages.inbounds.destinationPort" }}</th>
|
||||||
@@ -332,7 +380,7 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<table v-if="dbInbound.isSocks" class="tr-info-table">
|
<table v-if="dbInbound.isMixed" class="tr-info-table">
|
||||||
<tr>
|
<tr>
|
||||||
<th>{{ i18n "password" }} Auth</th>
|
<th>{{ i18n "password" }} Auth</th>
|
||||||
<th>{{ i18n "pages.inbounds.enable" }} udp</th>
|
<th>{{ i18n "pages.inbounds.enable" }} udp</th>
|
||||||
@@ -448,7 +496,7 @@
|
|||||||
</a-modal>
|
</a-modal>
|
||||||
<script>
|
<script>
|
||||||
function refreshIPs(email) {
|
function refreshIPs(email) {
|
||||||
return HttpUtil.post(`/panel/inbound/clientIps/${email}`).then((msg) => {
|
return HttpUtil.post(`/panel/api/inbounds/clientIps/${email}`).then((msg) => {
|
||||||
if (msg.success) {
|
if (msg.success) {
|
||||||
try {
|
try {
|
||||||
return JSON.parse(msg.obj).join(', ');
|
return JSON.parse(msg.obj).join(', ');
|
||||||
@@ -479,7 +527,7 @@
|
|||||||
this.dbInbound = new DBInbound(dbInbound);
|
this.dbInbound = new DBInbound(dbInbound);
|
||||||
this.clientSettings = this.inbound.clients ? this.inbound.clients[index] : null;
|
this.clientSettings = this.inbound.clients ? this.inbound.clients[index] : null;
|
||||||
this.isExpired = this.inbound.clients ? this.inbound.isExpiry(index) : this.dbInbound.isExpiry;
|
this.isExpired = this.inbound.clients ? this.inbound.isExpiry(index) : this.dbInbound.isExpiry;
|
||||||
this.clientStats = this.inbound.clients ? this.dbInbound.clientStats.find(row => row.email === this.clientSettings.email) : [];
|
this.clientStats = this.inbound.clients ? (this.dbInbound.clientStats.find(row => row.email === this.clientSettings.email) || null) : null;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
[
|
[
|
||||||
@@ -503,7 +551,7 @@
|
|||||||
if (this.clientSettings) {
|
if (this.clientSettings) {
|
||||||
if (this.clientSettings.subId) {
|
if (this.clientSettings.subId) {
|
||||||
this.subLink = this.genSubLink(this.clientSettings.subId);
|
this.subLink = this.genSubLink(this.clientSettings.subId);
|
||||||
this.subJsonLink = this.genSubJsonLink(this.clientSettings.subId);
|
this.subJsonLink = app.subSettings.subJsonEnable ? this.genSubJsonLink(this.clientSettings.subId) : '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.visible = true;
|
this.visible = true;
|
||||||
@@ -542,6 +590,24 @@
|
|||||||
}
|
}
|
||||||
return infoModal.dbInbound.isEnable;
|
return infoModal.dbInbound.isEnable;
|
||||||
},
|
},
|
||||||
|
get isDepleted() {
|
||||||
|
const stats = infoModal.clientStats;
|
||||||
|
const settings = infoModal.clientSettings;
|
||||||
|
if (!stats || !settings) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
const total = stats.total ?? 0;
|
||||||
|
const used = (stats.up ?? 0) + (stats.down ?? 0);
|
||||||
|
const hasTotal = total > 0;
|
||||||
|
const exhausted = hasTotal && used >= total;
|
||||||
|
|
||||||
|
const expiryTime = settings.expiryTime ?? 0;
|
||||||
|
const hasExpiry = expiryTime > 0;
|
||||||
|
const now = Date.now();
|
||||||
|
const expired = hasExpiry && now >= expiryTime;
|
||||||
|
|
||||||
|
return expired || exhausted;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
copy(content) {
|
copy(content) {
|
||||||
@@ -569,7 +635,7 @@
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
clearClientIps() {
|
clearClientIps() {
|
||||||
HttpUtil.post(`/panel/inbound/clearClientIps/${this.infoModal.clientStats.email}`)
|
HttpUtil.post(`/panel/api/inbounds/clearClientIps/${this.infoModal.clientStats.email}`)
|
||||||
.then((msg) => {
|
.then((msg) => {
|
||||||
if (!msg.success) {
|
if (!msg.success) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
{{define "modals/inboundModal"}}
|
{{define "modals/inboundModal"}}
|
||||||
<a-modal id="inbound-modal" v-model="inModal.visible" :title="inModal.title"
|
<a-modal id="inbound-modal" v-model="inModal.visible" :title="inModal.title" :dialog-style="{ top: '20px' }"
|
||||||
:dialog-style="{ top: '20px' }" @ok="inModal.ok"
|
@ok="inModal.ok" :confirm-loading="inModal.confirmLoading" :closable="true" :mask-closable="false"
|
||||||
:confirm-loading="inModal.confirmLoading" :closable="true" :mask-closable="false"
|
:class="themeSwitcher.currentTheme" :ok-text="inModal.okText" cancel-text='{{ i18n "close" }}'>
|
||||||
:class="themeSwitcher.currentTheme"
|
|
||||||
:ok-text="inModal.okText" cancel-text='{{ i18n "close" }}'>
|
|
||||||
{{template "form/inbound"}}
|
{{template "form/inbound"}}
|
||||||
</a-modal>
|
</a-modal>
|
||||||
<script>
|
<script>
|
||||||
@@ -20,7 +18,7 @@
|
|||||||
ok() {
|
ok() {
|
||||||
ObjectUtil.execute(inModal.confirm, inModal.inbound, inModal.dbInbound);
|
ObjectUtil.execute(inModal.confirm, inModal.inbound, inModal.dbInbound);
|
||||||
},
|
},
|
||||||
show({ title = '', okText = '{{ i18n "sure" }}', inbound = null, dbInbound = null, confirm = (inbound, dbInbound) => {}, isEdit = false }) {
|
show({ title = '', okText = '{{ i18n "sure" }}', inbound = null, dbInbound = null, confirm = (inbound, dbInbound) => { }, isEdit = false }) {
|
||||||
this.title = title;
|
this.title = title;
|
||||||
this.okText = okText;
|
this.okText = okText;
|
||||||
if (inbound) {
|
if (inbound) {
|
||||||
@@ -41,7 +39,7 @@
|
|||||||
inModal.visible = false;
|
inModal.visible = false;
|
||||||
inModal.loading(false);
|
inModal.loading(false);
|
||||||
},
|
},
|
||||||
loading(loading=true) {
|
loading(loading = true) {
|
||||||
inModal.confirmLoading = loading;
|
inModal.confirmLoading = loading;
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@@ -105,9 +103,9 @@
|
|||||||
},
|
},
|
||||||
SSMethodChange() {
|
SSMethodChange() {
|
||||||
this.inModal.inbound.settings.password = RandomUtil.randomShadowsocksPassword(this.inModal.inbound.settings.method)
|
this.inModal.inbound.settings.password = RandomUtil.randomShadowsocksPassword(this.inModal.inbound.settings.method)
|
||||||
|
|
||||||
if (this.inModal.inbound.isSSMultiUser) {
|
if (this.inModal.inbound.isSSMultiUser) {
|
||||||
if (this.inModal.inbound.settings.shadowsockses.length ==0){
|
if (this.inModal.inbound.settings.shadowsockses.length == 0) {
|
||||||
this.inModal.inbound.settings.shadowsockses = [new Inbound.ShadowsocksSettings.Shadowsocks()];
|
this.inModal.inbound.settings.shadowsockses = [new Inbound.ShadowsocksSettings.Shadowsocks()];
|
||||||
}
|
}
|
||||||
if (!this.inModal.inbound.isSS2022) {
|
if (!this.inModal.inbound.isSS2022) {
|
||||||
@@ -123,7 +121,7 @@
|
|||||||
client.password = RandomUtil.randomShadowsocksPassword(this.inModal.inbound.settings.method)
|
client.password = RandomUtil.randomShadowsocksPassword(this.inModal.inbound.settings.method)
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
if (this.inModal.inbound.settings.shadowsockses.length > 0){
|
if (this.inModal.inbound.settings.shadowsockses.length > 0) {
|
||||||
this.inModal.inbound.settings.shadowsockses = [];
|
this.inModal.inbound.settings.shadowsockses = [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -134,16 +132,75 @@
|
|||||||
},
|
},
|
||||||
async getNewX25519Cert() {
|
async getNewX25519Cert() {
|
||||||
inModal.loading(true);
|
inModal.loading(true);
|
||||||
const msg = await HttpUtil.post('/server/getNewX25519Cert');
|
const msg = await HttpUtil.get('/panel/api/server/getNewX25519Cert');
|
||||||
inModal.loading(false);
|
inModal.loading(false);
|
||||||
if (!msg.success) {
|
if (!msg.success) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
inModal.inbound.stream.reality.privateKey = msg.obj.privateKey;
|
inModal.inbound.stream.reality.privateKey = msg.obj.privateKey;
|
||||||
inModal.inbound.stream.reality.settings.publicKey = msg.obj.publicKey;
|
inModal.inbound.stream.reality.settings.publicKey = msg.obj.publicKey;
|
||||||
|
},
|
||||||
|
clearX25519Cert() {
|
||||||
|
this.inbound.stream.reality.privateKey = '';
|
||||||
|
this.inbound.stream.reality.settings.publicKey = '';
|
||||||
|
},
|
||||||
|
async getNewmldsa65() {
|
||||||
|
inModal.loading(true);
|
||||||
|
const msg = await HttpUtil.get('/panel/api/server/getNewmldsa65');
|
||||||
|
inModal.loading(false);
|
||||||
|
if (!msg.success) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
inModal.inbound.stream.reality.mldsa65Seed = msg.obj.seed;
|
||||||
|
inModal.inbound.stream.reality.settings.mldsa65Verify = msg.obj.verify;
|
||||||
|
},
|
||||||
|
clearMldsa65() {
|
||||||
|
this.inbound.stream.reality.mldsa65Seed = '';
|
||||||
|
this.inbound.stream.reality.settings.mldsa65Verify = '';
|
||||||
|
},
|
||||||
|
async getNewEchCert() {
|
||||||
|
inModal.loading(true);
|
||||||
|
const msg = await HttpUtil.post('/panel/api/server/getNewEchCert', { sni: inModal.inbound.stream.tls.sni });
|
||||||
|
inModal.loading(false);
|
||||||
|
if (!msg.success) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
inModal.inbound.stream.tls.echServerKeys = msg.obj.echServerKeys;
|
||||||
|
inModal.inbound.stream.tls.settings.echConfigList = msg.obj.echConfigList;
|
||||||
|
},
|
||||||
|
clearEchCert() {
|
||||||
|
this.inbound.stream.tls.echServerKeys = '';
|
||||||
|
this.inbound.stream.tls.settings.echConfigList = '';
|
||||||
|
},
|
||||||
|
async getNewVlessEnc() {
|
||||||
|
inModal.loading(true);
|
||||||
|
const msg = await HttpUtil.get('/panel/api/server/getNewVlessEnc');
|
||||||
|
inModal.loading(false);
|
||||||
|
|
||||||
|
if (!msg.success) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const auths = msg.obj.auths || [];
|
||||||
|
const selected = inModal.inbound.settings.selectedAuth;
|
||||||
|
const block = auths.find(a => a.label === selected);
|
||||||
|
|
||||||
|
if (!block) {
|
||||||
|
console.error("No auth block for", selected);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
inModal.inbound.settings.decryption = block.decryption;
|
||||||
|
inModal.inbound.settings.encryption = block.encryption;
|
||||||
|
},
|
||||||
|
clearVlessEnc() {
|
||||||
|
this.inbound.settings.decryption = 'none';
|
||||||
|
this.inbound.settings.encryption = 'none';
|
||||||
|
this.inbound.settings.selectedAuth = undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
{{end}}
|
{{end}}
|
||||||
@@ -21,7 +21,7 @@
|
|||||||
</a-space>
|
</a-space>
|
||||||
</template>
|
</template>
|
||||||
<tr-qr-modal class="qr-modal">
|
<tr-qr-modal class="qr-modal">
|
||||||
<template v-if="app.subSettings.enable && qrModal.subId">
|
<template v-if="app.subSettings?.enable && qrModal.subId">
|
||||||
<tr-qr-box class="qr-box">
|
<tr-qr-box class="qr-box">
|
||||||
<a-tag color="purple" class="qr-tag"><span>{{ i18n "pages.settings.subSettings"}}</span></a-tag>
|
<a-tag color="purple" class="qr-tag"><span>{{ i18n "pages.settings.subSettings"}}</span></a-tag>
|
||||||
<tr-qr-bg class="qr-bg-sub">
|
<tr-qr-bg class="qr-bg-sub">
|
||||||
@@ -30,7 +30,7 @@
|
|||||||
</tr-qr-bg-inner>
|
</tr-qr-bg-inner>
|
||||||
</tr-qr-bg>
|
</tr-qr-bg>
|
||||||
</tr-qr-box>
|
</tr-qr-box>
|
||||||
<tr-qr-box class="qr-box">
|
<tr-qr-box class="qr-box" v-if="app.subSettings.subJsonEnable">
|
||||||
<a-tag color="purple" class="qr-tag"><span>{{ i18n "pages.settings.subSettings"}} Json</span></a-tag>
|
<a-tag color="purple" class="qr-tag"><span>{{ i18n "pages.settings.subSettings"}} Json</span></a-tag>
|
||||||
<tr-qr-bg class="qr-bg-sub">
|
<tr-qr-bg class="qr-bg-sub">
|
||||||
<tr-qr-bg-inner class="qr-bg-sub-inner">
|
<tr-qr-bg-inner class="qr-bg-sub-inner">
|
||||||
@@ -151,7 +151,7 @@
|
|||||||
methods: {
|
methods: {
|
||||||
async getStatus() {
|
async getStatus() {
|
||||||
try {
|
try {
|
||||||
const msg = await HttpUtil.post('/server/status');
|
const msg = await HttpUtil.get('/panel/api/server/status');
|
||||||
if (msg.success) {
|
if (msg.success) {
|
||||||
this.serverStatus = msg.obj;
|
this.serverStatus = msg.obj;
|
||||||
}
|
}
|
||||||
@@ -262,7 +262,9 @@
|
|||||||
if (qrModal.client && qrModal.client.subId) {
|
if (qrModal.client && qrModal.client.subId) {
|
||||||
qrModal.subId = qrModal.client.subId;
|
qrModal.subId = qrModal.client.subId;
|
||||||
this.setQrCode("qrCode-sub", this.genSubLink(qrModal.subId));
|
this.setQrCode("qrCode-sub", this.genSubLink(qrModal.subId));
|
||||||
this.setQrCode("qrCode-subJson", this.genSubJsonLink(qrModal.subId));
|
if (app.subSettings.subJsonEnable) {
|
||||||
|
this.setQrCode("qrCode-subJson", this.genSubJsonLink(qrModal.subId));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
qrModal.qrcodes.forEach((element, index) => {
|
qrModal.qrcodes.forEach((element, index) => {
|
||||||
this.setQrCode("qrCode-" + index, element.link);
|
this.setQrCode("qrCode-" + index, element.link);
|
||||||
|
|||||||
@@ -1,11 +1,6 @@
|
|||||||
{{define "modals/ruleModal"}}
|
{{define "modals/ruleModal"}}
|
||||||
<a-modal id="rule-modal" v-model="ruleModal.visible" :title="ruleModal.title" @ok="ruleModal.ok" :confirm-loading="ruleModal.confirmLoading" :closable="true" :mask-closable="false" :ok-text="ruleModal.okText" cancel-text='{{ i18n "close" }}' :class="themeSwitcher.currentTheme">
|
<a-modal id="rule-modal" v-model="ruleModal.visible" :title="ruleModal.title" @ok="ruleModal.ok" :confirm-loading="ruleModal.confirmLoading" :closable="true" :mask-closable="false" :ok-text="ruleModal.okText" cancel-text='{{ i18n "close" }}' :class="themeSwitcher.currentTheme">
|
||||||
<a-form :colon="false" :label-col="{ md: {span:8} }" :wrapper-col="{ md: {span:14} }">
|
<a-form :colon="false" :label-col="{ md: {span:8} }" :wrapper-col="{ md: {span:14} }">
|
||||||
<a-form-item label='Domain Matcher'>
|
|
||||||
<a-select v-model="ruleModal.rule.domainMatcher" :dropdown-class-name="themeSwitcher.currentTheme">
|
|
||||||
<a-select-option v-for="dm in ['','hybrid','linear']" :value="dm">[[ dm ]]</a-select-option>
|
|
||||||
</a-select>
|
|
||||||
</a-form-item>
|
|
||||||
<a-form-item>
|
<a-form-item>
|
||||||
<template slot="label">
|
<template slot="label">
|
||||||
<a-tooltip>
|
<a-tooltip>
|
||||||
@@ -14,7 +9,7 @@
|
|||||||
</template> Source IPs <a-icon type="question-circle"></a-icon>
|
</template> Source IPs <a-icon type="question-circle"></a-icon>
|
||||||
</a-tooltip>
|
</a-tooltip>
|
||||||
</template>
|
</template>
|
||||||
<a-input v-model.trim="ruleModal.rule.source"></a-input>
|
<a-input v-model.trim="ruleModal.rule.sourceIP" placeholder="e.g. 0.0.0.0/8, fc00::/7, geoip:ir"></a-input>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item>
|
<a-form-item>
|
||||||
<template slot="label">
|
<template slot="label">
|
||||||
@@ -24,7 +19,17 @@
|
|||||||
</template> Source Port <a-icon type="question-circle"></a-icon>
|
</template> Source Port <a-icon type="question-circle"></a-icon>
|
||||||
</a-tooltip>
|
</a-tooltip>
|
||||||
</template>
|
</template>
|
||||||
<a-input v-model.trim="ruleModal.rule.sourcePort"></a-input>
|
<a-input v-model.trim="ruleModal.rule.sourcePort" placeholder="e.g. 53,443,1000-2000"></a-input>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item>
|
||||||
|
<template slot="label">
|
||||||
|
<a-tooltip>
|
||||||
|
<template slot="title">
|
||||||
|
<span>{{ i18n "pages.xray.rules.useComma" }}</span>
|
||||||
|
</template> VLESS Route <a-icon type="question-circle"></a-icon>
|
||||||
|
</a-tooltip>
|
||||||
|
</template>
|
||||||
|
<a-input v-model.trim="ruleModal.rule.vlessRoute" placeholder="e.g. 53,443,1000-2000"></a-input>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item label='Network'>
|
<a-form-item label='Network'>
|
||||||
<a-select v-model="ruleModal.rule.network" :dropdown-class-name="themeSwitcher.currentTheme">
|
<a-select v-model="ruleModal.rule.network" :dropdown-class-name="themeSwitcher.currentTheme">
|
||||||
@@ -57,7 +62,7 @@
|
|||||||
</template> IP <a-icon type="question-circle"></a-icon>
|
</template> IP <a-icon type="question-circle"></a-icon>
|
||||||
</a-tooltip>
|
</a-tooltip>
|
||||||
</template>
|
</template>
|
||||||
<a-input v-model.trim="ruleModal.rule.ip"></a-input>
|
<a-input v-model.trim="ruleModal.rule.ip" placeholder="e.g. 0.0.0.0/8, fc00::/7, geoip:ir"></a-input>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item>
|
<a-form-item>
|
||||||
<template slot="label">
|
<template slot="label">
|
||||||
@@ -67,7 +72,7 @@
|
|||||||
</template> Domain <a-icon type="question-circle"></a-icon>
|
</template> Domain <a-icon type="question-circle"></a-icon>
|
||||||
</a-tooltip>
|
</a-tooltip>
|
||||||
</template>
|
</template>
|
||||||
<a-input v-model.trim="ruleModal.rule.domain"></a-input>
|
<a-input v-model.trim="ruleModal.rule.domain" placeholder="e.g. google.com, geosite:cn"></a-input>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item>
|
<a-form-item>
|
||||||
<template slot="label">
|
<template slot="label">
|
||||||
@@ -77,7 +82,7 @@
|
|||||||
</template> User <a-icon type="question-circle"></a-icon>
|
</template> User <a-icon type="question-circle"></a-icon>
|
||||||
</a-tooltip>
|
</a-tooltip>
|
||||||
</template>
|
</template>
|
||||||
<a-input v-model.trim="ruleModal.rule.user"></a-input>
|
<a-input v-model.trim="ruleModal.rule.user" placeholder="e.g. email address"></a-input>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item>
|
<a-form-item>
|
||||||
<template slot="label">
|
<template slot="label">
|
||||||
@@ -87,7 +92,7 @@
|
|||||||
</template> Port <a-icon type="question-circle"></a-icon>
|
</template> Port <a-icon type="question-circle"></a-icon>
|
||||||
</a-tooltip>
|
</a-tooltip>
|
||||||
</template>
|
</template>
|
||||||
<a-input v-model.trim="ruleModal.rule.port"></a-input>
|
<a-input v-model.trim="ruleModal.rule.port" placeholder="e.g. 53,443,1000-2000"></a-input>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item label='Inbound Tags'>
|
<a-form-item label='Inbound Tags'>
|
||||||
<a-select v-model="ruleModal.rule.inboundTag" mode="multiple" :dropdown-class-name="themeSwitcher.currentTheme">
|
<a-select v-model="ruleModal.rule.inboundTag" mode="multiple" :dropdown-class-name="themeSwitcher.currentTheme">
|
||||||
@@ -123,13 +128,13 @@
|
|||||||
confirm: null,
|
confirm: null,
|
||||||
rule: {
|
rule: {
|
||||||
type: "field",
|
type: "field",
|
||||||
domainMatcher: "",
|
|
||||||
domain: "",
|
domain: "",
|
||||||
ip: "",
|
ip: "",
|
||||||
port: "",
|
port: "",
|
||||||
sourcePort: "",
|
sourcePort: "",
|
||||||
|
vlessRoute: "",
|
||||||
network: "",
|
network: "",
|
||||||
source: "",
|
sourceIP: "",
|
||||||
user: "",
|
user: "",
|
||||||
inboundTag: [],
|
inboundTag: [],
|
||||||
protocol: [],
|
protocol: [],
|
||||||
@@ -157,13 +162,13 @@
|
|||||||
this.confirm = confirm;
|
this.confirm = confirm;
|
||||||
this.visible = true;
|
this.visible = true;
|
||||||
if (isEdit) {
|
if (isEdit) {
|
||||||
this.rule.domainMatcher = rule.domainMatcher;
|
|
||||||
this.rule.domain = rule.domain ? rule.domain.join(',') : [];
|
this.rule.domain = rule.domain ? rule.domain.join(',') : [];
|
||||||
this.rule.ip = rule.ip ? rule.ip.join(',') : [];
|
this.rule.ip = rule.ip ? rule.ip.join(',') : [];
|
||||||
this.rule.port = rule.port;
|
this.rule.port = rule.port;
|
||||||
this.rule.sourcePort = rule.sourcePort;
|
this.rule.sourcePort = rule.sourcePort;
|
||||||
|
this.rule.vlessRoute = rule.vlessRoute;
|
||||||
this.rule.network = rule.network;
|
this.rule.network = rule.network;
|
||||||
this.rule.source = rule.source ? rule.source.join(',') : [];
|
this.rule.sourceIP = rule.sourceIP ? rule.sourceIP.join(',') : [];
|
||||||
this.rule.user = rule.user ? rule.user.join(',') : [];
|
this.rule.user = rule.user ? rule.user.join(',') : [];
|
||||||
this.rule.inboundTag = rule.inboundTag;
|
this.rule.inboundTag = rule.inboundTag;
|
||||||
this.rule.protocol = rule.protocol;
|
this.rule.protocol = rule.protocol;
|
||||||
@@ -172,13 +177,13 @@
|
|||||||
this.rule.balancerTag = rule.balancerTag ? rule.balancerTag : "";
|
this.rule.balancerTag = rule.balancerTag ? rule.balancerTag : "";
|
||||||
} else {
|
} else {
|
||||||
this.rule = {
|
this.rule = {
|
||||||
domainMatcher: "",
|
|
||||||
domain: "",
|
domain: "",
|
||||||
ip: "",
|
ip: "",
|
||||||
port: "",
|
port: "",
|
||||||
sourcePort: "",
|
sourcePort: "",
|
||||||
|
vlessRoute: "",
|
||||||
network: "",
|
network: "",
|
||||||
source: "",
|
sourceIP: "",
|
||||||
user: "",
|
user: "",
|
||||||
inboundTag: [],
|
inboundTag: [],
|
||||||
protocol: [],
|
protocol: [],
|
||||||
@@ -214,13 +219,13 @@
|
|||||||
rule = {};
|
rule = {};
|
||||||
newRule = {};
|
newRule = {};
|
||||||
rule.type = "field";
|
rule.type = "field";
|
||||||
rule.domainMatcher = value.domainMatcher;
|
|
||||||
rule.domain = value.domain.length > 0 ? value.domain.split(',') : [];
|
rule.domain = value.domain.length > 0 ? value.domain.split(',') : [];
|
||||||
rule.ip = value.ip.length > 0 ? value.ip.split(',') : [];
|
rule.ip = value.ip.length > 0 ? value.ip.split(',') : [];
|
||||||
rule.port = value.port;
|
rule.port = value.port;
|
||||||
rule.sourcePort = value.sourcePort;
|
rule.sourcePort = value.sourcePort;
|
||||||
|
rule.vlessRoute = value.vlessRoute;
|
||||||
rule.network = value.network;
|
rule.network = value.network;
|
||||||
rule.source = value.source.length > 0 ? value.source.split(',') : [];
|
rule.sourceIP = value.sourceIP.length > 0 ? value.sourceIP.split(',') : [];
|
||||||
rule.user = value.user.length > 0 ? value.user.split(',') : [];
|
rule.user = value.user.length > 0 ? value.user.split(',') : [];
|
||||||
rule.inboundTag = value.inboundTag;
|
rule.inboundTag = value.inboundTag;
|
||||||
rule.protocol = value.protocol;
|
rule.protocol = value.protocol;
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user