Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ef519331e2 | ||
|
|
19fee9b51b | ||
|
|
16a7f6a4c4 | ||
|
|
1aca99b2d7 | ||
|
|
2733d99cf7 | ||
|
|
6750103337 | ||
|
|
eaff3b8c39 | ||
|
|
c9a9807dd5 | ||
|
|
2b04bf8b5a | ||
|
|
62c84206a4 | ||
|
|
2650174eed | ||
|
|
d199b26ce2 | ||
|
|
0c25ec5978 | ||
|
|
055ff30e39 | ||
|
|
0f39cdbe7b | ||
|
|
4710432572 | ||
|
|
e0c8c73b91 | ||
|
|
b39f0c30ef | ||
|
|
c1753a6d19 | ||
|
|
8f384eaac4 | ||
|
|
a51d6bc50a | ||
|
|
43144804c7 | ||
|
|
dfe4748e97 | ||
|
|
30af159034 | ||
|
|
8819907be5 | ||
|
|
1a29ab0046 | ||
|
|
0ffec7df7f | ||
|
|
876b2d2588 | ||
|
|
af4be7f130 | ||
|
|
0e6cc0f40f | ||
|
|
08d39c33fa | ||
|
|
b76028412c | ||
|
|
fcea0f5332 | ||
|
|
a910cc2b43 | ||
|
|
6df3b36c58 | ||
|
|
e1228b9d69 | ||
|
|
6fff5d2de2 | ||
|
|
ce0eed3577 | ||
|
|
b839e01009 | ||
|
|
bf476e643f | ||
|
|
b88a4d8318 | ||
|
|
12931e7912 | ||
|
|
9205557566 | ||
|
|
4b127fb3f8 | ||
|
|
3728937dc5 | ||
|
|
54b561e278 | ||
|
|
e21f0df3d5 | ||
|
|
c849eb5054 | ||
|
|
799bad5eb6 | ||
|
|
bc103289db | ||
|
|
bbc2e82d12 | ||
|
|
2f3df076de | ||
|
|
9ffc3cdb2f | ||
|
|
d4cb851230 | ||
|
|
f88aa21076 | ||
|
|
c7332fad22 | ||
|
|
0bb158362e | ||
|
|
e9b7a8082b | ||
|
|
4b3c4b7168 | ||
|
|
585b2feb8f | ||
|
|
32b32ff3fc | ||
|
|
adca59d2b4 | ||
|
|
cea315deac | ||
|
|
3174286694 | ||
|
|
bcd213ac54 | ||
|
|
39a2c5ef8c | ||
|
|
dd4ff10cf4 | ||
|
|
2bd015c29f | ||
|
|
f59595e137 | ||
|
|
5cb674a165 | ||
|
|
d69cd1e033 | ||
|
|
252ce08659 | ||
|
|
7e17e47d75 | ||
|
|
9ae2de4dde | ||
|
|
27f2a60298 | ||
|
|
daf4af3abb | ||
|
|
2e775a5cf7 | ||
|
|
f26b4c334b | ||
|
|
b821409b04 | ||
|
|
de4111df21 | ||
|
|
a8817ede54 | ||
|
|
b86380e506 | ||
|
|
b2a6c66439 | ||
|
|
a48785b7aa | ||
|
|
b4362a68fc | ||
|
|
103b96eb19 | ||
|
|
e093e38c17 | ||
|
|
a3a801370b | ||
|
|
bb9b4501c2 | ||
|
|
492c259568 | ||
|
|
c5efa76623 | ||
|
|
b44cd17324 | ||
|
|
acf7f297f0 | ||
|
|
fdb24b115b | ||
|
|
1cd77f877d | ||
|
|
f3ad499273 | ||
|
|
8fca98bdf8 | ||
|
|
7123027287 | ||
|
|
90a85b1b88 | ||
|
|
745b056be9 | ||
|
|
831fe8e32e | ||
|
|
50e2da3fcb | ||
|
|
7db25b9c3a | ||
|
|
be3358b744 |
@@ -1,27 +0,0 @@
|
||||
name: Android
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
release:
|
||||
types: [published]
|
||||
branches: [ master ]
|
||||
|
||||
jobs:
|
||||
|
||||
build_android:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@v2
|
||||
- name: Build
|
||||
run: |
|
||||
chmod +x build.android.sh
|
||||
docker run --rm -i -w /app -v $(pwd):/app -e ANDROID_HOME=/usr/local/android_sdk -e GOPROXY=direct fyneio/fyne-cross:android-latest /app/build.android.sh
|
||||
- name: Upload
|
||||
uses: softprops/action-gh-release@v1
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
with:
|
||||
files: |
|
||||
android_client.apk
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -1,55 +0,0 @@
|
||||
name: Docker
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
release:
|
||||
types: [published]
|
||||
# branches: [ master ]
|
||||
tags: [v*]
|
||||
|
||||
jobs:
|
||||
build_docker:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@v2
|
||||
- name: Set env
|
||||
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v1
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
- name: Cache Docker layers
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: /tmp/.buildx-cache
|
||||
key: ${{ runner.os }}-buildx-${{ github.sha }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-buildx-
|
||||
- name: Login to DockerHub
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
- name: Build and push nps
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
context: .
|
||||
file: ./Dockerfile.nps
|
||||
platforms: linux/amd64,linux/arm,linux/arm64
|
||||
push: true
|
||||
tags: |
|
||||
${{ secrets.DOCKERHUB_USERNAME }}/nps:latest
|
||||
${{ secrets.DOCKERHUB_USERNAME }}/nps:${{ env.RELEASE_VERSION }}
|
||||
- name: Build and push npc
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
context: .
|
||||
file: ./Dockerfile.npc
|
||||
platforms: linux/amd64,linux/arm,linux/arm64
|
||||
push: true
|
||||
tags: |
|
||||
${{ secrets.DOCKERHUB_USERNAME }}/npc:latest
|
||||
${{ secrets.DOCKERHUB_USERNAME }}/npc:${{ env.RELEASE_VERSION }}
|
||||
@@ -1,93 +0,0 @@
|
||||
name: Release
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
release:
|
||||
types: [published]
|
||||
branches: [ master ]
|
||||
|
||||
jobs:
|
||||
|
||||
build_assets:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
||||
- name: Set up Go 1.x
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: 1.22
|
||||
id: go
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@v2
|
||||
- name: Get dependencies
|
||||
run: |
|
||||
go get -v -t -d ./...
|
||||
if [ -f Gopkg.toml ]; then
|
||||
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
|
||||
dep ensure
|
||||
fi
|
||||
- name: Build
|
||||
run: |
|
||||
chmod +x build.assets.sh
|
||||
./build.assets.sh
|
||||
- name: Upload
|
||||
uses: softprops/action-gh-release@v1
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
with:
|
||||
files: |
|
||||
freebsd_386_client.tar.gz
|
||||
freebsd_386_server.tar.gz
|
||||
freebsd_amd64_client.tar.gz
|
||||
freebsd_amd64_server.tar.gz
|
||||
freebsd_arm_client.tar.gz
|
||||
freebsd_arm_server.tar.gz
|
||||
linux_386_client.tar.gz
|
||||
linux_386_server.tar.gz
|
||||
linux_amd64_client.tar.gz
|
||||
linux_amd64_server.tar.gz
|
||||
linux_arm64_client.tar.gz
|
||||
linux_arm64_server.tar.gz
|
||||
linux_arm_v5_client.tar.gz
|
||||
linux_arm_v6_client.tar.gz
|
||||
linux_arm_v7_client.tar.gz
|
||||
linux_arm_v5_server.tar.gz
|
||||
linux_arm_v6_server.tar.gz
|
||||
linux_arm_v7_server.tar.gz
|
||||
linux_mips64le_client.tar.gz
|
||||
linux_mips64le_server.tar.gz
|
||||
linux_mips64_client.tar.gz
|
||||
linux_mips64_server.tar.gz
|
||||
linux_mipsle_client.tar.gz
|
||||
linux_mipsle_server.tar.gz
|
||||
linux_mips_client.tar.gz
|
||||
linux_mips_server.tar.gz
|
||||
darwin_amd64_client.tar.gz
|
||||
darwin_amd64_server.tar.gz
|
||||
darwin_arm64_client.tar.gz
|
||||
darwin_arm64_server.tar.gz
|
||||
windows_386_client.tar.gz
|
||||
windows_386_server.tar.gz
|
||||
windows_amd64_client.tar.gz
|
||||
windows_amd64_server.tar.gz
|
||||
npc_sdk.tar.gz
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
build_android:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@v2
|
||||
- name: Build
|
||||
run: |
|
||||
chmod +x build.android.sh
|
||||
docker run --rm -i -w /app -v $(pwd):/app -e ANDROID_HOME=/usr/local/android_sdk -e GOPROXY=direct fyneio/fyne-cross:android-latest /app/build.android.sh
|
||||
- name: Upload
|
||||
uses: softprops/action-gh-release@v1
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
with:
|
||||
files: |
|
||||
android_client.apk
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -0,0 +1,355 @@
|
||||
name: Release
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
env:
|
||||
GUI_DIR: cmd/npc/npc-gui
|
||||
FRONTEND_DIR: cmd/npc/npc-gui/frontend
|
||||
WAILS_VERSION: v2.11.0
|
||||
APP_NAME: npc-gui
|
||||
|
||||
jobs:
|
||||
|
||||
# ==================== 跨平台服务端/客户端打包 ====================
|
||||
build_assets:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: "1.22"
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v2
|
||||
- name: Get dependencies
|
||||
run: |
|
||||
go get -v -t -d ./...
|
||||
if [ -f Gopkg.toml ]; then
|
||||
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
|
||||
dep ensure
|
||||
fi
|
||||
- name: Build
|
||||
run: |
|
||||
chmod +x build.assets.sh
|
||||
./build.assets.sh
|
||||
- name: Upload
|
||||
uses: softprops/action-gh-release@v2
|
||||
if: github.event_name == 'release' || github.event_name == 'workflow_dispatch'
|
||||
with:
|
||||
files: |
|
||||
freebsd_386_client.tar.gz
|
||||
freebsd_386_server.tar.gz
|
||||
freebsd_amd64_client.tar.gz
|
||||
freebsd_amd64_server.tar.gz
|
||||
freebsd_arm_client.tar.gz
|
||||
freebsd_arm_server.tar.gz
|
||||
linux_386_client.tar.gz
|
||||
linux_386_server.tar.gz
|
||||
linux_amd64_client.tar.gz
|
||||
linux_amd64_server.tar.gz
|
||||
linux_arm64_client.tar.gz
|
||||
linux_arm64_server.tar.gz
|
||||
linux_arm_v5_client.tar.gz
|
||||
linux_arm_v6_client.tar.gz
|
||||
linux_arm_v7_client.tar.gz
|
||||
linux_arm_v5_server.tar.gz
|
||||
linux_arm_v6_server.tar.gz
|
||||
linux_arm_v7_server.tar.gz
|
||||
linux_mips64le_client.tar.gz
|
||||
linux_mips64le_server.tar.gz
|
||||
linux_mips64_client.tar.gz
|
||||
linux_mips64_server.tar.gz
|
||||
linux_mipsle_client.tar.gz
|
||||
linux_mipsle_server.tar.gz
|
||||
linux_mips_client.tar.gz
|
||||
linux_mips_server.tar.gz
|
||||
darwin_amd64_client.tar.gz
|
||||
darwin_amd64_server.tar.gz
|
||||
darwin_arm64_client.tar.gz
|
||||
darwin_arm64_server.tar.gz
|
||||
windows_386_client.tar.gz
|
||||
windows_386_server.tar.gz
|
||||
windows_amd64_client.tar.gz
|
||||
windows_amd64_server.tar.gz
|
||||
npc_sdk.tar.gz
|
||||
tag_name: ${{ github.ref_name }}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
# ==================== Android APK ====================
|
||||
build_android:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v4
|
||||
- name: Build
|
||||
run: |
|
||||
chmod +x build.android.sh
|
||||
docker run --rm -i -w /app -v $(pwd):/app -e ANDROID_HOME=/usr/local/android_sdk -e GOPROXY=direct fyneio/fyne-cross:android-latest /app/build.android.sh
|
||||
ls -la android_client.apk
|
||||
- name: Upload
|
||||
uses: softprops/action-gh-release@v2
|
||||
if: github.event_name == 'release' || github.event_name == 'workflow_dispatch'
|
||||
with:
|
||||
files: |
|
||||
android_client.apk
|
||||
tag_name: ${{ github.ref_name }}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
# ==================== Docker 镜像 ====================
|
||||
build_docker:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v2
|
||||
- name: Set env
|
||||
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v1
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
- name: Cache Docker layers
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: /tmp/.buildx-cache
|
||||
key: ${{ runner.os }}-buildx-${{ github.sha }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-buildx-
|
||||
- name: Login to DockerHub
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
- name: Build and push nps
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
context: .
|
||||
file: ./Dockerfile.nps
|
||||
platforms: linux/amd64,linux/arm,linux/arm64
|
||||
push: true
|
||||
tags: |
|
||||
${{ secrets.DOCKERHUB_USERNAME }}/nps:latest
|
||||
${{ secrets.DOCKERHUB_USERNAME }}/nps:${{ env.RELEASE_VERSION }}
|
||||
- name: Build and push npc
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
context: .
|
||||
file: ./Dockerfile.npc
|
||||
platforms: linux/amd64,linux/arm,linux/arm64
|
||||
push: true
|
||||
tags: |
|
||||
${{ secrets.DOCKERHUB_USERNAME }}/npc:latest
|
||||
${{ secrets.DOCKERHUB_USERNAME }}/npc:${{ env.RELEASE_VERSION }}
|
||||
|
||||
# ==================== Windows GUI ====================
|
||||
build_windows_gui:
|
||||
runs-on: windows-latest
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- platform: windows/386
|
||||
os_name: windows
|
||||
arch: 386
|
||||
- platform: windows/amd64
|
||||
os_name: windows
|
||||
arch: amd64
|
||||
- platform: windows/arm64
|
||||
os_name: windows
|
||||
arch: arm64
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v4
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "20"
|
||||
cache: yarn
|
||||
cache-dependency-path: ${{ env.FRONTEND_DIR }}/yarn.lock
|
||||
- name: Enable Yarn (corepack)
|
||||
run: corepack enable
|
||||
- name: Install frontend dependencies
|
||||
run: yarn install --frozen-lockfile
|
||||
working-directory: ${{ env.FRONTEND_DIR }}
|
||||
- name: Build frontend
|
||||
run: yarn build
|
||||
working-directory: ${{ env.FRONTEND_DIR }}
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version-file: ${{ env.GUI_DIR }}/go.mod
|
||||
check-latest: true
|
||||
- name: Install Wails CLI
|
||||
run: go install github.com/wailsapp/wails/v2/cmd/wails@${{ env.WAILS_VERSION }}
|
||||
working-directory: ${{ env.GUI_DIR }}
|
||||
- name: Build and package (Windows)
|
||||
shell: pwsh
|
||||
working-directory: ${{ env.GUI_DIR }}
|
||||
run: |
|
||||
$wails = Join-Path (go env GOPATH) "bin\wails.exe"
|
||||
$tagArgs = @()
|
||||
if ($env:WAILS_TAGS) { $tagArgs += @("-tags", $env:WAILS_TAGS) }
|
||||
& $wails build -m -s -trimpath -skipbindings @tagArgs -platform ${{ matrix.platform }} -o "$env:APP_NAME.exe"
|
||||
Set-Location build\bin
|
||||
$zipName = "$env:APP_NAME-${{ matrix.os_name }}-${{ matrix.arch }}.zip"
|
||||
$exe = Get-ChildItem -Path . -Filter *.exe | Select-Object -First 1
|
||||
if (-not $exe) {
|
||||
$exe = Get-ChildItem -Path . -File | Select-Object -First 1
|
||||
}
|
||||
if (-not $exe) {
|
||||
Write-Host "No build output found in build/bin"
|
||||
Get-ChildItem -Path . | Format-Table -AutoSize
|
||||
exit 1
|
||||
}
|
||||
Compress-Archive -Path $exe.Name -DestinationPath $zipName -Force
|
||||
- name: Upload Windows artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: windows-builds-${{ matrix.arch }}
|
||||
path: ${{ env.GUI_DIR }}/build/bin/${{ env.APP_NAME }}-${{ matrix.os_name }}-${{ matrix.arch }}.zip
|
||||
|
||||
# ==================== macOS GUI ====================
|
||||
build_macos_gui:
|
||||
runs-on: macos-latest
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- platform: darwin/amd64
|
||||
os_name: darwin
|
||||
arch: amd64
|
||||
- platform: darwin/arm64
|
||||
os_name: darwin
|
||||
arch: arm64
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v4
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "20"
|
||||
cache: yarn
|
||||
cache-dependency-path: ${{ env.FRONTEND_DIR }}/yarn.lock
|
||||
- name: Enable Yarn (corepack)
|
||||
run: corepack enable
|
||||
- name: Install frontend dependencies
|
||||
run: yarn install --frozen-lockfile
|
||||
working-directory: ${{ env.FRONTEND_DIR }}
|
||||
- name: Build frontend
|
||||
run: yarn build
|
||||
working-directory: ${{ env.FRONTEND_DIR }}
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version-file: ${{ env.GUI_DIR }}/go.mod
|
||||
check-latest: true
|
||||
- name: Install Wails CLI
|
||||
run: go install github.com/wailsapp/wails/v2/cmd/wails@${{ env.WAILS_VERSION }}
|
||||
working-directory: ${{ env.GUI_DIR }}
|
||||
- name: Build and package (macOS)
|
||||
shell: bash
|
||||
working-directory: ${{ env.GUI_DIR }}
|
||||
run: |
|
||||
wails="$(go env GOPATH)/bin/wails"
|
||||
tagArgs=()
|
||||
if [ -n "$WAILS_TAGS" ]; then
|
||||
tagArgs+=( -tags "$WAILS_TAGS" )
|
||||
fi
|
||||
"$wails" build -m -s -trimpath -skipbindings "${tagArgs[@]}" -platform "${{ matrix.platform }}" -o "$APP_NAME"
|
||||
cd build/bin
|
||||
app="$(ls -1d *.app 2>/dev/null | head -n 1)"
|
||||
if [ -z "$app" ]; then
|
||||
echo "No .app found in build/bin"
|
||||
ls -la
|
||||
exit 1
|
||||
fi
|
||||
zip -q -r "$APP_NAME-${{ matrix.os_name }}-${{ matrix.arch }}.zip" "$app"
|
||||
- name: Upload macOS artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: macos-builds-${{ matrix.arch }}
|
||||
path: ${{ env.GUI_DIR }}/build/bin/${{ env.APP_NAME }}-${{ matrix.os_name }}-${{ matrix.arch }}.zip
|
||||
|
||||
# ==================== Linux GUI ====================
|
||||
build_linux_gui:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
WAILS_TAGS: webkit2_41
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- platform: linux/amd64
|
||||
os_name: linux
|
||||
arch: amd64
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v4
|
||||
- name: Install Linux dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.1-dev
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "20"
|
||||
cache: yarn
|
||||
cache-dependency-path: ${{ env.FRONTEND_DIR }}/yarn.lock
|
||||
- name: Enable Yarn (corepack)
|
||||
run: corepack enable
|
||||
- name: Install frontend dependencies
|
||||
run: yarn install --frozen-lockfile
|
||||
working-directory: ${{ env.FRONTEND_DIR }}
|
||||
- name: Build frontend
|
||||
run: yarn build
|
||||
working-directory: ${{ env.FRONTEND_DIR }}
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version-file: ${{ env.GUI_DIR }}/go.mod
|
||||
check-latest: true
|
||||
- name: Install Wails CLI
|
||||
run: go install github.com/wailsapp/wails/v2/cmd/wails@${{ env.WAILS_VERSION }}
|
||||
working-directory: ${{ env.GUI_DIR }}
|
||||
- name: Build and package (Linux)
|
||||
shell: bash
|
||||
working-directory: ${{ env.GUI_DIR }}
|
||||
run: |
|
||||
wails="$(go env GOPATH)/bin/wails"
|
||||
tagArgs=()
|
||||
if [ -n "$WAILS_TAGS" ]; then
|
||||
tagArgs+=( -tags "$WAILS_TAGS" )
|
||||
fi
|
||||
"$wails" build -m -s -trimpath -skipbindings "${tagArgs[@]}" -platform "${{ matrix.platform }}" -o "$APP_NAME"
|
||||
cd build/bin
|
||||
bin="$(find . -maxdepth 1 -type f -perm -111 -printf '%f\n' | head -n 1)"
|
||||
if [ -z "$bin" ]; then
|
||||
echo "No executable file found in build/bin"
|
||||
ls -la
|
||||
exit 1
|
||||
fi
|
||||
zip -q "$APP_NAME-${{ matrix.os_name }}-${{ matrix.arch }}.zip" "$bin"
|
||||
- name: Upload Linux artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: linux-builds-${{ matrix.arch }}
|
||||
path: ${{ env.GUI_DIR }}/build/bin/${{ env.APP_NAME }}-${{ matrix.os_name }}-${{ matrix.arch }}.zip
|
||||
|
||||
# ==================== GUI Release 上传 ====================
|
||||
upload_gui_release:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [build_windows_gui, build_macos_gui, build_linux_gui]
|
||||
if: github.event_name == 'release' || github.event_name == 'workflow_dispatch'
|
||||
steps:
|
||||
- name: Download build artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
path: release-assets
|
||||
- name: Upload release assets
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
files: release-assets/**/*.zip
|
||||
tag_name: ${{ github.ref_name }}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
+1
-2
@@ -1,3 +1,2 @@
|
||||
.idea
|
||||
nps
|
||||
npc
|
||||
nps
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
FROM golang:1.22 as builder
|
||||
FROM golang:1.24 as builder
|
||||
ARG GOPROXY=direct
|
||||
WORKDIR /go/src/ehang.io/nps
|
||||
COPY . .
|
||||
|
||||
+1
-2
@@ -1,4 +1,4 @@
|
||||
FROM golang:1.22 as builder
|
||||
FROM golang:1.24 as builder
|
||||
ARG GOPROXY=direct
|
||||
WORKDIR /go/src/ehang.io/nps
|
||||
COPY . .
|
||||
@@ -7,6 +7,5 @@ RUN CGO_ENABLED=0 go build -ldflags="-w -s -extldflags -static" ./cmd/nps/nps.go
|
||||
|
||||
FROM scratch
|
||||
COPY --from=builder /go/src/ehang.io/nps/nps /
|
||||
COPY --from=builder /go/src/ehang.io/nps/web /web
|
||||
VOLUME /conf
|
||||
CMD ["/nps"]
|
||||
|
||||
@@ -1,37 +1,145 @@
|
||||
# NPS
|
||||
|
||||
[README](https://github.com/ehang-io/nps/blob/master/README.md)|[中文文档](https://github.com/ehang-io/nps/blob/master/README_zh.md)
|
||||
|
||||
[新特性文档](https://dqg9t9eulqq.feishu.cn/wiki/FmVVwDcEGiTZxekYJl5ccuFanlg?from=from_copylink)
|
||||
[原版文档](https://ehang.io/nps/documents)
|
||||
# 说明
|
||||
由于nps已经有二年多的时间没有更新了,存留了不少bug和未完善的功能。
|
||||
|
||||
由于nps已经停更多年,存留了不少bug和未完善的功能。
|
||||
此版本基于 nps 0.26.10的基础上二次开发而来。
|
||||
### 交流
|
||||
聊天灌水QQ群:619833483,热心群主可提供免费远程协助👍👍👍
|
||||
|
||||
***DockerHub***: [NPS](https://hub.docker.com/r/yisier1/nps) [NPC](https://hub.docker.com/r/yisier1/npc)
|
||||
|
||||
***宝塔面板***:[宝塔面板 Docker](docs/bt.md)
|
||||
|
||||
# 交流群
|
||||
聊天灌水QQ群:770569342,619833483(已满)
|
||||
|
||||
# 公益云内网穿透
|
||||
https://natnps.com/
|
||||
公益NPS内网穿透服务,长期免费,6M带宽,3条隧道,不限流量,欢迎来嫖,自行注册账号。
|
||||
|
||||
# 特价云服务器
|
||||
国内BGP,游戏开服,2核 2G 15M上行 25元/月,[专属连接,首月5折](https://www.rainyun.com/MjY0MzY1_)
|
||||
|
||||
|
||||
# 捐赠
|
||||

|
||||
|
||||
|
||||
## 提示
|
||||
强烈推荐使用无配置文件模式启动客户端(删除掉npc.exe 目录下的`conf`文件夹即可),所有数据应该在服务端保存和配置,而客户端只做连接转发。客户端配置文件对小白极不友好,配置繁琐,容易出错。
|
||||
0.26.21 版本后的客户端,无需再通过命令行方式启动、安装、卸载客户端,直接双击运行,按照提示输入指令即可完成,非常方便。
|
||||
|
||||
# 广告
|
||||
[NPS云穿透](https://natnps.com/register?utm_from=MQ==),免费3M带宽,2条隧道;6.8元12M带宽,10条隧道;13.8元24M带宽,20条隧道。
|
||||
雨云,500M带宽服务器;云服务器15元起,[专属连接,首月5折](https://www.rainyun.com/MjY0MzY1_)。
|
||||
|
||||
# 快速上手
|
||||
***服务端启动/安装:***`./npc(.exe) -server`
|
||||
|
||||

|
||||
|
||||
***客户端启动/安装:*** `./npc(.exe)`
|
||||
|
||||

|
||||
|
||||
|
||||
|
||||
# 更新日志
|
||||
- 2026-06-04 v0.26.34
|
||||
- 新增:
|
||||
- `nps -server` 管理脚本欢迎语显示当前版本号,更新版本时比对版本,已是最新则直接退出,避免无谓覆盖 [#328](https://github.com/yisier/nps/issues/328)
|
||||
- `npc` 管理脚本欢迎语显示当前版本号,新增 `[5] 更新客户端` 选项,更新并替换 npc 二进制
|
||||
- 客户端新增到期时间字段,创建/修改客户端时可选填写,到期后自动暂停客户端 [#322](https://github.com/yisier/nps/issues/322)
|
||||
- 修复:
|
||||
- Dashboard IO 速率采集阻塞请求 500ms,改为后台采集缓存,消除 Sleep 等待
|
||||
- ServerStatus 切片并发读写不安全,添加 RWMutex 保护
|
||||
- flowSession goroutine 泄漏,改为仅在 StartNewServer 启动一次
|
||||
- GetTunnel 双重遍历 sync.Map 性能问题,合并为单次 Range
|
||||
- Bridge Client 字段并发读写不安全,添加 Mutex 保护
|
||||
- TLS ClientHello recordLen 无上限,添加 16KB 限制防止内存耗尽
|
||||
- SOCKS5 地址解析未检查 Read 返回值,改用 io.ReadFull
|
||||
- 文件存储 panic 改为错误日志,defer 清理临时文件防止泄漏
|
||||
- GenerateServerPort 可能无限循环,限制 1000 次重试
|
||||
- P2P UDP 无超时永久阻塞,添加 30s ReadDeadline
|
||||
- P2P goroutine 退出控制改用 context,修复潜在泄漏
|
||||
- 客户端 UDP ReadFrom 错误后未退出,修复无效数据继续处理
|
||||
- [#324](https://github.com/yisier/nps/issues/324) 隧道/域名解析/UDP 流量始终为 0
|
||||
- muxPackager buffer pool 泄漏:UnPack() 错误路径未归还 windowBuff 导致内存持续增长
|
||||
- bridge 客户端重连时旧 WORK_CHAN/WORK_FILE mux 未关闭,底层连接和 goroutine 永不释放
|
||||
- pmux 连接超时泄漏:process() channel 发送超时后连接未关闭,且 ACCEPT_TIME_OUT 单位错误(10ns 应为 10s)
|
||||
- pmux 关闭流程 panic:加 done channel + WaitGroup 保证 Close() 等所有 process() 退出后再 close conn channel;process() 入口设 ReadDeadline 防止阻塞读导致 wg.Wait() 死锁;PortListener 加 done channel 唤醒 Accept()
|
||||
- 优化:ioutil.WriteFile → os.WriteFile、rand.Seed → rand.New 本地随机源
|
||||
|
||||
- 2026-05-23 v0.26.33
|
||||
- 新增:
|
||||
- 配置文件自动生成:启动时若 conf 目录或 nps.conf 不存在,自动创建并写入默认配置,方便 Docker 部署
|
||||
- 首次启动默认 web_username/admin、web_password、auth_key、auth_crypt_key 均改为随机生成,并打印到终端,提升安全性
|
||||
- Web 静态文件打包进可执行文件 + 静态文件 URL 加入版本号参数,升级后自动刷新缓存,部署无需单独拷贝 web 目录
|
||||
- 精简发布包:去除打包时冗余的 conf/nps.conf、web 目录
|
||||
- 清理失效配置项:移除 appname、runmode、https_default_cert_file、https_default_key_file、https_just_proxy
|
||||
- 修复:
|
||||
- [#184](https://github.com/yisier/nps/issues/184) 限速导致隧道中断:UpdateClient 在 RateLimit=0 时创建零速率令牌桶导致永久阻塞
|
||||
- [#159](https://github.com/yisier/nps/issues/159) 关闭隧道端口仍可用:StopServer 错误时提前返回未更新状态 + 重复 OpenTask case 导致隧道被自动重启
|
||||
- [#170](https://github.com/yisier/nps/issues/170) TCP 负载均衡只有一个后端可达:GetRandomTarget 未处理 \r 换行符和尾部空行
|
||||
- [#319](https://github.com/yisier/nps/issues/319) 客户端列表不显示实时网速:NowRate 计算逻辑错误,改为统计每秒实际消耗字节数
|
||||
- [#306](https://github.com/yisier/nps/issues/306) [#316](https://github.com/yisier/nps/issues/316) TCP Basic 认证与域名解析冲突:移除 TCP 隧道 Basic 认证探测,域名解析继续使用客户端 Basic 认证
|
||||
|
||||
- 2026-03-27 v0.26.32
|
||||
- 修复:
|
||||
- 客户端注册参数未正确处理[快捷启动命令]和[TLS快捷启动命令] [#303](https://github.com/yisier/nps/issues/303)
|
||||
- 修复https反向代理bug,感谢[okawao](https://github.com/okawao) 的 PR
|
||||
|
||||
|
||||
- 2026-03-23 v0.26.31
|
||||
- 新增:
|
||||
- 域名解析记录开关功能 [#314](https://github.com/yisier/nps/issues/314)
|
||||
- TCP隧道增加Basic认证 [306](https://github.com/yisier/nps/issues/306)
|
||||
- 修复:
|
||||
- 新增隧道出现secret mode keys must be unique [301](https://github.com/yisier/nps/issues/301)
|
||||
|
||||
|
||||
- 2026-03-12 v0.26.30
|
||||
修复:
|
||||
- http 协议 websocket 错误,感谢[xiaozonglong](https://github.com/xiaozonglong) 提供的 home assistant 环境 ,[#268](https://github.com/yisier/nps/issues/268),[#296](https://github.com/yisier/nps/issues/296)
|
||||
- 域名解析中,主机url点击无法跳转非80端口 [311](https://github.com/yisier/nps/issues/311)
|
||||
- 新增的主机配置页面,客户端ID异常 [#310](https://github.com/yisier/nps/issues/310)
|
||||
- 自动 HTTPS(301) 按照 `https_proxy_port` 配置的端口号跳转
|
||||
|
||||
|
||||
- 2026-01-24 v0.26.29
|
||||
新增:
|
||||
GUI 客户端,基于 Wails 开发,[点击查看了解更多](https://github.com/yisier/nps/blob/master/cmd/npc/npc-gui/README.md),需要 WebView2 运行时,可通过两种方式添加客户端。
|
||||
方式1:直接输入快捷启动命令即可
|
||||
方式2:手动添加客户端,输入-server -vkey等参数
|
||||

|
||||
修复:
|
||||
Android 包未构建到 Release [72](https://github.com/yisier/nps/issues/72)
|
||||
|
||||
|
||||
- 2025-12-06 v0.26.28
|
||||
-【全局参数】页面新增`服务地址`配置项,用于客户端命令地址显示、隧道访问地址显示 [293](https://github.com/yisier/nps/issues/293)
|
||||
-【IP授权功能优化】,通过穿透的端口去提交 IP 认证,感谢 [Aqamoe](https://github.com/Aqamoe) 的建议 [291](https://github.com/yisier/nps/issues/291)
|
||||
-【重构限速器实现】提升性能和准确性
|
||||
|
||||
|
||||
- 2025-11-05 v0.26.27
|
||||
新增:
|
||||
- 1.客户端新增【IP白名单】,可通过两种方式添加IP:
|
||||
- 方式1️⃣:在【客户端】新建/修改页面,配置IP授权密码,不在IP白名单的外网访问将被跳转到 IP 授权页面,输入正确的授权密码,即可完成添加 IP。
|
||||
- 方式2️⃣:在【客户端】新建/修改页面,直接添加IP到白名单中。
|
||||

|
||||
- 2.客户端配置移除【压缩】和【加密】功能,此功能会显著提高内存和CPU占用率,"利大于弊"。
|
||||
- 3.客户端默认不再提供配置文件,***强烈推荐使用无配置文件模式启动客户端***
|
||||
|
||||
|
||||
- 2025-08-15 v0.26.26
|
||||
修复:
|
||||
- windows注册服务 使用tls无法连接 [269](https://github.com/yisier/nps/issues/269)
|
||||
- 域名解析自动HTTPS逻辑bug [273](https://github.com/yisier/nps/issues/273)
|
||||
|
||||
|
||||
- 2025-05-28 v0.26.25
|
||||
新增:
|
||||
- nps增加`nps(.exe) -server` 命令,用于管理NPS服务,安装和卸载服务在 Linux 下需要有 sudo 权限,Windows 下需要有管理员权限。
|
||||

|
||||
- 增加【TLS快捷启动命令】,可用于在tls模式下,快速启动客户端。 [257](https://github.com/yisier/nps/issues/257)
|
||||
|
||||
|
||||
- 2025-04-16 v0.26.24
|
||||
新增:
|
||||
- 隧道支持复制功能,在隧道页面增加复制按钮,除了端口号为随机生成外,其他参数全部拷贝。[251](https://github.com/yisier/nps/issues/251)
|
||||
|
||||
修复:
|
||||
- 私密代理连接时服务端会报错退出,[250](https://github.com/yisier/nps/issues/250)
|
||||
|
||||
|
||||
|
||||
## 更新日志
|
||||
- 2025-04-11 v0.26.23
|
||||
新增:
|
||||
- TCP 隧道支持 Proxy Protocol 协议来传递经过请求的真实 IP。
|
||||
@@ -159,3 +267,8 @@ https://natnps.com/
|
||||
- 2022-09-14:
|
||||
修改NPS工作目录为当前可执行文件目录(即配置文件和nps可执行文件放在同一目录下,直接执行nps文件即可),去除注册系统服务,启动、停止、升级等命令
|
||||
|
||||
|
||||
|
||||
|
||||
# 捐赠
|
||||

|
||||
|
||||
+59
-18
@@ -12,6 +12,7 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"ehang.io/nps/lib/common"
|
||||
@@ -28,11 +29,12 @@ import (
|
||||
var ServerTlsEnable bool = false
|
||||
|
||||
type Client struct {
|
||||
mu sync.Mutex // 保护 signal/tunnel/Version 等字段的并发读写
|
||||
tunnel *nps_mux.Mux
|
||||
signal *conn.Conn
|
||||
file *nps_mux.Mux
|
||||
Version string
|
||||
retryTime int // it will be add 1 when ping not ok until to 3 will close the client
|
||||
retryTime atomic.Int32 // it will be add 1 when ping not ok until to 3 will close the client
|
||||
}
|
||||
|
||||
func NewClient(t, f *nps_mux.Mux, s *conn.Conn, vs string) *Client {
|
||||
@@ -237,8 +239,13 @@ func (s *Bridge) cliProcess(c *conn.Conn) {
|
||||
|
||||
func (s *Bridge) DelClient(id int) {
|
||||
if v, ok := s.Client.Load(id); ok {
|
||||
if v.(*Client).signal != nil {
|
||||
v.(*Client).signal.Close()
|
||||
cl := v.(*Client)
|
||||
cl.mu.Lock()
|
||||
signalToClose := cl.signal
|
||||
cl.signal = nil
|
||||
cl.mu.Unlock()
|
||||
if signalToClose != nil {
|
||||
signalToClose.Close()
|
||||
}
|
||||
s.Client.Delete(id)
|
||||
if file.GetDb().IsPubClient(id) {
|
||||
@@ -267,18 +274,30 @@ func (s *Bridge) typeDeal(typeVal string, c *conn.Conn, id int, vs string) {
|
||||
}
|
||||
//the vKey connect by another ,close the client of before
|
||||
if v, ok := s.Client.LoadOrStore(id, NewClient(nil, nil, c, vs)); ok {
|
||||
if v.(*Client).signal != nil {
|
||||
v.(*Client).signal.WriteClose()
|
||||
cl := v.(*Client)
|
||||
cl.mu.Lock()
|
||||
oldSignal := cl.signal
|
||||
cl.signal = c
|
||||
cl.Version = vs
|
||||
cl.mu.Unlock()
|
||||
cl.retryTime.Store(0)
|
||||
if oldSignal != nil {
|
||||
oldSignal.WriteClose()
|
||||
}
|
||||
v.(*Client).signal = c
|
||||
v.(*Client).Version = vs
|
||||
}
|
||||
go s.GetHealthFromClient(id, c)
|
||||
logs.Info("clientId %d connection succeeded, address:%s ", id, c.Conn.RemoteAddr())
|
||||
case common.WORK_CHAN:
|
||||
muxConn := nps_mux.NewMux(c.Conn, s.tunnelType, s.disconnectTime)
|
||||
if v, ok := s.Client.LoadOrStore(id, NewClient(muxConn, nil, nil, vs)); ok {
|
||||
v.(*Client).tunnel = muxConn
|
||||
cl := v.(*Client)
|
||||
cl.mu.Lock()
|
||||
oldTunnel := cl.tunnel
|
||||
cl.tunnel = muxConn
|
||||
cl.mu.Unlock()
|
||||
if oldTunnel != nil {
|
||||
oldTunnel.Close()
|
||||
}
|
||||
}
|
||||
case common.WORK_CONFIG:
|
||||
client, err := file.GetDb().GetClient(id)
|
||||
@@ -299,7 +318,14 @@ func (s *Bridge) typeDeal(typeVal string, c *conn.Conn, id int, vs string) {
|
||||
case common.WORK_FILE:
|
||||
muxConn := nps_mux.NewMux(c.Conn, s.tunnelType, s.disconnectTime)
|
||||
if v, ok := s.Client.LoadOrStore(id, NewClient(nil, muxConn, nil, vs)); ok {
|
||||
v.(*Client).file = muxConn
|
||||
cl := v.(*Client)
|
||||
cl.mu.Lock()
|
||||
oldFile := cl.file
|
||||
cl.file = muxConn
|
||||
cl.mu.Unlock()
|
||||
if oldFile != nil {
|
||||
oldFile.Close()
|
||||
}
|
||||
}
|
||||
case common.WORK_P2P:
|
||||
//read md5 secret
|
||||
@@ -311,15 +337,22 @@ func (s *Bridge) typeDeal(typeVal string, c *conn.Conn, id int, vs string) {
|
||||
if v, ok := s.Client.Load(t.Client.Id); !ok {
|
||||
return
|
||||
} else {
|
||||
cl := v.(*Client)
|
||||
cl.mu.Lock()
|
||||
sig := cl.signal
|
||||
cl.mu.Unlock()
|
||||
if sig == nil {
|
||||
return
|
||||
}
|
||||
//向密钥对应的客户端发送与服务端udp建立连接信息,地址,密钥
|
||||
v.(*Client).signal.Write([]byte(common.NEW_UDP_CONN))
|
||||
sig.Write([]byte(common.NEW_UDP_CONN))
|
||||
svrAddr := beego.AppConfig.String("p2p_ip") + ":" + beego.AppConfig.String("p2p_port")
|
||||
if err != nil {
|
||||
logs.Warn("get local udp addr error")
|
||||
return
|
||||
}
|
||||
v.(*Client).signal.WriteLenContent([]byte(svrAddr))
|
||||
v.(*Client).signal.WriteLenContent(b)
|
||||
sig.WriteLenContent([]byte(svrAddr))
|
||||
sig.WriteLenContent(b)
|
||||
//向该请求者发送建立连接请求,服务器地址
|
||||
c.WriteLenContent([]byte(svrAddr))
|
||||
}
|
||||
@@ -356,11 +389,14 @@ func (s *Bridge) SendLinkInfo(clientId int, link *conn.Link, t *file.Tunnel) (ta
|
||||
}
|
||||
}
|
||||
var tunnel *nps_mux.Mux
|
||||
cl := v.(*Client)
|
||||
cl.mu.Lock()
|
||||
if t != nil && t.Mode == "file" {
|
||||
tunnel = v.(*Client).file
|
||||
tunnel = cl.file
|
||||
} else {
|
||||
tunnel = v.(*Client).tunnel
|
||||
tunnel = cl.tunnel
|
||||
}
|
||||
cl.mu.Unlock()
|
||||
if tunnel == nil {
|
||||
err = errors.New("the client connect error")
|
||||
return
|
||||
@@ -393,14 +429,19 @@ func (s *Bridge) ping() {
|
||||
arr := make([]int, 0)
|
||||
s.Client.Range(func(key, value interface{}) bool {
|
||||
v := value.(*Client)
|
||||
if v.tunnel == nil || v.signal == nil {
|
||||
v.retryTime += 1
|
||||
if v.retryTime >= 3 {
|
||||
v.mu.Lock()
|
||||
tunnel := v.tunnel
|
||||
signal := v.signal
|
||||
if tunnel == nil || signal == nil {
|
||||
v.mu.Unlock()
|
||||
if v.retryTime.Add(1) >= 3 {
|
||||
arr = append(arr, key.(int))
|
||||
}
|
||||
return true
|
||||
}
|
||||
if v.tunnel.IsClose {
|
||||
isClose := tunnel.IsClose()
|
||||
v.mu.Unlock()
|
||||
if isClose {
|
||||
arr = append(arr, key.(int))
|
||||
}
|
||||
return true
|
||||
|
||||
+28
-5
@@ -1,8 +1,25 @@
|
||||
#/bin/bash
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
cd /go
|
||||
apt-get install libegl1-mesa-dev libgles2-mesa-dev libx11-dev xorg-dev -y
|
||||
go get -u fyne.io/fyne/v2/cmd/fyne fyne.io/fyne/v2
|
||||
if grep -q "buster" /etc/apt/sources.list; then
|
||||
sed -i 's|http://deb.debian.org/debian|http://archive.debian.org/debian|g' /etc/apt/sources.list
|
||||
sed -i 's|http://security.debian.org/debian-security|http://archive.debian.org/debian-security|g' /etc/apt/sources.list
|
||||
echo 'Acquire::Check-Valid-Until "false";' > /etc/apt/apt.conf.d/99no-check-valid
|
||||
fi
|
||||
apt-get update
|
||||
apt-get install -y libegl1-mesa-dev libgles2-mesa-dev libx11-dev xorg-dev ca-certificates curl
|
||||
|
||||
GO_VERSION="${GO_VERSION:-1.22.7}"
|
||||
curl -fsSL "https://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz" -o /tmp/go.tgz
|
||||
rm -rf /usr/local/go
|
||||
tar -C /usr/local -xzf /tmp/go.tgz
|
||||
export PATH="/usr/local/go/bin:$PATH"
|
||||
export GOTOOLCHAIN=auto
|
||||
go version
|
||||
|
||||
GO111MODULE=on go install fyne.io/fyne/v2/cmd/fyne@latest
|
||||
export PATH="$PATH:$(go env GOPATH)/bin"
|
||||
#mkdir -p /go/src/fyne.io
|
||||
#cd src/fyne.io
|
||||
#git clone https://github.com/fyne-io/fyne.git
|
||||
@@ -15,7 +32,7 @@ mkdir -p /go/src/ehang.io/nps
|
||||
cp -R /app/* /go/src/ehang.io/nps
|
||||
cd /go/src/ehang.io/nps
|
||||
#go get -u fyne.io/fyne fyne.io/fyne/cmd/fyne
|
||||
rm cmd/npc/sdk.go
|
||||
rm -f cmd/npc/sdk.go
|
||||
#go get -u ./...
|
||||
#go mod tidy
|
||||
#rm -rf /go/src/golang.org/x/mobile
|
||||
@@ -30,5 +47,11 @@ rm -rf vendor
|
||||
echo "vendor success"
|
||||
cd gui/npc
|
||||
fyne package -appID org.nps.client -os android -icon ../../docs/logo.png
|
||||
mv npc.apk /app/android_client.apk
|
||||
apk="$(ls -1 *.apk 2>/dev/null | head -n 1)"
|
||||
if [ -z "$apk" ]; then
|
||||
echo "No apk produced"
|
||||
ls -la
|
||||
exit 1
|
||||
fi
|
||||
mv "$apk" /app/android_client.apk
|
||||
echo "android build success"
|
||||
|
||||
+34
-34
@@ -8,160 +8,160 @@ tar -czvf npc_sdk.tar.gz npc_sdk.dll npc_sdk.so npc_sdk.h
|
||||
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
|
||||
|
||||
tar -czvf linux_amd64_client.tar.gz npc conf/npc.conf conf/multi_account.conf
|
||||
tar -czvf linux_amd64_client.tar.gz npc
|
||||
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=386 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
|
||||
|
||||
tar -czvf linux_386_client.tar.gz npc conf/npc.conf conf/multi_account.conf
|
||||
tar -czvf linux_386_client.tar.gz npc
|
||||
|
||||
CGO_ENABLED=0 GOOS=freebsd GOARCH=386 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
|
||||
|
||||
tar -czvf freebsd_386_client.tar.gz npc conf/npc.conf conf/multi_account.conf
|
||||
tar -czvf freebsd_386_client.tar.gz npc
|
||||
|
||||
CGO_ENABLED=0 GOOS=freebsd GOARCH=amd64 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
|
||||
|
||||
tar -czvf freebsd_amd64_client.tar.gz npc conf/npc.conf conf/multi_account.conf
|
||||
tar -czvf freebsd_amd64_client.tar.gz npc
|
||||
|
||||
CGO_ENABLED=0 GOOS=freebsd GOARCH=arm go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
|
||||
|
||||
tar -czvf freebsd_arm_client.tar.gz npc conf/npc.conf conf/multi_account.conf
|
||||
tar -czvf freebsd_arm_client.tar.gz npc
|
||||
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=7 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
|
||||
|
||||
tar -czvf linux_arm_v7_client.tar.gz npc conf/npc.conf conf/multi_account.conf
|
||||
tar -czvf linux_arm_v7_client.tar.gz npc
|
||||
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=6 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
|
||||
|
||||
tar -czvf linux_arm_v6_client.tar.gz npc conf/npc.conf conf/multi_account.conf
|
||||
tar -czvf linux_arm_v6_client.tar.gz npc
|
||||
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=5 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
|
||||
|
||||
tar -czvf linux_arm_v5_client.tar.gz npc conf/npc.conf conf/multi_account.conf
|
||||
tar -czvf linux_arm_v5_client.tar.gz npc
|
||||
|
||||
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
|
||||
|
||||
tar -czvf linux_arm64_client.tar.gz npc conf/npc.conf conf/multi_account.conf
|
||||
tar -czvf linux_arm64_client.tar.gz npc
|
||||
|
||||
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=mips64 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
|
||||
|
||||
tar -czvf linux_mips64_client.tar.gz npc conf/npc.conf conf/multi_account.conf
|
||||
tar -czvf linux_mips64_client.tar.gz npc
|
||||
|
||||
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=mips64le go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
|
||||
|
||||
tar -czvf linux_mips64le_client.tar.gz npc conf/npc.conf conf/multi_account.conf
|
||||
tar -czvf linux_mips64le_client.tar.gz npc
|
||||
|
||||
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=mipsle go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
|
||||
|
||||
tar -czvf linux_mipsle_client.tar.gz npc conf/npc.conf conf/multi_account.conf
|
||||
tar -czvf linux_mipsle_client.tar.gz npc
|
||||
|
||||
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=mips go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
|
||||
|
||||
tar -czvf linux_mips_client.tar.gz npc conf/npc.conf conf/multi_account.conf
|
||||
tar -czvf linux_mips_client.tar.gz npc
|
||||
|
||||
|
||||
CGO_ENABLED=0 GOOS=windows GOARCH=386 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
|
||||
|
||||
tar -czvf windows_386_client.tar.gz npc.exe conf/npc.conf conf/multi_account.conf
|
||||
tar -czvf windows_386_client.tar.gz npc.exe
|
||||
|
||||
|
||||
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
|
||||
|
||||
tar -czvf windows_amd64_client.tar.gz npc.exe conf/npc.conf conf/multi_account.conf
|
||||
tar -czvf windows_amd64_client.tar.gz npc.exe
|
||||
|
||||
|
||||
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
|
||||
|
||||
tar -czvf darwin_amd64_client.tar.gz npc conf/npc.conf conf/multi_account.conf
|
||||
tar -czvf darwin_amd64_client.tar.gz npc
|
||||
|
||||
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
|
||||
|
||||
tar -czvf darwin_arm64_client.tar.gz npc conf/npc.conf conf/multi_account.conf
|
||||
tar -czvf darwin_arm64_client.tar.gz npc
|
||||
|
||||
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
|
||||
|
||||
tar -czvf linux_amd64_server.tar.gz conf/nps.conf conf/tasks.json conf/clients.json conf/hosts.json conf/server.key conf/server.pem web/views web/static nps
|
||||
tar -czvf linux_amd64_server.tar.gz nps
|
||||
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=386 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
|
||||
|
||||
tar -czvf linux_386_server.tar.gz conf/nps.conf conf/tasks.json conf/clients.json conf/hosts.json conf/server.key conf/server.pem web/views web/static nps
|
||||
tar -czvf linux_386_server.tar.gz nps
|
||||
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=5 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
|
||||
|
||||
tar -czvf linux_arm_v5_server.tar.gz conf/nps.conf conf/tasks.json conf/clients.json conf/hosts.json conf/server.key conf/server.pem web/views web/static nps
|
||||
tar -czvf linux_arm_v5_server.tar.gz nps
|
||||
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=6 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
|
||||
|
||||
tar -czvf linux_arm_v6_server.tar.gz conf/nps.conf conf/tasks.json conf/clients.json conf/hosts.json conf/server.key conf/server.pem web/views web/static nps
|
||||
tar -czvf linux_arm_v6_server.tar.gz nps
|
||||
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=7 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
|
||||
|
||||
tar -czvf linux_arm_v7_server.tar.gz conf/nps.conf conf/tasks.json conf/clients.json conf/hosts.json conf/server.key conf/server.pem web/views web/static nps
|
||||
tar -czvf linux_arm_v7_server.tar.gz nps
|
||||
|
||||
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
|
||||
|
||||
tar -czvf linux_arm64_server.tar.gz conf/nps.conf conf/tasks.json conf/clients.json conf/hosts.json conf/server.key conf/server.pem web/views web/static nps
|
||||
tar -czvf linux_arm64_server.tar.gz nps
|
||||
|
||||
|
||||
CGO_ENABLED=0 GOOS=freebsd GOARCH=arm go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
|
||||
|
||||
tar -czvf freebsd_arm_server.tar.gz conf/nps.conf conf/tasks.json conf/clients.json conf/hosts.json conf/server.key conf/server.pem web/views web/static nps
|
||||
tar -czvf freebsd_arm_server.tar.gz nps
|
||||
|
||||
|
||||
CGO_ENABLED=0 GOOS=freebsd GOARCH=386 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
|
||||
|
||||
tar -czvf freebsd_386_server.tar.gz conf/nps.conf conf/tasks.json conf/clients.json conf/hosts.json conf/server.key conf/server.pem web/views web/static nps
|
||||
tar -czvf freebsd_386_server.tar.gz nps
|
||||
|
||||
|
||||
CGO_ENABLED=0 GOOS=freebsd GOARCH=amd64 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
|
||||
|
||||
tar -czvf freebsd_amd64_server.tar.gz conf/nps.conf conf/tasks.json conf/clients.json conf/hosts.json conf/server.key conf/server.pem web/views web/static nps
|
||||
tar -czvf freebsd_amd64_server.tar.gz nps
|
||||
|
||||
|
||||
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=mips go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
|
||||
|
||||
tar -czvf linux_mips_server.tar.gz conf/nps.conf conf/tasks.json conf/clients.json conf/hosts.json conf/server.key conf/server.pem web/views web/static nps
|
||||
tar -czvf linux_mips_server.tar.gz nps
|
||||
|
||||
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=mips64 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
|
||||
|
||||
tar -czvf linux_mips64_server.tar.gz conf/nps.conf conf/tasks.json conf/clients.json conf/hosts.json conf/server.key conf/server.pem web/views web/static nps
|
||||
tar -czvf linux_mips64_server.tar.gz nps
|
||||
|
||||
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=mips64le go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
|
||||
|
||||
tar -czvf linux_mips64le_server.tar.gz conf/nps.conf conf/tasks.json conf/clients.json conf/hosts.json conf/server.key conf/server.pem web/views web/static nps
|
||||
tar -czvf linux_mips64le_server.tar.gz nps
|
||||
|
||||
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=mipsle go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
|
||||
|
||||
tar -czvf linux_mipsle_server.tar.gz conf/nps.conf conf/tasks.json conf/clients.json conf/hosts.json conf/server.key conf/server.pem web/views web/static nps
|
||||
tar -czvf linux_mipsle_server.tar.gz nps
|
||||
|
||||
|
||||
|
||||
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
|
||||
|
||||
tar -czvf darwin_amd64_server.tar.gz conf/nps.conf conf/tasks.json conf/clients.json conf/hosts.json conf/server.key conf/server.pem web/views web/static nps
|
||||
tar -czvf darwin_amd64_server.tar.gz nps
|
||||
|
||||
|
||||
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
|
||||
|
||||
tar -czvf darwin_arm64_server.tar.gz conf/nps.conf conf/tasks.json conf/clients.json conf/hosts.json conf/server.key conf/server.pem web/views web/static nps
|
||||
tar -czvf darwin_arm64_server.tar.gz nps
|
||||
|
||||
|
||||
|
||||
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
|
||||
|
||||
tar -czvf windows_amd64_server.tar.gz conf/nps.conf conf/tasks.json conf/clients.json conf/hosts.json conf/server.key conf/server.pem web/views web/static nps.exe
|
||||
tar -czvf windows_amd64_server.tar.gz nps.exe
|
||||
|
||||
|
||||
CGO_ENABLED=0 GOOS=windows GOARCH=386 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
|
||||
|
||||
tar -czvf windows_386_server.tar.gz conf/nps.conf conf/tasks.json conf/clients.json conf/hosts.json conf/server.key conf/server.pem web/views web/static nps.exe
|
||||
tar -czvf windows_386_server.tar.gz nps.exe
|
||||
@@ -1,5 +1,5 @@
|
||||
#/bash/sh
|
||||
export VERSION=0.26.23
|
||||
export VERSION=0.26.33
|
||||
export GOPROXY=direct
|
||||
|
||||
sudo apt-get update
|
||||
@@ -13,71 +13,71 @@ tar -xvf upx-3.95-amd64_linux.tar.xz
|
||||
cp upx-3.95-amd64_linux/upx ./
|
||||
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
|
||||
tar -czvf linux_amd64_client.tar.gz npc conf/npc.conf conf/multi_account.conf
|
||||
tar -czvf linux_amd64_client.tar.gz npc
|
||||
|
||||
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=386 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
|
||||
tar -czvf linux_386_client.tar.gz npc conf/npc.conf conf/multi_account.conf
|
||||
tar -czvf linux_386_client.tar.gz npc
|
||||
|
||||
|
||||
CGO_ENABLED=0 GOOS=freebsd GOARCH=386 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
|
||||
tar -czvf freebsd_386_client.tar.gz npc conf/npc.conf conf/multi_account.conf
|
||||
tar -czvf freebsd_386_client.tar.gz npc
|
||||
|
||||
|
||||
CGO_ENABLED=0 GOOS=freebsd GOARCH=amd64 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
|
||||
tar -czvf freebsd_amd64_client.tar.gz npc conf/npc.conf conf/multi_account.conf
|
||||
tar -czvf freebsd_amd64_client.tar.gz npc
|
||||
|
||||
|
||||
CGO_ENABLED=0 GOOS=freebsd GOARCH=arm go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
|
||||
tar -czvf freebsd_arm_client.tar.gz npc conf/npc.conf conf/multi_account.conf
|
||||
tar -czvf freebsd_arm_client.tar.gz npc
|
||||
|
||||
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=7 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
|
||||
tar -czvf linux_arm_v7_client.tar.gz npc conf/npc.conf conf/multi_account.conf
|
||||
tar -czvf linux_arm_v7_client.tar.gz npc
|
||||
|
||||
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=6 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
|
||||
tar -czvf linux_arm_v6_client.tar.gz npc conf/npc.conf conf/multi_account.conf
|
||||
tar -czvf linux_arm_v6_client.tar.gz npc
|
||||
|
||||
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=5 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
|
||||
tar -czvf linux_arm_v5_client.tar.gz npc conf/npc.conf conf/multi_account.conf
|
||||
tar -czvf linux_arm_v5_client.tar.gz npc
|
||||
|
||||
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
|
||||
tar -czvf linux_arm64_client.tar.gz npc conf/npc.conf conf/multi_account.conf
|
||||
tar -czvf linux_arm64_client.tar.gz npc
|
||||
|
||||
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=mips64 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
|
||||
tar -czvf linux_mips64_client.tar.gz npc conf/npc.conf conf/multi_account.conf
|
||||
tar -czvf linux_mips64_client.tar.gz npc
|
||||
|
||||
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=mips64le go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
|
||||
tar -czvf linux_mips64le_client.tar.gz npc conf/npc.conf conf/multi_account.conf
|
||||
tar -czvf linux_mips64le_client.tar.gz npc
|
||||
|
||||
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=mipsle go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
|
||||
tar -czvf linux_mipsle_client.tar.gz npc conf/npc.conf conf/multi_account.conf
|
||||
tar -czvf linux_mipsle_client.tar.gz npc
|
||||
|
||||
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=mips go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
|
||||
tar -czvf linux_mips_client.tar.gz npc conf/npc.conf conf/multi_account.conf
|
||||
tar -czvf linux_mips_client.tar.gz npc
|
||||
|
||||
|
||||
CGO_ENABLED=0 GOOS=windows GOARCH=386 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
|
||||
tar -czvf windows_386_client.tar.gz npc.exe conf/npc.conf conf/multi_account.conf
|
||||
tar -czvf windows_386_client.tar.gz npc.exe
|
||||
|
||||
|
||||
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
|
||||
tar -czvf windows_amd64_client.tar.gz npc.exe conf/npc.conf conf/multi_account.conf
|
||||
tar -czvf windows_amd64_client.tar.gz npc.exe
|
||||
|
||||
|
||||
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
|
||||
tar -czvf darwin_amd64_client.tar.gz npc conf/npc.conf conf/multi_account.conf
|
||||
tar -czvf darwin_amd64_client.tar.gz npc
|
||||
|
||||
|
||||
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
|
||||
tar -czvf darwin_arm64_client.tar.gz npc conf/npc.conf conf/multi_account.conf
|
||||
tar -czvf darwin_arm64_client.tar.gz npc
|
||||
|
||||
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
|
||||
|
||||
+83
-35
@@ -3,8 +3,6 @@ package client
|
||||
import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"ehang.io/nps/lib/nps_mux"
|
||||
"github.com/pires/go-proxyproto"
|
||||
"net"
|
||||
"net/http"
|
||||
"strconv"
|
||||
@@ -12,6 +10,9 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"ehang.io/nps/lib/nps_mux"
|
||||
"github.com/pires/go-proxyproto"
|
||||
|
||||
"github.com/astaxie/beego/logs"
|
||||
"github.com/xtaci/kcp-go"
|
||||
|
||||
@@ -33,6 +34,7 @@ type TRPClient struct {
|
||||
cnf *config.Config
|
||||
disconnectTime int
|
||||
once sync.Once
|
||||
logger *logs.BeeLogger // 每个客户端独立的 logger
|
||||
}
|
||||
|
||||
// new client
|
||||
@@ -46,9 +48,53 @@ func NewRPClient(svraddr string, vKey string, bridgeConnType string, proxyUrl st
|
||||
cnf: cnf,
|
||||
disconnectTime: disconnectTime,
|
||||
once: sync.Once{},
|
||||
logger: nil, // 默认使用全局 logger,可通过 SetLogger 设置
|
||||
}
|
||||
}
|
||||
|
||||
// SetLogger 设置客户端的独立 logger
|
||||
func (s *TRPClient) SetLogger(logger *logs.BeeLogger) {
|
||||
s.logger = logger
|
||||
}
|
||||
|
||||
// log 辅助方法:如果设置了独立 logger 就使用,否则使用全局 logger
|
||||
func (s *TRPClient) logInfo(format string, v ...interface{}) {
|
||||
if s.logger != nil {
|
||||
s.logger.Info(format, v...)
|
||||
} else {
|
||||
logs.Info(format, v...)
|
||||
}
|
||||
}
|
||||
|
||||
func (s *TRPClient) logError(format string, v ...interface{}) {
|
||||
if s.logger != nil {
|
||||
s.logger.Error(format, v...)
|
||||
} else {
|
||||
logs.Error(format, v...)
|
||||
}
|
||||
}
|
||||
|
||||
func (s *TRPClient) logWarn(format string, v ...interface{}) {
|
||||
if s.logger != nil {
|
||||
s.logger.Warn(format, v...)
|
||||
} else {
|
||||
logs.Warn(format, v...)
|
||||
}
|
||||
}
|
||||
|
||||
func (s *TRPClient) logTrace(format string, v ...interface{}) {
|
||||
if s.logger != nil {
|
||||
s.logger.Trace(format, v...)
|
||||
} else {
|
||||
logs.Trace(format, v...)
|
||||
}
|
||||
}
|
||||
|
||||
// IsConnected 返回客户端是否已成功连接到服务器
|
||||
func (s *TRPClient) IsConnected() bool {
|
||||
return s.signal != nil
|
||||
}
|
||||
|
||||
var NowStatus int
|
||||
var CloseClient bool
|
||||
|
||||
@@ -62,16 +108,16 @@ retry:
|
||||
NowStatus = 0
|
||||
c, err := NewConn(s.bridgeConnType, s.vKey, s.svrAddr, common.WORK_MAIN, s.proxyUrl)
|
||||
if err != nil {
|
||||
logs.Error("The connection server failed and will be reconnected in five seconds, error", err.Error())
|
||||
s.logError("The connection server failed and will be reconnected in five seconds, error", err.Error())
|
||||
time.Sleep(time.Second * 5)
|
||||
goto retry
|
||||
}
|
||||
if c == nil {
|
||||
logs.Error("Error data from server, and will be reconnected in five seconds")
|
||||
s.logError("Error data from server, and will be reconnected in five seconds")
|
||||
time.Sleep(time.Second * 5)
|
||||
goto retry
|
||||
}
|
||||
logs.Info("Successful connection with server %s", s.svrAddr)
|
||||
s.logInfo("Successful connection with server %s", s.svrAddr)
|
||||
//monitor the connection
|
||||
go s.ping()
|
||||
s.signal = c
|
||||
@@ -91,14 +137,14 @@ func (s *TRPClient) handleMain() {
|
||||
for {
|
||||
flags, err := s.signal.ReadFlag()
|
||||
if err != nil {
|
||||
logs.Error("Accept server data error %s, end this service", err.Error())
|
||||
s.logError("Accept server data error %s, end this service", err.Error())
|
||||
break
|
||||
}
|
||||
switch flags {
|
||||
case common.NEW_UDP_CONN:
|
||||
//read server udp addr and password
|
||||
if lAddr, err := s.signal.GetShortLenContent(); err != nil {
|
||||
logs.Warn(err)
|
||||
s.logWarn(err.Error())
|
||||
return
|
||||
} else if pwd, err := s.signal.GetShortLenContent(); err == nil {
|
||||
var localAddr string
|
||||
@@ -106,7 +152,7 @@ func (s *TRPClient) handleMain() {
|
||||
if v, ok := s.p2pAddr[crypt.Md5(string(pwd)+strconv.Itoa(int(time.Now().Unix()/100)))]; !ok {
|
||||
tmpConn, err := common.GetLocalUdpAddr()
|
||||
if err != nil {
|
||||
logs.Error(err)
|
||||
s.logError(err.Error())
|
||||
return
|
||||
}
|
||||
localAddr = tmpConn.LocalAddr().String()
|
||||
@@ -125,25 +171,25 @@ func (s *TRPClient) newUdpConn(localAddr, rAddr string, md5Password string) {
|
||||
var err error
|
||||
var remoteAddress string
|
||||
if remoteAddress, localConn, err = handleP2PUdp(localAddr, rAddr, md5Password, common.WORK_P2P_PROVIDER); err != nil {
|
||||
logs.Error(err)
|
||||
s.logError(err.Error())
|
||||
return
|
||||
}
|
||||
l, err := kcp.ServeConn(nil, 150, 3, localConn)
|
||||
if err != nil {
|
||||
logs.Error(err)
|
||||
s.logError(err.Error())
|
||||
return
|
||||
}
|
||||
logs.Trace("start local p2p udp listen, local address", localConn.LocalAddr().String())
|
||||
s.logTrace("start local p2p udp listen, local address %s", localConn.LocalAddr().String())
|
||||
for {
|
||||
udpTunnel, err := l.AcceptKCP()
|
||||
if err != nil {
|
||||
logs.Error(err)
|
||||
s.logError(err.Error())
|
||||
l.Close()
|
||||
return
|
||||
}
|
||||
if udpTunnel.RemoteAddr().String() == string(remoteAddress) {
|
||||
conn.SetUdpSession(udpTunnel)
|
||||
logs.Trace("successful connection with client ,address %s", udpTunnel.RemoteAddr().String())
|
||||
s.logTrace("successful connection with client ,address %s", udpTunnel.RemoteAddr().String())
|
||||
//read link info from remote
|
||||
conn.Accept(nps_mux.NewMux(udpTunnel, s.bridgeConnType, s.disconnectTime), func(c net.Conn) {
|
||||
go s.handleChan(c)
|
||||
@@ -157,14 +203,14 @@ func (s *TRPClient) newUdpConn(localAddr, rAddr string, md5Password string) {
|
||||
func (s *TRPClient) newChan() {
|
||||
tunnel, err := NewConn(s.bridgeConnType, s.vKey, s.svrAddr, common.WORK_CHAN, s.proxyUrl)
|
||||
if err != nil {
|
||||
logs.Error("connect to ", s.svrAddr, "error:", err)
|
||||
s.logError("connect to %s error: %v", s.svrAddr, err)
|
||||
return
|
||||
}
|
||||
s.tunnel = nps_mux.NewMux(tunnel.Conn, s.bridgeConnType, s.disconnectTime)
|
||||
for {
|
||||
src, err := s.tunnel.Accept()
|
||||
if err != nil {
|
||||
logs.Warn(err)
|
||||
s.logWarn(err.Error())
|
||||
s.Close()
|
||||
break
|
||||
}
|
||||
@@ -176,7 +222,7 @@ func (s *TRPClient) handleChan(src net.Conn) {
|
||||
lk, err := conn.NewConn(src).GetLinkInfo()
|
||||
if err != nil || lk == nil {
|
||||
src.Close()
|
||||
logs.Error("get connection info from server error ", err)
|
||||
s.logError("get connection info from server error %v", err)
|
||||
return
|
||||
}
|
||||
//host for target processing
|
||||
@@ -184,7 +230,7 @@ func (s *TRPClient) handleChan(src net.Conn) {
|
||||
//if Conn type is http, read the request and log
|
||||
if lk.ConnType == "http" {
|
||||
if targetConn, err := net.DialTimeout(common.CONN_TCP, lk.Host, lk.Option.Timeout); err != nil {
|
||||
logs.Warn("connect to %s error %s", lk.Host, err.Error())
|
||||
s.logWarn("connect to %s error %s", lk.Host, err.Error())
|
||||
src.Close()
|
||||
} else {
|
||||
srcConn := conn.GetConn(src, lk.Crypt, lk.Compress, nil, false)
|
||||
@@ -203,7 +249,7 @@ func (s *TRPClient) handleChan(src net.Conn) {
|
||||
if len(remoteAddr) == 0 {
|
||||
remoteAddr = r.RemoteAddr
|
||||
}
|
||||
logs.Trace("http request, method %s, host %s, url %s, remote address %s", r.Method, r.Host, r.URL.Path, remoteAddr)
|
||||
s.logTrace("http request, method %s, host %s, url %s, remote address %s", r.Method, r.Host, r.URL.Path, remoteAddr)
|
||||
r.Write(targetConn)
|
||||
}
|
||||
}
|
||||
@@ -211,15 +257,15 @@ func (s *TRPClient) handleChan(src net.Conn) {
|
||||
return
|
||||
}
|
||||
if lk.ConnType == "udp5" {
|
||||
logs.Trace("new %s connection with the goal of %s, remote address:%s", lk.ConnType, lk.Host, lk.RemoteAddr)
|
||||
s.logTrace("new %s connection with the goal of %s, remote address:%s", lk.ConnType, lk.Host, lk.RemoteAddr)
|
||||
s.handleUdp(src)
|
||||
}
|
||||
//connect to target if conn type is tcp or udp
|
||||
if targetConn, err := net.DialTimeout(lk.ConnType, lk.Host, lk.Option.Timeout); err != nil {
|
||||
logs.Warn("connect to %s error %s", lk.Host, err.Error())
|
||||
s.logWarn("connect to %s error %s", lk.Host, err.Error())
|
||||
src.Close()
|
||||
} else {
|
||||
logs.Trace("new %s connection with the goal of %s, remote address:%s", lk.ConnType, lk.Host, lk.RemoteAddr)
|
||||
s.logTrace("new %s connection with the goal of %s, remote address:%s", lk.ConnType, lk.Host, lk.RemoteAddr)
|
||||
|
||||
if lk.ProtoVersion == "V1" || lk.ProtoVersion == "V2" {
|
||||
var addr = targetConn.RemoteAddr()
|
||||
@@ -257,11 +303,11 @@ func (s *TRPClient) handleChan(src net.Conn) {
|
||||
|
||||
_, err2 := header.WriteTo(targetConn)
|
||||
if err2 != nil {
|
||||
logs.Error(err2)
|
||||
s.logError(err2.Error())
|
||||
}
|
||||
}
|
||||
|
||||
conn.CopyWaitGroup(src, targetConn, lk.Crypt, lk.Compress, nil, nil, false, nil, nil)
|
||||
conn.CopyWaitGroup(src, targetConn, lk.Crypt, lk.Compress, nil, nil, false, nil, nil, nil)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -270,7 +316,7 @@ func (s *TRPClient) handleUdp(serverConn net.Conn) {
|
||||
local, err := net.ListenUDP("udp", nil)
|
||||
defer serverConn.Close()
|
||||
if err != nil {
|
||||
logs.Error("bind local udp port error ", err.Error())
|
||||
s.logError("bind local udp port error %s", err.Error())
|
||||
return
|
||||
}
|
||||
defer local.Close()
|
||||
@@ -278,21 +324,23 @@ func (s *TRPClient) handleUdp(serverConn net.Conn) {
|
||||
defer serverConn.Close()
|
||||
b := common.BufPoolUdp.Get().([]byte)
|
||||
defer common.BufPoolUdp.Put(b)
|
||||
var buf bytes.Buffer
|
||||
for {
|
||||
n, raddr, err := local.ReadFrom(b)
|
||||
if err != nil {
|
||||
logs.Error("read data from remote server error", err.Error())
|
||||
s.logError("read data from remote server error %s", err.Error())
|
||||
return
|
||||
}
|
||||
buf := bytes.Buffer{}
|
||||
buf.Reset()
|
||||
dgram := common.NewUDPDatagram(common.NewUDPHeader(0, 0, common.ToSocksAddr(raddr)), b[:n])
|
||||
dgram.Write(&buf)
|
||||
b, err := conn.GetLenBytes(buf.Bytes())
|
||||
data, err := conn.GetLenBytes(buf.Bytes())
|
||||
if err != nil {
|
||||
logs.Warn("get len bytes error", err.Error())
|
||||
s.logWarn("get len bytes error %s", err.Error())
|
||||
continue
|
||||
}
|
||||
if _, err := serverConn.Write(b); err != nil {
|
||||
logs.Error("write data to remote error", err.Error())
|
||||
if _, err := serverConn.Write(data); err != nil {
|
||||
s.logError("write data to remote error %s", err.Error())
|
||||
return
|
||||
}
|
||||
}
|
||||
@@ -302,23 +350,23 @@ func (s *TRPClient) handleUdp(serverConn net.Conn) {
|
||||
for {
|
||||
n, err := serverConn.Read(b)
|
||||
if err != nil {
|
||||
logs.Error("read udp data from server error ", err.Error())
|
||||
s.logError("read udp data from server error %s", err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
udpData, err := common.ReadUDPDatagram(bytes.NewReader(b[:n]))
|
||||
if err != nil {
|
||||
logs.Error("unpack data error", err.Error())
|
||||
s.logError("unpack data error %s", err.Error())
|
||||
return
|
||||
}
|
||||
raddr, err := net.ResolveUDPAddr("udp", udpData.Header.Addr.String())
|
||||
if err != nil {
|
||||
logs.Error("build remote addr err", err.Error())
|
||||
s.logError("build remote addr err %s", err.Error())
|
||||
continue // drop silently
|
||||
}
|
||||
_, err = local.WriteTo(udpData.Data, raddr)
|
||||
if err != nil {
|
||||
logs.Error("write data to remote ", raddr.String(), "error", err.Error())
|
||||
s.logError("write data to remote %s error %s", raddr.String(), err.Error())
|
||||
return
|
||||
}
|
||||
}
|
||||
@@ -331,7 +379,7 @@ loop:
|
||||
for {
|
||||
select {
|
||||
case <-s.ticker.C:
|
||||
if s.tunnel != nil && s.tunnel.IsClose {
|
||||
if s.tunnel != nil && s.tunnel.IsClose() {
|
||||
s.Close()
|
||||
break loop
|
||||
}
|
||||
|
||||
+33
-30
@@ -2,12 +2,12 @@ package client
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"context"
|
||||
"crypto/tls"
|
||||
"encoding/base64"
|
||||
"encoding/binary"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"math"
|
||||
"math/rand"
|
||||
@@ -147,7 +147,7 @@ re:
|
||||
}
|
||||
vkey = string(b)
|
||||
}
|
||||
ioutil.WriteFile(filepath.Join(common.GetTmpPath(), "npc_vkey.txt"), []byte(vkey), 0600)
|
||||
os.WriteFile(filepath.Join(common.GetTmpPath(), "npc_vkey.txt"), []byte(vkey), 0600)
|
||||
|
||||
//send hosts to server
|
||||
for _, v := range cnf.Hosts {
|
||||
@@ -343,6 +343,7 @@ func handleP2PUdp(localAddr, rAddr, md5Password, role string) (remoteAddress str
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
defer localConn.Close()
|
||||
err = getRemoteAddressFromServer(rAddr, localConn, md5Password, role, 0)
|
||||
if err != nil {
|
||||
logs.Error(err)
|
||||
@@ -359,27 +360,32 @@ func handleP2PUdp(localAddr, rAddr, md5Password, role string) (remoteAddress str
|
||||
return
|
||||
}
|
||||
var remoteAddr1, remoteAddr2, remoteAddr3 string
|
||||
// 修复:添加超时,避免无限等待远端响应
|
||||
localConn.SetReadDeadline(time.Now().Add(30 * time.Second))
|
||||
buf := make([]byte, 1024)
|
||||
for {
|
||||
buf := make([]byte, 1024)
|
||||
if n, addr, er := localConn.ReadFromUDP(buf); er != nil {
|
||||
err = er
|
||||
var n int
|
||||
var addr *net.UDPAddr
|
||||
n, addr, err = localConn.ReadFromUDP(buf)
|
||||
if err != nil {
|
||||
localConn.SetReadDeadline(time.Time{})
|
||||
return
|
||||
} else {
|
||||
rAddr2, _ := getNextAddr(rAddr, 1)
|
||||
rAddr3, _ := getNextAddr(rAddr, 2)
|
||||
switch addr.String() {
|
||||
case rAddr:
|
||||
remoteAddr1 = string(buf[:n])
|
||||
case rAddr2:
|
||||
remoteAddr2 = string(buf[:n])
|
||||
case rAddr3:
|
||||
remoteAddr3 = string(buf[:n])
|
||||
}
|
||||
}
|
||||
rAddr2, _ := getNextAddr(rAddr, 1)
|
||||
rAddr3, _ := getNextAddr(rAddr, 2)
|
||||
switch addr.String() {
|
||||
case rAddr:
|
||||
remoteAddr1 = string(buf[:n])
|
||||
case rAddr2:
|
||||
remoteAddr2 = string(buf[:n])
|
||||
case rAddr3:
|
||||
remoteAddr3 = string(buf[:n])
|
||||
}
|
||||
if remoteAddr1 != "" && remoteAddr2 != "" && remoteAddr3 != "" {
|
||||
break
|
||||
}
|
||||
}
|
||||
localConn.SetReadDeadline(time.Time{})
|
||||
if remoteAddress, err = sendP2PTestMsg(localConn, remoteAddr1, remoteAddr2, remoteAddr3); err != nil {
|
||||
return
|
||||
}
|
||||
@@ -389,9 +395,8 @@ func handleP2PUdp(localAddr, rAddr, md5Password, role string) (remoteAddress str
|
||||
|
||||
func sendP2PTestMsg(localConn *net.UDPConn, remoteAddr1, remoteAddr2, remoteAddr3 string) (string, error) {
|
||||
logs.Trace(remoteAddr3, remoteAddr2, remoteAddr1)
|
||||
defer localConn.Close()
|
||||
isClose := false
|
||||
defer func() { isClose = true }()
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
interval, err := getAddrInterval(remoteAddr1, remoteAddr2, remoteAddr3)
|
||||
if err != nil {
|
||||
return "", err
|
||||
@@ -410,10 +415,9 @@ func sendP2PTestMsg(localConn *net.UDPConn, remoteAddr1, remoteAddr2, remoteAddr
|
||||
defer ticker.Stop()
|
||||
for {
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
return
|
||||
case <-ticker.C:
|
||||
if isClose {
|
||||
return
|
||||
}
|
||||
if _, err := localConn.WriteTo([]byte(common.WORK_P2P_CONNECT), remoteUdpAddr); err != nil {
|
||||
return
|
||||
}
|
||||
@@ -436,10 +440,9 @@ func sendP2PTestMsg(localConn *net.UDPConn, remoteAddr1, remoteAddr2, remoteAddr
|
||||
defer ticker.Stop()
|
||||
for {
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
return
|
||||
case <-ticker.C:
|
||||
if isClose {
|
||||
return
|
||||
}
|
||||
if _, err := localConn.WriteTo([]byte(common.WORK_P2P_CONNECT), remoteUdpAddr); err != nil {
|
||||
return
|
||||
}
|
||||
@@ -552,13 +555,13 @@ func getRandomPortArr(min, max int) []int {
|
||||
for i := min; i <= max; i++ {
|
||||
addrAddr[max-i] = i
|
||||
}
|
||||
rand.Seed(time.Now().UnixNano())
|
||||
var r, temp int
|
||||
r := rand.New(rand.NewSource(time.Now().UnixNano()))
|
||||
var ri, temp int
|
||||
for i := max - min; i > 0; i-- {
|
||||
r = rand.Int() % i
|
||||
ri = r.Int() % i
|
||||
temp = addrAddr[i]
|
||||
addrAddr[i] = addrAddr[r]
|
||||
addrAddr[r] = temp
|
||||
addrAddr[i] = addrAddr[ri]
|
||||
addrAddr[ri] = temp
|
||||
}
|
||||
return addrAddr
|
||||
}
|
||||
|
||||
+2
-2
@@ -161,7 +161,7 @@ func handleSecret(localTcpConn net.Conn, config *config.CommonConfig, l *config.
|
||||
logs.Error("Local connection server failed ", err.Error())
|
||||
return
|
||||
}
|
||||
conn.CopyWaitGroup(remoteConn.Conn, localTcpConn, false, false, nil, nil, false, nil, nil)
|
||||
conn.CopyWaitGroup(remoteConn.Conn, localTcpConn, false, false, nil, nil, false, nil, nil, nil)
|
||||
}
|
||||
|
||||
func handleP2PVisitor(localTcpConn net.Conn, config *config.CommonConfig, l *config.LocalServer) {
|
||||
@@ -178,7 +178,7 @@ func handleP2PVisitor(localTcpConn net.Conn, config *config.CommonConfig, l *con
|
||||
udpConnStatus = false
|
||||
return
|
||||
} else {
|
||||
conn.CopyWaitGroup(target, localTcpConn, false, config.Client.Cnf.Compress, nil, nil, false, nil, nil)
|
||||
conn.CopyWaitGroup(target, localTcpConn, false, config.Client.Cnf.Compress, nil, nil, false, nil, nil, nil)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
# 编译输出
|
||||
*.exe
|
||||
*.dll
|
||||
*.so
|
||||
*.dylib
|
||||
*.o
|
||||
*.obj
|
||||
|
||||
# 依赖包
|
||||
node_modules/
|
||||
vendor/
|
||||
|
||||
# IDE
|
||||
.idea/
|
||||
.vscode/
|
||||
*.swp
|
||||
*.swo
|
||||
*~
|
||||
|
||||
# 系统文件
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
|
||||
# 构建临时文件
|
||||
*.tmp
|
||||
build/windows/
|
||||
dist/
|
||||
@@ -0,0 +1,47 @@
|
||||
# NPS 客户端 GUI (Wails 版本)
|
||||
|
||||
## 快捷命令格式
|
||||
|
||||
快捷命令使用 Base64 编码,解码后的格式为:
|
||||
```
|
||||
nps:name|addr|key|tls
|
||||
```
|
||||
|
||||
示例:
|
||||
```
|
||||
nps:MyServer|127.0.0.1:8024|mykey123|false
|
||||
```
|
||||
|
||||
编码后的 Base64:
|
||||
```
|
||||
bnBzOk15U2VydmVyfDEyNy4wLjAuMTo4MDI0fG15a2V5MTIzfGZhbHNl
|
||||
```
|
||||
|
||||
## 安装与运行
|
||||
|
||||
### 前置要求
|
||||
- Go 1.21+
|
||||
- Node.js 16+
|
||||
- Yarn
|
||||
|
||||
### 开发模式
|
||||
|
||||
```bash
|
||||
cd npc-gui
|
||||
|
||||
# 安装依赖
|
||||
yarn install
|
||||
|
||||
# 运行开发服务器
|
||||
wails dev
|
||||
```
|
||||
|
||||
|
||||
## 配置存储
|
||||
|
||||
连接配置自动保存在以下位置:
|
||||
- Windows: `%APPDATA%\npc\npc_data.json`
|
||||
- Linux: `~/.config/npc/npc_data.json`
|
||||
- macOS: `~/Library/Application Support/npc/npc_data.json`
|
||||
|
||||
|
||||
@@ -0,0 +1,898 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/base64"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"ehang.io/nps/client"
|
||||
"ehang.io/nps/lib/version"
|
||||
_ "github.com/astaxie/beego"
|
||||
"github.com/astaxie/beego/logs"
|
||||
wailsRuntime "github.com/wailsapp/wails/v2/pkg/runtime"
|
||||
)
|
||||
|
||||
type App struct {
|
||||
ctx context.Context
|
||||
}
|
||||
|
||||
// ShortClient 与前端结构对应
|
||||
type ShortClient struct {
|
||||
Name string `json:"name"`
|
||||
Addr string `json:"addr"`
|
||||
Key string `json:"key"`
|
||||
TLS bool `json:"tls"`
|
||||
Running bool `json:"running"` // 兼容旧版本,实际用Status
|
||||
Error string `json:"error"` // 连接错误信息
|
||||
Status string `json:"status"` // 连接状态: "stopped", "connecting", "connected"
|
||||
}
|
||||
|
||||
// ConnectionLog 连接日志项
|
||||
type ConnectionLog struct {
|
||||
Timestamp string `json:"timestamp"`
|
||||
Message string `json:"message"`
|
||||
Type string `json:"type"` // "info", "error", "warning", "success"
|
||||
ClientId string `json:"clientId"`
|
||||
}
|
||||
|
||||
var (
|
||||
shortcuts []ShortClient
|
||||
shortcutsMu sync.Mutex
|
||||
|
||||
// 改为用 context 管理内置客户端,而不是外部进程
|
||||
running = make(map[string]context.CancelFunc)
|
||||
clients = make(map[string]*client.TRPClient)
|
||||
clientErrors = make(map[string]string) // 存储客户端连接错误信息
|
||||
clientConnected = make(map[string]bool) // 存储客户端连接状态 (true=connected)
|
||||
clientAttempted = make(map[string]bool) // 存储客户端是否尝试过连接
|
||||
clientLoggers = make(map[string]*logs.BeeLogger) // 为每个客户端单独管理 logger
|
||||
statusMu sync.Mutex // 状态锁
|
||||
runningMu sync.Mutex
|
||||
loggerMu sync.Mutex // 保护 clientLoggers 的并发访问
|
||||
disconnectTimeout = 60
|
||||
connType = "tcp"
|
||||
|
||||
// 日志缓存机制,避免频繁读取文件
|
||||
logsCacheMu sync.RWMutex
|
||||
logsCache = make(map[string][]ConnectionLog) // 缓存:clientId -> logs
|
||||
logsCacheTime = make(map[string]time.Time) // 缓存时间:clientId -> time
|
||||
logsCacheTTL = 2 * time.Second // 缓存有效期 2 秒
|
||||
)
|
||||
|
||||
func NewApp() *App { return &App{} }
|
||||
|
||||
func (a *App) startup(ctx context.Context) {
|
||||
// 保存 context,用于后续调用 runtime API
|
||||
a.ctx = ctx
|
||||
|
||||
// 初始化日志系统,只使用 store logger(内存缓存)
|
||||
// 每个客户端有自己独立的日志文件,不需要全局日志文件
|
||||
logs.SetLogger("store")
|
||||
logs.SetLevel(logs.LevelDebug)
|
||||
|
||||
// 同步开机启动状态:检查配置与实际注册表是否一致
|
||||
go func() {
|
||||
store, err := loadPersistentStore()
|
||||
if err == nil {
|
||||
actualEnabled := isStartupEnabled()
|
||||
if store.Settings.StartupEnabled && !actualEnabled {
|
||||
// 配置说启用,但实际未启用,则启用之
|
||||
logs.Info("同步开机启动状态:启用")
|
||||
if err := enableStartup(); err != nil {
|
||||
logs.Error("同步开机启动失败: %v", err)
|
||||
}
|
||||
} else if !store.Settings.StartupEnabled && actualEnabled {
|
||||
// 配置说禁用,但实际已启用,则禁用之
|
||||
logs.Info("同步开机启动状态:禁用")
|
||||
if err := disableStartup(); err != nil {
|
||||
logs.Error("同步开机启动失败: %v", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
||||
go a.startTray()
|
||||
}
|
||||
|
||||
func getLogsPath() string {
|
||||
// 尝试从配置中读取用户设置的日志目录
|
||||
store, err := loadPersistentStore()
|
||||
if err == nil && store.Settings.LogDir != "" {
|
||||
// 确保目录存在
|
||||
_ = os.MkdirAll(store.Settings.LogDir, 0o755)
|
||||
return store.Settings.LogDir
|
||||
}
|
||||
|
||||
// 如果没有配置或读取失败,使用默认路径
|
||||
dir, err := os.UserConfigDir()
|
||||
if err != nil {
|
||||
dir = "."
|
||||
}
|
||||
cfgDir := filepath.Join(dir, "npc")
|
||||
_ = os.MkdirAll(cfgDir, 0o755)
|
||||
logsDir := filepath.Join(cfgDir, "logs")
|
||||
_ = os.MkdirAll(logsDir, 0o755)
|
||||
return logsDir
|
||||
}
|
||||
|
||||
// getClientLogFilePath 获取客户端的独立日志文件路径
|
||||
func getClientLogFilePath(vkey string) string {
|
||||
logsDir := getLogsPath()
|
||||
// 如果传入的是包含 addr|vkey 的 id,则提取最后一段作为 vkey
|
||||
if strings.Contains(vkey, "|") {
|
||||
parts := strings.Split(vkey, "|")
|
||||
vkey = parts[len(parts)-1]
|
||||
}
|
||||
// 进一步替换可能在 vkey 中出现的不适合作为文件名的字符
|
||||
vkey = strings.ReplaceAll(vkey, ":", "-")
|
||||
vkey = strings.ReplaceAll(vkey, "\\", "-")
|
||||
vkey = strings.ReplaceAll(vkey, "/", "-")
|
||||
return filepath.Join(logsDir, fmt.Sprintf("npc-client-%s.log", vkey))
|
||||
}
|
||||
|
||||
// initClientLogger 为客户端初始化独立的 logger
|
||||
func initClientLogger(vkey string) {
|
||||
loggerMu.Lock()
|
||||
defer loggerMu.Unlock()
|
||||
|
||||
if _, exists := clientLoggers[vkey]; !exists {
|
||||
// 为每个客户端创建独立的 BeeLogger
|
||||
logger := logs.NewLogger()
|
||||
// 设置为 Debug 级别,可以看到 Trace 日志
|
||||
logger.SetLevel(logs.LevelDebug)
|
||||
|
||||
// 设置独立的日志文件
|
||||
logFilePath := getClientLogFilePath(vkey)
|
||||
// Windows 路径中的反斜杠需要转义
|
||||
escapedPath := strings.ReplaceAll(logFilePath, "\\", "\\\\")
|
||||
logger.SetLogger(logs.AdapterFile, `{"filename":"`+escapedPath+`","daily":true,"maxdays":7}`)
|
||||
|
||||
clientLoggers[vkey] = logger
|
||||
}
|
||||
}
|
||||
|
||||
// getClientLogger 获取客户端的 logger
|
||||
func getClientLogger(id string) *logs.BeeLogger {
|
||||
loggerMu.Lock()
|
||||
defer loggerMu.Unlock()
|
||||
return clientLoggers[id]
|
||||
}
|
||||
|
||||
// closeClientLogger 关闭客户端的 logger
|
||||
func closeClientLogger(id string) {
|
||||
loggerMu.Lock()
|
||||
defer loggerMu.Unlock()
|
||||
|
||||
if logger, exists := clientLoggers[id]; exists {
|
||||
if logger != nil {
|
||||
logger.Close()
|
||||
}
|
||||
delete(clientLoggers, id)
|
||||
}
|
||||
}
|
||||
|
||||
func (a *App) shutdown(ctx context.Context) {
|
||||
setQuitting()
|
||||
QuitTray()
|
||||
wailsRuntime.Quit(a.ctx)
|
||||
}
|
||||
|
||||
// 持久化文件结构(向后兼容旧的仅数组格式)
|
||||
type GuiSettings struct {
|
||||
StartupEnabled bool `json:"startupEnabled"`
|
||||
RememberClientState bool `json:"rememberClientState"`
|
||||
LogDir string `json:"logDir"`
|
||||
ThemeMode string `json:"themeMode"` // "auto", "light", "dark"
|
||||
}
|
||||
|
||||
type PersistentStore struct {
|
||||
Shortcuts []ShortClient `json:"shortcuts"`
|
||||
Settings GuiSettings `json:"settings,omitempty"`
|
||||
ClientStates map[string]string `json:"clientStates,omitempty"`
|
||||
}
|
||||
|
||||
func getStoragePath() string {
|
||||
dir, err := os.UserConfigDir()
|
||||
if err != nil {
|
||||
dir = "."
|
||||
}
|
||||
cfgDir := filepath.Join(dir, "npc")
|
||||
_ = os.MkdirAll(cfgDir, 0o755)
|
||||
return filepath.Join(cfgDir, "npc_data.json")
|
||||
}
|
||||
|
||||
// 读取持久化 store,向后兼容:如果是数组则解析为 shortcuts
|
||||
func loadPersistentStore() (PersistentStore, error) {
|
||||
p := getStoragePath()
|
||||
b, err := os.ReadFile(p)
|
||||
if err != nil {
|
||||
return PersistentStore{}, err
|
||||
}
|
||||
|
||||
// 尝试解析为对象结构
|
||||
var store PersistentStore
|
||||
if err := json.Unmarshal(b, &store); err == nil {
|
||||
// 如果文件是对象但没有 shortcuts 字段,ensure empty slice
|
||||
if store.Shortcuts == nil {
|
||||
store.Shortcuts = []ShortClient{}
|
||||
}
|
||||
return store, nil
|
||||
}
|
||||
|
||||
// 兼容旧格式:直接是 ShortClient 数组
|
||||
var arr []ShortClient
|
||||
if err := json.Unmarshal(b, &arr); err == nil {
|
||||
return PersistentStore{Shortcuts: arr}, nil
|
||||
}
|
||||
|
||||
return PersistentStore{}, errors.New("invalid storage format")
|
||||
}
|
||||
|
||||
// 保存整个 store,保持 settings 与 clientStates
|
||||
func savePersistentStoreLocked(store PersistentStore) {
|
||||
p := getStoragePath()
|
||||
if data, err := json.MarshalIndent(store, "", " "); err == nil {
|
||||
_ = os.WriteFile(p, data, 0o644)
|
||||
}
|
||||
}
|
||||
|
||||
func loadShortcuts() {
|
||||
shortcutsMu.Lock()
|
||||
defer shortcutsMu.Unlock()
|
||||
p := getStoragePath()
|
||||
b, err := os.ReadFile(p)
|
||||
if err != nil {
|
||||
shortcuts = []ShortClient{}
|
||||
return
|
||||
}
|
||||
|
||||
// 先尝试解析为对象格式
|
||||
var store PersistentStore
|
||||
if err := json.Unmarshal(b, &store); err == nil {
|
||||
shortcuts = store.Shortcuts
|
||||
if shortcuts == nil {
|
||||
shortcuts = []ShortClient{}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// 兼容旧格式:直接是 ShortClient 数组
|
||||
var s []ShortClient
|
||||
if err := json.Unmarshal(b, &s); err != nil {
|
||||
shortcuts = []ShortClient{}
|
||||
return
|
||||
}
|
||||
shortcuts = s
|
||||
}
|
||||
|
||||
func saveShortcuts() {
|
||||
shortcutsMu.Lock()
|
||||
defer shortcutsMu.Unlock()
|
||||
saveShortcutsLocked()
|
||||
}
|
||||
|
||||
func saveShortcutsLocked() {
|
||||
p := getStoragePath()
|
||||
|
||||
var store PersistentStore
|
||||
// 尝试读取已有 store 以保留 settings/clientStates
|
||||
if b, err := os.ReadFile(p); err == nil {
|
||||
_ = json.Unmarshal(b, &store) // ignore errors, we'll overwrite shortcuts
|
||||
}
|
||||
store.Shortcuts = shortcuts
|
||||
savePersistentStoreLocked(store)
|
||||
}
|
||||
|
||||
// 以下为对 settings 与 clientStates 的访问方法(供前端调用)
|
||||
func (a *App) GetGuiSettings() (GuiSettings, error) {
|
||||
store, err := loadPersistentStore()
|
||||
if err != nil {
|
||||
// 返回默认值
|
||||
return GuiSettings{StartupEnabled: true, RememberClientState: true, LogDir: getLogsPath(), ThemeMode: "auto"}, nil
|
||||
}
|
||||
// 合并默认值
|
||||
s := store.Settings
|
||||
// 如果 LogDir 为空,使用默认路径
|
||||
if s.LogDir == "" {
|
||||
s.LogDir = getLogsPath()
|
||||
}
|
||||
// 如果 ThemeMode 为空,使用默认值 "auto"
|
||||
if s.ThemeMode == "" {
|
||||
s.ThemeMode = "auto"
|
||||
}
|
||||
// 检测是否为首次使用(配置为空),如果是则使用默认值 true
|
||||
// 注意:这里无法区分用户主动设置为 false 还是从未设置过,所以采用保守策略
|
||||
// 只有当配置文件存在但 Settings 字段完全为空时才认为是首次使用
|
||||
isFirstTime := !s.StartupEnabled && !s.RememberClientState
|
||||
if isFirstTime {
|
||||
// 首次使用,设置为默认值 true
|
||||
s.StartupEnabled = true
|
||||
s.RememberClientState = true
|
||||
}
|
||||
return s, nil
|
||||
}
|
||||
|
||||
func (a *App) SaveGuiSettings(s GuiSettings) error {
|
||||
shortcutsMu.Lock()
|
||||
defer shortcutsMu.Unlock()
|
||||
store, _ := loadPersistentStore()
|
||||
|
||||
// 保存之前检查开机启动设置是否有变化
|
||||
oldStartupEnabled := store.Settings.StartupEnabled
|
||||
|
||||
store.Settings = s
|
||||
// 如果 LogDir 为空,填充默认
|
||||
if store.Settings.LogDir == "" {
|
||||
store.Settings.LogDir = getLogsPath()
|
||||
}
|
||||
savePersistentStoreLocked(store)
|
||||
|
||||
// 如果开机启动设置发生变化,应用到系统
|
||||
if oldStartupEnabled != s.StartupEnabled {
|
||||
if s.StartupEnabled {
|
||||
if err := enableStartup(); err != nil {
|
||||
logs.Error("启用开机启动失败: %v", err)
|
||||
return fmt.Errorf("启用开机启动失败: %v", err)
|
||||
}
|
||||
logs.Info("已启用开机启动")
|
||||
} else {
|
||||
if err := disableStartup(); err != nil {
|
||||
logs.Error("禁用开机启动失败: %v", err)
|
||||
return fmt.Errorf("禁用开机启动失败: %v", err)
|
||||
}
|
||||
logs.Info("已禁用开机启动")
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (a *App) GetClientStates() (map[string]string, error) {
|
||||
store, err := loadPersistentStore()
|
||||
if err != nil {
|
||||
return map[string]string{}, nil
|
||||
}
|
||||
if store.ClientStates == nil {
|
||||
return map[string]string{}, nil
|
||||
}
|
||||
return store.ClientStates, nil
|
||||
}
|
||||
|
||||
func (a *App) SaveClientStates(m map[string]string) error {
|
||||
shortcutsMu.Lock()
|
||||
defer shortcutsMu.Unlock()
|
||||
store, _ := loadPersistentStore()
|
||||
store.ClientStates = m
|
||||
savePersistentStoreLocked(store)
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetDefaultLogDir 获取默认日志目录路径
|
||||
func (a *App) GetDefaultLogDir() string {
|
||||
dir, err := os.UserConfigDir()
|
||||
if err != nil {
|
||||
dir = "."
|
||||
}
|
||||
cfgDir := filepath.Join(dir, "npc")
|
||||
logsDir := filepath.Join(cfgDir, "logs")
|
||||
return logsDir
|
||||
}
|
||||
|
||||
// SelectDirectory 打开目录选择对话框
|
||||
func (a *App) SelectDirectory() (string, error) {
|
||||
logs.Info("SelectDirectory 被调用")
|
||||
|
||||
// 获取当前设置的日志目录作为默认目录
|
||||
defaultDir := ""
|
||||
store, err := loadPersistentStore()
|
||||
if err == nil && store.Settings.LogDir != "" {
|
||||
defaultDir = store.Settings.LogDir
|
||||
}
|
||||
|
||||
logs.Info("默认目录: %s", defaultDir)
|
||||
|
||||
// 打开目录选择对话框
|
||||
selectedDir, err := wailsRuntime.OpenDirectoryDialog(a.ctx, wailsRuntime.OpenDialogOptions{
|
||||
Title: "选择日志目录",
|
||||
DefaultDirectory: defaultDir,
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
logs.Error("打开目录选择对话框失败: %v", err)
|
||||
return "", err
|
||||
}
|
||||
|
||||
logs.Info("用户选择的目录: %s", selectedDir)
|
||||
return selectedDir, nil
|
||||
}
|
||||
|
||||
// GetAppVersion 返回来自 lib/version 的版本号
|
||||
func (a *App) GetAppVersion() string {
|
||||
return version.VERSION
|
||||
}
|
||||
|
||||
func addShortcut(sc ShortClient) {
|
||||
shortcutsMu.Lock()
|
||||
shortcuts = append(shortcuts, sc)
|
||||
shortcutsMu.Unlock()
|
||||
saveShortcuts()
|
||||
}
|
||||
|
||||
func findShortcutIndex(name, addr, key string) int {
|
||||
shortcutsMu.Lock()
|
||||
defer shortcutsMu.Unlock()
|
||||
for i, it := range shortcuts {
|
||||
if it.Name == name && it.Addr == addr && it.Key == key {
|
||||
return i
|
||||
}
|
||||
}
|
||||
return -1
|
||||
}
|
||||
|
||||
func (a *App) AddShortcut(arg string) error {
|
||||
// accept a JSON string from frontend
|
||||
var sc ShortClient
|
||||
if err := json.Unmarshal([]byte(arg), &sc); err != nil {
|
||||
return err
|
||||
}
|
||||
addShortcut(sc)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (a *App) AddShortcutFromBase64(s string) error {
|
||||
if s == "" {
|
||||
return errors.New("无效的启动命令")
|
||||
}
|
||||
b, err := base64.StdEncoding.DecodeString(s)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
payload := string(b)
|
||||
if !strings.HasPrefix(payload, "nps:") {
|
||||
return errors.New("无效的启动命令")
|
||||
}
|
||||
payload = payload[len("nps:"):]
|
||||
parts := strings.Split(payload, "|")
|
||||
if len(parts) != 4 {
|
||||
return errors.New("无效的启动命令")
|
||||
}
|
||||
tls := false
|
||||
if parts[3] == "true" {
|
||||
tls = true
|
||||
}
|
||||
sc := ShortClient{Name: parts[0], Addr: parts[1], Key: parts[2], TLS: tls}
|
||||
|
||||
// Check if shortcut already exists
|
||||
shortcutsMu.Lock()
|
||||
for _, existing := range shortcuts {
|
||||
if existing.Addr == sc.Addr && existing.Key == sc.Key {
|
||||
shortcutsMu.Unlock()
|
||||
return errors.New("该客户端已被添加")
|
||||
}
|
||||
}
|
||||
shortcutsMu.Unlock()
|
||||
|
||||
addShortcut(sc)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (a *App) GetShortcuts() ([]ShortClient, error) {
|
||||
loadShortcuts()
|
||||
shortcutsMu.Lock()
|
||||
defer shortcutsMu.Unlock()
|
||||
// populate running state
|
||||
res := make([]ShortClient, len(shortcuts))
|
||||
runningMu.Lock()
|
||||
statusMu.Lock()
|
||||
defer runningMu.Unlock()
|
||||
defer statusMu.Unlock()
|
||||
|
||||
for i, sc := range shortcuts {
|
||||
key := sc.Addr + "|" + sc.Key
|
||||
sc.Running = false
|
||||
sc.Status = "stopped"
|
||||
sc.Error = ""
|
||||
|
||||
// 检查客户端是否在 running map 中
|
||||
if _, ok := running[key]; ok {
|
||||
// 客户端正在运行(或重连中)
|
||||
if isConnected, ok := clientConnected[key]; ok && isConnected {
|
||||
// 连接成功
|
||||
sc.Status = "connected"
|
||||
sc.Running = true
|
||||
} else if _, attempted := clientAttempted[key]; attempted {
|
||||
// 尝试过连接但失败,显示为"连接中"(正在重连)
|
||||
sc.Status = "connecting"
|
||||
if errMsg, ok := clientErrors[key]; ok && errMsg != "" {
|
||||
sc.Error = errMsg
|
||||
}
|
||||
} else {
|
||||
// 刚启动,还未尝试连接
|
||||
sc.Status = "connecting"
|
||||
}
|
||||
}
|
||||
res[i] = sc
|
||||
}
|
||||
return res, nil
|
||||
}
|
||||
|
||||
func (a *App) RemoveShortcut(name, addr, key string) error {
|
||||
// stop if running
|
||||
id := addr + "|" + key
|
||||
runningMu.Lock()
|
||||
if cancel, ok := running[id]; ok {
|
||||
cancel()
|
||||
delete(running, id)
|
||||
// 也要关闭客户端
|
||||
if rpcClient, ok := clients[id]; ok {
|
||||
rpcClient.Close()
|
||||
delete(clients, id)
|
||||
}
|
||||
}
|
||||
statusMu.Lock()
|
||||
delete(clientErrors, id)
|
||||
delete(clientConnected, id)
|
||||
delete(clientAttempted, id)
|
||||
statusMu.Unlock()
|
||||
runningMu.Unlock()
|
||||
|
||||
// remove from slice
|
||||
shortcutsMu.Lock()
|
||||
defer shortcutsMu.Unlock()
|
||||
idx := -1
|
||||
for i, it := range shortcuts {
|
||||
if it.Name == name && it.Addr == addr && it.Key == key {
|
||||
idx = i
|
||||
break
|
||||
}
|
||||
}
|
||||
if idx == -1 {
|
||||
return nil
|
||||
}
|
||||
shortcuts = append(shortcuts[:idx], shortcuts[idx+1:]...)
|
||||
saveShortcutsLocked()
|
||||
return nil
|
||||
}
|
||||
|
||||
func (a *App) ToggleClient(name, addr, key string, tls bool, runningState bool) error {
|
||||
id := addr + "|" + key
|
||||
logs.Info("ToggleClient called: name=%s, addr=%s, tls=%v, runningState=%v", name, addr, tls, runningState)
|
||||
runningMu.Lock()
|
||||
defer runningMu.Unlock()
|
||||
if runningState {
|
||||
// start npc client in goroutine
|
||||
if _, ok := running[id]; !ok {
|
||||
logs.Info("Starting NPC client: %s", id)
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
running[id] = cancel
|
||||
// 清除之前的状态
|
||||
statusMu.Lock()
|
||||
delete(clientErrors, id)
|
||||
clientConnected[id] = false
|
||||
delete(clientAttempted, id)
|
||||
statusMu.Unlock()
|
||||
go startNpcClientWithContext(ctx, id, addr, key, tls)
|
||||
} else {
|
||||
logs.Info("Client already running: %s", id)
|
||||
}
|
||||
} else {
|
||||
// stop the client
|
||||
if cancel, ok := running[id]; ok {
|
||||
logs.Info("Stopping NPC client: %s", id)
|
||||
cancel()
|
||||
delete(running, id)
|
||||
// 清除状态
|
||||
statusMu.Lock()
|
||||
delete(clientErrors, id)
|
||||
delete(clientConnected, id)
|
||||
delete(clientAttempted, id)
|
||||
statusMu.Unlock()
|
||||
// 也要关闭客户端
|
||||
if rpcClient, ok := clients[id]; ok {
|
||||
rpcClient.Close()
|
||||
delete(clients, id)
|
||||
}
|
||||
} else {
|
||||
logs.Info("Client not running, nothing to stop: %s", id)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// startNpcClient 在 goroutine 中启动 npc 客户端(内置,不是外部进程)
|
||||
func startNpcClient(id, server, vkey string, tlsEnable bool) {
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
runningMu.Lock()
|
||||
running[id] = cancel
|
||||
runningMu.Unlock()
|
||||
|
||||
startNpcClientWithContext(ctx, id, server, vkey, tlsEnable)
|
||||
}
|
||||
|
||||
// startNpcClientWithContext 在给定的 context 中运行 npc 客户端
|
||||
func startNpcClientWithContext(ctx context.Context, id, server, vkey string, tlsEnable bool) {
|
||||
// 为该客户端初始化独立的日志文件
|
||||
initClientLogger(id)
|
||||
clientLogger := getClientLogger(id)
|
||||
|
||||
client.SetTlsEnable(tlsEnable)
|
||||
if clientLogger != nil {
|
||||
clientLogger.Info("启动 NPC 客户端: server=%s, vkey=%s, tls=%v", server, vkey, tlsEnable)
|
||||
}
|
||||
|
||||
for {
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
if clientLogger != nil {
|
||||
clientLogger.Info("停止 NPC 客户端")
|
||||
}
|
||||
statusMu.Lock()
|
||||
delete(clientConnected, id)
|
||||
delete(clientAttempted, id)
|
||||
delete(clientErrors, id)
|
||||
statusMu.Unlock()
|
||||
runningMu.Lock()
|
||||
if rpcClient, ok := clients[id]; ok {
|
||||
rpcClient.Close()
|
||||
delete(clients, id)
|
||||
}
|
||||
runningMu.Unlock()
|
||||
// 关闭客户端日志
|
||||
closeClientLogger(id)
|
||||
return
|
||||
default:
|
||||
}
|
||||
|
||||
if clientLogger != nil {
|
||||
clientLogger.Info("连接服务器")
|
||||
}
|
||||
|
||||
// 重置连接状态,准备新的连接尝试
|
||||
statusMu.Lock()
|
||||
clientConnected[id] = false
|
||||
statusMu.Unlock()
|
||||
|
||||
rpcClient := client.NewRPClient(server, vkey, connType, "", nil, disconnectTimeout)
|
||||
|
||||
// 设置客户端的独立 logger
|
||||
if clientLogger != nil {
|
||||
rpcClient.SetLogger(clientLogger)
|
||||
}
|
||||
|
||||
// 将客户端保存到全局 map
|
||||
runningMu.Lock()
|
||||
clients[id] = rpcClient
|
||||
runningMu.Unlock()
|
||||
|
||||
// 启动连接监听器(每次重连都启动)
|
||||
go monitorFirstConnection(ctx, id, rpcClient)
|
||||
|
||||
// 在后台监听 context 取消事件
|
||||
go func() {
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
if clientLogger != nil {
|
||||
clientLogger.Info("Context 已取消,关闭客户端")
|
||||
}
|
||||
rpcClient.Close()
|
||||
}
|
||||
}()
|
||||
|
||||
rpcClient.Start()
|
||||
|
||||
// 检查 context 是否已取消
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
if clientLogger != nil {
|
||||
clientLogger.Info("停止 NPC 客户端")
|
||||
}
|
||||
statusMu.Lock()
|
||||
delete(clientConnected, id)
|
||||
delete(clientAttempted, id)
|
||||
delete(clientErrors, id)
|
||||
statusMu.Unlock()
|
||||
runningMu.Lock()
|
||||
if rpcClient, ok := clients[id]; ok {
|
||||
rpcClient.Close()
|
||||
delete(clients, id)
|
||||
}
|
||||
runningMu.Unlock()
|
||||
// 关闭客户端日志
|
||||
closeClientLogger(id)
|
||||
return
|
||||
case <-time.After(5 * time.Second):
|
||||
// 继续重新连接
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// monitorFirstConnection 监听连接的结果,持续检查连接状态
|
||||
func monitorFirstConnection(ctx context.Context, id string, rpcClient *client.TRPClient) {
|
||||
ticker := time.NewTicker(100 * time.Millisecond)
|
||||
defer ticker.Stop()
|
||||
|
||||
initialTimeout := time.After(5 * time.Second)
|
||||
connected := false
|
||||
|
||||
clientLogger := getClientLogger(id)
|
||||
|
||||
for {
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
return
|
||||
case <-initialTimeout:
|
||||
if !connected {
|
||||
statusMu.Lock()
|
||||
clientAttempted[id] = true // 标记为已尝试
|
||||
clientConnected[id] = false
|
||||
clientErrors[id] = "连接服务器失败,正在重新连接..."
|
||||
statusMu.Unlock()
|
||||
if clientLogger != nil {
|
||||
clientLogger.Error("连接服务器失败 (timeout),将自动重连")
|
||||
}
|
||||
}
|
||||
// 即使超时,也继续监听连接状态变化
|
||||
case <-ticker.C:
|
||||
// 检查连接是否成功
|
||||
isNowConnected := rpcClient.IsConnected()
|
||||
if isNowConnected {
|
||||
if !connected {
|
||||
statusMu.Lock()
|
||||
clientAttempted[id] = true
|
||||
clientConnected[id] = true
|
||||
delete(clientErrors, id)
|
||||
statusMu.Unlock()
|
||||
if clientLogger != nil {
|
||||
clientLogger.Info("客户端连接成功")
|
||||
}
|
||||
connected = true
|
||||
}
|
||||
} else {
|
||||
// 如果已连接但现在断开,标记为断开状态
|
||||
if connected {
|
||||
statusMu.Lock()
|
||||
clientConnected[id] = false
|
||||
clientErrors[id] = "连接已断开,正在重新连接..."
|
||||
statusMu.Unlock()
|
||||
if clientLogger != nil {
|
||||
clientLogger.Warn("客户端连接已断开")
|
||||
}
|
||||
connected = false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// GetConnectionLogs 获取指定客户端的连接日志(从独立日志文件读取)
|
||||
func (a *App) GetConnectionLogs(clientId string) ([]ConnectionLog, error) {
|
||||
// 检查缓存是否有效
|
||||
logsCacheMu.RLock()
|
||||
if cachedLogs, exists := logsCache[clientId]; exists {
|
||||
if cacheTime, ok := logsCacheTime[clientId]; ok {
|
||||
if time.Since(cacheTime) < logsCacheTTL {
|
||||
// 缓存仍然有效
|
||||
logsCacheMu.RUnlock()
|
||||
return cachedLogs, nil
|
||||
}
|
||||
}
|
||||
}
|
||||
logsCacheMu.RUnlock()
|
||||
|
||||
// 缓存过期或不存在,重新读取日志
|
||||
// 读取该客户端的独立日志文件
|
||||
clientLogFile := getClientLogFilePath(clientId)
|
||||
|
||||
data, err := os.ReadFile(clientLogFile)
|
||||
if err != nil {
|
||||
// 如果文件不存在或读取失败,返回空日志
|
||||
return []ConnectionLog{}, nil
|
||||
}
|
||||
|
||||
logContent := string(data)
|
||||
if logContent == "" {
|
||||
return []ConnectionLog{}, nil
|
||||
}
|
||||
|
||||
var result []ConnectionLog
|
||||
lines := strings.Split(logContent, "\n")
|
||||
|
||||
for _, line := range lines {
|
||||
line = strings.TrimSpace(line)
|
||||
if line == "" {
|
||||
continue
|
||||
}
|
||||
|
||||
// 判断日志类型
|
||||
logType := "info"
|
||||
if strings.Contains(line, "[E]") {
|
||||
logType = "error"
|
||||
} else if strings.Contains(line, "[W]") {
|
||||
logType = "warning"
|
||||
} else if strings.Contains(line, "成功") || strings.Contains(line, "connected") || strings.Contains(line, "Success") {
|
||||
logType = "success"
|
||||
}
|
||||
|
||||
// 提取时间戳(日志格式通常是:2026-01-09 11:04:56 或 11:04:56)
|
||||
var timestamp string
|
||||
timeFields := strings.Fields(line)
|
||||
if len(timeFields) >= 2 {
|
||||
// 尝试获取前两个字段作为日期和时间
|
||||
timestamp = timeFields[0] + " " + timeFields[1]
|
||||
} else if len(timeFields) >= 1 {
|
||||
timestamp = timeFields[0]
|
||||
}
|
||||
|
||||
log := ConnectionLog{
|
||||
Timestamp: timestamp,
|
||||
Message: line,
|
||||
Type: logType,
|
||||
ClientId: clientId,
|
||||
}
|
||||
|
||||
result = append(result, log)
|
||||
}
|
||||
|
||||
// 更新缓存
|
||||
logsCacheMu.Lock()
|
||||
logsCache[clientId] = result
|
||||
logsCacheTime[clientId] = time.Now()
|
||||
logsCacheMu.Unlock()
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// ClearConnectionLogs 清空指定客户端的连接日志文件
|
||||
func (a *App) ClearConnectionLogs(clientId string) error {
|
||||
// 获取日志文件路径
|
||||
clientLogFile := getClientLogFilePath(clientId)
|
||||
|
||||
// 清空日志文件内容(写入空字符串)
|
||||
if err := os.WriteFile(clientLogFile, []byte(""), 0o644); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// 清空缓存
|
||||
logsCacheMu.Lock()
|
||||
delete(logsCache, clientId)
|
||||
delete(logsCacheTime, clientId)
|
||||
logsCacheMu.Unlock()
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// getExecutablePath 获取当前可执行文件的完整路径
|
||||
func getExecutablePath() (string, error) {
|
||||
exePath, err := os.Executable()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
// 解析符号链接,获取真实路径
|
||||
exePath, err = filepath.EvalSymlinks(exePath)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return exePath, nil
|
||||
}
|
||||
|
||||
// enableStartup 启用开机启动(跨平台)
|
||||
func enableStartup() error {
|
||||
return enableStartupImpl()
|
||||
}
|
||||
|
||||
// disableStartup 禁用开机启动(跨平台)
|
||||
func disableStartup() error {
|
||||
return disableStartupImpl()
|
||||
}
|
||||
|
||||
// isStartupEnabled 检查是否已启用开机启动(跨平台)
|
||||
func isStartupEnabled() bool {
|
||||
return isStartupEnabledImpl()
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
keep
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 66 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 614 KiB |
@@ -0,0 +1,12 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>NPS 客户端</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script type="module" src="/src/main.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"name": "npc-client",
|
||||
"packageManager": "yarn@1.22.22",
|
||||
"type": "module",
|
||||
"version": "1.0.0",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "vite build",
|
||||
"preview": "vite preview",
|
||||
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs --fix --ignore-path .gitignore"
|
||||
},
|
||||
"dependencies": {
|
||||
"vue": "^3.3.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@vitejs/plugin-vue": "^4.2.3",
|
||||
"vite": "^4.3.9"
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,4 @@
|
||||
import { createApp } from 'vue'
|
||||
import App from './App.vue'
|
||||
|
||||
createApp(App).mount('#app')
|
||||
@@ -0,0 +1,18 @@
|
||||
import { defineConfig } from 'vite'
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [vue()],
|
||||
build: {
|
||||
outDir: 'dist',
|
||||
rollupOptions: {
|
||||
external: ['/wails/go/main/App.js'],
|
||||
output: {
|
||||
globals: {
|
||||
'/wails/go/main/App.js': 'window'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -0,0 +1,31 @@
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
import {main} from '../models';
|
||||
|
||||
export function AddShortcut(arg1:string):Promise<void>;
|
||||
|
||||
export function AddShortcutFromBase64(arg1:string):Promise<void>;
|
||||
|
||||
export function ClearConnectionLogs(arg1:string):Promise<void>;
|
||||
|
||||
export function GetAppVersion():Promise<string>;
|
||||
|
||||
export function GetClientStates():Promise<Record<string, string>>;
|
||||
|
||||
export function GetConnectionLogs(arg1:string):Promise<Array<main.ConnectionLog>>;
|
||||
|
||||
export function GetDefaultLogDir():Promise<string>;
|
||||
|
||||
export function GetGuiSettings():Promise<main.GuiSettings>;
|
||||
|
||||
export function GetShortcuts():Promise<Array<main.ShortClient>>;
|
||||
|
||||
export function RemoveShortcut(arg1:string,arg2:string,arg3:string):Promise<void>;
|
||||
|
||||
export function SaveClientStates(arg1:Record<string, string>):Promise<void>;
|
||||
|
||||
export function SaveGuiSettings(arg1:main.GuiSettings):Promise<void>;
|
||||
|
||||
export function SelectDirectory():Promise<string>;
|
||||
|
||||
export function ToggleClient(arg1:string,arg2:string,arg3:string,arg4:boolean,arg5:boolean):Promise<void>;
|
||||
@@ -0,0 +1,59 @@
|
||||
// @ts-check
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
export function AddShortcut(arg1) {
|
||||
return window['go']['main']['App']['AddShortcut'](arg1);
|
||||
}
|
||||
|
||||
export function AddShortcutFromBase64(arg1) {
|
||||
return window['go']['main']['App']['AddShortcutFromBase64'](arg1);
|
||||
}
|
||||
|
||||
export function ClearConnectionLogs(arg1) {
|
||||
return window['go']['main']['App']['ClearConnectionLogs'](arg1);
|
||||
}
|
||||
|
||||
export function GetAppVersion() {
|
||||
return window['go']['main']['App']['GetAppVersion']();
|
||||
}
|
||||
|
||||
export function GetClientStates() {
|
||||
return window['go']['main']['App']['GetClientStates']();
|
||||
}
|
||||
|
||||
export function GetConnectionLogs(arg1) {
|
||||
return window['go']['main']['App']['GetConnectionLogs'](arg1);
|
||||
}
|
||||
|
||||
export function GetDefaultLogDir() {
|
||||
return window['go']['main']['App']['GetDefaultLogDir']();
|
||||
}
|
||||
|
||||
export function GetGuiSettings() {
|
||||
return window['go']['main']['App']['GetGuiSettings']();
|
||||
}
|
||||
|
||||
export function GetShortcuts() {
|
||||
return window['go']['main']['App']['GetShortcuts']();
|
||||
}
|
||||
|
||||
export function RemoveShortcut(arg1, arg2, arg3) {
|
||||
return window['go']['main']['App']['RemoveShortcut'](arg1, arg2, arg3);
|
||||
}
|
||||
|
||||
export function SaveClientStates(arg1) {
|
||||
return window['go']['main']['App']['SaveClientStates'](arg1);
|
||||
}
|
||||
|
||||
export function SaveGuiSettings(arg1) {
|
||||
return window['go']['main']['App']['SaveGuiSettings'](arg1);
|
||||
}
|
||||
|
||||
export function SelectDirectory() {
|
||||
return window['go']['main']['App']['SelectDirectory']();
|
||||
}
|
||||
|
||||
export function ToggleClient(arg1, arg2, arg3, arg4, arg5) {
|
||||
return window['go']['main']['App']['ToggleClient'](arg1, arg2, arg3, arg4, arg5);
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
export namespace main {
|
||||
|
||||
export class ConnectionLog {
|
||||
timestamp: string;
|
||||
message: string;
|
||||
type: string;
|
||||
clientId: string;
|
||||
|
||||
static createFrom(source: any = {}) {
|
||||
return new ConnectionLog(source);
|
||||
}
|
||||
|
||||
constructor(source: any = {}) {
|
||||
if ('string' === typeof source) source = JSON.parse(source);
|
||||
this.timestamp = source["timestamp"];
|
||||
this.message = source["message"];
|
||||
this.type = source["type"];
|
||||
this.clientId = source["clientId"];
|
||||
}
|
||||
}
|
||||
export class GuiSettings {
|
||||
startupEnabled: boolean;
|
||||
rememberClientState: boolean;
|
||||
logDir: string;
|
||||
themeMode: string;
|
||||
|
||||
static createFrom(source: any = {}) {
|
||||
return new GuiSettings(source);
|
||||
}
|
||||
|
||||
constructor(source: any = {}) {
|
||||
if ('string' === typeof source) source = JSON.parse(source);
|
||||
this.startupEnabled = source["startupEnabled"];
|
||||
this.rememberClientState = source["rememberClientState"];
|
||||
this.logDir = source["logDir"];
|
||||
this.themeMode = source["themeMode"];
|
||||
}
|
||||
}
|
||||
export class ShortClient {
|
||||
name: string;
|
||||
addr: string;
|
||||
key: string;
|
||||
tls: boolean;
|
||||
running: boolean;
|
||||
error: string;
|
||||
status: string;
|
||||
|
||||
static createFrom(source: any = {}) {
|
||||
return new ShortClient(source);
|
||||
}
|
||||
|
||||
constructor(source: any = {}) {
|
||||
if ('string' === typeof source) source = JSON.parse(source);
|
||||
this.name = source["name"];
|
||||
this.addr = source["addr"];
|
||||
this.key = source["key"];
|
||||
this.tls = source["tls"];
|
||||
this.running = source["running"];
|
||||
this.error = source["error"];
|
||||
this.status = source["status"];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"name": "@wailsapp/runtime",
|
||||
"version": "2.0.0",
|
||||
"description": "Wails Javascript runtime library",
|
||||
"main": "runtime.js",
|
||||
"types": "runtime.d.ts",
|
||||
"scripts": {
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/wailsapp/wails.git"
|
||||
},
|
||||
"keywords": [
|
||||
"Wails",
|
||||
"Javascript",
|
||||
"Go"
|
||||
],
|
||||
"author": "Lea Anthony <lea.anthony@gmail.com>",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/wailsapp/wails/issues"
|
||||
},
|
||||
"homepage": "https://github.com/wailsapp/wails#readme"
|
||||
}
|
||||
@@ -0,0 +1,249 @@
|
||||
/*
|
||||
_ __ _ __
|
||||
| | / /___ _(_) /____
|
||||
| | /| / / __ `/ / / ___/
|
||||
| |/ |/ / /_/ / / (__ )
|
||||
|__/|__/\__,_/_/_/____/
|
||||
The electron alternative for Go
|
||||
(c) Lea Anthony 2019-present
|
||||
*/
|
||||
|
||||
export interface Position {
|
||||
x: number;
|
||||
y: number;
|
||||
}
|
||||
|
||||
export interface Size {
|
||||
w: number;
|
||||
h: number;
|
||||
}
|
||||
|
||||
export interface Screen {
|
||||
isCurrent: boolean;
|
||||
isPrimary: boolean;
|
||||
width : number
|
||||
height : number
|
||||
}
|
||||
|
||||
// Environment information such as platform, buildtype, ...
|
||||
export interface EnvironmentInfo {
|
||||
buildType: string;
|
||||
platform: string;
|
||||
arch: string;
|
||||
}
|
||||
|
||||
// [EventsEmit](https://wails.io/docs/reference/runtime/events#eventsemit)
|
||||
// emits the given event. Optional data may be passed with the event.
|
||||
// This will trigger any event listeners.
|
||||
export function EventsEmit(eventName: string, ...data: any): void;
|
||||
|
||||
// [EventsOn](https://wails.io/docs/reference/runtime/events#eventson) sets up a listener for the given event name.
|
||||
export function EventsOn(eventName: string, callback: (...data: any) => void): () => void;
|
||||
|
||||
// [EventsOnMultiple](https://wails.io/docs/reference/runtime/events#eventsonmultiple)
|
||||
// sets up a listener for the given event name, but will only trigger a given number times.
|
||||
export function EventsOnMultiple(eventName: string, callback: (...data: any) => void, maxCallbacks: number): () => void;
|
||||
|
||||
// [EventsOnce](https://wails.io/docs/reference/runtime/events#eventsonce)
|
||||
// sets up a listener for the given event name, but will only trigger once.
|
||||
export function EventsOnce(eventName: string, callback: (...data: any) => void): () => void;
|
||||
|
||||
// [EventsOff](https://wails.io/docs/reference/runtime/events#eventsoff)
|
||||
// unregisters the listener for the given event name.
|
||||
export function EventsOff(eventName: string, ...additionalEventNames: string[]): void;
|
||||
|
||||
// [EventsOffAll](https://wails.io/docs/reference/runtime/events#eventsoffall)
|
||||
// unregisters all listeners.
|
||||
export function EventsOffAll(): void;
|
||||
|
||||
// [LogPrint](https://wails.io/docs/reference/runtime/log#logprint)
|
||||
// logs the given message as a raw message
|
||||
export function LogPrint(message: string): void;
|
||||
|
||||
// [LogTrace](https://wails.io/docs/reference/runtime/log#logtrace)
|
||||
// logs the given message at the `trace` log level.
|
||||
export function LogTrace(message: string): void;
|
||||
|
||||
// [LogDebug](https://wails.io/docs/reference/runtime/log#logdebug)
|
||||
// logs the given message at the `debug` log level.
|
||||
export function LogDebug(message: string): void;
|
||||
|
||||
// [LogError](https://wails.io/docs/reference/runtime/log#logerror)
|
||||
// logs the given message at the `error` log level.
|
||||
export function LogError(message: string): void;
|
||||
|
||||
// [LogFatal](https://wails.io/docs/reference/runtime/log#logfatal)
|
||||
// logs the given message at the `fatal` log level.
|
||||
// The application will quit after calling this method.
|
||||
export function LogFatal(message: string): void;
|
||||
|
||||
// [LogInfo](https://wails.io/docs/reference/runtime/log#loginfo)
|
||||
// logs the given message at the `info` log level.
|
||||
export function LogInfo(message: string): void;
|
||||
|
||||
// [LogWarning](https://wails.io/docs/reference/runtime/log#logwarning)
|
||||
// logs the given message at the `warning` log level.
|
||||
export function LogWarning(message: string): void;
|
||||
|
||||
// [WindowReload](https://wails.io/docs/reference/runtime/window#windowreload)
|
||||
// Forces a reload by the main application as well as connected browsers.
|
||||
export function WindowReload(): void;
|
||||
|
||||
// [WindowReloadApp](https://wails.io/docs/reference/runtime/window#windowreloadapp)
|
||||
// Reloads the application frontend.
|
||||
export function WindowReloadApp(): void;
|
||||
|
||||
// [WindowSetAlwaysOnTop](https://wails.io/docs/reference/runtime/window#windowsetalwaysontop)
|
||||
// Sets the window AlwaysOnTop or not on top.
|
||||
export function WindowSetAlwaysOnTop(b: boolean): void;
|
||||
|
||||
// [WindowSetSystemDefaultTheme](https://wails.io/docs/next/reference/runtime/window#windowsetsystemdefaulttheme)
|
||||
// *Windows only*
|
||||
// Sets window theme to system default (dark/light).
|
||||
export function WindowSetSystemDefaultTheme(): void;
|
||||
|
||||
// [WindowSetLightTheme](https://wails.io/docs/next/reference/runtime/window#windowsetlighttheme)
|
||||
// *Windows only*
|
||||
// Sets window to light theme.
|
||||
export function WindowSetLightTheme(): void;
|
||||
|
||||
// [WindowSetDarkTheme](https://wails.io/docs/next/reference/runtime/window#windowsetdarktheme)
|
||||
// *Windows only*
|
||||
// Sets window to dark theme.
|
||||
export function WindowSetDarkTheme(): void;
|
||||
|
||||
// [WindowCenter](https://wails.io/docs/reference/runtime/window#windowcenter)
|
||||
// Centers the window on the monitor the window is currently on.
|
||||
export function WindowCenter(): void;
|
||||
|
||||
// [WindowSetTitle](https://wails.io/docs/reference/runtime/window#windowsettitle)
|
||||
// Sets the text in the window title bar.
|
||||
export function WindowSetTitle(title: string): void;
|
||||
|
||||
// [WindowFullscreen](https://wails.io/docs/reference/runtime/window#windowfullscreen)
|
||||
// Makes the window full screen.
|
||||
export function WindowFullscreen(): void;
|
||||
|
||||
// [WindowUnfullscreen](https://wails.io/docs/reference/runtime/window#windowunfullscreen)
|
||||
// Restores the previous window dimensions and position prior to full screen.
|
||||
export function WindowUnfullscreen(): void;
|
||||
|
||||
// [WindowIsFullscreen](https://wails.io/docs/reference/runtime/window#windowisfullscreen)
|
||||
// Returns the state of the window, i.e. whether the window is in full screen mode or not.
|
||||
export function WindowIsFullscreen(): Promise<boolean>;
|
||||
|
||||
// [WindowSetSize](https://wails.io/docs/reference/runtime/window#windowsetsize)
|
||||
// Sets the width and height of the window.
|
||||
export function WindowSetSize(width: number, height: number): void;
|
||||
|
||||
// [WindowGetSize](https://wails.io/docs/reference/runtime/window#windowgetsize)
|
||||
// Gets the width and height of the window.
|
||||
export function WindowGetSize(): Promise<Size>;
|
||||
|
||||
// [WindowSetMaxSize](https://wails.io/docs/reference/runtime/window#windowsetmaxsize)
|
||||
// Sets the maximum window size. Will resize the window if the window is currently larger than the given dimensions.
|
||||
// Setting a size of 0,0 will disable this constraint.
|
||||
export function WindowSetMaxSize(width: number, height: number): void;
|
||||
|
||||
// [WindowSetMinSize](https://wails.io/docs/reference/runtime/window#windowsetminsize)
|
||||
// Sets the minimum window size. Will resize the window if the window is currently smaller than the given dimensions.
|
||||
// Setting a size of 0,0 will disable this constraint.
|
||||
export function WindowSetMinSize(width: number, height: number): void;
|
||||
|
||||
// [WindowSetPosition](https://wails.io/docs/reference/runtime/window#windowsetposition)
|
||||
// Sets the window position relative to the monitor the window is currently on.
|
||||
export function WindowSetPosition(x: number, y: number): void;
|
||||
|
||||
// [WindowGetPosition](https://wails.io/docs/reference/runtime/window#windowgetposition)
|
||||
// Gets the window position relative to the monitor the window is currently on.
|
||||
export function WindowGetPosition(): Promise<Position>;
|
||||
|
||||
// [WindowHide](https://wails.io/docs/reference/runtime/window#windowhide)
|
||||
// Hides the window.
|
||||
export function WindowHide(): void;
|
||||
|
||||
// [WindowShow](https://wails.io/docs/reference/runtime/window#windowshow)
|
||||
// Shows the window, if it is currently hidden.
|
||||
export function WindowShow(): void;
|
||||
|
||||
// [WindowMaximise](https://wails.io/docs/reference/runtime/window#windowmaximise)
|
||||
// Maximises the window to fill the screen.
|
||||
export function WindowMaximise(): void;
|
||||
|
||||
// [WindowToggleMaximise](https://wails.io/docs/reference/runtime/window#windowtogglemaximise)
|
||||
// Toggles between Maximised and UnMaximised.
|
||||
export function WindowToggleMaximise(): void;
|
||||
|
||||
// [WindowUnmaximise](https://wails.io/docs/reference/runtime/window#windowunmaximise)
|
||||
// Restores the window to the dimensions and position prior to maximising.
|
||||
export function WindowUnmaximise(): void;
|
||||
|
||||
// [WindowIsMaximised](https://wails.io/docs/reference/runtime/window#windowismaximised)
|
||||
// Returns the state of the window, i.e. whether the window is maximised or not.
|
||||
export function WindowIsMaximised(): Promise<boolean>;
|
||||
|
||||
// [WindowMinimise](https://wails.io/docs/reference/runtime/window#windowminimise)
|
||||
// Minimises the window.
|
||||
export function WindowMinimise(): void;
|
||||
|
||||
// [WindowUnminimise](https://wails.io/docs/reference/runtime/window#windowunminimise)
|
||||
// Restores the window to the dimensions and position prior to minimising.
|
||||
export function WindowUnminimise(): void;
|
||||
|
||||
// [WindowIsMinimised](https://wails.io/docs/reference/runtime/window#windowisminimised)
|
||||
// Returns the state of the window, i.e. whether the window is minimised or not.
|
||||
export function WindowIsMinimised(): Promise<boolean>;
|
||||
|
||||
// [WindowIsNormal](https://wails.io/docs/reference/runtime/window#windowisnormal)
|
||||
// Returns the state of the window, i.e. whether the window is normal or not.
|
||||
export function WindowIsNormal(): Promise<boolean>;
|
||||
|
||||
// [WindowSetBackgroundColour](https://wails.io/docs/reference/runtime/window#windowsetbackgroundcolour)
|
||||
// Sets the background colour of the window to the given RGBA colour definition. This colour will show through for all transparent pixels.
|
||||
export function WindowSetBackgroundColour(R: number, G: number, B: number, A: number): void;
|
||||
|
||||
// [ScreenGetAll](https://wails.io/docs/reference/runtime/window#screengetall)
|
||||
// Gets the all screens. Call this anew each time you want to refresh data from the underlying windowing system.
|
||||
export function ScreenGetAll(): Promise<Screen[]>;
|
||||
|
||||
// [BrowserOpenURL](https://wails.io/docs/reference/runtime/browser#browseropenurl)
|
||||
// Opens the given URL in the system browser.
|
||||
export function BrowserOpenURL(url: string): void;
|
||||
|
||||
// [Environment](https://wails.io/docs/reference/runtime/intro#environment)
|
||||
// Returns information about the environment
|
||||
export function Environment(): Promise<EnvironmentInfo>;
|
||||
|
||||
// [Quit](https://wails.io/docs/reference/runtime/intro#quit)
|
||||
// Quits the application.
|
||||
export function Quit(): void;
|
||||
|
||||
// [Hide](https://wails.io/docs/reference/runtime/intro#hide)
|
||||
// Hides the application.
|
||||
export function Hide(): void;
|
||||
|
||||
// [Show](https://wails.io/docs/reference/runtime/intro#show)
|
||||
// Shows the application.
|
||||
export function Show(): void;
|
||||
|
||||
// [ClipboardGetText](https://wails.io/docs/reference/runtime/clipboard#clipboardgettext)
|
||||
// Returns the current text stored on clipboard
|
||||
export function ClipboardGetText(): Promise<string>;
|
||||
|
||||
// [ClipboardSetText](https://wails.io/docs/reference/runtime/clipboard#clipboardsettext)
|
||||
// Sets a text on the clipboard
|
||||
export function ClipboardSetText(text: string): Promise<boolean>;
|
||||
|
||||
// [OnFileDrop](https://wails.io/docs/reference/runtime/draganddrop#onfiledrop)
|
||||
// OnFileDrop listens to drag and drop events and calls the callback with the coordinates of the drop and an array of path strings.
|
||||
export function OnFileDrop(callback: (x: number, y: number ,paths: string[]) => void, useDropTarget: boolean) :void
|
||||
|
||||
// [OnFileDropOff](https://wails.io/docs/reference/runtime/draganddrop#dragandddropoff)
|
||||
// OnFileDropOff removes the drag and drop listeners and handlers.
|
||||
export function OnFileDropOff() :void
|
||||
|
||||
// Check if the file path resolver is available
|
||||
export function CanResolveFilePaths(): boolean;
|
||||
|
||||
// Resolves file paths for an array of files
|
||||
export function ResolveFilePaths(files: File[]): void
|
||||
@@ -0,0 +1,242 @@
|
||||
/*
|
||||
_ __ _ __
|
||||
| | / /___ _(_) /____
|
||||
| | /| / / __ `/ / / ___/
|
||||
| |/ |/ / /_/ / / (__ )
|
||||
|__/|__/\__,_/_/_/____/
|
||||
The electron alternative for Go
|
||||
(c) Lea Anthony 2019-present
|
||||
*/
|
||||
|
||||
export function LogPrint(message) {
|
||||
window.runtime.LogPrint(message);
|
||||
}
|
||||
|
||||
export function LogTrace(message) {
|
||||
window.runtime.LogTrace(message);
|
||||
}
|
||||
|
||||
export function LogDebug(message) {
|
||||
window.runtime.LogDebug(message);
|
||||
}
|
||||
|
||||
export function LogInfo(message) {
|
||||
window.runtime.LogInfo(message);
|
||||
}
|
||||
|
||||
export function LogWarning(message) {
|
||||
window.runtime.LogWarning(message);
|
||||
}
|
||||
|
||||
export function LogError(message) {
|
||||
window.runtime.LogError(message);
|
||||
}
|
||||
|
||||
export function LogFatal(message) {
|
||||
window.runtime.LogFatal(message);
|
||||
}
|
||||
|
||||
export function EventsOnMultiple(eventName, callback, maxCallbacks) {
|
||||
return window.runtime.EventsOnMultiple(eventName, callback, maxCallbacks);
|
||||
}
|
||||
|
||||
export function EventsOn(eventName, callback) {
|
||||
return EventsOnMultiple(eventName, callback, -1);
|
||||
}
|
||||
|
||||
export function EventsOff(eventName, ...additionalEventNames) {
|
||||
return window.runtime.EventsOff(eventName, ...additionalEventNames);
|
||||
}
|
||||
|
||||
export function EventsOffAll() {
|
||||
return window.runtime.EventsOffAll();
|
||||
}
|
||||
|
||||
export function EventsOnce(eventName, callback) {
|
||||
return EventsOnMultiple(eventName, callback, 1);
|
||||
}
|
||||
|
||||
export function EventsEmit(eventName) {
|
||||
let args = [eventName].slice.call(arguments);
|
||||
return window.runtime.EventsEmit.apply(null, args);
|
||||
}
|
||||
|
||||
export function WindowReload() {
|
||||
window.runtime.WindowReload();
|
||||
}
|
||||
|
||||
export function WindowReloadApp() {
|
||||
window.runtime.WindowReloadApp();
|
||||
}
|
||||
|
||||
export function WindowSetAlwaysOnTop(b) {
|
||||
window.runtime.WindowSetAlwaysOnTop(b);
|
||||
}
|
||||
|
||||
export function WindowSetSystemDefaultTheme() {
|
||||
window.runtime.WindowSetSystemDefaultTheme();
|
||||
}
|
||||
|
||||
export function WindowSetLightTheme() {
|
||||
window.runtime.WindowSetLightTheme();
|
||||
}
|
||||
|
||||
export function WindowSetDarkTheme() {
|
||||
window.runtime.WindowSetDarkTheme();
|
||||
}
|
||||
|
||||
export function WindowCenter() {
|
||||
window.runtime.WindowCenter();
|
||||
}
|
||||
|
||||
export function WindowSetTitle(title) {
|
||||
window.runtime.WindowSetTitle(title);
|
||||
}
|
||||
|
||||
export function WindowFullscreen() {
|
||||
window.runtime.WindowFullscreen();
|
||||
}
|
||||
|
||||
export function WindowUnfullscreen() {
|
||||
window.runtime.WindowUnfullscreen();
|
||||
}
|
||||
|
||||
export function WindowIsFullscreen() {
|
||||
return window.runtime.WindowIsFullscreen();
|
||||
}
|
||||
|
||||
export function WindowGetSize() {
|
||||
return window.runtime.WindowGetSize();
|
||||
}
|
||||
|
||||
export function WindowSetSize(width, height) {
|
||||
window.runtime.WindowSetSize(width, height);
|
||||
}
|
||||
|
||||
export function WindowSetMaxSize(width, height) {
|
||||
window.runtime.WindowSetMaxSize(width, height);
|
||||
}
|
||||
|
||||
export function WindowSetMinSize(width, height) {
|
||||
window.runtime.WindowSetMinSize(width, height);
|
||||
}
|
||||
|
||||
export function WindowSetPosition(x, y) {
|
||||
window.runtime.WindowSetPosition(x, y);
|
||||
}
|
||||
|
||||
export function WindowGetPosition() {
|
||||
return window.runtime.WindowGetPosition();
|
||||
}
|
||||
|
||||
export function WindowHide() {
|
||||
window.runtime.WindowHide();
|
||||
}
|
||||
|
||||
export function WindowShow() {
|
||||
window.runtime.WindowShow();
|
||||
}
|
||||
|
||||
export function WindowMaximise() {
|
||||
window.runtime.WindowMaximise();
|
||||
}
|
||||
|
||||
export function WindowToggleMaximise() {
|
||||
window.runtime.WindowToggleMaximise();
|
||||
}
|
||||
|
||||
export function WindowUnmaximise() {
|
||||
window.runtime.WindowUnmaximise();
|
||||
}
|
||||
|
||||
export function WindowIsMaximised() {
|
||||
return window.runtime.WindowIsMaximised();
|
||||
}
|
||||
|
||||
export function WindowMinimise() {
|
||||
window.runtime.WindowMinimise();
|
||||
}
|
||||
|
||||
export function WindowUnminimise() {
|
||||
window.runtime.WindowUnminimise();
|
||||
}
|
||||
|
||||
export function WindowSetBackgroundColour(R, G, B, A) {
|
||||
window.runtime.WindowSetBackgroundColour(R, G, B, A);
|
||||
}
|
||||
|
||||
export function ScreenGetAll() {
|
||||
return window.runtime.ScreenGetAll();
|
||||
}
|
||||
|
||||
export function WindowIsMinimised() {
|
||||
return window.runtime.WindowIsMinimised();
|
||||
}
|
||||
|
||||
export function WindowIsNormal() {
|
||||
return window.runtime.WindowIsNormal();
|
||||
}
|
||||
|
||||
export function BrowserOpenURL(url) {
|
||||
window.runtime.BrowserOpenURL(url);
|
||||
}
|
||||
|
||||
export function Environment() {
|
||||
return window.runtime.Environment();
|
||||
}
|
||||
|
||||
export function Quit() {
|
||||
window.runtime.Quit();
|
||||
}
|
||||
|
||||
export function Hide() {
|
||||
window.runtime.Hide();
|
||||
}
|
||||
|
||||
export function Show() {
|
||||
window.runtime.Show();
|
||||
}
|
||||
|
||||
export function ClipboardGetText() {
|
||||
return window.runtime.ClipboardGetText();
|
||||
}
|
||||
|
||||
export function ClipboardSetText(text) {
|
||||
return window.runtime.ClipboardSetText(text);
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback for OnFileDrop returns a slice of file path strings when a drop is finished.
|
||||
*
|
||||
* @export
|
||||
* @callback OnFileDropCallback
|
||||
* @param {number} x - x coordinate of the drop
|
||||
* @param {number} y - y coordinate of the drop
|
||||
* @param {string[]} paths - A list of file paths.
|
||||
*/
|
||||
|
||||
/**
|
||||
* OnFileDrop listens to drag and drop events and calls the callback with the coordinates of the drop and an array of path strings.
|
||||
*
|
||||
* @export
|
||||
* @param {OnFileDropCallback} callback - Callback for OnFileDrop returns a slice of file path strings when a drop is finished.
|
||||
* @param {boolean} [useDropTarget=true] - Only call the callback when the drop finished on an element that has the drop target style. (--wails-drop-target)
|
||||
*/
|
||||
export function OnFileDrop(callback, useDropTarget) {
|
||||
return window.runtime.OnFileDrop(callback, useDropTarget);
|
||||
}
|
||||
|
||||
/**
|
||||
* OnFileDropOff removes the drag and drop listeners and handlers.
|
||||
*/
|
||||
export function OnFileDropOff() {
|
||||
return window.runtime.OnFileDropOff();
|
||||
}
|
||||
|
||||
export function CanResolveFilePaths() {
|
||||
return window.runtime.CanResolveFilePaths();
|
||||
}
|
||||
|
||||
export function ResolveFilePaths(files) {
|
||||
return window.runtime.ResolveFilePaths(files);
|
||||
}
|
||||
@@ -0,0 +1,336 @@
|
||||
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
||||
# yarn lockfile v1
|
||||
|
||||
|
||||
"@babel/helper-string-parser@^7.27.1":
|
||||
version "7.27.1"
|
||||
resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.27.1.tgz#54da796097ab19ce67ed9f88b47bb2ec49367687"
|
||||
integrity sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA==
|
||||
|
||||
"@babel/helper-validator-identifier@^7.28.5":
|
||||
version "7.28.5"
|
||||
resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.28.5.tgz#010b6938fab7cb7df74aa2bbc06aa503b8fe5fb4"
|
||||
integrity sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q==
|
||||
|
||||
"@babel/parser@^7.28.5":
|
||||
version "7.28.5"
|
||||
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.28.5.tgz#0b0225ee90362f030efd644e8034c99468893b08"
|
||||
integrity sha512-KKBU1VGYR7ORr3At5HAtUQ+TV3SzRCXmA/8OdDZiLDBIZxVyzXuztPjfLd3BV1PRAQGCMWWSHYhL0F8d5uHBDQ==
|
||||
dependencies:
|
||||
"@babel/types" "^7.28.5"
|
||||
|
||||
"@babel/types@^7.28.5":
|
||||
version "7.28.5"
|
||||
resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.28.5.tgz#10fc405f60897c35f07e85493c932c7b5ca0592b"
|
||||
integrity sha512-qQ5m48eI/MFLQ5PxQj4PFaprjyCTLI37ElWMmNs0K8Lk3dVeOdNpB3ks8jc7yM5CDmVC73eMVk/trk3fgmrUpA==
|
||||
dependencies:
|
||||
"@babel/helper-string-parser" "^7.27.1"
|
||||
"@babel/helper-validator-identifier" "^7.28.5"
|
||||
|
||||
"@esbuild/android-arm64@0.18.20":
|
||||
version "0.18.20"
|
||||
resolved "https://registry.yarnpkg.com/@esbuild/android-arm64/-/android-arm64-0.18.20.tgz#984b4f9c8d0377443cc2dfcef266d02244593622"
|
||||
integrity sha512-Nz4rJcchGDtENV0eMKUNa6L12zz2zBDXuhj/Vjh18zGqB44Bi7MBMSXjgunJgjRhCmKOjnPuZp4Mb6OKqtMHLQ==
|
||||
|
||||
"@esbuild/android-arm@0.18.20":
|
||||
version "0.18.20"
|
||||
resolved "https://registry.yarnpkg.com/@esbuild/android-arm/-/android-arm-0.18.20.tgz#fedb265bc3a589c84cc11f810804f234947c3682"
|
||||
integrity sha512-fyi7TDI/ijKKNZTUJAQqiG5T7YjJXgnzkURqmGj13C6dCqckZBLdl4h7bkhHt/t0WP+zO9/zwroDvANaOqO5Sw==
|
||||
|
||||
"@esbuild/android-x64@0.18.20":
|
||||
version "0.18.20"
|
||||
resolved "https://registry.yarnpkg.com/@esbuild/android-x64/-/android-x64-0.18.20.tgz#35cf419c4cfc8babe8893d296cd990e9e9f756f2"
|
||||
integrity sha512-8GDdlePJA8D6zlZYJV/jnrRAi6rOiNaCC/JclcXpB+KIuvfBN4owLtgzY2bsxnx666XjJx2kDPUmnTtR8qKQUg==
|
||||
|
||||
"@esbuild/darwin-arm64@0.18.20":
|
||||
version "0.18.20"
|
||||
resolved "https://registry.yarnpkg.com/@esbuild/darwin-arm64/-/darwin-arm64-0.18.20.tgz#08172cbeccf95fbc383399a7f39cfbddaeb0d7c1"
|
||||
integrity sha512-bxRHW5kHU38zS2lPTPOyuyTm+S+eobPUnTNkdJEfAddYgEcll4xkT8DB9d2008DtTbl7uJag2HuE5NZAZgnNEA==
|
||||
|
||||
"@esbuild/darwin-x64@0.18.20":
|
||||
version "0.18.20"
|
||||
resolved "https://registry.yarnpkg.com/@esbuild/darwin-x64/-/darwin-x64-0.18.20.tgz#d70d5790d8bf475556b67d0f8b7c5bdff053d85d"
|
||||
integrity sha512-pc5gxlMDxzm513qPGbCbDukOdsGtKhfxD1zJKXjCCcU7ju50O7MeAZ8c4krSJcOIJGFR+qx21yMMVYwiQvyTyQ==
|
||||
|
||||
"@esbuild/freebsd-arm64@0.18.20":
|
||||
version "0.18.20"
|
||||
resolved "https://registry.yarnpkg.com/@esbuild/freebsd-arm64/-/freebsd-arm64-0.18.20.tgz#98755cd12707f93f210e2494d6a4b51b96977f54"
|
||||
integrity sha512-yqDQHy4QHevpMAaxhhIwYPMv1NECwOvIpGCZkECn8w2WFHXjEwrBn3CeNIYsibZ/iZEUemj++M26W3cNR5h+Tw==
|
||||
|
||||
"@esbuild/freebsd-x64@0.18.20":
|
||||
version "0.18.20"
|
||||
resolved "https://registry.yarnpkg.com/@esbuild/freebsd-x64/-/freebsd-x64-0.18.20.tgz#c1eb2bff03915f87c29cece4c1a7fa1f423b066e"
|
||||
integrity sha512-tgWRPPuQsd3RmBZwarGVHZQvtzfEBOreNuxEMKFcd5DaDn2PbBxfwLcj4+aenoh7ctXcbXmOQIn8HI6mCSw5MQ==
|
||||
|
||||
"@esbuild/linux-arm64@0.18.20":
|
||||
version "0.18.20"
|
||||
resolved "https://registry.yarnpkg.com/@esbuild/linux-arm64/-/linux-arm64-0.18.20.tgz#bad4238bd8f4fc25b5a021280c770ab5fc3a02a0"
|
||||
integrity sha512-2YbscF+UL7SQAVIpnWvYwM+3LskyDmPhe31pE7/aoTMFKKzIc9lLbyGUpmmb8a8AixOL61sQ/mFh3jEjHYFvdA==
|
||||
|
||||
"@esbuild/linux-arm@0.18.20":
|
||||
version "0.18.20"
|
||||
resolved "https://registry.yarnpkg.com/@esbuild/linux-arm/-/linux-arm-0.18.20.tgz#3e617c61f33508a27150ee417543c8ab5acc73b0"
|
||||
integrity sha512-/5bHkMWnq1EgKr1V+Ybz3s1hWXok7mDFUMQ4cG10AfW3wL02PSZi5kFpYKrptDsgb2WAJIvRcDm+qIvXf/apvg==
|
||||
|
||||
"@esbuild/linux-ia32@0.18.20":
|
||||
version "0.18.20"
|
||||
resolved "https://registry.yarnpkg.com/@esbuild/linux-ia32/-/linux-ia32-0.18.20.tgz#699391cccba9aee6019b7f9892eb99219f1570a7"
|
||||
integrity sha512-P4etWwq6IsReT0E1KHU40bOnzMHoH73aXp96Fs8TIT6z9Hu8G6+0SHSw9i2isWrD2nbx2qo5yUqACgdfVGx7TA==
|
||||
|
||||
"@esbuild/linux-loong64@0.18.20":
|
||||
version "0.18.20"
|
||||
resolved "https://registry.yarnpkg.com/@esbuild/linux-loong64/-/linux-loong64-0.18.20.tgz#e6fccb7aac178dd2ffb9860465ac89d7f23b977d"
|
||||
integrity sha512-nXW8nqBTrOpDLPgPY9uV+/1DjxoQ7DoB2N8eocyq8I9XuqJ7BiAMDMf9n1xZM9TgW0J8zrquIb/A7s3BJv7rjg==
|
||||
|
||||
"@esbuild/linux-mips64el@0.18.20":
|
||||
version "0.18.20"
|
||||
resolved "https://registry.yarnpkg.com/@esbuild/linux-mips64el/-/linux-mips64el-0.18.20.tgz#eeff3a937de9c2310de30622a957ad1bd9183231"
|
||||
integrity sha512-d5NeaXZcHp8PzYy5VnXV3VSd2D328Zb+9dEq5HE6bw6+N86JVPExrA6O68OPwobntbNJ0pzCpUFZTo3w0GyetQ==
|
||||
|
||||
"@esbuild/linux-ppc64@0.18.20":
|
||||
version "0.18.20"
|
||||
resolved "https://registry.yarnpkg.com/@esbuild/linux-ppc64/-/linux-ppc64-0.18.20.tgz#2f7156bde20b01527993e6881435ad79ba9599fb"
|
||||
integrity sha512-WHPyeScRNcmANnLQkq6AfyXRFr5D6N2sKgkFo2FqguP44Nw2eyDlbTdZwd9GYk98DZG9QItIiTlFLHJHjxP3FA==
|
||||
|
||||
"@esbuild/linux-riscv64@0.18.20":
|
||||
version "0.18.20"
|
||||
resolved "https://registry.yarnpkg.com/@esbuild/linux-riscv64/-/linux-riscv64-0.18.20.tgz#6628389f210123d8b4743045af8caa7d4ddfc7a6"
|
||||
integrity sha512-WSxo6h5ecI5XH34KC7w5veNnKkju3zBRLEQNY7mv5mtBmrP/MjNBCAlsM2u5hDBlS3NGcTQpoBvRzqBcRtpq1A==
|
||||
|
||||
"@esbuild/linux-s390x@0.18.20":
|
||||
version "0.18.20"
|
||||
resolved "https://registry.yarnpkg.com/@esbuild/linux-s390x/-/linux-s390x-0.18.20.tgz#255e81fb289b101026131858ab99fba63dcf0071"
|
||||
integrity sha512-+8231GMs3mAEth6Ja1iK0a1sQ3ohfcpzpRLH8uuc5/KVDFneH6jtAJLFGafpzpMRO6DzJ6AvXKze9LfFMrIHVQ==
|
||||
|
||||
"@esbuild/linux-x64@0.18.20":
|
||||
version "0.18.20"
|
||||
resolved "https://registry.yarnpkg.com/@esbuild/linux-x64/-/linux-x64-0.18.20.tgz#c7690b3417af318a9b6f96df3031a8865176d338"
|
||||
integrity sha512-UYqiqemphJcNsFEskc73jQ7B9jgwjWrSayxawS6UVFZGWrAAtkzjxSqnoclCXxWtfwLdzU+vTpcNYhpn43uP1w==
|
||||
|
||||
"@esbuild/netbsd-x64@0.18.20":
|
||||
version "0.18.20"
|
||||
resolved "https://registry.yarnpkg.com/@esbuild/netbsd-x64/-/netbsd-x64-0.18.20.tgz#30e8cd8a3dded63975e2df2438ca109601ebe0d1"
|
||||
integrity sha512-iO1c++VP6xUBUmltHZoMtCUdPlnPGdBom6IrO4gyKPFFVBKioIImVooR5I83nTew5UOYrk3gIJhbZh8X44y06A==
|
||||
|
||||
"@esbuild/openbsd-x64@0.18.20":
|
||||
version "0.18.20"
|
||||
resolved "https://registry.yarnpkg.com/@esbuild/openbsd-x64/-/openbsd-x64-0.18.20.tgz#7812af31b205055874c8082ea9cf9ab0da6217ae"
|
||||
integrity sha512-e5e4YSsuQfX4cxcygw/UCPIEP6wbIL+se3sxPdCiMbFLBWu0eiZOJ7WoD+ptCLrmjZBK1Wk7I6D/I3NglUGOxg==
|
||||
|
||||
"@esbuild/sunos-x64@0.18.20":
|
||||
version "0.18.20"
|
||||
resolved "https://registry.yarnpkg.com/@esbuild/sunos-x64/-/sunos-x64-0.18.20.tgz#d5c275c3b4e73c9b0ecd38d1ca62c020f887ab9d"
|
||||
integrity sha512-kDbFRFp0YpTQVVrqUd5FTYmWo45zGaXe0X8E1G/LKFC0v8x0vWrhOWSLITcCn63lmZIxfOMXtCfti/RxN/0wnQ==
|
||||
|
||||
"@esbuild/win32-arm64@0.18.20":
|
||||
version "0.18.20"
|
||||
resolved "https://registry.yarnpkg.com/@esbuild/win32-arm64/-/win32-arm64-0.18.20.tgz#73bc7f5a9f8a77805f357fab97f290d0e4820ac9"
|
||||
integrity sha512-ddYFR6ItYgoaq4v4JmQQaAI5s7npztfV4Ag6NrhiaW0RrnOXqBkgwZLofVTlq1daVTQNhtI5oieTvkRPfZrePg==
|
||||
|
||||
"@esbuild/win32-ia32@0.18.20":
|
||||
version "0.18.20"
|
||||
resolved "https://registry.yarnpkg.com/@esbuild/win32-ia32/-/win32-ia32-0.18.20.tgz#ec93cbf0ef1085cc12e71e0d661d20569ff42102"
|
||||
integrity sha512-Wv7QBi3ID/rROT08SABTS7eV4hX26sVduqDOTe1MvGMjNd3EjOz4b7zeexIR62GTIEKrfJXKL9LFxTYgkyeu7g==
|
||||
|
||||
"@esbuild/win32-x64@0.18.20":
|
||||
version "0.18.20"
|
||||
resolved "https://registry.yarnpkg.com/@esbuild/win32-x64/-/win32-x64-0.18.20.tgz#786c5f41f043b07afb1af37683d7c33668858f6d"
|
||||
integrity sha512-kTdfRcSiDfQca/y9QIkng02avJ+NCaQvrMejlsB3RRv5sE9rRoeBPISaZpKxHELzRxZyLvNts1P27W3wV+8geQ==
|
||||
|
||||
"@jridgewell/sourcemap-codec@^1.5.5":
|
||||
version "1.5.5"
|
||||
resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.5.tgz#6912b00d2c631c0d15ce1a7ab57cd657f2a8f8ba"
|
||||
integrity sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==
|
||||
|
||||
"@vitejs/plugin-vue@^4.2.3":
|
||||
version "4.6.2"
|
||||
resolved "https://registry.yarnpkg.com/@vitejs/plugin-vue/-/plugin-vue-4.6.2.tgz#057d2ded94c4e71b94e9814f92dcd9306317aa46"
|
||||
integrity sha512-kqf7SGFoG+80aZG6Pf+gsZIVvGSCKE98JbiWqcCV9cThtg91Jav0yvYFC9Zb+jKetNGF6ZKeoaxgZfND21fWKw==
|
||||
|
||||
"@vue/compiler-core@3.5.26":
|
||||
version "3.5.26"
|
||||
resolved "https://registry.yarnpkg.com/@vue/compiler-core/-/compiler-core-3.5.26.tgz#1a91ea90980528bedff7b1c292690bfb30612485"
|
||||
integrity sha512-vXyI5GMfuoBCnv5ucIT7jhHKl55Y477yxP6fc4eUswjP8FG3FFVFd41eNDArR+Uk3QKn2Z85NavjaxLxOC19/w==
|
||||
dependencies:
|
||||
"@babel/parser" "^7.28.5"
|
||||
"@vue/shared" "3.5.26"
|
||||
entities "^7.0.0"
|
||||
estree-walker "^2.0.2"
|
||||
source-map-js "^1.2.1"
|
||||
|
||||
"@vue/compiler-dom@3.5.26":
|
||||
version "3.5.26"
|
||||
resolved "https://registry.yarnpkg.com/@vue/compiler-dom/-/compiler-dom-3.5.26.tgz#66c36b6ed8bdf43236d7188ea332bc9d078eb286"
|
||||
integrity sha512-y1Tcd3eXs834QjswshSilCBnKGeQjQXB6PqFn/1nxcQw4pmG42G8lwz+FZPAZAby6gZeHSt/8LMPfZ4Rb+Bd/A==
|
||||
dependencies:
|
||||
"@vue/compiler-core" "3.5.26"
|
||||
"@vue/shared" "3.5.26"
|
||||
|
||||
"@vue/compiler-sfc@3.5.26":
|
||||
version "3.5.26"
|
||||
resolved "https://registry.yarnpkg.com/@vue/compiler-sfc/-/compiler-sfc-3.5.26.tgz#fb1c6c4bf9a9e22bb169e039e19437cb6995917a"
|
||||
integrity sha512-egp69qDTSEZcf4bGOSsprUr4xI73wfrY5oRs6GSgXFTiHrWj4Y3X5Ydtip9QMqiCMCPVwLglB9GBxXtTadJ3mA==
|
||||
dependencies:
|
||||
"@babel/parser" "^7.28.5"
|
||||
"@vue/compiler-core" "3.5.26"
|
||||
"@vue/compiler-dom" "3.5.26"
|
||||
"@vue/compiler-ssr" "3.5.26"
|
||||
"@vue/shared" "3.5.26"
|
||||
estree-walker "^2.0.2"
|
||||
magic-string "^0.30.21"
|
||||
postcss "^8.5.6"
|
||||
source-map-js "^1.2.1"
|
||||
|
||||
"@vue/compiler-ssr@3.5.26":
|
||||
version "3.5.26"
|
||||
resolved "https://registry.yarnpkg.com/@vue/compiler-ssr/-/compiler-ssr-3.5.26.tgz#f6e94bccbb5339180779036ddfb614f998a197ea"
|
||||
integrity sha512-lZT9/Y0nSIRUPVvapFJEVDbEXruZh2IYHMk2zTtEgJSlP5gVOqeWXH54xDKAaFS4rTnDeDBQUYDtxKyoW9FwDw==
|
||||
dependencies:
|
||||
"@vue/compiler-dom" "3.5.26"
|
||||
"@vue/shared" "3.5.26"
|
||||
|
||||
"@vue/reactivity@3.5.26":
|
||||
version "3.5.26"
|
||||
resolved "https://registry.yarnpkg.com/@vue/reactivity/-/reactivity-3.5.26.tgz#59a1edf566dc80133c1c26c93711c877e8602c48"
|
||||
integrity sha512-9EnYB1/DIiUYYnzlnUBgwU32NNvLp/nhxLXeWRhHUEeWNTn1ECxX8aGO7RTXeX6PPcxe3LLuNBFoJbV4QZ+CFQ==
|
||||
dependencies:
|
||||
"@vue/shared" "3.5.26"
|
||||
|
||||
"@vue/runtime-core@3.5.26":
|
||||
version "3.5.26"
|
||||
resolved "https://registry.yarnpkg.com/@vue/runtime-core/-/runtime-core-3.5.26.tgz#3f2c040bcf8018c03a1ab5adb0d788c13c986f0e"
|
||||
integrity sha512-xJWM9KH1kd201w5DvMDOwDHYhrdPTrAatn56oB/LRG4plEQeZRQLw0Bpwih9KYoqmzaxF0OKSn6swzYi84e1/Q==
|
||||
dependencies:
|
||||
"@vue/reactivity" "3.5.26"
|
||||
"@vue/shared" "3.5.26"
|
||||
|
||||
"@vue/runtime-dom@3.5.26":
|
||||
version "3.5.26"
|
||||
resolved "https://registry.yarnpkg.com/@vue/runtime-dom/-/runtime-dom-3.5.26.tgz#5954848614883948ecc1f631a67b32cc32f81936"
|
||||
integrity sha512-XLLd/+4sPC2ZkN/6+V4O4gjJu6kSDbHAChvsyWgm1oGbdSO3efvGYnm25yCjtFm/K7rrSDvSfPDgN1pHgS4VNQ==
|
||||
dependencies:
|
||||
"@vue/reactivity" "3.5.26"
|
||||
"@vue/runtime-core" "3.5.26"
|
||||
"@vue/shared" "3.5.26"
|
||||
csstype "^3.2.3"
|
||||
|
||||
"@vue/server-renderer@3.5.26":
|
||||
version "3.5.26"
|
||||
resolved "https://registry.yarnpkg.com/@vue/server-renderer/-/server-renderer-3.5.26.tgz#269055497fcc75b3984063f866f17c748b565ef4"
|
||||
integrity sha512-TYKLXmrwWKSodyVuO1WAubucd+1XlLg4set0YoV+Hu8Lo79mp/YMwWV5mC5FgtsDxX3qo1ONrxFaTP1OQgy1uA==
|
||||
dependencies:
|
||||
"@vue/compiler-ssr" "3.5.26"
|
||||
"@vue/shared" "3.5.26"
|
||||
|
||||
"@vue/shared@3.5.26":
|
||||
version "3.5.26"
|
||||
resolved "https://registry.yarnpkg.com/@vue/shared/-/shared-3.5.26.tgz#1e02ef2d64aced818cd31d81ce5175711dc90a9f"
|
||||
integrity sha512-7Z6/y3uFI5PRoKeorTOSXKcDj0MSasfNNltcslbFrPpcw6aXRUALq4IfJlaTRspiWIUOEZbrpM+iQGmCOiWe4A==
|
||||
|
||||
csstype@^3.2.3:
|
||||
version "3.2.3"
|
||||
resolved "https://registry.yarnpkg.com/csstype/-/csstype-3.2.3.tgz#ec48c0f3e993e50648c86da559e2610995cf989a"
|
||||
integrity sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==
|
||||
|
||||
entities@^7.0.0:
|
||||
version "7.0.0"
|
||||
resolved "https://registry.yarnpkg.com/entities/-/entities-7.0.0.tgz#2ae4e443f3f17d152d3f5b0f79b932c1e59deb7a"
|
||||
integrity sha512-FDWG5cmEYf2Z00IkYRhbFrwIwvdFKH07uV8dvNy0omp/Qb1xcyCWp2UDtcwJF4QZZvk0sLudP6/hAu42TaqVhQ==
|
||||
|
||||
esbuild@^0.18.10:
|
||||
version "0.18.20"
|
||||
resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.18.20.tgz#4709f5a34801b43b799ab7d6d82f7284a9b7a7a6"
|
||||
integrity sha512-ceqxoedUrcayh7Y7ZX6NdbbDzGROiyVBgC4PriJThBKSVPWnnFHZAkfI1lJT8QFkOwH4qOS2SJkS4wvpGl8BpA==
|
||||
optionalDependencies:
|
||||
"@esbuild/android-arm" "0.18.20"
|
||||
"@esbuild/android-arm64" "0.18.20"
|
||||
"@esbuild/android-x64" "0.18.20"
|
||||
"@esbuild/darwin-arm64" "0.18.20"
|
||||
"@esbuild/darwin-x64" "0.18.20"
|
||||
"@esbuild/freebsd-arm64" "0.18.20"
|
||||
"@esbuild/freebsd-x64" "0.18.20"
|
||||
"@esbuild/linux-arm" "0.18.20"
|
||||
"@esbuild/linux-arm64" "0.18.20"
|
||||
"@esbuild/linux-ia32" "0.18.20"
|
||||
"@esbuild/linux-loong64" "0.18.20"
|
||||
"@esbuild/linux-mips64el" "0.18.20"
|
||||
"@esbuild/linux-ppc64" "0.18.20"
|
||||
"@esbuild/linux-riscv64" "0.18.20"
|
||||
"@esbuild/linux-s390x" "0.18.20"
|
||||
"@esbuild/linux-x64" "0.18.20"
|
||||
"@esbuild/netbsd-x64" "0.18.20"
|
||||
"@esbuild/openbsd-x64" "0.18.20"
|
||||
"@esbuild/sunos-x64" "0.18.20"
|
||||
"@esbuild/win32-arm64" "0.18.20"
|
||||
"@esbuild/win32-ia32" "0.18.20"
|
||||
"@esbuild/win32-x64" "0.18.20"
|
||||
|
||||
estree-walker@^2.0.2:
|
||||
version "2.0.2"
|
||||
resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-2.0.2.tgz#52f010178c2a4c117a7757cfe942adb7d2da4cac"
|
||||
integrity sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==
|
||||
|
||||
fsevents@~2.3.2:
|
||||
version "2.3.3"
|
||||
resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.3.tgz#cac6407785d03675a2a5e1a5305c697b347d90d6"
|
||||
integrity sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==
|
||||
|
||||
magic-string@^0.30.21:
|
||||
version "0.30.21"
|
||||
resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.30.21.tgz#56763ec09a0fa8091df27879fd94d19078c00d91"
|
||||
integrity sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==
|
||||
dependencies:
|
||||
"@jridgewell/sourcemap-codec" "^1.5.5"
|
||||
|
||||
nanoid@^3.3.11:
|
||||
version "3.3.11"
|
||||
resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.11.tgz#4f4f112cefbe303202f2199838128936266d185b"
|
||||
integrity sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==
|
||||
|
||||
picocolors@^1.1.1:
|
||||
version "1.1.1"
|
||||
resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.1.1.tgz#3d321af3eab939b083c8f929a1d12cda81c26b6b"
|
||||
integrity sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==
|
||||
|
||||
postcss@^8.4.27, postcss@^8.5.6:
|
||||
version "8.5.6"
|
||||
resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.5.6.tgz#2825006615a619b4f62a9e7426cc120b349a8f3c"
|
||||
integrity sha512-3Ybi1tAuwAP9s0r1UQ2J4n5Y0G05bJkpUIO0/bI9MhwmD70S5aTWbXGBwxHrelT+XM1k6dM0pk+SwNkpTRN7Pg==
|
||||
dependencies:
|
||||
nanoid "^3.3.11"
|
||||
picocolors "^1.1.1"
|
||||
source-map-js "^1.2.1"
|
||||
|
||||
rollup@^3.27.1:
|
||||
version "3.29.5"
|
||||
resolved "https://registry.yarnpkg.com/rollup/-/rollup-3.29.5.tgz#8a2e477a758b520fb78daf04bca4c522c1da8a54"
|
||||
integrity sha512-GVsDdsbJzzy4S/v3dqWPJ7EfvZJfCHiDqe80IyrF59LYuP+e6U1LJoUqeuqRbwAWoMNoXivMNeNAOf5E22VA1w==
|
||||
optionalDependencies:
|
||||
fsevents "~2.3.2"
|
||||
|
||||
source-map-js@^1.2.1:
|
||||
version "1.2.1"
|
||||
resolved "https://registry.yarnpkg.com/source-map-js/-/source-map-js-1.2.1.tgz#1ce5650fddd87abc099eda37dcff024c2667ae46"
|
||||
integrity sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==
|
||||
|
||||
vite@^4.3.9:
|
||||
version "4.5.14"
|
||||
resolved "https://registry.yarnpkg.com/vite/-/vite-4.5.14.tgz#2e652bc1d898265d987d6543ce866ecd65fa4086"
|
||||
integrity sha512-+v57oAaoYNnO3hIu5Z/tJRZjq5aHM2zDve9YZ8HngVHbhk66RStobhb1sqPMIPEleV6cNKYK4eGrAbE9Ulbl2g==
|
||||
dependencies:
|
||||
esbuild "^0.18.10"
|
||||
postcss "^8.4.27"
|
||||
rollup "^3.27.1"
|
||||
optionalDependencies:
|
||||
fsevents "~2.3.2"
|
||||
|
||||
vue@^3.3.4:
|
||||
version "3.5.26"
|
||||
resolved "https://registry.yarnpkg.com/vue/-/vue-3.5.26.tgz#03a0b17311e0e593d34b9358fa249b85e3a6d9fb"
|
||||
integrity sha512-SJ/NTccVyAoNUJmkM9KUqPcYlY+u8OVL1X5EW9RIs3ch5H2uERxyyIUI4MRxVCSOiEcupX9xNGde1tL9ZKpimA==
|
||||
dependencies:
|
||||
"@vue/compiler-dom" "3.5.26"
|
||||
"@vue/compiler-sfc" "3.5.26"
|
||||
"@vue/runtime-dom" "3.5.26"
|
||||
"@vue/server-renderer" "3.5.26"
|
||||
"@vue/shared" "3.5.26"
|
||||
@@ -0,0 +1,68 @@
|
||||
module npc-gui
|
||||
|
||||
go 1.24.0
|
||||
|
||||
toolchain go1.24.9
|
||||
|
||||
require (
|
||||
ehang.io/nps v0.0.0-00010101000000-000000000000
|
||||
github.com/astaxie/beego v1.12.3
|
||||
github.com/energye/systray v1.0.2
|
||||
github.com/wailsapp/wails/v2 v2.11.0
|
||||
golang.org/x/sys v0.30.0
|
||||
)
|
||||
|
||||
// 使用本地路径替代依赖
|
||||
replace (
|
||||
ehang.io/nps => ../../..
|
||||
github.com/astaxie/beego => github.com/exfly/beego v1.12.0-export-init
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/bep/debounce v1.2.1 // indirect
|
||||
github.com/go-ole/go-ole v1.3.0 // indirect
|
||||
github.com/godbus/dbus/v5 v5.1.0 // indirect
|
||||
github.com/golang/snappy v0.0.3 // indirect
|
||||
github.com/google/uuid v1.6.0 // indirect
|
||||
github.com/gorilla/websocket v1.5.3 // indirect
|
||||
github.com/jchv/go-winloader v0.0.0-20210711035445-715c2860da7e // indirect
|
||||
github.com/klauspost/cpuid/v2 v2.0.6 // indirect
|
||||
github.com/klauspost/reedsolomon v1.9.12 // indirect
|
||||
github.com/labstack/echo/v4 v4.13.3 // indirect
|
||||
github.com/labstack/gommon v0.4.2 // indirect
|
||||
github.com/leaanthony/go-ansi-parser v1.6.1 // indirect
|
||||
github.com/leaanthony/gosod v1.0.4 // indirect
|
||||
github.com/leaanthony/slicer v1.6.0 // indirect
|
||||
github.com/leaanthony/u v1.1.1 // indirect
|
||||
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect
|
||||
github.com/mattn/go-colorable v0.1.13 // indirect
|
||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||
github.com/panjf2000/ants/v2 v2.4.2 // indirect
|
||||
github.com/pires/go-proxyproto v0.8.0 // indirect
|
||||
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect
|
||||
github.com/pkg/errors v0.9.1 // indirect
|
||||
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect
|
||||
github.com/rivo/uniseg v0.4.7 // indirect
|
||||
github.com/samber/lo v1.49.1 // indirect
|
||||
github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644 // indirect
|
||||
github.com/shirou/gopsutil/v3 v3.23.10 // indirect
|
||||
github.com/shoenig/go-m1cpu v0.1.6 // indirect
|
||||
github.com/templexxx/cpufeat v0.0.0-20180724012125-cef66df7f161 // indirect
|
||||
github.com/templexxx/xor v0.0.0-20191217153810-f85b25db303b // indirect
|
||||
github.com/tevino/abool v0.0.0-20220530134649-2bfc934cb23c // indirect
|
||||
github.com/tjfoc/gmsm v1.4.0 // indirect
|
||||
github.com/tklauser/go-sysconf v0.3.12 // indirect
|
||||
github.com/tklauser/numcpus v0.6.1 // indirect
|
||||
github.com/tkrajina/go-reflector v0.5.8 // indirect
|
||||
github.com/valyala/bytebufferpool v1.0.0 // indirect
|
||||
github.com/valyala/fasttemplate v1.2.2 // indirect
|
||||
github.com/wailsapp/go-webview2 v1.0.22 // indirect
|
||||
github.com/wailsapp/mimetype v1.4.1 // indirect
|
||||
github.com/xtaci/kcp-go v5.4.20+incompatible // indirect
|
||||
github.com/yusufpapurcu/wmi v1.2.3 // indirect
|
||||
golang.org/x/crypto v0.33.0 // indirect
|
||||
golang.org/x/net v0.35.0 // indirect
|
||||
golang.org/x/text v0.22.0 // indirect
|
||||
golang.org/x/time v0.14.0 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
)
|
||||
@@ -0,0 +1,260 @@
|
||||
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||
github.com/Knetic/govaluate v3.0.0+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0=
|
||||
github.com/OwnLocal/goes v1.0.0/go.mod h1:8rIFjBGTue3lCU0wplczcUgt9Gxgrkkrw7etMIcn8TM=
|
||||
github.com/beego/goyaml2 v0.0.0-20130207012346-5545475820dd/go.mod h1:1b+Y/CofkYwXMUU0OhQqGvsY2Bvgr4j6jfT699wyZKQ=
|
||||
github.com/beego/x2j v0.0.0-20131220205130-a0352aadc542/go.mod h1:kSeGC/p1AbBiEp5kat81+DSQrZenVBZXklMLaELspWU=
|
||||
github.com/bep/debounce v1.2.1 h1:v67fRdBA9UQu2NhLFXrSg0Brw7CexQekrBwDMM8bzeY=
|
||||
github.com/bep/debounce v1.2.1/go.mod h1:H8yggRPQKLUhUoqrJC1bO2xNya7vanpDl7xR3ISbCJ0=
|
||||
github.com/bradfitz/gomemcache v0.0.0-20180710155616-bc664df96737/go.mod h1:PmM6Mmwb0LSuEubjR8N7PtNe1KxZLtOUHtbeikc5h60=
|
||||
github.com/casbin/casbin v1.7.0/go.mod h1:c67qKN6Oum3UF5Q1+BByfFxkwKvhwW57ITjqwtzR1KE=
|
||||
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
||||
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
|
||||
github.com/cloudflare/golz4 v0.0.0-20150217214814-ef862a3cdc58/go.mod h1:EOBUe0h4xcZ5GoxqC5SDxFQ8gwyZPKQoEzownBlhI80=
|
||||
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
|
||||
github.com/couchbase/go-couchbase v0.0.0-20181122212707-3e9b6e1258bb/go.mod h1:TWI8EKQMs5u5jLKW/tsb9VwauIrMIxQG1r5fMsswK5U=
|
||||
github.com/couchbase/gomemcached v0.0.0-20181122193126-5125a94a666c/go.mod h1:srVSlQLB8iXBVXHgnqemxUXqN6FCvClgCMPCsjBDR7c=
|
||||
github.com/couchbase/goutils v0.0.0-20180530154633-e865a1461c8a/go.mod h1:BQwMFlJzDjFDG3DJUdU0KORxn88UlsOULuxLExMh3Hs=
|
||||
github.com/cupcake/rdb v0.0.0-20161107195141-43ba34106c76/go.mod h1:vYwsqCOLxGiisLwp9rITslkFNpZD5rz43tf41QFkTWY=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/edsrzf/mmap-go v0.0.0-20170320065105-0bce6a688712/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M=
|
||||
github.com/elazarl/go-bindata-assetfs v1.0.0 h1:G/bYguwHIzWq9ZoyUQqrjTmJbbYn3j3CKKpKinvZLFk=
|
||||
github.com/elazarl/go-bindata-assetfs v1.0.0/go.mod h1:v+YaWX3bdea5J/mo8dSETolEo7R71Vk1u8bnjau5yw4=
|
||||
github.com/energye/systray v1.0.2 h1:63R4prQkANtpM2CIA4UrDCuwZFt+FiygG77JYCsNmXc=
|
||||
github.com/energye/systray v1.0.2/go.mod h1:sp7Q/q/I4/w5ebvpSuJVep71s9Bg7L9ZVp69gBASehM=
|
||||
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
||||
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
|
||||
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
|
||||
github.com/exfly/beego v1.12.0-export-init h1:VQNYKdXhAwZGUaFmQv8Aj921O3rQJZRIF8xeGrhsjrI=
|
||||
github.com/exfly/beego v1.12.0-export-init/go.mod h1:fysx+LZNZKnvh4GED/xND7jWtjCR6HzydR2Hh2Im57o=
|
||||
github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
|
||||
github.com/go-ole/go-ole v1.3.0 h1:Dt6ye7+vXGIKZ7Xtk4s6/xVdGDQynvom7xCFEdWr6uE=
|
||||
github.com/go-ole/go-ole v1.3.0/go.mod h1:5LS6F96DhAwUc7C+1HLexzMXY1xGRSryjyPPKW6zv78=
|
||||
github.com/go-redis/redis v6.14.2+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA=
|
||||
github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w=
|
||||
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
|
||||
github.com/godbus/dbus/v5 v5.1.0 h1:4KLkAxT3aOY8Li4FRJe/KvhoNFFxo0m6fNuFUO8QJUk=
|
||||
github.com/godbus/dbus/v5 v5.1.0/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
|
||||
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
|
||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
|
||||
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
|
||||
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
|
||||
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
|
||||
github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
|
||||
github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
|
||||
github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
|
||||
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
|
||||
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
|
||||
github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
||||
github.com/golang/snappy v0.0.3 h1:fHPg5GQYlCeLIPB9BZqMVR5nR9A+IM5zcgeTdjMYmLA=
|
||||
github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
||||
github.com/gomodule/redigo v2.0.0+incompatible/go.mod h1:B4C85qUVwatsJoIUNIfCRsp7qO0iAmpGFZ4EELWSbC4=
|
||||
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
|
||||
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
|
||||
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||
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/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg=
|
||||
github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
|
||||
github.com/jchv/go-winloader v0.0.0-20210711035445-715c2860da7e h1:Q3+PugElBCf4PFpxhErSzU3/PY5sFL5Z6rfv4AbGAck=
|
||||
github.com/jchv/go-winloader v0.0.0-20210711035445-715c2860da7e/go.mod h1:alcuEEnZsY1WQsagKhZDsoPCRoOijYqhZvPwLG0kzVs=
|
||||
github.com/klauspost/cpuid/v2 v2.0.2/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
|
||||
github.com/klauspost/cpuid/v2 v2.0.6 h1:dQ5ueTiftKxp0gyjKSx5+8BtPWkyQbd95m8Gys/RarI=
|
||||
github.com/klauspost/cpuid/v2 v2.0.6/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
|
||||
github.com/klauspost/reedsolomon v1.9.12 h1:EyOucRmcrLH+2hqKGdoA5SM8pwPKR6BJsf3r6zpYOA0=
|
||||
github.com/klauspost/reedsolomon v1.9.12/go.mod h1:nLvuzNvy1ZDNQW30IuMc2ZWCbiqrJgdLoUS2X8HAUVg=
|
||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||
github.com/labstack/echo/v4 v4.13.3 h1:pwhpCPrTl5qry5HRdM5FwdXnhXSLSY+WE+YQSeCaafY=
|
||||
github.com/labstack/echo/v4 v4.13.3/go.mod h1:o90YNEeQWjDozo584l7AwhJMHN0bOC4tAfg+Xox9q5g=
|
||||
github.com/labstack/gommon v0.4.2 h1:F8qTUNXgG1+6WQmqoUWnz8WiEU60mXVVw0P4ht1WRA0=
|
||||
github.com/labstack/gommon v0.4.2/go.mod h1:QlUFxVM+SNXhDL/Z7YhocGIBYOiwB0mXm1+1bAPHPyU=
|
||||
github.com/leaanthony/debme v1.2.1 h1:9Tgwf+kjcrbMQ4WnPcEIUcQuIZYqdWftzZkBr+i/oOc=
|
||||
github.com/leaanthony/debme v1.2.1/go.mod h1:3V+sCm5tYAgQymvSOfYQ5Xx2JCr+OXiD9Jkw3otUjiA=
|
||||
github.com/leaanthony/go-ansi-parser v1.6.1 h1:xd8bzARK3dErqkPFtoF9F3/HgN8UQk0ed1YDKpEz01A=
|
||||
github.com/leaanthony/go-ansi-parser v1.6.1/go.mod h1:+vva/2y4alzVmmIEpk9QDhA7vLC5zKDTRwfZGOp3IWU=
|
||||
github.com/leaanthony/gosod v1.0.4 h1:YLAbVyd591MRffDgxUOU1NwLhT9T1/YiwjKZpkNFeaI=
|
||||
github.com/leaanthony/gosod v1.0.4/go.mod h1:GKuIL0zzPj3O1SdWQOdgURSuhkF+Urizzxh26t9f1cw=
|
||||
github.com/leaanthony/slicer v1.6.0 h1:1RFP5uiPJvT93TAHi+ipd3NACobkW53yUiBqZheE/Js=
|
||||
github.com/leaanthony/slicer v1.6.0/go.mod h1:o/Iz29g7LN0GqH3aMjWAe90381nyZlDNquK+mtH2Fj8=
|
||||
github.com/leaanthony/u v1.1.1 h1:TUFjwDGlNX+WuwVEzDqQwC2lOv0P4uhTQw7CMFdiK7M=
|
||||
github.com/leaanthony/u v1.1.1/go.mod h1:9+o6hejoRljvZ3BzdYlVL0JYCwtnAsVuN9pVTQcaRfI=
|
||||
github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
|
||||
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 h1:6E+4a0GO5zZEnZ81pIr0yLvtUWk2if982qA3F3QD6H4=
|
||||
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I=
|
||||
github.com/matryer/is v1.4.0/go.mod h1:8I/i5uYgLzgsgEloJE1U6xx5HkBQpAZvepWuujKwMRU=
|
||||
github.com/matryer/is v1.4.1 h1:55ehd8zaGABKLXQUe2awZ99BD/PTc2ls+KV/dXphgEQ=
|
||||
github.com/matryer/is v1.4.1/go.mod h1:8I/i5uYgLzgsgEloJE1U6xx5HkBQpAZvepWuujKwMRU=
|
||||
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
|
||||
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
|
||||
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
|
||||
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-sqlite3 v1.10.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
|
||||
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs=
|
||||
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
|
||||
github.com/panjf2000/ants/v2 v2.4.2 h1:kesjjo8JipN3vNNg1XaiXaeSs6xJweBTgenkBtsrHf8=
|
||||
github.com/panjf2000/ants/v2 v2.4.2/go.mod h1:f6F0NZVFsGCp5A7QW/Zj/m92atWwOkY0OIhFxRNFr4A=
|
||||
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
|
||||
github.com/pires/go-proxyproto v0.8.0 h1:5unRmEAPbHXHuLjDg01CxJWf91cw3lKHc/0xzKpXEe0=
|
||||
github.com/pires/go-proxyproto v0.8.0/go.mod h1:iknsfgnH8EkjrMeMyvfKByp9TiBZCKZM0jx2xmKqnVY=
|
||||
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ=
|
||||
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU=
|
||||
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
||||
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c h1:ncq/mPwQF4JjgDlrVEn3C11VoGHZN7m8qihwgMEtzYw=
|
||||
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE=
|
||||
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
||||
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
|
||||
github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
|
||||
github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
|
||||
github.com/samber/lo v1.49.1 h1:4BIFyVfuQSEpluc7Fua+j1NolZHiEHEpaSEKdsH0tew=
|
||||
github.com/samber/lo v1.49.1/go.mod h1:dO6KHFzUKXgP8LDhU0oI8d2hekjXnGOu0DB8Jecxd6o=
|
||||
github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644 h1:X+yvsM2yrEktyI+b2qND5gpH8YhURn0k8OCaeRnkINo=
|
||||
github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644/go.mod h1:nkxAfR/5quYxwPZhyDxgasBMnRtBZd0FCEpawpjMUFg=
|
||||
github.com/shirou/gopsutil/v3 v3.23.10 h1:/N42opWlYzegYaVkWejXWJpbzKv2JDy3mrgGzKsh9hM=
|
||||
github.com/shirou/gopsutil/v3 v3.23.10/go.mod h1:JIE26kpucQi+innVlAUnIEOSBhBUkirr5b44yr55+WE=
|
||||
github.com/shoenig/go-m1cpu v0.1.6 h1:nxdKQNcEB6vzgA2E2bvzKIYRuNj7XNJ4S/aRSwKzFtM=
|
||||
github.com/shoenig/go-m1cpu v0.1.6/go.mod h1:1JJMcUBvfNwpq05QDQVAnx3gUHr9IYF7GNg9SUEw2VQ=
|
||||
github.com/shoenig/test v0.6.4 h1:kVTaSd7WLz5WZ2IaoM0RSzRsUD+m8wRR+5qvntpn4LU=
|
||||
github.com/shoenig/test v0.6.4/go.mod h1:byHiCGXqrVaflBLAMq/srcZIHynQPQgeyvkvXnjqq0k=
|
||||
github.com/siddontang/go v0.0.0-20180604090527-bdc77568d726/go.mod h1:3yhqj7WBBfRhbBlzyOC3gUxftwsU0u8gqevxwIHQpMw=
|
||||
github.com/siddontang/ledisdb v0.0.0-20181029004158-becf5f38d373/go.mod h1:mF1DpOSOUiJRMR+FDqaqu3EBqrybQtrDDszLUZ6oxPg=
|
||||
github.com/siddontang/rdb v0.0.0-20150307021120-fc89ed2e418d/go.mod h1:AMEsy7v5z92TR1JKMkLLoaOQk++LVnOKL3ScbJ8GNGA=
|
||||
github.com/ssdb/gossdb v0.0.0-20180723034631-88f6b59b84ec/go.mod h1:QBvMkMya+gXctz3kmljlUCu/yB3GZ6oee+dUozsezQE=
|
||||
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.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
|
||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
|
||||
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||
github.com/syndtr/goleveldb v0.0.0-20181127023241-353a9fca669c/go.mod h1:Z4AUp2Km+PwemOoO/VB5AOx9XSsIItzFjoJlOSiYmn0=
|
||||
github.com/templexxx/cpufeat v0.0.0-20180724012125-cef66df7f161 h1:89CEmDvlq/F7SJEOqkIdNDGJXrQIhuIx9D2DBXjavSU=
|
||||
github.com/templexxx/cpufeat v0.0.0-20180724012125-cef66df7f161/go.mod h1:wM7WEvslTq+iOEAMDLSzhVuOt5BRZ05WirO+b09GHQU=
|
||||
github.com/templexxx/xor v0.0.0-20191217153810-f85b25db303b h1:fj5tQ8acgNUr6O8LEplsxDhUIe2573iLkJc+PqnzZTI=
|
||||
github.com/templexxx/xor v0.0.0-20191217153810-f85b25db303b/go.mod h1:5XA7W9S6mni3h5uvOC75dA3m9CCCaS83lltmc0ukdi4=
|
||||
github.com/tevino/abool v0.0.0-20220530134649-2bfc934cb23c h1:coVla7zpsycc+kA9NXpcvv2E4I7+ii6L5hZO2S6C3kw=
|
||||
github.com/tevino/abool v0.0.0-20220530134649-2bfc934cb23c/go.mod h1:qc66Pna1RiIsPa7O4Egxxs9OqkuxDX55zznh9K07Tzg=
|
||||
github.com/tjfoc/gmsm v1.4.0 h1:8nbaiZG+iVdh+fXVw0DZoZZa7a4TGm3Qab+xdrdzj8s=
|
||||
github.com/tjfoc/gmsm v1.4.0/go.mod h1:j4INPkHWMrhJb38G+J6W4Tw0AbuN8Thu3PbdVYhVcTE=
|
||||
github.com/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFAEVmqU=
|
||||
github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI=
|
||||
github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+Fk=
|
||||
github.com/tklauser/numcpus v0.6.1/go.mod h1:1XfjsgE2zo8GVw7POkMbHENHzVg3GzmoZ9fESEdAacY=
|
||||
github.com/tkrajina/go-reflector v0.5.8 h1:yPADHrwmUbMq4RGEyaOUpz2H90sRsETNVpjzo3DLVQQ=
|
||||
github.com/tkrajina/go-reflector v0.5.8/go.mod h1:ECbqLgccecY5kPmPmXg1MrHW585yMcDkVl6IvJe64T4=
|
||||
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
|
||||
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
|
||||
github.com/valyala/fasttemplate v1.2.2 h1:lxLXG0uE3Qnshl9QyaK6XJxMXlQZELvChBOCmQD0Loo=
|
||||
github.com/valyala/fasttemplate v1.2.2/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ=
|
||||
github.com/wailsapp/go-webview2 v1.0.22 h1:YT61F5lj+GGaat5OB96Aa3b4QA+mybD0Ggq6NZijQ58=
|
||||
github.com/wailsapp/go-webview2 v1.0.22/go.mod h1:qJmWAmAmaniuKGZPWwne+uor3AHMB5PFhqiK0Bbj8kc=
|
||||
github.com/wailsapp/mimetype v1.4.1 h1:pQN9ycO7uo4vsUUuPeHEYoUkLVkaRntMnHJxVwYhwHs=
|
||||
github.com/wailsapp/mimetype v1.4.1/go.mod h1:9aV5k31bBOv5z6u+QP8TltzvNGJPmNJD4XlAL3U+j3o=
|
||||
github.com/wailsapp/wails/v2 v2.11.0 h1:seLacV8pqupq32IjS4Y7V8ucab0WZwtK6VvUVxSBtqQ=
|
||||
github.com/wailsapp/wails/v2 v2.11.0/go.mod h1:jrf0ZaM6+GBc1wRmXsM8cIvzlg0karYin3erahI4+0k=
|
||||
github.com/wendal/errors v0.0.0-20130201093226-f66c77a7882b/go.mod h1:Q12BUT7DqIlHRmgv3RskH+UCM/4eqVMgI0EMmlSpAXc=
|
||||
github.com/xtaci/kcp-go v5.4.20+incompatible h1:TN1uey3Raw0sTz0Fg8GkfM0uH3YwzhnZWQ1bABv5xAg=
|
||||
github.com/xtaci/kcp-go v5.4.20+incompatible/go.mod h1:bN6vIwHQbfHaHtFpEssmWsN45a+AZwO7eyRCmEIbtvE=
|
||||
github.com/xtaci/lossyconn v0.0.0-20190602105132-8df528c0c9ae h1:J0GxkO96kL4WF+AIT3M4mfUVinOCPgf2uUWYFUzN0sM=
|
||||
github.com/xtaci/lossyconn v0.0.0-20190602105132-8df528c0c9ae/go.mod h1:gXtu8J62kEgmN++bm9BVICuT/e8yiLI2KFobd/TRFsE=
|
||||
github.com/yusufpapurcu/wmi v1.2.3 h1:E1ctvB7uKFMOJw3fdOW32DwGE9I7t++CRUEMKvFoFiw=
|
||||
github.com/yusufpapurcu/wmi v1.2.3/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0=
|
||||
golang.org/x/crypto v0.0.0-20181127143415-eb0de9b17e85/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
golang.org/x/crypto v0.0.0-20201012173705-84dcc777aaee/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
golang.org/x/crypto v0.33.0 h1:IOBPskki6Lysi0lo9qQvbxiQ+FvsCC/YWOecCHAixus=
|
||||
golang.org/x/crypto v0.33.0/go.mod h1:bVdXmD7IV/4GdElGPozy6U7lWdRXA4qyRVGJV57uQ5M=
|
||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
||||
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
|
||||
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
||||
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
||||
golang.org/x/net v0.0.0-20210505024714-0287a6fb4125/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||
golang.org/x/net v0.35.0 h1:T5GQRQb2y08kTAByq9L4/bz8cipCdA8FbRTXewonqY8=
|
||||
golang.org/x/net v0.35.0/go.mod h1:EglIi67kWsHKlRzzVMUD93VMSWGFOMSZgxFjparz1Qk=
|
||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200810151505-1b9f1253b3ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/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.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.30.0 h1:QjkSwP/36a20jFYWkSue1YwXzLmsV5Gfq7Eiy72C1uc=
|
||||
golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
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.22.0 h1:bofq7m3/HAFvbF51jz3Q9wLg3jkvSPuiZu/pD1XwgtM=
|
||||
golang.org/x/text v0.22.0/go.mod h1:YRoo4H8PVmsu+E3Ou7cqLVH8oXWIHVoX0jqUWALQhfY=
|
||||
golang.org/x/time v0.14.0 h1:MRx4UaLrDotUKUdCIqzPC48t1Y9hANFKIRpNx+Te8PI=
|
||||
golang.org/x/time v0.14.0/go.mod h1:eL/Oa2bBBK0TkX57Fyni+NgnyQQN4LitPmob2Hjnqw4=
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
|
||||
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
|
||||
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
|
||||
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
|
||||
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
|
||||
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
|
||||
google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=
|
||||
google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
|
||||
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
|
||||
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
|
||||
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
|
||||
google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
|
||||
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
|
||||
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU=
|
||||
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.2.7/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
|
||||
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
@@ -0,0 +1,65 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"embed"
|
||||
"io/fs"
|
||||
|
||||
"github.com/wailsapp/wails/v2"
|
||||
"github.com/wailsapp/wails/v2/pkg/options"
|
||||
|
||||
"github.com/wailsapp/wails/v2/pkg/options/assetserver"
|
||||
"github.com/wailsapp/wails/v2/pkg/options/windows"
|
||||
wailsRuntime "github.com/wailsapp/wails/v2/pkg/runtime"
|
||||
)
|
||||
|
||||
//go:embed all:frontend/dist
|
||||
var embeddedFiles embed.FS
|
||||
|
||||
//go:embed build/appicon.png
|
||||
var trayIcon []byte
|
||||
|
||||
//go:embed build/appicon.ico
|
||||
var trayIconICO []byte
|
||||
|
||||
func main() {
|
||||
app := NewApp()
|
||||
|
||||
// Asset server expects the FS root to contain index.html — create a sub FS
|
||||
assets, err := fs.Sub(embeddedFiles, "frontend/dist")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
runErr := wails.Run(&options.App{
|
||||
Title: "NPS 客户端",
|
||||
Width: 1000,
|
||||
Height: 600,
|
||||
MinWidth: 1000,
|
||||
MinHeight: 600,
|
||||
AssetServer: &assetserver.Options{
|
||||
Assets: assets,
|
||||
},
|
||||
BackgroundColour: &options.RGBA{R: 27, G: 38, B: 54, A: 1},
|
||||
OnStartup: app.startup,
|
||||
OnShutdown: app.shutdown,
|
||||
OnBeforeClose: func(ctx context.Context) bool {
|
||||
if isQuitting() {
|
||||
return false
|
||||
}
|
||||
wailsRuntime.Hide(ctx)
|
||||
return true
|
||||
},
|
||||
Bind: []interface{}{
|
||||
app,
|
||||
},
|
||||
Windows: &windows.Options{
|
||||
WebviewIsTransparent: false,
|
||||
WindowIsTranslucent: false,
|
||||
},
|
||||
})
|
||||
|
||||
if runErr != nil {
|
||||
panic(runErr)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
//go:build darwin
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/astaxie/beego/logs"
|
||||
)
|
||||
|
||||
const (
|
||||
appName = "com.nps.client"
|
||||
plistFormat = `<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>Label</key>
|
||||
<string>%s</string>
|
||||
<key>ProgramArguments</key>
|
||||
<array>
|
||||
<string>%s</string>
|
||||
</array>
|
||||
<key>RunAtLoad</key>
|
||||
<true/>
|
||||
<key>KeepAlive</key>
|
||||
<false/>
|
||||
</dict>
|
||||
</plist>`
|
||||
)
|
||||
|
||||
// getLaunchAgentPath 获取 LaunchAgent plist 文件路径
|
||||
func getLaunchAgentPath() (string, error) {
|
||||
homeDir, err := os.UserHomeDir()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
launchAgentsDir := filepath.Join(homeDir, "Library", "LaunchAgents")
|
||||
// 确保目录存在
|
||||
if err := os.MkdirAll(launchAgentsDir, 0755); err != nil {
|
||||
return "", err
|
||||
}
|
||||
return filepath.Join(launchAgentsDir, appName+".plist"), nil
|
||||
}
|
||||
|
||||
// enableStartupImpl macOS 平台的开机启动实现(使用 LaunchAgents)
|
||||
func enableStartupImpl() error {
|
||||
// 获取可执行文件路径
|
||||
exePath, err := getExecutablePath()
|
||||
if err != nil {
|
||||
return fmt.Errorf("获取可执行文件路径失败: %v", err)
|
||||
}
|
||||
|
||||
// 获取 plist 文件路径
|
||||
plistPath, err := getLaunchAgentPath()
|
||||
if err != nil {
|
||||
return fmt.Errorf("获取 LaunchAgent 路径失败: %v", err)
|
||||
}
|
||||
|
||||
// 生成 plist 内容
|
||||
plistContent := fmt.Sprintf(plistFormat, appName, exePath)
|
||||
|
||||
// 写入 plist 文件
|
||||
if err := os.WriteFile(plistPath, []byte(plistContent), 0644); err != nil {
|
||||
return fmt.Errorf("写入 plist 文件失败: %v", err)
|
||||
}
|
||||
|
||||
logs.Info("成功添加开机启动项: %s -> %s", appName, plistPath)
|
||||
return nil
|
||||
}
|
||||
|
||||
// disableStartupImpl macOS 平台的禁用开机启动实现(删除 plist 文件)
|
||||
func disableStartupImpl() error {
|
||||
plistPath, err := getLaunchAgentPath()
|
||||
if err != nil {
|
||||
return fmt.Errorf("获取 LaunchAgent 路径失败: %v", err)
|
||||
}
|
||||
|
||||
// 删除 plist 文件
|
||||
if err := os.Remove(plistPath); err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
logs.Info("开机启动项不存在,无需删除")
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("删除 plist 文件失败: %v", err)
|
||||
}
|
||||
|
||||
logs.Info("成功删除开机启动项: %s", plistPath)
|
||||
return nil
|
||||
}
|
||||
|
||||
// isStartupEnabledImpl macOS 平台检查是否已启用开机启动
|
||||
func isStartupEnabledImpl() bool {
|
||||
plistPath, err := getLaunchAgentPath()
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
|
||||
// 检查 plist 文件是否存在
|
||||
_, err = os.Stat(plistPath)
|
||||
return err == nil
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
//go:build linux
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/astaxie/beego/logs"
|
||||
)
|
||||
|
||||
const (
|
||||
appName = "nps-client"
|
||||
desktopFormat = `[Desktop Entry]
|
||||
Type=Application
|
||||
Name=NPS Client
|
||||
Comment=NPS Client Auto Start
|
||||
Exec=%s
|
||||
Terminal=false
|
||||
X-GNOME-Autostart-enabled=true
|
||||
`
|
||||
)
|
||||
|
||||
// getAutostartPath 获取自动启动目录路径
|
||||
func getAutostartPath() (string, error) {
|
||||
// 优先使用 XDG_CONFIG_HOME
|
||||
configHome := os.Getenv("XDG_CONFIG_HOME")
|
||||
if configHome == "" {
|
||||
homeDir, err := os.UserHomeDir()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
configHome = filepath.Join(homeDir, ".config")
|
||||
}
|
||||
|
||||
autostartDir := filepath.Join(configHome, "autostart")
|
||||
// 确保目录存在
|
||||
if err := os.MkdirAll(autostartDir, 0755); err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return filepath.Join(autostartDir, appName+".desktop"), nil
|
||||
}
|
||||
|
||||
// enableStartupImpl Linux 平台的开机启动实现(使用 .desktop 文件)
|
||||
func enableStartupImpl() error {
|
||||
// 获取可执行文件路径
|
||||
exePath, err := getExecutablePath()
|
||||
if err != nil {
|
||||
return fmt.Errorf("获取可执行文件路径失败: %v", err)
|
||||
}
|
||||
|
||||
// 获取 .desktop 文件路径
|
||||
desktopPath, err := getAutostartPath()
|
||||
if err != nil {
|
||||
return fmt.Errorf("获取 autostart 路径失败: %v", err)
|
||||
}
|
||||
|
||||
// 生成 .desktop 文件内容
|
||||
desktopContent := fmt.Sprintf(desktopFormat, exePath)
|
||||
|
||||
// 写入 .desktop 文件
|
||||
if err := os.WriteFile(desktopPath, []byte(desktopContent), 0644); err != nil {
|
||||
return fmt.Errorf("写入 desktop 文件失败: %v", err)
|
||||
}
|
||||
|
||||
logs.Info("成功添加开机启动项: %s -> %s", appName, desktopPath)
|
||||
return nil
|
||||
}
|
||||
|
||||
// disableStartupImpl Linux 平台的禁用开机启动实现(删除 .desktop 文件)
|
||||
func disableStartupImpl() error {
|
||||
desktopPath, err := getAutostartPath()
|
||||
if err != nil {
|
||||
return fmt.Errorf("获取 autostart 路径失败: %v", err)
|
||||
}
|
||||
|
||||
// 删除 .desktop 文件
|
||||
if err := os.Remove(desktopPath); err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
logs.Info("开机启动项不存在,无需删除")
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("删除 desktop 文件失败: %v", err)
|
||||
}
|
||||
|
||||
logs.Info("成功删除开机启动项: %s", desktopPath)
|
||||
return nil
|
||||
}
|
||||
|
||||
// isStartupEnabledImpl Linux 平台检查是否已启用开机启动
|
||||
func isStartupEnabledImpl() bool {
|
||||
desktopPath, err := getAutostartPath()
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
|
||||
// 检查 .desktop 文件是否存在
|
||||
_, err = os.Stat(desktopPath)
|
||||
return err == nil
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
//go:build windows
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/astaxie/beego/logs"
|
||||
"golang.org/x/sys/windows/registry"
|
||||
)
|
||||
|
||||
const appName = "NPS客户端"
|
||||
|
||||
// enableStartupImpl Windows 平台的开机启动实现(使用注册表)
|
||||
func enableStartupImpl() error {
|
||||
// 获取可执行文件路径
|
||||
exePath, err := getExecutablePath()
|
||||
if err != nil {
|
||||
return fmt.Errorf("获取可执行文件路径失败: %v", err)
|
||||
}
|
||||
|
||||
// 打开注册表键
|
||||
key, err := registry.OpenKey(registry.CURRENT_USER, `Software\Microsoft\Windows\CurrentVersion\Run`, registry.SET_VALUE)
|
||||
if err != nil {
|
||||
return fmt.Errorf("打开注册表失败: %v", err)
|
||||
}
|
||||
defer key.Close()
|
||||
|
||||
// 设置注册表值(应用名称 -> 可执行文件路径)
|
||||
err = key.SetStringValue(appName, exePath)
|
||||
if err != nil {
|
||||
return fmt.Errorf("设置注册表值失败: %v", err)
|
||||
}
|
||||
|
||||
logs.Info("成功添加开机启动项: %s -> %s", appName, exePath)
|
||||
return nil
|
||||
}
|
||||
|
||||
// disableStartupImpl Windows 平台的禁用开机启动实现(删除注册表项)
|
||||
func disableStartupImpl() error {
|
||||
// 打开注册表键
|
||||
key, err := registry.OpenKey(registry.CURRENT_USER, `Software\Microsoft\Windows\CurrentVersion\Run`, registry.SET_VALUE)
|
||||
if err != nil {
|
||||
return fmt.Errorf("打开注册表失败: %v", err)
|
||||
}
|
||||
defer key.Close()
|
||||
|
||||
// 删除注册表值
|
||||
err = key.DeleteValue(appName)
|
||||
if err != nil {
|
||||
// 如果键不存在,不算错误
|
||||
if err == registry.ErrNotExist {
|
||||
logs.Info("开机启动项不存在,无需删除")
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("删除注册表值失败: %v", err)
|
||||
}
|
||||
|
||||
logs.Info("成功删除开机启动项: %s", appName)
|
||||
return nil
|
||||
}
|
||||
|
||||
// isStartupEnabledImpl Windows 平台检查是否已启用开机启动
|
||||
func isStartupEnabledImpl() bool {
|
||||
key, err := registry.OpenKey(registry.CURRENT_USER, `Software\Microsoft\Windows\CurrentVersion\Run`, registry.QUERY_VALUE)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
defer key.Close()
|
||||
|
||||
_, _, err = key.GetStringValue(appName)
|
||||
return err == nil
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
//go:build !darwin
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
_ "image/png"
|
||||
"log"
|
||||
"os"
|
||||
"runtime"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/energye/systray"
|
||||
wailsRuntime "github.com/wailsapp/wails/v2/pkg/runtime"
|
||||
)
|
||||
|
||||
// QuitTray 退出托盘程序
|
||||
func QuitTray() {
|
||||
systray.Quit()
|
||||
}
|
||||
|
||||
// startTray 初始化系统托盘
|
||||
func (a *App) startTray() {
|
||||
// 锁定 OS 线程,确保 Windows 消息循环稳定运行
|
||||
runtime.LockOSThread()
|
||||
defer runtime.UnlockOSThread()
|
||||
|
||||
log.Println("systray: start")
|
||||
|
||||
// 使用 sync.WaitGroup 确保资源正确释放
|
||||
var wg sync.WaitGroup
|
||||
wg.Add(1)
|
||||
|
||||
systray.Run(
|
||||
func() {
|
||||
// onReady 回调 - 在主线程执行
|
||||
log.Println("systray: onReady start")
|
||||
defer wg.Done()
|
||||
|
||||
// 增加短暂延迟确保系统托盘完全初始化
|
||||
time.Sleep(200 * time.Millisecond)
|
||||
|
||||
// 设置托盘图标 - 增加错误处理
|
||||
var iconSet bool
|
||||
if runtime.GOOS == "windows" {
|
||||
if len(trayIconICO) > 0 {
|
||||
log.Println("systray: using embedded ICO icon")
|
||||
systray.SetIcon(trayIconICO)
|
||||
iconSet = true
|
||||
}
|
||||
} else {
|
||||
log.Println("systray: using PNG icon for non-windows")
|
||||
if len(trayIcon) > 0 {
|
||||
systray.SetIcon(trayIcon)
|
||||
iconSet = true
|
||||
}
|
||||
}
|
||||
|
||||
if !iconSet {
|
||||
log.Println("systray: no icon provided, using default")
|
||||
}
|
||||
|
||||
systray.SetTitle("NPS 客户端")
|
||||
systray.SetTooltip("NPS 客户端")
|
||||
|
||||
// 创建菜单项 - 确保在主线程创建
|
||||
showItem := systray.AddMenuItem("显示", "点击显示")
|
||||
quitItem := systray.AddMenuItem("退出", "点击退出")
|
||||
|
||||
log.Println("systray: menu items added")
|
||||
|
||||
systray.SetOnClick(func(menu systray.IMenu) {
|
||||
_ = menu
|
||||
log.Println("[Tray] Left click")
|
||||
if a.ctx != nil && !isQuitting() {
|
||||
wailsRuntime.EventsEmit(a.ctx, "tray-show")
|
||||
go func() {
|
||||
wailsRuntime.Show(a.ctx)
|
||||
}()
|
||||
}
|
||||
})
|
||||
|
||||
showItem.Click(func() {
|
||||
log.Println("[Menu] Show item clicked")
|
||||
if a.ctx != nil && !isQuitting() {
|
||||
// 确保在主线程执行 UI 操作
|
||||
wailsRuntime.EventsEmit(a.ctx, "tray-show")
|
||||
// 直接调用 Show 可能跨线程,改用异步调用
|
||||
go func() {
|
||||
wailsRuntime.Show(a.ctx)
|
||||
}()
|
||||
}
|
||||
})
|
||||
|
||||
quitItem.Click(func() {
|
||||
log.Println("[Menu] Quit item clicked")
|
||||
if !isQuitting() {
|
||||
setQuitting()
|
||||
|
||||
// 先关闭菜单
|
||||
systray.Quit()
|
||||
|
||||
// 退出应用
|
||||
if a.ctx != nil {
|
||||
wailsRuntime.Quit(a.ctx)
|
||||
} else {
|
||||
os.Exit(0)
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
func() {
|
||||
// onExit 回调
|
||||
log.Println("systray: onExit")
|
||||
setQuitting()
|
||||
wg.Wait()
|
||||
log.Println("systray: exited cleanly")
|
||||
},
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package main
|
||||
|
||||
import "sync"
|
||||
|
||||
// 退出状态由公共文件维护,避免平台实现重复定义。
|
||||
var (
|
||||
quitting bool
|
||||
quitMutex sync.Mutex
|
||||
)
|
||||
|
||||
// setQuitting 设置退出状态
|
||||
func setQuitting() {
|
||||
quitMutex.Lock()
|
||||
defer quitMutex.Unlock()
|
||||
quitting = true
|
||||
}
|
||||
|
||||
// isQuitting 检查是否正在退出
|
||||
func isQuitting() bool {
|
||||
quitMutex.Lock()
|
||||
defer quitMutex.Unlock()
|
||||
return quitting
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
//go:build darwin
|
||||
|
||||
package main
|
||||
|
||||
import "log"
|
||||
|
||||
// QuitTray no-op on macOS to avoid AppDelegate conflict with systray.
|
||||
func QuitTray() {}
|
||||
|
||||
// startTray on macOS: disable systray to avoid duplicate AppDelegate symbols.
|
||||
func (a *App) startTray() {
|
||||
log.Println("tray: disabled on darwin (systray AppDelegate conflict)")
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
{
|
||||
"name": "NPS 客户端",
|
||||
"outputtype": "desktop",
|
||||
"frontend": {
|
||||
"dir": "frontend",
|
||||
"packageManager": "yarn",
|
||||
"install": "yarn install",
|
||||
"build": "yarn run build",
|
||||
"dev": "yarn run dev",
|
||||
"dev:serverUrl": "http://localhost:34115"
|
||||
},
|
||||
"author": {
|
||||
"name": "NPS"
|
||||
},
|
||||
"info": {
|
||||
"productName": "NPS Client",
|
||||
"productVersion": "0.26.33",
|
||||
"companyName": "NPS",
|
||||
"copyright": "Copyright © 2026 NPS"
|
||||
},
|
||||
"build": {
|
||||
"nsis": {
|
||||
"oneShotInstaller": true,
|
||||
"allowToChangeInstallationDirectory": true,
|
||||
"icon": "build/windows/icon.ico"
|
||||
},
|
||||
"windows": {
|
||||
"icon": "build/windows/icon.ico"
|
||||
},
|
||||
"buildTags": "npcgui"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
||||
# yarn lockfile v1
|
||||
|
||||
|
||||
+40
-9
@@ -292,8 +292,10 @@ func printSlogan() {
|
||||
fmt.Printf("\u001B[32m输入[3]\u001B[0m - 启动系统服务\n")
|
||||
fmt.Printf("\u001B[32m输入[4]\u001B[0m - 停止系统服务\n")
|
||||
fmt.Printf("---------------------\n")
|
||||
fmt.Printf("\u001B[32m输入[5]\u001B[0m - 更新客户端\n")
|
||||
fmt.Printf("\u001B[32m输入[0]\u001B[0m - 退出\n")
|
||||
fmt.Printf("---------------------\n")
|
||||
fmt.Printf("\u001B[32m当前版本:%s\u001B[0m\n", version.VERSION)
|
||||
fmt.Printf("直接输入[快捷启动命令]则是启动隧道,多个[快捷启动命令]用英文逗号拼接\n")
|
||||
fmt.Printf("\n")
|
||||
}
|
||||
@@ -314,8 +316,8 @@ func inputCmd() {
|
||||
|
||||
flag := strings.Replace(flag, " ", "", -1)
|
||||
|
||||
// 如果输入不等于 1,2,3,4,则启动隧道
|
||||
if flag != "1" && flag != "2" && flag != "3" && flag != "4" {
|
||||
// 如果输入不等于 1,2,3,4,5,则启动隧道
|
||||
if flag != "1" && flag != "2" && flag != "3" && flag != "4" && flag != "5" {
|
||||
|
||||
vkeys := strings.Split(flag, `,`)
|
||||
var cmdArray []string
|
||||
@@ -336,7 +338,12 @@ func inputCmd() {
|
||||
}
|
||||
|
||||
} else {
|
||||
systemService(flag)
|
||||
if flag == "5" {
|
||||
install.UpdateNpcNew()
|
||||
inputCmd()
|
||||
} else {
|
||||
systemService(flag)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -344,14 +351,25 @@ func inputCmd() {
|
||||
func startNpcServer(startCmd string) {
|
||||
var serAddr string
|
||||
var vkey string
|
||||
var tls string
|
||||
array := strings.Fields(startCmd)
|
||||
serAddr = array[0]
|
||||
vkey = array[1]
|
||||
|
||||
if len(array) > 2 {
|
||||
tls = array[2]
|
||||
}
|
||||
go func() {
|
||||
for {
|
||||
logs.Info("start cmd:-server=" + serAddr + " -vkey=" + vkey)
|
||||
logs.Info("the version of client is %s, the core version of client is %s", version.VERSION, version.GetVersion())
|
||||
if tls == "-tls_enable=true" || tls == "true" {
|
||||
client.SetTlsEnable(true)
|
||||
logs.Info("start cmd:-server=" + serAddr + " -vkey=" + vkey + " " + tls)
|
||||
logs.Info("the version of client is %s, the core version of client is %s,tls enable is %t", version.VERSION, version.GetVersion(), client.GetTlsEnable())
|
||||
} else {
|
||||
client.SetTlsEnable(false)
|
||||
logs.Info("start cmd:-server=" + serAddr + " -vkey=" + vkey)
|
||||
logs.Info("the version of client is %s, the core version of client is %s", version.VERSION, version.GetVersion())
|
||||
}
|
||||
|
||||
client.NewRPClient(serAddr, vkey, *connType, *proxyUrl, nil, *disconnectTime).Start()
|
||||
logs.Info("Client closed! It will be reconnected in five seconds")
|
||||
time.Sleep(time.Second * 5)
|
||||
@@ -399,11 +417,21 @@ func systemService(flag string) {
|
||||
|
||||
for _, item := range cmdArray {
|
||||
array := strings.Fields(item)
|
||||
systemPro(flag, array[0], array[1])
|
||||
|
||||
tls := "false"
|
||||
if len(array) > 2 {
|
||||
tls = array[2]
|
||||
}
|
||||
// tls
|
||||
if tls == "-tls_enable=true" || tls == "true" {
|
||||
systemPro(flag, array[0], array[1], true)
|
||||
} else {
|
||||
systemPro(flag, array[0], array[1], false)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for _, key := range vkeys {
|
||||
systemPro(flag, "", key)
|
||||
systemPro(flag, "", key, false)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -412,7 +440,7 @@ func systemService(flag string) {
|
||||
return
|
||||
}
|
||||
|
||||
func systemPro(flag string, serAddr string, vkey string) {
|
||||
func systemPro(flag string, serAddr string, vkey string, tls bool) {
|
||||
// init service
|
||||
prg := &npc{
|
||||
exit: make(chan struct{}),
|
||||
@@ -430,6 +458,9 @@ func systemPro(flag string, serAddr string, vkey string) {
|
||||
case "1":
|
||||
svcConfig.Arguments = append(svcConfig.Arguments, "-server="+serAddr)
|
||||
svcConfig.Arguments = append(svcConfig.Arguments, "-vkey="+vkey)
|
||||
if tls {
|
||||
svcConfig.Arguments = append(svcConfig.Arguments, "-tls_enable=true")
|
||||
}
|
||||
svcConfig.Arguments = append(svcConfig.Arguments, "-debug=false")
|
||||
|
||||
*logPath = common.GetNpcLogPath()
|
||||
|
||||
+292
-9
@@ -1,9 +1,13 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"ehang.io/nps/bridge"
|
||||
"ehang.io/nps/lib/daemon"
|
||||
"ehang.io/nps/server"
|
||||
"flag"
|
||||
"fmt"
|
||||
"github.com/fatih/color"
|
||||
"log"
|
||||
"os"
|
||||
"os/exec"
|
||||
@@ -16,13 +20,13 @@ import (
|
||||
"ehang.io/nps/lib/file"
|
||||
"ehang.io/nps/lib/install"
|
||||
"ehang.io/nps/lib/version"
|
||||
"ehang.io/nps/server"
|
||||
"ehang.io/nps/server/connection"
|
||||
"ehang.io/nps/server/tool"
|
||||
"ehang.io/nps/web/routers"
|
||||
|
||||
"ehang.io/nps/lib/common"
|
||||
"ehang.io/nps/lib/crypt"
|
||||
"ehang.io/nps/web"
|
||||
"github.com/astaxie/beego"
|
||||
"github.com/astaxie/beego/logs"
|
||||
|
||||
@@ -30,9 +34,11 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
level string
|
||||
ver = flag.Bool("version", false, "show current version")
|
||||
confPath = flag.String("conf_path", "", "set current confPath")
|
||||
level string
|
||||
ver = flag.Bool("version", false, "show current version")
|
||||
confPath = flag.String("conf_path", "", "set current confPath")
|
||||
serverCmd = flag.Bool("server", false, "NPS管理脚本")
|
||||
npsLogPath = flag.String("log_path", "", "nps log path")
|
||||
)
|
||||
|
||||
func main() {
|
||||
@@ -45,7 +51,13 @@ func main() {
|
||||
common.PrintVersion()
|
||||
return
|
||||
}
|
||||
if *serverCmd {
|
||||
printSlogan()
|
||||
inputCmd()
|
||||
return
|
||||
}
|
||||
|
||||
var logPath string
|
||||
// *confPath why get null value ?
|
||||
for _, v := range os.Args[1:] {
|
||||
switch v {
|
||||
@@ -55,8 +67,15 @@ func main() {
|
||||
if strings.Contains(v, "-conf_path=") {
|
||||
common.ConfPath = strings.Replace(v, "-conf_path=", "", -1)
|
||||
}
|
||||
|
||||
if strings.Contains(v, "-log_path=") {
|
||||
logPath = strings.Replace(v, "-log_path=", "", -1)
|
||||
}
|
||||
}
|
||||
|
||||
// auto-generate default config files if not exist
|
||||
initConfig(filepath.Join(common.GetRunPath(), "conf"))
|
||||
|
||||
if err := beego.LoadAppConfig("ini", filepath.Join(common.GetRunPath(), "conf", "nps.conf")); err != nil {
|
||||
log.Fatalln("load config file error", err.Error())
|
||||
}
|
||||
@@ -68,13 +87,17 @@ func main() {
|
||||
logs.Reset()
|
||||
logs.EnableFuncCallDepth(true)
|
||||
logs.SetLogFuncCallDepth(3)
|
||||
logPath := beego.AppConfig.String("log_path")
|
||||
|
||||
if logPath == "" {
|
||||
logPath = common.GetLogPath()
|
||||
}
|
||||
if common.IsWindows() {
|
||||
logPath = strings.Replace(logPath, "\\", "\\\\", -1)
|
||||
logPath := beego.AppConfig.String("log_path")
|
||||
if logPath == "" {
|
||||
logPath = common.GetLogPath()
|
||||
}
|
||||
if common.IsWindows() {
|
||||
logPath = strings.Replace(logPath, "\\", "\\\\", -1)
|
||||
}
|
||||
}
|
||||
|
||||
// init service
|
||||
options := make(service.KeyValue)
|
||||
svcConfig := &service.Config{
|
||||
@@ -186,6 +209,185 @@ func main() {
|
||||
_ = s.Run()
|
||||
}
|
||||
|
||||
func printSlogan() {
|
||||
green := color.New(color.FgGreen).SprintFunc()
|
||||
// 第一次输入,如果输入 1,2,3,4 则需要输入秘钥,否则
|
||||
|
||||
fmt.Printf("%s", green(""))
|
||||
|
||||
fmt.Printf("\033[32;0m欢迎使用 NPS 管理脚本,当前版本:v%s\n", version.VERSION)
|
||||
fmt.Printf("\033[0m") // 重置颜色
|
||||
|
||||
fmt.Printf("\n")
|
||||
|
||||
fmt.Printf("\u001B[32m输入[1]\u001B[0m - 安装 NPS\n")
|
||||
fmt.Printf("\u001B[32m输入[2]\u001B[0m - 卸载 NPS\n")
|
||||
fmt.Printf("\u001B[32m输入[3]\u001B[0m - 更新 NPS\n")
|
||||
fmt.Printf("---------------------\n")
|
||||
fmt.Printf("\u001B[32m输入[4]\u001B[0m - 查看状态\n")
|
||||
fmt.Printf("---------------------\n")
|
||||
fmt.Printf("\u001B[32m输入[5]\u001B[0m - 启动 NPS\n")
|
||||
fmt.Printf("\u001B[32m输入[6]\u001B[0m - 停止 NPS\n")
|
||||
fmt.Printf("\u001B[32m输入[7]\u001B[0m - 重启 NPS\n")
|
||||
fmt.Printf("---------------------\n")
|
||||
fmt.Printf("\u001B[32m输入[0]\u001B[0m - 退出脚本\n")
|
||||
fmt.Printf("---------------------\n")
|
||||
fmt.Printf("\n")
|
||||
|
||||
}
|
||||
|
||||
func inputCmd() {
|
||||
var flag string
|
||||
fmt.Printf("请输入[0-7]:")
|
||||
|
||||
stdin := bufio.NewReader(os.Stdin)
|
||||
_, err := fmt.Fscanln(stdin, &flag)
|
||||
if err != nil {
|
||||
fmt.Println("输入有误")
|
||||
} else {
|
||||
if flag == "0" {
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
// init service
|
||||
|
||||
prg := &nps{
|
||||
exit: make(chan struct{}),
|
||||
}
|
||||
options := make(service.KeyValue)
|
||||
svcConfig := &service.Config{
|
||||
Name: "Nps",
|
||||
DisplayName: "nps内网穿透代理服务器",
|
||||
Description: "一款轻量级、功能强大的内网穿透代理服务器。支持tcp、udp流量转发,支持内网http代理、内网socks5代理,同时支持snappy压缩、站点保护、加密传输、多路复用、header修改等。支持web图形化管理,集成多用户模式。",
|
||||
Option: options,
|
||||
}
|
||||
s, _ := service.New(prg, svcConfig)
|
||||
|
||||
switch flag {
|
||||
case "1":
|
||||
// uninstall before
|
||||
_ = service.Control(s, "stop")
|
||||
_ = service.Control(s, "uninstall")
|
||||
binPath := install.InstallNpsToCurrentDir()
|
||||
|
||||
beego.LoadAppConfig("ini", filepath.Join(common.GetAppPath(), "conf", "nps.conf"))
|
||||
|
||||
logPath := filepath.Join(common.GetAppPath(), "nps.log")
|
||||
if common.IsWindows() {
|
||||
logPath = strings.Replace(logPath, "\\", "\\\\", -1)
|
||||
}
|
||||
svcConfig.Arguments = append(svcConfig.Arguments, "service")
|
||||
svcConfig.Arguments = append(svcConfig.Arguments, "-conf_path="+common.GetAppPath())
|
||||
svcConfig.Arguments = append(svcConfig.Arguments, "-log_path="+logPath)
|
||||
|
||||
fmt.Println("日志文件路径为:", logPath)
|
||||
|
||||
svcConfig.Executable = binPath
|
||||
s, err := service.New(prg, svcConfig)
|
||||
|
||||
if service.Platform() == "unix-systemv" {
|
||||
logs.Info("unix-systemv service")
|
||||
confPath := "/etc/init.d/" + svcConfig.Name
|
||||
os.Symlink(confPath, "/etc/rc.d/S90"+svcConfig.Name)
|
||||
os.Symlink(confPath, "/etc/rc.d/K02"+svcConfig.Name)
|
||||
}
|
||||
|
||||
err = service.Control(s, "install")
|
||||
if err != nil {
|
||||
logs.Error("Valid actions: %q\n%s", service.ControlAction, err.Error())
|
||||
} else {
|
||||
fmt.Println("NPS服务安装成功")
|
||||
}
|
||||
|
||||
err = service.Control(s, "start")
|
||||
if err != nil {
|
||||
fmt.Println("启动NPS服务失败", err)
|
||||
} else {
|
||||
fmt.Println("NPS服务已启动,管理面板访问地址:127.0.0.1:" + beego.AppConfig.String("web_port"))
|
||||
}
|
||||
|
||||
break
|
||||
case "2":
|
||||
// 卸载系统服务
|
||||
err := service.Control(s, "stop")
|
||||
if err != nil {
|
||||
fmt.Println("NPS服务停止失败", err)
|
||||
} else {
|
||||
fmt.Println("NPS服务已停止")
|
||||
}
|
||||
|
||||
err = service.Control(s, "uninstall")
|
||||
if err != nil {
|
||||
logs.Error("NPS服务卸载失败")
|
||||
}
|
||||
if service.Platform() == "unix-systemv" {
|
||||
logs.Info("unix-systemv service")
|
||||
os.Remove("/etc/rc.d/S90" + svcConfig.Name)
|
||||
os.Remove("/etc/rc.d/K02" + svcConfig.Name)
|
||||
}
|
||||
|
||||
if err == nil {
|
||||
fmt.Println("NPS服务已卸载成功")
|
||||
}
|
||||
break
|
||||
case "3":
|
||||
install.UpdateNpsNew()
|
||||
break
|
||||
case "4":
|
||||
// 查看状态
|
||||
var statusMsg = ""
|
||||
status, err := s.Status()
|
||||
if err != nil {
|
||||
statusMsg = "\u001B[31m未运行\u001B[0m"
|
||||
} else {
|
||||
if status == 1 {
|
||||
statusMsg = "\u001B[32m运行中\u001B[0m"
|
||||
} else {
|
||||
statusMsg = "\u001B[31m未运行\u001B[0m"
|
||||
}
|
||||
}
|
||||
fmt.Println("NPS服务状态:" + statusMsg)
|
||||
break
|
||||
case "5":
|
||||
// 启动 NPS
|
||||
err := service.Control(s, "start")
|
||||
if err != nil {
|
||||
fmt.Println("NPS服务启动失败", err)
|
||||
} else {
|
||||
fmt.Println("NPS服务启动成功")
|
||||
}
|
||||
|
||||
break
|
||||
case "6":
|
||||
// 停止 NPS
|
||||
err := service.Control(s, "stop")
|
||||
if err != nil {
|
||||
fmt.Println("NPS服务停止失败", err)
|
||||
} else {
|
||||
fmt.Println("NPS服务停止成功")
|
||||
}
|
||||
|
||||
break
|
||||
case "7":
|
||||
// 重启 NPS
|
||||
err := service.Control(s, "restart")
|
||||
if err != nil {
|
||||
fmt.Println("NPS服务重启失败", err)
|
||||
} else {
|
||||
fmt.Println("NPS服务重启成功")
|
||||
}
|
||||
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
inputCmd()
|
||||
}
|
||||
|
||||
func installNps() {
|
||||
|
||||
}
|
||||
|
||||
type nps struct {
|
||||
exit chan struct{}
|
||||
}
|
||||
@@ -232,6 +434,7 @@ func run() {
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
logs.Info("日志路径:" + *npsLogPath)
|
||||
logs.Info("the config path is:" + common.GetRunPath())
|
||||
logs.Info("the version of server is %s ,allow client core version to be %s,tls enable is %t", version.VERSION, version.GetVersion(), bridge.ServerTlsEnable)
|
||||
connection.InitConnectionService()
|
||||
@@ -245,3 +448,83 @@ func run() {
|
||||
}
|
||||
go server.StartNewServer(bridgePort, task, beego.AppConfig.String("bridge_type"), timeout)
|
||||
}
|
||||
|
||||
func initConfig(confDir string) {
|
||||
if !common.FileExists(confDir) {
|
||||
os.MkdirAll(confDir, 0755)
|
||||
}
|
||||
confPath := filepath.Join(confDir, "nps.conf")
|
||||
if !common.FileExists(confPath) {
|
||||
webPassword := crypt.GetRandomString(8)
|
||||
authKey := crypt.GetRandomString(8)
|
||||
authCryptKey := crypt.GetRandomString(16)
|
||||
content := strings.Replace(defaultNpsConf, "web_password=123", "web_password="+webPassword, 1)
|
||||
content = strings.Replace(content, "auth_key=123", "auth_key="+authKey, 1)
|
||||
content = strings.Replace(content, "auth_crypt_key =213", "auth_crypt_key ="+authCryptKey, 1)
|
||||
f, err := os.Create(confPath)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
defer f.Close()
|
||||
f.WriteString(content)
|
||||
logs.Info("Auto-generated default config file:", confPath)
|
||||
logs.Info("Web login username: admin, password:", webPassword)
|
||||
logs.Info("auth_key:", authKey)
|
||||
logs.Info("auth_crypt_key:", authCryptKey)
|
||||
}
|
||||
web.ExtractWebFiles(common.GetRunPath())
|
||||
}
|
||||
|
||||
const defaultNpsConf = `http_proxy_ip=0.0.0.0
|
||||
http_proxy_port=80
|
||||
https_proxy_port=443
|
||||
show_http_proxy_port=true
|
||||
|
||||
bridge_type=tcp
|
||||
bridge_port=8024
|
||||
bridge_ip=0.0.0.0
|
||||
|
||||
public_vkey=123
|
||||
|
||||
flow_store_interval=1
|
||||
|
||||
log_level=6
|
||||
log_path=nps.log
|
||||
|
||||
web_host=a.o.com
|
||||
web_username=admin
|
||||
web_password=123
|
||||
web_port = 8081
|
||||
web_ip=0.0.0.0
|
||||
web_base_url=
|
||||
web_open_ssl=false
|
||||
web_cert_file=conf/server.pem
|
||||
web_key_file=conf/server.key
|
||||
|
||||
auth_key=123
|
||||
auth_crypt_key =213
|
||||
|
||||
allow_user_login=true
|
||||
allow_user_register=false
|
||||
allow_user_change_username=true
|
||||
|
||||
allow_flow_limit=true
|
||||
allow_rate_limit=true
|
||||
allow_tunnel_num_limit=true
|
||||
allow_local_proxy=false
|
||||
allow_connection_num_limit=true
|
||||
allow_multi_ip=true
|
||||
system_info_display=true
|
||||
|
||||
http_add_origin_header=true
|
||||
|
||||
http_cache=false
|
||||
http_cache_length=100
|
||||
|
||||
disconnect_timeout=60
|
||||
|
||||
open_captcha=false
|
||||
|
||||
tls_enable=true
|
||||
tls_bridge_port=8025
|
||||
`
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
{"Cnf":{"U":"","P":"","Compress":false,"Crypt":false},"Id":34,"VerifyKey":"a1efa114df","Addr":"127.0.0.1","Remark":"","Status":true,"IsConnect":false,"RateLimit":0,"Flow":{"ExportFlow":0,"InletFlow":0,"FlowLimit":0},"Rate":{"NowRate":0},"NoStore":false,"NoDisplay":false,"MaxConn":0,"NowConn":0,"WebUserName":"","WebPassword":"","ConfigConnAllow":true,"MaxTunnelNum":0,"Version":"0.26.20","BlackIpList":[""],"CreateTime":"2025-01-03 17:07:37","LastOnlineTime":"2025-01-07 11:12:00"}
|
||||
*#*
|
||||
@@ -0,0 +1 @@
|
||||
{"BlackIpList":[],"ServerUrl":""}
|
||||
+5
-12
@@ -1,16 +1,9 @@
|
||||
appname = nps
|
||||
#Boot mode(dev|pro)
|
||||
runmode = dev
|
||||
|
||||
#HTTP(S) proxy port, no startup if empty
|
||||
http_proxy_ip=0.0.0.0
|
||||
http_proxy_port=80
|
||||
https_proxy_port=443
|
||||
https_just_proxy=true
|
||||
#default https certificate setting
|
||||
https_default_cert_file=conf/server.pem
|
||||
https_default_key_file=conf/server.key
|
||||
|
||||
# 是否展示非【80】端口
|
||||
show_http_proxy_port=true
|
||||
##bridge
|
||||
bridge_type=tcp
|
||||
bridge_port=8024
|
||||
@@ -58,9 +51,9 @@ auth_crypt_key =213
|
||||
#allow_ports=9001-9009,10001,11000-12000
|
||||
|
||||
#Web management multi-user login
|
||||
allow_user_login=false
|
||||
allow_user_login=true
|
||||
allow_user_register=false
|
||||
allow_user_change_username=false
|
||||
allow_user_change_username=true
|
||||
|
||||
#extension
|
||||
#流量限制
|
||||
@@ -99,4 +92,4 @@ open_captcha=false
|
||||
|
||||
# 是否开启tls
|
||||
tls_enable=true
|
||||
tls_bridge_port=8025
|
||||
tls_bridge_port=8025
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
-----BEGIN RSA PRIVATE KEY-----
|
||||
MIIEpAIBAAKCAQEA2MVLOHvgU8FCp6LgQrPfaWcGygrsRk7TL9hbT8MxbCRUSLV7
|
||||
Lbt3q5Knz8eTN4NWmwE6L5glOcH2x3Hnn+hPjbvgq35XBBIccAm0cYYKqoKkikeK
|
||||
FZM0Gp/WhSrhJ4laTyQqyleIFKpwD9kHDiC/sxjGDhSFmHKhhAnsQIRm2tppFXX0
|
||||
aAMqJEm88jzk1BN2QtKjEAn1u8v1+QW1KP3WuzdXH4L7hhMll66/KIm6Hfs2FRHQ
|
||||
pRUWqZeJY4q79NW5p5f+siGwOsGpxb/p11pM+0xnCH3UIFbm3zCTzP4sLvkfFGAe
|
||||
yAHsAwmaP8dJxh40ej3NN8uNiNvt8nw2Vb/1LwIDAQABAoIBAD40x/RKoEKIyE8B
|
||||
D6g0pB1EQo+CePFoN3SYewO1uR4WgtVmtxWVoa7r5BpdZGLe3uCWhpMX7z7W6bGs
|
||||
f1LFQOckjkHIfMIfTGfecRjO5Yqu+Pbxtq+gUah+S/plJr3IzdC+SUVNvzBnBMeX
|
||||
eU3Vmg2UQ2nQ+9GWu8D/c/vDwxx0X8oQ2G8QaxX0tUurlSMNA3M7xySwEvhx54fO
|
||||
UrDF3Q4yF48eA4butxVLFWf3cnlY+nR8uYd2vKfmp689/8C6kkfoM9igB78e93sm
|
||||
uDM2eRLm4kU5WLl301T42n6AF7w8J0MhLLVOIeLs4l5gZPa3uKvYFmuHQao7e/5R
|
||||
U/jHKrECgYEA8alPXuxFSVOvdhIsSN//Frj9CdExVdYmaLkt/2LO4FMnOaWh1xh7
|
||||
5iCY1bJT8D9dhfbqRg3qW2oguZD8gu04R8fTRegQ89qmAIwsEYqVf9salR41lZU4
|
||||
Rc+5yc7O11WIe9Lzu+ONFBFkAh3UFMR4zVZ/JhKIG/P5Srm7SUdKW2cCgYEA5aHo
|
||||
x2LR+yKhjkrBzHG3Qrfy1PtlYHjOpYYAKHQcBFuiG08W3CK/vkYl+mhv0uyhT7mn
|
||||
q6NDqrpZPRnDlOoEqgRS1X/QWKN6Pgd4HNLIawvp0vK9jYXDPcAXFzVthXCIwFcn
|
||||
3a3m4cHiuLdRNOHkydiHQyTOF6eEneN07TDvwvkCgYEApzOd1u9igPmFzQuF2GYi
|
||||
+HXFnaU/nUQuDwcQ7EJRIKRn31raPxiRoQesty5LJU6yRp4wOYgnPliPi9Tk4TGA
|
||||
XynC4/tMv2vorzhMxVY9Wdke602bhYNZC/RNd3O/aP2lEQdD3Bv04I2nxE8fDb9i
|
||||
VbAjCRSJV83WDf2zt1+78sECgYEAzezjRiKdcZu9y0/I+WEk2cUCE/MaF2he0FsZ
|
||||
uy1cjp/qAJltQ5452xUnK6cKWNlxU4CHF0mC/hC8xCldliZCZoEYE3PaUBLSJdwm
|
||||
35o6tpxpZI3gZJCG5NJlIp/8BkVDrVC7ZHV17hAkFEf4n/bPaB8wNYtE8jt8luaK
|
||||
TcarzGkCgYBn2alN0RLN2PHDurraFZB6GuCvh/arEjSCY3SDFQPF10CVjTDV7sx3
|
||||
eqJkwJ81syTmfJwZIceWbOFGgsuSx37UrQAVlHZSvzeqEg9dA5HqSoOACyidJI7j
|
||||
RG2+HB+KpsIZjGgLrEM4i7VOpYUDRdaouIXngFq/t9HNT+MDck5/Lw==
|
||||
-----END RSA PRIVATE KEY-----
|
||||
@@ -1,22 +0,0 @@
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIDtTCCAp2gAwIBAgIJAPXRSiP0Fs7sMA0GCSqGSIb3DQEBBQUAMEUxCzAJBgNV
|
||||
BAYTAkFVMRMwEQYDVQQIEwpTb21lLVN0YXRlMSEwHwYDVQQKExhJbnRlcm5ldCBX
|
||||
aWRnaXRzIFB0eSBMdGQwHhcNMTcxMTA3MDg1MzQ2WhcNMjcxMTA1MDg1MzQ2WjBF
|
||||
MQswCQYDVQQGEwJBVTETMBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50
|
||||
ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB
|
||||
CgKCAQEA2MVLOHvgU8FCp6LgQrPfaWcGygrsRk7TL9hbT8MxbCRUSLV7Lbt3q5Kn
|
||||
z8eTN4NWmwE6L5glOcH2x3Hnn+hPjbvgq35XBBIccAm0cYYKqoKkikeKFZM0Gp/W
|
||||
hSrhJ4laTyQqyleIFKpwD9kHDiC/sxjGDhSFmHKhhAnsQIRm2tppFXX0aAMqJEm8
|
||||
8jzk1BN2QtKjEAn1u8v1+QW1KP3WuzdXH4L7hhMll66/KIm6Hfs2FRHQpRUWqZeJ
|
||||
Y4q79NW5p5f+siGwOsGpxb/p11pM+0xnCH3UIFbm3zCTzP4sLvkfFGAeyAHsAwma
|
||||
P8dJxh40ej3NN8uNiNvt8nw2Vb/1LwIDAQABo4GnMIGkMB0GA1UdDgQWBBQdPc0R
|
||||
a8alY6Ab7voidkTGaH4PxzB1BgNVHSMEbjBsgBQdPc0Ra8alY6Ab7voidkTGaH4P
|
||||
x6FJpEcwRTELMAkGA1UEBhMCQVUxEzARBgNVBAgTClNvbWUtU3RhdGUxITAfBgNV
|
||||
BAoTGEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZIIJAPXRSiP0Fs7sMAwGA1UdEwQF
|
||||
MAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAH1IZNkjuvt2nZPzXsuiVNyCE1vm346z
|
||||
naE0Uzt3aseAN9m/iiB8mLz+ryvWc2aFMX5lTdsHdm2rqmqBCBXeRwTLf4OeHIju
|
||||
ZQW6makWt6PxANEo6gbdPbQXbS420ssUhnR2irIH1SdI31iikVFPdiS0baRRE/gS
|
||||
+440M1jOOOnKm0Qin92ejsshmji/0qaD2+6D5TNw4HmIZaFTBw+kfjxCL6trfeBn
|
||||
4fT0RJ121V3G3+AtG5sWQ93B3pCg+jtD+fGKkNSLhphq84bD1Zv7l73QGOoylkEn
|
||||
Sc0ajTLOXFBb83yRdlgV3Da95jH9rDZ4jSod48m+KemoZTDQw0vSwAU=
|
||||
-----END CERTIFICATE-----
|
||||
@@ -45,6 +45,7 @@ POST /client/add/
|
||||
| flow\_limit | 流量限制 单位M 空则为不限制 |
|
||||
| max\_conn | 客户端最大连接数量 空则为不限制 |
|
||||
| max\_tunnel | 客户端最大隧道数量 空则为不限制 |
|
||||
| expire\_time | 到期时间,留空表示永不过期,到期后自动暂停。支持格式:`2006-01-02 15:04:05`、`2006-01-02 15:04`、`2006-01-02T15:04:05`、`2006-01-02T15:04`、`2006-01-02` |
|
||||
|
||||
***
|
||||
修改客户端
|
||||
@@ -67,6 +68,7 @@ POST /client/edit/
|
||||
| flow\_limit | 流量限制 单位M 空则为不限制 |
|
||||
| max\_conn | 客户端最大连接数量 空则为不限制 |
|
||||
| max\_tunnel | 客户端最大隧道数量 空则为不限制 |
|
||||
| expire\_time | 到期时间,留空表示永不过期,到期后自动暂停。格式同新增接口 |
|
||||
| id | 要修改的客户端id |
|
||||
|
||||
***
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
module ehang.io/nps
|
||||
|
||||
go 1.22
|
||||
go 1.24.0
|
||||
|
||||
toolchain go1.24.9
|
||||
|
||||
require (
|
||||
fyne.io/fyne/v2 v2.0.2
|
||||
fyne.io/fyne/v2 v2.2.0
|
||||
github.com/astaxie/beego v1.12.0
|
||||
github.com/c4milo/unpackit v0.0.0-20170704181138-4ed373e9ef1c
|
||||
github.com/ccding/go-stun v0.0.0-20180726100737-be486d185f3d
|
||||
@@ -17,21 +19,27 @@ require (
|
||||
github.com/shirou/gopsutil/v3 v3.23.10
|
||||
github.com/xtaci/kcp-go v5.4.20+incompatible
|
||||
golang.org/x/net v0.23.0
|
||||
golang.org/x/time v0.14.0
|
||||
)
|
||||
|
||||
require (
|
||||
fyne.io/systray v1.9.1-0.20220523202515-bb6f1d955cff // indirect
|
||||
github.com/bradfitz/iter v0.0.0-20191230175014-e8f45d346db8 // indirect
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/dsnet/compress v0.0.1 // indirect
|
||||
github.com/fredbi/uri v0.0.0-20181227131451-3dcfdacbaaf3 // indirect
|
||||
github.com/fsnotify/fsnotify v1.4.9 // indirect
|
||||
github.com/fyne-io/mobile v0.1.3-0.20210318200029-09e9c4e13a8f // indirect
|
||||
github.com/go-gl/gl v0.0.0-20190320180904-bf2b1f2f34d7 // indirect
|
||||
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20210311203641-62640a716d48 // indirect
|
||||
github.com/fsnotify/fsnotify v1.5.4 // indirect
|
||||
github.com/fyne-io/gl-js v0.0.0-20220119005834-d2da28d9ccfe // indirect
|
||||
github.com/fyne-io/glfw-js v0.0.0-20220120001248-ee7290d23504 // indirect
|
||||
github.com/fyne-io/image v0.0.0-20220602074514-4956b0afb3d2 // indirect
|
||||
github.com/go-gl/gl v0.0.0-20211210172815-726fda9656d6 // indirect
|
||||
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20211213063430-748e38ca8aec // indirect
|
||||
github.com/go-ole/go-ole v1.2.6 // indirect
|
||||
github.com/godbus/dbus/v5 v5.0.3 // indirect
|
||||
github.com/godbus/dbus/v5 v5.1.0 // indirect
|
||||
github.com/goki/freetype v0.0.0-20181231101311-fa8a33aabaff // indirect
|
||||
github.com/gopherjs/gopherjs v1.17.2 // indirect
|
||||
github.com/hooklift/assert v0.0.0-20170704181755-9d1defd6d214 // indirect
|
||||
github.com/jsummers/gobmp v0.0.0-20151104160322-e2ba15ffa76e // indirect
|
||||
github.com/klauspost/compress v1.4.1 // indirect
|
||||
github.com/klauspost/cpuid v1.3.1 // indirect
|
||||
github.com/klauspost/cpuid/v2 v2.0.6 // indirect
|
||||
@@ -54,13 +62,16 @@ require (
|
||||
github.com/tklauser/numcpus v0.6.1 // indirect
|
||||
github.com/ulikunitz/xz v0.5.6 // indirect
|
||||
github.com/xtaci/lossyconn v0.0.0-20190602105132-8df528c0c9ae // indirect
|
||||
github.com/yuin/goldmark v1.4.0 // indirect
|
||||
github.com/yusufpapurcu/wmi v1.2.3 // indirect
|
||||
golang.org/x/crypto v0.21.0 // indirect
|
||||
golang.org/x/image v0.0.0-20200430140353-33d19683fad8 // indirect
|
||||
golang.org/x/image v0.0.0-20220601225756-64ec528b34cd // indirect
|
||||
golang.org/x/mobile v0.0.0-20211207041440-4e6c2922fdee // indirect
|
||||
golang.org/x/sys v0.25.0 // indirect
|
||||
golang.org/x/text v0.14.0 // indirect
|
||||
gopkg.in/yaml.v2 v2.2.8 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
honnef.co/go/js/dom v0.0.0-20210725211120-f030747120f2 // indirect
|
||||
)
|
||||
|
||||
replace github.com/astaxie/beego => github.com/exfly/beego v1.12.0-export-init
|
||||
|
||||
@@ -1,13 +1,60 @@
|
||||
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||
fyne.io/fyne/v2 v2.0.2 h1:6pDvFuCmL1odyT/fPI+2L54hMJW1Zt9Dno41HmLInRs=
|
||||
fyne.io/fyne/v2 v2.0.2/go.mod h1:3+FYmLJVgeb8EvTPJ5YzZeo7LkAq4bbuY3Zrir6xHbg=
|
||||
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||
cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU=
|
||||
cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU=
|
||||
cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY=
|
||||
cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc=
|
||||
cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0=
|
||||
cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To=
|
||||
cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4=
|
||||
cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M=
|
||||
cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc=
|
||||
cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk=
|
||||
cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs=
|
||||
cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc=
|
||||
cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY=
|
||||
cloud.google.com/go v0.72.0/go.mod h1:M+5Vjvlc2wnp6tjzE102Dw08nGShTscUx2nZMufOKPI=
|
||||
cloud.google.com/go v0.74.0/go.mod h1:VV1xSbzvo+9QJOxLDaJfTjx5e+MePCpCWwvftOeQmWk=
|
||||
cloud.google.com/go v0.78.0/go.mod h1:QjdrLG0uq+YwhjoVOLsS1t7TW8fs36kLs4XO5R5ECHg=
|
||||
cloud.google.com/go v0.79.0/go.mod h1:3bzgcEeQlzbuEAYu4mrWhKqWjmpprinYgKJLgKHnbb8=
|
||||
cloud.google.com/go v0.81.0/go.mod h1:mk/AM35KwGk/Nm2YSeZbxXdrNK3KZOYHmLkOqC2V6E0=
|
||||
cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o=
|
||||
cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE=
|
||||
cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc=
|
||||
cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg=
|
||||
cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc=
|
||||
cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ=
|
||||
cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE=
|
||||
cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk=
|
||||
cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk=
|
||||
cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I=
|
||||
cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw=
|
||||
cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA=
|
||||
cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU=
|
||||
cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw=
|
||||
cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos=
|
||||
cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk=
|
||||
cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs=
|
||||
cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0=
|
||||
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
|
||||
fyne.io/fyne/v2 v2.2.0 h1:7LoUyChpADjki8mxcb5Xm/ykZdBX9PHAKeymAkthEtk=
|
||||
fyne.io/fyne/v2 v2.2.0/go.mod h1:Jl/dcptOV4NZWSK1PlxDbO+jFeQBHzUqDUUsKiP0EQ0=
|
||||
fyne.io/systray v1.9.1-0.20220523202515-bb6f1d955cff h1:l439vjQ+tyWm9c8NRFtJ6W3EcNzvcaU5A70xd+7PItM=
|
||||
fyne.io/systray v1.9.1-0.20220523202515-bb6f1d955cff/go.mod h1:N4ZU0i34X+n8soFRlBNkmJTunw9wD+9jIP19fSZpjSI=
|
||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||
github.com/BurntSushi/toml v1.1.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
|
||||
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
|
||||
github.com/Knetic/govaluate v3.0.0+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0=
|
||||
github.com/Kodeworks/golang-image-ico v0.0.0-20141118225523-73f0f4cfade9/go.mod h1:7uhhqiBaR4CpN0k9rMjOtjpcfGd6DG2m04zQxKnWQ0I=
|
||||
github.com/OwnLocal/goes v1.0.0/go.mod h1:8rIFjBGTue3lCU0wplczcUgt9Gxgrkkrw7etMIcn8TM=
|
||||
github.com/akavel/rsrc v0.8.0/go.mod h1:uLoCtb9J+EyAqh+26kdrTgmzRBFPGOolLWKpdxkKq+c=
|
||||
github.com/akavel/rsrc v0.10.2/go.mod h1:uLoCtb9J+EyAqh+26kdrTgmzRBFPGOolLWKpdxkKq+c=
|
||||
github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
|
||||
github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o=
|
||||
github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY=
|
||||
github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
|
||||
github.com/beego/goyaml2 v0.0.0-20130207012346-5545475820dd/go.mod h1:1b+Y/CofkYwXMUU0OhQqGvsY2Bvgr4j6jfT699wyZKQ=
|
||||
github.com/beego/x2j v0.0.0-20131220205130-a0352aadc542/go.mod h1:kSeGC/p1AbBiEp5kat81+DSQrZenVBZXklMLaELspWU=
|
||||
github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
|
||||
github.com/bketelsen/crypt v0.0.4/go.mod h1:aI6NrJ0pMGgvZKL1iVgXLnfIFJtfV+bKCoqOes/6LfM=
|
||||
github.com/bradfitz/gomemcache v0.0.0-20180710155616-bc664df96737/go.mod h1:PmM6Mmwb0LSuEubjR8N7PtNe1KxZLtOUHtbeikc5h60=
|
||||
github.com/bradfitz/iter v0.0.0-20191230175014-e8f45d346db8 h1:GKTyiRCL6zVf5wWaqKnf+7Qs6GbEPfd4iMOitWzXJx8=
|
||||
github.com/bradfitz/iter v0.0.0-20191230175014-e8f45d346db8/go.mod h1:spo1JLcs67NmW1aVLEgtA8Yy1elc+X8y5SRW1sFW4Og=
|
||||
@@ -17,12 +64,21 @@ github.com/casbin/casbin v1.7.0/go.mod h1:c67qKN6Oum3UF5Q1+BByfFxkwKvhwW57ITjqwt
|
||||
github.com/ccding/go-stun v0.0.0-20180726100737-be486d185f3d h1:As4937T5NVbJ/DmZT9z33pyLEprMd6CUSfhbmMY57Io=
|
||||
github.com/ccding/go-stun v0.0.0-20180726100737-be486d185f3d/go.mod h1:3FK1bMar37f7jqVY7q/63k3OMX1c47pGCufzt3X0sYE=
|
||||
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
||||
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
|
||||
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
|
||||
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
|
||||
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
|
||||
github.com/cloudflare/golz4 v0.0.0-20150217214814-ef862a3cdc58/go.mod h1:EOBUe0h4xcZ5GoxqC5SDxFQ8gwyZPKQoEzownBlhI80=
|
||||
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
|
||||
github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
|
||||
github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
|
||||
github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
|
||||
github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
|
||||
github.com/couchbase/go-couchbase v0.0.0-20181122212707-3e9b6e1258bb/go.mod h1:TWI8EKQMs5u5jLKW/tsb9VwauIrMIxQG1r5fMsswK5U=
|
||||
github.com/couchbase/gomemcached v0.0.0-20181122193126-5125a94a666c/go.mod h1:srVSlQLB8iXBVXHgnqemxUXqN6FCvClgCMPCsjBDR7c=
|
||||
github.com/couchbase/goutils v0.0.0-20180530154633-e865a1461c8a/go.mod h1:BQwMFlJzDjFDG3DJUdU0KORxn88UlsOULuxLExMh3Hs=
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.1/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
|
||||
github.com/cupcake/rdb v0.0.0-20161107195141-43ba34106c76/go.mod h1:vYwsqCOLxGiisLwp9rITslkFNpZD5rz43tf41QFkTWY=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
@@ -34,62 +90,162 @@ github.com/edsrzf/mmap-go v0.0.0-20170320065105-0bce6a688712/go.mod h1:YO35OhQPt
|
||||
github.com/elazarl/go-bindata-assetfs v1.0.0 h1:G/bYguwHIzWq9ZoyUQqrjTmJbbYn3j3CKKpKinvZLFk=
|
||||
github.com/elazarl/go-bindata-assetfs v1.0.0/go.mod h1:v+YaWX3bdea5J/mo8dSETolEo7R71Vk1u8bnjau5yw4=
|
||||
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
||||
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
||||
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
|
||||
github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po=
|
||||
github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk=
|
||||
github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk=
|
||||
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
|
||||
github.com/exfly/beego v1.12.0-export-init h1:VQNYKdXhAwZGUaFmQv8Aj921O3rQJZRIF8xeGrhsjrI=
|
||||
github.com/exfly/beego v1.12.0-export-init/go.mod h1:fysx+LZNZKnvh4GED/xND7jWtjCR6HzydR2Hh2Im57o=
|
||||
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
|
||||
github.com/fatih/color v1.18.0 h1:S8gINlzdQ840/4pfAwic/ZE0djQEH3wM94VfqLTZcOM=
|
||||
github.com/fatih/color v1.18.0/go.mod h1:4FelSpRwEGDpQ12mAdzqdOukCy4u8WUtOY6lkT/6HfU=
|
||||
github.com/fredbi/uri v0.0.0-20181227131451-3dcfdacbaaf3 h1:FDqhDm7pcsLhhWl1QtD8vlzI4mm59llRvNzrFg6/LAA=
|
||||
github.com/fredbi/uri v0.0.0-20181227131451-3dcfdacbaaf3/go.mod h1:CzM2G82Q9BDUvMTGHnXf/6OExw/Dz2ivDj48nVg7Lg8=
|
||||
github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4=
|
||||
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
|
||||
github.com/fyne-io/mobile v0.1.3-0.20210318200029-09e9c4e13a8f h1:rguJ/t99j/6zRSFzsBKlsmmyl+vOvCeTJ+2uTBvuXFI=
|
||||
github.com/fyne-io/mobile v0.1.3-0.20210318200029-09e9c4e13a8f/go.mod h1:/kOrWrZB6sasLbEy2JIvr4arEzQTXBTZGb3Y96yWbHY=
|
||||
github.com/go-gl/gl v0.0.0-20190320180904-bf2b1f2f34d7 h1:SCYMcCJ89LjRGwEa0tRluNRiMjZHalQZrVrvTbPh+qw=
|
||||
github.com/go-gl/gl v0.0.0-20190320180904-bf2b1f2f34d7/go.mod h1:482civXOzJJCPzJ4ZOX/pwvXBWSnzD4OKMdH4ClKGbk=
|
||||
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20210311203641-62640a716d48 h1:QrUfZrT8n72FUuiABt4tbu8PwDnOPAbnj3Mql1UhdRI=
|
||||
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20210311203641-62640a716d48/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
|
||||
github.com/fsnotify/fsnotify v1.5.4 h1:jRbGcIw6P2Meqdwuo0H1p6JVLbL5DHKAKlYndzMwVZI=
|
||||
github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU=
|
||||
github.com/fyne-io/gl-js v0.0.0-20220119005834-d2da28d9ccfe h1:A/wiwvQ0CAjPkuJytaD+SsXkPU0asQ+guQEIg1BJGX4=
|
||||
github.com/fyne-io/gl-js v0.0.0-20220119005834-d2da28d9ccfe/go.mod h1:d4clgH0/GrRwWjRzJJQXxT/h1TyuNSfF/X64zb/3Ggg=
|
||||
github.com/fyne-io/glfw-js v0.0.0-20220120001248-ee7290d23504 h1:+31CdF/okdokeFNoy9L/2PccG3JFidQT3ev64/r4pYU=
|
||||
github.com/fyne-io/glfw-js v0.0.0-20220120001248-ee7290d23504/go.mod h1:gLRWYfYnMA9TONeppRSikMdXlHQ97xVsPojddUv3b/E=
|
||||
github.com/fyne-io/image v0.0.0-20220602074514-4956b0afb3d2 h1:hnLq+55b7Zh7/2IRzWCpiTcAvjv/P8ERF+N7+xXbZhk=
|
||||
github.com/fyne-io/image v0.0.0-20220602074514-4956b0afb3d2/go.mod h1:eO7W361vmlPOrykIg+Rsh1SZ3tQBaOsfzZhsIOb/Lm0=
|
||||
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
|
||||
github.com/go-gl/gl v0.0.0-20211210172815-726fda9656d6 h1:zDw5v7qm4yH7N8C8uWd+8Ii9rROdgWxQuGoJ9WDXxfk=
|
||||
github.com/go-gl/gl v0.0.0-20211210172815-726fda9656d6/go.mod h1:9YTyiznxEY1fVinfM7RvRcjRHbw2xLBJ3AAGIT0I4Nw=
|
||||
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
|
||||
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
|
||||
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
|
||||
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20211213063430-748e38ca8aec h1:3FLiRYO6PlQFDpUU7OEFlWgjGD1jnBIVSJ5SYRWk+9c=
|
||||
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20211213063430-748e38ca8aec/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
|
||||
github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY=
|
||||
github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
|
||||
github.com/go-redis/redis v6.14.2+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA=
|
||||
github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w=
|
||||
github.com/godbus/dbus/v5 v5.0.3 h1:ZqHaoEF7TBzh4jzPmqVhE/5A1z9of6orkAe5uHoAeME=
|
||||
github.com/godbus/dbus/v5 v5.0.3/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
|
||||
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
|
||||
github.com/godbus/dbus/v5 v5.1.0 h1:4KLkAxT3aOY8Li4FRJe/KvhoNFFxo0m6fNuFUO8QJUk=
|
||||
github.com/godbus/dbus/v5 v5.1.0/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
|
||||
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
|
||||
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
|
||||
github.com/goki/freetype v0.0.0-20181231101311-fa8a33aabaff h1:W71vTCKoxtdXgnm1ECDFkfQnpdqAO00zzGXLA5yaEX8=
|
||||
github.com/goki/freetype v0.0.0-20181231101311-fa8a33aabaff/go.mod h1:wfqRWLHRBsRgkp5dmbG56SA0DmVtwrF5N3oPdI8t+Aw=
|
||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
|
||||
github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
||||
github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
||||
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
||||
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
|
||||
github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
|
||||
github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y=
|
||||
github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw=
|
||||
github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw=
|
||||
github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw=
|
||||
github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4=
|
||||
github.com/golang/mock v1.5.0/go.mod h1:CWnOUgYIOo4TcNZ0wHX3YZCqsaM1I1Jvs6v3mP3KVu8=
|
||||
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
|
||||
github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
|
||||
github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk=
|
||||
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
|
||||
github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
|
||||
github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
|
||||
github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
|
||||
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
|
||||
github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8=
|
||||
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
|
||||
github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
|
||||
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
|
||||
github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM=
|
||||
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
|
||||
github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
||||
github.com/golang/snappy v0.0.3 h1:fHPg5GQYlCeLIPB9BZqMVR5nR9A+IM5zcgeTdjMYmLA=
|
||||
github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
||||
github.com/gomodule/redigo v2.0.0+incompatible/go.mod h1:B4C85qUVwatsJoIUNIfCRsp7qO0iAmpGFZ4EELWSbC4=
|
||||
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
|
||||
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
|
||||
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
|
||||
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
|
||||
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
|
||||
github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0=
|
||||
github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0=
|
||||
github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
|
||||
github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
|
||||
github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
|
||||
github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
|
||||
github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
|
||||
github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
|
||||
github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
|
||||
github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
|
||||
github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
|
||||
github.com/google/pprof v0.0.0-20210122040257-d980be63207e/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
|
||||
github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
|
||||
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
|
||||
github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
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/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
|
||||
github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk=
|
||||
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
|
||||
github.com/gopherjs/gopherjs v0.0.0-20211219123610-ec9572f70e60/go.mod h1:cz9oNYuRUWGdHmLF2IodMLkAhcPtXeULvcBNagUrxTI=
|
||||
github.com/gopherjs/gopherjs v1.17.2 h1:fQnZVsXk8uxXIStYb0N4bGk7jeyTalG/wsZjQ25dO0g=
|
||||
github.com/gopherjs/gopherjs v1.17.2/go.mod h1:pRRIvn/QzFLrKfvEz3qUuEhtE/zLCWfreZ6J5gM2i+k=
|
||||
github.com/goxjs/gl v0.0.0-20210104184919-e3fafc6f8f2a/go.mod h1:dy/f2gjY09hwVfIyATps4G2ai7/hLwLkc5TrPqONuXY=
|
||||
github.com/goxjs/glfw v0.0.0-20191126052801-d2efb5f20838/go.mod h1:oS8P8gVOT4ywTcjV6wZlOU4GuVFQ8F5328KY3MJ79CY=
|
||||
github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw=
|
||||
github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q=
|
||||
github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8=
|
||||
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
|
||||
github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
|
||||
github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
|
||||
github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM=
|
||||
github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk=
|
||||
github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU=
|
||||
github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU=
|
||||
github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4=
|
||||
github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
|
||||
github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
|
||||
github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90=
|
||||
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
|
||||
github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
|
||||
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
|
||||
github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64=
|
||||
github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ=
|
||||
github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I=
|
||||
github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc=
|
||||
github.com/hooklift/assert v0.0.0-20170704181755-9d1defd6d214 h1:WgfvpuKg42WVLkxNwzfFraXkTXPK36bMqXvMFN67clI=
|
||||
github.com/hooklift/assert v0.0.0-20170704181755-9d1defd6d214/go.mod h1:kj6hFWqfwSjFjLnYW5PK1DoxZ4O0uapwHRmd9jhln4E=
|
||||
github.com/jackmordaunt/icns v0.0.0-20181231085925-4f16af745526/go.mod h1:UQkeMHVoNcyXYq9otUupF7/h/2tmHlhrS2zw7ZVvUqc=
|
||||
github.com/josephspurrier/goversioninfo v0.0.0-20200309025242-14b0ab84c6ca/go.mod h1:eJTEwMjXb7kZ633hO3Ln9mBUCOjX2+FlTljvpl9SYdE=
|
||||
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
|
||||
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
|
||||
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
|
||||
github.com/jackmordaunt/icns/v2 v2.2.1/go.mod h1:6aYIB9eSzyfHHMKqDf17Xrs1zetQPReAkiUSHzdw4cI=
|
||||
github.com/josephspurrier/goversioninfo v1.4.0/go.mod h1:JWzv5rKQr+MmW+LvM412ToT/IkYDZjaclF2pKDss8IY=
|
||||
github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
||||
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
|
||||
github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk=
|
||||
github.com/jsummers/gobmp v0.0.0-20151104160322-e2ba15ffa76e h1:LvL4XsI70QxOGHed6yhQtAU34Kx3Qq2wwBzGFKY8zKk=
|
||||
github.com/jsummers/gobmp v0.0.0-20151104160322-e2ba15ffa76e/go.mod h1:kLgvv7o6UM+0QSf0QjAse3wReFDsb9qbZJdfexWlrQw=
|
||||
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
|
||||
github.com/kardianos/service v1.2.0 h1:bGuZ/epo3vrt8IPC7mnKQolqFeYJb7Cs8Rk4PSOBB/g=
|
||||
github.com/kardianos/service v1.2.0/go.mod h1:CIMRFEJVL+0DS1a3Nx06NaMn4Dz63Ng6O7dl0qH0zVM=
|
||||
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
|
||||
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
|
||||
github.com/klauspost/compress v1.4.1 h1:8VMb5+0wMgdBykOV96DwNwKFQ+WTI4pzYURP99CcB9E=
|
||||
github.com/klauspost/compress v1.4.1/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A=
|
||||
github.com/klauspost/cpuid v1.2.0/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek=
|
||||
@@ -102,35 +258,66 @@ github.com/klauspost/pgzip v1.2.1 h1:oIPZROsWuPHpOdMVWLuJZXwgjhrW8r1yEX8UqMyeNHM
|
||||
github.com/klauspost/pgzip v1.2.1/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs=
|
||||
github.com/klauspost/reedsolomon v1.9.12 h1:EyOucRmcrLH+2hqKGdoA5SM8pwPKR6BJsf3r6zpYOA0=
|
||||
github.com/klauspost/reedsolomon v1.9.12/go.mod h1:nLvuzNvy1ZDNQW30IuMc2ZWCbiqrJgdLoUS2X8HAUVg=
|
||||
github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg=
|
||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
|
||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||
github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
|
||||
github.com/lucor/goinfo v0.0.0-20200401173949-526b5363a13a/go.mod h1:ORP3/rB5IsulLEBwQZCJyyV6niqmI7P4EWSmkug+1Ng=
|
||||
github.com/lucor/goinfo v0.0.0-20210802170112-c078a2b0f08b/go.mod h1:PRq09yoB+Q2OJReAmwzKivcYyremnibWGbK7WfftHzc=
|
||||
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 h1:6E+4a0GO5zZEnZ81pIr0yLvtUWk2if982qA3F3QD6H4=
|
||||
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I=
|
||||
github.com/magiconair/properties v1.8.5/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60=
|
||||
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
|
||||
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
|
||||
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
|
||||
github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
|
||||
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
|
||||
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-sqlite3 v1.10.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
|
||||
github.com/mcuadros/go-version v0.0.0-20190830083331-035f6764e8d2/go.mod h1:76rfSfYPWj01Z85hUf/ituArm797mNKcvINh1OlsZKo=
|
||||
github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
|
||||
github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc=
|
||||
github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
|
||||
github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI=
|
||||
github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg=
|
||||
github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY=
|
||||
github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
|
||||
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
|
||||
github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
|
||||
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
||||
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
||||
github.com/neelance/astrewrite v0.0.0-20160511093645-99348263ae86/go.mod h1:kHJEU3ofeGjhHklVoIGuVj85JJwZ6kWPaJwCIxgnFmo=
|
||||
github.com/neelance/sourcemap v0.0.0-20200213170602-2833bce08e4c/go.mod h1:Qr6/a/Q4r9LP1IltGz7tA7iOK1WonHEYhu1HRBA7ZiM=
|
||||
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646/go.mod h1:jpp1/29i3P1S/RLdc7JQKbRpFeM1dOBd8T9ki5s+AY8=
|
||||
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs=
|
||||
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
|
||||
github.com/panjf2000/ants/v2 v2.4.2 h1:kesjjo8JipN3vNNg1XaiXaeSs6xJweBTgenkBtsrHf8=
|
||||
github.com/panjf2000/ants/v2 v2.4.2/go.mod h1:f6F0NZVFsGCp5A7QW/Zj/m92atWwOkY0OIhFxRNFr4A=
|
||||
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
|
||||
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
|
||||
github.com/pelletier/go-toml v1.9.3/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c=
|
||||
github.com/pires/go-proxyproto v0.8.0 h1:5unRmEAPbHXHuLjDg01CxJWf91cw3lKHc/0xzKpXEe0=
|
||||
github.com/pires/go-proxyproto v0.8.0/go.mod h1:iknsfgnH8EkjrMeMyvfKByp9TiBZCKZM0jx2xmKqnVY=
|
||||
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
||||
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI=
|
||||
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c h1:ncq/mPwQF4JjgDlrVEn3C11VoGHZN7m8qihwgMEtzYw=
|
||||
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE=
|
||||
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
||||
github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
|
||||
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
|
||||
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||
github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
|
||||
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=
|
||||
github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644 h1:X+yvsM2yrEktyI+b2qND5gpH8YhURn0k8OCaeRnkINo=
|
||||
github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644/go.mod h1:nkxAfR/5quYxwPZhyDxgasBMnRtBZd0FCEpawpjMUFg=
|
||||
github.com/shirou/gopsutil/v3 v3.23.10 h1:/N42opWlYzegYaVkWejXWJpbzKv2JDy3mrgGzKsh9hM=
|
||||
@@ -139,11 +326,22 @@ github.com/shoenig/go-m1cpu v0.1.6 h1:nxdKQNcEB6vzgA2E2bvzKIYRuNj7XNJ4S/aRSwKzFt
|
||||
github.com/shoenig/go-m1cpu v0.1.6/go.mod h1:1JJMcUBvfNwpq05QDQVAnx3gUHr9IYF7GNg9SUEw2VQ=
|
||||
github.com/shoenig/test v0.6.4 h1:kVTaSd7WLz5WZ2IaoM0RSzRsUD+m8wRR+5qvntpn4LU=
|
||||
github.com/shoenig/test v0.6.4/go.mod h1:byHiCGXqrVaflBLAMq/srcZIHynQPQgeyvkvXnjqq0k=
|
||||
github.com/shurcooL/go v0.0.0-20200502201357-93f07166e636/go.mod h1:TDJrrUr11Vxrven61rcy3hJMUqaf/CLWYhHNPmT14Lk=
|
||||
github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749/go.mod h1:ZY1cvUeJuFPAdZ/B6v7RHavJWZn2YPVFQ1OSXhCGOkg=
|
||||
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
|
||||
github.com/shurcooL/vfsgen v0.0.0-20200824052919-0d455de96546/go.mod h1:TrYk7fJVaAttu97ZZKrO9UbRa8izdowaMIZcxYMbVaw=
|
||||
github.com/siddontang/go v0.0.0-20180604090527-bdc77568d726/go.mod h1:3yhqj7WBBfRhbBlzyOC3gUxftwsU0u8gqevxwIHQpMw=
|
||||
github.com/siddontang/ledisdb v0.0.0-20181029004158-becf5f38d373/go.mod h1:mF1DpOSOUiJRMR+FDqaqu3EBqrybQtrDDszLUZ6oxPg=
|
||||
github.com/siddontang/rdb v0.0.0-20150307021120-fc89ed2e418d/go.mod h1:AMEsy7v5z92TR1JKMkLLoaOQk++LVnOKL3ScbJ8GNGA=
|
||||
github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ=
|
||||
github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
|
||||
github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
|
||||
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
|
||||
github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
|
||||
github.com/spf13/afero v1.6.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I=
|
||||
github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
|
||||
github.com/spf13/cobra v1.2.1/go.mod h1:ExllRjgxM/piMAM+3tAZvg8fsklGAf3tPfi+i8t68Nk=
|
||||
github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo=
|
||||
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||
github.com/spf13/viper v1.8.1/go.mod h1:o0Pch8wJ9BVSWGQMbra6iw0oQ5oktSIBaujf1rJH9Ns=
|
||||
github.com/srwiley/oksvg v0.0.0-20200311192757-870daf9aa564 h1:HunZiaEKNGVdhTRQOVpMmj5MQnGnv+e8uZNu3xFLgyM=
|
||||
github.com/srwiley/oksvg v0.0.0-20200311192757-870daf9aa564/go.mod h1:afMbS0qvv1m5tfENCwnOdZGOF8RGR/FsZ7bvBxQGZG4=
|
||||
github.com/srwiley/rasterx v0.0.0-20200120212402-85cb7272f5e9 h1:m59mIOBO4kfcNCEzJNy71UkeF4XIx2EVmL9KLwDQdmM=
|
||||
@@ -153,12 +351,16 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
|
||||
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/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
|
||||
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
|
||||
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||
github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw=
|
||||
github.com/syndtr/goleveldb v0.0.0-20181127023241-353a9fca669c/go.mod h1:Z4AUp2Km+PwemOoO/VB5AOx9XSsIItzFjoJlOSiYmn0=
|
||||
github.com/templexxx/cpufeat v0.0.0-20180724012125-cef66df7f161 h1:89CEmDvlq/F7SJEOqkIdNDGJXrQIhuIx9D2DBXjavSU=
|
||||
github.com/templexxx/cpufeat v0.0.0-20180724012125-cef66df7f161/go.mod h1:wM7WEvslTq+iOEAMDLSzhVuOt5BRZ05WirO+b09GHQU=
|
||||
@@ -172,56 +374,200 @@ github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+F
|
||||
github.com/tklauser/numcpus v0.6.1/go.mod h1:1XfjsgE2zo8GVw7POkMbHENHzVg3GzmoZ9fESEdAacY=
|
||||
github.com/ulikunitz/xz v0.5.6 h1:jGHAfXawEGZQ3blwU5wnWKQJvAraT7Ftq9EXjnXYgt8=
|
||||
github.com/ulikunitz/xz v0.5.6/go.mod h1:2bypXElzHzzJZwzH67Y6wb67pO62Rzfn7BSiF4ABRW8=
|
||||
github.com/urfave/cli/v2 v2.4.0/go.mod h1:NX9W0zmTvedE5oDoOMs2RTC8RvdK98NTYZE5LbaEYPg=
|
||||
github.com/wendal/errors v0.0.0-20130201093226-f66c77a7882b/go.mod h1:Q12BUT7DqIlHRmgv3RskH+UCM/4eqVMgI0EMmlSpAXc=
|
||||
github.com/xtaci/kcp-go v5.4.20+incompatible h1:TN1uey3Raw0sTz0Fg8GkfM0uH3YwzhnZWQ1bABv5xAg=
|
||||
github.com/xtaci/kcp-go v5.4.20+incompatible/go.mod h1:bN6vIwHQbfHaHtFpEssmWsN45a+AZwO7eyRCmEIbtvE=
|
||||
github.com/xtaci/lossyconn v0.0.0-20190602105132-8df528c0c9ae h1:J0GxkO96kL4WF+AIT3M4mfUVinOCPgf2uUWYFUzN0sM=
|
||||
github.com/xtaci/lossyconn v0.0.0-20190602105132-8df528c0c9ae/go.mod h1:gXtu8J62kEgmN++bm9BVICuT/e8yiLI2KFobd/TRFsE=
|
||||
github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
|
||||
github.com/yuin/goldmark v1.4.0 h1:OtISOGfH6sOWa1/qXqqAiOIAO6Z5J3AEAE18WAq6BiQ=
|
||||
github.com/yuin/goldmark v1.4.0/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
|
||||
github.com/yusufpapurcu/wmi v1.2.3 h1:E1ctvB7uKFMOJw3fdOW32DwGE9I7t++CRUEMKvFoFiw=
|
||||
github.com/yusufpapurcu/wmi v1.2.3/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0=
|
||||
go.etcd.io/etcd/api/v3 v3.5.0/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs=
|
||||
go.etcd.io/etcd/client/pkg/v3 v3.5.0/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g=
|
||||
go.etcd.io/etcd/client/v2 v2.305.0/go.mod h1:h9puh54ZTgAKtEbut2oe9P4L/oqKCVB6xsXlzd7alYQ=
|
||||
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
|
||||
go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=
|
||||
go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
|
||||
go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
|
||||
go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
|
||||
go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk=
|
||||
go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E=
|
||||
go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
|
||||
go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU=
|
||||
go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo=
|
||||
golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||
golang.org/x/crypto v0.0.0-20181127143415-eb0de9b17e85/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
golang.org/x/crypto v0.0.0-20201012173705-84dcc777aaee/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||
golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA=
|
||||
golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs=
|
||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
|
||||
golang.org/x/exp v0.0.0-20190731235908-ec7cb31e5a56/go.mod h1:JhuoJpWY28nO4Vef9tZUw9qufEGTyX1+7lmHxV5q5G4=
|
||||
golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek=
|
||||
golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY=
|
||||
golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
|
||||
golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
|
||||
golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
|
||||
golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM=
|
||||
golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU=
|
||||
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
|
||||
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
|
||||
golang.org/x/image v0.0.0-20200430140353-33d19683fad8 h1:6WW6V3x1P/jokJBpRQYUJnMHRP6isStQwCozxnU7XQw=
|
||||
golang.org/x/image v0.0.0-20200430140353-33d19683fad8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
|
||||
golang.org/x/image v0.0.0-20220601225756-64ec528b34cd h1:9NbNcTg//wfC5JskFW4Z3sqwVnjmJKHxLAol1bW2qgw=
|
||||
golang.org/x/image v0.0.0-20220601225756-64ec528b34cd/go.mod h1:doUCurBvlfPMKfmIpRIywoHmhN3VyhnoFDbvIEWF4hY=
|
||||
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
||||
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
|
||||
golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
||||
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
||||
golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
||||
golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
||||
golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
||||
golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs=
|
||||
golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
|
||||
golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
|
||||
golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
|
||||
golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
|
||||
golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE=
|
||||
golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o=
|
||||
golang.org/x/mobile v0.0.0-20211207041440-4e6c2922fdee h1:/tShaw8UTf0XzI8DOZwQHzC7d6Vi3EtrBnftiZ4vAvU=
|
||||
golang.org/x/mobile v0.0.0-20211207041440-4e6c2922fdee/go.mod h1:pe2sM7Uk+2Su1y7u/6Z8KJ24D7lepUjFZbhFOrmDfuQ=
|
||||
golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc=
|
||||
golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY=
|
||||
golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
|
||||
golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
|
||||
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
|
||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
||||
golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
||||
golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
||||
golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
||||
golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
||||
golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
|
||||
golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
|
||||
golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
|
||||
golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
||||
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
||||
golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
||||
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
||||
golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||
golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||
golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc=
|
||||
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
|
||||
golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||
golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs=
|
||||
golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg=
|
||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
|
||||
golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
|
||||
golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
|
||||
golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
|
||||
golang.org/x/oauth2 v0.0.0-20210220000619-9bb904979d93/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
|
||||
golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
|
||||
golang.org/x/oauth2 v0.0.0-20210402161424-2e8d93401602/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
|
||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200720211630-cb9d2d5c5666/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20201015000850-e3ed0017c211/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
@@ -229,46 +575,208 @@ golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34=
|
||||
golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
||||
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
|
||||
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
||||
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/time v0.14.0 h1:MRx4UaLrDotUKUdCIqzPC48t1Y9hANFKIRpNx+Te8PI=
|
||||
golang.org/x/time v0.14.0/go.mod h1:eL/Oa2bBBK0TkX57Fyni+NgnyQQN4LitPmob2Hjnqw4=
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
|
||||
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||
golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||
golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||
golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||
golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
||||
golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
||||
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
||||
golang.org/x/tools v0.0.0-20190808195139-e713427fea3f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
|
||||
golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
|
||||
golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
|
||||
golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20200328031815-3db5fc6bac03/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8=
|
||||
golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||
golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||
golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||
golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||
golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||
golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||
golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||
golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||
golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||
golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||
golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw=
|
||||
golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw=
|
||||
golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8=
|
||||
golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
|
||||
golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
|
||||
golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
|
||||
golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
|
||||
golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
|
||||
golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
|
||||
golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
|
||||
golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
|
||||
golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE=
|
||||
golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||
golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||
golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||
golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||
golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0=
|
||||
golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
|
||||
golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
|
||||
golang.org/x/tools v0.1.8-0.20211022200916-316ba0b74098/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo=
|
||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE=
|
||||
google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M=
|
||||
google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg=
|
||||
google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg=
|
||||
google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI=
|
||||
google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI=
|
||||
google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI=
|
||||
google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
|
||||
google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
|
||||
google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
|
||||
google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
|
||||
google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
|
||||
google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE=
|
||||
google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE=
|
||||
google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM=
|
||||
google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc=
|
||||
google.golang.org/api v0.35.0/go.mod h1:/XrVsuzM0rZmrsbjJutiuftIzeuTQcEeaYcSk/mQ1dg=
|
||||
google.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34qYtE=
|
||||
google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8=
|
||||
google.golang.org/api v0.41.0/go.mod h1:RkxM5lITDfTzmyKFPt+wGrCJbVfniCr2ool8kTBzRTU=
|
||||
google.golang.org/api v0.43.0/go.mod h1:nQsDGjRXMo4lvh5hP0TKqF244gqhGcr/YSIykhUk/94=
|
||||
google.golang.org/api v0.44.0/go.mod h1:EBOGZqzyhtvMDoxwS97ctnh0zUmYY6CxqXsc1AvkYD8=
|
||||
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
|
||||
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||
google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||
google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0=
|
||||
google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
|
||||
google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
|
||||
google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
|
||||
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
|
||||
google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
|
||||
google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
|
||||
google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
|
||||
google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
|
||||
google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
|
||||
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
|
||||
google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8=
|
||||
google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
|
||||
google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
|
||||
google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
|
||||
google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
|
||||
google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
|
||||
google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
|
||||
google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA=
|
||||
google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
||||
google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
||||
google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
||||
google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
||||
google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
||||
google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
||||
google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
||||
google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
||||
google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
||||
google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U=
|
||||
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo=
|
||||
google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA=
|
||||
google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20201109203340-2640f1f9cdfb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20210222152913-aa3ee6e6a81c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A=
|
||||
google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0=
|
||||
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
|
||||
google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
|
||||
google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=
|
||||
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
|
||||
google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=
|
||||
google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
|
||||
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
|
||||
google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
|
||||
google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60=
|
||||
google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk=
|
||||
google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
|
||||
google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
|
||||
google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
|
||||
google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0=
|
||||
google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc=
|
||||
google.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA51WJ8=
|
||||
google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU=
|
||||
google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU=
|
||||
google.golang.org/grpc v1.36.1/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU=
|
||||
google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM=
|
||||
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
|
||||
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
|
||||
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
|
||||
google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
|
||||
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
|
||||
google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
||||
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
||||
google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
||||
google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4=
|
||||
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
|
||||
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
|
||||
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU=
|
||||
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
|
||||
gopkg.in/ini.v1 v1.62.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
|
||||
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.2.7/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10=
|
||||
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
|
||||
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
honnef.co/go/js/dom v0.0.0-20210725211120-f030747120f2 h1:oomkgU6VaQDsV6qZby2uz1Lap0eXmku8+2em3A/l700=
|
||||
honnef.co/go/js/dom v0.0.0-20210725211120-f030747120f2/go.mod h1:sUMDUKNB2ZcVjt92UnLy3cdGs+wDAcrPdV3JP6sVgA4=
|
||||
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
|
||||
honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
|
||||
honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
|
||||
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
|
||||
rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=
|
||||
rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 32 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 42 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 26 KiB |
@@ -34,5 +34,8 @@ WWW-Authenticate: Basic realm="easyProxy"
|
||||
401 Unauthorized`
|
||||
ConnectionFailBytes = `HTTP/1.1 404 Not Found
|
||||
|
||||
`
|
||||
Unauthorized = `HTTP/1.1 401 Unauthorized
|
||||
|
||||
`
|
||||
)
|
||||
|
||||
+20
-10
@@ -8,10 +8,14 @@ import (
|
||||
|
||||
var ConfPath string
|
||||
|
||||
//Get the currently selected configuration file directory
|
||||
//For non-Windows systems, select the /etc/nps as config directory if exist, or select ./
|
||||
//windows system, select the C:\Program Files\nps as config directory if exist, or select ./
|
||||
// Get the currently selected configuration file directory
|
||||
// For non-Windows systems, select the /etc/nps as config directory if exist, or select ./
|
||||
// windows system, select the C:\Program Files\nps as config directory if exist, or select ./
|
||||
func GetRunPath() string {
|
||||
if ConfPath != "" {
|
||||
return ConfPath
|
||||
}
|
||||
|
||||
var path string
|
||||
if len(os.Args) == 1 {
|
||||
if !IsWindows() {
|
||||
@@ -28,7 +32,7 @@ func GetRunPath() string {
|
||||
return path
|
||||
}
|
||||
|
||||
//Different systems get different installation paths
|
||||
// Different systems get different installation paths
|
||||
func GetInstallPath() string {
|
||||
var path string
|
||||
|
||||
@@ -45,7 +49,7 @@ func GetInstallPath() string {
|
||||
return path
|
||||
}
|
||||
|
||||
//Get the absolute path to the running directory
|
||||
// Get the absolute path to the running directory
|
||||
func GetAppPath() string {
|
||||
if path, err := filepath.Abs(filepath.Dir(os.Args[0])); err == nil {
|
||||
return path
|
||||
@@ -53,7 +57,7 @@ func GetAppPath() string {
|
||||
return os.Args[0]
|
||||
}
|
||||
|
||||
//Determine whether the current system is a Windows system?
|
||||
// Determine whether the current system is a Windows system?
|
||||
func IsWindows() bool {
|
||||
if runtime.GOOS == "windows" {
|
||||
return true
|
||||
@@ -61,7 +65,7 @@ func IsWindows() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
//interface log file path
|
||||
// interface log file path
|
||||
func GetLogPath() string {
|
||||
var path string
|
||||
if IsWindows() {
|
||||
@@ -72,7 +76,13 @@ func GetLogPath() string {
|
||||
return path
|
||||
}
|
||||
|
||||
//interface npc log file path
|
||||
func GetLogPathCurrentPath() string {
|
||||
var path string
|
||||
path = filepath.Join(GetAppPath(), "nps.log")
|
||||
return path
|
||||
}
|
||||
|
||||
// interface npc log file path
|
||||
func GetNpcLogPath() string {
|
||||
var path string
|
||||
if IsWindows() {
|
||||
@@ -83,7 +93,7 @@ func GetNpcLogPath() string {
|
||||
return path
|
||||
}
|
||||
|
||||
//interface pid file path
|
||||
// interface pid file path
|
||||
func GetTmpPath() string {
|
||||
var path string
|
||||
if IsWindows() {
|
||||
@@ -94,7 +104,7 @@ func GetTmpPath() string {
|
||||
return path
|
||||
}
|
||||
|
||||
//config file path
|
||||
// config file path
|
||||
func GetConfigPath() string {
|
||||
var path string
|
||||
if IsWindows() {
|
||||
|
||||
@@ -310,6 +310,17 @@ func IsBlackIp(ipPort, vkey string, blackIpList []string) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// 判断访问地址是否在白名单内
|
||||
func IsAuthIp(ipPort, vkey string, authIpList []string) bool {
|
||||
ip := GetIpByAddr(ipPort)
|
||||
|
||||
if in(ip, authIpList) {
|
||||
return false
|
||||
}
|
||||
logs.Error("IP地址[" + ip + "]不在隧道[" + vkey + "]白名单列表内")
|
||||
return true
|
||||
}
|
||||
|
||||
func CopyBuffer(dst io.Writer, src io.Reader, label ...string) (written int64, err error) {
|
||||
buf := CopyBuff.Get()
|
||||
defer CopyBuff.Put(buf)
|
||||
|
||||
+7
-5
@@ -39,10 +39,10 @@ func (s *Conn) readRequest(buf []byte) (n int, err error) {
|
||||
var rd int
|
||||
for {
|
||||
rd, err = s.Read(buf[n:])
|
||||
n += rd
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
n += rd
|
||||
if n < 4 {
|
||||
continue
|
||||
}
|
||||
@@ -61,10 +61,12 @@ func (s *Conn) readRequest(buf []byte) (n int, err error) {
|
||||
func (s *Conn) GetHost() (method, address string, rb []byte, err error, r *http.Request) {
|
||||
var b [32 * 1024]byte
|
||||
var n int
|
||||
if n, err = s.readRequest(b[:]); err != nil {
|
||||
if n, err = s.readRequest(b[:]); n > 0 {
|
||||
rb = b[:n]
|
||||
}
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
rb = b[:n]
|
||||
r, err = http.ReadRequest(bufio.NewReader(bytes.NewReader(rb)))
|
||||
if err != nil {
|
||||
return
|
||||
@@ -374,7 +376,7 @@ func SetUdpSession(sess *kcp.UDPSession) {
|
||||
|
||||
//conn1 mux conn
|
||||
func CopyWaitGroup(conn1, conn2 net.Conn, crypt bool, snappy bool, rate *rate.Rate,
|
||||
flow *file.Flow, isServer bool, rb []byte, task *file.Tunnel) {
|
||||
flow *file.Flow, isServer bool, rb []byte, task *file.Tunnel, host *file.Host) {
|
||||
//var in, out int64
|
||||
//var wg sync.WaitGroup
|
||||
connHandle := GetConn(conn1, crypt, snappy, rate, isServer)
|
||||
@@ -397,7 +399,7 @@ func CopyWaitGroup(conn1, conn2 net.Conn, crypt bool, snappy bool, rate *rate.Ra
|
||||
//}
|
||||
wg := new(sync.WaitGroup)
|
||||
wg.Add(1)
|
||||
err := goroutine.CopyConnsPool.Invoke(goroutine.NewConns(connHandle, conn2, flow, wg, task))
|
||||
err := goroutine.CopyConnsPool.Invoke(goroutine.NewConns(connHandle, conn2, flow, wg, task, host))
|
||||
wg.Wait()
|
||||
if err != nil {
|
||||
logs.Error(err)
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
package conn
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"io"
|
||||
"net"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
type bytesThenErrConn struct {
|
||||
net.Conn
|
||||
payload []byte
|
||||
err error
|
||||
read bool
|
||||
}
|
||||
|
||||
func (c *bytesThenErrConn) Read(b []byte) (int, error) {
|
||||
if c.read {
|
||||
return 0, c.err
|
||||
}
|
||||
c.read = true
|
||||
return copy(b, c.payload), c.err
|
||||
}
|
||||
|
||||
func TestGetHostReturnsBufferedBytesOnReadError(t *testing.T) {
|
||||
clientConn, serverConn := net.Pipe()
|
||||
defer clientConn.Close()
|
||||
defer serverConn.Close()
|
||||
|
||||
payload := []byte("SSH-2.0-OpenSSH_9.0\r\n")
|
||||
if err := serverConn.SetReadDeadline(time.Now().Add(50 * time.Millisecond)); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
type result struct {
|
||||
rb []byte
|
||||
err error
|
||||
}
|
||||
done := make(chan result, 1)
|
||||
go func() {
|
||||
_, _, rb, err, _ := NewConn(serverConn).GetHost()
|
||||
done <- result{rb: rb, err: err}
|
||||
}()
|
||||
|
||||
if _, err := clientConn.Write(payload); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
select {
|
||||
case got := <-done:
|
||||
if got.err == nil {
|
||||
t.Fatal("expected GetHost to fail for non-HTTP payload")
|
||||
}
|
||||
if !bytes.Equal(got.rb, payload) {
|
||||
t.Fatalf("expected buffered payload %q, got %q", payload, got.rb)
|
||||
}
|
||||
case <-time.After(time.Second):
|
||||
t.Fatal("GetHost did not return after read deadline")
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetHostReturnsBufferedBytesWhenReadReturnsBytesAndError(t *testing.T) {
|
||||
payload := []byte("SSH-2.0-OpenSSH_9.0\r\n")
|
||||
c := &bytesThenErrConn{
|
||||
payload: payload,
|
||||
err: io.ErrUnexpectedEOF,
|
||||
}
|
||||
|
||||
_, _, rb, err, _ := NewConn(c).GetHost()
|
||||
if err == nil {
|
||||
t.Fatal("expected GetHost to fail for non-HTTP payload")
|
||||
}
|
||||
if !bytes.Equal(rb, payload) {
|
||||
t.Fatalf("expected buffered payload %q, got %q", payload, rb)
|
||||
}
|
||||
}
|
||||
+21
-12
@@ -8,10 +8,11 @@ import (
|
||||
"encoding/base64"
|
||||
"encoding/hex"
|
||||
"errors"
|
||||
"github.com/google/uuid"
|
||||
"math/rand"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
// en
|
||||
@@ -89,20 +90,28 @@ func GetVkey() string {
|
||||
}
|
||||
|
||||
func Base64Decoding(encodedString string) (string, error) {
|
||||
// 先尝试 base64 解码,兼容原先的 "nps " 前缀
|
||||
decodedBytes, err := base64.StdEncoding.DecodeString(encodedString)
|
||||
if err != nil {
|
||||
// 处理解码错误
|
||||
return "", err
|
||||
}
|
||||
|
||||
// 将解码后的字节数组转换为字符串
|
||||
decodedString := string(decodedBytes)
|
||||
|
||||
// 如果startCmd开头不包含"nps ",则报错
|
||||
if len(decodedString) < 4 || !(decodedString[0:4] == "nps ") {
|
||||
return "", errors.New("快捷启动命令错误,请检查")
|
||||
if err == nil {
|
||||
if len(decodedString) >= 4 && decodedString[:4] == "nps " {
|
||||
return decodedString[4:], nil
|
||||
}
|
||||
}
|
||||
// 兼容直接以 "nps:" 开头的旧格式:
|
||||
// nps:name|addr|key|tls
|
||||
if len(decodedString) >= 4 && strings.HasPrefix(decodedString, "nps:") {
|
||||
parts := strings.Split(decodedString[4:], "|")
|
||||
if len(parts) < 4 {
|
||||
return "", errors.New("快捷启动命令格式错误,请检查")
|
||||
}
|
||||
addr := strings.TrimSpace(parts[1])
|
||||
key := strings.TrimSpace(parts[2])
|
||||
tls := strings.TrimSpace(parts[3])
|
||||
// 返回兼容老服务端的格式:"addr key tls",不修改端口或 TLS 标志
|
||||
return addr + " " + key + " " + tls, nil
|
||||
}
|
||||
|
||||
return decodedString[4:], nil
|
||||
|
||||
return "", errors.New("快捷启动命令错误,请检查")
|
||||
}
|
||||
|
||||
+29
-3
@@ -1,6 +1,7 @@
|
||||
package file
|
||||
|
||||
import (
|
||||
"crypto/md5"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/http"
|
||||
@@ -95,7 +96,7 @@ func (s *DbUtils) GetIdByVerifyKey(vKey string, addr string) (id int, err error)
|
||||
func (s *DbUtils) NewTask(t *Tunnel) (err error) {
|
||||
s.JsonDb.Tasks.Range(func(key, value interface{}) bool {
|
||||
v := value.(*Tunnel)
|
||||
if (v.Mode == "secret" || v.Mode == "p2p") && v.Password == t.Password {
|
||||
if (v.Mode == "secret" || v.Mode == "p2p") && v.Password == t.Password && t.Password != "" {
|
||||
err = errors.New(fmt.Sprintf("secret mode keys %s must be unique", t.Password))
|
||||
return false
|
||||
}
|
||||
@@ -221,7 +222,7 @@ reset:
|
||||
c.VerifyKey = crypt.GetVkey()
|
||||
}
|
||||
if c.RateLimit == 0 {
|
||||
c.Rate = rate.NewRate(int64(2 << 23))
|
||||
c.Rate = rate.NewRate((2 << 23) * 1024)
|
||||
} else if c.Rate == nil {
|
||||
c.Rate = rate.NewRate(int64(c.RateLimit * 1024))
|
||||
}
|
||||
@@ -272,7 +273,7 @@ func (s *DbUtils) VerifyUserName(username string, id int) (res bool) {
|
||||
func (s *DbUtils) UpdateClient(t *Client) error {
|
||||
s.JsonDb.Clients.Store(t.Id, t)
|
||||
if t.RateLimit == 0 {
|
||||
t.Rate = rate.NewRate(int64(2 << 23))
|
||||
t.Rate = rate.NewRate(int64((2 << 23) * 1024))
|
||||
t.Rate.Start()
|
||||
}
|
||||
return nil
|
||||
@@ -317,6 +318,24 @@ func (s *DbUtils) GetClientIdByVkey(vkey string) (id int, err error) {
|
||||
return
|
||||
}
|
||||
|
||||
func (s *DbUtils) GetClientByVkey(vkey string) (c *Client, err error) {
|
||||
var exist bool
|
||||
s.JsonDb.Clients.Range(func(key, value interface{}) bool {
|
||||
v := value.(*Client)
|
||||
if fmt.Sprintf("%x", md5.Sum([]byte(v.VerifyKey))) == vkey {
|
||||
exist = true
|
||||
c = v
|
||||
return false
|
||||
}
|
||||
return true
|
||||
})
|
||||
if exist {
|
||||
return
|
||||
}
|
||||
err = errors.New("未找到客户端")
|
||||
return
|
||||
}
|
||||
|
||||
func (s *DbUtils) GetHostById(id int) (h *Host, err error) {
|
||||
if v, ok := s.JsonDb.Hosts.Load(id); ok {
|
||||
h = v.(*Host)
|
||||
@@ -358,6 +377,13 @@ func (s *DbUtils) GetInfoByHost(host string, r *http.Request) (h *Host, err erro
|
||||
if v.Location == "" {
|
||||
v.Location = "/"
|
||||
}
|
||||
// "*" means SNI-based HTTPS lookup where actual URI is unknown, skip location filter
|
||||
if r.RequestURI == "*" {
|
||||
if h == nil || (len(v.Location) > len(h.Location)) {
|
||||
h = v
|
||||
}
|
||||
continue
|
||||
}
|
||||
if strings.Index(r.RequestURI, v.Location) == 0 {
|
||||
if h == nil || (len(v.Location) > len(h.Location)) {
|
||||
h = v
|
||||
|
||||
+32
-12
@@ -66,7 +66,7 @@ func (s *JsonDb) LoadClientFromJsonFile() {
|
||||
if post.RateLimit > 0 {
|
||||
post.Rate = rate.NewRate(int64(post.RateLimit * 1024))
|
||||
} else {
|
||||
post.Rate = rate.NewRate(int64(2 << 23))
|
||||
post.Rate = rate.NewRate((2 << 23) * 1024)
|
||||
}
|
||||
post.Rate.Start()
|
||||
post.NowConn = 0
|
||||
@@ -158,6 +158,9 @@ func (s *JsonDb) GetHostId() int32 {
|
||||
}
|
||||
|
||||
func loadSyncMapFromFile(filePath string, f func(value string)) {
|
||||
if !common.FileExists(filePath) {
|
||||
return
|
||||
}
|
||||
b, err := common.ReadAllFromFile(filePath)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
@@ -184,8 +187,14 @@ func storeSyncMapToFile(m sync.Map, filePath string) {
|
||||
file, err := os.Create(filePath + ".tmp")
|
||||
// first create a temporary file to store
|
||||
if err != nil {
|
||||
panic(err)
|
||||
logs.Error("store to file: create tmp file error: %v", err)
|
||||
return
|
||||
}
|
||||
defer func() {
|
||||
file.Close()
|
||||
os.Remove(filePath + ".tmp")
|
||||
}()
|
||||
var writeErr bool
|
||||
m.Range(func(key, value interface{}) bool {
|
||||
var b []byte
|
||||
var err error
|
||||
@@ -208,9 +217,6 @@ func storeSyncMapToFile(m sync.Map, filePath string) {
|
||||
return true
|
||||
}
|
||||
b, err = json.Marshal(obj)
|
||||
//case *Glob:
|
||||
// obj := value.(*Glob)
|
||||
// b, err = json.Marshal(obj)
|
||||
default:
|
||||
return true
|
||||
}
|
||||
@@ -219,40 +225,54 @@ func storeSyncMapToFile(m sync.Map, filePath string) {
|
||||
}
|
||||
_, err = file.Write(b)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
logs.Error("store to file: write error: %v", err)
|
||||
writeErr = true
|
||||
return false
|
||||
}
|
||||
_, err = file.Write([]byte("\n" + common.CONN_DATA_SEQ))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
logs.Error("store to file: write separator error: %v", err)
|
||||
writeErr = true
|
||||
return false
|
||||
}
|
||||
return true
|
||||
})
|
||||
if writeErr {
|
||||
return
|
||||
}
|
||||
_ = file.Sync()
|
||||
_ = file.Close()
|
||||
// must close file first, then rename it
|
||||
err = os.Rename(filePath+".tmp", filePath)
|
||||
if err != nil {
|
||||
logs.Error(err, "store to file err, data will lost")
|
||||
}
|
||||
// replace the file, maybe provides atomic operation
|
||||
}
|
||||
|
||||
func storeGlobalToFile(m *Glob, filePath string) {
|
||||
file, err := os.Create(filePath + ".tmp")
|
||||
// first create a temporary file to store
|
||||
if err != nil {
|
||||
panic(err)
|
||||
logs.Error("store global to file: create tmp file error: %v", err)
|
||||
return
|
||||
}
|
||||
defer func() {
|
||||
file.Close()
|
||||
os.Remove(filePath + ".tmp")
|
||||
}()
|
||||
|
||||
var b []byte
|
||||
b, err = json.Marshal(m)
|
||||
if err != nil {
|
||||
logs.Error("store global to file: marshal error: %v", err)
|
||||
return
|
||||
}
|
||||
_, err = file.Write(b)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
logs.Error("store global to file: write error: %v", err)
|
||||
return
|
||||
}
|
||||
_ = file.Sync()
|
||||
_ = file.Close()
|
||||
// must close file first, then rename it
|
||||
err = os.Rename(filePath+".tmp", filePath)
|
||||
if err != nil {
|
||||
logs.Error(err, "store to file err, data will lost")
|
||||
|
||||
+18
-8
@@ -54,6 +54,10 @@ type Client struct {
|
||||
BlackIpList []string
|
||||
CreateTime string
|
||||
LastOnlineTime string
|
||||
IpWhite bool // 是否启用ip白名单
|
||||
IpWhitePass string // ip授权密码
|
||||
IpWhiteList []string // ip白名单
|
||||
ExpireTime string // 到期时间,留空表示永不过期,格式 2006-01-02 15:04:05
|
||||
sync.RWMutex
|
||||
}
|
||||
|
||||
@@ -149,7 +153,6 @@ type Tunnel struct {
|
||||
Remark string
|
||||
TargetAddr string
|
||||
NoStore bool
|
||||
IsHttp bool
|
||||
LocalPath string
|
||||
StripPre string
|
||||
ProtoVersion string
|
||||
@@ -205,25 +208,32 @@ type MultiAccount struct {
|
||||
}
|
||||
|
||||
func (s *Target) GetRandomTarget() (string, error) {
|
||||
s.Lock()
|
||||
if s.TargetArr == nil {
|
||||
s.TargetArr = strings.Split(s.TargetStr, "\n")
|
||||
}
|
||||
if len(s.TargetArr) == 1 {
|
||||
return s.TargetArr[0], nil
|
||||
arr := strings.Split(s.TargetStr, "\n")
|
||||
s.TargetArr = make([]string, 0, len(arr))
|
||||
for _, v := range arr {
|
||||
v = strings.TrimRight(v, "\r")
|
||||
if v != "" {
|
||||
s.TargetArr = append(s.TargetArr, v)
|
||||
}
|
||||
}
|
||||
}
|
||||
if len(s.TargetArr) == 0 {
|
||||
s.Unlock()
|
||||
return "", errors.New("all inward-bending targets are offline")
|
||||
}
|
||||
s.Lock()
|
||||
defer s.Unlock()
|
||||
if s.nowIndex >= len(s.TargetArr)-1 {
|
||||
s.nowIndex = -1
|
||||
}
|
||||
s.nowIndex++
|
||||
return s.TargetArr[s.nowIndex], nil
|
||||
addr := s.TargetArr[s.nowIndex]
|
||||
s.Unlock()
|
||||
return addr, nil
|
||||
}
|
||||
|
||||
type Glob struct {
|
||||
BlackIpList []string
|
||||
ServerUrl string
|
||||
sync.RWMutex
|
||||
}
|
||||
|
||||
+80
-27
@@ -1,14 +1,18 @@
|
||||
package goroutine
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"net"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"ehang.io/nps/lib/common"
|
||||
"ehang.io/nps/lib/file"
|
||||
"github.com/astaxie/beego/logs"
|
||||
"github.com/panjf2000/ants/v2"
|
||||
"io"
|
||||
"net"
|
||||
"strings"
|
||||
"sync"
|
||||
)
|
||||
|
||||
type connGroup struct {
|
||||
@@ -18,6 +22,7 @@ type connGroup struct {
|
||||
n *int64
|
||||
flow *file.Flow
|
||||
task *file.Tunnel
|
||||
host *file.Host
|
||||
remote string
|
||||
}
|
||||
|
||||
@@ -30,7 +35,7 @@ type connGroup struct {
|
||||
// }
|
||||
//}
|
||||
|
||||
func newConnGroup(dst, src io.ReadWriteCloser, wg *sync.WaitGroup, n *int64, flow *file.Flow, task *file.Tunnel, remote string) connGroup {
|
||||
func newConnGroup(dst, src io.ReadWriteCloser, wg *sync.WaitGroup, n *int64, flow *file.Flow, task *file.Tunnel, host *file.Host, remote string) connGroup {
|
||||
return connGroup{
|
||||
src: src,
|
||||
dst: dst,
|
||||
@@ -38,11 +43,12 @@ func newConnGroup(dst, src io.ReadWriteCloser, wg *sync.WaitGroup, n *int64, flo
|
||||
n: n,
|
||||
flow: flow,
|
||||
task: task,
|
||||
host: host,
|
||||
remote: remote,
|
||||
}
|
||||
}
|
||||
|
||||
func CopyBuffer(dst io.Writer, src io.Reader, flow *file.Flow, task *file.Tunnel, remote string) (err error) {
|
||||
func CopyBuffer(dst io.Writer, src io.Reader, flow *file.Flow, task *file.Tunnel, host *file.Host, remote string) (err error) {
|
||||
buf := common.CopyBuff.Get()
|
||||
defer common.CopyBuff.Put(buf)
|
||||
for {
|
||||
@@ -51,24 +57,64 @@ func CopyBuffer(dst io.Writer, src io.Reader, flow *file.Flow, task *file.Tunnel
|
||||
}
|
||||
nr, er := src.Read(buf)
|
||||
|
||||
//if len(pr)>0 && pr[0] && nr > 50 {
|
||||
// logs.Warn(string(buf[:50]))
|
||||
//}
|
||||
|
||||
if task != nil {
|
||||
task.IsHttp = false
|
||||
firstLine := string(buf[0:nr])
|
||||
if len(firstLine) > 3 {
|
||||
method := firstLine[0:3]
|
||||
if method != "" && (method == "HTT" || method == "GET" || method == "POS" || method == "HEA" || method == "PUT" || method == "DEL") {
|
||||
if method != "HTT" {
|
||||
heads := strings.Split(firstLine, "\r\n")
|
||||
if len(heads) >= 2 {
|
||||
logs.Info("HTTP Request method %s, %s, remote address %s, target %s", heads[0], heads[1], remote, task.Target.TargetStr)
|
||||
if task.Client.IpWhite && task.Client.IpWhitePass != "" {
|
||||
|
||||
if common.IsAuthIp(remote, task.Client.VerifyKey, task.Client.IpWhiteList) {
|
||||
ip := common.GetIpByAddr(remote)
|
||||
var jsonBytes []byte
|
||||
|
||||
errorContent, _ := common.ReadAllFromFile(filepath.Join(common.GetRunPath(), "web", "static", "page", "auth.html"))
|
||||
authHtml := string(errorContent)
|
||||
authHtml = strings.ReplaceAll(authHtml, "${ip}", ip)
|
||||
|
||||
fullRequest := string(buf[0:nr])
|
||||
// 获取HTTP请求的第一行
|
||||
lines := strings.Split(fullRequest, "\r\n")
|
||||
if len(lines) == 0 {
|
||||
lines = strings.Split(fullRequest, "\n")
|
||||
}
|
||||
firstLine := lines[0]
|
||||
|
||||
// 优先处理客户端直接访问的 POST /authIp 请求,直接响应给客户端,不经隧道转发
|
||||
if strings.HasPrefix(firstLine, "POST /authIp") {
|
||||
pass := ""
|
||||
parts := strings.Split(firstLine, " ")
|
||||
if len(parts) > 1 {
|
||||
path := parts[1]
|
||||
if strings.Contains(path, "/authIp?pass=") {
|
||||
pass = strings.ReplaceAll(path, "/authIp?pass=", "")
|
||||
}
|
||||
}
|
||||
if pass == task.Client.IpWhitePass {
|
||||
task.Client.IpWhiteList = append(task.Client.IpWhiteList, ip)
|
||||
file.GetDb().UpdateClient(task.Client)
|
||||
logs.Info("客户端IP白名单认证授权成功:vkey [%s] ip [%s] password [%s]", task.Client.VerifyKey, ip, pass)
|
||||
jsonBytes, err = json.Marshal(map[string]interface{}{"success": true, "message": "授权成功"})
|
||||
} else {
|
||||
logs.Error("客户端IP白名单认证授权密码错误:vkey [%s] ip [%s] password [%s]", task.Client.VerifyKey, ip, pass)
|
||||
jsonBytes, err = json.Marshal(map[string]interface{}{"success": false, "message": "密码错误"})
|
||||
}
|
||||
response := fmt.Sprintf("HTTP/1.1 200 OK\r\nContent-Type: application/json\r\nContent-Length: %d\r\nConnection: close\r\n\r\n%s", len(jsonBytes), jsonBytes)
|
||||
// 如果 src 是真实的客户端连接(net.Conn),直接写回客户端并关闭连接,避免走隧道转发
|
||||
if connSrc, ok := src.(net.Conn); ok {
|
||||
connSrc.Write([]byte(response))
|
||||
connSrc.Close()
|
||||
} else {
|
||||
dst.Write([]byte(response))
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
task.IsHttp = true
|
||||
// 非授权IP,返回授权页面(同样优先返回给客户端)
|
||||
response := fmt.Sprintf("HTTP/1.1 401 Unauthorized\r\nContent-Type: text/html; charset=utf-8\r\nContent-Length: %d\r\nConnection: close\r\n\r\n%s", len(authHtml), authHtml)
|
||||
if connSrc, ok := src.(net.Conn); ok {
|
||||
connSrc.Write([]byte(response))
|
||||
connSrc.Close()
|
||||
} else {
|
||||
dst.Write([]byte(response))
|
||||
}
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -81,11 +127,16 @@ func CopyBuffer(dst io.Writer, src io.Reader, flow *file.Flow, task *file.Tunnel
|
||||
flow.Add(int64(nw), int64(nw))
|
||||
// <<20 = 1024 * 1024
|
||||
if flow.FlowLimit > 0 && (flow.FlowLimit<<20) < (flow.ExportFlow+flow.InletFlow) {
|
||||
logs.Info("流量已经超出.........")
|
||||
logs.Error("隧道[%s]流量已经超出", task.Client.VerifyKey)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if task != nil && task.Flow != nil && task.Flow != flow {
|
||||
task.Flow.Add(int64(nw), int64(nw))
|
||||
}
|
||||
if host != nil && host.Flow != nil && host.Flow != flow {
|
||||
host.Flow.Add(int64(nw), int64(nw))
|
||||
}
|
||||
}
|
||||
if ew != nil {
|
||||
err = ew
|
||||
@@ -101,7 +152,6 @@ func CopyBuffer(dst io.Writer, src io.Reader, flow *file.Flow, task *file.Tunnel
|
||||
break
|
||||
}
|
||||
}
|
||||
//return written, err
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -111,8 +161,9 @@ func copyConnGroup(group interface{}) {
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
|
||||
var err error
|
||||
err = CopyBuffer(cg.dst, cg.src, cg.flow, cg.task, cg.remote)
|
||||
err = CopyBuffer(cg.dst, cg.src, cg.flow, cg.task, cg.host, cg.remote)
|
||||
if err != nil {
|
||||
cg.src.Close()
|
||||
cg.dst.Close()
|
||||
@@ -131,15 +182,17 @@ type Conns struct {
|
||||
flow *file.Flow
|
||||
wg *sync.WaitGroup
|
||||
task *file.Tunnel
|
||||
host *file.Host
|
||||
}
|
||||
|
||||
func NewConns(c1 io.ReadWriteCloser, c2 net.Conn, flow *file.Flow, wg *sync.WaitGroup, task *file.Tunnel) Conns {
|
||||
func NewConns(c1 io.ReadWriteCloser, c2 net.Conn, flow *file.Flow, wg *sync.WaitGroup, task *file.Tunnel, host *file.Host) Conns {
|
||||
return Conns{
|
||||
conn1: c1,
|
||||
conn2: c2,
|
||||
flow: flow,
|
||||
wg: wg,
|
||||
task: task,
|
||||
host: host,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -150,9 +203,9 @@ func copyConns(group interface{}) {
|
||||
wg.Add(2)
|
||||
var in, out int64
|
||||
remoteAddr := conns.conn2.RemoteAddr().String()
|
||||
_ = connCopyPool.Invoke(newConnGroup(conns.conn1, conns.conn2, wg, &in, conns.flow, conns.task, remoteAddr))
|
||||
_ = connCopyPool.Invoke(newConnGroup(conns.conn1, conns.conn2, wg, &in, conns.flow, conns.task, conns.host, remoteAddr))
|
||||
// outside to mux : incoming
|
||||
_ = connCopyPool.Invoke(newConnGroup(conns.conn2, conns.conn1, wg, &out, conns.flow, conns.task, remoteAddr))
|
||||
_ = connCopyPool.Invoke(newConnGroup(conns.conn2, conns.conn1, wg, &out, conns.flow, conns.task, conns.host, remoteAddr))
|
||||
// mux to outside : outgoing
|
||||
wg.Wait()
|
||||
//if conns.flow != nil {
|
||||
|
||||
+148
-2
@@ -2,6 +2,7 @@ package install
|
||||
|
||||
import (
|
||||
"ehang.io/nps/lib/common"
|
||||
"ehang.io/nps/lib/version"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
@@ -13,6 +14,7 @@ import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
@@ -141,6 +143,53 @@ func UpdateNps() {
|
||||
fmt.Println("Update completed, please restart")
|
||||
}
|
||||
|
||||
func UpdateNpsNew() {
|
||||
latest, err := fetchLatestVersion()
|
||||
if err != nil {
|
||||
log.Println("获取最新版本失败:", err)
|
||||
return
|
||||
} else {
|
||||
fmt.Println("最新版本为:", latest)
|
||||
if compareVersion(version.VERSION, latest) >= 0 {
|
||||
fmt.Println("当前已是最新版本,无需更新")
|
||||
return
|
||||
}
|
||||
}
|
||||
destPath := downloadLatest2("server", filepath.Join(common.GetAppPath(), "temp"))
|
||||
//复制文件到对应目录
|
||||
copyStaticFileReplaceNps(destPath, common.GetAppPath())
|
||||
fmt.Println("更新成功,请重启服务")
|
||||
}
|
||||
|
||||
func fetchLatestVersion() (string, error) {
|
||||
resp, err := http.Get("https://api.github.com/repos/yisier/nps/releases/latest")
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
b, err := ioutil.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
rl := new(release)
|
||||
if err := json.Unmarshal(b, rl); err != nil {
|
||||
return "", err
|
||||
}
|
||||
return rl.TagName, nil
|
||||
}
|
||||
|
||||
func compareVersion(a, b string) int {
|
||||
ai, _ := strconv.Atoi(strings.ReplaceAll(strings.TrimPrefix(a, "v"), ".", ""))
|
||||
bi, _ := strconv.Atoi(strings.ReplaceAll(strings.TrimPrefix(b, "v"), ".", ""))
|
||||
if ai < bi {
|
||||
return -1
|
||||
}
|
||||
if ai > bi {
|
||||
return 1
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func UpdateNpc() {
|
||||
destPath := downloadLatest("client")
|
||||
//复制文件到对应目录
|
||||
@@ -148,6 +197,23 @@ func UpdateNpc() {
|
||||
fmt.Println("Update completed, please restart")
|
||||
}
|
||||
|
||||
func UpdateNpcNew() {
|
||||
latest, err := fetchLatestVersion()
|
||||
if err != nil {
|
||||
log.Println("获取最新版本失败:", err)
|
||||
return
|
||||
} else {
|
||||
fmt.Println("最新版本为:", latest)
|
||||
if compareVersion(version.VERSION, latest) >= 0 {
|
||||
fmt.Println("当前已是最新版本,无需更新")
|
||||
return
|
||||
}
|
||||
}
|
||||
destPath := downloadLatest2("client", filepath.Join(common.GetAppPath(), "temp"))
|
||||
copyStaticFileReplaceNpc(destPath, common.GetAppPath())
|
||||
fmt.Println("更新成功,请重启客户端")
|
||||
}
|
||||
|
||||
type release struct {
|
||||
TagName string `json:"tag_name"`
|
||||
}
|
||||
@@ -190,6 +256,43 @@ func downloadLatest(bin string) string {
|
||||
return destPath
|
||||
}
|
||||
|
||||
func downloadLatest2(bin string, path string) string {
|
||||
// get version
|
||||
data, err := http.Get("https://api.github.com/repos/yisier/nps/releases/latest")
|
||||
if err != nil {
|
||||
log.Fatal(err.Error())
|
||||
}
|
||||
b, err := ioutil.ReadAll(data.Body)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
rl := new(release)
|
||||
json.Unmarshal(b, &rl)
|
||||
version := rl.TagName
|
||||
fmt.Println("the latest version is", version)
|
||||
filename := runtime.GOOS + "_" + runtime.GOARCH + "_" + bin + ".tar.gz"
|
||||
// download latest package
|
||||
downloadUrl := fmt.Sprintf("https://github.com/yisier/nps/releases/download/%s/%s", version, filename)
|
||||
fmt.Println("download package from ", downloadUrl)
|
||||
resp, err := http.Get(downloadUrl)
|
||||
if err != nil {
|
||||
log.Fatal(err.Error())
|
||||
}
|
||||
destPath, err := unpackit.Unpack(resp.Body, path)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
if bin == "server" {
|
||||
destPath = strings.Replace(destPath, "/web", "", -1)
|
||||
destPath = strings.Replace(destPath, `\web`, "", -1)
|
||||
destPath = strings.Replace(destPath, "/views", "", -1)
|
||||
destPath = strings.Replace(destPath, `\views`, "", -1)
|
||||
} else {
|
||||
destPath = strings.Replace(destPath, `\conf`, "", -1)
|
||||
destPath = strings.Replace(destPath, "/conf", "", -1)
|
||||
}
|
||||
return destPath
|
||||
}
|
||||
func copyStaticFile(srcPath, bin string) string {
|
||||
path := common.GetInstallPath()
|
||||
if bin == "nps" {
|
||||
@@ -226,6 +329,34 @@ func copyStaticFile(srcPath, bin string) string {
|
||||
return binPath
|
||||
}
|
||||
|
||||
func copyStaticFileReplaceNps(srcPath, descPath string) string {
|
||||
//复制文件到对应目录
|
||||
os.Rename(filepath.Join(srcPath, "web"), filepath.Join(descPath, "web"))
|
||||
chMod(filepath.Join(descPath, "web"), 0766)
|
||||
|
||||
binPath, _ := filepath.Abs(os.Args[0])
|
||||
if !common.IsWindows() {
|
||||
os.Rename(filepath.Join(srcPath, "nps"), filepath.Join(descPath, "nps"))
|
||||
} else {
|
||||
os.Rename(filepath.Join(srcPath, "nps.exe"), filepath.Join(descPath, "nps.exe"))
|
||||
}
|
||||
chMod(binPath, 0755)
|
||||
os.RemoveAll(srcPath)
|
||||
return binPath
|
||||
}
|
||||
|
||||
func copyStaticFileReplaceNpc(srcPath, descPath string) string {
|
||||
binPath, _ := filepath.Abs(os.Args[0])
|
||||
if !common.IsWindows() {
|
||||
os.Rename(filepath.Join(srcPath, "npc"), filepath.Join(descPath, "npc"))
|
||||
} else {
|
||||
os.Rename(filepath.Join(srcPath, "npc.exe"), filepath.Join(descPath, "npc.exe"))
|
||||
}
|
||||
chMod(binPath, 0755)
|
||||
os.RemoveAll(srcPath)
|
||||
return binPath
|
||||
}
|
||||
|
||||
func InstallNpc() {
|
||||
path := common.GetInstallPath()
|
||||
if !common.FileExists(path) {
|
||||
@@ -266,6 +397,21 @@ now!`)
|
||||
chMod(common.GetLogPath(), 0777)
|
||||
return binPath
|
||||
}
|
||||
|
||||
func InstallNpsToCurrentDir() string {
|
||||
path := common.GetAppPath()
|
||||
log.Println("install path:" + path)
|
||||
log.Println("install ok!")
|
||||
chMod(filepath.Join(path, "nps.log"), 0777)
|
||||
|
||||
if !common.IsWindows() {
|
||||
path = filepath.Join(path, "nps")
|
||||
} else {
|
||||
path = filepath.Join(path, "nps.exe")
|
||||
}
|
||||
return path
|
||||
}
|
||||
|
||||
func MkidrDirAll(path string, v ...string) {
|
||||
for _, item := range v {
|
||||
if err := os.MkdirAll(filepath.Join(path, item), 0755); err != nil {
|
||||
@@ -310,7 +456,7 @@ func CopyDir(srcPath string, destPath string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
//生成目录并拷贝文件
|
||||
// 生成目录并拷贝文件
|
||||
func copyFile(src, dest string) (w int64, err error) {
|
||||
srcFile, err := os.Open(src)
|
||||
if err != nil {
|
||||
@@ -345,7 +491,7 @@ func copyFile(src, dest string) (w int64, err error) {
|
||||
return io.Copy(dstFile, srcFile)
|
||||
}
|
||||
|
||||
//检测文件夹路径时候存在
|
||||
// 检测文件夹路径时候存在
|
||||
func pathExists(path string) (bool, error) {
|
||||
_, err := os.Stat(path)
|
||||
if err == nil {
|
||||
|
||||
+1
-1
@@ -72,7 +72,7 @@ func (s *conn) Close() (err error) {
|
||||
func (s *conn) closeProcess() {
|
||||
s.isClose = true
|
||||
s.receiveWindow.mux.connMap.Delete(s.connId)
|
||||
if !s.receiveWindow.mux.IsClose {
|
||||
if !s.receiveWindow.mux.IsClose() {
|
||||
// if server or user close the conn while reading, will Get a io.EOF
|
||||
// and this Close method will be invoke, send this signal to close other side
|
||||
s.receiveWindow.mux.sendInfo(muxConnClose, s.connId, nil)
|
||||
|
||||
+18
-16
@@ -35,7 +35,7 @@ type Mux struct {
|
||||
newConnCh chan *conn
|
||||
id int32
|
||||
closeChan chan struct{}
|
||||
IsClose bool
|
||||
isClose atomic.Bool
|
||||
counter *latencyCounter
|
||||
bw *bandwidth
|
||||
pingCh chan []byte
|
||||
@@ -70,7 +70,6 @@ func NewMux(c net.Conn, connType string, pingCheckThreshold int) *Mux {
|
||||
closeChan: make(chan struct{}, 1),
|
||||
newConnCh: make(chan *conn),
|
||||
bw: NewBandwidth(fd),
|
||||
IsClose: false,
|
||||
connType: connType,
|
||||
pingCh: make(chan []byte),
|
||||
pingCheckThreshold: checkThreshold,
|
||||
@@ -86,8 +85,11 @@ func NewMux(c net.Conn, connType string, pingCheckThreshold int) *Mux {
|
||||
return m
|
||||
}
|
||||
|
||||
// IsClose returns whether the mux connection has been closed.
|
||||
func (s *Mux) IsClose() bool { return s.isClose.Load() }
|
||||
|
||||
func (s *Mux) NewConn() (*conn, error) {
|
||||
if s.IsClose {
|
||||
if s.isClose.Load() {
|
||||
return nil, errors.New("the mux has closed")
|
||||
}
|
||||
conn := NewConn(s.getId(), s)
|
||||
@@ -106,7 +108,7 @@ func (s *Mux) NewConn() (*conn, error) {
|
||||
}
|
||||
|
||||
func (s *Mux) Accept() (net.Conn, error) {
|
||||
if s.IsClose {
|
||||
if s.isClose.Load() {
|
||||
return nil, errors.New("accpet error,the mux has closed")
|
||||
}
|
||||
conn := <-s.newConnCh
|
||||
@@ -121,7 +123,7 @@ func (s *Mux) Addr() net.Addr {
|
||||
}
|
||||
|
||||
func (s *Mux) sendInfo(flag uint8, id int32, data interface{}) {
|
||||
if s.IsClose {
|
||||
if s.isClose.Load() {
|
||||
return
|
||||
}
|
||||
var err error
|
||||
@@ -140,11 +142,11 @@ func (s *Mux) sendInfo(flag uint8, id int32, data interface{}) {
|
||||
func (s *Mux) writeSession() {
|
||||
go func() {
|
||||
for {
|
||||
if s.IsClose {
|
||||
if s.isClose.Load() {
|
||||
break
|
||||
}
|
||||
pack := s.writeQueue.Pop()
|
||||
if s.IsClose {
|
||||
if s.isClose.Load() {
|
||||
break
|
||||
}
|
||||
//if pack.flag == muxNewMsg || pack.flag == muxNewMsgPart {
|
||||
@@ -173,7 +175,7 @@ func (s *Mux) ping() {
|
||||
ticker := time.NewTicker(time.Second * 5)
|
||||
defer ticker.Stop()
|
||||
for {
|
||||
if s.IsClose {
|
||||
if s.isClose.Load() {
|
||||
break
|
||||
}
|
||||
select {
|
||||
@@ -197,7 +199,7 @@ func (s *Mux) ping() {
|
||||
var now time.Time
|
||||
var data []byte
|
||||
for {
|
||||
if s.IsClose {
|
||||
if s.isClose.Load() {
|
||||
break
|
||||
}
|
||||
select {
|
||||
@@ -213,7 +215,7 @@ func (s *Mux) ping() {
|
||||
// convert float64 to bits, store it atomic
|
||||
//log.Println("ping", math.Float64frombits(atomic.LoadUint64(&s.latency)))
|
||||
}
|
||||
if cap(data) > 0 && !s.IsClose {
|
||||
if cap(data) > 0 && !s.isClose.Load() {
|
||||
windowBuff.Put(data)
|
||||
}
|
||||
}
|
||||
@@ -224,11 +226,11 @@ func (s *Mux) readSession() {
|
||||
go func() {
|
||||
var connection *conn
|
||||
for {
|
||||
if s.IsClose {
|
||||
if s.isClose.Load() {
|
||||
break
|
||||
}
|
||||
connection = s.newConnQueue.Pop()
|
||||
if s.IsClose {
|
||||
if s.isClose.Load() {
|
||||
break // make sure that is closed
|
||||
}
|
||||
s.connMap.Set(connection.connId, connection) //it has been Set before send ok
|
||||
@@ -241,7 +243,7 @@ func (s *Mux) readSession() {
|
||||
var l uint16
|
||||
var err error
|
||||
for {
|
||||
if s.IsClose {
|
||||
if s.isClose.Load() {
|
||||
return
|
||||
}
|
||||
pack = muxPack.Get()
|
||||
@@ -322,10 +324,10 @@ func (s *Mux) newMsg(connection *conn, pack *muxPackager) (err error) {
|
||||
}
|
||||
|
||||
func (s *Mux) Close() (err error) {
|
||||
if s.IsClose {
|
||||
if s.isClose.Load() {
|
||||
return errors.New("the mux has closed")
|
||||
}
|
||||
s.IsClose = true
|
||||
s.isClose.Store(true)
|
||||
log.Println("close mux")
|
||||
s.connMap.Close()
|
||||
//s.connMap = nil
|
||||
@@ -361,7 +363,7 @@ func (s *Mux) release() {
|
||||
s.newConnQueue.Stop()
|
||||
}
|
||||
|
||||
//Get New connId as unique flag
|
||||
// Get New connId as unique flag
|
||||
func (s *Mux) getId() (id int32) {
|
||||
//Avoid going beyond the scope
|
||||
if (math.MaxInt32 - s.id) < 10000 {
|
||||
|
||||
@@ -135,6 +135,7 @@ func (Self *muxPackager) UnPack(reader io.Reader) (n uint16, err error) {
|
||||
Self.buf = Self.buf[0:13]
|
||||
l, err := io.ReadFull(reader, Self.buf[:5])
|
||||
if err != nil {
|
||||
windowBuff.Put(Self.buf) // 归还 buf,避免 pool 泄漏
|
||||
return
|
||||
}
|
||||
n += uint16(l)
|
||||
@@ -145,6 +146,11 @@ func (Self *muxPackager) UnPack(reader io.Reader) (n uint16, err error) {
|
||||
var m uint16
|
||||
Self.content = windowBuff.Get() // need Get a window buf from pool
|
||||
m, err = Self.basePackager.UnPack(reader)
|
||||
if err != nil {
|
||||
windowBuff.Put(Self.content) // 归还 content buf,避免 pool 泄漏
|
||||
windowBuff.Put(Self.buf)
|
||||
return
|
||||
}
|
||||
n += m
|
||||
case muxMsgSendOk:
|
||||
l, err = io.ReadFull(reader, Self.buf[5:13])
|
||||
|
||||
+11
-5
@@ -10,12 +10,14 @@ type PortListener struct {
|
||||
connCh chan *PortConn
|
||||
addr net.Addr
|
||||
isClose bool
|
||||
done chan struct{}
|
||||
}
|
||||
|
||||
func NewPortListener(connCh chan *PortConn, addr net.Addr) *PortListener {
|
||||
return &PortListener{
|
||||
connCh: connCh,
|
||||
addr: addr,
|
||||
done: make(chan struct{}),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,19 +25,23 @@ func (pListener *PortListener) Accept() (net.Conn, error) {
|
||||
if pListener.isClose {
|
||||
return nil, errors.New("the listener has closed")
|
||||
}
|
||||
conn := <-pListener.connCh
|
||||
if conn != nil {
|
||||
return conn, nil
|
||||
select {
|
||||
case <-pListener.done:
|
||||
return nil, errors.New("the listener has closed")
|
||||
case conn := <-pListener.connCh:
|
||||
if conn != nil {
|
||||
return conn, nil
|
||||
}
|
||||
return nil, errors.New("the listener has closed")
|
||||
}
|
||||
return nil, errors.New("the listener has closed")
|
||||
}
|
||||
|
||||
func (pListener *PortListener) Close() error {
|
||||
//close
|
||||
if pListener.isClose {
|
||||
return errors.New("the listener has closed")
|
||||
}
|
||||
pListener.isClose = true
|
||||
close(pListener.done)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
+29
-5
@@ -10,6 +10,7 @@ import (
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"ehang.io/nps/lib/common"
|
||||
@@ -34,6 +35,8 @@ type PortMux struct {
|
||||
net.Listener
|
||||
port int
|
||||
isClose bool
|
||||
done chan struct{} // 关闭时触发 process() 退出,避免 send on closed channel
|
||||
wg sync.WaitGroup // 跟踪 in-flight process(),保证 Close() 关闭 conn channel 前全部退出
|
||||
managerHost string
|
||||
clientConn chan *PortConn
|
||||
httpConn chan *PortConn
|
||||
@@ -45,6 +48,7 @@ func NewPortMux(port int, managerHost string) *PortMux {
|
||||
pMux := &PortMux{
|
||||
managerHost: managerHost,
|
||||
port: port,
|
||||
done: make(chan struct{}),
|
||||
clientConn: make(chan *PortConn),
|
||||
httpConn: make(chan *PortConn),
|
||||
httpsConn: make(chan *PortConn),
|
||||
@@ -65,25 +69,35 @@ func (pMux *PortMux) Start() error {
|
||||
logs.Error(err)
|
||||
os.Exit(0)
|
||||
}
|
||||
pMux.wg.Add(1)
|
||||
go func() {
|
||||
defer pMux.wg.Done()
|
||||
for {
|
||||
conn, err := pMux.Listener.Accept()
|
||||
if err != nil {
|
||||
logs.Warn(err)
|
||||
//close
|
||||
pMux.Close()
|
||||
return
|
||||
}
|
||||
go pMux.process(conn)
|
||||
pMux.wg.Add(1)
|
||||
go func(c net.Conn) {
|
||||
defer pMux.wg.Done()
|
||||
pMux.process(c)
|
||||
}(conn)
|
||||
}
|
||||
}()
|
||||
return nil
|
||||
}
|
||||
|
||||
func (pMux *PortMux) process(conn net.Conn) {
|
||||
// 设置读超时,防止客户端不发数据导致 goroutine 永久阻塞,造成 wg.Wait() 死锁
|
||||
readTimeout := ACCEPT_TIME_OUT * time.Second
|
||||
conn.SetReadDeadline(time.Now().Add(readTimeout))
|
||||
|
||||
// Recognition according to different signs
|
||||
// read 3 byte
|
||||
buf := make([]byte, 3)
|
||||
if n, err := io.ReadFull(conn, buf); err != nil || n != 3 {
|
||||
conn.Close()
|
||||
return
|
||||
}
|
||||
var ch chan *PortConn
|
||||
@@ -92,6 +106,7 @@ func (pMux *PortMux) process(conn net.Conn) {
|
||||
var readMore = false
|
||||
switch common.BytesToNum(buf) {
|
||||
case HTTP_CONNECT, HTTP_DELETE, HTTP_GET, HTTP_HEAD, HTTP_OPTIONS, HTTP_POST, HTTP_PUT, HTTP_TRACE: //http and manager
|
||||
conn.SetReadDeadline(time.Now().Add(readTimeout)) // 刷新超时,给 HTTP 头读取完整时间窗口
|
||||
buffer.Reset()
|
||||
r := bufio.NewReader(conn)
|
||||
buffer.Write(buf)
|
||||
@@ -127,12 +142,18 @@ func (pMux *PortMux) process(conn net.Conn) {
|
||||
readMore = true
|
||||
ch = pMux.httpsConn
|
||||
}
|
||||
// 清除读超时,后续由 PortConn 的消费者自行管理超时
|
||||
conn.SetReadDeadline(time.Time{})
|
||||
if len(rs) == 0 {
|
||||
rs = buf
|
||||
}
|
||||
timer := time.NewTimer(ACCEPT_TIME_OUT)
|
||||
timer := time.NewTimer(readTimeout)
|
||||
defer timer.Stop()
|
||||
select {
|
||||
case <-pMux.done:
|
||||
conn.Close()
|
||||
case <-timer.C:
|
||||
conn.Close()
|
||||
case ch <- newPortConn(conn, rs, readMore):
|
||||
}
|
||||
}
|
||||
@@ -142,11 +163,14 @@ func (pMux *PortMux) Close() error {
|
||||
return errors.New("the port pmux has closed")
|
||||
}
|
||||
pMux.isClose = true
|
||||
_ = pMux.Listener.Close() // 停止接收新连接,触发 accept 协程退出
|
||||
close(pMux.done) // 唤醒 in-flight process()
|
||||
pMux.wg.Wait() // 等待所有 process() 退出后再 close conn channel
|
||||
close(pMux.clientConn)
|
||||
close(pMux.httpsConn)
|
||||
close(pMux.httpConn)
|
||||
close(pMux.managerConn)
|
||||
return pMux.Listener.Close()
|
||||
return nil
|
||||
}
|
||||
|
||||
func (pMux *PortMux) GetClientListener() net.Listener {
|
||||
|
||||
+2
-2
@@ -18,7 +18,7 @@ func NewRateConn(conn io.ReadWriteCloser, rate *Rate) io.ReadWriteCloser {
|
||||
|
||||
func (s *rateConn) Read(b []byte) (n int, err error) {
|
||||
n, err = s.conn.Read(b)
|
||||
if s.rate != nil {
|
||||
if s.rate != nil && s.rate.addSize > 0 {
|
||||
s.rate.Get(int64(n))
|
||||
}
|
||||
return
|
||||
@@ -26,7 +26,7 @@ func (s *rateConn) Read(b []byte) (n int, err error) {
|
||||
|
||||
func (s *rateConn) Write(b []byte) (n int, err error) {
|
||||
n, err = s.conn.Write(b)
|
||||
if s.rate != nil {
|
||||
if s.rate != nil && s.rate.addSize > 0 {
|
||||
s.rate.Get(int64(n))
|
||||
}
|
||||
return
|
||||
|
||||
+36
-57
@@ -1,81 +1,60 @@
|
||||
package rate
|
||||
|
||||
import (
|
||||
"context"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
xrate "golang.org/x/time/rate"
|
||||
)
|
||||
|
||||
type Rate struct {
|
||||
bucketSize int64
|
||||
bucketSurplusSize int64
|
||||
bucketAddSize int64
|
||||
stopChan chan bool
|
||||
NowRate int64
|
||||
limiter *xrate.Limiter
|
||||
addSize int64
|
||||
stopChan chan struct{}
|
||||
consumed int64
|
||||
NowRate int64
|
||||
}
|
||||
|
||||
func NewRate(addSize int64) *Rate {
|
||||
return &Rate{
|
||||
bucketSize: addSize * 2,
|
||||
bucketSurplusSize: 0,
|
||||
bucketAddSize: addSize,
|
||||
stopChan: make(chan bool),
|
||||
limiter: xrate.NewLimiter(xrate.Limit(addSize), int(addSize)),
|
||||
addSize: addSize,
|
||||
stopChan: make(chan struct{}),
|
||||
}
|
||||
}
|
||||
|
||||
func (s *Rate) Start() {
|
||||
go s.session()
|
||||
}
|
||||
|
||||
func (s *Rate) add(size int64) {
|
||||
if res := s.bucketSize - s.bucketSurplusSize; res < s.bucketAddSize {
|
||||
atomic.AddInt64(&s.bucketSurplusSize, res)
|
||||
return
|
||||
}
|
||||
atomic.AddInt64(&s.bucketSurplusSize, size)
|
||||
}
|
||||
|
||||
//回桶
|
||||
func (s *Rate) ReturnBucket(size int64) {
|
||||
s.add(size)
|
||||
}
|
||||
|
||||
//停止
|
||||
func (s *Rate) Stop() {
|
||||
s.stopChan <- true
|
||||
}
|
||||
|
||||
func (s *Rate) Get(size int64) {
|
||||
if s.bucketSurplusSize >= size {
|
||||
atomic.AddInt64(&s.bucketSurplusSize, -size)
|
||||
return
|
||||
}
|
||||
ticker := time.NewTicker(time.Millisecond * 100)
|
||||
for {
|
||||
select {
|
||||
case <-ticker.C:
|
||||
if s.bucketSurplusSize >= size {
|
||||
atomic.AddInt64(&s.bucketSurplusSize, -size)
|
||||
ticker.Stop()
|
||||
go func() {
|
||||
ticker := time.NewTicker(time.Second)
|
||||
defer ticker.Stop()
|
||||
for {
|
||||
select {
|
||||
case <-ticker.C:
|
||||
s.NowRate = atomic.SwapInt64(&s.consumed, 0)
|
||||
case <-s.stopChan:
|
||||
return
|
||||
}
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
func (s *Rate) Stop() {
|
||||
select {
|
||||
case <-s.stopChan:
|
||||
default:
|
||||
close(s.stopChan)
|
||||
}
|
||||
}
|
||||
|
||||
func (s *Rate) session() {
|
||||
ticker := time.NewTicker(time.Second * 1)
|
||||
for {
|
||||
select {
|
||||
case <-ticker.C:
|
||||
if rs := s.bucketAddSize - s.bucketSurplusSize; rs > 0 {
|
||||
s.NowRate = rs
|
||||
} else {
|
||||
s.NowRate = s.bucketSize - s.bucketSurplusSize
|
||||
}
|
||||
s.add(s.bucketAddSize)
|
||||
case <-s.stopChan:
|
||||
ticker.Stop()
|
||||
return
|
||||
}
|
||||
func (s *Rate) Get(size int64) {
|
||||
if s.addSize <= 0 {
|
||||
return
|
||||
}
|
||||
if size <= 0 {
|
||||
return
|
||||
}
|
||||
ctx := context.Background()
|
||||
_ = s.limiter.WaitN(ctx, int(size))
|
||||
atomic.AddInt64(&s.consumed, size)
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package version
|
||||
|
||||
const VERSION = "0.26.23"
|
||||
const VERSION = "0.26.34"
|
||||
|
||||
// Compulsory minimum version, Minimum downward compatibility to this version
|
||||
func GetVersion() string {
|
||||
|
||||
@@ -29,6 +29,7 @@ type BaseServer struct {
|
||||
bridge NetBridge
|
||||
task *file.Tunnel
|
||||
errorContent []byte
|
||||
errorCode int
|
||||
sync.Mutex
|
||||
}
|
||||
|
||||
@@ -95,7 +96,7 @@ func in(target string, str_array []string) bool {
|
||||
|
||||
// create a new connection and start bytes copying
|
||||
func (s *BaseServer) DealClient(c *conn.Conn, client *file.Client, addr string,
|
||||
rb []byte, tp string, f func(), flow *file.Flow, localProxy bool, task *file.Tunnel) error {
|
||||
rb []byte, tp string, f func(), flow *file.Flow, localProxy bool, task *file.Tunnel, host *file.Host) error {
|
||||
|
||||
// 判断访问地址是否在全局黑名单内
|
||||
if IsGlobalBlackIp(c.RemoteAddr().String()) {
|
||||
@@ -109,7 +110,12 @@ func (s *BaseServer) DealClient(c *conn.Conn, client *file.Client, addr string,
|
||||
return nil
|
||||
}
|
||||
|
||||
link := conn.NewLink(tp, addr, client.Cnf.Crypt, client.Cnf.Compress, c.Conn.RemoteAddr().String(), localProxy, task.ProtoVersion)
|
||||
protoVersion := ""
|
||||
if task != nil {
|
||||
protoVersion = task.ProtoVersion
|
||||
}
|
||||
|
||||
link := conn.NewLink(tp, addr, client.Cnf.Crypt, client.Cnf.Compress, c.Conn.RemoteAddr().String(), localProxy, protoVersion)
|
||||
if target, err := s.bridge.SendLinkInfo(client.Id, link, s.task); err != nil {
|
||||
logs.Warn("get connection from client id %d error %s", client.Id, err.Error())
|
||||
c.Close()
|
||||
@@ -118,7 +124,7 @@ func (s *BaseServer) DealClient(c *conn.Conn, client *file.Client, addr string,
|
||||
if f != nil {
|
||||
f()
|
||||
}
|
||||
conn.CopyWaitGroup(target, c.Conn, link.Crypt, link.Compress, client.Rate, flow, true, rb, task)
|
||||
conn.CopyWaitGroup(target, c.Conn, link.Crypt, link.Compress, client.Rate, flow, true, rb, task, host)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
+45
-2
@@ -10,6 +10,8 @@ import (
|
||||
"ehang.io/nps/lib/file"
|
||||
"ehang.io/nps/lib/goroutine"
|
||||
"ehang.io/nps/server/connection"
|
||||
"encoding/json"
|
||||
"github.com/astaxie/beego"
|
||||
"github.com/astaxie/beego/logs"
|
||||
"io"
|
||||
"net"
|
||||
@@ -112,7 +114,7 @@ func (s *httpServer) handleTunneling(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
// 自动 http 301 https
|
||||
if host.AutoHttps && r.TLS == nil {
|
||||
http.Redirect(w, r, "https://"+r.Host+r.RequestURI, http.StatusMovedPermanently)
|
||||
http.Redirect(w, r, "https://"+host.Host+":"+beego.AppConfig.String("https_proxy_port"), http.StatusMovedPermanently)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -196,6 +198,45 @@ reset:
|
||||
return
|
||||
}
|
||||
|
||||
if host.Client.IpWhite && host.Client.IpWhitePass != "" {
|
||||
if common.IsAuthIp(c.RemoteAddr().String(), host.Client.VerifyKey, host.Client.IpWhiteList) {
|
||||
|
||||
if r.URL.Path == "/authIp" {
|
||||
rawQuery := r.URL.RawQuery
|
||||
|
||||
var jsonBytes []byte
|
||||
ip := common.GetIpByAddr(c.RemoteAddr().String())
|
||||
|
||||
if strings.Contains(rawQuery, "pass=") {
|
||||
// 截取 = 后面的值
|
||||
pass := strings.Split(rawQuery, "pass=")[1]
|
||||
if pass == host.Client.IpWhitePass {
|
||||
host.Client.IpWhiteList = append(host.Client.IpWhiteList, ip)
|
||||
file.GetDb().UpdateClient(host.Client)
|
||||
logs.Info("客户端IP白名单认证授权成功:vkey [%s] ip [%s] password [%s]", host.Client.VerifyKey, ip, pass)
|
||||
jsonBytes, err = json.Marshal(map[string]interface{}{"success": true, "message": "授权成功"})
|
||||
} else {
|
||||
logs.Error("客户端IP白名单认证授权密码错误:vkey [%s] ip [%s] password [%s]", host.Client.VerifyKey, ip, pass)
|
||||
jsonBytes, err = json.Marshal(map[string]interface{}{"success": false, "message": "密码错误"})
|
||||
}
|
||||
} else {
|
||||
logs.Error("客户端IP白名单认证授权密码错误:vkey [%s] ip [%s]", host.Client.VerifyKey, ip)
|
||||
jsonBytes, err = json.Marshal(map[string]interface{}{"success": false, "message": "参数错误"})
|
||||
}
|
||||
s.errorContent, err = jsonBytes, err
|
||||
s.errorCode = 200
|
||||
return
|
||||
}
|
||||
|
||||
errorContent, _ := common.ReadAllFromFile(filepath.Join(common.GetRunPath(), "web", "static", "page", "auth.html"))
|
||||
authHtml := string(errorContent)
|
||||
authHtml = strings.ReplaceAll(authHtml, "${ip}", common.GetIpByAddr(c.RemoteAddr().String()))
|
||||
s.errorContent, err = []byte(authHtml), err
|
||||
s.errorCode = 401
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// 判断访问地址是否在黑名单内
|
||||
if common.IsBlackIp(c.RemoteAddr().String(), host.Client.VerifyKey, host.Client.BlackIpList) {
|
||||
c.Close()
|
||||
@@ -221,7 +262,7 @@ reset:
|
||||
}
|
||||
}()
|
||||
|
||||
err1 := goroutine.CopyBuffer(c, connClient, host.Client.Flow, nil, "")
|
||||
err1 := goroutine.CopyBuffer(c, connClient, host.Client.Flow, nil, host, "")
|
||||
if err1 != nil {
|
||||
return
|
||||
}
|
||||
@@ -251,6 +292,7 @@ reset:
|
||||
}
|
||||
logs.Trace("%s request, method %s, host %s, url %s, remote address %s, return cache", r.URL.Scheme, r.Method, r.Host, r.URL.Path, c.RemoteAddr().String())
|
||||
host.Client.Flow.Add(int64(n), int64(n))
|
||||
host.Flow.Add(int64(n), int64(n))
|
||||
//if return cache and does not create a new conn with client and Connection is not set or close, close the connection.
|
||||
if strings.ToLower(r.Header.Get("Connection")) == "close" || strings.ToLower(r.Header.Get("Connection")) == "" {
|
||||
break
|
||||
@@ -272,6 +314,7 @@ reset:
|
||||
break
|
||||
}
|
||||
host.Client.Flow.Add(int64(lenConn.Len), int64(lenConn.Len))
|
||||
host.Flow.Add(int64(lenConn.Len), int64(lenConn.Len))
|
||||
|
||||
readReq:
|
||||
//read req from connection
|
||||
|
||||
+65
-17
@@ -1,6 +1,7 @@
|
||||
package proxy
|
||||
|
||||
import (
|
||||
"io"
|
||||
"net"
|
||||
"net/http"
|
||||
"net/url"
|
||||
@@ -38,10 +39,14 @@ func (https *HttpsServer) Start() error {
|
||||
|
||||
conn.Accept(https.listener, func(c net.Conn) {
|
||||
serverName, rb := GetServerNameFromClientHello(c)
|
||||
if serverName == "" {
|
||||
serverName = getFallbackServerName()
|
||||
logs.Debug("https fallback server name result, remote addr %s, server name %q", c.RemoteAddr().String(), serverName)
|
||||
}
|
||||
r := buildHttpsRequest(serverName)
|
||||
if host, err := file.GetDb().GetInfoByHost(serverName, r); err != nil {
|
||||
c.Close()
|
||||
logs.Debug("the url %s can't be parsed!,remote addr %s", serverName, c.RemoteAddr().String())
|
||||
logs.Debug("https host lookup failed, server name %q, remote addr %s, error %v", serverName, c.RemoteAddr().String(), err)
|
||||
return
|
||||
} else {
|
||||
if host.CertFilePath == "" || host.KeyFilePath == "" {
|
||||
@@ -140,6 +145,35 @@ func (https *HttpsServer) Start() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func getFallbackServerName() string {
|
||||
global := file.GetDb().GetGlobal()
|
||||
if global == nil {
|
||||
return ""
|
||||
}
|
||||
serverName := strings.TrimSpace(global.ServerUrl)
|
||||
if serverName == "" {
|
||||
return ""
|
||||
}
|
||||
if strings.Contains(serverName, "://") {
|
||||
if u, err := url.Parse(serverName); err == nil && u.Host != "" {
|
||||
serverName = u.Host
|
||||
}
|
||||
}
|
||||
if i := strings.Index(serverName, "/"); i >= 0 {
|
||||
serverName = serverName[:i]
|
||||
}
|
||||
serverName = common.GetIpByAddr(serverName)
|
||||
serverName = strings.TrimSpace(serverName)
|
||||
if serverName == "" {
|
||||
return ""
|
||||
}
|
||||
ip := net.ParseIP(serverName)
|
||||
if ip != nil && ip.IsUnspecified() {
|
||||
return ""
|
||||
}
|
||||
return serverName
|
||||
}
|
||||
|
||||
func (https *HttpsServer) cert(host *file.Host, c net.Conn, rb []byte, certFileUrl string, keyFileUrl string) {
|
||||
var l *HttpsListener
|
||||
i := 0
|
||||
@@ -159,14 +193,14 @@ func (https *HttpsServer) cert(host *file.Host, c net.Conn, rb []byte, certFileU
|
||||
}
|
||||
https.httpsListenerMap.Delete(value)
|
||||
https.hostIdCertMap.Delete(key)
|
||||
logs.Info("Listener 已释放")
|
||||
logs.Debug("Listener 已释放")
|
||||
}
|
||||
}
|
||||
}
|
||||
return true
|
||||
})
|
||||
|
||||
logs.Info("当前 Listener 连接数量", i)
|
||||
logs.Debug("当前 Listener 连接数量", i)
|
||||
|
||||
if cert, ok := https.hostIdCertMap.Load(host.Id); ok {
|
||||
if cert == certFileUrl {
|
||||
@@ -225,7 +259,7 @@ func (https *HttpsServer) handleHttps2(c net.Conn, hostName string, rb []byte, r
|
||||
logs.Warn(err.Error())
|
||||
}
|
||||
logs.Info("new https connection,clientId %d,host %s,remote address %s", host.Client.Id, r.Host, c.RemoteAddr().String())
|
||||
https.DealClient(conn.NewConn(c), host.Client, targetAddr, rb, common.CONN_TCP, nil, host.Client.Flow, host.Target.LocalProxy, nil)
|
||||
https.DealClient(conn.NewConn(c), host.Client, targetAddr, rb, common.CONN_TCP, nil, host.Client.Flow, host.Target.LocalProxy, nil, host)
|
||||
}
|
||||
|
||||
// close
|
||||
@@ -268,7 +302,7 @@ func (https *HttpsServer) handleHttps(c net.Conn) {
|
||||
logs.Warn(err.Error())
|
||||
}
|
||||
logs.Trace("new https connection,clientId %d,host %s,remote address %s", host.Client.Id, r.Host, c.RemoteAddr().String())
|
||||
https.DealClient(conn.NewConn(c), host.Client, targetAddr, rb, common.CONN_TCP, nil, host.Client.Flow, host.Target.LocalProxy, nil)
|
||||
https.DealClient(conn.NewConn(c), host.Client, targetAddr, rb, common.CONN_TCP, nil, host.Client.Flow, host.Target.LocalProxy, nil, host)
|
||||
}
|
||||
|
||||
type HttpsListener struct {
|
||||
@@ -300,27 +334,41 @@ func (httpsListener *HttpsListener) Addr() net.Addr {
|
||||
return httpsListener.parentListener.Addr()
|
||||
}
|
||||
|
||||
// get server name from connection by read client hello bytes
|
||||
// get server name from connection by read full client hello bytes
|
||||
func GetServerNameFromClientHello(c net.Conn) (string, []byte) {
|
||||
buf := make([]byte, 4096)
|
||||
data := make([]byte, 4096)
|
||||
n, err := c.Read(buf)
|
||||
header := make([]byte, 5)
|
||||
headerN, err := io.ReadFull(c, header)
|
||||
if err != nil {
|
||||
return "", nil
|
||||
return "", header[:headerN]
|
||||
}
|
||||
if n < 42 {
|
||||
return "", nil
|
||||
if header[0] != 0x16 {
|
||||
return "", header
|
||||
}
|
||||
copy(data, buf[:n])
|
||||
recordLen := int(header[3])<<8 | int(header[4])
|
||||
if recordLen <= 0 || recordLen > 16384 {
|
||||
return "", header
|
||||
}
|
||||
|
||||
body := make([]byte, recordLen)
|
||||
bodyN, err := io.ReadFull(c, body)
|
||||
if err != nil {
|
||||
return "", append(header, body[:bodyN]...)
|
||||
}
|
||||
|
||||
rawBytes := append(header, body...)
|
||||
clientHello := new(crypt.ClientHelloMsg)
|
||||
clientHello.Unmarshal(data[5:n])
|
||||
return clientHello.GetServerName(), buf[:n]
|
||||
if !clientHello.Unmarshal(body) {
|
||||
return "", rawBytes
|
||||
}
|
||||
return clientHello.GetServerName(), rawBytes
|
||||
}
|
||||
|
||||
// build https request
|
||||
// build https request for SNI-based host lookup.
|
||||
// RequestURI is set to "*" to skip Location filtering in GetInfoByHost,
|
||||
// because at TLS handshake stage the actual HTTP request path is unknown.
|
||||
func buildHttpsRequest(hostName string) *http.Request {
|
||||
r := new(http.Request)
|
||||
r.RequestURI = "/"
|
||||
r.RequestURI = "*"
|
||||
r.URL = new(url.URL)
|
||||
r.URL.Scheme = "https"
|
||||
r.Host = hostName
|
||||
|
||||
+68
-14
@@ -108,22 +108,47 @@ func (s *Sock5ModeServer) sendReply(c net.Conn, rep uint8) {
|
||||
// do conn
|
||||
func (s *Sock5ModeServer) doConnect(c net.Conn, command uint8) {
|
||||
addrType := make([]byte, 1)
|
||||
c.Read(addrType)
|
||||
if _, err := io.ReadFull(c, addrType); err != nil {
|
||||
logs.Warn("read addr type error", err)
|
||||
s.sendReply(c, serverFailure)
|
||||
c.Close()
|
||||
return
|
||||
}
|
||||
var host string
|
||||
switch addrType[0] {
|
||||
case ipV4:
|
||||
ipv4 := make(net.IP, net.IPv4len)
|
||||
c.Read(ipv4)
|
||||
if _, err := io.ReadFull(c, ipv4); err != nil {
|
||||
logs.Warn("read ipv4 error", err)
|
||||
s.sendReply(c, serverFailure)
|
||||
c.Close()
|
||||
return
|
||||
}
|
||||
host = ipv4.String()
|
||||
case ipV6:
|
||||
ipv6 := make(net.IP, net.IPv6len)
|
||||
c.Read(ipv6)
|
||||
if _, err := io.ReadFull(c, ipv6); err != nil {
|
||||
logs.Warn("read ipv6 error", err)
|
||||
s.sendReply(c, serverFailure)
|
||||
c.Close()
|
||||
return
|
||||
}
|
||||
host = ipv6.String()
|
||||
case domainName:
|
||||
var domainLen uint8
|
||||
binary.Read(c, binary.BigEndian, &domainLen)
|
||||
if err := binary.Read(c, binary.BigEndian, &domainLen); err != nil {
|
||||
logs.Warn("read domain len error", err)
|
||||
s.sendReply(c, serverFailure)
|
||||
c.Close()
|
||||
return
|
||||
}
|
||||
domain := make([]byte, domainLen)
|
||||
c.Read(domain)
|
||||
if _, err := io.ReadFull(c, domain); err != nil {
|
||||
logs.Warn("read domain error", err)
|
||||
s.sendReply(c, serverFailure)
|
||||
c.Close()
|
||||
return
|
||||
}
|
||||
host = string(domain)
|
||||
default:
|
||||
s.sendReply(c, addrTypeNotSupported)
|
||||
@@ -131,7 +156,12 @@ func (s *Sock5ModeServer) doConnect(c net.Conn, command uint8) {
|
||||
}
|
||||
|
||||
var port uint16
|
||||
binary.Read(c, binary.BigEndian, &port)
|
||||
if err := binary.Read(c, binary.BigEndian, &port); err != nil {
|
||||
logs.Warn("read port error", err)
|
||||
s.sendReply(c, serverFailure)
|
||||
c.Close()
|
||||
return
|
||||
}
|
||||
// connect to host
|
||||
addr := net.JoinHostPort(host, strconv.Itoa(int(port)))
|
||||
var ltype string
|
||||
@@ -142,7 +172,7 @@ func (s *Sock5ModeServer) doConnect(c net.Conn, command uint8) {
|
||||
}
|
||||
s.DealClient(conn.NewConn(c), s.task.Client, addr, nil, ltype, func() {
|
||||
s.sendReply(c, succeeded)
|
||||
}, s.task.Flow, s.task.Target.LocalProxy, nil)
|
||||
}, s.task.Flow, s.task.Target.LocalProxy, nil, nil)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -176,22 +206,42 @@ func (s *Sock5ModeServer) sendUdpReply(writeConn net.Conn, c net.Conn, rep uint8
|
||||
func (s *Sock5ModeServer) handleUDP(c net.Conn) {
|
||||
defer c.Close()
|
||||
addrType := make([]byte, 1)
|
||||
c.Read(addrType)
|
||||
if _, err := io.ReadFull(c, addrType); err != nil {
|
||||
logs.Warn("read addr type error", err)
|
||||
s.sendReply(c, serverFailure)
|
||||
return
|
||||
}
|
||||
var host string
|
||||
switch addrType[0] {
|
||||
case ipV4:
|
||||
ipv4 := make(net.IP, net.IPv4len)
|
||||
c.Read(ipv4)
|
||||
if _, err := io.ReadFull(c, ipv4); err != nil {
|
||||
logs.Warn("read ipv4 error", err)
|
||||
s.sendReply(c, serverFailure)
|
||||
return
|
||||
}
|
||||
host = ipv4.String()
|
||||
case ipV6:
|
||||
ipv6 := make(net.IP, net.IPv6len)
|
||||
c.Read(ipv6)
|
||||
if _, err := io.ReadFull(c, ipv6); err != nil {
|
||||
logs.Warn("read ipv6 error", err)
|
||||
s.sendReply(c, serverFailure)
|
||||
return
|
||||
}
|
||||
host = ipv6.String()
|
||||
case domainName:
|
||||
var domainLen uint8
|
||||
binary.Read(c, binary.BigEndian, &domainLen)
|
||||
if err := binary.Read(c, binary.BigEndian, &domainLen); err != nil {
|
||||
logs.Warn("read domain len error", err)
|
||||
s.sendReply(c, serverFailure)
|
||||
return
|
||||
}
|
||||
domain := make([]byte, domainLen)
|
||||
c.Read(domain)
|
||||
if _, err := io.ReadFull(c, domain); err != nil {
|
||||
logs.Warn("read domain error", err)
|
||||
s.sendReply(c, serverFailure)
|
||||
return
|
||||
}
|
||||
host = string(domain)
|
||||
default:
|
||||
s.sendReply(c, addrTypeNotSupported)
|
||||
@@ -199,8 +249,12 @@ func (s *Sock5ModeServer) handleUDP(c net.Conn) {
|
||||
}
|
||||
//读取端口
|
||||
var port uint16
|
||||
binary.Read(c, binary.BigEndian, &port)
|
||||
logs.Warn(host, string(port))
|
||||
if err := binary.Read(c, binary.BigEndian, &port); err != nil {
|
||||
logs.Warn("read port error", err)
|
||||
s.sendReply(c, serverFailure)
|
||||
return
|
||||
}
|
||||
logs.Warn(host, strconv.Itoa(int(port)))
|
||||
replyAddr, err := net.ResolveUDPAddr("udp", s.task.ServerIp+":0")
|
||||
if err != nil {
|
||||
logs.Error("build local reply addr error", err)
|
||||
|
||||
+13
-11
@@ -1,3 +1,6 @@
|
||||
//go:build !npcgui
|
||||
// +build !npcgui
|
||||
|
||||
package proxy
|
||||
|
||||
import (
|
||||
@@ -22,7 +25,7 @@ type TunnelModeServer struct {
|
||||
listener net.Listener
|
||||
}
|
||||
|
||||
//tcp|http|host
|
||||
// tcp|http|host
|
||||
func NewTunnelModeServer(process process, bridge NetBridge, task *file.Tunnel) *TunnelModeServer {
|
||||
s := new(TunnelModeServer)
|
||||
s.bridge = bridge
|
||||
@@ -31,7 +34,7 @@ func NewTunnelModeServer(process process, bridge NetBridge, task *file.Tunnel) *
|
||||
return s
|
||||
}
|
||||
|
||||
//开始
|
||||
// 开始
|
||||
func (s *TunnelModeServer) Start() error {
|
||||
return conn.NewTcpListenerAndProcess(s.task.ServerIp+":"+strconv.Itoa(s.task.Port), func(c net.Conn) {
|
||||
if err := s.CheckFlowAndConnNum(s.task.Client); err != nil {
|
||||
@@ -45,17 +48,17 @@ func (s *TunnelModeServer) Start() error {
|
||||
}, &s.listener)
|
||||
}
|
||||
|
||||
//close
|
||||
// close
|
||||
func (s *TunnelModeServer) Close() error {
|
||||
return s.listener.Close()
|
||||
}
|
||||
|
||||
//web管理方式
|
||||
// web管理方式
|
||||
type WebServer struct {
|
||||
BaseServer
|
||||
}
|
||||
|
||||
//开始
|
||||
// 开始
|
||||
func (s *WebServer) Start() error {
|
||||
p, _ := beego.AppConfig.Int("web_port")
|
||||
if p == 0 {
|
||||
@@ -86,7 +89,7 @@ func (s *WebServer) Close() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
//new
|
||||
// new
|
||||
func NewWebServer(bridge *bridge.Bridge) *WebServer {
|
||||
s := new(WebServer)
|
||||
s.bridge = bridge
|
||||
@@ -95,7 +98,7 @@ func NewWebServer(bridge *bridge.Bridge) *WebServer {
|
||||
|
||||
type process func(c *conn.Conn, s *TunnelModeServer) error
|
||||
|
||||
//tcp proxy
|
||||
// tcp proxy
|
||||
func ProcessTunnel(c *conn.Conn, s *TunnelModeServer) error {
|
||||
targetAddr, err := s.task.Target.GetRandomTarget()
|
||||
if err != nil {
|
||||
@@ -103,11 +106,10 @@ func ProcessTunnel(c *conn.Conn, s *TunnelModeServer) error {
|
||||
logs.Warn("tcp port %d ,client id %d,task id %d connect error %s", s.task.Port, s.task.Client.Id, s.task.Id, err.Error())
|
||||
return err
|
||||
}
|
||||
|
||||
return s.DealClient(c, s.task.Client, targetAddr, nil, common.CONN_TCP, nil, s.task.Client.Flow, s.task.Target.LocalProxy, s.task)
|
||||
return s.DealClient(c, s.task.Client, targetAddr, nil, common.CONN_TCP, nil, s.task.Client.Flow, s.task.Target.LocalProxy, s.task, nil)
|
||||
}
|
||||
|
||||
//http proxy
|
||||
// http proxy
|
||||
func ProcessHttp(c *conn.Conn, s *TunnelModeServer) error {
|
||||
|
||||
_, addr, rb, err, r := c.GetHost()
|
||||
@@ -123,6 +125,6 @@ func ProcessHttp(c *conn.Conn, s *TunnelModeServer) error {
|
||||
if err := s.auth(r, c, s.task.Client.Cnf.U, s.task.Client.Cnf.P); err != nil {
|
||||
return err
|
||||
}
|
||||
return s.DealClient(c, s.task.Client, addr, rb, common.CONN_TCP, nil, s.task.Client.Flow, s.task.Target.LocalProxy, nil)
|
||||
return s.DealClient(c, s.task.Client, addr, rb, common.CONN_TCP, nil, s.task.Client.Flow, s.task.Target.LocalProxy, nil, nil)
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
package proxy
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"io"
|
||||
"net"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"ehang.io/nps/lib/common"
|
||||
"ehang.io/nps/lib/conn"
|
||||
"ehang.io/nps/lib/file"
|
||||
)
|
||||
|
||||
type tunnelTestBridge struct {
|
||||
target net.Conn
|
||||
}
|
||||
|
||||
func (b *tunnelTestBridge) SendLinkInfo(clientId int, link *conn.Link, t *file.Tunnel) (net.Conn, error) {
|
||||
return b.target, nil
|
||||
}
|
||||
|
||||
func TestProcessTunnelForwardsBufferedBytesWhenAuthProbeFails(t *testing.T) {
|
||||
confPath := t.TempDir()
|
||||
confDir := filepath.Join(confPath, "conf")
|
||||
if err := os.MkdirAll(confDir, 0755); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
for _, name := range []string{"clients.json", "tasks.json", "hosts.json"} {
|
||||
if err := os.WriteFile(filepath.Join(confDir, name), nil, 0644); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
oldConfPath := common.ConfPath
|
||||
common.ConfPath = confPath
|
||||
t.Cleanup(func() {
|
||||
common.ConfPath = oldConfPath
|
||||
})
|
||||
|
||||
clientConn, serverConn := net.Pipe()
|
||||
defer clientConn.Close()
|
||||
defer serverConn.Close()
|
||||
|
||||
targetClient, targetServer := net.Pipe()
|
||||
defer targetClient.Close()
|
||||
defer targetServer.Close()
|
||||
|
||||
client := file.NewClient("test", true, true)
|
||||
client.Id = 1
|
||||
client.Cnf.U = "user"
|
||||
client.Cnf.P = "pass"
|
||||
task := &file.Tunnel{
|
||||
Id: 1,
|
||||
Client: client,
|
||||
Target: &file.Target{
|
||||
TargetStr: "127.0.0.1:22",
|
||||
},
|
||||
}
|
||||
server := NewTunnelModeServer(ProcessTunnel, &tunnelTestBridge{target: targetServer}, task)
|
||||
|
||||
done := make(chan error, 1)
|
||||
go func() {
|
||||
done <- ProcessTunnel(conn.NewConn(serverConn), server)
|
||||
}()
|
||||
|
||||
payload := []byte("SSH-2.0-OpenSSH_9.0\r\n")
|
||||
if _, err := clientConn.Write(payload); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if err := targetClient.SetReadDeadline(time.Now().Add(time.Second)); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
got := make([]byte, len(payload))
|
||||
if _, err := io.ReadFull(targetClient, got); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if !bytes.Equal(got, payload) {
|
||||
t.Fatalf("expected forwarded payload %q, got %q", payload, got)
|
||||
}
|
||||
|
||||
clientConn.Close()
|
||||
targetClient.Close()
|
||||
select {
|
||||
case err := <-done:
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
case <-time.After(time.Second):
|
||||
t.Fatal("ProcessTunnel did not exit after connections closed")
|
||||
}
|
||||
}
|
||||
@@ -16,7 +16,7 @@ func HandleTrans(c *conn.Conn, s *TunnelModeServer) error {
|
||||
if addr, err := getAddress(c.Conn); err != nil {
|
||||
return err
|
||||
} else {
|
||||
return s.DealClient(c, s.task.Client, addr, nil, common.CONN_TCP, nil, s.task.Flow, s.task.Target.LocalProxy, nil)
|
||||
return s.DealClient(c, s.task.Client, addr, nil, common.CONN_TCP, nil, s.task.Flow, s.task.Target.LocalProxy, nil, nil)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+198
-56
@@ -5,6 +5,7 @@ import (
|
||||
"net"
|
||||
"strings"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"ehang.io/nps/bridge"
|
||||
@@ -14,20 +15,51 @@ import (
|
||||
"github.com/astaxie/beego/logs"
|
||||
)
|
||||
|
||||
const (
|
||||
udpSessionIdleTimeout = 120 * time.Second
|
||||
udpSweepInterval = 30 * time.Second
|
||||
udpReadDeadline = 60 * time.Second
|
||||
udpBuildTimeout = 5 * time.Second
|
||||
)
|
||||
|
||||
// udpSession 代表一个客户端 src addr ↔ npc 之间的 UDP 转发会话。
|
||||
//
|
||||
// 同一个 src addr 在并发场景下可能被多个 goroutine 同时尝试建立会话。为避免
|
||||
// 重复建立,采用"原子占位"模式:第一个 goroutine 通过 sync.Map.LoadOrStore
|
||||
// 占位(此时 ready 通道未关闭),后续 goroutine 检测到占位后阻塞在 ready
|
||||
// 通道上等待会话就绪,然后复用同一个 target 转发数据。这样:
|
||||
// - 同一 src addr 始终只有 1 条到 npc 的 mux stream
|
||||
// - 只有"赢家"消耗一个 NowConn 配额,输家不再重复占用
|
||||
// - 避免了 race window 期间的 NowConn 配额泄漏
|
||||
type udpSession struct {
|
||||
target io.ReadWriteCloser // 用于 Read/Write 的封装层(可能含加密/压缩)
|
||||
rawConn net.Conn // 底层 mux conn,用于 SetReadDeadline
|
||||
lastActive int64 // 最近活跃时间(unix nano,原子读写)
|
||||
ready chan struct{} // 会话就绪后关闭;建立失败时也关闭
|
||||
err error // 建立失败时设置;ready 关闭后才允许读
|
||||
}
|
||||
|
||||
func (u *udpSession) touch() {
|
||||
atomic.StoreInt64(&u.lastActive, time.Now().UnixNano())
|
||||
}
|
||||
|
||||
type UdpModeServer struct {
|
||||
BaseServer
|
||||
addrMap sync.Map
|
||||
listener *net.UDPConn
|
||||
addrMap sync.Map
|
||||
listener *net.UDPConn
|
||||
closeOnce sync.Once
|
||||
closeCh chan struct{}
|
||||
}
|
||||
|
||||
func NewUdpModeServer(bridge *bridge.Bridge, task *file.Tunnel) *UdpModeServer {
|
||||
s := new(UdpModeServer)
|
||||
s.bridge = bridge
|
||||
s.task = task
|
||||
s.closeCh = make(chan struct{})
|
||||
return s
|
||||
}
|
||||
|
||||
// 开始
|
||||
// Start 启动 UDP 监听,主循环只负责快速收包并分发,不做任何耗时操作。
|
||||
func (s *UdpModeServer) Start() error {
|
||||
var err error
|
||||
if s.task.ServerIp == "" {
|
||||
@@ -37,90 +69,200 @@ func (s *UdpModeServer) Start() error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
go s.sweeper()
|
||||
for {
|
||||
buf := common.BufPoolUdp.Get().([]byte)
|
||||
n, addr, err := s.listener.ReadFromUDP(buf)
|
||||
if err != nil {
|
||||
common.BufPoolUdp.Put(buf)
|
||||
if strings.Contains(err.Error(), "use of closed network connection") {
|
||||
break
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
||||
// 判断访问地址是否在全局黑名单内
|
||||
if IsGlobalBlackIp(addr.String()) {
|
||||
break
|
||||
common.BufPoolUdp.Put(buf)
|
||||
continue
|
||||
}
|
||||
|
||||
// 判断访问地址是否在黑名单内
|
||||
if common.IsBlackIp(addr.String(), s.task.Client.VerifyKey, s.task.Client.BlackIpList) {
|
||||
break
|
||||
common.BufPoolUdp.Put(buf)
|
||||
continue
|
||||
}
|
||||
|
||||
logs.Trace("New udp connection,client %d,remote address %s", s.task.Client.Id, addr)
|
||||
go s.process(addr, buf[:n])
|
||||
go s.process(addr, buf, n)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *UdpModeServer) process(addr *net.UDPAddr, data []byte) {
|
||||
if v, ok := s.addrMap.Load(addr.String()); ok {
|
||||
clientConn, ok := v.(io.ReadWriteCloser)
|
||||
if ok {
|
||||
_, err := clientConn.Write(data)
|
||||
if err != nil {
|
||||
logs.Warn(err)
|
||||
// process 处理单个 UDP 包。函数持有 buf 的所有权,所有路径必须归还。
|
||||
func (s *UdpModeServer) process(addr *net.UDPAddr, buf []byte, n int) {
|
||||
key := addr.String()
|
||||
data := buf[:n]
|
||||
|
||||
// 快路径:会话已存在
|
||||
if v, ok := s.addrMap.Load(key); ok {
|
||||
s.dispatch(key, v.(*udpSession), data, n)
|
||||
common.BufPoolUdp.Put(buf)
|
||||
return
|
||||
}
|
||||
|
||||
// 慢路径:尝试成为该 key 的"会话建立者"
|
||||
placeholder := &udpSession{ready: make(chan struct{})}
|
||||
placeholder.touch()
|
||||
if existing, loaded := s.addrMap.LoadOrStore(key, placeholder); loaded {
|
||||
// 输了占位竞争,等赢家把会话建好后复用
|
||||
s.dispatch(key, existing.(*udpSession), data, n)
|
||||
common.BufPoolUdp.Put(buf)
|
||||
return
|
||||
}
|
||||
|
||||
// 赢得占位 —— 我去建立会话
|
||||
s.runSession(addr, key, placeholder, buf, n)
|
||||
}
|
||||
|
||||
// dispatch 把数据写入 sess.target。若 sess 仍在建立中则阻塞等待,超时则丢包。
|
||||
func (s *UdpModeServer) dispatch(key string, sess *udpSession, data []byte, n int) {
|
||||
if sess.ready != nil {
|
||||
select {
|
||||
case <-sess.ready:
|
||||
if sess.err != nil {
|
||||
logs.Trace("udp session build failed for %s: %v", key, sess.err)
|
||||
return
|
||||
}
|
||||
s.task.Client.Flow.Add(int64(len(data)), int64(len(data)))
|
||||
}
|
||||
} else {
|
||||
if err := s.CheckFlowAndConnNum(s.task.Client); err != nil {
|
||||
logs.Warn("client id %d, task id %d,error %s, when udp connection", s.task.Client.Id, s.task.Id, err.Error())
|
||||
case <-time.After(udpBuildTimeout):
|
||||
logs.Warn("udp session build timeout for %s, drop packet", key)
|
||||
return
|
||||
case <-s.closeCh:
|
||||
return
|
||||
}
|
||||
defer s.task.Client.AddConn()
|
||||
link := conn.NewLink(common.CONN_UDP, s.task.Target.TargetStr, s.task.Client.Cnf.Crypt, s.task.Client.Cnf.Compress, addr.String(), s.task.Target.LocalProxy, "")
|
||||
if clientConn, err := s.bridge.SendLinkInfo(s.task.Client.Id, link, s.task); err != nil {
|
||||
}
|
||||
if _, err := sess.target.Write(data); err != nil {
|
||||
logs.Warn(err)
|
||||
s.removeSession(key, sess)
|
||||
return
|
||||
}
|
||||
sess.touch()
|
||||
s.task.Client.Flow.Add(int64(n), int64(n))
|
||||
s.task.Flow.Add(int64(n), int64(n))
|
||||
}
|
||||
|
||||
// runSession 由占位赢家执行:建立到 npc 的 stream、发送首包、运行下行读循环。
|
||||
// buf 由本函数负责归还。
|
||||
func (s *UdpModeServer) runSession(addr *net.UDPAddr, key string, sess *udpSession, buf []byte, n int) {
|
||||
data := buf[:n]
|
||||
|
||||
// 失败时统一清理:关 ready 通道唤醒所有输家、删占位、归还 buf。
|
||||
failBuild := func(err error) {
|
||||
sess.err = err
|
||||
close(sess.ready)
|
||||
s.addrMap.Delete(key)
|
||||
common.BufPoolUdp.Put(buf)
|
||||
}
|
||||
|
||||
if err := s.CheckFlowAndConnNum(s.task.Client); err != nil {
|
||||
logs.Warn("client id %d, task id %d,error %s, when udp connection", s.task.Client.Id, s.task.Id, err.Error())
|
||||
failBuild(err)
|
||||
return
|
||||
}
|
||||
// 只有赢家消耗 NowConn 配额,函数返回时释放。
|
||||
defer s.task.Client.AddConn()
|
||||
|
||||
link := conn.NewLink(common.CONN_UDP, s.task.Target.TargetStr, s.task.Client.Cnf.Crypt, s.task.Client.Cnf.Compress, addr.String(), s.task.Target.LocalProxy, "")
|
||||
clientConn, err := s.bridge.SendLinkInfo(s.task.Client.Id, link, s.task)
|
||||
if err != nil {
|
||||
failBuild(err)
|
||||
return
|
||||
}
|
||||
|
||||
target := conn.GetConn(clientConn, s.task.Client.Cnf.Crypt, s.task.Client.Cnf.Compress, nil, true)
|
||||
sess.target = target
|
||||
sess.rawConn = clientConn
|
||||
sess.touch()
|
||||
close(sess.ready) // 唤醒所有等待该会话的输家
|
||||
|
||||
defer s.removeSession(key, sess)
|
||||
|
||||
logs.Trace("New udp connection,client %d,remote address %s", s.task.Client.Id, addr)
|
||||
|
||||
if _, err := target.Write(data); err != nil {
|
||||
logs.Warn(err)
|
||||
common.BufPoolUdp.Put(buf)
|
||||
return
|
||||
}
|
||||
common.BufPoolUdp.Put(buf)
|
||||
s.task.Client.Flow.Add(int64(n), int64(n))
|
||||
s.task.Flow.Add(int64(n), int64(n))
|
||||
|
||||
// 下行读循环
|
||||
rbuf := common.BufPoolUdp.Get().([]byte)
|
||||
defer common.BufPoolUdp.Put(rbuf)
|
||||
|
||||
for {
|
||||
// 设到 rawConn 上:mux stream 的 SetReadDeadline 是底层 net.Conn 实现,
|
||||
// 比设在加密/压缩包装层 target 上更可靠。
|
||||
clientConn.SetReadDeadline(time.Now().Add(udpReadDeadline))
|
||||
rn, err := target.Read(rbuf)
|
||||
if err != nil {
|
||||
// sweeper 主动 Close、idle deadline 触发、或对端断开都会落到这里
|
||||
return
|
||||
} else {
|
||||
target := conn.GetConn(clientConn, s.task.Client.Cnf.Crypt, s.task.Client.Cnf.Compress, nil, true)
|
||||
s.addrMap.Store(addr.String(), target)
|
||||
defer target.Close()
|
||||
}
|
||||
sess.touch()
|
||||
if _, err := s.listener.WriteTo(rbuf[:rn], addr); err != nil {
|
||||
logs.Warn(err)
|
||||
return
|
||||
}
|
||||
s.task.Client.Flow.Add(int64(rn), int64(rn))
|
||||
s.task.Flow.Add(int64(rn), int64(rn))
|
||||
}
|
||||
}
|
||||
|
||||
_, err := target.Write(data)
|
||||
if err != nil {
|
||||
logs.Warn(err)
|
||||
return
|
||||
}
|
||||
// removeSession 安全地从 addrMap 移除并关闭会话。
|
||||
// 用 == 比对避免误删被替换的新 session(虽然当前协议不会发生,但保持防御性)。
|
||||
func (s *UdpModeServer) removeSession(key string, sess *udpSession) {
|
||||
if v, ok := s.addrMap.Load(key); ok && v.(*udpSession) == sess {
|
||||
s.addrMap.Delete(key)
|
||||
}
|
||||
if sess.target != nil {
|
||||
sess.target.Close()
|
||||
}
|
||||
}
|
||||
|
||||
buf := common.BufPoolUdp.Get().([]byte)
|
||||
defer common.BufPoolUdp.Put(buf)
|
||||
|
||||
s.task.Client.Flow.Add(int64(len(data)), int64(len(data)))
|
||||
for {
|
||||
clientConn.SetReadDeadline(time.Now().Add(time.Duration(60) * time.Second))
|
||||
if n, err := target.Read(buf); err != nil {
|
||||
s.addrMap.Delete(addr.String())
|
||||
logs.Warn(err)
|
||||
return
|
||||
} else {
|
||||
_, err := s.listener.WriteTo(buf[:n], addr)
|
||||
if err != nil {
|
||||
logs.Warn(err)
|
||||
return
|
||||
}
|
||||
s.task.Client.Flow.Add(int64(n), int64(n))
|
||||
// sweeper 周期性扫描 addrMap,把空闲超过 udpSessionIdleTimeout 的会话清掉。
|
||||
// 关闭 target 会让阻塞中的 target.Read 立即返回错误,让对应的 runSession
|
||||
// 走 defer 链路自然退出(释放 NowConn 配额、删 addrMap 条目)。
|
||||
func (s *UdpModeServer) sweeper() {
|
||||
ticker := time.NewTicker(udpSweepInterval)
|
||||
defer ticker.Stop()
|
||||
idleNs := int64(udpSessionIdleTimeout)
|
||||
for {
|
||||
select {
|
||||
case <-s.closeCh:
|
||||
return
|
||||
case <-ticker.C:
|
||||
now := time.Now().UnixNano()
|
||||
s.addrMap.Range(func(k, v interface{}) bool {
|
||||
sess := v.(*udpSession)
|
||||
// 跳过仍在建立中的占位(target 尚未填充)
|
||||
if sess.target == nil {
|
||||
return true
|
||||
}
|
||||
//if err := s.CheckFlowAndConnNum(s.task.Client); err != nil {
|
||||
// logs.Warn("client id %d, task id %d,error %s, when udp connection", s.task.Client.Id, s.task.Id, err.Error())
|
||||
// return
|
||||
//}
|
||||
}
|
||||
if now-atomic.LoadInt64(&sess.lastActive) > idleNs {
|
||||
s.removeSession(k.(string), sess)
|
||||
}
|
||||
return true
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (s *UdpModeServer) Close() error {
|
||||
s.closeOnce.Do(func() {
|
||||
close(s.closeCh)
|
||||
})
|
||||
s.addrMap.Range(func(k, v interface{}) bool {
|
||||
s.removeSession(k.(string), v.(*udpSession))
|
||||
return true
|
||||
})
|
||||
return s.listener.Close()
|
||||
}
|
||||
|
||||
@@ -99,8 +99,8 @@ func NewHttpReverseProxy(s *httpServer) *HttpReverseProxy {
|
||||
local, _ := net.ResolveTCPAddr("tcp", "127.0.0.1")
|
||||
proxy := NewReverseProxy(&httputil.ReverseProxy{
|
||||
Director: func(r *http.Request) {
|
||||
host := r.Context().Value("host").(*file.Host)
|
||||
common.ChangeHostAndHeader(r, host.HostChange, host.HeaderChange, "")
|
||||
//host := r.Context().Value("host").(*file.Host)
|
||||
//common.ChangeHostAndHeader(r, host.HostChange, host.HeaderChange, "")
|
||||
},
|
||||
Transport: &http.Transport{
|
||||
ResponseHeaderTimeout: rp.responseHeaderTimeout,
|
||||
@@ -257,7 +257,7 @@ func Join(c1 io.ReadWriteCloser, c2 io.ReadWriteCloser, host *file.Host) (inCoun
|
||||
defer to.Close()
|
||||
defer from.Close()
|
||||
defer wait.Done()
|
||||
goroutine.CopyBuffer(to, from, host.Client.Flow, nil, "")
|
||||
goroutine.CopyBuffer(to, from, host.Client.Flow, nil, host, "")
|
||||
//*count, _ = io.Copy(to, from)
|
||||
}
|
||||
|
||||
|
||||
+93
-87
@@ -57,7 +57,7 @@ func DealBridgeTask() {
|
||||
for {
|
||||
select {
|
||||
case t := <-Bridge.OpenTask:
|
||||
AddTask(t)
|
||||
StartTask(t.Id)
|
||||
case t := <-Bridge.CloseTask:
|
||||
StopServer(t.Id)
|
||||
case id := <-Bridge.CloseClient:
|
||||
@@ -67,13 +67,11 @@ func DealBridgeTask() {
|
||||
file.GetDb().DelClient(id)
|
||||
}
|
||||
}
|
||||
case tunnel := <-Bridge.OpenTask:
|
||||
StartTask(tunnel.Id)
|
||||
case s := <-Bridge.SecretChan:
|
||||
logs.Trace("New secret connection, addr", s.Conn.Conn.RemoteAddr())
|
||||
if t := file.GetDb().GetTaskByMd5Password(s.Password); t != nil {
|
||||
if t.Status {
|
||||
go proxy.NewBaseServer(Bridge, t).DealClient(s.Conn, t.Client, t.Target.TargetStr, nil, common.CONN_TCP, nil, t.Flow, t.Target.LocalProxy, nil)
|
||||
go proxy.NewBaseServer(Bridge, t).DealClient(s.Conn, t.Client, t.Target.TargetStr, nil, common.CONN_TCP, nil, t.Flow, t.Target.LocalProxy, nil, nil)
|
||||
} else {
|
||||
s.Conn.Close()
|
||||
logs.Trace("This key %s cannot be processed,status is close", s.Password)
|
||||
@@ -89,6 +87,12 @@ func DealBridgeTask() {
|
||||
// start a new server
|
||||
func StartNewServer(bridgePort int, cnf *file.Tunnel, bridgeType string, bridgeDisconnect int) {
|
||||
Bridge = bridge.NewTunnel(bridgePort, bridgeType, common.GetBoolByStr(beego.AppConfig.String("ip_limit")), RunList, bridgeDisconnect)
|
||||
// 启动流量持久化(只启动一次,避免每次 AddTask 创建泄漏的 goroutine)
|
||||
if minute, err := beego.AppConfig.Int("flow_store_interval"); err == nil && minute > 0 {
|
||||
go flowSession(time.Minute * time.Duration(minute))
|
||||
}
|
||||
// 启动后台 IO 速率采集,Dashboard 直接读缓存,无需 Sleep
|
||||
tool.StartIORateCollector()
|
||||
go func() {
|
||||
if err := Bridge.StartTunnel(); err != nil {
|
||||
logs.Error("start server bridge error", err)
|
||||
@@ -102,6 +106,7 @@ func StartNewServer(bridgePort int, cnf *file.Tunnel, bridgeType string, bridgeD
|
||||
}
|
||||
go DealBridgeTask()
|
||||
go dealClientFlow()
|
||||
go dealClientExpire()
|
||||
if svr := NewMode(Bridge, cnf); svr != nil {
|
||||
if err := svr.Start(); err != nil {
|
||||
logs.Error(err)
|
||||
@@ -124,6 +129,50 @@ func dealClientFlow() {
|
||||
}
|
||||
}
|
||||
|
||||
// dealClientExpire 周期性扫描客户端到期时间,过期则自动暂停
|
||||
func dealClientExpire() {
|
||||
// 启动时立即检查一次,避免重启后到期客户端最多 1 分钟内才被暂停
|
||||
checkClientExpire()
|
||||
ticker := time.NewTicker(time.Minute)
|
||||
defer ticker.Stop()
|
||||
for {
|
||||
select {
|
||||
case <-ticker.C:
|
||||
checkClientExpire()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// checkClientExpire 遍历所有客户端,若 ExpireTime 已过则将 Status 置为 false 并断开连接
|
||||
func checkClientExpire() {
|
||||
now := time.Now()
|
||||
changed := false
|
||||
file.GetDb().JsonDb.Clients.Range(func(key, value interface{}) bool {
|
||||
v, ok := value.(*file.Client)
|
||||
if !ok || v == nil {
|
||||
return true
|
||||
}
|
||||
if v.ExpireTime == "" || !v.Status {
|
||||
return true
|
||||
}
|
||||
t, err := time.ParseInLocation("2006-01-02 15:04:05", v.ExpireTime, time.Local)
|
||||
if err != nil {
|
||||
return true
|
||||
}
|
||||
if now.Before(t) {
|
||||
return true
|
||||
}
|
||||
v.Status = false
|
||||
changed = true
|
||||
logs.Info("client id %d (remark: %s) expired at %s, auto paused", v.Id, v.Remark, v.ExpireTime)
|
||||
DelClientConnect(v.Id)
|
||||
return true
|
||||
})
|
||||
if changed {
|
||||
file.GetDb().JsonDb.StoreClientsToJsonFile()
|
||||
}
|
||||
}
|
||||
|
||||
// new a server by mode name
|
||||
func NewMode(Bridge *bridge.Bridge, c *file.Tunnel) proxy.Service {
|
||||
var service proxy.Service
|
||||
@@ -160,25 +209,20 @@ func NewMode(Bridge *bridge.Bridge, c *file.Tunnel) proxy.Service {
|
||||
|
||||
// stop server
|
||||
func StopServer(id int) error {
|
||||
//if v, ok := RunList[id]; ok {
|
||||
if v, ok := RunList.Load(id); ok {
|
||||
if svr, ok := v.(proxy.Service); ok {
|
||||
if err := svr.Close(); err != nil {
|
||||
return err
|
||||
logs.Error("stop server id %d error", id, err)
|
||||
}
|
||||
logs.Info("stop server id %d", id)
|
||||
} else {
|
||||
logs.Warn("stop server id %d error", id)
|
||||
}
|
||||
if t, err := file.GetDb().GetTask(id); err != nil {
|
||||
return err
|
||||
} else {
|
||||
RunList.Delete(id)
|
||||
if t, err := file.GetDb().GetTask(id); err == nil {
|
||||
t.Status = false
|
||||
logs.Info("close port %d,remark %s,client id %d,task id %d", t.Port, t.Remark, t.Client.Id, t.Id)
|
||||
file.GetDb().UpdateTask(t)
|
||||
}
|
||||
//delete(RunList, id)
|
||||
RunList.Delete(id)
|
||||
return nil
|
||||
}
|
||||
return errors.New("task is not running")
|
||||
@@ -196,9 +240,6 @@ func AddTask(t *file.Tunnel) error {
|
||||
logs.Error("taskId %d start error port %d open failed", t.Id, t.Port)
|
||||
return errors.New("the port open error")
|
||||
}
|
||||
if minute, err := beego.AppConfig.Int("flow_store_interval"); err == nil && minute > 0 {
|
||||
go flowSession(time.Minute * time.Duration(minute))
|
||||
}
|
||||
if svr := NewMode(Bridge, t); svr != nil {
|
||||
logs.Info("tunnel task %s start mode:%s port %d", t.Remark, t.Mode, t.Port)
|
||||
//RunList[t.Id] = svr
|
||||
@@ -245,18 +286,16 @@ func GetTunnel(start, length int, typeVal string, clientId int, search string, s
|
||||
all_list := make([]*file.Tunnel, 0) //store all Tunnel
|
||||
list := make([]*file.Tunnel, 0)
|
||||
var cnt int
|
||||
keys := file.GetMapKeys(file.GetDb().JsonDb.Tasks, false, "", "")
|
||||
|
||||
//get all Tunnel and sort
|
||||
for _, key := range keys {
|
||||
if value, ok := file.GetDb().JsonDb.Tasks.Load(key); ok {
|
||||
v := value.(*file.Tunnel)
|
||||
if (typeVal != "" && v.Mode != typeVal || (clientId != 0 && v.Client.Id != clientId)) || (typeVal == "" && clientId != v.Client.Id) {
|
||||
continue
|
||||
}
|
||||
all_list = append(all_list, v)
|
||||
// 单次遍历收集所有符合条件的 Tunnel(修复原代码双重遍历 sync.Map 的性能问题)
|
||||
file.GetDb().JsonDb.Tasks.Range(func(key, value interface{}) bool {
|
||||
v := value.(*file.Tunnel)
|
||||
if (typeVal != "" && v.Mode != typeVal || (clientId != 0 && v.Client.Id != clientId)) || (typeVal == "" && clientId != v.Client.Id) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
all_list = append(all_list, v)
|
||||
return true
|
||||
})
|
||||
//sort by Id, Remark, TargetStr, Port, asc or desc
|
||||
if sortField == "Id" {
|
||||
if order == "asc" {
|
||||
@@ -290,31 +329,25 @@ func GetTunnel(start, length int, typeVal string, clientId int, search string, s
|
||||
}
|
||||
}
|
||||
|
||||
//search
|
||||
for _, key := range all_list {
|
||||
if value, ok := file.GetDb().JsonDb.Tasks.Load(key.Id); ok {
|
||||
v := value.(*file.Tunnel)
|
||||
if (typeVal != "" && v.Mode != typeVal || (clientId != 0 && v.Client.Id != clientId)) || (typeVal == "" && clientId != v.Client.Id) {
|
||||
continue
|
||||
}
|
||||
if search != "" && !(v.Id == common.GetIntNoErrByStr(search) || v.Port == common.GetIntNoErrByStr(search) || strings.Contains(v.Password, search) || strings.Contains(v.Remark, search) || strings.Contains(v.Target.TargetStr, search)) {
|
||||
continue
|
||||
}
|
||||
cnt++
|
||||
if _, ok := Bridge.Client.Load(v.Client.Id); ok {
|
||||
v.Client.IsConnect = true
|
||||
} else {
|
||||
v.Client.IsConnect = false
|
||||
}
|
||||
if start--; start < 0 {
|
||||
if length--; length >= 0 {
|
||||
if _, ok := RunList.Load(v.Id); ok {
|
||||
v.RunStatus = true
|
||||
} else {
|
||||
v.RunStatus = false
|
||||
}
|
||||
list = append(list, v)
|
||||
//search and paginate(直接在已排序的列表上操作,避免二次 Load)
|
||||
for _, v := range all_list {
|
||||
if search != "" && !(v.Id == common.GetIntNoErrByStr(search) || v.Port == common.GetIntNoErrByStr(search) || strings.Contains(v.Password, search) || strings.Contains(v.Remark, search) || strings.Contains(v.Target.TargetStr, search)) {
|
||||
continue
|
||||
}
|
||||
cnt++
|
||||
if _, ok := Bridge.Client.Load(v.Client.Id); ok {
|
||||
v.Client.IsConnect = true
|
||||
} else {
|
||||
v.Client.IsConnect = false
|
||||
}
|
||||
if start--; start < 0 {
|
||||
if length--; length >= 0 {
|
||||
if _, ok := RunList.Load(v.Id); ok {
|
||||
v.RunStatus = true
|
||||
} else {
|
||||
v.RunStatus = false
|
||||
}
|
||||
list = append(list, v)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -329,7 +362,6 @@ func GetClientList(start, length int, search, sort, order string, clientId int)
|
||||
}
|
||||
|
||||
func dealClientData() {
|
||||
//logs.Info("dealClientData.........")
|
||||
|
||||
file.GetDb().JsonDb.Clients.Range(func(key, value interface{}) bool {
|
||||
v := value.(*file.Client)
|
||||
@@ -340,34 +372,7 @@ func dealClientData() {
|
||||
} else {
|
||||
v.IsConnect = false
|
||||
}
|
||||
//v.Flow.InletFlow = 0
|
||||
//v.Flow.ExportFlow = 0
|
||||
//if len(file.GetDb().JsonDb.Hosts) == 0 {
|
||||
//
|
||||
//}
|
||||
//var inflow int64 = 0
|
||||
//var outflow int64 = 0
|
||||
//file.GetDb().JsonDb.Hosts.Range(func(key, value interface{}) bool {
|
||||
// h := value.(*file.Host)
|
||||
// if h.Client.Id == v.Id {
|
||||
// inflow += h.Flow.InletFlow
|
||||
// outflow += h.Flow.ExportFlow
|
||||
// }
|
||||
// return true
|
||||
//})
|
||||
//file.GetDb().JsonDb.Tasks.Range(func(key, value interface{}) bool {
|
||||
// t := value.(*file.Tunnel)
|
||||
// if t.Client.Id == v.Id {
|
||||
// inflow += t.Flow.InletFlow
|
||||
// outflow += t.Flow.ExportFlow
|
||||
// }
|
||||
// return true
|
||||
//})
|
||||
//
|
||||
//if inflow >0 || outflow >0{
|
||||
// v.Flow.InletFlow = inflow
|
||||
// v.Flow.ExportFlow = outflow
|
||||
//}
|
||||
|
||||
return true
|
||||
})
|
||||
return
|
||||
@@ -485,25 +490,26 @@ func GetDashboardData() map[string]interface{} {
|
||||
data["swap_mem"] = math.Round(swap.UsedPercent)
|
||||
vir, _ := mem.VirtualMemory()
|
||||
data["virtual_mem"] = math.Round(vir.UsedPercent)
|
||||
conn, _ := net.ProtoCounters(nil)
|
||||
io1, _ := net.IOCounters(false)
|
||||
time.Sleep(time.Millisecond * 500)
|
||||
io2, _ := net.IOCounters(false)
|
||||
if len(io2) > 0 && len(io1) > 0 {
|
||||
data["io_send"] = (io2[0].BytesSent - io1[0].BytesSent) * 2
|
||||
data["io_recv"] = (io2[0].BytesRecv - io1[0].BytesRecv) * 2
|
||||
// IO 速率从后台缓存读取,无需 Sleep 500ms
|
||||
if cached, ok := tool.IORateCache.Load().(map[string]uint64); ok {
|
||||
data["io_send"] = cached["io_send"]
|
||||
data["io_recv"] = cached["io_recv"]
|
||||
}
|
||||
conn, _ := net.ProtoCounters(nil)
|
||||
for _, v := range conn {
|
||||
data[v.Protocol] = v.Stats["CurrEstab"]
|
||||
}
|
||||
//chart
|
||||
var fg int
|
||||
if len(tool.ServerStatus) >= 10 {
|
||||
fg = len(tool.ServerStatus) / 10
|
||||
tool.ServerStatusMu.RLock()
|
||||
statusLen := len(tool.ServerStatus)
|
||||
if statusLen >= 10 {
|
||||
fg = statusLen / 10
|
||||
for i := 0; i <= 9; i++ {
|
||||
data["sys"+strconv.Itoa(i+1)] = tool.ServerStatus[i*fg]
|
||||
}
|
||||
}
|
||||
tool.ServerStatusMu.RUnlock()
|
||||
return data
|
||||
}
|
||||
|
||||
|
||||
@@ -1,84 +0,0 @@
|
||||
package test
|
||||
|
||||
import (
|
||||
"log"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
|
||||
"ehang.io/nps/lib/common"
|
||||
"ehang.io/nps/lib/file"
|
||||
"github.com/astaxie/beego"
|
||||
)
|
||||
|
||||
func TestServerConfig() {
|
||||
var postTcpArr []int
|
||||
var postUdpArr []int
|
||||
file.GetDb().JsonDb.Tasks.Range(func(key, value interface{}) bool {
|
||||
v := value.(*file.Tunnel)
|
||||
if v.Mode == "udp" {
|
||||
isInArr(&postUdpArr, v.Port, v.Remark, "udp")
|
||||
} else if v.Port != 0 {
|
||||
|
||||
isInArr(&postTcpArr, v.Port, v.Remark, "tcp")
|
||||
}
|
||||
return true
|
||||
})
|
||||
p, err := beego.AppConfig.Int("web_port")
|
||||
if err != nil {
|
||||
log.Fatalln("Getting web management port error :", err)
|
||||
} else {
|
||||
isInArr(&postTcpArr, p, "Web Management port", "tcp")
|
||||
}
|
||||
|
||||
if p := beego.AppConfig.String("bridge_port"); p != "" {
|
||||
if port, err := strconv.Atoi(p); err != nil {
|
||||
log.Fatalln("get Server and client communication portserror:", err)
|
||||
} else if beego.AppConfig.String("bridge_type") == "kcp" {
|
||||
isInArr(&postUdpArr, port, "Server and client communication ports", "udp")
|
||||
} else {
|
||||
isInArr(&postTcpArr, port, "Server and client communication ports", "tcp")
|
||||
}
|
||||
}
|
||||
|
||||
if p := beego.AppConfig.String("httpProxyPort"); p != "" {
|
||||
if port, err := strconv.Atoi(p); err != nil {
|
||||
log.Fatalln("get http port error:", err)
|
||||
} else {
|
||||
isInArr(&postTcpArr, port, "https port", "tcp")
|
||||
}
|
||||
}
|
||||
if p := beego.AppConfig.String("https_proxy_port"); p != "" {
|
||||
if b, err := beego.AppConfig.Bool("https_just_proxy"); !(err == nil && b) {
|
||||
if port, err := strconv.Atoi(p); err != nil {
|
||||
log.Fatalln("get https port error", err)
|
||||
} else {
|
||||
if beego.AppConfig.String("pemPath") != "" && !common.FileExists(filepath.Join(common.GetRunPath(), beego.AppConfig.String("pemPath"))) {
|
||||
log.Fatalf("ssl certFile %s is not exist", beego.AppConfig.String("pemPath"))
|
||||
}
|
||||
if beego.AppConfig.String("keyPath") != "" && !common.FileExists(filepath.Join(common.GetRunPath(), beego.AppConfig.String("keyPath"))) {
|
||||
log.Fatalf("ssl keyFile %s is not exist", beego.AppConfig.String("pemPath"))
|
||||
}
|
||||
isInArr(&postTcpArr, port, "http port", "tcp")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func isInArr(arr *[]int, val int, remark string, tp string) {
|
||||
for _, v := range *arr {
|
||||
if v == val {
|
||||
log.Fatalf("the port %d is reused,remark: %s", val, remark)
|
||||
}
|
||||
}
|
||||
if tp == "tcp" {
|
||||
if !common.TestTcpPort(val) {
|
||||
log.Fatalf("open the %d port error ,remark: %s", val, remark)
|
||||
}
|
||||
} else {
|
||||
if !common.TestUdpPort(val) {
|
||||
log.Fatalf("open the %d port error ,remark: %s", val, remark)
|
||||
}
|
||||
}
|
||||
*arr = append(*arr, val)
|
||||
return
|
||||
}
|
||||
+59
-9
@@ -4,6 +4,8 @@ import (
|
||||
"math"
|
||||
"math/rand"
|
||||
"strconv"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"ehang.io/nps/lib/common"
|
||||
@@ -15,8 +17,10 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
ports []int
|
||||
ServerStatus []map[string]interface{}
|
||||
ports []int
|
||||
ServerStatus []map[string]interface{}
|
||||
ServerStatusMu sync.RWMutex
|
||||
IORateCache atomic.Value
|
||||
)
|
||||
|
||||
func StartSystemInfo() {
|
||||
@@ -52,7 +56,7 @@ func TestServerPort(p int, m string) (b bool) {
|
||||
}
|
||||
|
||||
func GenerateServerPort(m string) int {
|
||||
for {
|
||||
for i := 0; i < 1000; i++ {
|
||||
//生成随机数 1024 - 65535
|
||||
serverPort := rand.Intn(65535)
|
||||
if serverPort < 1024 {
|
||||
@@ -63,6 +67,7 @@ func GenerateServerPort(m string) int {
|
||||
return serverPort
|
||||
}
|
||||
}
|
||||
return 0 // 超过最大重试次数,返回0表示无法分配端口
|
||||
}
|
||||
|
||||
func getSeverStatus() {
|
||||
@@ -88,12 +93,9 @@ func getSeverStatus() {
|
||||
vir, _ := mem.VirtualMemory()
|
||||
m["virtual_mem"] = math.Round(vir.UsedPercent)
|
||||
conn, _ := net.ProtoCounters(nil)
|
||||
io1, _ := net.IOCounters(false)
|
||||
time.Sleep(time.Millisecond * 500)
|
||||
io2, _ := net.IOCounters(false)
|
||||
if len(io2) > 0 && len(io1) > 0 {
|
||||
m["io_send"] = (io2[0].BytesSent - io1[0].BytesSent) * 2
|
||||
m["io_recv"] = (io2[0].BytesRecv - io1[0].BytesRecv) * 2
|
||||
if cached, ok := IORateCache.Load().(map[string]uint64); ok {
|
||||
m["io_send"] = cached["io_send"]
|
||||
m["io_recv"] = cached["io_recv"]
|
||||
}
|
||||
t := time.Now()
|
||||
m["time"] = strconv.Itoa(t.Hour()) + ":" + strconv.Itoa(t.Minute()) + ":" + strconv.Itoa(t.Second())
|
||||
@@ -102,8 +104,56 @@ func getSeverStatus() {
|
||||
m[v.Protocol] = v.Stats["CurrEstab"]
|
||||
}
|
||||
if len(ServerStatus) >= 1440 {
|
||||
ServerStatusMu.Lock()
|
||||
ServerStatus = ServerStatus[1:]
|
||||
ServerStatusMu.Unlock()
|
||||
}
|
||||
ServerStatusMu.Lock()
|
||||
ServerStatus = append(ServerStatus, m)
|
||||
ServerStatusMu.Unlock()
|
||||
}
|
||||
}
|
||||
|
||||
// StartIORateCollector 启动后台 IO 速率采集,每 2s 刷新一次 IORateCache
|
||||
func StartIORateCollector() {
|
||||
go collectIORate()
|
||||
}
|
||||
|
||||
func collectIORate() {
|
||||
var lastSent, lastRecv uint64
|
||||
// 修复:无论首次 IOCounters 是否成功,都把 lastTime 设为 now,
|
||||
// 否则首次有效采样的 elapsed 会是几十年,导致 sendRate/recvRate 直接为 0
|
||||
lastTime := time.Now()
|
||||
if io, err := net.IOCounters(false); err == nil && len(io) > 0 {
|
||||
lastSent = io[0].BytesSent
|
||||
lastRecv = io[0].BytesRecv
|
||||
}
|
||||
|
||||
ticker := time.NewTicker(2 * time.Second)
|
||||
defer ticker.Stop()
|
||||
for range ticker.C {
|
||||
now := time.Now()
|
||||
io, err := net.IOCounters(false)
|
||||
if err != nil || len(io) == 0 {
|
||||
continue
|
||||
}
|
||||
elapsed := now.Sub(lastTime).Seconds()
|
||||
if elapsed <= 0 {
|
||||
continue
|
||||
}
|
||||
var sendRate, recvRate uint64
|
||||
if io[0].BytesSent >= lastSent {
|
||||
sendRate = uint64(float64(io[0].BytesSent-lastSent) / elapsed)
|
||||
}
|
||||
if io[0].BytesRecv >= lastRecv {
|
||||
recvRate = uint64(float64(io[0].BytesRecv-lastRecv) / elapsed)
|
||||
}
|
||||
lastSent = io[0].BytesSent
|
||||
lastRecv = io[0].BytesRecv
|
||||
lastTime = now
|
||||
IORateCache.Store(map[string]uint64{
|
||||
"io_send": sendRate,
|
||||
"io_recv": recvRate,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,12 @@ package controllers
|
||||
|
||||
import (
|
||||
"encoding/hex"
|
||||
"github.com/astaxie/beego/logs"
|
||||
"html"
|
||||
"time"
|
||||
|
||||
"ehang.io/nps/lib/file"
|
||||
|
||||
"ehang.io/nps/lib/crypt"
|
||||
"github.com/astaxie/beego"
|
||||
)
|
||||
@@ -40,3 +44,63 @@ func (s *AuthController) GetTime() {
|
||||
s.Data["json"] = m
|
||||
s.ServeJSON()
|
||||
}
|
||||
|
||||
func (s *AuthController) IpWhiteAuth() {
|
||||
s.Ctx.ResponseWriter.Header().Set("Access-Control-Allow-Origin", "*")
|
||||
s.Ctx.ResponseWriter.Header().Set("Access-Control-Allow-Methods", "GET, POST, OPTIONS")
|
||||
s.Ctx.ResponseWriter.Header().Set("Access-Control-Allow-Headers", "Content-Type")
|
||||
|
||||
vkey := s.getEscapeString("vkey")
|
||||
ip := s.getEscapeString("ip")
|
||||
password := s.getEscapeString("pass")
|
||||
|
||||
if vkey == "" || password == "" {
|
||||
s.Data["json"] = map[string]interface{}{"success": false, "message": "参数错误"}
|
||||
s.ServeJSON()
|
||||
return
|
||||
}
|
||||
|
||||
// 如果未提供 ip,则使用请求中的客户端 IP(支持代理头)
|
||||
if ip == "" {
|
||||
ip = s.Ctx.Input.IP()
|
||||
ip = html.EscapeString(ip)
|
||||
}
|
||||
|
||||
c, err := file.GetDb().GetClientByVkey(vkey)
|
||||
if err != nil {
|
||||
s.Data["json"] = map[string]interface{}{"success": false, "message": "客户端密钥错误"}
|
||||
s.ServeJSON()
|
||||
logs.Error("客户端IP白名单认证失败,客户端密钥错误:vkey [%s] ip [%s] password [%s]", vkey, ip, password)
|
||||
return
|
||||
}
|
||||
|
||||
if c.IpWhitePass != password {
|
||||
s.Data["json"] = map[string]interface{}{"success": false, "message": "授权密码错误"}
|
||||
s.ServeJSON()
|
||||
logs.Error("客户端IP白名单认证失败,授权密码错误:vkey [%s] ip [%s] password [%s]", vkey, ip, password)
|
||||
return
|
||||
}
|
||||
|
||||
ipExists := false
|
||||
for _, existingIp := range c.IpWhiteList {
|
||||
if existingIp == ip {
|
||||
ipExists = true
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if !ipExists {
|
||||
c.IpWhiteList = append(c.IpWhiteList, ip)
|
||||
file.GetDb().UpdateClient(c)
|
||||
}
|
||||
|
||||
s.Data["json"] = map[string]interface{}{"success": true, "message": "授权成功"}
|
||||
s.ServeJSON()
|
||||
|
||||
logs.Info("客户端IP白名单认证授权成功:vkey [%s] ip [%s] password [%s]", vkey, ip, password)
|
||||
|
||||
}
|
||||
|
||||
func (s *AuthController) getEscapeString(key string) string {
|
||||
return html.EscapeString(s.GetString(key))
|
||||
}
|
||||
|
||||
+35
-16
@@ -1,16 +1,18 @@
|
||||
package controllers
|
||||
|
||||
import (
|
||||
"ehang.io/nps/bridge"
|
||||
"html"
|
||||
"math"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"ehang.io/nps/bridge"
|
||||
|
||||
"ehang.io/nps/lib/common"
|
||||
"ehang.io/nps/lib/crypt"
|
||||
"ehang.io/nps/lib/file"
|
||||
"ehang.io/nps/lib/version"
|
||||
"ehang.io/nps/server"
|
||||
"github.com/astaxie/beego"
|
||||
)
|
||||
@@ -21,7 +23,7 @@ type BaseController struct {
|
||||
actionName string
|
||||
}
|
||||
|
||||
//初始化参数
|
||||
// 初始化参数
|
||||
func (s *BaseController) Prepare() {
|
||||
s.Data["web_base_url"] = beego.AppConfig.String("web_base_url")
|
||||
controllerName, actionName := s.GetControllerAndAction()
|
||||
@@ -54,7 +56,6 @@ func (s *BaseController) Prepare() {
|
||||
} else {
|
||||
s.Data["isAdmin"] = true
|
||||
}
|
||||
s.Data["https_just_proxy"], _ = beego.AppConfig.Bool("https_just_proxy")
|
||||
s.Data["allow_user_login"], _ = beego.AppConfig.Bool("allow_user_login")
|
||||
s.Data["allow_flow_limit"], _ = beego.AppConfig.Bool("allow_flow_limit")
|
||||
s.Data["allow_rate_limit"], _ = beego.AppConfig.Bool("allow_rate_limit")
|
||||
@@ -64,9 +65,14 @@ func (s *BaseController) Prepare() {
|
||||
s.Data["allow_tunnel_num_limit"], _ = beego.AppConfig.Bool("allow_tunnel_num_limit")
|
||||
s.Data["allow_local_proxy"], _ = beego.AppConfig.Bool("allow_local_proxy")
|
||||
s.Data["allow_user_change_username"], _ = beego.AppConfig.Bool("allow_user_change_username")
|
||||
showHttpProxyPort := beego.AppConfig.DefaultBool("show_http_proxy_port", true)
|
||||
httpPort := beego.AppConfig.String("http_proxy_port")
|
||||
if httpPort != "80" && showHttpProxyPort {
|
||||
s.Data["http_proxy_port"] = ":" + httpPort
|
||||
}
|
||||
}
|
||||
|
||||
//加载模板
|
||||
// 加载模板
|
||||
func (s *BaseController) display(tpl ...string) {
|
||||
s.Data["web_base_url"] = beego.AppConfig.String("web_base_url")
|
||||
var tplname string
|
||||
@@ -80,12 +86,25 @@ func (s *BaseController) display(tpl ...string) {
|
||||
}
|
||||
ip := s.Ctx.Request.Host
|
||||
s.Data["ip"] = common.GetIpByAddr(ip)
|
||||
|
||||
global := file.GetDb().GetGlobal()
|
||||
if global != nil && global.ServerUrl != "" && global.ServerUrl != ip {
|
||||
// 替换掉 http:// 或者 https://
|
||||
ip = global.ServerUrl
|
||||
ip = strings.ReplaceAll(ip, "http://", "")
|
||||
ip = strings.ReplaceAll(ip, "https://", "")
|
||||
s.Data["ip"] = ip
|
||||
}
|
||||
|
||||
s.Data["bridgeType"] = beego.AppConfig.String("bridge_type")
|
||||
if common.IsWindows() {
|
||||
s.Data["win"] = ".exe"
|
||||
s.Data["win"] = "npc.exe"
|
||||
} else {
|
||||
s.Data["win"] = "./npc"
|
||||
}
|
||||
|
||||
s.Data["p"] = strconv.Itoa(server.Bridge.TunnelPort)
|
||||
s.Data["version"] = version.VERSION
|
||||
|
||||
if bridge.ServerTlsEnable {
|
||||
tlsPort := strconv.Itoa(beego.AppConfig.DefaultInt("tls_bridge_port", 8025))
|
||||
@@ -100,19 +119,19 @@ func (s *BaseController) display(tpl ...string) {
|
||||
s.TplName = tplname
|
||||
}
|
||||
|
||||
//错误
|
||||
// 错误
|
||||
func (s *BaseController) error() {
|
||||
s.Data["web_base_url"] = beego.AppConfig.String("web_base_url")
|
||||
s.Layout = "public/layout.html"
|
||||
s.TplName = "public/error.html"
|
||||
}
|
||||
|
||||
//getEscapeString
|
||||
// getEscapeString
|
||||
func (s *BaseController) getEscapeString(key string) string {
|
||||
return html.EscapeString(s.GetString(key))
|
||||
}
|
||||
|
||||
//去掉没有err返回值的int
|
||||
// 去掉没有err返回值的int
|
||||
func (s *BaseController) GetIntNoErr(key string, def ...int) int {
|
||||
strv := s.Ctx.Input.Query(key)
|
||||
if len(strv) == 0 && len(def) > 0 {
|
||||
@@ -122,7 +141,7 @@ func (s *BaseController) GetIntNoErr(key string, def ...int) int {
|
||||
return val
|
||||
}
|
||||
|
||||
//获取去掉错误的bool值
|
||||
// 获取去掉错误的bool值
|
||||
func (s *BaseController) GetBoolNoErr(key string, def ...bool) bool {
|
||||
strv := s.Ctx.Input.Query(key)
|
||||
if len(strv) == 0 && len(def) > 0 {
|
||||
@@ -132,28 +151,28 @@ func (s *BaseController) GetBoolNoErr(key string, def ...bool) bool {
|
||||
return val
|
||||
}
|
||||
|
||||
//ajax正确返回
|
||||
// ajax正确返回
|
||||
func (s *BaseController) AjaxOk(str string) {
|
||||
s.Data["json"] = ajax(str, 1)
|
||||
s.ServeJSON()
|
||||
s.StopRun()
|
||||
}
|
||||
|
||||
//ajax正确返回
|
||||
// ajax正确返回
|
||||
func (s *BaseController) AjaxOkWithId(str string, id int) {
|
||||
s.Data["json"] = ajaxWithId(str, 1, id)
|
||||
s.ServeJSON()
|
||||
s.StopRun()
|
||||
}
|
||||
|
||||
//ajax错误返回
|
||||
// ajax错误返回
|
||||
func (s *BaseController) AjaxErr(str string) {
|
||||
s.Data["json"] = ajax(str, 0)
|
||||
s.ServeJSON()
|
||||
s.StopRun()
|
||||
}
|
||||
|
||||
//组装ajax
|
||||
// 组装ajax
|
||||
func ajax(str string, status int) map[string]interface{} {
|
||||
json := make(map[string]interface{})
|
||||
json["status"] = status
|
||||
@@ -161,7 +180,7 @@ func ajax(str string, status int) map[string]interface{} {
|
||||
return json
|
||||
}
|
||||
|
||||
//组装ajax
|
||||
// 组装ajax
|
||||
func ajaxWithId(str string, status int, id int) map[string]interface{} {
|
||||
json := make(map[string]interface{})
|
||||
json["status"] = status
|
||||
@@ -170,7 +189,7 @@ func ajaxWithId(str string, status int, id int) map[string]interface{} {
|
||||
return json
|
||||
}
|
||||
|
||||
//ajax table返回
|
||||
// ajax table返回
|
||||
func (s *BaseController) AjaxTable(list interface{}, cnt int, recordsTotal int, kwargs map[string]interface{}) {
|
||||
json := make(map[string]interface{})
|
||||
json["rows"] = list
|
||||
@@ -187,7 +206,7 @@ func (s *BaseController) AjaxTable(list interface{}, cnt int, recordsTotal int,
|
||||
s.StopRun()
|
||||
}
|
||||
|
||||
//ajax table参数
|
||||
// ajax table参数
|
||||
func (s *BaseController) GetAjaxParams() (start, limit int) {
|
||||
return s.GetIntNoErr("offset"), s.GetIntNoErr("limit")
|
||||
}
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
package controllers
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"ehang.io/nps/lib/common"
|
||||
"ehang.io/nps/lib/file"
|
||||
"ehang.io/nps/lib/rate"
|
||||
"ehang.io/nps/server"
|
||||
"github.com/astaxie/beego"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
type ClientController struct {
|
||||
@@ -69,6 +70,10 @@ func (s *ClientController) Add() {
|
||||
FlowLimit: int64(s.GetIntNoErr("flow_limit")),
|
||||
},
|
||||
BlackIpList: RemoveRepeatedElement(strings.Split(s.getEscapeString("blackiplist"), "\r\n")),
|
||||
IpWhite: s.GetBoolNoErr("ipwhite"),
|
||||
IpWhitePass: s.getEscapeString("ipwhitepass"),
|
||||
IpWhiteList: RemoveRepeatedElement(strings.Split(s.getEscapeString("ipwhitelist"), "\r\n")),
|
||||
ExpireTime: normalizeExpireTime(s.getEscapeString("expire_time")),
|
||||
CreateTime: time.Now().Format("2006-01-02 15:04:05"),
|
||||
}
|
||||
if err := file.GetDb().NewClient(t); err != nil {
|
||||
@@ -102,6 +107,7 @@ func (s *ClientController) Edit() {
|
||||
} else {
|
||||
s.Data["c"] = c
|
||||
s.Data["BlackIpList"] = strings.Join(c.BlackIpList, "\r\n")
|
||||
s.Data["IpWhiteList"] = strings.Join(c.IpWhiteList, "\r\n")
|
||||
}
|
||||
s.SetInfo("edit client")
|
||||
s.display()
|
||||
@@ -139,6 +145,9 @@ func (s *ClientController) Edit() {
|
||||
}
|
||||
c.WebPassword = s.getEscapeString("web_password")
|
||||
c.ConfigConnAllow = s.GetBoolNoErr("config_conn_allow")
|
||||
c.IpWhite = s.GetBoolNoErr("ipwhite")
|
||||
c.IpWhitePass = s.getEscapeString("ipwhitepass")
|
||||
c.IpWhiteList = RemoveRepeatedElement(strings.Split(s.getEscapeString("ipwhitelist"), "\r\n"))
|
||||
if c.Rate != nil {
|
||||
c.Rate.Stop()
|
||||
}
|
||||
@@ -146,11 +155,12 @@ func (s *ClientController) Edit() {
|
||||
c.Rate = rate.NewRate(int64(c.RateLimit * 1024))
|
||||
c.Rate.Start()
|
||||
} else {
|
||||
c.Rate = rate.NewRate(int64(2 << 23))
|
||||
c.Rate = rate.NewRate((2 << 23) * 1024)
|
||||
c.Rate.Start()
|
||||
}
|
||||
|
||||
c.BlackIpList = RemoveRepeatedElement(strings.Split(s.getEscapeString("blackiplist"), "\r\n"))
|
||||
c.ExpireTime = normalizeExpireTime(s.getEscapeString("expire_time"))
|
||||
file.GetDb().JsonDb.StoreClientsToJsonFile()
|
||||
}
|
||||
s.AjaxOk("save success")
|
||||
@@ -160,6 +170,10 @@ func (s *ClientController) Edit() {
|
||||
func RemoveRepeatedElement(arr []string) (newArr []string) {
|
||||
newArr = make([]string, 0)
|
||||
for i := 0; i < len(arr); i++ {
|
||||
// 过滤空IP
|
||||
if strings.TrimSpace(arr[i]) == "" {
|
||||
continue
|
||||
}
|
||||
repeat := false
|
||||
for j := i + 1; j < len(arr); j++ {
|
||||
if arr[i] == arr[j] {
|
||||
@@ -174,6 +188,39 @@ func RemoveRepeatedElement(arr []string) (newArr []string) {
|
||||
return
|
||||
}
|
||||
|
||||
// expireTimeFormats 支持的到期时间输入格式
|
||||
var expireTimeFormats = []string{
|
||||
"2006-01-02 15:04:05",
|
||||
"2006-01-02 15:04",
|
||||
"2006-01-02T15:04:05",
|
||||
"2006-01-02T15:04",
|
||||
"2006-01-02",
|
||||
}
|
||||
|
||||
// ParseExpireTime 将多种格式的到期时间字符串解析为 time.Time
|
||||
// 留空或无法解析返回 ok=false
|
||||
func ParseExpireTime(s string) (time.Time, bool) {
|
||||
s = strings.TrimSpace(s)
|
||||
if s == "" {
|
||||
return time.Time{}, false
|
||||
}
|
||||
for _, f := range expireTimeFormats {
|
||||
if t, err := time.ParseInLocation(f, s, time.Local); err == nil {
|
||||
return t, true
|
||||
}
|
||||
}
|
||||
return time.Time{}, false
|
||||
}
|
||||
|
||||
// normalizeExpireTime 将用户提交的到期时间统一为 "2006-01-02 15:04:05"
|
||||
// 无法解析则返回空串表示不限制
|
||||
func normalizeExpireTime(s string) string {
|
||||
if t, ok := ParseExpireTime(s); ok {
|
||||
return t.Format("2006-01-02 15:04:05")
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// 更改状态
|
||||
func (s *ClientController) ChangeStatus() {
|
||||
id := s.GetIntNoErr("id")
|
||||
|
||||
@@ -23,21 +23,20 @@ func (s *GlobalController) Index() {
|
||||
return
|
||||
}
|
||||
s.Data["globalBlackIpList"] = strings.Join(global.BlackIpList, "\r\n")
|
||||
s.Data["serverUrl"] = global.ServerUrl
|
||||
}
|
||||
|
||||
//添加全局黑名单IP
|
||||
// 添加全局参数
|
||||
func (s *GlobalController) Save() {
|
||||
//global, err := file.GetDb().GetGlobal()
|
||||
//if err != nil {
|
||||
// return
|
||||
//}
|
||||
if s.Ctx.Request.Method == "GET" {
|
||||
s.Data["menu"] = "global"
|
||||
s.SetInfo("save global")
|
||||
s.display()
|
||||
} else {
|
||||
|
||||
t := &file.Glob{BlackIpList: RemoveRepeatedElement(strings.Split(s.getEscapeString("globalBlackIpList"), "\r\n"))}
|
||||
t := &file.Glob{
|
||||
BlackIpList: RemoveRepeatedElement(strings.Split(s.getEscapeString("globalBlackIpList"), "\r\n")),
|
||||
ServerUrl: s.getEscapeString("serverUrl")}
|
||||
|
||||
if err := file.GetDb().SaveGlobal(t); err != nil {
|
||||
s.AjaxErr(err.Error())
|
||||
|
||||
@@ -132,6 +132,53 @@ func (s *IndexController) Add() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (s *IndexController) Copy() {
|
||||
oldId := s.GetIntNoErr("id")
|
||||
if oldTask, err := file.GetDb().GetTask(oldId); err != nil {
|
||||
s.error()
|
||||
} else {
|
||||
if client, err := file.GetDb().GetClient(oldTask.Client.Id); err != nil {
|
||||
s.AjaxErr("modified error,the client is not exist")
|
||||
return
|
||||
} else {
|
||||
oldTask.Client = client
|
||||
}
|
||||
|
||||
id := int(file.GetDb().JsonDb.GetTaskId())
|
||||
newTask := &file.Tunnel{
|
||||
Client: oldTask.Client,
|
||||
Port: tool.GenerateServerPort(oldTask.Mode),
|
||||
ServerIp: oldTask.ServerIp,
|
||||
Mode: oldTask.Mode,
|
||||
Target: oldTask.Target,
|
||||
Id: id,
|
||||
Status: true,
|
||||
Remark: oldTask.Remark,
|
||||
Password: oldTask.Password,
|
||||
LocalPath: oldTask.LocalPath,
|
||||
StripPre: oldTask.StripPre,
|
||||
ProtoVersion: oldTask.ProtoVersion,
|
||||
Flow: &file.Flow{},
|
||||
}
|
||||
if !tool.TestServerPort(newTask.Port, newTask.Mode) {
|
||||
s.AjaxErr("The port cannot be opened because it may has been occupied or is no longer allowed.")
|
||||
}
|
||||
|
||||
if newTask.Client.MaxTunnelNum != 0 && newTask.Client.GetTunnelNum() >= newTask.Client.MaxTunnelNum {
|
||||
s.AjaxErr("The number of tunnels exceeds the limit")
|
||||
}
|
||||
if err := file.GetDb().NewTask(newTask); err != nil {
|
||||
s.AjaxErr(err.Error())
|
||||
}
|
||||
if err := server.AddTask(newTask); err != nil {
|
||||
s.AjaxErr(err.Error())
|
||||
} else {
|
||||
s.AjaxOkWithId("add success", id)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (s *IndexController) GetOneTunnel() {
|
||||
id := s.GetIntNoErr("id")
|
||||
data := make(map[string]interface{})
|
||||
@@ -254,6 +301,26 @@ func (s *IndexController) DelHost() {
|
||||
s.AjaxOk("delete success")
|
||||
}
|
||||
|
||||
func (s *IndexController) HostStop() {
|
||||
id := s.GetIntNoErr("id")
|
||||
if h, err := file.GetDb().GetHostById(id); err != nil {
|
||||
s.AjaxErr("stop error")
|
||||
} else {
|
||||
h.IsClose = true
|
||||
}
|
||||
s.AjaxOk("stop success")
|
||||
}
|
||||
|
||||
func (s *IndexController) HostStart() {
|
||||
id := s.GetIntNoErr("id")
|
||||
if h, err := file.GetDb().GetHostById(id); err != nil {
|
||||
s.AjaxErr("start error")
|
||||
} else {
|
||||
h.IsClose = false
|
||||
}
|
||||
s.AjaxOk("start success")
|
||||
}
|
||||
|
||||
func (s *IndexController) AddHost() {
|
||||
if s.Ctx.Request.Method == "GET" {
|
||||
s.Data["client_id"] = s.getEscapeString("client_id")
|
||||
@@ -276,6 +343,11 @@ func (s *IndexController) AddHost() {
|
||||
CertFilePath: s.getEscapeString("cert_file_path"),
|
||||
AutoHttps: s.GetBoolNoErr("AutoHttps"),
|
||||
}
|
||||
|
||||
if h.Scheme == "http" {
|
||||
h.AutoHttps = false
|
||||
}
|
||||
|
||||
var err error
|
||||
if h.Client, err = file.GetDb().GetClient(s.GetIntNoErr("client_id")); err != nil {
|
||||
s.AjaxErr("add error the client can not be found")
|
||||
@@ -332,6 +404,11 @@ func (s *IndexController) EditHost() {
|
||||
h.CertFilePath = s.getEscapeString("cert_file_path")
|
||||
h.Target.LocalProxy = s.GetBoolNoErr("local_proxy")
|
||||
h.AutoHttps = s.GetBoolNoErr("AutoHttps")
|
||||
|
||||
if h.Scheme == "http" {
|
||||
h.AutoHttps = false
|
||||
}
|
||||
|
||||
file.GetDb().JsonDb.StoreHostToJsonFile()
|
||||
}
|
||||
s.AjaxOk("modified success")
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
package web
|
||||
|
||||
import (
|
||||
"embed"
|
||||
"io/fs"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"ehang.io/nps/lib/common"
|
||||
"github.com/astaxie/beego/logs"
|
||||
)
|
||||
|
||||
//go:embed static
|
||||
var StaticFS embed.FS
|
||||
|
||||
//go:embed views
|
||||
var ViewsFS embed.FS
|
||||
|
||||
func ExtractWebFiles(runPath string) {
|
||||
webDir := filepath.Join(runPath, "web")
|
||||
staticDir := filepath.Join(webDir, "static")
|
||||
viewsDir := filepath.Join(webDir, "views")
|
||||
|
||||
if !common.FileExists(staticDir) {
|
||||
extractFS(StaticFS, "static", webDir)
|
||||
logs.Info("Extracted embedded web/static to", staticDir)
|
||||
}
|
||||
if !common.FileExists(viewsDir) {
|
||||
extractFS(ViewsFS, "views", webDir)
|
||||
logs.Info("Extracted embedded web/views to", viewsDir)
|
||||
}
|
||||
}
|
||||
|
||||
func extractFS(efs embed.FS, root string, destDir string) {
|
||||
fs.WalkDir(efs, ".", func(path string, d fs.DirEntry, err error) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
targetPath := filepath.Join(destDir, path)
|
||||
if d.IsDir() {
|
||||
os.MkdirAll(targetPath, 0755)
|
||||
return nil
|
||||
}
|
||||
data, err := efs.ReadFile(path)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
os.MkdirAll(filepath.Dir(targetPath), 0755)
|
||||
os.WriteFile(targetPath, data, 0644)
|
||||
return nil
|
||||
})
|
||||
}
|
||||
@@ -14,6 +14,7 @@ func Init() {
|
||||
beego.NSAutoRouter(&controllers.LoginController{}),
|
||||
beego.NSAutoRouter(&controllers.ClientController{}),
|
||||
beego.NSAutoRouter(&controllers.AuthController{}),
|
||||
beego.NSRouter("/auth/ipwhiteauth", &controllers.AuthController{}, "*:IpWhiteAuth"),
|
||||
beego.NSAutoRouter(&controllers.GlobalController{}),
|
||||
)
|
||||
beego.AddNamespace(ns)
|
||||
@@ -23,6 +24,7 @@ func Init() {
|
||||
beego.AutoRouter(&controllers.LoginController{})
|
||||
beego.AutoRouter(&controllers.ClientController{})
|
||||
beego.AutoRouter(&controllers.AuthController{})
|
||||
beego.Router("/auth/ipwhiteauth", &controllers.AuthController{}, "*:IpWhiteAuth")
|
||||
beego.AutoRouter(&controllers.GlobalController{})
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
||||
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
||||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.zh = {}));
|
||||
}(this, (function (exports) { 'use strict';
|
||||
|
||||
var fp = typeof window !== "undefined" && window.flatpickr !== undefined
|
||||
? window.flatpickr
|
||||
: {
|
||||
l10ns: {},
|
||||
};
|
||||
var Mandarin = {
|
||||
weekdays: {
|
||||
shorthand: ["周日", "周一", "周二", "周三", "周四", "周五", "周六"],
|
||||
longhand: [
|
||||
"星期日",
|
||||
"星期一",
|
||||
"星期二",
|
||||
"星期三",
|
||||
"星期四",
|
||||
"星期五",
|
||||
"星期六",
|
||||
],
|
||||
},
|
||||
months: {
|
||||
shorthand: [
|
||||
"一月",
|
||||
"二月",
|
||||
"三月",
|
||||
"四月",
|
||||
"五月",
|
||||
"六月",
|
||||
"七月",
|
||||
"八月",
|
||||
"九月",
|
||||
"十月",
|
||||
"十一月",
|
||||
"十二月",
|
||||
],
|
||||
longhand: [
|
||||
"一月",
|
||||
"二月",
|
||||
"三月",
|
||||
"四月",
|
||||
"五月",
|
||||
"六月",
|
||||
"七月",
|
||||
"八月",
|
||||
"九月",
|
||||
"十月",
|
||||
"十一月",
|
||||
"十二月",
|
||||
],
|
||||
},
|
||||
rangeSeparator: " 至 ",
|
||||
weekAbbreviation: "周",
|
||||
scrollTitle: "滚动切换",
|
||||
toggleTitle: "点击切换 12/24 小时时制",
|
||||
};
|
||||
fp.l10ns.zh = Mandarin;
|
||||
var zh = fp.l10ns;
|
||||
|
||||
exports.Mandarin = Mandarin;
|
||||
exports.default = zh;
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
})));
|
||||
Vendored
+2
File diff suppressed because one or more lines are too long
@@ -59,7 +59,7 @@
|
||||
$.fn.cloudLang = function () {
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: window.nps.web_base_url + '/static/page/languages.xml?v=20250107',
|
||||
url: window.nps.web_base_url + '/static/page/languages.xml?v=202512051',
|
||||
dataType: 'xml',
|
||||
success: function (xml) {
|
||||
languages['content'] = xml2json($(xml).children())['content'];
|
||||
@@ -144,6 +144,7 @@ function submitform(action, url, postdata) {
|
||||
case 'start':
|
||||
case 'stop':
|
||||
case 'delete':
|
||||
case 'copy':
|
||||
var langobj = languages['content']['confirm'][action];
|
||||
action = (langobj[languages['current']] || langobj[languages['default']] || 'Are you sure you want to ' + action + ' it?');
|
||||
if (! confirm(action)) return;
|
||||
|
||||
@@ -0,0 +1,227 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="initial-scale=1, user-scalable=0, minimal-ui">
|
||||
<title>NPS访问验证</title>
|
||||
<style>
|
||||
html {
|
||||
padding: 30px 10px;
|
||||
font-size: 20px;
|
||||
line-height: 1.4;
|
||||
color: #737373;
|
||||
background: #ddd;
|
||||
-webkit-text-size-adjust: 100%;
|
||||
-ms-text-size-adjust: 100%;
|
||||
}
|
||||
|
||||
html,
|
||||
input {
|
||||
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
}
|
||||
|
||||
body {
|
||||
max-width: 500px;
|
||||
_width: 500px;
|
||||
padding: 30px 20px 50px;
|
||||
/* background-color: white; */
|
||||
margin: 40px auto;
|
||||
-webkit-border-radius: 6px;
|
||||
-moz-border-radius: 6px;
|
||||
border-radius: 6px;
|
||||
-webkit-box-shadow: 0 0px 2px rgba(0, 0, 0, 0.05);
|
||||
-moz-box-shadow: 0 0px 2px rgba(0, 0, 0, 0.1);
|
||||
box-shadow: 0 0px 2px rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
|
||||
h1 {
|
||||
margin: 0 10px;
|
||||
font-size: 50px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
h1 span {
|
||||
color: #bbb;
|
||||
}
|
||||
|
||||
h3 {
|
||||
margin: 1.5em 0 0.5em;
|
||||
}
|
||||
|
||||
p {
|
||||
margin: 1em 0;
|
||||
}
|
||||
|
||||
ul {
|
||||
padding: 0 0 0 40px;
|
||||
margin: 1em 0;
|
||||
}
|
||||
|
||||
.container {
|
||||
max-width: 380px;
|
||||
_width: 380px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
|
||||
html .login-wrap {
|
||||
position: relative;
|
||||
/* margin: 180px auto; */
|
||||
background: #ecf0f1;
|
||||
/* width: 350px; */
|
||||
border-radius: 5px;
|
||||
box-shadow: 3px 3px 10px #333;
|
||||
padding: 15px;
|
||||
}
|
||||
|
||||
html .login-wrap h2 {
|
||||
text-align: center;
|
||||
/* font-weight: 200; */
|
||||
font-size: 1.6em;
|
||||
margin-top: 20px;
|
||||
color: #34495e;
|
||||
height: 50px;
|
||||
}
|
||||
|
||||
html .login-wrap .form {
|
||||
padding-top: 20px;
|
||||
}
|
||||
|
||||
|
||||
html .login-wrap .form input[type="text"],
|
||||
html .login-wrap .form input[type="password"],
|
||||
html .login-wrap .form button {
|
||||
width: 80%;
|
||||
margin-left: 10%;
|
||||
margin-bottom: 25px;
|
||||
height: 40px;
|
||||
border-radius: 5px;
|
||||
outline: 0;
|
||||
-moz-outline-style: none;
|
||||
}
|
||||
|
||||
|
||||
html .login-wrap .form input[type="text"],
|
||||
html .login-wrap .form input[type="password"] {
|
||||
border: 1px solid #bbb;
|
||||
padding: 0 0 0 10px;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
html .login-wrap .form input[type="text"]:focus,
|
||||
html .login-wrap .form input[type="password"]:focus {
|
||||
border: 1px solid #3498db;
|
||||
}
|
||||
|
||||
|
||||
html .login-wrap .form a {
|
||||
text-align: center;
|
||||
font-size: 12px;
|
||||
color: #3498db;
|
||||
}
|
||||
|
||||
|
||||
html .login-wrap .form a {
|
||||
text-align: center;
|
||||
font-size: 12px;
|
||||
color: #3498db;
|
||||
}
|
||||
|
||||
html .login-wrap .form a p {
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
|
||||
html .login-wrap .form button {
|
||||
background: #e74c3c;
|
||||
border: none;
|
||||
color: white;
|
||||
font-size: 18px;
|
||||
font-weight: 200;
|
||||
cursor: pointer;
|
||||
transition: box-shadow .4s ease;
|
||||
}
|
||||
|
||||
html .login-wrap .form button:hover {
|
||||
box-shadow: 1px 1px 5px #555;
|
||||
}
|
||||
|
||||
html .login-wrap .form button:active {
|
||||
box-shadow: 1px 1px 7px #222;
|
||||
}
|
||||
|
||||
|
||||
html .login-wrap:after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
background: -webkit-linear-gradient(left, #27ae60 0%, #27ae60 20%, #8e44ad 20%, #8e44ad 40%, #3498db 40%, #3498db 60%, #e74c3c 60%, #e74c3c 80%, #f1c40f 80%, #f1c40f 100%);
|
||||
background: -moz-linear-gradient(left, #27ae60 0%, #27ae60 20%, #8e44ad 20%, #8e44ad 40%, #3498db 40%, #3498db 60%, #e74c3c 60%, #e74c3c 80%, #f1c40f 80%, #f1c40f 100%);
|
||||
height: 5px;
|
||||
border-radius: 5px 5px 0 0;
|
||||
}
|
||||
|
||||
.tips {
|
||||
text-align: center;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.ip-addr {
|
||||
font-weight: bolder;
|
||||
}
|
||||
|
||||
.error {
|
||||
text-align: center;
|
||||
color: red;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div hidden id="port">${port}</div>
|
||||
|
||||
<div class="container">
|
||||
<div class="login-wrap">
|
||||
<h2>访问验证</h2>
|
||||
<div class="tips">当前 IP (<span class="ip-addr" id="ip_addr">${ip}</span>) 未经授权, 已禁止访问</div>
|
||||
<div class="form">
|
||||
<input type="text" id="pwd" placeholder="请输入访问密码" name="pw">
|
||||
<button onclick="submitAuth()"> 提交验证</button>
|
||||
<div hidden id="error" class="error"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
<script>
|
||||
function submitAuth() {
|
||||
var pwd = document.getElementById("pwd").value
|
||||
|
||||
if (pwd === '' || pwd == null) {
|
||||
document.getElementById("error").hidden = false;
|
||||
document.getElementById("error").innerHTML = "请输入授权秘钥"
|
||||
}
|
||||
const xhr = new XMLHttpRequest()
|
||||
xhr.addEventListener("readystatechange", function () {
|
||||
// debugger
|
||||
if (xhr.response != null && xhr.response !== '') {
|
||||
var resp = JSON.parse(xhr.response);
|
||||
console.log(resp)
|
||||
if (resp.success !== true) {
|
||||
document.getElementById("error").hidden = false;
|
||||
document.getElementById("error").innerHTML = resp.message
|
||||
} else {
|
||||
location.reload();
|
||||
}
|
||||
|
||||
}
|
||||
console.log(xhr.response)
|
||||
})
|
||||
xhr.open("post", "/authIp?pass=" + pwd)
|
||||
xhr.send()
|
||||
}
|
||||
</script>
|
||||
|
||||
</html>
|
||||
@@ -189,11 +189,19 @@
|
||||
<zh-CN>访问端命令</zh-CN>
|
||||
<en-US>Access command</en-US>
|
||||
</lang>
|
||||
<lang id="word-protoversion">
|
||||
<zh-CN>Proxy Protocol Version</zh-CN>
|
||||
<en-US>Proxy Protocol Version</en-US>
|
||||
</lang>
|
||||
|
||||
<lang id="word-quicklycommand">
|
||||
<zh-CN>快捷启动命令</zh-CN>
|
||||
<en-US>Quickly command</en-US>
|
||||
</lang>
|
||||
<lang id="word-tlsquicklycommand">
|
||||
<zh-CN>TLS快捷启动命令</zh-CN>
|
||||
<en-US>TLS Quickly command</en-US>
|
||||
</lang>
|
||||
|
||||
<lang id="word-commandclient">
|
||||
<zh-CN>客户端命令</zh-CN>
|
||||
@@ -591,6 +599,12 @@
|
||||
<zh-CN>唯一值,不填将自动生成</zh-CN>
|
||||
<en-US>Unique, non-filling will be generated automatically</en-US>
|
||||
</lang>
|
||||
|
||||
<lang id="info-ipwhitepass">
|
||||
<zh-CN>IP授权密码,不在IP白名单的访问将被跳转到IP授权页面,输入正确的授权密码,即可完成添加IP。</zh-CN>
|
||||
<en-US>IP White Password, access that is not in the IP white list will be redirected to the IP authorization page, enter the correct authorization password, and you can complete the addition of IP.</en-US>
|
||||
</lang>
|
||||
|
||||
<lang id="info-casefile">
|
||||
<zh-CN>通提供一个公网可访问的本地文件服务,此模式仅客户端使用配置文件模式方可启动。</zh-CN>
|
||||
<en-US>Provide a local file service accessible to the public network, which can only be started by the client using the profile mode.</en-US>
|
||||
@@ -724,6 +738,12 @@
|
||||
<en-US>Empty means to be unrestricted</en-US>
|
||||
</lang>
|
||||
|
||||
<lang id="info-input-whitepass">
|
||||
<zh-CN>留空表示不跳转IP授权页面</zh-CN>
|
||||
<en-US>Empty means not to jump to the IP authorization page</en-US>
|
||||
</lang>
|
||||
|
||||
|
||||
|
||||
<lang id="word-blackiplist">
|
||||
<zh-CN>IP黑名单(防暴力破解)</zh-CN>
|
||||
@@ -736,6 +756,16 @@
|
||||
<en-US>Global IP Black List</en-US>
|
||||
</lang>
|
||||
|
||||
<lang id="word-serverurl">
|
||||
<zh-CN>服务地址</zh-CN>
|
||||
<en-US>Server</en-US>
|
||||
</lang>
|
||||
|
||||
<lang id="info-servertips">
|
||||
<zh-CN>客户端命令地址显示、隧道访问显示</zh-CN>
|
||||
<en-US>Server URL, Tunnel Access</en-US>
|
||||
</lang>
|
||||
|
||||
<lang id="info-suchasblackiplist">
|
||||
<zh-CN>例如 10.1.50.203 10.1.50.202</zh-CN>
|
||||
<en-US>such as 10.1.50.203 10.1.50.202</en-US>
|
||||
@@ -762,6 +792,31 @@
|
||||
<en-US>Last Online Time</en-US>
|
||||
</lang>
|
||||
|
||||
<lang id="word-expiretime">
|
||||
<zh-CN>到期时间</zh-CN>
|
||||
<en-US>Expire Time</en-US>
|
||||
</lang>
|
||||
|
||||
<lang id="info-expiretime">
|
||||
<zh-CN>留空表示永不过期,到期后将自动暂停客户端</zh-CN>
|
||||
<en-US>Leave blank for no expiration. The client will be paused automatically when expired.</en-US>
|
||||
</lang>
|
||||
|
||||
<lang id="word-ipwhite">
|
||||
<zh-CN>启用IP白名单</zh-CN>
|
||||
<en-US> Enable IP White </en-US>
|
||||
</lang>
|
||||
|
||||
<lang id="word-ipwhitepass">
|
||||
<zh-CN>IP白名单授权密码</zh-CN>
|
||||
<en-US>IP White Password </en-US>
|
||||
</lang>
|
||||
|
||||
<lang id="word-ipwhitelist">
|
||||
<zh-CN>IP白名单</zh-CN>
|
||||
<en-US>IP White List </en-US>
|
||||
</lang>
|
||||
|
||||
<confirm>
|
||||
<lang id="delete">
|
||||
<zh-CN>你确定你要删除它吗?</zh-CN>
|
||||
@@ -775,6 +830,10 @@
|
||||
<zh-CN>你确定你要停止它吗?</zh-CN>
|
||||
<en-US>Are you sure you want to stop it?</en-US>
|
||||
</lang>
|
||||
<lang id="copy">
|
||||
<zh-CN>你确定要复制它吗?</zh-CN>
|
||||
<en-US>Are you sure you want to copy it?</en-US>
|
||||
</lang>
|
||||
</confirm>
|
||||
|
||||
<reply>
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user