Compare commits
70 Commits
1.3.0-rc.0
...
1.3.6
| Author | SHA1 | Date | |
|---|---|---|---|
| 9d1ad833f9 | |||
| e6f7354ce7 | |||
| a2c3033f5a | |||
| 03cda07c9d | |||
| fb999b4ee8 | |||
| e3ebfcf721 | |||
| 33071deb53 | |||
| 9b3b8d4540 | |||
| 98bf124078 | |||
| abc73a6525 | |||
| 2276175354 | |||
| 7f24735677 | |||
| 4d1544864d | |||
| 4aadee7ca0 | |||
| 6aba1354d5 | |||
| 63b229143d | |||
| f861950c50 | |||
| 97d1694bfa | |||
| 2d28d9b409 | |||
| 560c41acbe | |||
| e3c33bf649 | |||
| 216db63551 | |||
| 05d8a6bf85 | |||
| 1e6c2b9598 | |||
| f006323f54 | |||
| f3bfe9bb9a | |||
| ffbab9682a | |||
| 123813dc90 | |||
| 7bc7468cf3 | |||
| 12addde548 | |||
| e54cca19fa | |||
| a67ec6f58e | |||
| f913591af0 | |||
| 38f7c131a2 | |||
| 7c0478d7f4 | |||
| b26aa8d53c | |||
| fb12a27d62 | |||
| 82c7b43f06 | |||
| 05880ed3b3 | |||
| 1b13fd6839 | |||
| 44fd5f767b | |||
| 9135033dfd | |||
| b1a61584b1 | |||
| b2a0ccfe02 | |||
| 590f6871af | |||
| 282a24b8fc | |||
| af1d34a762 | |||
| 69da810426 | |||
| 8f98050964 | |||
| 1c14c1ce9c | |||
| f2ccba3cd2 | |||
| 5ad8d61002 | |||
| f7e40023c4 | |||
| 975150420c | |||
| 9c3db8cc2b | |||
| 55b6272204 | |||
| 371eb9ece8 | |||
| e883a8e153 | |||
| f608f0bba0 | |||
| 4c73fa6d58 | |||
| d13cac69c6 | |||
| 13990b68d2 | |||
| 4068096fce | |||
| a20a926332 | |||
| 50ef6cd225 | |||
| dd7e81c557 | |||
| 58fd5f17cf | |||
| 13117843ec | |||
| 60b0b3c878 | |||
| 825a8d9fd9 |
+1
-1
@@ -1 +1 @@
|
|||||||
buy_me_a_coffee: alireza7
|
github: alireza0
|
||||||
|
|||||||
@@ -10,11 +10,11 @@ jobs:
|
|||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4.2.2
|
uses: actions/checkout@v5.0.0
|
||||||
with:
|
with:
|
||||||
submodules: recursive
|
submodules: recursive
|
||||||
- name: Set up Node.js
|
- name: Set up Node.js
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v5
|
||||||
with:
|
with:
|
||||||
node-version: 20
|
node-version: 20
|
||||||
- name: Install dependencies and build frontend
|
- name: Install dependencies and build frontend
|
||||||
@@ -30,20 +30,12 @@ jobs:
|
|||||||
|
|
||||||
build:
|
build:
|
||||||
needs: frontend-build
|
needs: frontend-build
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
platform:
|
|
||||||
- linux/amd64
|
|
||||||
- linux/386
|
|
||||||
- linux/arm64/v8
|
|
||||||
- linux/arm/v7
|
|
||||||
- linux/arm/v6
|
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4.2.2
|
uses: actions/checkout@v5.0.0
|
||||||
- name: Download frontend build artifact
|
- name: Download frontend build artifact
|
||||||
uses: actions/download-artifact@v4
|
uses: actions/download-artifact@v5
|
||||||
with:
|
with:
|
||||||
name: frontend-dist
|
name: frontend-dist
|
||||||
path: frontend_dist
|
path: frontend_dist
|
||||||
@@ -89,7 +81,7 @@ jobs:
|
|||||||
context: .
|
context: .
|
||||||
file: Dockerfile.frontend-artifact
|
file: Dockerfile.frontend-artifact
|
||||||
push: true
|
push: true
|
||||||
platforms: ${{ matrix.platform }}
|
platforms: linux/amd64, linux/386, linux/arm64/v8, linux/arm/v7, linux/arm/v6
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
cache-from: type=local,src=/tmp/.buildx-cache
|
cache-from: type=local,src=/tmp/.buildx-cache
|
||||||
|
|||||||
@@ -1,13 +1,23 @@
|
|||||||
name: Release S-UI
|
name: Release S-UI
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
|
||||||
tags:
|
|
||||||
- "*"
|
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
release:
|
||||||
|
types: [published]
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
paths:
|
||||||
|
- '.github/workflows/release.yml'
|
||||||
|
- 'frontend/**'
|
||||||
|
- '**.sh'
|
||||||
|
- '**.go'
|
||||||
|
- 'go.mod'
|
||||||
|
- 'go.sum'
|
||||||
|
- 's-ui.service'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build-linux:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
platform:
|
platform:
|
||||||
@@ -18,42 +28,26 @@ jobs:
|
|||||||
- armv5
|
- armv5
|
||||||
- 386
|
- 386
|
||||||
- s390x
|
- s390x
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4.2.2
|
uses: actions/checkout@v5.0.0
|
||||||
with:
|
with:
|
||||||
submodules: recursive
|
submodules: recursive
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Setup Go
|
- name: Setup Go
|
||||||
uses: actions/setup-go@v5
|
uses: actions/setup-go@v6
|
||||||
with:
|
with:
|
||||||
cache: false
|
cache: false
|
||||||
go-version-file: go.mod
|
go-version-file: go.mod
|
||||||
|
|
||||||
- name: Setup Node.js
|
- name: Setup Node.js
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v5
|
||||||
with:
|
with:
|
||||||
node-version: '22'
|
node-version: '22'
|
||||||
registry-url: 'https://registry.npmjs.org'
|
registry-url: 'https://registry.npmjs.org'
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
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 }}" == "armv5" ]; then
|
|
||||||
sudo apt install gcc-arm-linux-gnueabi
|
|
||||||
elif [ "${{ matrix.platform }}" == "386" ]; then
|
|
||||||
sudo apt install gcc-i686-linux-gnu
|
|
||||||
elif [ "${{ matrix.platform }}" == "s390x" ]; then
|
|
||||||
sudo apt install gcc-s390x-linux-gnu
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Build frontend
|
- name: Build frontend
|
||||||
run: |
|
run: |
|
||||||
cd frontend
|
cd frontend
|
||||||
@@ -68,31 +62,34 @@ jobs:
|
|||||||
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 }}" == "armv5" ]; then
|
TARBALL_BASE="https://toolchains.bootlin.com/downloads/releases/toolchains/$BOOTLIN_ARCH/tarballs/"
|
||||||
export GOARCH=arm
|
TARBALL_URL=$(curl -fsSL "$TARBALL_BASE" | grep -oE "${BOOTLIN_ARCH}--musl--stable-[^\"]+\\.tar\\.xz" | sort -r | head -n1)
|
||||||
export GOARM=5
|
[ -z "$TARBALL_URL" ] && { echo "Failed to locate Bootlin musl toolchain for arch=$BOOTLIN_ARCH" >&2; exit 1; }
|
||||||
export CC=arm-linux-gnueabi-gcc
|
echo "Downloading: $TARBALL_URL"
|
||||||
elif [ "${{ matrix.platform }}" == "386" ]; then
|
cd /tmp
|
||||||
export GOARCH=386
|
curl -fL -sS -o "$(basename "$TARBALL_URL")" "$TARBALL_BASE/$TARBALL_URL"
|
||||||
export CC=i686-linux-gnu-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; }
|
||||||
|
cd -
|
||||||
|
|
||||||
### Build s-ui
|
### Build s-ui
|
||||||
go build -ldflags="-w -s" -tags "with_quic,with_grpc,with_utls,with_acme,with_gvisor" -o sui main.go
|
go build -ldflags="-w -s -linkmode external -extldflags '-static'" -tags "with_quic,with_grpc,with_utls,with_acme,with_gvisor" -o sui main.go
|
||||||
|
file sui
|
||||||
|
ldd sui || echo "Static binary confirmed"
|
||||||
|
|
||||||
mkdir s-ui
|
mkdir s-ui
|
||||||
cp sui s-ui/
|
cp sui s-ui/
|
||||||
@@ -102,8 +99,16 @@ jobs:
|
|||||||
- name: Package
|
- name: Package
|
||||||
run: tar -zcvf s-ui-linux-${{ matrix.platform }}.tar.gz s-ui
|
run: tar -zcvf s-ui-linux-${{ matrix.platform }}.tar.gz s-ui
|
||||||
|
|
||||||
- name: Upload
|
- name: Upload files to Artifacts
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: s-ui-linux-${{ matrix.platform }}
|
||||||
|
path: ./s-ui-linux-${{ matrix.platform }}.tar.gz
|
||||||
|
retention-days: 30
|
||||||
|
|
||||||
|
- name: Upload to Release
|
||||||
uses: svenstaro/upload-release-action@v2
|
uses: svenstaro/upload-release-action@v2
|
||||||
|
if: github.event_name == 'release' && github.event.action == 'published'
|
||||||
with:
|
with:
|
||||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
tag: ${{ github.ref }}
|
tag: ${{ github.ref }}
|
||||||
|
|||||||
@@ -0,0 +1,171 @@
|
|||||||
|
name: Build S-UI for Windows
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
release:
|
||||||
|
types: [published]
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
paths:
|
||||||
|
- '.github/workflows/windows.yml'
|
||||||
|
- 'frontend/**'
|
||||||
|
- '**.go'
|
||||||
|
- 'go.mod'
|
||||||
|
- 'go.sum'
|
||||||
|
- 'windows/**'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-windows:
|
||||||
|
runs-on: windows-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v5.0.0
|
||||||
|
with:
|
||||||
|
submodules: recursive
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Setup Go
|
||||||
|
uses: actions/setup-go@v6
|
||||||
|
with:
|
||||||
|
cache: false
|
||||||
|
go-version-file: go.mod
|
||||||
|
|
||||||
|
- name: Setup Node.js
|
||||||
|
uses: actions/setup-node@v5
|
||||||
|
with:
|
||||||
|
node-version: '22'
|
||||||
|
registry-url: 'https://registry.npmjs.org'
|
||||||
|
|
||||||
|
- name: Install zip for Windows
|
||||||
|
shell: powershell
|
||||||
|
run: |
|
||||||
|
# Install Chocolatey if not available
|
||||||
|
if (!(Get-Command choco -ErrorAction SilentlyContinue)) {
|
||||||
|
Set-ExecutionPolicy Bypass -Scope Process -Force
|
||||||
|
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072
|
||||||
|
iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
|
||||||
|
}
|
||||||
|
# Install zip
|
||||||
|
choco install zip -y
|
||||||
|
|
||||||
|
- name: Build frontend
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
cd frontend
|
||||||
|
npm install
|
||||||
|
npm run build
|
||||||
|
cd ..
|
||||||
|
mv frontend/dist web/html
|
||||||
|
rm -fr frontend
|
||||||
|
|
||||||
|
- name: Build s-ui
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
export CGO_ENABLED=1
|
||||||
|
export GOOS=windows
|
||||||
|
export GOARCH=amd64
|
||||||
|
|
||||||
|
echo "Building for Windows amd64"
|
||||||
|
go version
|
||||||
|
|
||||||
|
### Build s-ui
|
||||||
|
go build -ldflags="-w -s" -tags "with_quic,with_grpc,with_utls,with_acme,with_gvisor" -o sui.exe main.go
|
||||||
|
file sui.exe
|
||||||
|
|
||||||
|
mkdir s-ui-windows
|
||||||
|
cp sui.exe s-ui-windows/
|
||||||
|
cp -r windows/* s-ui-windows/
|
||||||
|
|
||||||
|
- name: Package
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
zip -r "s-ui-windows-amd64.zip" s-ui-windows
|
||||||
|
|
||||||
|
- name: Upload files to Artifacts
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: s-ui-windows-amd64
|
||||||
|
path: ./s-ui-windows-amd64.zip
|
||||||
|
retention-days: 30
|
||||||
|
|
||||||
|
- name: Upload to Release
|
||||||
|
uses: svenstaro/upload-release-action@v2
|
||||||
|
if: github.event_name == 'release' && github.event.action == 'published'
|
||||||
|
with:
|
||||||
|
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
tag: ${{ github.ref }}
|
||||||
|
file: s-ui-windows-amd64.zip
|
||||||
|
asset_name: s-ui-windows-amd64.zip
|
||||||
|
prerelease: true
|
||||||
|
overwrite: true
|
||||||
|
|
||||||
|
build-windows-arm64:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v5.0.0
|
||||||
|
with:
|
||||||
|
submodules: recursive
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Setup Go
|
||||||
|
uses: actions/setup-go@v6
|
||||||
|
with:
|
||||||
|
cache: false
|
||||||
|
go-version-file: go.mod
|
||||||
|
|
||||||
|
- name: Setup Node.js
|
||||||
|
uses: actions/setup-node@v5
|
||||||
|
with:
|
||||||
|
node-version: '22'
|
||||||
|
registry-url: 'https://registry.npmjs.org'
|
||||||
|
|
||||||
|
- name: Build frontend
|
||||||
|
run: |
|
||||||
|
cd frontend
|
||||||
|
npm install
|
||||||
|
npm run build
|
||||||
|
cd ..
|
||||||
|
mv frontend/dist web/html
|
||||||
|
rm -fr frontend
|
||||||
|
|
||||||
|
- name: Build s-ui for ARM64
|
||||||
|
run: |
|
||||||
|
export CGO_ENABLED=0
|
||||||
|
export GOOS=windows
|
||||||
|
export GOARCH=arm64
|
||||||
|
|
||||||
|
echo "Building for Windows ARM64 (32-bit)"
|
||||||
|
go version
|
||||||
|
go env GOOS GOARCH
|
||||||
|
|
||||||
|
### Build s-ui without CGO for ARM64
|
||||||
|
go build -ldflags="-w -s" -tags "with_quic,with_grpc,with_utls,with_acme,with_gvisor" -o sui.exe main.go
|
||||||
|
file sui.exe
|
||||||
|
|
||||||
|
mkdir s-ui-windows
|
||||||
|
cp sui.exe s-ui-windows/
|
||||||
|
cp -r windows/* s-ui-windows/
|
||||||
|
|
||||||
|
- name: Package ARM64
|
||||||
|
run: |
|
||||||
|
zip -r "s-ui-windows-arm64.zip" s-ui-windows
|
||||||
|
|
||||||
|
- name: Upload ARM64 files to Artifacts
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: s-ui-windows-arm64
|
||||||
|
path: ./s-ui-windows-arm64.zip
|
||||||
|
retention-days: 30
|
||||||
|
|
||||||
|
- name: Upload ARM64 to Release
|
||||||
|
uses: svenstaro/upload-release-action@v2
|
||||||
|
if: github.event_name == 'release' && github.event.action == 'published'
|
||||||
|
with:
|
||||||
|
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
tag: ${{ github.ref }}
|
||||||
|
file: s-ui-windows-arm64.zip
|
||||||
|
asset_name: s-ui-windows-arm64.zip
|
||||||
|
prerelease: true
|
||||||
|
overwrite: true
|
||||||
@@ -20,6 +20,14 @@ frontend/
|
|||||||
*.log*
|
*.log*
|
||||||
.cache
|
.cache
|
||||||
|
|
||||||
|
# Windows build artifacts
|
||||||
|
*.exe
|
||||||
|
*.zip
|
||||||
|
s-ui-windows/
|
||||||
|
sui-*.exe
|
||||||
|
sui-*.zip
|
||||||
|
windows/sui-*.exe
|
||||||
|
|
||||||
# Editor directories and files
|
# Editor directories and files
|
||||||
.idea
|
.idea
|
||||||
.vscode
|
.vscode
|
||||||
|
|||||||
+1
-1
@@ -3,7 +3,7 @@ WORKDIR /app
|
|||||||
COPY frontend/ ./
|
COPY frontend/ ./
|
||||||
RUN npm install && npm run build
|
RUN npm install && npm run build
|
||||||
|
|
||||||
FROM golang:1.24-alpine AS backend-builder
|
FROM golang:1.25-alpine AS backend-builder
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
ARG TARGETARCH
|
ARG TARGETARCH
|
||||||
ENV CGO_ENABLED=1
|
ENV CGO_ENABLED=1
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
FROM golang:1.24-alpine AS backend-builder
|
FROM golang:1.25-alpine AS backend-builder
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
ARG TARGETARCH
|
ARG TARGETARCH
|
||||||
ENV CGO_ENABLED=1
|
ENV CGO_ENABLED=1
|
||||||
|
|||||||
@@ -27,6 +27,13 @@
|
|||||||
| Dark/Light Theme | :heavy_check_mark: |
|
| Dark/Light Theme | :heavy_check_mark: |
|
||||||
| API Interface | :heavy_check_mark: |
|
| API Interface | :heavy_check_mark: |
|
||||||
|
|
||||||
|
## Supported Platforms
|
||||||
|
| Platform | Architecture | Status |
|
||||||
|
|----------|--------------|---------|
|
||||||
|
| Linux | amd64, arm64, armv7, armv6, armv5, 386, s390x | ✅ Supported |
|
||||||
|
| Windows | amd64, 386, arm64 | ✅ Supported |
|
||||||
|
| macOS | amd64, arm64 | 🚧 Experimental |
|
||||||
|
|
||||||
## Screenshots
|
## Screenshots
|
||||||
|
|
||||||

|

|
||||||
@@ -46,10 +53,17 @@
|
|||||||
|
|
||||||
## Install & Upgrade to Latest Version
|
## Install & Upgrade to Latest Version
|
||||||
|
|
||||||
|
### Linux/macOS
|
||||||
```sh
|
```sh
|
||||||
bash <(curl -Ls https://raw.githubusercontent.com/alireza0/s-ui/master/install.sh)
|
bash <(curl -Ls https://raw.githubusercontent.com/alireza0/s-ui/master/install.sh)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Windows
|
||||||
|
1. Download the latest Windows release from [GitHub Releases](https://github.com/alireza0/s-ui/releases/latest)
|
||||||
|
2. Extract the ZIP file
|
||||||
|
3. Run `install-windows.bat` as Administrator
|
||||||
|
4. Follow the installation wizard
|
||||||
|
|
||||||
## Install legacy Version
|
## Install legacy Version
|
||||||
|
|
||||||
**Step 1:** To install your desired legacy version, add the version to the end of the installation command. e.g., ver `1.0.0`:
|
**Step 1:** To install your desired legacy version, add the version to the end of the installation command. e.g., ver `1.0.0`:
|
||||||
@@ -60,6 +74,7 @@ VERSION=1.0.0 && bash <(curl -Ls https://raw.githubusercontent.com/alireza0/s-ui
|
|||||||
|
|
||||||
## Manual installation
|
## Manual installation
|
||||||
|
|
||||||
|
### Linux/macOS
|
||||||
1. Get the latest version of S-UI based on your OS/Architecture from GitHub: [https://github.com/alireza0/s-ui/releases/latest](https://github.com/alireza0/s-ui/releases/latest)
|
1. Get the latest version of S-UI based on your OS/Architecture from GitHub: [https://github.com/alireza0/s-ui/releases/latest](https://github.com/alireza0/s-ui/releases/latest)
|
||||||
2. **OPTIONAL** Get the latest version of `s-ui.sh` [https://raw.githubusercontent.com/alireza0/s-ui/master/s-ui.sh](https://raw.githubusercontent.com/alireza0/s-ui/master/s-ui.sh)
|
2. **OPTIONAL** Get the latest version of `s-ui.sh` [https://raw.githubusercontent.com/alireza0/s-ui/master/s-ui.sh](https://raw.githubusercontent.com/alireza0/s-ui/master/s-ui.sh)
|
||||||
3. **OPTIONAL** Copy `s-ui.sh` to /usr/bin/ and run `chmod +x /usr/bin/s-ui`.
|
3. **OPTIONAL** Copy `s-ui.sh` to /usr/bin/ and run `chmod +x /usr/bin/s-ui`.
|
||||||
@@ -68,6 +83,14 @@ VERSION=1.0.0 && bash <(curl -Ls https://raw.githubusercontent.com/alireza0/s-ui
|
|||||||
6. Enable autostart and start S-UI service using `systemctl enable s-ui --now`
|
6. Enable autostart and start S-UI service using `systemctl enable s-ui --now`
|
||||||
7. Start sing-box service using `systemctl enable sing-box --now`
|
7. Start sing-box service using `systemctl enable sing-box --now`
|
||||||
|
|
||||||
|
### Windows
|
||||||
|
1. Get the latest Windows version from GitHub: [https://github.com/alireza0/s-ui/releases/latest](https://github.com/alireza0/s-ui/releases/latest)
|
||||||
|
2. Download the appropriate Windows package (e.g., `s-ui-windows-amd64.zip`)
|
||||||
|
3. Extract the ZIP file to a directory of your choice
|
||||||
|
4. Run `install-windows.bat` as Administrator
|
||||||
|
5. Follow the installation wizard
|
||||||
|
6. Access the panel at http://localhost:2095/app
|
||||||
|
|
||||||
## Uninstall S-UI
|
## Uninstall S-UI
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
@@ -111,7 +134,7 @@ docker compose up -d
|
|||||||
mkdir s-ui && cd s-ui
|
mkdir s-ui && cd s-ui
|
||||||
docker run -itd \
|
docker run -itd \
|
||||||
-p 2095:2095 -p 2096:2096 -p 443:443 -p 80:80 \
|
-p 2095:2095 -p 2096:2096 -p 443:443 -p 80:80 \
|
||||||
-v $PWD/db/:/usr/local/s-ui/db/ \
|
-v $PWD/db/:/app/db/ \
|
||||||
-v $PWD/cert/:/root/cert/ \
|
-v $PWD/cert/:/root/cert/ \
|
||||||
--name s-ui --restart=unless-stopped \
|
--name s-ui --restart=unless-stopped \
|
||||||
alireza7/s-ui:latest
|
alireza7/s-ui:latest
|
||||||
@@ -194,21 +217,6 @@ To run backend (from root folder of repository):
|
|||||||
- HTTPS for secure access to the web panel and subscription service (self-provided domain + SSL certificate)
|
- HTTPS for secure access to the web panel and subscription service (self-provided domain + SSL certificate)
|
||||||
- Dark/Light theme
|
- Dark/Light theme
|
||||||
|
|
||||||
## Recommended OS
|
|
||||||
|
|
||||||
- Ubuntu 20.04+
|
|
||||||
- Debian 11+
|
|
||||||
- CentOS 8+
|
|
||||||
- Fedora 36+
|
|
||||||
- Arch Linux
|
|
||||||
- Parch Linux
|
|
||||||
- Manjaro
|
|
||||||
- Armbian
|
|
||||||
- AlmaLinux 9+
|
|
||||||
- Rocky Linux 9+
|
|
||||||
- Oracle Linux 8+
|
|
||||||
- OpenSUSE Tubleweed
|
|
||||||
|
|
||||||
## Environment Variables
|
## Environment Variables
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
|
|||||||
+1
-1
@@ -68,7 +68,7 @@ func (a *APIHandler) getHandler(c *gin.Context) {
|
|||||||
a.ApiService.Logout(c)
|
a.ApiService.Logout(c)
|
||||||
case "load":
|
case "load":
|
||||||
a.ApiService.LoadData(c)
|
a.ApiService.LoadData(c)
|
||||||
case "inbounds", "outbounds", "endpoints", "tls", "clients", "config":
|
case "inbounds", "outbounds", "endpoints", "services", "tls", "clients", "config":
|
||||||
err := a.ApiService.LoadPartialData(c, []string{action})
|
err := a.ApiService.LoadPartialData(c, []string{action})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
jsonMsg(c, action, err)
|
jsonMsg(c, action, err)
|
||||||
|
|||||||
+6
-2
@@ -7,7 +7,6 @@ import (
|
|||||||
"s-ui/service"
|
"s-ui/service"
|
||||||
"s-ui/util"
|
"s-ui/util"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
@@ -86,7 +85,11 @@ func (a *ApiService) getData(c *gin.Context) (interface{}, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
subURI, err := a.SettingService.GetFinalSubURI(strings.Split(c.Request.Host, ":")[0])
|
subURI, err := a.SettingService.GetFinalSubURI(getHostname(c))
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
trafficAge, err := a.SettingService.GetTrafficAge()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
@@ -98,6 +101,7 @@ func (a *ApiService) getData(c *gin.Context) (interface{}, error) {
|
|||||||
data["endpoints"] = endpoints
|
data["endpoints"] = endpoints
|
||||||
data["services"] = services
|
data["services"] = services
|
||||||
data["subURI"] = subURI
|
data["subURI"] = subURI
|
||||||
|
data["enableTraffic"] = trafficAge > 0
|
||||||
data["onlines"] = onlines
|
data["onlines"] = onlines
|
||||||
} else {
|
} else {
|
||||||
data["onlines"] = onlines
|
data["onlines"] = onlines
|
||||||
|
|||||||
+1
-1
@@ -61,7 +61,7 @@ func (a *APIv2Handler) getHandler(c *gin.Context) {
|
|||||||
switch action {
|
switch action {
|
||||||
case "load":
|
case "load":
|
||||||
a.ApiService.LoadData(c)
|
a.ApiService.LoadData(c)
|
||||||
case "inbounds", "outbounds", "endpoints", "tls", "clients", "config":
|
case "inbounds", "outbounds", "endpoints", "services", "tls", "clients", "config":
|
||||||
err := a.ApiService.LoadPartialData(c, []string{action})
|
err := a.ApiService.LoadPartialData(c, []string{action})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
jsonMsg(c, action, err)
|
jsonMsg(c, action, err)
|
||||||
|
|||||||
+4
-1
@@ -29,8 +29,11 @@ func getRemoteIp(c *gin.Context) string {
|
|||||||
|
|
||||||
func getHostname(c *gin.Context) string {
|
func getHostname(c *gin.Context) string {
|
||||||
host := c.Request.Host
|
host := c.Request.Host
|
||||||
if colonIndex := strings.LastIndex(host, ":"); colonIndex != -1 {
|
if strings.Contains(host, ":") {
|
||||||
host, _, _ = net.SplitHostPort(c.Request.Host)
|
host, _, _ = net.SplitHostPort(c.Request.Host)
|
||||||
|
if strings.Contains(host, ":") {
|
||||||
|
host = "[" + host + "]"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return host
|
return host
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-1
@@ -5,6 +5,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -51,9 +52,13 @@ func GetDBFolderPath() string {
|
|||||||
if dbFolderPath == "" {
|
if dbFolderPath == "" {
|
||||||
dir, err := filepath.Abs(filepath.Dir(os.Args[0]))
|
dir, err := filepath.Abs(filepath.Dir(os.Args[0]))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
// Cross-platform fallback path
|
||||||
|
if runtime.GOOS == "windows" {
|
||||||
|
return "C:\\Program Files\\s-ui\\db"
|
||||||
|
}
|
||||||
return "/usr/local/s-ui/db"
|
return "/usr/local/s-ui/db"
|
||||||
}
|
}
|
||||||
dbFolderPath = dir + "/db"
|
dbFolderPath = filepath.Join(dir, "db")
|
||||||
}
|
}
|
||||||
return dbFolderPath
|
return dbFolderPath
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -1 +1 @@
|
|||||||
1.3.0-rc.0
|
1.3.6
|
||||||
+14
-4
@@ -49,6 +49,7 @@ type Box struct {
|
|||||||
connection *route.ConnectionManager
|
connection *route.ConnectionManager
|
||||||
router *route.Router
|
router *route.Router
|
||||||
internalService []adapter.LifecycleService
|
internalService []adapter.LifecycleService
|
||||||
|
statsTracker *StatsTracker
|
||||||
connTracker *ConnTracker
|
connTracker *ConnTracker
|
||||||
done chan struct{}
|
done chan struct{}
|
||||||
}
|
}
|
||||||
@@ -302,15 +303,15 @@ func NewBox(options Options) (*Box, error) {
|
|||||||
return nil, common.NewError("initialize service["+F.ToString(i)+"]"+tag, err)
|
return nil, common.NewError("initialize service["+F.ToString(i)+"]"+tag, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
outboundManager.Initialize(sbCommon.Must1(
|
outboundManager.Initialize(func() (adapter.Outbound, error) {
|
||||||
direct.NewOutbound(
|
return direct.NewOutbound(
|
||||||
ctx,
|
ctx,
|
||||||
router,
|
router,
|
||||||
logFactory.NewLogger("outbound/direct"),
|
logFactory.NewLogger("outbound/direct"),
|
||||||
"direct",
|
"direct",
|
||||||
option.DirectOutboundOptions{},
|
option.DirectOutboundOptions{},
|
||||||
),
|
)
|
||||||
))
|
})
|
||||||
dnsTransportManager.Initialize(sbCommon.Must1(
|
dnsTransportManager.Initialize(sbCommon.Must1(
|
||||||
local.NewTransport(
|
local.NewTransport(
|
||||||
ctx,
|
ctx,
|
||||||
@@ -324,6 +325,10 @@ func NewBox(options Options) (*Box, error) {
|
|||||||
return nil, common.NewError("initialize platform interface", err)
|
return nil, common.NewError("initialize platform interface", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if statsTracker == nil {
|
||||||
|
statsTracker = NewStatsTracker()
|
||||||
|
}
|
||||||
|
router.AppendTracker(statsTracker)
|
||||||
if connTracker == nil {
|
if connTracker == nil {
|
||||||
connTracker = NewConnTracker()
|
connTracker = NewConnTracker()
|
||||||
}
|
}
|
||||||
@@ -387,6 +392,7 @@ func NewBox(options Options) (*Box, error) {
|
|||||||
logFactory: logFactory,
|
logFactory: logFactory,
|
||||||
logger: logFactory.Logger(),
|
logger: logFactory.Logger(),
|
||||||
internalService: internalServices,
|
internalService: internalServices,
|
||||||
|
statsTracker: statsTracker,
|
||||||
connTracker: connTracker,
|
connTracker: connTracker,
|
||||||
done: make(chan struct{}),
|
done: make(chan struct{}),
|
||||||
}, nil
|
}, nil
|
||||||
@@ -530,6 +536,10 @@ func (s *Box) Endpoint() adapter.EndpointManager {
|
|||||||
return s.endpoint
|
return s.endpoint
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *Box) StatsTracker() *StatsTracker {
|
||||||
|
return s.statsTracker
|
||||||
|
}
|
||||||
|
|
||||||
func (s *Box) ConnTracker() *ConnTracker {
|
func (s *Box) ConnTracker() *ConnTracker {
|
||||||
return s.connTracker
|
return s.connTracker
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ var (
|
|||||||
service_manager adapter.ServiceManager
|
service_manager adapter.ServiceManager
|
||||||
endpoint_manager adapter.EndpointManager
|
endpoint_manager adapter.EndpointManager
|
||||||
router adapter.Router
|
router adapter.Router
|
||||||
|
statsTracker *StatsTracker
|
||||||
connTracker *ConnTracker
|
connTracker *ConnTracker
|
||||||
factory log.Factory
|
factory log.Factory
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -0,0 +1,136 @@
|
|||||||
|
package core
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"net"
|
||||||
|
"sync"
|
||||||
|
|
||||||
|
"github.com/gofrs/uuid/v5"
|
||||||
|
"github.com/sagernet/sing-box/adapter"
|
||||||
|
"github.com/sagernet/sing/common/network"
|
||||||
|
)
|
||||||
|
|
||||||
|
type ConnectionInfo struct {
|
||||||
|
ID string
|
||||||
|
Conn net.Conn
|
||||||
|
PacketConn network.PacketConn
|
||||||
|
Inbound string
|
||||||
|
Type string // "tcp" or "udp"
|
||||||
|
}
|
||||||
|
|
||||||
|
type ConnTracker struct {
|
||||||
|
access sync.Mutex
|
||||||
|
connections map[string]*ConnectionInfo
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewConnTracker() *ConnTracker {
|
||||||
|
return &ConnTracker{
|
||||||
|
connections: make(map[string]*ConnectionInfo),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *ConnTracker) generateConnectionID() string {
|
||||||
|
return uuid.Must(uuid.NewV4()).String()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *ConnTracker) RoutedConnection(ctx context.Context, conn net.Conn, metadata adapter.InboundContext, matchedRule adapter.Rule, matchOutbound adapter.Outbound) net.Conn {
|
||||||
|
connID := c.generateConnectionID()
|
||||||
|
connInfo := &ConnectionInfo{
|
||||||
|
ID: connID,
|
||||||
|
Conn: conn,
|
||||||
|
Inbound: metadata.Inbound,
|
||||||
|
Type: "tcp",
|
||||||
|
}
|
||||||
|
|
||||||
|
c.trackConnection(connID, connInfo)
|
||||||
|
|
||||||
|
return c.createWrappedConn(conn, connID)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *ConnTracker) RoutedPacketConnection(ctx context.Context, conn network.PacketConn, metadata adapter.InboundContext, matchedRule adapter.Rule, matchOutbound adapter.Outbound) network.PacketConn {
|
||||||
|
connID := c.generateConnectionID()
|
||||||
|
connInfo := &ConnectionInfo{
|
||||||
|
ID: connID,
|
||||||
|
PacketConn: conn,
|
||||||
|
Inbound: metadata.Inbound,
|
||||||
|
Type: "udp",
|
||||||
|
}
|
||||||
|
|
||||||
|
c.trackConnection(connID, connInfo)
|
||||||
|
|
||||||
|
return c.createWrappedPacketConn(conn, connID)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *ConnTracker) CloseConnByInbound(inbound string) int {
|
||||||
|
c.access.Lock()
|
||||||
|
defer c.access.Unlock()
|
||||||
|
|
||||||
|
closedCount := 0
|
||||||
|
for connID, connInfo := range c.connections {
|
||||||
|
if connInfo.Inbound == inbound {
|
||||||
|
if connInfo.Conn != nil {
|
||||||
|
connInfo.Conn.Close()
|
||||||
|
}
|
||||||
|
if connInfo.PacketConn != nil {
|
||||||
|
connInfo.PacketConn.Close()
|
||||||
|
}
|
||||||
|
delete(c.connections, connID)
|
||||||
|
closedCount++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return closedCount
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *ConnTracker) trackConnection(connID string, connInfo *ConnectionInfo) {
|
||||||
|
c.access.Lock()
|
||||||
|
defer c.access.Unlock()
|
||||||
|
c.connections[connID] = connInfo
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *ConnTracker) untrackConnection(connID string) {
|
||||||
|
c.access.Lock()
|
||||||
|
defer c.access.Unlock()
|
||||||
|
delete(c.connections, connID)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *ConnTracker) createWrappedConn(conn net.Conn, connID string) *wrappedConn {
|
||||||
|
return &wrappedConn{
|
||||||
|
Conn: conn,
|
||||||
|
connID: connID,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *ConnTracker) createWrappedPacketConn(conn network.PacketConn, connID string) *wrappedPacketConn {
|
||||||
|
return &wrappedPacketConn{
|
||||||
|
PacketConn: conn,
|
||||||
|
connID: connID,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
type wrappedConn struct {
|
||||||
|
net.Conn
|
||||||
|
connID string
|
||||||
|
}
|
||||||
|
|
||||||
|
func (w *wrappedConn) Close() error {
|
||||||
|
connTracker.untrackConnection(w.connID)
|
||||||
|
return w.Conn.Close()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (w *wrappedConn) Upstream() any {
|
||||||
|
return w.Conn
|
||||||
|
}
|
||||||
|
|
||||||
|
type wrappedPacketConn struct {
|
||||||
|
network.PacketConn
|
||||||
|
connID string
|
||||||
|
}
|
||||||
|
|
||||||
|
func (w *wrappedPacketConn) Close() error {
|
||||||
|
connTracker.untrackConnection(w.connID)
|
||||||
|
return w.PacketConn.Close()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (w *wrappedPacketConn) Upstream() any {
|
||||||
|
return w.PacketConn
|
||||||
|
}
|
||||||
@@ -18,27 +18,27 @@ type Counter struct {
|
|||||||
write *atomic.Int64
|
write *atomic.Int64
|
||||||
}
|
}
|
||||||
|
|
||||||
type ConnTracker struct {
|
type StatsTracker struct {
|
||||||
access sync.Mutex
|
access sync.Mutex
|
||||||
createdAt time.Time
|
|
||||||
inbounds map[string]Counter
|
inbounds map[string]Counter
|
||||||
outbounds map[string]Counter
|
outbounds map[string]Counter
|
||||||
users map[string]Counter
|
users map[string]Counter
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewConnTracker() *ConnTracker {
|
func NewStatsTracker() *StatsTracker {
|
||||||
return &ConnTracker{
|
return &StatsTracker{
|
||||||
createdAt: time.Now(),
|
|
||||||
inbounds: make(map[string]Counter),
|
inbounds: make(map[string]Counter),
|
||||||
outbounds: make(map[string]Counter),
|
outbounds: make(map[string]Counter),
|
||||||
users: make(map[string]Counter),
|
users: make(map[string]Counter),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *ConnTracker) getReadCounters(inbound string, outbound string, user string) ([]*atomic.Int64, []*atomic.Int64) {
|
func (c *StatsTracker) getReadCounters(inbound string, outbound string, user string) ([]*atomic.Int64, []*atomic.Int64) {
|
||||||
var readCounter []*atomic.Int64
|
var readCounter []*atomic.Int64
|
||||||
var writeCounter []*atomic.Int64
|
var writeCounter []*atomic.Int64
|
||||||
c.access.Lock()
|
c.access.Lock()
|
||||||
|
defer c.access.Unlock()
|
||||||
|
|
||||||
if inbound != "" {
|
if inbound != "" {
|
||||||
readCounter = append(readCounter, c.loadOrCreateCounter(&c.inbounds, inbound).read)
|
readCounter = append(readCounter, c.loadOrCreateCounter(&c.inbounds, inbound).read)
|
||||||
writeCounter = append(writeCounter, c.inbounds[inbound].write)
|
writeCounter = append(writeCounter, c.inbounds[inbound].write)
|
||||||
@@ -51,11 +51,10 @@ func (c *ConnTracker) getReadCounters(inbound string, outbound string, user stri
|
|||||||
readCounter = append(readCounter, c.loadOrCreateCounter(&c.users, user).read)
|
readCounter = append(readCounter, c.loadOrCreateCounter(&c.users, user).read)
|
||||||
writeCounter = append(writeCounter, c.users[user].write)
|
writeCounter = append(writeCounter, c.users[user].write)
|
||||||
}
|
}
|
||||||
c.access.Unlock()
|
|
||||||
return readCounter, writeCounter
|
return readCounter, writeCounter
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *ConnTracker) loadOrCreateCounter(obj *map[string]Counter, name string) Counter {
|
func (c *StatsTracker) loadOrCreateCounter(obj *map[string]Counter, name string) Counter {
|
||||||
counter, loaded := (*obj)[name]
|
counter, loaded := (*obj)[name]
|
||||||
if loaded {
|
if loaded {
|
||||||
return counter
|
return counter
|
||||||
@@ -65,17 +64,17 @@ func (c *ConnTracker) loadOrCreateCounter(obj *map[string]Counter, name string)
|
|||||||
return counter
|
return counter
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *ConnTracker) RoutedConnection(ctx context.Context, conn net.Conn, metadata adapter.InboundContext, matchedRule adapter.Rule, matchOutbound adapter.Outbound) net.Conn {
|
func (c *StatsTracker) RoutedConnection(ctx context.Context, conn net.Conn, metadata adapter.InboundContext, matchedRule adapter.Rule, matchOutbound adapter.Outbound) net.Conn {
|
||||||
readCounter, writeCounter := c.getReadCounters(metadata.Inbound, matchOutbound.Tag(), metadata.User)
|
readCounter, writeCounter := c.getReadCounters(metadata.Inbound, matchOutbound.Tag(), metadata.User)
|
||||||
return bufio.NewInt64CounterConn(conn, readCounter, writeCounter)
|
return bufio.NewInt64CounterConn(conn, readCounter, writeCounter)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *ConnTracker) RoutedPacketConnection(ctx context.Context, conn network.PacketConn, metadata adapter.InboundContext, matchedRule adapter.Rule, matchOutbound adapter.Outbound) network.PacketConn {
|
func (c *StatsTracker) RoutedPacketConnection(ctx context.Context, conn network.PacketConn, metadata adapter.InboundContext, matchedRule adapter.Rule, matchOutbound adapter.Outbound) network.PacketConn {
|
||||||
readCounter, writeCounter := c.getReadCounters(metadata.Inbound, matchOutbound.Tag(), metadata.User)
|
readCounter, writeCounter := c.getReadCounters(metadata.Inbound, matchOutbound.Tag(), metadata.User)
|
||||||
return bufio.NewInt64CounterPacketConn(conn, readCounter, writeCounter)
|
return bufio.NewInt64CounterPacketConn(conn, readCounter, nil, writeCounter, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *ConnTracker) GetStats() *[]model.Stats {
|
func (c *StatsTracker) GetStats() *[]model.Stats {
|
||||||
c.access.Lock()
|
c.access.Lock()
|
||||||
defer c.access.Unlock()
|
defer c.access.Unlock()
|
||||||
|
|
||||||
+3
-1
@@ -20,11 +20,13 @@ func (c *CronJob) Start(loc *time.Location, trafficAge int) error {
|
|||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
// Start stats job
|
// Start stats job
|
||||||
c.cron.AddJob("@every 10s", NewStatsJob())
|
c.cron.AddJob("@every 10s", NewStatsJob(trafficAge > 0))
|
||||||
// Start expiry job
|
// Start expiry job
|
||||||
c.cron.AddJob("@every 1m", NewDepleteJob())
|
c.cron.AddJob("@every 1m", NewDepleteJob())
|
||||||
// Start deleting old stats
|
// Start deleting old stats
|
||||||
|
if trafficAge > 0 {
|
||||||
c.cron.AddJob("@daily", NewDelStatsJob(trafficAge))
|
c.cron.AddJob("@daily", NewDelStatsJob(trafficAge))
|
||||||
|
}
|
||||||
// Start core if it is not running
|
// Start core if it is not running
|
||||||
c.cron.AddJob("@every 5s", NewCheckCoreJob())
|
c.cron.AddJob("@every 5s", NewCheckCoreJob())
|
||||||
}()
|
}()
|
||||||
|
|||||||
+6
-3
@@ -7,14 +7,17 @@ import (
|
|||||||
|
|
||||||
type StatsJob struct {
|
type StatsJob struct {
|
||||||
service.StatsService
|
service.StatsService
|
||||||
|
enableTraffic bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewStatsJob() *StatsJob {
|
func NewStatsJob(saveTraffic bool) *StatsJob {
|
||||||
return &StatsJob{}
|
return &StatsJob{
|
||||||
|
enableTraffic: saveTraffic,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *StatsJob) Run() {
|
func (s *StatsJob) Run() {
|
||||||
err := s.StatsService.SaveStats()
|
err := s.StatsService.SaveStats(s.enableTraffic)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Warning("Get stats failed: ", err)
|
logger.Warning("Get stats failed: ", err)
|
||||||
return
|
return
|
||||||
|
|||||||
+6
-1
@@ -7,6 +7,7 @@ import (
|
|||||||
"mime/multipart"
|
"mime/multipart"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"runtime"
|
||||||
"s-ui/cmd/migration"
|
"s-ui/cmd/migration"
|
||||||
"s-ui/config"
|
"s-ui/config"
|
||||||
"s-ui/database/model"
|
"s-ui/database/model"
|
||||||
@@ -287,7 +288,11 @@ func SendSighup() error {
|
|||||||
// Send SIGHUP to the current process
|
// Send SIGHUP to the current process
|
||||||
go func() {
|
go func() {
|
||||||
time.Sleep(3 * time.Second)
|
time.Sleep(3 * time.Second)
|
||||||
err := process.Signal(syscall.SIGHUP)
|
if runtime.GOOS == "windows" {
|
||||||
|
err = process.Kill()
|
||||||
|
} else {
|
||||||
|
err = process.Signal(syscall.SIGHUP)
|
||||||
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Error("send signal SIGHUP failed:", err)
|
logger.Error("send signal SIGHUP failed:", err)
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
Submodule frontend updated: bd927f63fc...1ba1f776bf
@@ -1,21 +1,22 @@
|
|||||||
module s-ui
|
module s-ui
|
||||||
|
|
||||||
go 1.24.5
|
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.10.1
|
||||||
|
github.com/gofrs/uuid/v5 v5.3.2
|
||||||
github.com/op/go-logging v0.0.0-20160315200505-970db520ece7
|
github.com/op/go-logging v0.0.0-20160315200505-970db520ece7
|
||||||
github.com/robfig/cron/v3 v3.0.1
|
github.com/robfig/cron/v3 v3.0.1
|
||||||
github.com/sagernet/sing v0.7.0-beta.1.0.20250722151551-64142925accb
|
github.com/sagernet/sing v0.7.10
|
||||||
github.com/sagernet/sing-box v1.12.0-rc.3
|
github.com/sagernet/sing-box v1.12.8
|
||||||
github.com/sagernet/sing-dns v0.4.6
|
github.com/sagernet/sing-dns v0.4.6
|
||||||
github.com/shirou/gopsutil/v4 v4.25.6
|
github.com/shirou/gopsutil/v4 v4.25.8
|
||||||
golang.zx2c4.com/wireguard/wgctrl v0.0.0-20241231184526-a9ab2273dd10
|
golang.zx2c4.com/wireguard/wgctrl v0.0.0-20241231184526-a9ab2273dd10
|
||||||
gopkg.in/yaml.v3 v3.0.1
|
gopkg.in/yaml.v3 v3.0.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 (
|
||||||
@@ -53,14 +54,13 @@ require (
|
|||||||
github.com/gobwas/pool v0.2.1 // indirect
|
github.com/gobwas/pool v0.2.1 // indirect
|
||||||
github.com/goccy/go-json v0.10.5 // indirect
|
github.com/goccy/go-json v0.10.5 // indirect
|
||||||
github.com/godbus/dbus/v5 v5.1.1-0.20230522191255-76236955d466 // indirect
|
github.com/godbus/dbus/v5 v5.1.1-0.20230522191255-76236955d466 // indirect
|
||||||
github.com/gofrs/uuid/v5 v5.3.2 // indirect
|
|
||||||
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
|
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
|
||||||
github.com/google/btree v1.1.3 // indirect
|
github.com/google/btree v1.1.3 // indirect
|
||||||
github.com/google/go-cmp v0.7.0 // indirect
|
github.com/google/go-cmp v0.7.0 // indirect
|
||||||
github.com/google/nftables v0.2.1-0.20240414091927-5e242ec57806 // indirect
|
github.com/google/nftables v0.2.1-0.20240414091927-5e242ec57806 // indirect
|
||||||
github.com/google/uuid v1.6.0 // indirect
|
github.com/google/uuid v1.6.0 // indirect
|
||||||
github.com/gorilla/context v1.1.2 // indirect
|
github.com/gorilla/context v1.1.2 // indirect
|
||||||
github.com/gorilla/csrf v1.7.3-0.20250123201450-9dd6af1f6d30 // indirect
|
github.com/gorilla/csrf v1.7.3 // 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
|
||||||
github.com/hashicorp/yamux v0.1.2 // indirect
|
github.com/hashicorp/yamux v0.1.2 // indirect
|
||||||
@@ -81,12 +81,12 @@ require (
|
|||||||
github.com/logrusorgru/aurora v2.0.3+incompatible // indirect
|
github.com/logrusorgru/aurora v2.0.3+incompatible // indirect
|
||||||
github.com/lufia/plan9stats v0.0.0-20250317134145-8bc96cf8fc35 // indirect
|
github.com/lufia/plan9stats v0.0.0-20250317134145-8bc96cf8fc35 // 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.30 // indirect
|
||||||
github.com/mdlayher/genetlink v1.3.2 // indirect
|
github.com/mdlayher/genetlink v1.3.2 // indirect
|
||||||
github.com/mdlayher/netlink v1.7.3-0.20250113171957-fbb4dce95f42 // indirect
|
github.com/mdlayher/netlink v1.7.3-0.20250113171957-fbb4dce95f42 // indirect
|
||||||
github.com/mdlayher/sdnotify v1.0.0 // indirect
|
github.com/mdlayher/sdnotify v1.0.0 // indirect
|
||||||
github.com/mdlayher/socket v0.5.1 // indirect
|
github.com/mdlayher/socket v0.5.1 // indirect
|
||||||
github.com/metacubex/tfo-go v0.0.0-20241231083714-66613d49c422 // indirect
|
github.com/metacubex/tfo-go v0.0.0-20250516165257-e29c16ae41d4 // indirect
|
||||||
github.com/metacubex/utls v1.8.0 // indirect
|
github.com/metacubex/utls v1.8.0 // indirect
|
||||||
github.com/mholt/acmez/v3 v3.1.2 // indirect
|
github.com/mholt/acmez/v3 v3.1.2 // indirect
|
||||||
github.com/miekg/dns v1.1.67 // indirect
|
github.com/miekg/dns v1.1.67 // indirect
|
||||||
@@ -106,15 +106,15 @@ require (
|
|||||||
github.com/sagernet/netlink v0.0.0-20240612041022-b9a21c07ac6a // indirect
|
github.com/sagernet/netlink v0.0.0-20240612041022-b9a21c07ac6a // indirect
|
||||||
github.com/sagernet/nftables v0.3.0-beta.4 // indirect
|
github.com/sagernet/nftables v0.3.0-beta.4 // indirect
|
||||||
github.com/sagernet/quic-go v0.52.0-beta.1 // indirect
|
github.com/sagernet/quic-go v0.52.0-beta.1 // indirect
|
||||||
github.com/sagernet/sing-mux v0.3.2 // indirect
|
github.com/sagernet/sing-mux v0.3.3 // indirect
|
||||||
github.com/sagernet/sing-quic v0.5.0-beta.3 // indirect
|
github.com/sagernet/sing-quic v0.5.2-0.20250909083218-00a55617c0fb // indirect
|
||||||
github.com/sagernet/sing-shadowsocks v0.2.8 // indirect
|
github.com/sagernet/sing-shadowsocks v0.2.8 // indirect
|
||||||
github.com/sagernet/sing-shadowsocks2 v0.2.1 // indirect
|
github.com/sagernet/sing-shadowsocks2 v0.2.1 // indirect
|
||||||
github.com/sagernet/sing-shadowtls v0.2.1-0.20250503051639-fcd445d33c11 // indirect
|
github.com/sagernet/sing-shadowtls v0.2.1-0.20250503051639-fcd445d33c11 // indirect
|
||||||
github.com/sagernet/sing-tun v0.6.10-0.20250721014417-ebbe32588cfb // indirect
|
github.com/sagernet/sing-tun v0.7.2 // indirect
|
||||||
github.com/sagernet/sing-vmess v0.2.4 // indirect
|
github.com/sagernet/sing-vmess v0.2.7 // indirect
|
||||||
github.com/sagernet/smux v1.5.34-mod.2 // indirect
|
github.com/sagernet/smux v1.5.34-mod.2 // indirect
|
||||||
github.com/sagernet/tailscale v1.80.3-mod.5 // indirect
|
github.com/sagernet/tailscale v1.80.3-sing-box-1.12-mod.1 // indirect
|
||||||
github.com/sagernet/wireguard-go v0.0.1-beta.7 // indirect
|
github.com/sagernet/wireguard-go v0.0.1-beta.7 // indirect
|
||||||
github.com/sagernet/ws v0.0.0-20231204124109-acfe8907c854 // indirect
|
github.com/sagernet/ws v0.0.0-20231204124109-acfe8907c854 // indirect
|
||||||
github.com/tailscale/certstore v0.1.1-0.20231202035212-d3fa0460f47e // indirect
|
github.com/tailscale/certstore v0.1.1-0.20231202035212-d3fa0460f47e // indirect
|
||||||
@@ -139,17 +139,17 @@ require (
|
|||||||
go.uber.org/zap/exp v0.3.0 // indirect
|
go.uber.org/zap/exp v0.3.0 // indirect
|
||||||
go4.org/mem v0.0.0-20240501181205-ae6ca9944745 // indirect
|
go4.org/mem v0.0.0-20240501181205-ae6ca9944745 // 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.20.0 // indirect
|
||||||
golang.org/x/crypto v0.40.0 // indirect
|
golang.org/x/crypto v0.41.0 // indirect
|
||||||
golang.org/x/exp v0.0.0-20250506013437-ce4c2cf36ca6 // indirect
|
golang.org/x/exp v0.0.0-20250506013437-ce4c2cf36ca6 // indirect
|
||||||
golang.org/x/mod v0.26.0 // indirect
|
golang.org/x/mod v0.27.0 // indirect
|
||||||
golang.org/x/net v0.42.0 // indirect
|
golang.org/x/net v0.43.0 // indirect
|
||||||
golang.org/x/sync v0.16.0 // indirect
|
golang.org/x/sync v0.16.0 // indirect
|
||||||
golang.org/x/sys v0.34.0 // indirect
|
golang.org/x/sys v0.35.0 // indirect
|
||||||
golang.org/x/term v0.33.0 // indirect
|
golang.org/x/term v0.34.0 // indirect
|
||||||
golang.org/x/text v0.27.0 // indirect
|
golang.org/x/text v0.28.0 // indirect
|
||||||
golang.org/x/time v0.9.0 // indirect
|
golang.org/x/time v0.9.0 // indirect
|
||||||
golang.org/x/tools v0.34.0 // indirect
|
golang.org/x/tools v0.36.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/windows v0.5.3 // indirect
|
golang.zx2c4.com/wireguard/windows v0.5.3 // indirect
|
||||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20250324211829-b45e905df463 // indirect
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20250324211829-b45e905df463 // indirect
|
||||||
|
|||||||
@@ -108,8 +108,8 @@ 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=
|
||||||
github.com/gorilla/context v1.1.2/go.mod h1:KDPwT9i/MeWHiLl90fuTgrt4/wPcv75vFAZLaOOcbxM=
|
github.com/gorilla/context v1.1.2/go.mod h1:KDPwT9i/MeWHiLl90fuTgrt4/wPcv75vFAZLaOOcbxM=
|
||||||
github.com/gorilla/csrf v1.7.3-0.20250123201450-9dd6af1f6d30 h1:fiJdrgVBkjZ5B1HJ2WQwNOaXB+QyYcNXTA3t1XYLz0M=
|
github.com/gorilla/csrf v1.7.3 h1:BHWt6FTLZAb2HtWT5KDBf6qgpZzvtbp9QWDRKZMXJC0=
|
||||||
github.com/gorilla/csrf v1.7.3-0.20250123201450-9dd6af1f6d30/go.mod h1:F1Fj3KG23WYHE6gozCmBAezKookxbIvUJT+121wTuLk=
|
github.com/gorilla/csrf v1.7.3/go.mod h1:F1Fj3KG23WYHE6gozCmBAezKookxbIvUJT+121wTuLk=
|
||||||
github.com/gorilla/securecookie v1.1.2 h1:YCIWL56dvtr73r6715mJs5ZvhtnY73hBvEF8kXD8ePA=
|
github.com/gorilla/securecookie v1.1.2 h1:YCIWL56dvtr73r6715mJs5ZvhtnY73hBvEF8kXD8ePA=
|
||||||
github.com/gorilla/securecookie v1.1.2/go.mod h1:NfCASbcHqRSY+3a8tlWJwsQap2VX5pwzwo4h3eOamfo=
|
github.com/gorilla/securecookie v1.1.2/go.mod h1:NfCASbcHqRSY+3a8tlWJwsQap2VX5pwzwo4h3eOamfo=
|
||||||
github.com/gorilla/sessions v1.4.0 h1:kpIYOp/oi6MG/p5PgxApU8srsSw9tuFbt46Lt7auzqQ=
|
github.com/gorilla/sessions v1.4.0 h1:kpIYOp/oi6MG/p5PgxApU8srsSw9tuFbt46Lt7auzqQ=
|
||||||
@@ -153,8 +153,8 @@ github.com/lufia/plan9stats v0.0.0-20250317134145-8bc96cf8fc35 h1:PpXWgLPs+Fqr32
|
|||||||
github.com/lufia/plan9stats v0.0.0-20250317134145-8bc96cf8fc35/go.mod h1:autxFIvghDt3jPTLoqZ9OZ7s9qTGNAWmYCjVFWPX/zg=
|
github.com/lufia/plan9stats v0.0.0-20250317134145-8bc96cf8fc35/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.30 h1:bVreufq3EAIG1Quvws73du3/QgdeZ3myglJlrzSYYCY=
|
||||||
github.com/mattn/go-sqlite3 v1.14.28/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=
|
github.com/mattn/go-sqlite3 v1.14.30/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=
|
||||||
github.com/mdlayher/genetlink v1.3.2 h1:KdrNKe+CTu+IbZnm/GVUMXSqBBLqcGpRDa0xkQy56gw=
|
github.com/mdlayher/genetlink v1.3.2 h1:KdrNKe+CTu+IbZnm/GVUMXSqBBLqcGpRDa0xkQy56gw=
|
||||||
github.com/mdlayher/genetlink v1.3.2/go.mod h1:tcC3pkCrPUGIKKsCsp0B3AdaaKuHtaxoJRz3cc+528o=
|
github.com/mdlayher/genetlink v1.3.2/go.mod h1:tcC3pkCrPUGIKKsCsp0B3AdaaKuHtaxoJRz3cc+528o=
|
||||||
github.com/mdlayher/netlink v1.7.3-0.20250113171957-fbb4dce95f42 h1:A1Cq6Ysb0GM0tpKMbdCXCIfBclan4oHk1Jb+Hrejirg=
|
github.com/mdlayher/netlink v1.7.3-0.20250113171957-fbb4dce95f42 h1:A1Cq6Ysb0GM0tpKMbdCXCIfBclan4oHk1Jb+Hrejirg=
|
||||||
@@ -163,8 +163,8 @@ github.com/mdlayher/sdnotify v1.0.0 h1:Ma9XeLVN/l0qpyx1tNeMSeTjCPH6NtuD6/N9XdTlQ
|
|||||||
github.com/mdlayher/sdnotify v1.0.0/go.mod h1:HQUmpM4XgYkhDLtd+Uad8ZFK1T9D5+pNxnXQjCeJlGE=
|
github.com/mdlayher/sdnotify v1.0.0/go.mod h1:HQUmpM4XgYkhDLtd+Uad8ZFK1T9D5+pNxnXQjCeJlGE=
|
||||||
github.com/mdlayher/socket v0.5.1 h1:VZaqt6RkGkt2OE9l3GcC6nZkqD3xKeQLyfleW/uBcos=
|
github.com/mdlayher/socket v0.5.1 h1:VZaqt6RkGkt2OE9l3GcC6nZkqD3xKeQLyfleW/uBcos=
|
||||||
github.com/mdlayher/socket v0.5.1/go.mod h1:TjPLHI1UgwEv5J1B5q0zTZq12A/6H7nKmtTanQE37IQ=
|
github.com/mdlayher/socket v0.5.1/go.mod h1:TjPLHI1UgwEv5J1B5q0zTZq12A/6H7nKmtTanQE37IQ=
|
||||||
github.com/metacubex/tfo-go v0.0.0-20241231083714-66613d49c422 h1:zGeQt3UyNydIVrMRB97AA5WsYEau/TyCnRtTf1yUmJY=
|
github.com/metacubex/tfo-go v0.0.0-20250516165257-e29c16ae41d4 h1:j1VRTiC9JLR4nUbSikx9OGdu/3AgFDqgcLj4GoqyQkc=
|
||||||
github.com/metacubex/tfo-go v0.0.0-20241231083714-66613d49c422/go.mod h1:l9oLnLoEXyGZ5RVLsh7QCC5XsouTUyKk4F2nLm2DHLw=
|
github.com/metacubex/tfo-go v0.0.0-20250516165257-e29c16ae41d4/go.mod h1:l9oLnLoEXyGZ5RVLsh7QCC5XsouTUyKk4F2nLm2DHLw=
|
||||||
github.com/metacubex/utls v1.8.0 h1:mSYi6FMnmc5riARl5UZDmWVy710z+P5b7xuGW0lV9ac=
|
github.com/metacubex/utls v1.8.0 h1:mSYi6FMnmc5riARl5UZDmWVy710z+P5b7xuGW0lV9ac=
|
||||||
github.com/metacubex/utls v1.8.0/go.mod h1:FdjYzVfCtgtna19hX0ER1Xsa5uJInwdQ4IcaaI98lEQ=
|
github.com/metacubex/utls v1.8.0/go.mod h1:FdjYzVfCtgtna19hX0ER1Xsa5uJInwdQ4IcaaI98lEQ=
|
||||||
github.com/mholt/acmez/v3 v3.1.2 h1:auob8J/0FhmdClQicvJvuDavgd5ezwLBfKuYmynhYzc=
|
github.com/mholt/acmez/v3 v3.1.2 h1:auob8J/0FhmdClQicvJvuDavgd5ezwLBfKuYmynhYzc=
|
||||||
@@ -214,36 +214,36 @@ github.com/sagernet/nftables v0.3.0-beta.4/go.mod h1:OQXAjvjNGGFxaTgVCSTRIhYB5/l
|
|||||||
github.com/sagernet/quic-go v0.52.0-beta.1 h1:hWkojLg64zjV+MJOvJU/kOeWndm3tiEfBLx5foisszs=
|
github.com/sagernet/quic-go v0.52.0-beta.1 h1:hWkojLg64zjV+MJOvJU/kOeWndm3tiEfBLx5foisszs=
|
||||||
github.com/sagernet/quic-go v0.52.0-beta.1/go.mod h1:OV+V5kEBb8kJS7k29MzDu6oj9GyMc7HA07sE1tedxz4=
|
github.com/sagernet/quic-go v0.52.0-beta.1/go.mod h1:OV+V5kEBb8kJS7k29MzDu6oj9GyMc7HA07sE1tedxz4=
|
||||||
github.com/sagernet/sing v0.6.9/go.mod h1:ARkL0gM13/Iv5VCZmci/NuoOlePoIsW0m7BWfln/Hak=
|
github.com/sagernet/sing v0.6.9/go.mod h1:ARkL0gM13/Iv5VCZmci/NuoOlePoIsW0m7BWfln/Hak=
|
||||||
github.com/sagernet/sing v0.7.0-beta.1.0.20250722151551-64142925accb h1:9DU5JA9Cow/bUfdP1v1pYMbAkFiW17UbI4b/iEPjVnc=
|
github.com/sagernet/sing v0.7.10 h1:2yPhZFx+EkyHPH8hXNezgyRSHyGY12CboId7CtwLROw=
|
||||||
github.com/sagernet/sing v0.7.0-beta.1.0.20250722151551-64142925accb/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-box v1.12.0-rc.3 h1:2II6wtPSAZZtE7+1EvdoEo1M0+De8483sqwMd8evaos=
|
github.com/sagernet/sing-box v1.12.8 h1:XnDRmD5tT5PsBPvMQ6zmLtbAKD3/l/6mHUfCJYa+L2g=
|
||||||
github.com/sagernet/sing-box v1.12.0-rc.3/go.mod h1:9HHuLZi2GS3xaDT9oh9hpXsaoEB71HN8YM03lctYB10=
|
github.com/sagernet/sing-box v1.12.8/go.mod h1:HRB+cgvwOMnoNmVhJm2DoFQPbJvDSRDaLonaMlT4tjo=
|
||||||
github.com/sagernet/sing-dns v0.4.6 h1:mjZC0o6d5sQ1sraoOBbK3G3apCbuL8wWYwu2RNu5rbM=
|
github.com/sagernet/sing-dns v0.4.6 h1:mjZC0o6d5sQ1sraoOBbK3G3apCbuL8wWYwu2RNu5rbM=
|
||||||
github.com/sagernet/sing-dns v0.4.6/go.mod h1:dweQs54ng2YGzoJfz+F9dGuDNdP5pJ3PLeggnK5VWc8=
|
github.com/sagernet/sing-dns v0.4.6/go.mod h1:dweQs54ng2YGzoJfz+F9dGuDNdP5pJ3PLeggnK5VWc8=
|
||||||
github.com/sagernet/sing-mux v0.3.2 h1:meZVFiiStvHThb/trcpAkCrmtJOuItG5Dzl1RRP5/NE=
|
github.com/sagernet/sing-mux v0.3.3 h1:YFgt9plMWzH994BMZLmyKL37PdIVaIilwP0Jg+EcLfw=
|
||||||
github.com/sagernet/sing-mux v0.3.2/go.mod h1:pht8iFY4c9Xltj7rhVd208npkNaeCxzyXCgulDPLUDA=
|
github.com/sagernet/sing-mux v0.3.3/go.mod h1:pht8iFY4c9Xltj7rhVd208npkNaeCxzyXCgulDPLUDA=
|
||||||
github.com/sagernet/sing-quic v0.5.0-beta.3 h1:X/acRNsqQNfDlmwE7SorHfaZiny5e67hqIzM/592ric=
|
github.com/sagernet/sing-quic v0.5.2-0.20250909083218-00a55617c0fb h1:5Wx3XeTiKrrrcrAky7Hc1bO3CGxrvho2Vu5b/adlEIM=
|
||||||
github.com/sagernet/sing-quic v0.5.0-beta.3/go.mod h1:SAv/qdeDN+75msGG5U5ZIwG+3Ua50jVIKNrRSY8pkx0=
|
github.com/sagernet/sing-quic v0.5.2-0.20250909083218-00a55617c0fb/go.mod h1:evP1e++ZG8TJHVV5HudXV4vWeYzGfCdF4HwSJZcdqkI=
|
||||||
github.com/sagernet/sing-shadowsocks v0.2.8 h1:PURj5PRoAkqeHh2ZW205RWzN9E9RtKCVCzByXruQWfE=
|
github.com/sagernet/sing-shadowsocks v0.2.8 h1:PURj5PRoAkqeHh2ZW205RWzN9E9RtKCVCzByXruQWfE=
|
||||||
github.com/sagernet/sing-shadowsocks v0.2.8/go.mod h1:lo7TWEMDcN5/h5B8S0ew+r78ZODn6SwVaFhvB6H+PTI=
|
github.com/sagernet/sing-shadowsocks v0.2.8/go.mod h1:lo7TWEMDcN5/h5B8S0ew+r78ZODn6SwVaFhvB6H+PTI=
|
||||||
github.com/sagernet/sing-shadowsocks2 v0.2.1 h1:dWV9OXCeFPuYGHb6IRqlSptVnSzOelnqqs2gQ2/Qioo=
|
github.com/sagernet/sing-shadowsocks2 v0.2.1 h1:dWV9OXCeFPuYGHb6IRqlSptVnSzOelnqqs2gQ2/Qioo=
|
||||||
github.com/sagernet/sing-shadowsocks2 v0.2.1/go.mod h1:RnXS0lExcDAovvDeniJ4IKa2IuChrdipolPYWBv9hWQ=
|
github.com/sagernet/sing-shadowsocks2 v0.2.1/go.mod h1:RnXS0lExcDAovvDeniJ4IKa2IuChrdipolPYWBv9hWQ=
|
||||||
github.com/sagernet/sing-shadowtls v0.2.1-0.20250503051639-fcd445d33c11 h1:tK+75l64tm9WvEFrYRE1t0YxoFdWQqw/h7Uhzj0vJ+w=
|
github.com/sagernet/sing-shadowtls v0.2.1-0.20250503051639-fcd445d33c11 h1:tK+75l64tm9WvEFrYRE1t0YxoFdWQqw/h7Uhzj0vJ+w=
|
||||||
github.com/sagernet/sing-shadowtls v0.2.1-0.20250503051639-fcd445d33c11/go.mod h1:sWqKnGlMipCHaGsw1sTTlimyUpgzP4WP3pjhCsYt9oA=
|
github.com/sagernet/sing-shadowtls v0.2.1-0.20250503051639-fcd445d33c11/go.mod h1:sWqKnGlMipCHaGsw1sTTlimyUpgzP4WP3pjhCsYt9oA=
|
||||||
github.com/sagernet/sing-tun v0.6.10-0.20250721014417-ebbe32588cfb h1:cvHEzjk3sVy80UA9PFKX15MzSP0g1uKwUspOm2ds3no=
|
github.com/sagernet/sing-tun v0.7.2 h1:uJkAZM0KBqIYzrq077QGqdvj/+4i/pMOx6Pnx0jYqAs=
|
||||||
github.com/sagernet/sing-tun v0.6.10-0.20250721014417-ebbe32588cfb/go.mod h1:AHJuRrLbNRJuivuFZ2VhXwDj4ViYp14szG5EkkKAqRQ=
|
github.com/sagernet/sing-tun v0.7.2/go.mod h1:pUEjh9YHQ2gJT6Lk0TYDklh3WJy7lz+848vleGM3JPM=
|
||||||
github.com/sagernet/sing-vmess v0.2.4 h1:wSg/SdxThELAvoRIN2yCZgu5xsmP1FWPBrP2ab2wq3A=
|
github.com/sagernet/sing-vmess v0.2.7 h1:2ee+9kO0xW5P4mfe6TYVWf9VtY8k1JhNysBqsiYj0sk=
|
||||||
github.com/sagernet/sing-vmess v0.2.4/go.mod h1:5aYoOtYksAyS0NXDm0qKeTYW1yoE1bJVcv+XLcVoyJs=
|
github.com/sagernet/sing-vmess v0.2.7/go.mod h1:5aYoOtYksAyS0NXDm0qKeTYW1yoE1bJVcv+XLcVoyJs=
|
||||||
github.com/sagernet/smux v1.5.34-mod.2 h1:gkmBjIjlJ2zQKpLigOkFur5kBKdV6bNRoFu2WkltRQ4=
|
github.com/sagernet/smux v1.5.34-mod.2 h1:gkmBjIjlJ2zQKpLigOkFur5kBKdV6bNRoFu2WkltRQ4=
|
||||||
github.com/sagernet/smux v1.5.34-mod.2/go.mod h1:0KW0+R+ycvA2INW4gbsd7BNyg+HEfLIAxa5N02/28Zc=
|
github.com/sagernet/smux v1.5.34-mod.2/go.mod h1:0KW0+R+ycvA2INW4gbsd7BNyg+HEfLIAxa5N02/28Zc=
|
||||||
github.com/sagernet/tailscale v1.80.3-mod.5 h1:7V7z+p2C//TGtff20pPnDCt3qP6uFyY62peJoKF9z/A=
|
github.com/sagernet/tailscale v1.80.3-sing-box-1.12-mod.1 h1:gMC0q+0VvZBotZMZ9G0R8ZMEIT/Q6KnXbw0/OgMjmdk=
|
||||||
github.com/sagernet/tailscale v1.80.3-mod.5/go.mod h1:EBxXsWu4OH2ELbQLq32WoBeIubG8KgDrg4/Oaxjs6lI=
|
github.com/sagernet/tailscale v1.80.3-sing-box-1.12-mod.1/go.mod h1:EBxXsWu4OH2ELbQLq32WoBeIubG8KgDrg4/Oaxjs6lI=
|
||||||
github.com/sagernet/wireguard-go v0.0.1-beta.7 h1:ltgBwYHfr+9Wz1eG59NiWnHrYEkDKHG7otNZvu85DXI=
|
github.com/sagernet/wireguard-go v0.0.1-beta.7 h1:ltgBwYHfr+9Wz1eG59NiWnHrYEkDKHG7otNZvu85DXI=
|
||||||
github.com/sagernet/wireguard-go v0.0.1-beta.7/go.mod h1:jGXij2Gn2wbrWuYNUmmNhf1dwcZtvyAvQoe8Xd8MbUo=
|
github.com/sagernet/wireguard-go v0.0.1-beta.7/go.mod h1:jGXij2Gn2wbrWuYNUmmNhf1dwcZtvyAvQoe8Xd8MbUo=
|
||||||
github.com/sagernet/ws v0.0.0-20231204124109-acfe8907c854 h1:6uUiZcDRnZSAegryaUGwPC/Fj13JSHwiTftrXhMmYOc=
|
github.com/sagernet/ws v0.0.0-20231204124109-acfe8907c854 h1:6uUiZcDRnZSAegryaUGwPC/Fj13JSHwiTftrXhMmYOc=
|
||||||
github.com/sagernet/ws v0.0.0-20231204124109-acfe8907c854/go.mod h1:LtfoSK3+NG57tvnVEHgcuBW9ujgE8enPSgzgwStwCAA=
|
github.com/sagernet/ws v0.0.0-20231204124109-acfe8907c854/go.mod h1:LtfoSK3+NG57tvnVEHgcuBW9ujgE8enPSgzgwStwCAA=
|
||||||
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/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=
|
||||||
@@ -255,8 +255,8 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO
|
|||||||
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.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||||
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||||
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/tailscale/certstore v0.1.1-0.20231202035212-d3fa0460f47e h1:PtWT87weP5LWHEY//SWsYkSO3RWRZo4OSWagh3YD2vQ=
|
github.com/tailscale/certstore v0.1.1-0.20231202035212-d3fa0460f47e h1:PtWT87weP5LWHEY//SWsYkSO3RWRZo4OSWagh3YD2vQ=
|
||||||
github.com/tailscale/certstore v0.1.1-0.20231202035212-d3fa0460f47e/go.mod h1:XrBNfAFN+pwoWuksbFS9Ccxnopa15zJGgXRFN90l3K4=
|
github.com/tailscale/certstore v0.1.1-0.20231202035212-d3fa0460f47e/go.mod h1:XrBNfAFN+pwoWuksbFS9Ccxnopa15zJGgXRFN90l3K4=
|
||||||
github.com/tailscale/go-winio v0.0.0-20231025203758-c4f33415bf55 h1:Gzfnfk2TWrk8Jj4P4c1a3CtQyMaTVCznlkLZI++hok4=
|
github.com/tailscale/go-winio v0.0.0-20231025203758-c4f33415bf55 h1:Gzfnfk2TWrk8Jj4P4c1a3CtQyMaTVCznlkLZI++hok4=
|
||||||
@@ -322,21 +322,21 @@ go4.org/mem v0.0.0-20240501181205-ae6ca9944745 h1:Tl++JLUCe4sxGu8cTpDzRLd3tN7US4
|
|||||||
go4.org/mem v0.0.0-20240501181205-ae6ca9944745/go.mod h1:reUoABIJ9ikfM5sgtSF3Wushcza7+WeD01VB9Lirh3g=
|
go4.org/mem v0.0.0-20240501181205-ae6ca9944745/go.mod h1:reUoABIJ9ikfM5sgtSF3Wushcza7+WeD01VB9Lirh3g=
|
||||||
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.20.0 h1:dx1zTU0MAE98U+TQ8BLl7XsJbgze2WnNKF/8tGp/Q6c=
|
||||||
golang.org/x/arch v0.18.0/go.mod h1:bdwinDaKcfZUGpH09BB7ZmOfhalA8lQdzl62l8gGWsk=
|
golang.org/x/arch v0.20.0/go.mod h1:bdwinDaKcfZUGpH09BB7ZmOfhalA8lQdzl62l8gGWsk=
|
||||||
golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8=
|
golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8=
|
||||||
golang.org/x/crypto v0.40.0 h1:r4x+VvoG5Fm+eJcxMaY8CQM7Lb0l1lsmjGBQ6s8BfKM=
|
golang.org/x/crypto v0.41.0 h1:WKYxWedPGCTVVl5+WHSSrOBT0O8lx32+zxmHxijgXp4=
|
||||||
golang.org/x/crypto v0.40.0/go.mod h1:Qr1vMER5WyS2dfPHAlsOj01wgLbsyWtFn/aY+5+ZdxY=
|
golang.org/x/crypto v0.41.0/go.mod h1:pO5AFd7FA68rFak7rOAGVuygIISepHftHnr8dr6+sUc=
|
||||||
golang.org/x/exp v0.0.0-20250506013437-ce4c2cf36ca6 h1:y5zboxd6LQAqYIhHnB48p0ByQ/GnQx2BE33L8BOHQkI=
|
golang.org/x/exp v0.0.0-20250506013437-ce4c2cf36ca6 h1:y5zboxd6LQAqYIhHnB48p0ByQ/GnQx2BE33L8BOHQkI=
|
||||||
golang.org/x/exp v0.0.0-20250506013437-ce4c2cf36ca6/go.mod h1:U6Lno4MTRCDY+Ba7aCcauB9T60gsv5s4ralQzP72ZoQ=
|
golang.org/x/exp v0.0.0-20250506013437-ce4c2cf36ca6/go.mod h1:U6Lno4MTRCDY+Ba7aCcauB9T60gsv5s4ralQzP72ZoQ=
|
||||||
golang.org/x/image v0.23.0 h1:HseQ7c2OpPKTPVzNjG5fwJsOTCiiwS4QdsYi5XU6H68=
|
golang.org/x/image v0.23.0 h1:HseQ7c2OpPKTPVzNjG5fwJsOTCiiwS4QdsYi5XU6H68=
|
||||||
golang.org/x/image v0.23.0/go.mod h1:wJJBTdLfCCf3tiHa1fNxpZmUI4mmoZvwMCPP0ddoNKY=
|
golang.org/x/image v0.23.0/go.mod h1:wJJBTdLfCCf3tiHa1fNxpZmUI4mmoZvwMCPP0ddoNKY=
|
||||||
golang.org/x/mod v0.26.0 h1:EGMPT//Ezu+ylkCijjPc+f4Aih7sZvaAr+O3EHBxvZg=
|
golang.org/x/mod v0.27.0 h1:kb+q2PyFnEADO2IEF935ehFUXlWiNjJWtRNgBLSfbxQ=
|
||||||
golang.org/x/mod v0.26.0/go.mod h1:/j6NAhSk8iQ723BGAUyoAcn7SlD7s15Dp9Nd/SfeaFQ=
|
golang.org/x/mod v0.27.0/go.mod h1:rWI627Fq0DEoudcK+MBkNkCe0EetEaDSwJJkCcjpazc=
|
||||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||||
golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||||
golang.org/x/net v0.42.0 h1:jzkYrhi3YQWD6MLBJcsklgQsoAcw89EcZbJw8Z614hs=
|
golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE=
|
||||||
golang.org/x/net v0.42.0/go.mod h1:FF1RA5d3u7nAYA4z2TkclSCKh68eSXtiFwcWQpPXdt8=
|
golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg=
|
||||||
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.16.0 h1:ycBJEhp9p4vXvUZNszeOq0kGTPghopOL8q0fq3vstxw=
|
golang.org/x/sync v0.16.0 h1:ycBJEhp9p4vXvUZNszeOq0kGTPghopOL8q0fq3vstxw=
|
||||||
golang.org/x/sync v0.16.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
|
golang.org/x/sync v0.16.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
|
||||||
@@ -350,20 +350,20 @@ golang.org/x/sys v0.0.0-20220817070843-5a390386f1f2/go.mod h1:oPkhp1MJrh7nUepCBc
|
|||||||
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.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||||
golang.org/x/sys v0.34.0 h1:H5Y5sJ2L2JRdyv7ROF1he/lPdvFsd0mJHFw2ThKHxLA=
|
golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI=
|
||||||
golang.org/x/sys v0.34.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
|
golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
|
||||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||||
golang.org/x/term v0.33.0 h1:NuFncQrRcaRvVmgRkvM3j/F00gWIAlcmlB8ACEKmGIg=
|
golang.org/x/term v0.34.0 h1:O/2T7POpk0ZZ7MAzMeWFSg6S5IpWd/RXDlM9hgM3DR4=
|
||||||
golang.org/x/term v0.33.0/go.mod h1:s18+ql9tYWp1IfpV9DmCtQDDSRBUjKaw9M1eAv5UeF0=
|
golang.org/x/term v0.34.0/go.mod h1:5jC53AEywhIVebHgPVeg0mj8OD3VO9OzclacVrqpaAw=
|
||||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||||
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||||
golang.org/x/text v0.27.0 h1:4fGWRpyh641NLlecmyl4LOe6yDdfaYNrGb2zdfo4JV4=
|
golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng=
|
||||||
golang.org/x/text v0.27.0/go.mod h1:1D28KMCvyooCX9hBiosv5Tz/+YLxj0j7XhWjpSUF7CU=
|
golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU=
|
||||||
golang.org/x/time v0.9.0 h1:EsRrnYcQiGH+5FfbgvV4AP7qEZstoyrHB0DzarOQ4ZY=
|
golang.org/x/time v0.9.0 h1:EsRrnYcQiGH+5FfbgvV4AP7qEZstoyrHB0DzarOQ4ZY=
|
||||||
golang.org/x/time v0.9.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
|
golang.org/x/time v0.9.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
|
||||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||||
golang.org/x/tools v0.34.0 h1:qIpSLOxeCYGg9TrcJokLBG4KFA6d795g0xkBkiESGlo=
|
golang.org/x/tools v0.36.0 h1:kWS0uv/zsvHEle1LbV5LE8QujrxB3wfQyxHfhOk0Qkg=
|
||||||
golang.org/x/tools v0.34.0/go.mod h1:pAP9OwEaY1CAW3HOmg3hLZC5Z0CCmzjAF2UQMSqNARg=
|
golang.org/x/tools v0.36.0/go.mod h1:WBDiHKJK8YgLHlcQPYQzNCkUxUypCaa5ZegCVutKm+s=
|
||||||
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/wgctrl v0.0.0-20241231184526-a9ab2273dd10 h1:3GDAcqdIg1ozBNLgPy4SLT84nfcBjr6rhGtXYtrkWLU=
|
golang.zx2c4.com/wireguard/wgctrl v0.0.0-20241231184526-a9ab2273dd10 h1:3GDAcqdIg1ozBNLgPy4SLT84nfcBjr6rhGtXYtrkWLU=
|
||||||
@@ -383,8 +383,8 @@ 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=
|
||||||
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=
|
nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50=
|
||||||
|
|||||||
-60
@@ -38,66 +38,6 @@ arch() {
|
|||||||
|
|
||||||
echo "arch: $(arch)"
|
echo "arch: $(arch)"
|
||||||
|
|
||||||
os_version=""
|
|
||||||
os_version=$(grep -i version_id /etc/os-release | cut -d \" -f2 | cut -d . -f1)
|
|
||||||
|
|
||||||
if [[ "${release}" == "arch" ]]; then
|
|
||||||
echo "Your OS is Arch Linux"
|
|
||||||
elif [[ "${release}" == "parch" ]]; then
|
|
||||||
echo "Your OS is Parch linux"
|
|
||||||
elif [[ "${release}" == "manjaro" ]]; then
|
|
||||||
echo "Your OS is Manjaro"
|
|
||||||
elif [[ "${release}" == "armbian" ]]; then
|
|
||||||
echo "Your OS is Armbian"
|
|
||||||
elif [[ "${release}" == "opensuse-tumbleweed" ]]; then
|
|
||||||
echo "Your OS is OpenSUSE Tumbleweed"
|
|
||||||
elif [[ "${release}" == "centos" ]]; then
|
|
||||||
if [[ ${os_version} -lt 8 ]]; then
|
|
||||||
echo -e "${red} Please use CentOS 8 or higher ${plain}\n" && exit 1
|
|
||||||
fi
|
|
||||||
elif [[ "${release}" == "ubuntu" ]]; then
|
|
||||||
if [[ ${os_version} -lt 20 ]]; then
|
|
||||||
echo -e "${red} Please use Ubuntu 20 or higher version!${plain}\n" && exit 1
|
|
||||||
fi
|
|
||||||
elif [[ "${release}" == "fedora" ]]; then
|
|
||||||
if [[ ${os_version} -lt 36 ]]; then
|
|
||||||
echo -e "${red} Please use Fedora 36 or higher version!${plain}\n" && exit 1
|
|
||||||
fi
|
|
||||||
elif [[ "${release}" == "debian" ]]; then
|
|
||||||
if [[ ${os_version} -lt 11 ]]; then
|
|
||||||
echo -e "${red} Please use Debian 11 or higher ${plain}\n" && exit 1
|
|
||||||
fi
|
|
||||||
elif [[ "${release}" == "almalinux" ]]; then
|
|
||||||
if [[ ${os_version} -lt 9 ]]; then
|
|
||||||
echo -e "${red} Please use AlmaLinux 9 or higher ${plain}\n" && exit 1
|
|
||||||
fi
|
|
||||||
elif [[ "${release}" == "rocky" ]]; then
|
|
||||||
if [[ ${os_version} -lt 9 ]]; then
|
|
||||||
echo -e "${red} Please use Rocky Linux 9 or higher ${plain}\n" && exit 1
|
|
||||||
fi
|
|
||||||
elif [[ "${release}" == "oracle" ]]; then
|
|
||||||
if [[ ${os_version} -lt 8 ]]; then
|
|
||||||
echo -e "${red} Please use Oracle Linux 8 or higher ${plain}\n" && exit 1
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo -e "${red}Your operating system is not supported by this script.${plain}\n"
|
|
||||||
echo "Please ensure you are using one of the following supported operating systems:"
|
|
||||||
echo "- Ubuntu 20.04+"
|
|
||||||
echo "- Debian 11+"
|
|
||||||
echo "- CentOS 8+"
|
|
||||||
echo "- Fedora 36+"
|
|
||||||
echo "- Arch Linux"
|
|
||||||
echo "- Parch Linux"
|
|
||||||
echo "- Manjaro"
|
|
||||||
echo "- Armbian"
|
|
||||||
echo "- AlmaLinux 9+"
|
|
||||||
echo "- Rocky Linux 9+"
|
|
||||||
echo "- Oracle Linux 8+"
|
|
||||||
echo "- OpenSUSE Tumbleweed"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
install_base() {
|
install_base() {
|
||||||
case "${release}" in
|
case "${release}" in
|
||||||
centos | almalinux | rocky | oracle)
|
centos | almalinux | rocky | oracle)
|
||||||
|
|||||||
Generated
-6
@@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "s-ui",
|
|
||||||
"lockfileVersion": 3,
|
|
||||||
"requires": true,
|
|
||||||
"packages": {}
|
|
||||||
}
|
|
||||||
@@ -32,65 +32,6 @@ fi
|
|||||||
|
|
||||||
echo "The OS release is: $release"
|
echo "The OS release is: $release"
|
||||||
|
|
||||||
os_version=""
|
|
||||||
os_version=$(grep -i version_id /etc/os-release | cut -d \" -f2 | cut -d . -f1)
|
|
||||||
|
|
||||||
if [[ "${release}" == "arch" ]]; then
|
|
||||||
echo "Your OS is Arch Linux"
|
|
||||||
elif [[ "${release}" == "parch" ]]; then
|
|
||||||
echo "Your OS is Parch linux"
|
|
||||||
elif [[ "${release}" == "manjaro" ]]; then
|
|
||||||
echo "Your OS is Manjaro"
|
|
||||||
elif [[ "${release}" == "armbian" ]]; then
|
|
||||||
echo "Your OS is Armbian"
|
|
||||||
elif [[ "${release}" == "opensuse-tumbleweed" ]]; then
|
|
||||||
echo "Your OS is OpenSUSE Tumbleweed"
|
|
||||||
elif [[ "${release}" == "centos" ]]; then
|
|
||||||
if [[ ${os_version} -lt 8 ]]; then
|
|
||||||
echo -e "${red} Please use CentOS 8 or higher ${plain}\n" && exit 1
|
|
||||||
fi
|
|
||||||
elif [[ "${release}" == "ubuntu" ]]; then
|
|
||||||
if [[ ${os_version} -lt 22 ]]; then
|
|
||||||
echo -e "${red} Please use Ubuntu 22 or higher version!${plain}\n" && exit 1
|
|
||||||
fi
|
|
||||||
elif [[ "${release}" == "fedora" ]]; then
|
|
||||||
if [[ ${os_version} -lt 36 ]]; then
|
|
||||||
echo -e "${red} Please use Fedora 36 or higher version!${plain}\n" && exit 1
|
|
||||||
fi
|
|
||||||
elif [[ "${release}" == "debian" ]]; then
|
|
||||||
if [[ ${os_version} -lt 11 ]]; then
|
|
||||||
echo -e "${red} Please use Debian 11 or higher ${plain}\n" && exit 1
|
|
||||||
fi
|
|
||||||
elif [[ "${release}" == "almalinux" ]]; then
|
|
||||||
if [[ ${os_version} -lt 9 ]]; then
|
|
||||||
echo -e "${red} Please use AlmaLinux 9 or higher ${plain}\n" && exit 1
|
|
||||||
fi
|
|
||||||
elif [[ "${release}" == "rocky" ]]; then
|
|
||||||
if [[ ${os_version} -lt 9 ]]; then
|
|
||||||
echo -e "${red} Please use Rocky Linux 9 or higher ${plain}\n" && exit 1
|
|
||||||
fi
|
|
||||||
elif [[ "${release}" == "oracle" ]]; then
|
|
||||||
if [[ ${os_version} -lt 8 ]]; then
|
|
||||||
echo -e "${red} Please use Oracle Linux 8 or higher ${plain}\n" && exit 1
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo -e "${red}Your operating system is not supported by this script.${plain}\n"
|
|
||||||
echo "Please ensure you are using one of the following supported operating systems:"
|
|
||||||
echo "- Ubuntu 22.04+"
|
|
||||||
echo "- Debian 11+"
|
|
||||||
echo "- CentOS 8+"
|
|
||||||
echo "- Fedora 36+"
|
|
||||||
echo "- Arch Linux"
|
|
||||||
echo "- Parch Linux"
|
|
||||||
echo "- Manjaro"
|
|
||||||
echo "- Armbian"
|
|
||||||
echo "- AlmaLinux 9+"
|
|
||||||
echo "- Rocky Linux 9+"
|
|
||||||
echo "- Oracle Linux 8+"
|
|
||||||
echo "- OpenSUSE Tumbleweed"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
confirm() {
|
confirm() {
|
||||||
if [[ $# > 1 ]]; then
|
if [[ $# > 1 ]]; then
|
||||||
echo && read -p "$1 [Default$2]: " temp
|
echo && read -p "$1 [Default$2]: " temp
|
||||||
|
|||||||
+1
-1
@@ -283,7 +283,7 @@ func (s *ClientService) UpdateLinksByInboundChange(tx *gorm.DB, inbounds *[]mode
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
for _, clientLink := range clientLinks {
|
for _, clientLink := range clientLinks {
|
||||||
if clientLink["remark"] != inbound.Tag && clientLink["remark"] != oldTag {
|
if clientLink["type"] != "local" || (clientLink["remark"] != inbound.Tag && clientLink["remark"] != oldTag) {
|
||||||
newClientLinks = append(newClientLinks, clientLink)
|
newClientLinks = append(newClientLinks, clientLink)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-1
@@ -142,7 +142,8 @@ func (s *ConfigService) Save(obj string, act string, data json.RawMessage, initU
|
|||||||
|
|
||||||
switch obj {
|
switch obj {
|
||||||
case "clients":
|
case "clients":
|
||||||
inboundIds, err := s.ClientService.Save(tx, act, data, hostname)
|
var inboundIds []uint
|
||||||
|
inboundIds, err = s.ClientService.Save(tx, act, data, hostname)
|
||||||
if err == nil && len(inboundIds) > 0 {
|
if err == nil && len(inboundIds) > 0 {
|
||||||
objs = append(objs, "inbounds")
|
objs = append(objs, "inbounds")
|
||||||
err = s.InboundService.RestartInbounds(tx, inboundIds)
|
err = s.InboundService.RestartInbounds(tx, inboundIds)
|
||||||
|
|||||||
@@ -341,6 +341,9 @@ func (s *InboundService) RestartInbounds(tx *gorm.DB, ids []uint) error {
|
|||||||
if err != nil && err != os.ErrInvalid {
|
if err != nil && err != os.ErrInvalid {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
// Close all existing connections
|
||||||
|
corePtr.GetInstance().ConnTracker().CloseConnByInbound(inbound.Tag)
|
||||||
|
|
||||||
inboundConfig, err := inbound.MarshalJSON()
|
inboundConfig, err := inbound.MarshalJSON()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|||||||
+6
-1
@@ -2,6 +2,7 @@ package service
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
"runtime"
|
||||||
"s-ui/logger"
|
"s-ui/logger"
|
||||||
"syscall"
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
@@ -17,7 +18,11 @@ func (s *PanelService) RestartPanel(delay time.Duration) error {
|
|||||||
}
|
}
|
||||||
go func() {
|
go func() {
|
||||||
time.Sleep(delay)
|
time.Sleep(delay)
|
||||||
err := p.Signal(syscall.SIGHUP)
|
if runtime.GOOS == "windows" {
|
||||||
|
err = p.Kill()
|
||||||
|
} else {
|
||||||
|
err = p.Signal(syscall.SIGHUP)
|
||||||
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Error("send signal SIGHUP failed:", err)
|
logger.Error("send signal SIGHUP failed:", err)
|
||||||
}
|
}
|
||||||
|
|||||||
+18
-1
@@ -3,6 +3,7 @@ package service
|
|||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"os"
|
"os"
|
||||||
|
"runtime"
|
||||||
"s-ui/config"
|
"s-ui/config"
|
||||||
"s-ui/database"
|
"s-ui/database"
|
||||||
"s-ui/database/model"
|
"s-ui/database/model"
|
||||||
@@ -19,10 +20,16 @@ var defaultConfig = `{
|
|||||||
"log": {
|
"log": {
|
||||||
"level": "info"
|
"level": "info"
|
||||||
},
|
},
|
||||||
"dns": {},
|
"dns": {
|
||||||
|
"servers": [],
|
||||||
|
"rules": []
|
||||||
|
},
|
||||||
"route": {
|
"route": {
|
||||||
"rules": [
|
"rules": [
|
||||||
{
|
{
|
||||||
|
"action": "sniff"
|
||||||
|
},
|
||||||
|
{
|
||||||
"protocol": [
|
"protocol": [
|
||||||
"dns"
|
"dns"
|
||||||
],
|
],
|
||||||
@@ -239,6 +246,9 @@ func (s *SettingService) GetTimeLocation() (*time.Location, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
if runtime.GOOS == "windows" {
|
||||||
|
l = "Local"
|
||||||
|
}
|
||||||
location, err := time.LoadLocation(l)
|
location, err := time.LoadLocation(l)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
defaultLocation := defaultValueMap["timeLocation"]
|
defaultLocation := defaultValueMap["timeLocation"]
|
||||||
@@ -381,6 +391,13 @@ func (s *SettingService) Save(tx *gorm.DB, data json.RawMessage) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Delete all stats if it is set to 0
|
||||||
|
if key == "trafficAge" && obj == "0" {
|
||||||
|
err = tx.Where("id > 0").Delete(model.Stats{}).Error
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
err = tx.Model(model.Setting{}).Where("key = ?", key).Update("value", obj).Error
|
err = tx.Model(model.Setting{}).Where("key = ?", key).Update("value", obj).Error
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|||||||
+6
-4
@@ -19,11 +19,11 @@ var onlineResources = &onlines{}
|
|||||||
type StatsService struct {
|
type StatsService struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *StatsService) SaveStats() error {
|
func (s *StatsService) SaveStats(enableTraffic bool) error {
|
||||||
if !corePtr.IsRunning() {
|
if !corePtr.IsRunning() {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
stats := corePtr.GetInstance().ConnTracker().GetStats()
|
stats := corePtr.GetInstance().StatsTracker().GetStats()
|
||||||
|
|
||||||
// Reset onlines
|
// Reset onlines
|
||||||
onlineResources.Inbound = nil
|
onlineResources.Inbound = nil
|
||||||
@@ -70,8 +70,10 @@ func (s *StatsService) SaveStats() error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
err = tx.Create(&stats).Error
|
if !enableTraffic {
|
||||||
return err
|
return nil
|
||||||
|
}
|
||||||
|
return tx.Create(&stats).Error
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *StatsService) GetStats(resource string, tag string, limit int) ([]model.Stats, error) {
|
func (s *StatsService) GetStats(resource string, tag string, limit int) ([]model.Stats, error) {
|
||||||
|
|||||||
+19
-3
@@ -73,8 +73,12 @@ func (s *ClashService) GetClash(subId string) (*string, []string, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
links := s.LinkService.GetLinks(&client.Links, "external", "")
|
links := s.LinkService.GetLinks(&client.Links, "external", "")
|
||||||
|
tagNumEnable := 0
|
||||||
|
if len(links) > 1 {
|
||||||
|
tagNumEnable = 1
|
||||||
|
}
|
||||||
for index, link := range links {
|
for index, link := range links {
|
||||||
json, tag, err := util.GetOutbound(link, index)
|
json, tag, err := util.GetOutbound(link, (index+1)*tagNumEnable)
|
||||||
if err == nil && len(tag) > 0 {
|
if err == nil && len(tag) > 0 {
|
||||||
*outbounds = append(*outbounds, *json)
|
*outbounds = append(*outbounds, *json)
|
||||||
*outTags = append(*outTags, tag)
|
*outTags = append(*outTags, tag)
|
||||||
@@ -132,6 +136,12 @@ func (s *ClashService) ConvertToClashMeta(outbounds *[]map[string]interface{}) (
|
|||||||
proxy["flow"] = flow
|
proxy["flow"] = flow
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if t == "tuic" {
|
||||||
|
proxy["password"] = obMap["password"]
|
||||||
|
if congestion_control, ok := obMap["congestion_control"].(string); ok {
|
||||||
|
proxy["congestion-controller"] = congestion_control
|
||||||
|
}
|
||||||
|
}
|
||||||
case "trojan":
|
case "trojan":
|
||||||
proxy["password"] = obMap["password"]
|
proxy["password"] = obMap["password"]
|
||||||
case "socks", "http":
|
case "socks", "http":
|
||||||
@@ -162,9 +172,15 @@ func (s *ClashService) ConvertToClashMeta(outbounds *[]map[string]interface{}) (
|
|||||||
proxy["obfs"] = obfs["type"]
|
proxy["obfs"] = obfs["type"]
|
||||||
proxy["obfs-password"] = obfs["password"]
|
proxy["obfs-password"] = obfs["password"]
|
||||||
}
|
}
|
||||||
if ports, ok := obMap["server_ports"].([]string); ok {
|
|
||||||
proxy["ports"] = strings.ReplaceAll(strings.Join(ports, ","), ":", "-")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if portLists, ok := obMap["server_ports"].([]interface{}); ok {
|
||||||
|
var ports []string
|
||||||
|
for _, portList := range portLists {
|
||||||
|
portRange, _ := portList.(string)
|
||||||
|
ports = append(ports, strings.ReplaceAll(portRange, ":", "-"))
|
||||||
|
}
|
||||||
|
proxy["ports"] = strings.Join(ports, ",")
|
||||||
}
|
}
|
||||||
case "anytls":
|
case "anytls":
|
||||||
proxy["password"] = obMap["password"]
|
proxy["password"] = obMap["password"]
|
||||||
|
|||||||
+30
-1
@@ -7,6 +7,7 @@ import (
|
|||||||
"s-ui/database/model"
|
"s-ui/database/model"
|
||||||
"s-ui/service"
|
"s-ui/service"
|
||||||
"s-ui/util"
|
"s-ui/util"
|
||||||
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
const defaultJson = `
|
const defaultJson = `
|
||||||
@@ -60,8 +61,12 @@ func (j *JsonService) GetJson(subId string, format string) (*string, []string, e
|
|||||||
}
|
}
|
||||||
|
|
||||||
links := j.LinkService.GetLinks(&client.Links, "external", "")
|
links := j.LinkService.GetLinks(&client.Links, "external", "")
|
||||||
|
tagNumEnable := 0
|
||||||
|
if len(links) > 1 {
|
||||||
|
tagNumEnable = 1
|
||||||
|
}
|
||||||
for index, link := range links {
|
for index, link := range links {
|
||||||
json, tag, err := util.GetOutbound(link, index)
|
json, tag, err := util.GetOutbound(link, (index+1)*tagNumEnable)
|
||||||
if err == nil && len(tag) > 0 {
|
if err == nil && len(tag) > 0 {
|
||||||
*outbounds = append(*outbounds, *json)
|
*outbounds = append(*outbounds, *json)
|
||||||
*outTags = append(*outTags, tag)
|
*outTags = append(*outTags, tag)
|
||||||
@@ -128,6 +133,29 @@ func (j *JsonService) getOutbounds(clientConfig json.RawMessage, inbounds []*mod
|
|||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
protocol, _ := outbound["type"].(string)
|
protocol, _ := outbound["type"].(string)
|
||||||
|
|
||||||
|
// Shadowsocks
|
||||||
|
if protocol == "shadowsocks" {
|
||||||
|
var userPass []string
|
||||||
|
var inbOptions map[string]interface{}
|
||||||
|
err = json.Unmarshal(inData.Options, &inbOptions)
|
||||||
|
if err != nil {
|
||||||
|
return nil, nil, err
|
||||||
|
}
|
||||||
|
method, _ := inbOptions["method"].(string)
|
||||||
|
if strings.HasPrefix(method, "2022") {
|
||||||
|
inbPass, _ := inbOptions["password"].(string)
|
||||||
|
userPass = append(userPass, inbPass)
|
||||||
|
}
|
||||||
|
var pass string
|
||||||
|
if method == "2022-blake3-aes-128-gcm" {
|
||||||
|
pass, _ = configs["shadowsocks16"].(map[string]interface{})["password"].(string)
|
||||||
|
} else {
|
||||||
|
pass, _ = configs["shadowsocks"].(map[string]interface{})["password"].(string)
|
||||||
|
}
|
||||||
|
userPass = append(userPass, pass)
|
||||||
|
outbound["password"] = strings.Join(userPass, ":")
|
||||||
|
} else { // Other protocols
|
||||||
config, _ := configs[protocol].(map[string]interface{})
|
config, _ := configs[protocol].(map[string]interface{})
|
||||||
for key, value := range config {
|
for key, value := range config {
|
||||||
if key == "name" || key == "alterId" || (key == "flow" && inData.TlsId == 0) {
|
if key == "name" || key == "alterId" || (key == "flow" && inData.TlsId == 0) {
|
||||||
@@ -135,6 +163,7 @@ func (j *JsonService) getOutbounds(clientConfig json.RawMessage, inbounds []*mod
|
|||||||
}
|
}
|
||||||
outbound[key] = value
|
outbound[key] = value
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var addrs []map[string]interface{}
|
var addrs []map[string]interface{}
|
||||||
err = json.Unmarshal(inData.Addrs, &addrs)
|
err = json.Unmarshal(inData.Addrs, &addrs)
|
||||||
|
|||||||
+108
-139
@@ -10,7 +10,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
var InboundTypeWithLink = []string{"shadowsocks", "naive", "hysteria", "hysteria2", "anytls", "tuic", "vless", "trojan", "vmess"}
|
var InboundTypeWithLink = []string{"socks", "http", "mixed", "shadowsocks", "naive", "hysteria", "hysteria2", "anytls", "tuic", "vless", "trojan", "vmess"}
|
||||||
|
|
||||||
func LinkGenerator(clientConfig json.RawMessage, i *model.Inbound, hostname string) []string {
|
func LinkGenerator(clientConfig json.RawMessage, i *model.Inbound, hostname string) []string {
|
||||||
inbound, err := i.MarshalFull()
|
inbound, err := i.MarshalFull()
|
||||||
@@ -61,6 +61,15 @@ func LinkGenerator(clientConfig json.RawMessage, i *model.Inbound, hostname stri
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch i.Type {
|
switch i.Type {
|
||||||
|
case "socks":
|
||||||
|
return socksLink(userConfig["socks"], *inbound, Addrs)
|
||||||
|
case "http":
|
||||||
|
return httpLink(userConfig["http"], *inbound, Addrs)
|
||||||
|
case "mixed":
|
||||||
|
return append(
|
||||||
|
socksLink(userConfig["socks"], *inbound, Addrs),
|
||||||
|
httpLink(userConfig["http"], *inbound, Addrs)...,
|
||||||
|
)
|
||||||
case "shadowsocks":
|
case "shadowsocks":
|
||||||
return shadowsocksLink(userConfig, *inbound, Addrs)
|
return shadowsocksLink(userConfig, *inbound, Addrs)
|
||||||
case "naive":
|
case "naive":
|
||||||
@@ -106,6 +115,26 @@ func prepareTls(t *model.Tls) map[string]interface{} {
|
|||||||
return oTls
|
return oTls
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func socksLink(userConfig map[string]interface{}, inbound map[string]interface{}, addrs []map[string]interface{}) []string {
|
||||||
|
var links []string
|
||||||
|
for _, addr := range addrs {
|
||||||
|
links = append(links, fmt.Sprintf("socks5://%s:%s@%s:%d", userConfig["username"], userConfig["password"], addr["server"].(string), uint(addr["server_port"].(float64))))
|
||||||
|
}
|
||||||
|
return links
|
||||||
|
}
|
||||||
|
|
||||||
|
func httpLink(userConfig map[string]interface{}, inbound map[string]interface{}, addrs []map[string]interface{}) []string {
|
||||||
|
var links []string
|
||||||
|
var protocol string = "http"
|
||||||
|
for _, addr := range addrs {
|
||||||
|
if addr["tls"] != nil {
|
||||||
|
protocol = "https"
|
||||||
|
}
|
||||||
|
links = append(links, fmt.Sprintf("%s://%s:%s@%s:%d", protocol, userConfig["username"], userConfig["password"], addr["server"].(string), uint(addr["server_port"].(float64))))
|
||||||
|
}
|
||||||
|
return links
|
||||||
|
}
|
||||||
|
|
||||||
func shadowsocksLink(
|
func shadowsocksLink(
|
||||||
userConfig map[string]map[string]interface{},
|
userConfig map[string]map[string]interface{},
|
||||||
inbound map[string]interface{},
|
inbound map[string]interface{},
|
||||||
@@ -130,7 +159,7 @@ func shadowsocksLink(
|
|||||||
var links []string
|
var links []string
|
||||||
for _, addr := range addrs {
|
for _, addr := range addrs {
|
||||||
port, _ := addr["server_port"].(float64)
|
port, _ := addr["server_port"].(float64)
|
||||||
links = append(links, fmt.Sprintf("%s@%s:%d", uriBase, addr["server"].(string), uint(port)))
|
links = append(links, fmt.Sprintf("%s@%s:%.0f#%s", uriBase, addr["server"].(string), port, addr["remark"].(string)))
|
||||||
}
|
}
|
||||||
return links
|
return links
|
||||||
}
|
}
|
||||||
@@ -171,7 +200,7 @@ func naiveLink(
|
|||||||
}
|
}
|
||||||
|
|
||||||
port, _ := addr["server_port"].(float64)
|
port, _ := addr["server_port"].(float64)
|
||||||
uri := baseUri + toBase64([]byte(fmt.Sprintf("%s:%s@%s:%d", username, password, addr["server"].(string), uint(port))))
|
uri := baseUri + toBase64([]byte(fmt.Sprintf("%s:%s@%s:%.0f", username, password, addr["server"].(string), port)))
|
||||||
links = append(links, addParams(uri, params, addr["remark"].(string)))
|
links = append(links, addParams(uri, params, addr["remark"].(string)))
|
||||||
}
|
}
|
||||||
return links
|
return links
|
||||||
@@ -187,29 +216,17 @@ func hysteriaLink(
|
|||||||
|
|
||||||
for _, addr := range addrs {
|
for _, addr := range addrs {
|
||||||
params := map[string]string{}
|
params := map[string]string{}
|
||||||
if upmbps, ok := inbound["up_mbps"].(string); ok {
|
if upmbps, ok := inbound["up_mbps"].(float64); ok {
|
||||||
params["up_mbps"] = upmbps
|
params["downmbps"] = fmt.Sprintf("%.0f", upmbps)
|
||||||
}
|
}
|
||||||
if downmbps, ok := inbound["down_mbps"].(string); ok {
|
if downmbps, ok := inbound["down_mbps"].(float64); ok {
|
||||||
params["down_mbps"] = downmbps
|
params["upmbps"] = fmt.Sprintf("%.0f", downmbps)
|
||||||
}
|
}
|
||||||
if auth, ok := userConfig["auth_str"].(string); ok {
|
if auth, ok := userConfig["auth_str"].(string); ok {
|
||||||
params["auth"] = auth
|
params["auth"] = auth
|
||||||
}
|
}
|
||||||
if tls, ok := addr["tls"].(map[string]interface{}); ok {
|
if tls, ok := addr["tls"].(map[string]interface{}); ok {
|
||||||
if sni, ok := tls["server_name"].(string); ok {
|
getTlsParams(¶ms, tls, "insecure")
|
||||||
params["peer"] = sni
|
|
||||||
}
|
|
||||||
if alpn, ok := tls["alpn"].([]interface{}); ok {
|
|
||||||
alpnList := make([]string, len(alpn))
|
|
||||||
for i, v := range alpn {
|
|
||||||
alpnList[i] = v.(string)
|
|
||||||
}
|
|
||||||
params["alpn"] = strings.Join(alpnList, ",")
|
|
||||||
}
|
|
||||||
if insecure, ok := tls["insecure"].(bool); ok && insecure {
|
|
||||||
params["insecure"] = "1"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if obfs, ok := inbound["obfs"].(string); ok {
|
if obfs, ok := inbound["obfs"].(string); ok {
|
||||||
params["obfs"] = obfs
|
params["obfs"] = obfs
|
||||||
@@ -219,9 +236,18 @@ func hysteriaLink(
|
|||||||
} else {
|
} else {
|
||||||
params["fastopen"] = "0"
|
params["fastopen"] = "0"
|
||||||
}
|
}
|
||||||
|
var outJson map[string]interface{}
|
||||||
|
json.Unmarshal(inbound["out_json"].(json.RawMessage), &outJson)
|
||||||
|
if mport, ok := outJson["server_ports"].([]interface{}); ok {
|
||||||
|
mportList := make([]string, len(mport))
|
||||||
|
for i, v := range mport {
|
||||||
|
mportList[i] = v.(string)
|
||||||
|
}
|
||||||
|
params["mport"] = strings.Join(mportList, ",")
|
||||||
|
}
|
||||||
|
|
||||||
port, _ := addr["server_port"].(float64)
|
port, _ := addr["server_port"].(float64)
|
||||||
uri := fmt.Sprintf("%s%s:%d", baseUri, addr["server"].(string), uint(port))
|
uri := fmt.Sprintf("%s%s:%.0f", baseUri, addr["server"].(string), port)
|
||||||
links = append(links, addParams(uri, params, addr["remark"].(string)))
|
links = append(links, addParams(uri, params, addr["remark"].(string)))
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -239,26 +265,14 @@ func hysteria2Link(
|
|||||||
|
|
||||||
for _, addr := range addrs {
|
for _, addr := range addrs {
|
||||||
params := map[string]string{}
|
params := map[string]string{}
|
||||||
if upmbps, ok := inbound["up_mbps"].(string); ok {
|
if upmbps, ok := inbound["up_mbps"].(float64); ok {
|
||||||
params["up_mbps"] = upmbps
|
params["downmbps"] = fmt.Sprintf("%.0f", upmbps)
|
||||||
}
|
}
|
||||||
if downmbps, ok := inbound["down_mbps"].(string); ok {
|
if downmbps, ok := inbound["down_mbps"].(float64); ok {
|
||||||
params["down_mbps"] = downmbps
|
params["upmbps"] = fmt.Sprintf("%.0f", downmbps)
|
||||||
}
|
}
|
||||||
if tls, ok := addr["tls"].(map[string]interface{}); ok {
|
if tls, ok := addr["tls"].(map[string]interface{}); ok {
|
||||||
if sni, ok := tls["server_name"].(string); ok {
|
getTlsParams(¶ms, tls, "insecure")
|
||||||
params["sni"] = sni
|
|
||||||
}
|
|
||||||
if alpn, ok := tls["alpn"].([]interface{}); ok {
|
|
||||||
alpnList := make([]string, len(alpn))
|
|
||||||
for i, v := range alpn {
|
|
||||||
alpnList[i] = v.(string)
|
|
||||||
}
|
|
||||||
params["alpn"] = strings.Join(alpnList, ",")
|
|
||||||
}
|
|
||||||
if insecure, ok := tls["insecure"].(bool); ok && insecure {
|
|
||||||
params["insecure"] = "1"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if obfs, ok := inbound["obfs"].(map[string]interface{}); ok {
|
if obfs, ok := inbound["obfs"].(map[string]interface{}); ok {
|
||||||
if obfsType, ok := obfs["type"].(string); ok {
|
if obfsType, ok := obfs["type"].(string); ok {
|
||||||
@@ -273,9 +287,18 @@ func hysteria2Link(
|
|||||||
} else {
|
} else {
|
||||||
params["fastopen"] = "0"
|
params["fastopen"] = "0"
|
||||||
}
|
}
|
||||||
|
var outJson map[string]interface{}
|
||||||
|
json.Unmarshal(inbound["out_json"].(json.RawMessage), &outJson)
|
||||||
|
if mport, ok := outJson["server_ports"].([]interface{}); ok {
|
||||||
|
mportList := make([]string, len(mport))
|
||||||
|
for i, v := range mport {
|
||||||
|
mportList[i] = v.(string)
|
||||||
|
}
|
||||||
|
params["mport"] = strings.Join(mportList, ",")
|
||||||
|
}
|
||||||
|
|
||||||
port, _ := addr["server_port"].(float64)
|
port, _ := addr["server_port"].(float64)
|
||||||
uri := fmt.Sprintf("%s%s:%d", baseUri, addr["server"].(string), uint(port))
|
uri := fmt.Sprintf("%s%s:%.0f", baseUri, addr["server"].(string), port)
|
||||||
links = append(links, addParams(uri, params, addr["remark"].(string)))
|
links = append(links, addParams(uri, params, addr["remark"].(string)))
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -293,23 +316,11 @@ func anytlsLink(
|
|||||||
for _, addr := range addrs {
|
for _, addr := range addrs {
|
||||||
params := map[string]string{}
|
params := map[string]string{}
|
||||||
if tls, ok := addr["tls"].(map[string]interface{}); ok {
|
if tls, ok := addr["tls"].(map[string]interface{}); ok {
|
||||||
if sni, ok := tls["server_name"].(string); ok {
|
getTlsParams(¶ms, tls, "insecure")
|
||||||
params["sni"] = sni
|
|
||||||
}
|
|
||||||
if alpn, ok := tls["alpn"].([]interface{}); ok {
|
|
||||||
alpnList := make([]string, len(alpn))
|
|
||||||
for i, v := range alpn {
|
|
||||||
alpnList[i] = v.(string)
|
|
||||||
}
|
|
||||||
params["alpn"] = strings.Join(alpnList, ",")
|
|
||||||
}
|
|
||||||
if insecure, ok := tls["insecure"].(bool); ok && insecure {
|
|
||||||
params["insecure"] = "1"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
port, _ := addr["server_port"].(float64)
|
port, _ := addr["server_port"].(float64)
|
||||||
uri := fmt.Sprintf("%s%s:%d", baseUri, addr["server"].(string), uint(port))
|
uri := fmt.Sprintf("%s%s:%.0f", baseUri, addr["server"].(string), port)
|
||||||
links = append(links, addParams(uri, params, addr["remark"].(string)))
|
links = append(links, addParams(uri, params, addr["remark"].(string)))
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -329,29 +340,14 @@ func tuicLink(
|
|||||||
for _, addr := range addrs {
|
for _, addr := range addrs {
|
||||||
params := map[string]string{}
|
params := map[string]string{}
|
||||||
if tls, ok := addr["tls"].(map[string]interface{}); ok {
|
if tls, ok := addr["tls"].(map[string]interface{}); ok {
|
||||||
if sni, ok := tls["server_name"].(string); ok {
|
getTlsParams(¶ms, tls, "insecure")
|
||||||
params["sni"] = sni
|
|
||||||
}
|
|
||||||
if alpn, ok := tls["alpn"].([]interface{}); ok {
|
|
||||||
alpnList := make([]string, len(alpn))
|
|
||||||
for i, v := range alpn {
|
|
||||||
alpnList[i] = v.(string)
|
|
||||||
}
|
|
||||||
params["alpn"] = strings.Join(alpnList, ",")
|
|
||||||
}
|
|
||||||
if insecure, ok := tls["insecure"].(bool); ok && insecure {
|
|
||||||
params["insecure"] = "1"
|
|
||||||
}
|
|
||||||
if disableSni, ok := tls["disable_sni"].(bool); ok && disableSni {
|
|
||||||
params["disable_sni"] = "1"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if congestionControl, ok := inbound["congestion_control"].(string); ok {
|
if congestionControl, ok := inbound["congestion_control"].(string); ok {
|
||||||
params["congestion_control"] = congestionControl
|
params["congestion_control"] = congestionControl
|
||||||
}
|
}
|
||||||
|
|
||||||
port, _ := addr["server_port"].(float64)
|
port, _ := addr["server_port"].(float64)
|
||||||
uri := fmt.Sprintf("%s%s:%d", baseUri, addr["server"].(string), uint(port))
|
uri := fmt.Sprintf("%s%s:%.0f", baseUri, addr["server"].(string), port)
|
||||||
links = append(links, addParams(uri, params, addr["remark"].(string)))
|
links = append(links, addParams(uri, params, addr["remark"].(string)))
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -370,39 +366,13 @@ func vlessLink(
|
|||||||
for _, addr := range addrs {
|
for _, addr := range addrs {
|
||||||
params := baseParams
|
params := baseParams
|
||||||
if tls, ok := addr["tls"].(map[string]interface{}); ok && tls["enabled"].(bool) {
|
if tls, ok := addr["tls"].(map[string]interface{}); ok && tls["enabled"].(bool) {
|
||||||
if reality, ok := tls["reality"].(map[string]interface{}); ok && reality["enabled"].(bool) {
|
getTlsParams(¶ms, tls, "allowInsecure")
|
||||||
params["security"] = "reality"
|
|
||||||
if pbk, ok := reality["public_key"].(string); ok {
|
|
||||||
params["pbk"] = pbk
|
|
||||||
}
|
|
||||||
if sid, ok := reality["short_id"].(string); ok {
|
|
||||||
params["sid"] = sid
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
params["security"] = "tls"
|
|
||||||
if insecure, ok := tls["insecure"].(bool); ok && insecure {
|
|
||||||
params["allowInsecure"] = "1"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if flow, ok := userConfig["flow"].(string); ok {
|
if flow, ok := userConfig["flow"].(string); ok {
|
||||||
params["flow"] = flow
|
params["flow"] = flow
|
||||||
}
|
}
|
||||||
if utls, ok := tls["utls"].(map[string]interface{}); ok {
|
|
||||||
params["fp"], _ = utls["fingerprint"].(string)
|
|
||||||
}
|
|
||||||
if sni, ok := tls["server_name"].(string); ok {
|
|
||||||
params["sni"] = sni
|
|
||||||
}
|
|
||||||
if alpn, ok := tls["alpn"].([]interface{}); ok {
|
|
||||||
alpnList := make([]string, len(alpn))
|
|
||||||
for i, v := range alpn {
|
|
||||||
alpnList[i] = v.(string)
|
|
||||||
}
|
|
||||||
params["alpn"] = strings.Join(alpnList, ",")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
port, _ := addr["server_port"].(float64)
|
port, _ := addr["server_port"].(float64)
|
||||||
uri := fmt.Sprintf("vless://%s@%s:%d", uuid, addr["server"].(string), uint(port))
|
uri := fmt.Sprintf("vless://%s@%s:%.0f", uuid, addr["server"].(string), port)
|
||||||
uri = addParams(uri, params, addr["remark"].(string))
|
uri = addParams(uri, params, addr["remark"].(string))
|
||||||
links = append(links, uri)
|
links = append(links, uri)
|
||||||
}
|
}
|
||||||
@@ -421,36 +391,10 @@ func trojanLink(
|
|||||||
for _, addr := range addrs {
|
for _, addr := range addrs {
|
||||||
params := baseParams
|
params := baseParams
|
||||||
if tls, ok := addr["tls"].(map[string]interface{}); ok && tls["enabled"].(bool) {
|
if tls, ok := addr["tls"].(map[string]interface{}); ok && tls["enabled"].(bool) {
|
||||||
if reality, ok := tls["reality"].(map[string]interface{}); ok && reality["enabled"].(bool) {
|
getTlsParams(¶ms, tls, "allowInsecure")
|
||||||
params["security"] = "reality"
|
|
||||||
if pbk, ok := reality["public_key"].(string); ok {
|
|
||||||
params["pbk"] = pbk
|
|
||||||
}
|
|
||||||
if sid, ok := reality["short_id"].(string); ok {
|
|
||||||
params["sid"] = sid
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
params["security"] = "tls"
|
|
||||||
if insecure, ok := tls["insecure"].(bool); ok && insecure {
|
|
||||||
params["allowInsecure"] = "1"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if utls, ok := tls["utls"].(map[string]interface{}); ok {
|
|
||||||
params["fp"], _ = utls["fingerprint"].(string)
|
|
||||||
}
|
|
||||||
if sni, ok := tls["server_name"].(string); ok {
|
|
||||||
params["sni"] = sni
|
|
||||||
}
|
|
||||||
if alpn, ok := tls["alpn"].([]interface{}); ok {
|
|
||||||
alpnList := make([]string, len(alpn))
|
|
||||||
for i, v := range alpn {
|
|
||||||
alpnList[i] = v.(string)
|
|
||||||
}
|
|
||||||
params["alpn"] = strings.Join(alpnList, ",")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
port, _ := addr["server_port"].(float64)
|
port, _ := addr["server_port"].(float64)
|
||||||
uri := fmt.Sprintf("trojan://%s@%s:%d", password, addr["server"].(string), uint(port))
|
uri := fmt.Sprintf("trojan://%s@%s:%.0f", password, addr["server"].(string), port)
|
||||||
uri = addParams(uri, params, addr["remark"].(string))
|
uri = addParams(uri, params, addr["remark"].(string))
|
||||||
links = append(links, uri)
|
links = append(links, uri)
|
||||||
}
|
}
|
||||||
@@ -501,6 +445,13 @@ func vmessLink(
|
|||||||
if sni, ok := tls["server_name"].(string); ok {
|
if sni, ok := tls["server_name"].(string); ok {
|
||||||
obj["sni"] = sni
|
obj["sni"] = sni
|
||||||
}
|
}
|
||||||
|
if alpn, ok := tls["alpn"].([]interface{}); ok {
|
||||||
|
alpnList := make([]string, len(alpn))
|
||||||
|
for i, v := range alpn {
|
||||||
|
alpnList[i] = v.(string)
|
||||||
|
}
|
||||||
|
obj["alpn"] = strings.Join(alpnList, ",")
|
||||||
|
}
|
||||||
if utls, ok := tls["utls"].(map[string]interface{}); ok {
|
if utls, ok := tls["utls"].(map[string]interface{}); ok {
|
||||||
obj["fp"], _ = utls["fingerprint"].(string)
|
obj["fp"], _ = utls["fingerprint"].(string)
|
||||||
}
|
}
|
||||||
@@ -522,11 +473,16 @@ func toBase64(d []byte) string {
|
|||||||
|
|
||||||
func addParams(uri string, params map[string]string, remark string) string {
|
func addParams(uri string, params map[string]string, remark string) string {
|
||||||
URL, _ := url.Parse(uri)
|
URL, _ := url.Parse(uri)
|
||||||
q := URL.Query()
|
var q []string
|
||||||
for k, v := range params {
|
for k, v := range params {
|
||||||
q.Add(k, v)
|
switch k {
|
||||||
|
case "mport", "alpn":
|
||||||
|
q = append(q, fmt.Sprintf("%s=%s", k, v))
|
||||||
|
default:
|
||||||
|
q = append(q, fmt.Sprintf("%s=%s", k, url.QueryEscape(v)))
|
||||||
}
|
}
|
||||||
URL.RawQuery = q.Encode()
|
}
|
||||||
|
URL.RawQuery = strings.Join(q, "&")
|
||||||
URL.Fragment = remark
|
URL.Fragment = remark
|
||||||
return URL.String()
|
return URL.String()
|
||||||
}
|
}
|
||||||
@@ -576,22 +532,35 @@ func getTransportParams(t interface{}) map[string]string {
|
|||||||
return params
|
return params
|
||||||
}
|
}
|
||||||
|
|
||||||
func getTlsParams(t interface{}) map[string]string {
|
func getTlsParams(params *map[string]string, tls map[string]interface{}, insecureKey string) {
|
||||||
params := map[string]string{}
|
if reality, ok := tls["reality"].(map[string]interface{}); ok && reality["enabled"].(bool) {
|
||||||
if tls, hasTls := t.(map[string]interface{}); hasTls {
|
(*params)["security"] = "reality"
|
||||||
|
if pbk, ok := reality["public_key"].(string); ok {
|
||||||
|
(*params)["pbk"] = pbk
|
||||||
|
}
|
||||||
|
if sid, ok := reality["short_id"].(string); ok {
|
||||||
|
(*params)["sid"] = sid
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
(*params)["security"] = "tls"
|
||||||
|
if insecure, ok := tls["insecure"].(bool); ok && insecure {
|
||||||
|
(*params)[insecureKey] = "1"
|
||||||
|
}
|
||||||
|
if disableSni, ok := tls["disable_sni"].(bool); ok && disableSni {
|
||||||
|
(*params)["disable_sni"] = "1"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if utls, ok := tls["utls"].(map[string]interface{}); ok {
|
||||||
|
(*params)["fp"], _ = utls["fingerprint"].(string)
|
||||||
|
}
|
||||||
if sni, ok := tls["server_name"].(string); ok {
|
if sni, ok := tls["server_name"].(string); ok {
|
||||||
params["sni"] = sni
|
(*params)["sni"] = sni
|
||||||
}
|
}
|
||||||
if alpn, ok := tls["alpn"].([]interface{}); ok {
|
if alpn, ok := tls["alpn"].([]interface{}); ok {
|
||||||
alpnList := make([]string, len(alpn))
|
alpnList := make([]string, len(alpn))
|
||||||
for i, v := range alpn {
|
for i, v := range alpn {
|
||||||
alpnList[i] = v.(string)
|
alpnList[i] = v.(string)
|
||||||
}
|
}
|
||||||
params["alpn"] = strings.Join(alpnList, ",")
|
(*params)["alpn"] = strings.Join(alpnList, ",")
|
||||||
}
|
|
||||||
if insecure, ok := tls["insecure"].(bool); ok && insecure {
|
|
||||||
params["insecure"] = "1"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return params
|
|
||||||
}
|
|
||||||
|
|||||||
+13
-4
@@ -435,7 +435,7 @@ func ss(u *url.URL, i int) (*map[string]interface{}, string, error) {
|
|||||||
return &ss, tag, nil
|
return &ss, tag, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func getTransport(tp_type string, q *url.Values) *map[string]interface{} {
|
func getTransport(tp_type string, q *url.Values) map[string]interface{} {
|
||||||
transport := map[string]interface{}{}
|
transport := map[string]interface{}{}
|
||||||
tp_host := q.Get("host")
|
tp_host := q.Get("host")
|
||||||
tp_path := q.Get("path")
|
tp_path := q.Get("path")
|
||||||
@@ -472,15 +472,16 @@ func getTransport(tp_type string, q *url.Values) *map[string]interface{} {
|
|||||||
transport["path"] = tp_path
|
transport["path"] = tp_path
|
||||||
transport["host"] = tp_host
|
transport["host"] = tp_host
|
||||||
}
|
}
|
||||||
return &transport
|
return transport
|
||||||
}
|
}
|
||||||
|
|
||||||
func getTls(security string, q *url.Values) *map[string]interface{} {
|
func getTls(security string, q *url.Values) map[string]interface{} {
|
||||||
tls := map[string]interface{}{}
|
tls := map[string]interface{}{}
|
||||||
tls_fp := q.Get("fp")
|
tls_fp := q.Get("fp")
|
||||||
tls_sni := q.Get("sni")
|
tls_sni := q.Get("sni")
|
||||||
tls_insecure := q.Get("allowInsecure")
|
tls_insecure := q.Get("allowInsecure")
|
||||||
tls_alpn := q.Get("alpn")
|
tls_alpn := q.Get("alpn")
|
||||||
|
tls_ech := q.Get("ech")
|
||||||
switch security {
|
switch security {
|
||||||
case "tls":
|
case "tls":
|
||||||
tls["enabled"] = true
|
tls["enabled"] = true
|
||||||
@@ -507,5 +508,13 @@ func getTls(security string, q *url.Values) *map[string]interface{} {
|
|||||||
"fingerprint": tls_fp,
|
"fingerprint": tls_fp,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return &tls
|
if len(tls_ech) > 0 {
|
||||||
|
tls["ech"] = map[string]interface{}{
|
||||||
|
"enabled": true,
|
||||||
|
"config": []string{
|
||||||
|
tls_ech,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return tls
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-1
@@ -42,7 +42,6 @@ func FillOutJson(i *model.Inbound, hostname string) error {
|
|||||||
case "http", "socks", "mixed", "anytls":
|
case "http", "socks", "mixed", "anytls":
|
||||||
case "shadowsocks":
|
case "shadowsocks":
|
||||||
shadowsocksOut(&outJson, *inbound)
|
shadowsocksOut(&outJson, *inbound)
|
||||||
return nil
|
|
||||||
case "shadowtls":
|
case "shadowtls":
|
||||||
shadowTlsOut(&outJson, *inbound)
|
shadowTlsOut(&outJson, *inbound)
|
||||||
case "hysteria":
|
case "hysteria":
|
||||||
@@ -98,6 +97,9 @@ func addTls(out *map[string]interface{}, tls *model.Tls) {
|
|||||||
if maxVersion, ok := tlsServer["max_version"]; ok {
|
if maxVersion, ok := tlsServer["max_version"]; ok {
|
||||||
tlsConfig["max_version"] = maxVersion
|
tlsConfig["max_version"] = maxVersion
|
||||||
}
|
}
|
||||||
|
if certificate, ok := tlsServer["certificate"]; ok {
|
||||||
|
tlsConfig["certificate"] = certificate
|
||||||
|
}
|
||||||
if cipherSuites, ok := tlsServer["cipher_suites"]; ok {
|
if cipherSuites, ok := tlsServer["cipher_suites"]; ok {
|
||||||
tlsConfig["cipher_suites"] = cipherSuites
|
tlsConfig["cipher_suites"] = cipherSuites
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
# Windows Files
|
||||||
|
|
||||||
|
This directory contains all Windows-specific files for S-UI.
|
||||||
|
|
||||||
|
## Available Files:
|
||||||
|
|
||||||
|
- **s-ui-windows.xml**: Windows Service configuration
|
||||||
|
- **install-windows.bat**: Installation script
|
||||||
|
- **s-ui-windows.bat**: Control panel
|
||||||
|
- **uninstall-windows.bat**: Uninstallation script
|
||||||
|
- **build-windows.bat**: Simple build script for CMD
|
||||||
|
- **build-windows.ps1**: Advanced build script for PowerShell
|
||||||
|
|
||||||
|
## Usage:
|
||||||
|
|
||||||
|
To install S-UI on Windows:
|
||||||
|
1. Run `install-windows.bat` as Administrator
|
||||||
|
2. Follow the installation wizard
|
||||||
|
3. Use `s-ui-windows.bat` for management
|
||||||
|
|
||||||
|
To build from source:
|
||||||
|
- With CMD: `build-windows.bat`
|
||||||
|
- With PowerShell: `.\build-windows.ps1`
|
||||||
@@ -0,0 +1,71 @@
|
|||||||
|
@echo off
|
||||||
|
setlocal enabledelayedexpansion
|
||||||
|
|
||||||
|
echo Building S-UI for Windows...
|
||||||
|
|
||||||
|
REM Check if Go is installed
|
||||||
|
go version >nul 2>&1
|
||||||
|
if errorlevel 1 (
|
||||||
|
echo Error: Go is not installed or not in PATH
|
||||||
|
echo Please install Go from https://golang.org/dl/
|
||||||
|
pause
|
||||||
|
exit /b 1
|
||||||
|
)
|
||||||
|
|
||||||
|
REM Check if Node.js is installed
|
||||||
|
node --version >nul 2>&1
|
||||||
|
if errorlevel 1 (
|
||||||
|
echo Error: Node.js is not installed or not in PATH
|
||||||
|
echo Please install Node.js from https://nodejs.org/
|
||||||
|
pause
|
||||||
|
exit /b 1
|
||||||
|
)
|
||||||
|
|
||||||
|
echo Building frontend...
|
||||||
|
cd frontend
|
||||||
|
call npm install
|
||||||
|
if errorlevel 1 (
|
||||||
|
echo Error: Failed to install frontend dependencies
|
||||||
|
pause
|
||||||
|
exit /b 1
|
||||||
|
)
|
||||||
|
|
||||||
|
call npm run build
|
||||||
|
if errorlevel 1 (
|
||||||
|
echo Error: Failed to build frontend
|
||||||
|
pause
|
||||||
|
exit /b 1
|
||||||
|
)
|
||||||
|
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
echo Creating web/html directory...
|
||||||
|
if not exist "web\html" mkdir "web\html"
|
||||||
|
|
||||||
|
echo Copying frontend build files...
|
||||||
|
xcopy "frontend\dist\*" "web\html\" /E /Y /Q
|
||||||
|
|
||||||
|
echo Building backend...
|
||||||
|
set CGO_ENABLED=1
|
||||||
|
set GOOS=windows
|
||||||
|
set GOARCH=amd64
|
||||||
|
|
||||||
|
REM Try to build with CGO first
|
||||||
|
go build -ldflags "-w -s" -tags "with_quic,with_grpc,with_utls,with_acme,with_gvisor" -o sui.exe main.go
|
||||||
|
if errorlevel 1 (
|
||||||
|
echo Warning: CGO build failed, trying without CGO...
|
||||||
|
set CGO_ENABLED=0
|
||||||
|
go build -ldflags "-w -s" -tags "with_quic,with_grpc,with_utls,with_acme,with_gvisor" -o sui.exe main.go
|
||||||
|
if errorlevel 1 (
|
||||||
|
echo Error: Failed to build backend
|
||||||
|
pause
|
||||||
|
exit /b 1
|
||||||
|
)
|
||||||
|
echo Built without CGO (some features may be limited)
|
||||||
|
) else (
|
||||||
|
echo Built with CGO
|
||||||
|
)
|
||||||
|
|
||||||
|
echo Build completed successfully!
|
||||||
|
echo Output: sui.exe
|
||||||
|
pause
|
||||||
@@ -0,0 +1,138 @@
|
|||||||
|
# PowerShell script for building S-UI on Windows
|
||||||
|
param(
|
||||||
|
[string]$Architecture = "amd64",
|
||||||
|
[switch]$NoCGO,
|
||||||
|
[switch]$Help
|
||||||
|
)
|
||||||
|
|
||||||
|
if ($Help) {
|
||||||
|
Write-Host "Usage: .\build-windows.ps1 [-Architecture <arch>] [-NoCGO] [-Help]"
|
||||||
|
Write-Host "Architectures: amd64, 386, arm64"
|
||||||
|
Write-Host "Examples:"
|
||||||
|
Write-Host " .\build-windows.ps1 # Build for amd64 with CGO"
|
||||||
|
Write-Host " .\build-windows.ps1 -Architecture 386 # Build for 32-bit Windows"
|
||||||
|
Write-Host " .\build-windows.ps1 -NoCGO # Build without CGO"
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host "Building S-UI for Windows ($Architecture)..." -ForegroundColor Green
|
||||||
|
|
||||||
|
# Check if Go is installed
|
||||||
|
try {
|
||||||
|
$goVersion = go version 2>$null
|
||||||
|
if ($LASTEXITCODE -ne 0) {
|
||||||
|
throw "Go not found"
|
||||||
|
}
|
||||||
|
Write-Host "Go version: $goVersion" -ForegroundColor Green
|
||||||
|
} catch {
|
||||||
|
Write-Host "Error: Go is not installed or not in PATH" -ForegroundColor Red
|
||||||
|
Write-Host "Please install Go from https://golang.org/dl/" -ForegroundColor Yellow
|
||||||
|
Read-Host "Press Enter to exit"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# Check if Node.js is installed
|
||||||
|
try {
|
||||||
|
$nodeVersion = node --version 2>$null
|
||||||
|
if ($LASTEXITCODE -ne 0) {
|
||||||
|
throw "Node.js not found"
|
||||||
|
}
|
||||||
|
Write-Host "Node.js version: $nodeVersion" -ForegroundColor Green
|
||||||
|
} catch {
|
||||||
|
Write-Host "Error: Node.js is not installed or not in PATH" -ForegroundColor Red
|
||||||
|
Write-Host "Please install Node.js from https://nodejs.org/" -ForegroundColor Yellow
|
||||||
|
Read-Host "Press Enter to exit"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# Build frontend
|
||||||
|
Write-Host "Building frontend..." -ForegroundColor Yellow
|
||||||
|
Push-Location frontend
|
||||||
|
|
||||||
|
try {
|
||||||
|
Write-Host "Installing dependencies..." -ForegroundColor Cyan
|
||||||
|
npm install
|
||||||
|
if ($LASTEXITCODE -ne 0) {
|
||||||
|
throw "Failed to install frontend dependencies"
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host "Building frontend..." -ForegroundColor Cyan
|
||||||
|
npm run build
|
||||||
|
if ($LASTEXITCODE -ne 0) {
|
||||||
|
throw "Failed to build frontend"
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
Write-Host "Error: $_" -ForegroundColor Red
|
||||||
|
Pop-Location
|
||||||
|
Read-Host "Press Enter to exit"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
Pop-Location
|
||||||
|
|
||||||
|
# Create web/html directory
|
||||||
|
Write-Host "Creating web/html directory..." -ForegroundColor Yellow
|
||||||
|
if (!(Test-Path "web\html")) {
|
||||||
|
New-Item -ItemType Directory -Path "web\html" -Force | Out-Null
|
||||||
|
}
|
||||||
|
|
||||||
|
# Copy frontend build files
|
||||||
|
Write-Host "Copying frontend build files..." -ForegroundColor Yellow
|
||||||
|
Copy-Item "frontend\dist\*" "web\html\" -Recurse -Force
|
||||||
|
|
||||||
|
# Build backend
|
||||||
|
Write-Host "Building backend..." -ForegroundColor Yellow
|
||||||
|
|
||||||
|
# Set environment variables
|
||||||
|
$env:GOOS = "windows"
|
||||||
|
$env:GOARCH = $Architecture
|
||||||
|
|
||||||
|
if ($NoCGO) {
|
||||||
|
$env:CGO_ENABLED = "0"
|
||||||
|
Write-Host "Building without CGO..." -ForegroundColor Yellow
|
||||||
|
} else {
|
||||||
|
$env:CGO_ENABLED = "1"
|
||||||
|
Write-Host "Building with CGO..." -ForegroundColor Yellow
|
||||||
|
}
|
||||||
|
|
||||||
|
# Build command
|
||||||
|
$buildCmd = "go build -ldflags `"-w -s`" -tags `"with_quic,with_grpc,with_utls,with_acme,with_gvisor`" -o sui.exe main.go"
|
||||||
|
|
||||||
|
try {
|
||||||
|
Invoke-Expression $buildCmd
|
||||||
|
if ($LASTEXITCODE -ne 0) {
|
||||||
|
if (!$NoCGO) {
|
||||||
|
Write-Host "CGO build failed, trying without CGO..." -ForegroundColor Yellow
|
||||||
|
$env:CGO_ENABLED = "0"
|
||||||
|
Invoke-Expression $buildCmd
|
||||||
|
if ($LASTEXITCODE -ne 0) {
|
||||||
|
throw "Failed to build backend even without CGO"
|
||||||
|
}
|
||||||
|
Write-Host "Built without CGO (some features may be limited)" -ForegroundColor Yellow
|
||||||
|
} else {
|
||||||
|
throw "Failed to build backend"
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ($env:CGO_ENABLED -eq "1") {
|
||||||
|
Write-Host "Built successfully with CGO" -ForegroundColor Green
|
||||||
|
} else {
|
||||||
|
Write-Host "Built successfully without CGO" -ForegroundColor Green
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
Write-Host "Error: $_" -ForegroundColor Red
|
||||||
|
Read-Host "Press Enter to exit"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host "Build completed successfully!" -ForegroundColor Green
|
||||||
|
Write-Host "Output: sui.exe" -ForegroundColor Green
|
||||||
|
|
||||||
|
# Show file info
|
||||||
|
if (Test-Path "sui.exe") {
|
||||||
|
$fileInfo = Get-Item "sui.exe"
|
||||||
|
Write-Host "File size: $([math]::Round($fileInfo.Length / 1MB, 2)) MB" -ForegroundColor Cyan
|
||||||
|
Write-Host "Created: $($fileInfo.CreationTime)" -ForegroundColor Cyan
|
||||||
|
}
|
||||||
|
|
||||||
|
Read-Host "Press Enter to exit"
|
||||||
@@ -0,0 +1,194 @@
|
|||||||
|
@echo off
|
||||||
|
setlocal enabledelayedexpansion
|
||||||
|
|
||||||
|
echo ========================================
|
||||||
|
echo S-UI Windows Installer
|
||||||
|
echo ========================================
|
||||||
|
|
||||||
|
REM Check if running as Administrator
|
||||||
|
net session >nul 2>&1
|
||||||
|
if %errorLevel% neq 0 (
|
||||||
|
echo Error: This script must be run as Administrator
|
||||||
|
echo Right-click on this file and select "Run as administrator"
|
||||||
|
pause
|
||||||
|
exit /b 1
|
||||||
|
)
|
||||||
|
|
||||||
|
REM Set installation directory
|
||||||
|
set "INSTALL_DIR=C:\Program Files\s-ui"
|
||||||
|
set "SERVICE_NAME=s-ui"
|
||||||
|
|
||||||
|
echo Installing S-UI to: %INSTALL_DIR%
|
||||||
|
|
||||||
|
REM Create installation directory
|
||||||
|
if not exist "%INSTALL_DIR%" mkdir "%INSTALL_DIR%"
|
||||||
|
if not exist "%INSTALL_DIR%\db" mkdir "%INSTALL_DIR%\db"
|
||||||
|
if not exist "%INSTALL_DIR%\logs" mkdir "%INSTALL_DIR%\logs"
|
||||||
|
if not exist "%INSTALL_DIR%\cert" mkdir "%INSTALL_DIR%\cert"
|
||||||
|
|
||||||
|
REM Copy files
|
||||||
|
echo Copying files...
|
||||||
|
copy "sui.exe" "%INSTALL_DIR%\" >nul
|
||||||
|
copy "s-ui-windows.xml" "%INSTALL_DIR%\" >nul
|
||||||
|
copy "s-ui-windows.bat" "%INSTALL_DIR%\" >nul
|
||||||
|
|
||||||
|
REM Check if WinSW is available
|
||||||
|
set "WINSW_PATH=%INSTALL_DIR%\winsw.exe"
|
||||||
|
if not exist "%WINSW_PATH%" (
|
||||||
|
echo Downloading WinSW...
|
||||||
|
powershell -Command "& {Invoke-WebRequest -Uri 'https://github.com/winsw/winsw/releases/download/v2.12.0/WinSW-x64.exe' -OutFile '%WINSW_PATH%'}"
|
||||||
|
if exist "%WINSW_PATH%" (
|
||||||
|
echo WinSW downloaded successfully
|
||||||
|
) else (
|
||||||
|
echo Warning: Failed to download WinSW. Service installation will be skipped.
|
||||||
|
echo You can manually download WinSW from: https://github.com/winsw/winsw/releases
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
REM Install Windows Service
|
||||||
|
if exist "%WINSW_PATH%" (
|
||||||
|
echo Installing Windows Service...
|
||||||
|
cd /d "%INSTALL_DIR%"
|
||||||
|
copy "winsw.exe" "s-ui-service.exe" >nul
|
||||||
|
copy "s-ui-windows.xml" "s-ui-service.xml" >nul
|
||||||
|
|
||||||
|
REM Install service
|
||||||
|
s-ui-service.exe install
|
||||||
|
if %errorLevel% equ 0 (
|
||||||
|
echo Service installed successfully
|
||||||
|
) else (
|
||||||
|
echo Warning: Failed to install service. You can install it manually later.
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
REM Run migration
|
||||||
|
echo Running database migration...
|
||||||
|
cd /d "%INSTALL_DIR%"
|
||||||
|
sui.exe migrate
|
||||||
|
if %errorLevel% equ 0 (
|
||||||
|
echo Migration completed successfully
|
||||||
|
) else (
|
||||||
|
echo Warning: Migration failed or database is new
|
||||||
|
)
|
||||||
|
|
||||||
|
REM Get network configuration
|
||||||
|
echo.
|
||||||
|
echo ========================================
|
||||||
|
echo Network Configuration
|
||||||
|
echo ========================================
|
||||||
|
|
||||||
|
REM Get local IP addresses
|
||||||
|
echo Available IP addresses:
|
||||||
|
for /f "tokens=2 delims=:" %%i in ('ipconfig ^| findstr /i "IPv4"') do (
|
||||||
|
echo %%i
|
||||||
|
)
|
||||||
|
|
||||||
|
REM Get panel configuration
|
||||||
|
echo.
|
||||||
|
set /p panel_port="Enter panel port (default: 2095): "
|
||||||
|
if "%panel_port%"=="" set "panel_port=2095"
|
||||||
|
|
||||||
|
set /p panel_path="Enter panel path (default: /app/): "
|
||||||
|
if "%panel_path%"=="" set "panel_path=/app/"
|
||||||
|
|
||||||
|
set /p sub_port="Enter subscription port (default: 2096): "
|
||||||
|
if "%sub_port%"=="" set "sub_port=2096"
|
||||||
|
|
||||||
|
set /p sub_path="Enter subscription path (default: /sub/): "
|
||||||
|
if "%sub_path%"=="" set "sub_path=/sub/"
|
||||||
|
|
||||||
|
REM Apply settings
|
||||||
|
echo.
|
||||||
|
echo Applying settings...
|
||||||
|
cd /d "%INSTALL_DIR%"
|
||||||
|
sui.exe setting -port %panel_port% -path "%panel_path%" -subPort %sub_port% -subPath "%sub_path%"
|
||||||
|
|
||||||
|
REM Get admin credentials
|
||||||
|
echo.
|
||||||
|
echo ========================================
|
||||||
|
echo Admin Configuration
|
||||||
|
echo ========================================
|
||||||
|
|
||||||
|
set /p admin_username="Enter admin username (default: admin): "
|
||||||
|
if "%admin_username%"=="" set "admin_username=admin"
|
||||||
|
|
||||||
|
set /p admin_password="Enter admin password: "
|
||||||
|
if "%admin_password%"=="" (
|
||||||
|
echo Error: Password cannot be empty
|
||||||
|
pause
|
||||||
|
exit /b 1
|
||||||
|
)
|
||||||
|
|
||||||
|
REM Set admin credentials
|
||||||
|
echo Setting admin credentials...
|
||||||
|
sui.exe admin -username "%admin_username%" -password "%admin_password%"
|
||||||
|
|
||||||
|
REM Start service
|
||||||
|
echo Starting S-UI service...
|
||||||
|
net start %SERVICE_NAME%
|
||||||
|
if %errorLevel% equ 0 (
|
||||||
|
echo Service started successfully
|
||||||
|
) else (
|
||||||
|
echo Warning: Failed to start service. You can start it manually later.
|
||||||
|
)
|
||||||
|
|
||||||
|
REM Create desktop shortcut
|
||||||
|
echo Creating desktop shortcut...
|
||||||
|
set "DESKTOP=%USERPROFILE%\Desktop"
|
||||||
|
if exist "%DESKTOP%" (
|
||||||
|
powershell -Command "& {$WshShell = New-Object -comObject WScript.Shell; $Shortcut = $WshShell.CreateShortcut('%DESKTOP%\S-UI.lnk'); $Shortcut.TargetPath = '%INSTALL_DIR%\s-ui-windows.bat'; $Shortcut.WorkingDirectory = '%INSTALL_DIR%'; $Shortcut.Description = 'S-UI Control Panel'; $Shortcut.Save()}"
|
||||||
|
echo Desktop shortcut created
|
||||||
|
)
|
||||||
|
|
||||||
|
REM Create Start Menu shortcut
|
||||||
|
echo Creating Start Menu shortcut...
|
||||||
|
set "START_MENU=%APPDATA%\Microsoft\Windows\Start Menu\Programs"
|
||||||
|
if exist "%START_MENU%" (
|
||||||
|
if not exist "%START_MENU%\S-UI" mkdir "%START_MENU%\S-UI"
|
||||||
|
powershell -Command "& {$WshShell = New-Object -comObject WScript.Shell; $Shortcut = $WshShell.CreateShortcut('%START_MENU%\S-UI\S-UI Control Panel.lnk'); $Shortcut.TargetPath = '%INSTALL_DIR%\s-ui-windows.bat'; $Shortcut.WorkingDirectory = '%INSTALL_DIR%'; $Shortcut.Description = 'S-UI Control Panel'; $Shortcut.Save()}"
|
||||||
|
echo Start Menu shortcut created
|
||||||
|
)
|
||||||
|
|
||||||
|
REM Set permissions
|
||||||
|
echo Setting permissions...
|
||||||
|
icacls "%INSTALL_DIR%" /grant "Users:(OI)(CI)RX" /T >nul
|
||||||
|
icacls "%INSTALL_DIR%\db" /grant "Users:(OI)(CI)F" /T >nul
|
||||||
|
icacls "%INSTALL_DIR%\logs" /grant "Users:(OI)(CI)F" /T >nul
|
||||||
|
|
||||||
|
REM Create environment variable
|
||||||
|
echo Setting environment variable...
|
||||||
|
setx SUI_HOME "%INSTALL_DIR%" /M >nul
|
||||||
|
|
||||||
|
REM Show final configuration
|
||||||
|
echo.
|
||||||
|
echo ========================================
|
||||||
|
echo Installation completed successfully!
|
||||||
|
echo ========================================
|
||||||
|
echo.
|
||||||
|
echo S-UI has been installed to: %INSTALL_DIR%
|
||||||
|
echo.
|
||||||
|
echo Configuration:
|
||||||
|
echo Panel Port: %panel_port%
|
||||||
|
echo Panel Path: %panel_path%
|
||||||
|
echo Subscription Port: %sub_port%
|
||||||
|
echo Subscription Path: %sub_path%
|
||||||
|
echo Admin Username: %admin_username%
|
||||||
|
echo.
|
||||||
|
echo Access URLs:
|
||||||
|
for /f "tokens=2 delims=:" %%i in ('ipconfig ^| findstr /i "IPv4"') do (
|
||||||
|
set "ip=%%i"
|
||||||
|
set "ip=!ip: =!"
|
||||||
|
echo Panel: http://!ip!:%panel_port%%panel_path%
|
||||||
|
echo Subscription: http://!ip!:%sub_port%%sub_path%
|
||||||
|
)
|
||||||
|
echo.
|
||||||
|
echo Service name: %SERVICE_NAME%
|
||||||
|
echo.
|
||||||
|
echo Useful commands:
|
||||||
|
echo net start %SERVICE_NAME% - Start the service
|
||||||
|
echo net stop %SERVICE_NAME% - Stop the service
|
||||||
|
echo sc query %SERVICE_NAME% - Check service status
|
||||||
|
echo.
|
||||||
|
echo You can also use the desktop shortcut or Start Menu item.
|
||||||
|
echo.
|
||||||
|
pause
|
||||||
@@ -0,0 +1,236 @@
|
|||||||
|
@echo off
|
||||||
|
setlocal enabledelayedexpansion
|
||||||
|
|
||||||
|
REM S-UI Windows Control Script
|
||||||
|
REM This script provides a menu-driven interface for managing S-UI on Windows
|
||||||
|
|
||||||
|
set "SERVICE_NAME=s-ui"
|
||||||
|
set "INSTALL_DIR=%SUI_HOME%"
|
||||||
|
if "%INSTALL_DIR%"=="" set "INSTALL_DIR=C:\Program Files\s-ui"
|
||||||
|
|
||||||
|
:menu
|
||||||
|
cls
|
||||||
|
echo ========================================
|
||||||
|
echo S-UI Windows Control Panel
|
||||||
|
echo ========================================
|
||||||
|
echo.
|
||||||
|
echo Current directory: %INSTALL_DIR%
|
||||||
|
echo.
|
||||||
|
echo 1. Start S-UI Service
|
||||||
|
echo 2. Stop S-UI Service
|
||||||
|
echo 3. Restart S-UI Service
|
||||||
|
echo 4. Check Service Status
|
||||||
|
echo 5. View Service Logs
|
||||||
|
echo 6. Open Panel in Browser
|
||||||
|
echo 7. Run S-UI Manually
|
||||||
|
echo 8. Install/Uninstall Service
|
||||||
|
echo 9. Open Installation Directory
|
||||||
|
echo 10. Show Configuration
|
||||||
|
echo 11. Show Access URLs
|
||||||
|
echo 0. Exit
|
||||||
|
echo.
|
||||||
|
echo ========================================
|
||||||
|
|
||||||
|
set /p choice="Please select an option [0-11]: "
|
||||||
|
|
||||||
|
if "%choice%"=="1" goto start_service
|
||||||
|
if "%choice%"=="2" goto stop_service
|
||||||
|
if "%choice%"=="3" goto restart_service
|
||||||
|
if "%choice%"=="4" goto check_status
|
||||||
|
if "%choice%"=="5" goto view_logs
|
||||||
|
if "%choice%"=="6" goto open_panel
|
||||||
|
if "%choice%"=="7" goto run_manual
|
||||||
|
if "%choice%"=="8" goto service_management
|
||||||
|
if "%choice%"=="9" goto open_directory
|
||||||
|
if "%choice%"=="10" goto show_config
|
||||||
|
if "%choice%"=="11" goto show_urls
|
||||||
|
if "%choice%"=="0" goto exit
|
||||||
|
goto invalid_choice
|
||||||
|
|
||||||
|
:start_service
|
||||||
|
echo Starting S-UI service...
|
||||||
|
net start %SERVICE_NAME%
|
||||||
|
if %errorLevel% equ 0 (
|
||||||
|
echo Service started successfully!
|
||||||
|
) else (
|
||||||
|
echo Failed to start service. Error code: %errorLevel%
|
||||||
|
)
|
||||||
|
pause
|
||||||
|
goto menu
|
||||||
|
|
||||||
|
:stop_service
|
||||||
|
echo Stopping S-UI service...
|
||||||
|
net stop %SERVICE_NAME%
|
||||||
|
if %errorLevel% equ 0 (
|
||||||
|
echo Service stopped successfully!
|
||||||
|
) else (
|
||||||
|
echo Failed to stop service. Error code: %errorLevel%
|
||||||
|
)
|
||||||
|
pause
|
||||||
|
goto menu
|
||||||
|
|
||||||
|
:restart_service
|
||||||
|
echo Restarting S-UI service...
|
||||||
|
net stop %SERVICE_NAME% >nul 2>&1
|
||||||
|
timeout /t 2 /nobreak >nul
|
||||||
|
net start %SERVICE_NAME%
|
||||||
|
if %errorLevel% equ 0 (
|
||||||
|
echo Service restarted successfully!
|
||||||
|
) else (
|
||||||
|
echo Failed to restart service. Error code: %errorLevel%
|
||||||
|
)
|
||||||
|
pause
|
||||||
|
goto menu
|
||||||
|
|
||||||
|
:check_status
|
||||||
|
echo Checking S-UI service status...
|
||||||
|
sc query %SERVICE_NAME%
|
||||||
|
echo.
|
||||||
|
echo Service status details:
|
||||||
|
for /f "tokens=3 delims=: " %%i in ('sc query %SERVICE_NAME% ^| find "STATE"') do (
|
||||||
|
echo Current state: %%i
|
||||||
|
)
|
||||||
|
pause
|
||||||
|
goto menu
|
||||||
|
|
||||||
|
:view_logs
|
||||||
|
echo Opening S-UI logs...
|
||||||
|
if exist "%INSTALL_DIR%\logs" (
|
||||||
|
start "" "%INSTALL_DIR%\logs"
|
||||||
|
) else (
|
||||||
|
echo Logs directory not found: %INSTALL_DIR%\logs
|
||||||
|
)
|
||||||
|
pause
|
||||||
|
goto menu
|
||||||
|
|
||||||
|
:open_panel
|
||||||
|
echo Opening S-UI panel in browser...
|
||||||
|
start http://localhost:2095
|
||||||
|
echo Panel opened in default browser.
|
||||||
|
pause
|
||||||
|
goto menu
|
||||||
|
|
||||||
|
:run_manual
|
||||||
|
echo Running S-UI manually...
|
||||||
|
if exist "%INSTALL_DIR%\sui.exe" (
|
||||||
|
cd /d "%INSTALL_DIR%"
|
||||||
|
echo Starting S-UI in current window...
|
||||||
|
echo Press Ctrl+C to stop
|
||||||
|
echo.
|
||||||
|
sui.exe
|
||||||
|
) else (
|
||||||
|
echo S-UI executable not found: %INSTALL_DIR%\sui.exe
|
||||||
|
echo Please run the installer first.
|
||||||
|
)
|
||||||
|
pause
|
||||||
|
goto menu
|
||||||
|
|
||||||
|
:service_management
|
||||||
|
cls
|
||||||
|
echo ========================================
|
||||||
|
echo Service Management
|
||||||
|
echo ========================================
|
||||||
|
echo.
|
||||||
|
echo 1. Install Windows Service
|
||||||
|
echo 2. Uninstall Windows Service
|
||||||
|
echo 3. Back to Main Menu
|
||||||
|
echo.
|
||||||
|
set /p service_choice="Select option [1-3]: "
|
||||||
|
|
||||||
|
if "%service_choice%"=="1" goto install_service
|
||||||
|
if "%service_choice%"=="2" goto uninstall_service
|
||||||
|
if "%service_choice%"=="3" goto menu
|
||||||
|
goto invalid_choice
|
||||||
|
|
||||||
|
:install_service
|
||||||
|
echo Installing Windows Service...
|
||||||
|
if exist "%INSTALL_DIR%\s-ui-service.exe" (
|
||||||
|
cd /d "%INSTALL_DIR%"
|
||||||
|
s-ui-service.exe install
|
||||||
|
if %errorLevel% equ 0 (
|
||||||
|
echo Service installed successfully!
|
||||||
|
echo Starting service...
|
||||||
|
net start %SERVICE_NAME%
|
||||||
|
) else (
|
||||||
|
echo Failed to install service. Error code: %errorLevel%
|
||||||
|
)
|
||||||
|
) else (
|
||||||
|
echo Service wrapper not found. Please run the installer first.
|
||||||
|
)
|
||||||
|
pause
|
||||||
|
goto service_management
|
||||||
|
|
||||||
|
:uninstall_service
|
||||||
|
echo Uninstalling Windows Service...
|
||||||
|
if exist "%INSTALL_DIR%\s-ui-service.exe" (
|
||||||
|
cd /d "%INSTALL_DIR%"
|
||||||
|
net stop %SERVICE_NAME% >nul 2>&1
|
||||||
|
s-ui-service.exe uninstall
|
||||||
|
if %errorLevel% equ 0 (
|
||||||
|
echo Service uninstalled successfully!
|
||||||
|
) else (
|
||||||
|
echo Failed to uninstall service. Error code: %errorLevel%
|
||||||
|
)
|
||||||
|
) else (
|
||||||
|
echo Service wrapper not found.
|
||||||
|
)
|
||||||
|
pause
|
||||||
|
goto service_management
|
||||||
|
|
||||||
|
:open_directory
|
||||||
|
echo Opening installation directory...
|
||||||
|
if exist "%INSTALL_DIR%" (
|
||||||
|
start "" "%INSTALL_DIR%"
|
||||||
|
) else (
|
||||||
|
echo Installation directory not found: %INSTALL_DIR%
|
||||||
|
)
|
||||||
|
pause
|
||||||
|
goto menu
|
||||||
|
|
||||||
|
:show_config
|
||||||
|
echo.
|
||||||
|
echo ========================================
|
||||||
|
echo S-UI Configuration
|
||||||
|
echo ========================================
|
||||||
|
if exist "%INSTALL_DIR%\sui.exe" (
|
||||||
|
cd /d "%INSTALL_DIR%"
|
||||||
|
echo Current settings:
|
||||||
|
sui.exe setting -show
|
||||||
|
echo.
|
||||||
|
echo Admin credentials:
|
||||||
|
sui.exe admin -show
|
||||||
|
) else (
|
||||||
|
echo S-UI executable not found. Please run the installer first.
|
||||||
|
)
|
||||||
|
pause
|
||||||
|
goto menu
|
||||||
|
|
||||||
|
:show_urls
|
||||||
|
echo.
|
||||||
|
echo ========================================
|
||||||
|
echo Access URLs
|
||||||
|
echo ========================================
|
||||||
|
echo.
|
||||||
|
echo Local access:
|
||||||
|
echo Panel: http://localhost:2095
|
||||||
|
echo Subscription: http://localhost:2096
|
||||||
|
echo.
|
||||||
|
echo Network access:
|
||||||
|
for /f "tokens=2 delims=:" %%i in ('ipconfig ^| findstr /i "IPv4"') do (
|
||||||
|
set "ip=%%i"
|
||||||
|
set "ip=!ip: =!"
|
||||||
|
echo Panel: http://!ip!:2095
|
||||||
|
echo Subscription: http://!ip!:2096
|
||||||
|
)
|
||||||
|
echo.
|
||||||
|
pause
|
||||||
|
goto menu
|
||||||
|
|
||||||
|
:invalid_choice
|
||||||
|
echo Invalid choice. Please select a valid option.
|
||||||
|
pause
|
||||||
|
goto menu
|
||||||
|
|
||||||
|
:exit
|
||||||
|
echo Thank you for using S-UI Windows Control Panel!
|
||||||
|
exit /b 0
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<service>
|
||||||
|
<id>s-ui</id>
|
||||||
|
<name>S-UI Proxy Panel</name>
|
||||||
|
<description>S-UI is a proxy panel for managing proxy services</description>
|
||||||
|
<executable>%BASE%\sui.exe</executable>
|
||||||
|
<arguments></arguments>
|
||||||
|
<logmode>rotate</logmode>
|
||||||
|
<logpath>%BASE%\logs</logpath>
|
||||||
|
<log size="10 m" />
|
||||||
|
<log keep="10" />
|
||||||
|
<workingdirectory>%BASE%</workingdirectory>
|
||||||
|
<env name="SUI_DB_FOLDER" value="db" />
|
||||||
|
<env name="SUI_DEBUG" value="false" />
|
||||||
|
<onfailure action="restart" delay="10 sec" />
|
||||||
|
<onfailure action="restart" delay="20 sec" />
|
||||||
|
<onfailure action="none" />
|
||||||
|
<resetfailure>1 hour</resetfailure>
|
||||||
|
<startmode>Automatic</startmode>
|
||||||
|
<depend>tcpip</depend>
|
||||||
|
<depend>netman</depend>
|
||||||
|
</service>
|
||||||
@@ -0,0 +1,102 @@
|
|||||||
|
@echo off
|
||||||
|
setlocal enabledelayedexpansion
|
||||||
|
|
||||||
|
echo ========================================
|
||||||
|
echo S-UI Windows Uninstaller
|
||||||
|
echo ========================================
|
||||||
|
|
||||||
|
REM Check if running as Administrator
|
||||||
|
net session >nul 2>&1
|
||||||
|
if %errorLevel% neq 0 (
|
||||||
|
echo Error: This script must be run as Administrator
|
||||||
|
echo Right-click on this file and select "Run as administrator"
|
||||||
|
pause
|
||||||
|
exit /b 1
|
||||||
|
)
|
||||||
|
|
||||||
|
REM Set installation directory
|
||||||
|
set "INSTALL_DIR=C:\Program Files\s-ui"
|
||||||
|
set "SERVICE_NAME=s-ui"
|
||||||
|
|
||||||
|
echo Uninstalling S-UI from: %INSTALL_DIR%
|
||||||
|
|
||||||
|
REM Stop and remove Windows Service
|
||||||
|
if exist "%INSTALL_DIR%\s-ui-service.exe" (
|
||||||
|
echo Stopping and removing Windows Service...
|
||||||
|
net stop %SERVICE_NAME% >nul 2>&1
|
||||||
|
cd /d "%INSTALL_DIR%"
|
||||||
|
s-ui-service.exe uninstall >nul 2>&1
|
||||||
|
if %errorLevel% equ 0 (
|
||||||
|
echo Service removed successfully
|
||||||
|
) else (
|
||||||
|
echo Warning: Failed to remove service or service was not installed
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
REM Remove desktop shortcut
|
||||||
|
echo Removing desktop shortcut...
|
||||||
|
set "DESKTOP=%USERPROFILE%\Desktop"
|
||||||
|
if exist "%DESKTOP%\S-UI.lnk" (
|
||||||
|
del "%DESKTOP%\S-UI.lnk" >nul 2>&1
|
||||||
|
echo Desktop shortcut removed
|
||||||
|
)
|
||||||
|
|
||||||
|
REM Remove Start Menu shortcut
|
||||||
|
echo Removing Start Menu shortcut...
|
||||||
|
set "START_MENU=%APPDATA%\Microsoft\Windows\Start Menu\Programs\S-UI"
|
||||||
|
if exist "%START_MENU%" (
|
||||||
|
rmdir /s /q "%START_MENU%" >nul 2>&1
|
||||||
|
echo Start Menu shortcut removed
|
||||||
|
)
|
||||||
|
|
||||||
|
REM Remove environment variable
|
||||||
|
echo Removing environment variable...
|
||||||
|
reg delete "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v SUI_HOME /f >nul 2>&1
|
||||||
|
|
||||||
|
REM Ask user if they want to keep data
|
||||||
|
echo.
|
||||||
|
set /p keep_data="Do you want to keep your data (database, logs, certificates)? [y/n]: "
|
||||||
|
if /i "%keep_data%"=="y" (
|
||||||
|
echo Keeping data files...
|
||||||
|
REM Remove only executable and service files
|
||||||
|
if exist "%INSTALL_DIR%\sui.exe" del "%INSTALL_DIR%\sui.exe" >nul 2>&1
|
||||||
|
if exist "%INSTALL_DIR%\s-ui-service.exe" del "%INSTALL_DIR%\s-ui-service.exe" >nul 2>&1
|
||||||
|
if exist "%INSTALL_DIR%\s-ui-service.xml" del "%INSTALL_DIR%\s-ui-service.xml" >nul 2>&1
|
||||||
|
if exist "%INSTALL_DIR%\winsw.exe" del "%INSTALL_DIR%\winsw.exe" >nul 2>&1
|
||||||
|
if exist "%INSTALL_DIR%\*.bat" del "%INSTALL_DIR%\*.bat" >nul 2>&1
|
||||||
|
if exist "%INSTALL_DIR%\*.xml" del "%INSTALL_DIR%\*.xml" >nul 2>&1
|
||||||
|
if exist "%INSTALL_DIR%\*.md" del "%INSTALL_DIR%\*.md" >nul 2>&1
|
||||||
|
echo Data files preserved in: %INSTALL_DIR%
|
||||||
|
) else (
|
||||||
|
echo Removing all files...
|
||||||
|
REM Remove entire installation directory
|
||||||
|
if exist "%INSTALL_DIR%" (
|
||||||
|
rmdir /s /q "%INSTALL_DIR%" >nul 2>&1
|
||||||
|
if exist "%INSTALL_DIR%" (
|
||||||
|
echo Warning: Some files could not be removed. Please manually delete: %INSTALL_DIR%
|
||||||
|
) else (
|
||||||
|
echo All files removed successfully
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
REM Remove firewall rules
|
||||||
|
echo Removing firewall rules...
|
||||||
|
netsh advfirewall firewall delete rule name="S-UI Panel" >nul 2>&1
|
||||||
|
netsh advfirewall firewall delete rule name="S-UI Subscription" >nul 2>&1
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ========================================
|
||||||
|
echo Uninstallation completed!
|
||||||
|
echo ========================================
|
||||||
|
echo.
|
||||||
|
echo S-UI has been uninstalled from your system.
|
||||||
|
echo.
|
||||||
|
if /i "%keep_data%"=="y" (
|
||||||
|
echo Your data has been preserved in: %INSTALL_DIR%
|
||||||
|
echo You can safely delete this directory if you no longer need the data.
|
||||||
|
)
|
||||||
|
echo.
|
||||||
|
echo Thank you for using S-UI!
|
||||||
|
echo.
|
||||||
|
pause
|
||||||
Reference in New Issue
Block a user