mirror of
https://github.com/SagerNet/sing-box.git
synced 2026-04-14 04:38:28 +10:00
Compare commits
39 Commits
v1.13.0-al
...
dev-wifi-l
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
766972ce52 | ||
|
|
f1e48a1cad | ||
|
|
ba496ae300 | ||
|
|
4488148322 | ||
|
|
f086454f81 | ||
|
|
f9b6a068ee | ||
|
|
0ad2a441d9 | ||
|
|
c714b59c87 | ||
|
|
bd6b125707 | ||
|
|
d1109cee90 | ||
|
|
b48002b4db | ||
|
|
67cedfd927 | ||
|
|
853b576d12 | ||
|
|
05cd7f6192 | ||
|
|
e4cf55a86d | ||
|
|
2bf605fad4 | ||
|
|
b913899d43 | ||
|
|
e1a22c0cc2 | ||
|
|
d890c8e8d7 | ||
|
|
1b4ffff67c | ||
|
|
6d012c04cd | ||
|
|
c1309b63c9 | ||
|
|
6674b252bf | ||
|
|
8c7b2e4ac3 | ||
|
|
f400c927c4 | ||
|
|
587d330b58 | ||
|
|
719a28920a | ||
|
|
2e0d344a3d | ||
|
|
387084b7c7 | ||
|
|
e15c02ee33 | ||
|
|
2648b80c6b | ||
|
|
391f7a73d2 | ||
|
|
c1565e2bb0 | ||
|
|
605d8b41f9 | ||
|
|
03d8243d41 | ||
|
|
30f1beb071 | ||
|
|
3841d9cb5a | ||
|
|
dbb7345ec9 | ||
|
|
88f000412b |
1
.github/CRONET_GO_VERSION
vendored
1
.github/CRONET_GO_VERSION
vendored
@@ -1 +0,0 @@
|
|||||||
5e61220bb2d22453eb6d105077c88c8ab1e1c3b2
|
|
||||||
2
.github/setup_go_for_windows7.sh
vendored
2
.github/setup_go_for_windows7.sh
vendored
@@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
VERSION="1.25.5"
|
VERSION="1.25.1"
|
||||||
|
|
||||||
mkdir -p $HOME/go
|
mkdir -p $HOME/go
|
||||||
cd $HOME/go
|
cd $HOME/go
|
||||||
|
|||||||
13
.github/update_cronet.sh
vendored
13
.github/update_cronet.sh
vendored
@@ -1,13 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
set -e -o pipefail
|
|
||||||
|
|
||||||
SCRIPT_DIR=$(dirname "$0")
|
|
||||||
PROJECTS=$SCRIPT_DIR/../..
|
|
||||||
|
|
||||||
git -C $PROJECTS/cronet-go fetch origin main
|
|
||||||
git -C $PROJECTS/cronet-go fetch origin go
|
|
||||||
go get -x github.com/sagernet/cronet-go/all@$(git -C $PROJECTS/cronet-go rev-parse origin/go)
|
|
||||||
go get -x github.com/sagernet/cronet-go@$(git -C $PROJECTS/cronet-go rev-parse origin/go)
|
|
||||||
go mod tidy
|
|
||||||
git -C $PROJECTS/cronet-go rev-parse origin/HEAD > "$SCRIPT_DIR/CRONET_GO_VERSION"
|
|
||||||
340
.github/workflows/build.yml
vendored
340
.github/workflows/build.yml
vendored
@@ -46,7 +46,7 @@ jobs:
|
|||||||
- name: Setup Go
|
- name: Setup Go
|
||||||
uses: actions/setup-go@v5
|
uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: ^1.25.5
|
go-version: ^1.25.1
|
||||||
- name: Check input version
|
- name: Check input version
|
||||||
if: github.event_name == 'workflow_dispatch'
|
if: github.event_name == 'workflow_dispatch'
|
||||||
run: |-
|
run: |-
|
||||||
@@ -69,25 +69,13 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- { os: linux, arch: amd64, variant: purego, naive: true, openwrt: "x86_64" }
|
- { os: linux, arch: amd64, debian: amd64, rpm: x86_64, pacman: x86_64, openwrt: "x86_64" }
|
||||||
- { os: linux, arch: amd64, variant: glibc, naive: true }
|
- { os: linux, arch: "386", go386: sse2, debian: i386, rpm: i386, openwrt: "i386_pentium4" }
|
||||||
- { os: linux, arch: amd64, variant: musl, naive: true, debian: amd64, rpm: x86_64, pacman: x86_64, openwrt: "x86_64" }
|
|
||||||
|
|
||||||
- { os: linux, arch: arm64, variant: purego, naive: true, openwrt: "aarch64_cortex-a53 aarch64_cortex-a72 aarch64_cortex-a76 aarch64_generic" }
|
|
||||||
- { os: linux, arch: arm64, variant: glibc, naive: true }
|
|
||||||
- { os: linux, arch: arm64, variant: musl, naive: true, debian: arm64, rpm: aarch64, pacman: aarch64, openwrt: "aarch64_cortex-a53 aarch64_cortex-a72 aarch64_cortex-a76 aarch64_generic" }
|
|
||||||
|
|
||||||
- { os: linux, arch: "386", go386: sse2, openwrt: "i386_pentium4" }
|
|
||||||
- { os: linux, arch: "386", variant: glibc, naive: true, go386: sse2 }
|
|
||||||
- { os: linux, arch: "386", variant: musl, naive: true, go386: sse2, debian: i386, rpm: i386, openwrt: "i386_pentium4" }
|
|
||||||
|
|
||||||
- { os: linux, arch: arm, goarm: "7", openwrt: "arm_cortex-a5_vfpv4 arm_cortex-a7_neon-vfpv4 arm_cortex-a7_vfpv4 arm_cortex-a8_vfpv3 arm_cortex-a9_neon arm_cortex-a9_vfpv3-d16 arm_cortex-a15_neon-vfpv4" }
|
|
||||||
- { os: linux, arch: arm, variant: glibc, naive: true, goarm: "7" }
|
|
||||||
- { os: linux, arch: arm, variant: musl, naive: true, goarm: "7", debian: armhf, rpm: armv7hl, pacman: armv7hl, openwrt: "arm_cortex-a5_vfpv4 arm_cortex-a7_neon-vfpv4 arm_cortex-a7_vfpv4 arm_cortex-a8_vfpv3 arm_cortex-a9_neon arm_cortex-a9_vfpv3-d16 arm_cortex-a15_neon-vfpv4" }
|
|
||||||
|
|
||||||
- { os: linux, arch: "386", go386: softfloat, openwrt: "i386_pentium-mmx" }
|
- { os: linux, arch: "386", go386: softfloat, openwrt: "i386_pentium-mmx" }
|
||||||
|
- { os: linux, arch: arm64, debian: arm64, rpm: aarch64, pacman: aarch64, openwrt: "aarch64_cortex-a53 aarch64_cortex-a72 aarch64_cortex-a76 aarch64_generic" }
|
||||||
- { os: linux, arch: arm, goarm: "5", openwrt: "arm_arm926ej-s arm_cortex-a7 arm_cortex-a9 arm_fa526 arm_xscale" }
|
- { os: linux, arch: arm, goarm: "5", openwrt: "arm_arm926ej-s arm_cortex-a7 arm_cortex-a9 arm_fa526 arm_xscale" }
|
||||||
- { os: linux, arch: arm, goarm: "6", debian: armel, rpm: armv6hl, openwrt: "arm_arm1176jzf-s_vfp" }
|
- { os: linux, arch: arm, goarm: "6", debian: armel, rpm: armv6hl, openwrt: "arm_arm1176jzf-s_vfp" }
|
||||||
|
- { os: linux, arch: arm, goarm: "7", debian: armhf, rpm: armv7hl, pacman: armv7hl, openwrt: "arm_cortex-a5_vfpv4 arm_cortex-a7_neon-vfpv4 arm_cortex-a7_vfpv4 arm_cortex-a8_vfpv3 arm_cortex-a9_neon arm_cortex-a9_vfpv3-d16 arm_cortex-a15_neon-vfpv4" }
|
||||||
- { os: linux, arch: mips, gomips: softfloat, openwrt: "mips_24kc mips_4kec mips_mips32" }
|
- { os: linux, arch: mips, gomips: softfloat, openwrt: "mips_24kc mips_4kec mips_mips32" }
|
||||||
- { os: linux, arch: mipsle, gomips: hardfloat, debian: mipsel, rpm: mipsel, openwrt: "mipsel_24kc_24kf" }
|
- { os: linux, arch: mipsle, gomips: hardfloat, debian: mipsel, rpm: mipsel, openwrt: "mipsel_24kc_24kf" }
|
||||||
- { os: linux, arch: mipsle, gomips: softfloat, openwrt: "mipsel_24kc mipsel_74kc mipsel_mips32" }
|
- { os: linux, arch: mipsle, gomips: softfloat, openwrt: "mipsel_24kc mipsel_74kc mipsel_mips32" }
|
||||||
@@ -99,8 +87,15 @@ jobs:
|
|||||||
- { os: linux, arch: riscv64, debian: riscv64, rpm: riscv64, openwrt: "riscv64_generic" }
|
- { os: linux, arch: riscv64, debian: riscv64, rpm: riscv64, openwrt: "riscv64_generic" }
|
||||||
- { os: linux, arch: loong64, debian: loongarch64, rpm: loongarch64, openwrt: "loongarch64_generic" }
|
- { os: linux, arch: loong64, debian: loongarch64, rpm: loongarch64, openwrt: "loongarch64_generic" }
|
||||||
|
|
||||||
|
- { os: windows, arch: amd64 }
|
||||||
- { os: windows, arch: amd64, legacy_win7: true, legacy_name: "windows-7" }
|
- { os: windows, arch: amd64, legacy_win7: true, legacy_name: "windows-7" }
|
||||||
|
- { os: windows, arch: "386" }
|
||||||
- { os: windows, arch: "386", legacy_win7: true, legacy_name: "windows-7" }
|
- { os: windows, arch: "386", legacy_win7: true, legacy_name: "windows-7" }
|
||||||
|
- { os: windows, arch: arm64 }
|
||||||
|
|
||||||
|
- { os: darwin, arch: amd64 }
|
||||||
|
- { os: darwin, arch: arm64 }
|
||||||
|
- { os: darwin, arch: amd64, legacy_go124: true, legacy_name: "macos-11" }
|
||||||
|
|
||||||
- { os: android, arch: arm64, ndk: "aarch64-linux-android21" }
|
- { os: android, arch: arm64, ndk: "aarch64-linux-android21" }
|
||||||
- { os: android, arch: arm, ndk: "armv7a-linux-androideabi21" }
|
- { os: android, arch: arm, ndk: "armv7a-linux-androideabi21" }
|
||||||
@@ -112,15 +107,15 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- name: Setup Go
|
- name: Setup Go
|
||||||
if: ${{ ! (matrix.legacy_win7 || matrix.legacy_go124) }}
|
if: ${{ ! (matrix.legacy_go123 || matrix.legacy_go124) }}
|
||||||
uses: actions/setup-go@v5
|
uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: ^1.25.5
|
go-version: ^1.25.1
|
||||||
- name: Setup Go 1.24
|
- name: Setup Go 1.24
|
||||||
if: matrix.legacy_go124
|
if: matrix.legacy_go124
|
||||||
uses: actions/setup-go@v5
|
uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: ~1.24.10
|
go-version: ~1.24.6
|
||||||
- name: Cache Go for Windows 7
|
- name: Cache Go for Windows 7
|
||||||
if: matrix.legacy_win7
|
if: matrix.legacy_win7
|
||||||
id: cache-go-for-windows7
|
id: cache-go-for-windows7
|
||||||
@@ -128,7 +123,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
~/go/go_win7
|
~/go/go_win7
|
||||||
key: go_win7_1255
|
key: go_win7_1251
|
||||||
- name: Setup Go for Windows 7
|
- name: Setup Go for Windows 7
|
||||||
if: matrix.legacy_win7 && steps.cache-go-for-windows7.outputs.cache-hit != 'true'
|
if: matrix.legacy_win7 && steps.cache-go-for-windows7.outputs.cache-hit != 'true'
|
||||||
run: |-
|
run: |-
|
||||||
@@ -144,45 +139,6 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
ndk-version: r28
|
ndk-version: r28
|
||||||
local-cache: true
|
local-cache: true
|
||||||
- name: Clone cronet-go
|
|
||||||
if: matrix.naive
|
|
||||||
run: |
|
|
||||||
set -xeuo pipefail
|
|
||||||
CRONET_GO_VERSION=$(cat .github/CRONET_GO_VERSION)
|
|
||||||
git init ~/cronet-go
|
|
||||||
git -C ~/cronet-go remote add origin https://github.com/sagernet/cronet-go.git
|
|
||||||
git -C ~/cronet-go fetch --depth=1 origin "$CRONET_GO_VERSION"
|
|
||||||
git -C ~/cronet-go checkout FETCH_HEAD
|
|
||||||
git -C ~/cronet-go submodule update --init --recursive --depth=1
|
|
||||||
- name: Cache Chromium toolchain
|
|
||||||
if: matrix.naive
|
|
||||||
id: cache-chromium-toolchain
|
|
||||||
uses: actions/cache@v4
|
|
||||||
with:
|
|
||||||
path: |
|
|
||||||
~/cronet-go/naiveproxy/src/third_party/llvm-build/Release+Asserts
|
|
||||||
~/cronet-go/naiveproxy/src/out/sysroot-build
|
|
||||||
key: chromium-toolchain-${{ matrix.arch }}-${{ matrix.variant }}-${{ hashFiles('.github/CRONET_GO_VERSION') }}
|
|
||||||
- name: Download Chromium toolchain
|
|
||||||
if: matrix.naive
|
|
||||||
run: |
|
|
||||||
set -xeuo pipefail
|
|
||||||
cd ~/cronet-go
|
|
||||||
if [[ "${{ matrix.variant }}" == "musl" ]]; then
|
|
||||||
go run ./cmd/build-naive --target=linux/${{ matrix.arch }} --libc=musl download-toolchain
|
|
||||||
else
|
|
||||||
go run ./cmd/build-naive --target=linux/${{ matrix.arch }} download-toolchain
|
|
||||||
fi
|
|
||||||
- name: Set Chromium toolchain environment
|
|
||||||
if: matrix.naive
|
|
||||||
run: |
|
|
||||||
set -xeuo pipefail
|
|
||||||
cd ~/cronet-go
|
|
||||||
if [[ "${{ matrix.variant }}" == "musl" ]]; then
|
|
||||||
go run ./cmd/build-naive --target=linux/${{ matrix.arch }} --libc=musl env >> $GITHUB_ENV
|
|
||||||
else
|
|
||||||
go run ./cmd/build-naive --target=linux/${{ matrix.arch }} env >> $GITHUB_ENV
|
|
||||||
fi
|
|
||||||
- name: Set tag
|
- name: Set tag
|
||||||
run: |-
|
run: |-
|
||||||
git ls-remote --exit-code --tags origin v${{ needs.calculate_version.outputs.version }} || echo "PUBLISHED=false" >> "$GITHUB_ENV"
|
git ls-remote --exit-code --tags origin v${{ needs.calculate_version.outputs.version }} || echo "PUBLISHED=false" >> "$GITHUB_ENV"
|
||||||
@@ -190,70 +146,10 @@ jobs:
|
|||||||
- name: Set build tags
|
- name: Set build tags
|
||||||
run: |
|
run: |
|
||||||
set -xeuo pipefail
|
set -xeuo pipefail
|
||||||
TAGS='with_gvisor,with_quic,with_dhcp,with_wireguard,with_utls,with_acme,with_clash_api,with_tailscale,with_ccm,with_ocm,badlinkname,tfogo_checklinkname0'
|
TAGS='with_gvisor,with_quic,with_dhcp,with_wireguard,with_utls,with_acme,with_clash_api,with_tailscale,badlinkname,tfogo_checklinkname0'
|
||||||
if [[ "${{ matrix.naive }}" == "true" ]]; then
|
|
||||||
TAGS="${TAGS},with_naive_outbound"
|
|
||||||
fi
|
|
||||||
if [[ "${{ matrix.variant }}" == "purego" ]]; then
|
|
||||||
TAGS="${TAGS},with_purego"
|
|
||||||
elif [[ "${{ matrix.variant }}" == "musl" ]]; then
|
|
||||||
TAGS="${TAGS},with_musl"
|
|
||||||
fi
|
|
||||||
echo "BUILD_TAGS=${TAGS}" >> "${GITHUB_ENV}"
|
echo "BUILD_TAGS=${TAGS}" >> "${GITHUB_ENV}"
|
||||||
- name: Build (purego)
|
- name: Build
|
||||||
if: matrix.variant == 'purego'
|
if: matrix.os != 'android'
|
||||||
run: |
|
|
||||||
set -xeuo pipefail
|
|
||||||
mkdir -p dist
|
|
||||||
go build -v -trimpath -o dist/sing-box -tags "${BUILD_TAGS}" \
|
|
||||||
-ldflags '-s -buildid= -X github.com/sagernet/sing-box/constant.Version=${{ needs.calculate_version.outputs.version }} -checklinkname=0' \
|
|
||||||
./cmd/sing-box
|
|
||||||
env:
|
|
||||||
CGO_ENABLED: "0"
|
|
||||||
GOOS: ${{ matrix.os }}
|
|
||||||
GOARCH: ${{ matrix.arch }}
|
|
||||||
GO386: ${{ matrix.go386 }}
|
|
||||||
GOARM: ${{ matrix.goarm }}
|
|
||||||
GOMIPS: ${{ matrix.gomips }}
|
|
||||||
GOMIPS64: ${{ matrix.gomips }}
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
- name: Extract libcronet.so
|
|
||||||
if: matrix.variant == 'purego' && matrix.naive
|
|
||||||
run: |
|
|
||||||
cd ~/cronet-go
|
|
||||||
CGO_ENABLED=0 go run -v ./cmd/build-naive extract-lib --target ${{ matrix.os }}/${{ matrix.arch }} -o $GITHUB_WORKSPACE/dist
|
|
||||||
- name: Build (glibc)
|
|
||||||
if: matrix.variant == 'glibc'
|
|
||||||
run: |
|
|
||||||
set -xeuo pipefail
|
|
||||||
mkdir -p dist
|
|
||||||
go build -v -trimpath -o dist/sing-box -tags "${BUILD_TAGS}" \
|
|
||||||
-ldflags '-s -buildid= -X github.com/sagernet/sing-box/constant.Version=${{ needs.calculate_version.outputs.version }} -checklinkname=0' \
|
|
||||||
./cmd/sing-box
|
|
||||||
env:
|
|
||||||
CGO_ENABLED: "1"
|
|
||||||
GOOS: linux
|
|
||||||
GOARCH: ${{ matrix.arch }}
|
|
||||||
GO386: ${{ matrix.go386 }}
|
|
||||||
GOARM: ${{ matrix.goarm }}
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
- name: Build (musl)
|
|
||||||
if: matrix.variant == 'musl'
|
|
||||||
run: |
|
|
||||||
set -xeuo pipefail
|
|
||||||
mkdir -p dist
|
|
||||||
go build -v -trimpath -o dist/sing-box -tags "${BUILD_TAGS}" \
|
|
||||||
-ldflags '-s -buildid= -X github.com/sagernet/sing-box/constant.Version=${{ needs.calculate_version.outputs.version }} -checklinkname=0' \
|
|
||||||
./cmd/sing-box
|
|
||||||
env:
|
|
||||||
CGO_ENABLED: "1"
|
|
||||||
GOOS: linux
|
|
||||||
GOARCH: ${{ matrix.arch }}
|
|
||||||
GO386: ${{ matrix.go386 }}
|
|
||||||
GOARM: ${{ matrix.goarm }}
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
- name: Build (non-variant)
|
|
||||||
if: matrix.os != 'android' && matrix.variant == ''
|
|
||||||
run: |
|
run: |
|
||||||
set -xeuo pipefail
|
set -xeuo pipefail
|
||||||
mkdir -p dist
|
mkdir -p dist
|
||||||
@@ -297,11 +193,6 @@ jobs:
|
|||||||
elif [[ -n "${{ matrix.legacy_name }}" ]]; then
|
elif [[ -n "${{ matrix.legacy_name }}" ]]; then
|
||||||
DIR_NAME="${DIR_NAME}-legacy-${{ matrix.legacy_name }}"
|
DIR_NAME="${DIR_NAME}-legacy-${{ matrix.legacy_name }}"
|
||||||
fi
|
fi
|
||||||
if [[ "${{ matrix.variant }}" == "glibc" ]]; then
|
|
||||||
DIR_NAME="${DIR_NAME}-glibc"
|
|
||||||
elif [[ "${{ matrix.variant }}" == "musl" ]]; then
|
|
||||||
DIR_NAME="${DIR_NAME}-musl"
|
|
||||||
fi
|
|
||||||
echo "DIR_NAME=${DIR_NAME}" >> "${GITHUB_ENV}"
|
echo "DIR_NAME=${DIR_NAME}" >> "${GITHUB_ENV}"
|
||||||
PKG_VERSION="${{ needs.calculate_version.outputs.version }}"
|
PKG_VERSION="${{ needs.calculate_version.outputs.version }}"
|
||||||
PKG_VERSION="${PKG_VERSION//-/\~}"
|
PKG_VERSION="${PKG_VERSION//-/\~}"
|
||||||
@@ -369,12 +260,8 @@ jobs:
|
|||||||
-p "dist/openwrt.deb" \
|
-p "dist/openwrt.deb" \
|
||||||
--architecture all \
|
--architecture all \
|
||||||
dist/sing-box=/usr/bin/sing-box
|
dist/sing-box=/usr/bin/sing-box
|
||||||
SUFFIX=""
|
|
||||||
if [[ "${{ matrix.variant }}" == "musl" ]]; then
|
|
||||||
SUFFIX="_musl"
|
|
||||||
fi
|
|
||||||
for architecture in ${{ matrix.openwrt }}; do
|
for architecture in ${{ matrix.openwrt }}; do
|
||||||
.github/deb2ipk.sh "$architecture" "dist/openwrt.deb" "dist/sing-box_${{ needs.calculate_version.outputs.version }}_openwrt_${architecture}${SUFFIX}.ipk"
|
.github/deb2ipk.sh "$architecture" "dist/openwrt.deb" "dist/sing-box_${{ needs.calculate_version.outputs.version }}_openwrt_${architecture}.ipk"
|
||||||
done
|
done
|
||||||
rm "dist/openwrt.deb"
|
rm "dist/openwrt.deb"
|
||||||
- name: Archive
|
- name: Archive
|
||||||
@@ -388,177 +275,15 @@ jobs:
|
|||||||
zip -r "${DIR_NAME}.zip" "${DIR_NAME}"
|
zip -r "${DIR_NAME}.zip" "${DIR_NAME}"
|
||||||
else
|
else
|
||||||
cp sing-box "${DIR_NAME}"
|
cp sing-box "${DIR_NAME}"
|
||||||
if [ -f libcronet.so ]; then
|
|
||||||
cp libcronet.so "${DIR_NAME}"
|
|
||||||
fi
|
|
||||||
tar -czvf "${DIR_NAME}.tar.gz" "${DIR_NAME}"
|
tar -czvf "${DIR_NAME}.tar.gz" "${DIR_NAME}"
|
||||||
fi
|
fi
|
||||||
rm -r "${DIR_NAME}"
|
rm -r "${DIR_NAME}"
|
||||||
- name: Cleanup
|
|
||||||
run: rm -f dist/sing-box dist/libcronet.so
|
|
||||||
- name: Upload artifact
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: binary-${{ matrix.os }}_${{ matrix.arch }}${{ matrix.goarm && format('v{0}', matrix.goarm) }}${{ matrix.go386 && format('_{0}', matrix.go386) }}${{ matrix.gomips && format('_{0}', matrix.gomips) }}${{ matrix.legacy_name && format('-legacy-{0}', matrix.legacy_name) }}${{ matrix.variant && format('-{0}', matrix.variant) }}
|
|
||||||
path: "dist"
|
|
||||||
build_darwin:
|
|
||||||
name: Build Darwin binaries
|
|
||||||
if: github.event_name != 'workflow_dispatch' || inputs.build == 'All' || inputs.build == 'Binary'
|
|
||||||
runs-on: macos-latest
|
|
||||||
needs:
|
|
||||||
- calculate_version
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
include:
|
|
||||||
- { arch: amd64 }
|
|
||||||
- { arch: arm64 }
|
|
||||||
- { arch: amd64, legacy_go124: true, legacy_name: "macos-11" }
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
- name: Setup Go
|
|
||||||
if: ${{ ! matrix.legacy_go124 }}
|
|
||||||
uses: actions/setup-go@v5
|
|
||||||
with:
|
|
||||||
go-version: ^1.25.3
|
|
||||||
- name: Setup Go 1.24
|
|
||||||
if: matrix.legacy_go124
|
|
||||||
uses: actions/setup-go@v5
|
|
||||||
with:
|
|
||||||
go-version: ~1.24.6
|
|
||||||
- name: Set tag
|
|
||||||
run: |-
|
|
||||||
git ls-remote --exit-code --tags origin v${{ needs.calculate_version.outputs.version }} || echo "PUBLISHED=false" >> "$GITHUB_ENV"
|
|
||||||
git tag v${{ needs.calculate_version.outputs.version }} -f
|
|
||||||
- name: Set build tags
|
|
||||||
run: |
|
|
||||||
set -xeuo pipefail
|
|
||||||
TAGS='with_gvisor,with_quic,with_dhcp,with_wireguard,with_utls,with_acme,with_clash_api,with_tailscale,with_ccm,with_ocm,badlinkname,tfogo_checklinkname0'
|
|
||||||
if [[ "${{ matrix.legacy_go124 }}" != "true" ]]; then
|
|
||||||
TAGS="${TAGS},with_naive_outbound"
|
|
||||||
fi
|
|
||||||
echo "BUILD_TAGS=${TAGS}" >> "${GITHUB_ENV}"
|
|
||||||
- name: Build
|
|
||||||
run: |
|
|
||||||
set -xeuo pipefail
|
|
||||||
mkdir -p dist
|
|
||||||
go build -v -trimpath -o dist/sing-box -tags "${BUILD_TAGS}" \
|
|
||||||
-ldflags '-s -buildid= -X github.com/sagernet/sing-box/constant.Version=${{ needs.calculate_version.outputs.version }} -checklinkname=0' \
|
|
||||||
./cmd/sing-box
|
|
||||||
env:
|
|
||||||
CGO_ENABLED: "1"
|
|
||||||
GOOS: darwin
|
|
||||||
GOARCH: ${{ matrix.arch }}
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
- name: Set name
|
|
||||||
run: |-
|
|
||||||
DIR_NAME="sing-box-${{ needs.calculate_version.outputs.version }}-darwin-${{ matrix.arch }}"
|
|
||||||
if [[ -n "${{ matrix.legacy_name }}" ]]; then
|
|
||||||
DIR_NAME="${DIR_NAME}-legacy-${{ matrix.legacy_name }}"
|
|
||||||
fi
|
|
||||||
echo "DIR_NAME=${DIR_NAME}" >> "${GITHUB_ENV}"
|
|
||||||
- name: Archive
|
|
||||||
run: |
|
|
||||||
set -xeuo pipefail
|
|
||||||
cd dist
|
|
||||||
mkdir -p "${DIR_NAME}"
|
|
||||||
cp ../LICENSE "${DIR_NAME}"
|
|
||||||
cp sing-box "${DIR_NAME}"
|
|
||||||
tar -czvf "${DIR_NAME}.tar.gz" "${DIR_NAME}"
|
|
||||||
rm -r "${DIR_NAME}"
|
|
||||||
- name: Cleanup
|
- name: Cleanup
|
||||||
run: rm dist/sing-box
|
run: rm dist/sing-box
|
||||||
- name: Upload artifact
|
- name: Upload artifact
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: binary-darwin_${{ matrix.arch }}${{ matrix.legacy_name && format('-legacy-{0}', matrix.legacy_name) }}
|
name: binary-${{ matrix.os }}_${{ matrix.arch }}${{ matrix.goarm && format('v{0}', matrix.goarm) }}${{ matrix.go386 && format('_{0}', matrix.go386) }}${{ matrix.gomips && format('_{0}', matrix.gomips) }}${{ matrix.legacy_name && format('-legacy-{0}', matrix.legacy_name) }}
|
||||||
path: "dist"
|
|
||||||
build_windows:
|
|
||||||
name: Build Windows binaries
|
|
||||||
if: github.event_name != 'workflow_dispatch' || inputs.build == 'All' || inputs.build == 'Binary'
|
|
||||||
runs-on: windows-latest
|
|
||||||
needs:
|
|
||||||
- calculate_version
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
include:
|
|
||||||
- { arch: amd64, naive: true }
|
|
||||||
- { arch: "386" }
|
|
||||||
- { arch: arm64, naive: true }
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
- name: Setup Go
|
|
||||||
uses: actions/setup-go@v5
|
|
||||||
with:
|
|
||||||
go-version: ^1.25.4
|
|
||||||
- name: Set tag
|
|
||||||
run: |-
|
|
||||||
git ls-remote --exit-code --tags origin v${{ needs.calculate_version.outputs.version }} || echo "PUBLISHED=false" >> "$env:GITHUB_ENV"
|
|
||||||
git tag v${{ needs.calculate_version.outputs.version }} -f
|
|
||||||
- name: Build
|
|
||||||
if: matrix.naive
|
|
||||||
run: |
|
|
||||||
mkdir -p dist
|
|
||||||
go build -v -trimpath -o dist/sing-box.exe -tags "with_gvisor,with_quic,with_dhcp,with_wireguard,with_utls,with_acme,with_clash_api,with_tailscale,with_ccm,with_ocm,with_naive_outbound,with_purego,badlinkname,tfogo_checklinkname0" `
|
|
||||||
-ldflags "-s -buildid= -X github.com/sagernet/sing-box/constant.Version=${{ needs.calculate_version.outputs.version }} -checklinkname=0" `
|
|
||||||
./cmd/sing-box
|
|
||||||
env:
|
|
||||||
CGO_ENABLED: "0"
|
|
||||||
GOOS: windows
|
|
||||||
GOARCH: ${{ matrix.arch }}
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
- name: Build
|
|
||||||
if: ${{ !matrix.naive }}
|
|
||||||
run: |
|
|
||||||
mkdir -p dist
|
|
||||||
go build -v -trimpath -o dist/sing-box.exe -tags "with_gvisor,with_quic,with_dhcp,with_wireguard,with_utls,with_acme,with_clash_api,with_tailscale,with_ccm,with_ocm,badlinkname,tfogo_checklinkname0" `
|
|
||||||
-ldflags "-s -buildid= -X github.com/sagernet/sing-box/constant.Version=${{ needs.calculate_version.outputs.version }} -checklinkname=0" `
|
|
||||||
./cmd/sing-box
|
|
||||||
env:
|
|
||||||
CGO_ENABLED: "0"
|
|
||||||
GOOS: windows
|
|
||||||
GOARCH: ${{ matrix.arch }}
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
- name: Extract libcronet.dll
|
|
||||||
if: matrix.naive
|
|
||||||
run: |
|
|
||||||
$CRONET_GO_VERSION = Get-Content .github/CRONET_GO_VERSION
|
|
||||||
$env:CGO_ENABLED = "0"
|
|
||||||
go run -v "github.com/sagernet/cronet-go/cmd/build-naive@$CRONET_GO_VERSION" extract-lib --target windows/${{ matrix.arch }} -o dist
|
|
||||||
- name: Archive
|
|
||||||
if: matrix.naive
|
|
||||||
run: |
|
|
||||||
$DIR_NAME = "sing-box-${{ needs.calculate_version.outputs.version }}-windows-${{ matrix.arch }}"
|
|
||||||
mkdir "dist/$DIR_NAME"
|
|
||||||
Copy-Item LICENSE "dist/$DIR_NAME"
|
|
||||||
Copy-Item "dist/sing-box.exe" "dist/$DIR_NAME"
|
|
||||||
Copy-Item "dist/libcronet.dll" "dist/$DIR_NAME"
|
|
||||||
Compress-Archive -Path "dist/$DIR_NAME" -DestinationPath "dist/$DIR_NAME.zip"
|
|
||||||
Remove-Item -Recurse "dist/$DIR_NAME"
|
|
||||||
- name: Archive
|
|
||||||
if: ${{ !matrix.naive }}
|
|
||||||
run: |
|
|
||||||
$DIR_NAME = "sing-box-${{ needs.calculate_version.outputs.version }}-windows-${{ matrix.arch }}"
|
|
||||||
mkdir "dist/$DIR_NAME"
|
|
||||||
Copy-Item LICENSE "dist/$DIR_NAME"
|
|
||||||
Copy-Item "dist/sing-box.exe" "dist/$DIR_NAME"
|
|
||||||
Compress-Archive -Path "dist/$DIR_NAME" -DestinationPath "dist/$DIR_NAME.zip"
|
|
||||||
Remove-Item -Recurse "dist/$DIR_NAME"
|
|
||||||
- name: Cleanup
|
|
||||||
if: matrix.naive
|
|
||||||
run: Remove-Item dist/sing-box.exe, dist/libcronet.dll
|
|
||||||
- name: Cleanup
|
|
||||||
if: ${{ !matrix.naive }}
|
|
||||||
run: Remove-Item dist/sing-box.exe
|
|
||||||
- name: Upload artifact
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: binary-windows_${{ matrix.arch }}
|
|
||||||
path: "dist"
|
path: "dist"
|
||||||
build_android:
|
build_android:
|
||||||
name: Build Android
|
name: Build Android
|
||||||
@@ -575,7 +300,7 @@ jobs:
|
|||||||
- name: Setup Go
|
- name: Setup Go
|
||||||
uses: actions/setup-go@v5
|
uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: ^1.25.5
|
go-version: ^1.25.1
|
||||||
- name: Setup Android NDK
|
- name: Setup Android NDK
|
||||||
id: setup-ndk
|
id: setup-ndk
|
||||||
uses: nttld/setup-ndk@v1
|
uses: nttld/setup-ndk@v1
|
||||||
@@ -633,17 +358,8 @@ jobs:
|
|||||||
- name: Prepare upload
|
- name: Prepare upload
|
||||||
run: |-
|
run: |-
|
||||||
mkdir -p dist
|
mkdir -p dist
|
||||||
#cp clients/android/app/build/outputs/apk/play/release/*.apk dist
|
cp clients/android/app/build/outputs/apk/play/release/*.apk dist
|
||||||
cp clients/android/app/build/outputs/apk/other/release/*.apk dist
|
cp clients/android/app/build/outputs/apk/other/release/*-universal.apk dist
|
||||||
VERSION_CODE=$(grep VERSION_CODE clients/android/version.properties | cut -d= -f2)
|
|
||||||
VERSION_NAME=$(grep VERSION_NAME clients/android/version.properties | cut -d= -f2)
|
|
||||||
cat > dist/SFA-version-metadata.json << EOF
|
|
||||||
{
|
|
||||||
"version_code": ${VERSION_CODE},
|
|
||||||
"version_name": "${VERSION_NAME}"
|
|
||||||
}
|
|
||||||
EOF
|
|
||||||
cat dist/SFA-version-metadata.json
|
|
||||||
- name: Upload artifact
|
- name: Upload artifact
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
@@ -664,7 +380,7 @@ jobs:
|
|||||||
- name: Setup Go
|
- name: Setup Go
|
||||||
uses: actions/setup-go@v5
|
uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: ^1.25.5
|
go-version: ^1.25.1
|
||||||
- name: Setup Android NDK
|
- name: Setup Android NDK
|
||||||
id: setup-ndk
|
id: setup-ndk
|
||||||
uses: nttld/setup-ndk@v1
|
uses: nttld/setup-ndk@v1
|
||||||
@@ -717,7 +433,7 @@ jobs:
|
|||||||
build_apple:
|
build_apple:
|
||||||
name: Build Apple clients
|
name: Build Apple clients
|
||||||
runs-on: macos-26
|
runs-on: macos-26
|
||||||
if: false # github.event_name != 'workflow_dispatch' || inputs.build == 'All' || inputs.build == 'Apple' || inputs.build == 'app-store' || inputs.build == 'iOS' || inputs.build == 'macOS' || inputs.build == 'tvOS' || inputs.build == 'macOS-standalone'
|
if: false
|
||||||
needs:
|
needs:
|
||||||
- calculate_version
|
- calculate_version
|
||||||
strategy:
|
strategy:
|
||||||
@@ -763,7 +479,7 @@ jobs:
|
|||||||
if: matrix.if
|
if: matrix.if
|
||||||
uses: actions/setup-go@v5
|
uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: ^1.25.5
|
go-version: ^1.25.1
|
||||||
- name: Set tag
|
- name: Set tag
|
||||||
if: matrix.if
|
if: matrix.if
|
||||||
run: |-
|
run: |-
|
||||||
@@ -903,8 +619,6 @@ jobs:
|
|||||||
needs:
|
needs:
|
||||||
- calculate_version
|
- calculate_version
|
||||||
- build
|
- build
|
||||||
- build_darwin
|
|
||||||
- build_windows
|
|
||||||
- build_android
|
- build_android
|
||||||
- build_apple
|
- build_apple
|
||||||
steps:
|
steps:
|
||||||
|
|||||||
149
.github/workflows/docker.yml
vendored
149
.github/workflows/docker.yml
vendored
@@ -1,10 +1,6 @@
|
|||||||
name: Publish Docker Images
|
name: Publish Docker Images
|
||||||
|
|
||||||
on:
|
on:
|
||||||
#push:
|
|
||||||
# branches:
|
|
||||||
# - main-next
|
|
||||||
# - dev-next
|
|
||||||
release:
|
release:
|
||||||
types:
|
types:
|
||||||
- published
|
- published
|
||||||
@@ -17,134 +13,8 @@ env:
|
|||||||
REGISTRY_IMAGE: ghcr.io/sagernet/sing-box
|
REGISTRY_IMAGE: ghcr.io/sagernet/sing-box
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build_binary:
|
build:
|
||||||
name: Build binary
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
|
||||||
fail-fast: true
|
|
||||||
matrix:
|
|
||||||
include:
|
|
||||||
# Naive-enabled builds (musl)
|
|
||||||
- { arch: amd64, naive: true, docker_platform: "linux/amd64" }
|
|
||||||
- { arch: arm64, naive: true, docker_platform: "linux/arm64" }
|
|
||||||
- { arch: "386", naive: true, docker_platform: "linux/386" }
|
|
||||||
- { arch: arm, goarm: "7", naive: true, docker_platform: "linux/arm/v7" }
|
|
||||||
# Non-naive builds
|
|
||||||
- { arch: arm, goarm: "6", docker_platform: "linux/arm/v6" }
|
|
||||||
- { arch: ppc64le, docker_platform: "linux/ppc64le" }
|
|
||||||
- { arch: riscv64, docker_platform: "linux/riscv64" }
|
|
||||||
- { arch: s390x, docker_platform: "linux/s390x" }
|
|
||||||
steps:
|
|
||||||
- name: Get commit to build
|
|
||||||
id: ref
|
|
||||||
run: |-
|
|
||||||
if [[ -z "${{ github.event.inputs.tag }}" ]]; then
|
|
||||||
ref="${{ github.ref_name }}"
|
|
||||||
else
|
|
||||||
ref="${{ github.event.inputs.tag }}"
|
|
||||||
fi
|
|
||||||
echo "ref=$ref"
|
|
||||||
echo "ref=$ref" >> $GITHUB_OUTPUT
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
|
|
||||||
with:
|
|
||||||
ref: ${{ steps.ref.outputs.ref }}
|
|
||||||
fetch-depth: 0
|
|
||||||
- name: Setup Go
|
|
||||||
uses: actions/setup-go@v5
|
|
||||||
with:
|
|
||||||
go-version: ^1.25.4
|
|
||||||
- name: Clone cronet-go
|
|
||||||
if: matrix.naive
|
|
||||||
run: |
|
|
||||||
set -xeuo pipefail
|
|
||||||
CRONET_GO_VERSION=$(cat .github/CRONET_GO_VERSION)
|
|
||||||
git init ~/cronet-go
|
|
||||||
git -C ~/cronet-go remote add origin https://github.com/sagernet/cronet-go.git
|
|
||||||
git -C ~/cronet-go fetch --depth=1 origin "$CRONET_GO_VERSION"
|
|
||||||
git -C ~/cronet-go checkout FETCH_HEAD
|
|
||||||
git -C ~/cronet-go submodule update --init --recursive --depth=1
|
|
||||||
- name: Cache Chromium toolchain
|
|
||||||
if: matrix.naive
|
|
||||||
id: cache-chromium-toolchain
|
|
||||||
uses: actions/cache@v4
|
|
||||||
with:
|
|
||||||
path: |
|
|
||||||
~/cronet-go/naiveproxy/src/third_party/llvm-build/Release+Asserts
|
|
||||||
~/cronet-go/naiveproxy/src/out/sysroot-build
|
|
||||||
key: chromium-toolchain-${{ matrix.arch }}-musl-${{ hashFiles('.github/CRONET_GO_VERSION') }}
|
|
||||||
- name: Download Chromium toolchain
|
|
||||||
if: matrix.naive
|
|
||||||
run: |
|
|
||||||
set -xeuo pipefail
|
|
||||||
cd ~/cronet-go
|
|
||||||
go run ./cmd/build-naive --target=linux/${{ matrix.arch }} --libc=musl download-toolchain
|
|
||||||
- name: Set version
|
|
||||||
run: |
|
|
||||||
set -xeuo pipefail
|
|
||||||
VERSION=$(go run ./cmd/internal/read_tag)
|
|
||||||
echo "VERSION=${VERSION}" >> "${GITHUB_ENV}"
|
|
||||||
- name: Set Chromium toolchain environment
|
|
||||||
if: matrix.naive
|
|
||||||
run: |
|
|
||||||
set -xeuo pipefail
|
|
||||||
cd ~/cronet-go
|
|
||||||
go run ./cmd/build-naive --target=linux/${{ matrix.arch }} --libc=musl env >> $GITHUB_ENV
|
|
||||||
- name: Set build tags
|
|
||||||
run: |
|
|
||||||
set -xeuo pipefail
|
|
||||||
TAGS='with_gvisor,with_quic,with_dhcp,with_wireguard,with_utls,with_acme,with_clash_api,with_tailscale,with_ccm,with_ocm,badlinkname,tfogo_checklinkname0'
|
|
||||||
if [[ "${{ matrix.naive }}" == "true" ]]; then
|
|
||||||
TAGS="${TAGS},with_naive_outbound,with_musl"
|
|
||||||
fi
|
|
||||||
echo "BUILD_TAGS=${TAGS}" >> "${GITHUB_ENV}"
|
|
||||||
- name: Build (naive)
|
|
||||||
if: matrix.naive
|
|
||||||
run: |
|
|
||||||
set -xeuo pipefail
|
|
||||||
go build -v -trimpath -o sing-box -tags "${BUILD_TAGS}" \
|
|
||||||
-ldflags "-X \"github.com/sagernet/sing-box/constant.Version=${VERSION}\" -s -w -buildid= -checklinkname=0" \
|
|
||||||
./cmd/sing-box
|
|
||||||
env:
|
|
||||||
CGO_ENABLED: "1"
|
|
||||||
GOOS: linux
|
|
||||||
GOARCH: ${{ matrix.arch }}
|
|
||||||
GOARM: ${{ matrix.goarm }}
|
|
||||||
- name: Build (non-naive)
|
|
||||||
if: ${{ ! matrix.naive }}
|
|
||||||
run: |
|
|
||||||
set -xeuo pipefail
|
|
||||||
go build -v -trimpath -o sing-box -tags "${BUILD_TAGS}" \
|
|
||||||
-ldflags "-X \"github.com/sagernet/sing-box/constant.Version=${VERSION}\" -s -w -buildid= -checklinkname=0" \
|
|
||||||
./cmd/sing-box
|
|
||||||
env:
|
|
||||||
CGO_ENABLED: "0"
|
|
||||||
GOOS: linux
|
|
||||||
GOARCH: ${{ matrix.arch }}
|
|
||||||
GOARM: ${{ matrix.goarm }}
|
|
||||||
- name: Prepare artifact
|
|
||||||
run: |
|
|
||||||
platform=${{ matrix.docker_platform }}
|
|
||||||
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
|
|
||||||
# Rename binary to include arch info for Dockerfile.binary
|
|
||||||
BINARY_NAME="sing-box-${{ matrix.arch }}"
|
|
||||||
if [[ -n "${{ matrix.goarm }}" ]]; then
|
|
||||||
BINARY_NAME="${BINARY_NAME}v${{ matrix.goarm }}"
|
|
||||||
fi
|
|
||||||
mv sing-box "${BINARY_NAME}"
|
|
||||||
echo "BINARY_NAME=${BINARY_NAME}" >> $GITHUB_ENV
|
|
||||||
- name: Upload binary
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: binary-${{ env.PLATFORM_PAIR }}
|
|
||||||
path: ${{ env.BINARY_NAME }}
|
|
||||||
if-no-files-found: error
|
|
||||||
retention-days: 1
|
|
||||||
build_docker:
|
|
||||||
name: Build Docker image
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs:
|
|
||||||
- build_binary
|
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: true
|
fail-fast: true
|
||||||
matrix:
|
matrix:
|
||||||
@@ -177,16 +47,6 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
platform=${{ matrix.platform }}
|
platform=${{ matrix.platform }}
|
||||||
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
|
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
|
||||||
- name: Download binary
|
|
||||||
uses: actions/download-artifact@v5
|
|
||||||
with:
|
|
||||||
name: binary-${{ env.PLATFORM_PAIR }}
|
|
||||||
path: .
|
|
||||||
- name: Prepare binary
|
|
||||||
run: |
|
|
||||||
# Find and make the binary executable
|
|
||||||
chmod +x sing-box-*
|
|
||||||
ls -la sing-box-*
|
|
||||||
- name: Setup QEMU
|
- name: Setup QEMU
|
||||||
uses: docker/setup-qemu-action@v3
|
uses: docker/setup-qemu-action@v3
|
||||||
- name: Setup Docker Buildx
|
- name: Setup Docker Buildx
|
||||||
@@ -208,7 +68,8 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
platforms: ${{ matrix.platform }}
|
platforms: ${{ matrix.platform }}
|
||||||
context: .
|
context: .
|
||||||
file: Dockerfile.binary
|
build-args: |
|
||||||
|
BUILDKIT_CONTEXT_KEEP_GIT_DIR=1
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true
|
outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true
|
||||||
- name: Export digest
|
- name: Export digest
|
||||||
@@ -226,7 +87,7 @@ jobs:
|
|||||||
merge:
|
merge:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs:
|
needs:
|
||||||
- build_docker
|
- build
|
||||||
steps:
|
steps:
|
||||||
- name: Get commit to build
|
- name: Get commit to build
|
||||||
id: ref
|
id: ref
|
||||||
@@ -260,7 +121,6 @@ jobs:
|
|||||||
username: ${{ github.repository_owner }}
|
username: ${{ github.repository_owner }}
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
- name: Create manifest list and push
|
- name: Create manifest list and push
|
||||||
if: github.event_name != 'push'
|
|
||||||
working-directory: /tmp/digests
|
working-directory: /tmp/digests
|
||||||
run: |
|
run: |
|
||||||
docker buildx imagetools create \
|
docker buildx imagetools create \
|
||||||
@@ -268,7 +128,6 @@ jobs:
|
|||||||
-t "${{ env.REGISTRY_IMAGE }}:${{ steps.ref.outputs.ref }}" \
|
-t "${{ env.REGISTRY_IMAGE }}:${{ steps.ref.outputs.ref }}" \
|
||||||
$(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *)
|
$(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *)
|
||||||
- name: Inspect image
|
- name: Inspect image
|
||||||
if: github.event_name != 'push'
|
|
||||||
run: |
|
run: |
|
||||||
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.ref.outputs.latest }}
|
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.ref.outputs.latest }}
|
||||||
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.ref.outputs.ref }}
|
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.ref.outputs.ref }}
|
||||||
|
|||||||
76
.github/workflows/linux.yml
vendored
76
.github/workflows/linux.yml
vendored
@@ -1,10 +1,6 @@
|
|||||||
name: Build Linux Packages
|
name: Build Linux Packages
|
||||||
|
|
||||||
on:
|
on:
|
||||||
#push:
|
|
||||||
# branches:
|
|
||||||
# - main-next
|
|
||||||
# - dev-next
|
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs:
|
inputs:
|
||||||
version:
|
version:
|
||||||
@@ -34,7 +30,7 @@ jobs:
|
|||||||
- name: Setup Go
|
- name: Setup Go
|
||||||
uses: actions/setup-go@v5
|
uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: ^1.25.5
|
go-version: ^1.25.1
|
||||||
- name: Check input version
|
- name: Check input version
|
||||||
if: github.event_name == 'workflow_dispatch'
|
if: github.event_name == 'workflow_dispatch'
|
||||||
run: |-
|
run: |-
|
||||||
@@ -56,13 +52,11 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
# Naive-enabled builds (musl)
|
- { os: linux, arch: amd64, debian: amd64, rpm: x86_64, pacman: x86_64 }
|
||||||
- { os: linux, arch: amd64, naive: true, debian: amd64, rpm: x86_64, pacman: x86_64 }
|
- { os: linux, arch: "386", debian: i386, rpm: i386 }
|
||||||
- { os: linux, arch: arm64, naive: true, debian: arm64, rpm: aarch64, pacman: aarch64 }
|
|
||||||
- { os: linux, arch: "386", naive: true, debian: i386, rpm: i386 }
|
|
||||||
- { os: linux, arch: arm, goarm: "7", naive: true, debian: armhf, rpm: armv7hl, pacman: armv7hl }
|
|
||||||
# Non-naive builds (unsupported architectures)
|
|
||||||
- { os: linux, arch: arm, goarm: "6", debian: armel, rpm: armv6hl }
|
- { os: linux, arch: arm, goarm: "6", debian: armel, rpm: armv6hl }
|
||||||
|
- { os: linux, arch: arm, goarm: "7", debian: armhf, rpm: armv7hl, pacman: armv7hl }
|
||||||
|
- { os: linux, arch: arm64, debian: arm64, rpm: aarch64, pacman: aarch64 }
|
||||||
- { os: linux, arch: mips64le, debian: mips64el, rpm: mips64el }
|
- { os: linux, arch: mips64le, debian: mips64el, rpm: mips64el }
|
||||||
- { os: linux, arch: mipsle, debian: mipsel, rpm: mipsel }
|
- { os: linux, arch: mipsle, debian: mipsel, rpm: mipsel }
|
||||||
- { os: linux, arch: s390x, debian: s390x, rpm: s390x }
|
- { os: linux, arch: s390x, debian: s390x, rpm: s390x }
|
||||||
@@ -77,38 +71,13 @@ jobs:
|
|||||||
- name: Setup Go
|
- name: Setup Go
|
||||||
uses: actions/setup-go@v5
|
uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: ^1.25.5
|
go-version: ^1.25.1
|
||||||
- name: Clone cronet-go
|
- name: Setup Android NDK
|
||||||
if: matrix.naive
|
if: matrix.os == 'android'
|
||||||
run: |
|
uses: nttld/setup-ndk@v1
|
||||||
set -xeuo pipefail
|
|
||||||
CRONET_GO_VERSION=$(cat .github/CRONET_GO_VERSION)
|
|
||||||
git init ~/cronet-go
|
|
||||||
git -C ~/cronet-go remote add origin https://github.com/sagernet/cronet-go.git
|
|
||||||
git -C ~/cronet-go fetch --depth=1 origin "$CRONET_GO_VERSION"
|
|
||||||
git -C ~/cronet-go checkout FETCH_HEAD
|
|
||||||
git -C ~/cronet-go submodule update --init --recursive --depth=1
|
|
||||||
- name: Cache Chromium toolchain
|
|
||||||
if: matrix.naive
|
|
||||||
id: cache-chromium-toolchain
|
|
||||||
uses: actions/cache@v4
|
|
||||||
with:
|
with:
|
||||||
path: |
|
ndk-version: r28
|
||||||
~/cronet-go/naiveproxy/src/third_party/llvm-build/Release+Asserts
|
local-cache: true
|
||||||
~/cronet-go/naiveproxy/src/out/sysroot-build
|
|
||||||
key: chromium-toolchain-${{ matrix.arch }}-musl-${{ hashFiles('.github/CRONET_GO_VERSION') }}
|
|
||||||
- name: Download Chromium toolchain
|
|
||||||
if: matrix.naive
|
|
||||||
run: |
|
|
||||||
set -xeuo pipefail
|
|
||||||
cd ~/cronet-go
|
|
||||||
go run ./cmd/build-naive --target=linux/${{ matrix.arch }} --libc=musl download-toolchain
|
|
||||||
- name: Set Chromium toolchain environment
|
|
||||||
if: matrix.naive
|
|
||||||
run: |
|
|
||||||
set -xeuo pipefail
|
|
||||||
cd ~/cronet-go
|
|
||||||
go run ./cmd/build-naive --target=linux/${{ matrix.arch }} --libc=musl env >> $GITHUB_ENV
|
|
||||||
- name: Set tag
|
- name: Set tag
|
||||||
run: |-
|
run: |-
|
||||||
git ls-remote --exit-code --tags origin v${{ needs.calculate_version.outputs.version }} || echo "PUBLISHED=false" >> "$GITHUB_ENV"
|
git ls-remote --exit-code --tags origin v${{ needs.calculate_version.outputs.version }} || echo "PUBLISHED=false" >> "$GITHUB_ENV"
|
||||||
@@ -116,27 +85,9 @@ jobs:
|
|||||||
- name: Set build tags
|
- name: Set build tags
|
||||||
run: |
|
run: |
|
||||||
set -xeuo pipefail
|
set -xeuo pipefail
|
||||||
TAGS='with_gvisor,with_quic,with_dhcp,with_wireguard,with_utls,with_acme,with_clash_api,with_tailscale,with_ccm,with_ocm,badlinkname,tfogo_checklinkname0'
|
TAGS='with_gvisor,with_quic,with_dhcp,with_wireguard,with_utls,with_acme,with_clash_api,with_tailscale,badlinkname,tfogo_checklinkname0'
|
||||||
if [[ "${{ matrix.naive }}" == "true" ]]; then
|
|
||||||
TAGS="${TAGS},with_naive_outbound,with_musl"
|
|
||||||
fi
|
|
||||||
echo "BUILD_TAGS=${TAGS}" >> "${GITHUB_ENV}"
|
echo "BUILD_TAGS=${TAGS}" >> "${GITHUB_ENV}"
|
||||||
- name: Build (naive)
|
- name: Build
|
||||||
if: matrix.naive
|
|
||||||
run: |
|
|
||||||
set -xeuo pipefail
|
|
||||||
mkdir -p dist
|
|
||||||
go build -v -trimpath -o dist/sing-box -tags "${BUILD_TAGS}" \
|
|
||||||
-ldflags '-s -buildid= -X github.com/sagernet/sing-box/constant.Version=${{ needs.calculate_version.outputs.version }} -checklinkname=0' \
|
|
||||||
./cmd/sing-box
|
|
||||||
env:
|
|
||||||
CGO_ENABLED: "1"
|
|
||||||
GOOS: linux
|
|
||||||
GOARCH: ${{ matrix.arch }}
|
|
||||||
GOARM: ${{ matrix.goarm }}
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
- name: Build (non-naive)
|
|
||||||
if: ${{ ! matrix.naive }}
|
|
||||||
run: |
|
run: |
|
||||||
set -xeuo pipefail
|
set -xeuo pipefail
|
||||||
mkdir -p dist
|
mkdir -p dist
|
||||||
@@ -234,6 +185,5 @@ jobs:
|
|||||||
path: dist
|
path: dist
|
||||||
merge-multiple: true
|
merge-multiple: true
|
||||||
- name: Publish packages
|
- name: Publish packages
|
||||||
if: github.event_name != 'push'
|
|
||||||
run: |-
|
run: |-
|
||||||
ls dist | xargs -I {} curl -F "package=@dist/{}" https://${{ secrets.FURY_TOKEN }}@push.fury.io/sagernet/
|
ls dist | xargs -I {} curl -F "package=@dist/{}" https://${{ secrets.FURY_TOKEN }}@push.fury.io/sagernet/
|
||||||
|
|||||||
103
.goreleaser.fury.yaml
Normal file
103
.goreleaser.fury.yaml
Normal file
@@ -0,0 +1,103 @@
|
|||||||
|
project_name: sing-box
|
||||||
|
builds:
|
||||||
|
- id: main
|
||||||
|
main: ./cmd/sing-box
|
||||||
|
flags:
|
||||||
|
- -v
|
||||||
|
- -trimpath
|
||||||
|
ldflags:
|
||||||
|
- -X github.com/sagernet/sing-box/constant.Version={{ .Version }}
|
||||||
|
- -s
|
||||||
|
- -buildid=
|
||||||
|
tags:
|
||||||
|
- with_gvisor
|
||||||
|
- with_quic
|
||||||
|
- with_dhcp
|
||||||
|
- with_wireguard
|
||||||
|
- with_utls
|
||||||
|
- with_acme
|
||||||
|
- with_clash_api
|
||||||
|
- with_tailscale
|
||||||
|
env:
|
||||||
|
- CGO_ENABLED=0
|
||||||
|
targets:
|
||||||
|
- linux_386
|
||||||
|
- linux_amd64_v1
|
||||||
|
- linux_arm64
|
||||||
|
- linux_arm_7
|
||||||
|
- linux_s390x
|
||||||
|
- linux_riscv64
|
||||||
|
- linux_mips64le
|
||||||
|
mod_timestamp: '{{ .CommitTimestamp }}'
|
||||||
|
snapshot:
|
||||||
|
name_template: "{{ .Version }}.{{ .ShortCommit }}"
|
||||||
|
nfpms:
|
||||||
|
- &template
|
||||||
|
id: package
|
||||||
|
package_name: sing-box
|
||||||
|
file_name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ with .Arm }}v{{ . }}{{ end }}{{ with .Mips }}_{{ . }}{{ end }}{{ if not (eq .Amd64 "v1") }}{{ .Amd64 }}{{ end }}'
|
||||||
|
builds:
|
||||||
|
- main
|
||||||
|
homepage: https://sing-box.sagernet.org/
|
||||||
|
maintainer: nekohasekai <contact-git@sekai.icu>
|
||||||
|
description: The universal proxy platform.
|
||||||
|
license: GPLv3 or later
|
||||||
|
formats:
|
||||||
|
- deb
|
||||||
|
- rpm
|
||||||
|
priority: extra
|
||||||
|
contents:
|
||||||
|
- src: release/config/config.json
|
||||||
|
dst: /etc/sing-box/config.json
|
||||||
|
type: "config|noreplace"
|
||||||
|
|
||||||
|
- src: release/config/sing-box.service
|
||||||
|
dst: /usr/lib/systemd/system/sing-box.service
|
||||||
|
- src: release/config/sing-box@.service
|
||||||
|
dst: /usr/lib/systemd/system/sing-box@.service
|
||||||
|
- src: release/config/sing-box.sysusers
|
||||||
|
dst: /usr/lib/sysusers.d/sing-box.conf
|
||||||
|
- src: release/config/sing-box.rules
|
||||||
|
dst: /usr/share/polkit-1/rules.d/sing-box.rules
|
||||||
|
- src: release/config/sing-box-split-dns.xml
|
||||||
|
dst: /usr/share/dbus-1/system.d/sing-box-split-dns.conf
|
||||||
|
|
||||||
|
- src: release/completions/sing-box.bash
|
||||||
|
dst: /usr/share/bash-completion/completions/sing-box.bash
|
||||||
|
- src: release/completions/sing-box.fish
|
||||||
|
dst: /usr/share/fish/vendor_completions.d/sing-box.fish
|
||||||
|
- src: release/completions/sing-box.zsh
|
||||||
|
dst: /usr/share/zsh/site-functions/_sing-box
|
||||||
|
|
||||||
|
- src: LICENSE
|
||||||
|
dst: /usr/share/licenses/sing-box/LICENSE
|
||||||
|
deb:
|
||||||
|
signature:
|
||||||
|
key_file: "{{ .Env.NFPM_KEY_PATH }}"
|
||||||
|
fields:
|
||||||
|
Bugs: https://github.com/SagerNet/sing-box/issues
|
||||||
|
rpm:
|
||||||
|
signature:
|
||||||
|
key_file: "{{ .Env.NFPM_KEY_PATH }}"
|
||||||
|
conflicts:
|
||||||
|
- sing-box-beta
|
||||||
|
- id: package_beta
|
||||||
|
<<: *template
|
||||||
|
package_name: sing-box-beta
|
||||||
|
file_name_template: '{{ .ProjectName }}-beta_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ with .Arm }}v{{ . }}{{ end }}{{ with .Mips }}_{{ . }}{{ end }}{{ if not (eq .Amd64 "v1") }}{{ .Amd64 }}{{ end }}'
|
||||||
|
formats:
|
||||||
|
- deb
|
||||||
|
- rpm
|
||||||
|
conflicts:
|
||||||
|
- sing-box
|
||||||
|
release:
|
||||||
|
disable: true
|
||||||
|
furies:
|
||||||
|
- account: sagernet
|
||||||
|
ids:
|
||||||
|
- package
|
||||||
|
disable: "{{ not (not .Prerelease) }}"
|
||||||
|
- account: sagernet
|
||||||
|
ids:
|
||||||
|
- package_beta
|
||||||
|
disable: "{{ not .Prerelease }}"
|
||||||
213
.goreleaser.yaml
Normal file
213
.goreleaser.yaml
Normal file
@@ -0,0 +1,213 @@
|
|||||||
|
version: 2
|
||||||
|
project_name: sing-box
|
||||||
|
builds:
|
||||||
|
- &template
|
||||||
|
id: main
|
||||||
|
main: ./cmd/sing-box
|
||||||
|
flags:
|
||||||
|
- -v
|
||||||
|
- -trimpath
|
||||||
|
ldflags:
|
||||||
|
- -X github.com/sagernet/sing-box/constant.Version={{ .Version }}
|
||||||
|
- -s
|
||||||
|
- -buildid=
|
||||||
|
tags:
|
||||||
|
- with_gvisor
|
||||||
|
- with_quic
|
||||||
|
- with_dhcp
|
||||||
|
- with_wireguard
|
||||||
|
- with_utls
|
||||||
|
- with_acme
|
||||||
|
- with_clash_api
|
||||||
|
- with_tailscale
|
||||||
|
env:
|
||||||
|
- CGO_ENABLED=0
|
||||||
|
- GOTOOLCHAIN=local
|
||||||
|
targets:
|
||||||
|
- linux_386
|
||||||
|
- linux_amd64_v1
|
||||||
|
- linux_arm64
|
||||||
|
- linux_arm_6
|
||||||
|
- linux_arm_7
|
||||||
|
- linux_s390x
|
||||||
|
- linux_riscv64
|
||||||
|
- linux_mips64le
|
||||||
|
- windows_amd64_v1
|
||||||
|
- windows_386
|
||||||
|
- windows_arm64
|
||||||
|
- darwin_amd64_v1
|
||||||
|
- darwin_arm64
|
||||||
|
mod_timestamp: '{{ .CommitTimestamp }}'
|
||||||
|
- id: legacy
|
||||||
|
<<: *template
|
||||||
|
tags:
|
||||||
|
- with_gvisor
|
||||||
|
- with_quic
|
||||||
|
- with_dhcp
|
||||||
|
- with_wireguard
|
||||||
|
- with_utls
|
||||||
|
- with_acme
|
||||||
|
- with_clash_api
|
||||||
|
- with_tailscale
|
||||||
|
env:
|
||||||
|
- CGO_ENABLED=0
|
||||||
|
- GOROOT={{ .Env.GOPATH }}/go_legacy
|
||||||
|
tool: "{{ .Env.GOPATH }}/go_legacy/bin/go"
|
||||||
|
targets:
|
||||||
|
- windows_amd64_v1
|
||||||
|
- windows_386
|
||||||
|
- id: android
|
||||||
|
<<: *template
|
||||||
|
env:
|
||||||
|
- CGO_ENABLED=1
|
||||||
|
- GOTOOLCHAIN=local
|
||||||
|
overrides:
|
||||||
|
- goos: android
|
||||||
|
goarch: arm
|
||||||
|
goarm: 7
|
||||||
|
env:
|
||||||
|
- CC=armv7a-linux-androideabi21-clang
|
||||||
|
- CXX=armv7a-linux-androideabi21-clang++
|
||||||
|
- goos: android
|
||||||
|
goarch: arm64
|
||||||
|
env:
|
||||||
|
- CC=aarch64-linux-android21-clang
|
||||||
|
- CXX=aarch64-linux-android21-clang++
|
||||||
|
- goos: android
|
||||||
|
goarch: 386
|
||||||
|
env:
|
||||||
|
- CC=i686-linux-android21-clang
|
||||||
|
- CXX=i686-linux-android21-clang++
|
||||||
|
- goos: android
|
||||||
|
goarch: amd64
|
||||||
|
goamd64: v1
|
||||||
|
env:
|
||||||
|
- CC=x86_64-linux-android21-clang
|
||||||
|
- CXX=x86_64-linux-android21-clang++
|
||||||
|
targets:
|
||||||
|
- android_arm_7
|
||||||
|
- android_arm64
|
||||||
|
- android_386
|
||||||
|
- android_amd64
|
||||||
|
archives:
|
||||||
|
- &template
|
||||||
|
id: archive
|
||||||
|
builds:
|
||||||
|
- main
|
||||||
|
- android
|
||||||
|
formats:
|
||||||
|
- tar.gz
|
||||||
|
format_overrides:
|
||||||
|
- goos: windows
|
||||||
|
formats:
|
||||||
|
- zip
|
||||||
|
wrap_in_directory: true
|
||||||
|
files:
|
||||||
|
- LICENSE
|
||||||
|
name_template: '{{ .ProjectName }}-{{ .Version }}-{{ .Os }}-{{ .Arch }}{{ with .Arm }}v{{ . }}{{ end }}{{ if and .Mips (not (eq .Mips "hardfloat")) }}_{{ .Mips }}{{ end }}{{ if not (eq .Amd64 "v1") }}{{ .Amd64 }}{{ end }}'
|
||||||
|
- id: archive-legacy
|
||||||
|
<<: *template
|
||||||
|
builds:
|
||||||
|
- legacy
|
||||||
|
name_template: '{{ .ProjectName }}-{{ .Version }}-{{ .Os }}-{{ .Arch }}-legacy'
|
||||||
|
nfpms:
|
||||||
|
- id: package
|
||||||
|
package_name: sing-box
|
||||||
|
file_name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ with .Arm }}v{{ . }}{{ end }}{{ if and .Mips (not (eq .Mips "hardfloat")) }}_{{ .Mips }}{{ end }}{{ if not (eq .Amd64 "v1") }}{{ .Amd64 }}{{ end }}'
|
||||||
|
builds:
|
||||||
|
- main
|
||||||
|
homepage: https://sing-box.sagernet.org/
|
||||||
|
maintainer: nekohasekai <contact-git@sekai.icu>
|
||||||
|
description: The universal proxy platform.
|
||||||
|
license: GPLv3 or later
|
||||||
|
formats:
|
||||||
|
- deb
|
||||||
|
- rpm
|
||||||
|
- archlinux
|
||||||
|
# - apk
|
||||||
|
# - ipk
|
||||||
|
priority: extra
|
||||||
|
contents:
|
||||||
|
- src: release/config/config.json
|
||||||
|
dst: /etc/sing-box/config.json
|
||||||
|
type: "config|noreplace"
|
||||||
|
|
||||||
|
- src: release/config/sing-box.service
|
||||||
|
dst: /usr/lib/systemd/system/sing-box.service
|
||||||
|
- src: release/config/sing-box@.service
|
||||||
|
dst: /usr/lib/systemd/system/sing-box@.service
|
||||||
|
- src: release/config/sing-box.sysusers
|
||||||
|
dst: /usr/lib/sysusers.d/sing-box.conf
|
||||||
|
- src: release/config/sing-box.rules
|
||||||
|
dst: /usr/share/polkit-1/rules.d/sing-box.rules
|
||||||
|
- src: release/config/sing-box-split-dns.xml
|
||||||
|
dst: /usr/share/dbus-1/system.d/sing-box-split-dns.conf
|
||||||
|
|
||||||
|
- src: release/completions/sing-box.bash
|
||||||
|
dst: /usr/share/bash-completion/completions/sing-box.bash
|
||||||
|
- src: release/completions/sing-box.fish
|
||||||
|
dst: /usr/share/fish/vendor_completions.d/sing-box.fish
|
||||||
|
- src: release/completions/sing-box.zsh
|
||||||
|
dst: /usr/share/zsh/site-functions/_sing-box
|
||||||
|
|
||||||
|
- src: LICENSE
|
||||||
|
dst: /usr/share/licenses/sing-box/LICENSE
|
||||||
|
deb:
|
||||||
|
signature:
|
||||||
|
key_file: "{{ .Env.NFPM_KEY_PATH }}"
|
||||||
|
fields:
|
||||||
|
Bugs: https://github.com/SagerNet/sing-box/issues
|
||||||
|
rpm:
|
||||||
|
signature:
|
||||||
|
key_file: "{{ .Env.NFPM_KEY_PATH }}"
|
||||||
|
overrides:
|
||||||
|
apk:
|
||||||
|
contents:
|
||||||
|
- src: release/config/config.json
|
||||||
|
dst: /etc/sing-box/config.json
|
||||||
|
type: config
|
||||||
|
|
||||||
|
- src: release/config/sing-box.initd
|
||||||
|
dst: /etc/init.d/sing-box
|
||||||
|
|
||||||
|
- src: release/completions/sing-box.bash
|
||||||
|
dst: /usr/share/bash-completion/completions/sing-box.bash
|
||||||
|
- src: release/completions/sing-box.fish
|
||||||
|
dst: /usr/share/fish/vendor_completions.d/sing-box.fish
|
||||||
|
- src: release/completions/sing-box.zsh
|
||||||
|
dst: /usr/share/zsh/site-functions/_sing-box
|
||||||
|
|
||||||
|
- src: LICENSE
|
||||||
|
dst: /usr/share/licenses/sing-box/LICENSE
|
||||||
|
ipk:
|
||||||
|
contents:
|
||||||
|
- src: release/config/config.json
|
||||||
|
dst: /etc/sing-box/config.json
|
||||||
|
type: config
|
||||||
|
|
||||||
|
- src: release/config/openwrt.init
|
||||||
|
dst: /etc/init.d/sing-box
|
||||||
|
- src: release/config/openwrt.conf
|
||||||
|
dst: /etc/config/sing-box
|
||||||
|
source:
|
||||||
|
enabled: false
|
||||||
|
name_template: '{{ .ProjectName }}-{{ .Version }}.source'
|
||||||
|
prefix_template: '{{ .ProjectName }}-{{ .Version }}/'
|
||||||
|
checksum:
|
||||||
|
disable: true
|
||||||
|
name_template: '{{ .ProjectName }}-{{ .Version }}.checksum'
|
||||||
|
signs:
|
||||||
|
- artifacts: checksum
|
||||||
|
release:
|
||||||
|
github:
|
||||||
|
owner: SagerNet
|
||||||
|
name: sing-box
|
||||||
|
draft: true
|
||||||
|
prerelease: auto
|
||||||
|
mode: replace
|
||||||
|
ids:
|
||||||
|
- archive
|
||||||
|
- package
|
||||||
|
skip_upload: true
|
||||||
|
partial:
|
||||||
|
by: target
|
||||||
@@ -13,13 +13,15 @@ RUN set -ex \
|
|||||||
&& export COMMIT=$(git rev-parse --short HEAD) \
|
&& export COMMIT=$(git rev-parse --short HEAD) \
|
||||||
&& export VERSION=$(go run ./cmd/internal/read_tag) \
|
&& export VERSION=$(go run ./cmd/internal/read_tag) \
|
||||||
&& go build -v -trimpath -tags \
|
&& go build -v -trimpath -tags \
|
||||||
"with_gvisor,with_quic,with_dhcp,with_wireguard,with_utls,with_acme,with_clash_api,with_tailscale,with_ccm,with_ocm,badlinkname,tfogo_checklinkname0" \
|
"with_gvisor,with_quic,with_dhcp,with_wireguard,with_utls,with_acme,with_clash_api,with_tailscale,badlinkname,tfogo_checklinkname0" \
|
||||||
-o /go/bin/sing-box \
|
-o /go/bin/sing-box \
|
||||||
-ldflags "-X \"github.com/sagernet/sing-box/constant.Version=$VERSION\" -s -w -buildid= -checklinkname=0" \
|
-ldflags "-X \"github.com/sagernet/sing-box/constant.Version=$VERSION\" -s -w -buildid= -checklinkname=0" \
|
||||||
./cmd/sing-box
|
./cmd/sing-box
|
||||||
FROM --platform=$TARGETPLATFORM alpine AS dist
|
FROM --platform=$TARGETPLATFORM alpine AS dist
|
||||||
LABEL maintainer="nekohasekai <contact-git@sekai.icu>"
|
LABEL maintainer="nekohasekai <contact-git@sekai.icu>"
|
||||||
RUN set -ex \
|
RUN set -ex \
|
||||||
&& apk add --no-cache --upgrade bash tzdata ca-certificates nftables
|
&& apk upgrade \
|
||||||
|
&& apk add bash tzdata ca-certificates nftables \
|
||||||
|
&& rm -rf /var/cache/apk/*
|
||||||
COPY --from=builder /go/bin/sing-box /usr/local/bin/sing-box
|
COPY --from=builder /go/bin/sing-box /usr/local/bin/sing-box
|
||||||
ENTRYPOINT ["sing-box"]
|
ENTRYPOINT ["sing-box"]
|
||||||
|
|||||||
@@ -1,8 +0,0 @@
|
|||||||
FROM alpine
|
|
||||||
ARG TARGETARCH
|
|
||||||
ARG TARGETVARIANT
|
|
||||||
LABEL maintainer="nekohasekai <contact-git@sekai.icu>"
|
|
||||||
RUN set -ex \
|
|
||||||
&& apk add --no-cache --upgrade bash tzdata ca-certificates nftables
|
|
||||||
COPY sing-box-${TARGETARCH}${TARGETVARIANT} /usr/local/bin/sing-box
|
|
||||||
ENTRYPOINT ["sing-box"]
|
|
||||||
6
Makefile
6
Makefile
@@ -1,6 +1,6 @@
|
|||||||
NAME = sing-box
|
NAME = sing-box
|
||||||
COMMIT = $(shell git rev-parse --short HEAD)
|
COMMIT = $(shell git rev-parse --short HEAD)
|
||||||
TAGS ?= with_gvisor,with_quic,with_dhcp,with_wireguard,with_utls,with_acme,with_clash_api,with_tailscale,with_ccm,with_ocm,badlinkname,tfogo_checklinkname0
|
TAGS ?= with_gvisor,with_quic,with_dhcp,with_wireguard,with_utls,with_acme,with_clash_api,with_tailscale,badlinkname,tfogo_checklinkname0
|
||||||
|
|
||||||
GOHOSTOS = $(shell go env GOHOSTOS)
|
GOHOSTOS = $(shell go env GOHOSTOS)
|
||||||
GOHOSTARCH = $(shell go env GOHOSTARCH)
|
GOHOSTARCH = $(shell go env GOHOSTARCH)
|
||||||
@@ -249,8 +249,8 @@ lib:
|
|||||||
go run ./cmd/internal/build_libbox -target ios
|
go run ./cmd/internal/build_libbox -target ios
|
||||||
|
|
||||||
lib_install:
|
lib_install:
|
||||||
go install -v github.com/sagernet/gomobile/cmd/gomobile@v0.1.10
|
go install -v github.com/sagernet/gomobile/cmd/gomobile@v0.1.8
|
||||||
go install -v github.com/sagernet/gomobile/cmd/gobind@v0.1.10
|
go install -v github.com/sagernet/gomobile/cmd/gobind@v0.1.8
|
||||||
|
|
||||||
docs:
|
docs:
|
||||||
venv/bin/mkdocs serve
|
venv/bin/mkdocs serve
|
||||||
|
|||||||
@@ -1,11 +1,3 @@
|
|||||||
> Sponsored by [Warp](https://go.warp.dev/sing-box), built for coding with multiple AI agents
|
|
||||||
|
|
||||||
<a href="https://go.warp.dev/sing-box">
|
|
||||||
<img alt="Warp sponsorship" width="400" src="https://github.com/warpdotdev/brand-assets/raw/refs/heads/main/Github/Sponsor/Warp-Github-LG-02.png">
|
|
||||||
</a>
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
# sing-box
|
# sing-box
|
||||||
|
|
||||||
The universal proxy platform.
|
The universal proxy platform.
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import (
|
|||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/sagernet/sing/common/observable"
|
|
||||||
"github.com/sagernet/sing/common/varbin"
|
"github.com/sagernet/sing/common/varbin"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -15,7 +14,6 @@ type ClashServer interface {
|
|||||||
ConnectionTracker
|
ConnectionTracker
|
||||||
Mode() string
|
Mode() string
|
||||||
ModeList() []string
|
ModeList() []string
|
||||||
SetModeUpdateHook(hook *observable.Subscriber[struct{}])
|
|
||||||
HistoryStorage() URLTestHistoryStorage
|
HistoryStorage() URLTestHistoryStorage
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -25,7 +23,7 @@ type URLTestHistory struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type URLTestHistoryStorage interface {
|
type URLTestHistoryStorage interface {
|
||||||
SetHook(hook *observable.Subscriber[struct{}])
|
SetHook(hook chan<- struct{})
|
||||||
LoadURLTestHistory(tag string) *URLTestHistory
|
LoadURLTestHistory(tag string) *URLTestHistory
|
||||||
DeleteURLTestHistory(tag string)
|
DeleteURLTestHistory(tag string)
|
||||||
StoreURLTestHistory(tag string, history *URLTestHistory)
|
StoreURLTestHistory(tag string, history *URLTestHistory)
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ func NewUpstreamContextHandlerEx(
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (w *myUpstreamContextHandlerWrapperEx) NewConnectionEx(ctx context.Context, conn net.Conn, source M.Socksaddr, destination M.Socksaddr, onClose N.CloseHandlerFunc) {
|
func (w *myUpstreamContextHandlerWrapperEx) NewConnectionEx(ctx context.Context, conn net.Conn, source M.Socksaddr, destination M.Socksaddr, onClose N.CloseHandlerFunc) {
|
||||||
_, myMetadata := ExtendContext(ctx)
|
myMetadata := ContextFrom(ctx)
|
||||||
if source.IsValid() {
|
if source.IsValid() {
|
||||||
myMetadata.Source = source
|
myMetadata.Source = source
|
||||||
}
|
}
|
||||||
@@ -84,7 +84,7 @@ func (w *myUpstreamContextHandlerWrapperEx) NewConnectionEx(ctx context.Context,
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (w *myUpstreamContextHandlerWrapperEx) NewPacketConnectionEx(ctx context.Context, conn N.PacketConn, source M.Socksaddr, destination M.Socksaddr, onClose N.CloseHandlerFunc) {
|
func (w *myUpstreamContextHandlerWrapperEx) NewPacketConnectionEx(ctx context.Context, conn N.PacketConn, source M.Socksaddr, destination M.Socksaddr, onClose N.CloseHandlerFunc) {
|
||||||
_, myMetadata := ExtendContext(ctx)
|
myMetadata := ContextFrom(ctx)
|
||||||
if source.IsValid() {
|
if source.IsValid() {
|
||||||
myMetadata.Source = source
|
myMetadata.Source = source
|
||||||
}
|
}
|
||||||
@@ -146,7 +146,7 @@ type routeContextHandlerWrapperEx struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (r *routeContextHandlerWrapperEx) NewConnectionEx(ctx context.Context, conn net.Conn, source M.Socksaddr, destination M.Socksaddr, onClose N.CloseHandlerFunc) {
|
func (r *routeContextHandlerWrapperEx) NewConnectionEx(ctx context.Context, conn net.Conn, source M.Socksaddr, destination M.Socksaddr, onClose N.CloseHandlerFunc) {
|
||||||
_, metadata := ExtendContext(ctx)
|
metadata := ContextFrom(ctx)
|
||||||
if source.IsValid() {
|
if source.IsValid() {
|
||||||
metadata.Source = source
|
metadata.Source = source
|
||||||
}
|
}
|
||||||
@@ -157,7 +157,7 @@ func (r *routeContextHandlerWrapperEx) NewConnectionEx(ctx context.Context, conn
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (r *routeContextHandlerWrapperEx) NewPacketConnectionEx(ctx context.Context, conn N.PacketConn, source M.Socksaddr, destination M.Socksaddr, onClose N.CloseHandlerFunc) {
|
func (r *routeContextHandlerWrapperEx) NewPacketConnectionEx(ctx context.Context, conn N.PacketConn, source M.Socksaddr, destination M.Socksaddr, onClose N.CloseHandlerFunc) {
|
||||||
_, metadata := ExtendContext(ctx)
|
metadata := ContextFrom(ctx)
|
||||||
if source.IsValid() {
|
if source.IsValid() {
|
||||||
metadata.Source = source
|
metadata.Source = source
|
||||||
}
|
}
|
||||||
|
|||||||
Submodule clients/android updated: f3763ba71d...e08fbfcfea
Submodule clients/apple updated: 532c140f05...84d8cf1757
@@ -46,7 +46,7 @@ var (
|
|||||||
sharedFlags []string
|
sharedFlags []string
|
||||||
debugFlags []string
|
debugFlags []string
|
||||||
sharedTags []string
|
sharedTags []string
|
||||||
darwinTags []string
|
macOSTags []string
|
||||||
memcTags []string
|
memcTags []string
|
||||||
notMemcTags []string
|
notMemcTags []string
|
||||||
debugTags []string
|
debugTags []string
|
||||||
@@ -62,8 +62,8 @@ func init() {
|
|||||||
sharedFlags = append(sharedFlags, "-ldflags", "-X github.com/sagernet/sing-box/constant.Version="+currentTag+" -s -w -buildid= -checklinkname=0")
|
sharedFlags = append(sharedFlags, "-ldflags", "-X github.com/sagernet/sing-box/constant.Version="+currentTag+" -s -w -buildid= -checklinkname=0")
|
||||||
debugFlags = append(debugFlags, "-ldflags", "-X github.com/sagernet/sing-box/constant.Version="+currentTag+" -checklinkname=0")
|
debugFlags = append(debugFlags, "-ldflags", "-X github.com/sagernet/sing-box/constant.Version="+currentTag+" -checklinkname=0")
|
||||||
|
|
||||||
sharedTags = append(sharedTags, "with_gvisor", "with_quic", "with_wireguard", "with_utls", "with_naive_outbound", "with_clash_api", "with_conntrack", "badlinkname", "tfogo_checklinkname0")
|
sharedTags = append(sharedTags, "with_gvisor", "with_quic", "with_wireguard", "with_utls", "with_clash_api", "with_conntrack", "badlinkname", "tfogo_checklinkname0")
|
||||||
darwinTags = append(darwinTags, "with_dhcp")
|
macOSTags = append(macOSTags, "with_dhcp")
|
||||||
memcTags = append(memcTags, "with_tailscale")
|
memcTags = append(memcTags, "with_tailscale")
|
||||||
notMemcTags = append(notMemcTags, "with_low_memory")
|
notMemcTags = append(notMemcTags, "with_low_memory")
|
||||||
debugTags = append(debugTags, "debug")
|
debugTags = append(debugTags, "debug")
|
||||||
@@ -158,7 +158,9 @@ func buildApple() {
|
|||||||
"-tags-not-macos=with_low_memory",
|
"-tags-not-macos=with_low_memory",
|
||||||
}
|
}
|
||||||
if !withTailscale {
|
if !withTailscale {
|
||||||
args = append(args, "-tags-macos="+strings.Join(memcTags, ","))
|
args = append(args, "-tags-macos="+strings.Join(append(macOSTags, memcTags...), ","))
|
||||||
|
} else {
|
||||||
|
args = append(args, "-tags-macos="+strings.Join(macOSTags, ","))
|
||||||
}
|
}
|
||||||
|
|
||||||
if !debugEnabled {
|
if !debugEnabled {
|
||||||
@@ -167,7 +169,7 @@ func buildApple() {
|
|||||||
args = append(args, debugFlags...)
|
args = append(args, debugFlags...)
|
||||||
}
|
}
|
||||||
|
|
||||||
tags := append(sharedTags, darwinTags...)
|
tags := sharedTags
|
||||||
if withTailscale {
|
if withTailscale {
|
||||||
tags = append(tags, memcTags...)
|
tags = append(tags, memcTags...)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -142,18 +142,9 @@ func NewDefault(ctx context.Context, options option.DialerOptions) (*DefaultDial
|
|||||||
} else {
|
} else {
|
||||||
dialer.Timeout = C.TCPConnectTimeout
|
dialer.Timeout = C.TCPConnectTimeout
|
||||||
}
|
}
|
||||||
if !options.DisableTCPKeepAlive {
|
// TODO: Add an option to customize the keep alive period
|
||||||
keepIdle := time.Duration(options.TCPKeepAlive)
|
dialer.KeepAlive = C.TCPKeepAliveInitial
|
||||||
if keepIdle == 0 {
|
dialer.Control = control.Append(dialer.Control, control.SetKeepAlivePeriod(C.TCPKeepAliveInitial, C.TCPKeepAliveInterval))
|
||||||
keepIdle = C.TCPKeepAliveInitial
|
|
||||||
}
|
|
||||||
keepInterval := time.Duration(options.TCPKeepAliveInterval)
|
|
||||||
if keepInterval == 0 {
|
|
||||||
keepInterval = C.TCPKeepAliveInterval
|
|
||||||
}
|
|
||||||
dialer.KeepAlive = keepIdle
|
|
||||||
dialer.Control = control.Append(dialer.Control, control.SetKeepAlivePeriod(keepIdle, keepInterval))
|
|
||||||
}
|
|
||||||
var udpFragment bool
|
var udpFragment bool
|
||||||
if options.UDPFragment != nil {
|
if options.UDPFragment != nil {
|
||||||
udpFragment = *options.UDPFragment
|
udpFragment = *options.UDPFragment
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ func (l *Listener) ListenTCP() (net.Listener, error) {
|
|||||||
if l.listenOptions.ReuseAddr {
|
if l.listenOptions.ReuseAddr {
|
||||||
listenConfig.Control = control.Append(listenConfig.Control, control.ReuseAddr())
|
listenConfig.Control = control.Append(listenConfig.Control, control.ReuseAddr())
|
||||||
}
|
}
|
||||||
if !l.listenOptions.DisableTCPKeepAlive {
|
if l.listenOptions.TCPKeepAlive >= 0 {
|
||||||
keepIdle := time.Duration(l.listenOptions.TCPKeepAlive)
|
keepIdle := time.Duration(l.listenOptions.TCPKeepAlive)
|
||||||
if keepIdle == 0 {
|
if keepIdle == 0 {
|
||||||
keepIdle = C.TCPKeepAliveInitial
|
keepIdle = C.TCPKeepAliveInitial
|
||||||
|
|||||||
@@ -134,9 +134,7 @@ func (m *connmanMonitor) monitorSignals(ctx context.Context, signalChan chan *db
|
|||||||
if !ok {
|
if !ok {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// godbus Signal.Name uses "interface.member" format (e.g. "net.connman.Service.PropertyChanged"),
|
if signal.Name == "PropertyChanged" {
|
||||||
// not just the member name. This differs from the D-Bus signal member in the match rule.
|
|
||||||
if signal.Name == "net.connman.Service.PropertyChanged" {
|
|
||||||
state := m.ReadWIFIState()
|
state := m.ReadWIFIState()
|
||||||
if state != lastState {
|
if state != lastState {
|
||||||
lastState = state
|
lastState = state
|
||||||
@@ -156,10 +154,6 @@ func (m *connmanMonitor) Close() error {
|
|||||||
close(m.signalChan)
|
close(m.signalChan)
|
||||||
}
|
}
|
||||||
if m.conn != nil {
|
if m.conn != nil {
|
||||||
m.conn.RemoveMatchSignal(
|
|
||||||
dbus.WithMatchInterface("net.connman.Service"),
|
|
||||||
dbus.WithMatchSender("net.connman"),
|
|
||||||
)
|
|
||||||
return m.conn.Close()
|
return m.conn.Close()
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
@@ -178,10 +178,6 @@ func (m *iwdMonitor) Close() error {
|
|||||||
close(m.signalChan)
|
close(m.signalChan)
|
||||||
}
|
}
|
||||||
if m.conn != nil {
|
if m.conn != nil {
|
||||||
m.conn.RemoveMatchSignal(
|
|
||||||
dbus.WithMatchInterface("org.freedesktop.DBus.Properties"),
|
|
||||||
dbus.WithMatchSender("net.connman.iwd"),
|
|
||||||
)
|
|
||||||
return m.conn.Close()
|
return m.conn.Close()
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
@@ -40,59 +40,57 @@ func (m *networkManagerMonitor) ReadWIFIState() adapter.WIFIState {
|
|||||||
|
|
||||||
nmObj := m.conn.Object("org.freedesktop.NetworkManager", "/org/freedesktop/NetworkManager")
|
nmObj := m.conn.Object("org.freedesktop.NetworkManager", "/org/freedesktop/NetworkManager")
|
||||||
|
|
||||||
var activeConnectionPaths []dbus.ObjectPath
|
var primaryConnectionPath dbus.ObjectPath
|
||||||
err := nmObj.CallWithContext(ctx, "org.freedesktop.DBus.Properties.Get", 0, "org.freedesktop.NetworkManager", "ActiveConnections").Store(&activeConnectionPaths)
|
err := nmObj.CallWithContext(ctx, "org.freedesktop.DBus.Properties.Get", 0, "org.freedesktop.NetworkManager", "PrimaryConnection").Store(&primaryConnectionPath)
|
||||||
if err != nil || len(activeConnectionPaths) == 0 {
|
if err != nil || primaryConnectionPath == "/" {
|
||||||
return adapter.WIFIState{}
|
return adapter.WIFIState{}
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, connectionPath := range activeConnectionPaths {
|
connObj := m.conn.Object("org.freedesktop.NetworkManager", primaryConnectionPath)
|
||||||
connObj := m.conn.Object("org.freedesktop.NetworkManager", connectionPath)
|
|
||||||
|
|
||||||
var devicePaths []dbus.ObjectPath
|
var devicePaths []dbus.ObjectPath
|
||||||
err = connObj.CallWithContext(ctx, "org.freedesktop.DBus.Properties.Get", 0, "org.freedesktop.NetworkManager.Connection.Active", "Devices").Store(&devicePaths)
|
err = connObj.CallWithContext(ctx, "org.freedesktop.DBus.Properties.Get", 0, "org.freedesktop.NetworkManager.Connection.Active", "Devices").Store(&devicePaths)
|
||||||
if err != nil || len(devicePaths) == 0 {
|
if err != nil || len(devicePaths) == 0 {
|
||||||
|
return adapter.WIFIState{}
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, devicePath := range devicePaths {
|
||||||
|
deviceObj := m.conn.Object("org.freedesktop.NetworkManager", devicePath)
|
||||||
|
|
||||||
|
var deviceType uint32
|
||||||
|
err = deviceObj.CallWithContext(ctx, "org.freedesktop.DBus.Properties.Get", 0, "org.freedesktop.NetworkManager.Device", "DeviceType").Store(&deviceType)
|
||||||
|
if err != nil || deviceType != 2 {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, devicePath := range devicePaths {
|
var accessPointPath dbus.ObjectPath
|
||||||
deviceObj := m.conn.Object("org.freedesktop.NetworkManager", devicePath)
|
err = deviceObj.CallWithContext(ctx, "org.freedesktop.DBus.Properties.Get", 0, "org.freedesktop.NetworkManager.Device.Wireless", "ActiveAccessPoint").Store(&accessPointPath)
|
||||||
|
if err != nil || accessPointPath == "/" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
var deviceType uint32
|
apObj := m.conn.Object("org.freedesktop.NetworkManager", accessPointPath)
|
||||||
err = deviceObj.CallWithContext(ctx, "org.freedesktop.DBus.Properties.Get", 0, "org.freedesktop.NetworkManager.Device", "DeviceType").Store(&deviceType)
|
|
||||||
if err != nil || deviceType != 2 {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
var accessPointPath dbus.ObjectPath
|
var ssidBytes []byte
|
||||||
err = deviceObj.CallWithContext(ctx, "org.freedesktop.DBus.Properties.Get", 0, "org.freedesktop.NetworkManager.Device.Wireless", "ActiveAccessPoint").Store(&accessPointPath)
|
err = apObj.CallWithContext(ctx, "org.freedesktop.DBus.Properties.Get", 0, "org.freedesktop.NetworkManager.AccessPoint", "Ssid").Store(&ssidBytes)
|
||||||
if err != nil || accessPointPath == "/" {
|
if err != nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
apObj := m.conn.Object("org.freedesktop.NetworkManager", accessPointPath)
|
var hwAddress string
|
||||||
|
err = apObj.CallWithContext(ctx, "org.freedesktop.DBus.Properties.Get", 0, "org.freedesktop.NetworkManager.AccessPoint", "HwAddress").Store(&hwAddress)
|
||||||
|
if err != nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
var ssidBytes []byte
|
ssid := strings.TrimSpace(string(ssidBytes))
|
||||||
err = apObj.CallWithContext(ctx, "org.freedesktop.DBus.Properties.Get", 0, "org.freedesktop.NetworkManager.AccessPoint", "Ssid").Store(&ssidBytes)
|
if ssid == "" {
|
||||||
if err != nil {
|
continue
|
||||||
continue
|
}
|
||||||
}
|
|
||||||
|
|
||||||
var hwAddress string
|
return adapter.WIFIState{
|
||||||
err = apObj.CallWithContext(ctx, "org.freedesktop.DBus.Properties.Get", 0, "org.freedesktop.NetworkManager.AccessPoint", "HwAddress").Store(&hwAddress)
|
SSID: ssid,
|
||||||
if err != nil {
|
BSSID: strings.ToUpper(strings.ReplaceAll(hwAddress, ":", "")),
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
ssid := strings.TrimSpace(string(ssidBytes))
|
|
||||||
if ssid == "" {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
return adapter.WIFIState{
|
|
||||||
SSID: ssid,
|
|
||||||
BSSID: strings.ToUpper(strings.ReplaceAll(hwAddress, ":", "")),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -153,10 +151,6 @@ func (m *networkManagerMonitor) Close() error {
|
|||||||
close(m.signalChan)
|
close(m.signalChan)
|
||||||
}
|
}
|
||||||
if m.conn != nil {
|
if m.conn != nil {
|
||||||
m.conn.RemoveMatchSignal(
|
|
||||||
dbus.WithMatchSender("org.freedesktop.NetworkManager"),
|
|
||||||
dbus.WithMatchInterface("org.freedesktop.DBus.Properties"),
|
|
||||||
)
|
|
||||||
return m.conn.Close()
|
return m.conn.Close()
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
@@ -8,21 +8,15 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
|
||||||
"sync/atomic"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/sagernet/sing-box/adapter"
|
"github.com/sagernet/sing-box/adapter"
|
||||||
)
|
)
|
||||||
|
|
||||||
var wpaSocketCounter atomic.Uint64
|
|
||||||
|
|
||||||
type wpaSupplicantMonitor struct {
|
type wpaSupplicantMonitor struct {
|
||||||
socketPath string
|
socketPath string
|
||||||
callback func(adapter.WIFIState)
|
callback func(adapter.WIFIState)
|
||||||
cancel context.CancelFunc
|
cancel context.CancelFunc
|
||||||
monitorConn *net.UnixConn
|
|
||||||
connMutex sync.Mutex
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func newWpaSupplicantMonitor(callback func(adapter.WIFIState)) (WIFIMonitor, error) {
|
func newWpaSupplicantMonitor(callback func(adapter.WIFIState)) (WIFIMonitor, error) {
|
||||||
@@ -37,8 +31,7 @@ func newWpaSupplicantMonitor(callback func(adapter.WIFIState)) (WIFIMonitor, err
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
socketPath := filepath.Join(socketDir, entry.Name())
|
socketPath := filepath.Join(socketDir, entry.Name())
|
||||||
id := wpaSocketCounter.Add(1)
|
localAddr := &net.UnixAddr{Name: fmt.Sprintf("@sing-box-wpa-%d", os.Getpid()), Net: "unixgram"}
|
||||||
localAddr := &net.UnixAddr{Name: fmt.Sprintf("@sing-box-wpa-%d-%d", os.Getpid(), id), Net: "unixgram"}
|
|
||||||
remoteAddr := &net.UnixAddr{Name: socketPath, Net: "unixgram"}
|
remoteAddr := &net.UnixAddr{Name: socketPath, Net: "unixgram"}
|
||||||
conn, err := net.DialUnix("unixgram", localAddr, remoteAddr)
|
conn, err := net.DialUnix("unixgram", localAddr, remoteAddr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -52,8 +45,7 @@ func newWpaSupplicantMonitor(callback func(adapter.WIFIState)) (WIFIMonitor, err
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (m *wpaSupplicantMonitor) ReadWIFIState() adapter.WIFIState {
|
func (m *wpaSupplicantMonitor) ReadWIFIState() adapter.WIFIState {
|
||||||
id := wpaSocketCounter.Add(1)
|
localAddr := &net.UnixAddr{Name: fmt.Sprintf("@sing-box-wpa-%d", os.Getpid()), Net: "unixgram"}
|
||||||
localAddr := &net.UnixAddr{Name: fmt.Sprintf("@sing-box-wpa-%d-%d", os.Getpid(), id), Net: "unixgram"}
|
|
||||||
remoteAddr := &net.UnixAddr{Name: m.socketPath, Net: "unixgram"}
|
remoteAddr := &net.UnixAddr{Name: m.socketPath, Net: "unixgram"}
|
||||||
conn, err := net.DialUnix("unixgram", localAddr, remoteAddr)
|
conn, err := net.DialUnix("unixgram", localAddr, remoteAddr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -93,11 +85,8 @@ func (m *wpaSupplicantMonitor) ReadWIFIState() adapter.WIFIState {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// sendCommand sends a command to wpa_supplicant and returns the response.
|
|
||||||
// Commands are sent without trailing newlines per the wpa_supplicant control
|
|
||||||
// interface protocol - the official wpa_ctrl.c sends raw command strings.
|
|
||||||
func (m *wpaSupplicantMonitor) sendCommand(conn *net.UnixConn, command string) (string, error) {
|
func (m *wpaSupplicantMonitor) sendCommand(conn *net.UnixConn, command string) (string, error) {
|
||||||
_, err := conn.Write([]byte(command))
|
_, err := conn.Write([]byte(command + "\n"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
@@ -132,8 +121,6 @@ func (m *wpaSupplicantMonitor) Start() error {
|
|||||||
|
|
||||||
func (m *wpaSupplicantMonitor) monitorEvents(ctx context.Context, lastState adapter.WIFIState) {
|
func (m *wpaSupplicantMonitor) monitorEvents(ctx context.Context, lastState adapter.WIFIState) {
|
||||||
var consecutiveErrors int
|
var consecutiveErrors int
|
||||||
var debounceTimer *time.Timer
|
|
||||||
var debounceMutex sync.Mutex
|
|
||||||
|
|
||||||
localAddr := &net.UnixAddr{Name: fmt.Sprintf("@sing-box-wpa-mon-%d", os.Getpid()), Net: "unixgram"}
|
localAddr := &net.UnixAddr{Name: fmt.Sprintf("@sing-box-wpa-mon-%d", os.Getpid()), Net: "unixgram"}
|
||||||
remoteAddr := &net.UnixAddr{Name: m.socketPath, Net: "unixgram"}
|
remoteAddr := &net.UnixAddr{Name: m.socketPath, Net: "unixgram"}
|
||||||
@@ -143,14 +130,7 @@ func (m *wpaSupplicantMonitor) monitorEvents(ctx context.Context, lastState adap
|
|||||||
}
|
}
|
||||||
defer conn.Close()
|
defer conn.Close()
|
||||||
|
|
||||||
m.connMutex.Lock()
|
_, err = conn.Write([]byte("ATTACH\n"))
|
||||||
m.monitorConn = conn
|
|
||||||
m.connMutex.Unlock()
|
|
||||||
|
|
||||||
// ATTACH/DETACH commands use os_strcmp() for exact matching in wpa_supplicant,
|
|
||||||
// so they must be sent without trailing newlines.
|
|
||||||
// See: https://w1.fi/cgit/hostap/tree/wpa_supplicant/ctrl_iface_unix.c
|
|
||||||
_, err = conn.Write([]byte("ATTACH"))
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -164,12 +144,6 @@ func (m *wpaSupplicantMonitor) monitorEvents(ctx context.Context, lastState adap
|
|||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
debounceMutex.Lock()
|
|
||||||
if debounceTimer != nil {
|
|
||||||
debounceTimer.Stop()
|
|
||||||
}
|
|
||||||
debounceMutex.Unlock()
|
|
||||||
conn.Write([]byte("DETACH"))
|
|
||||||
return
|
return
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
@@ -177,14 +151,6 @@ func (m *wpaSupplicantMonitor) monitorEvents(ctx context.Context, lastState adap
|
|||||||
conn.SetReadDeadline(time.Now().Add(30 * time.Second))
|
conn.SetReadDeadline(time.Now().Add(30 * time.Second))
|
||||||
n, err := conn.Read(buf)
|
n, err := conn.Read(buf)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if netErr, ok := err.(net.Error); ok && netErr.Timeout() {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
select {
|
|
||||||
case <-ctx.Done():
|
|
||||||
return
|
|
||||||
default:
|
|
||||||
}
|
|
||||||
consecutiveErrors++
|
consecutiveErrors++
|
||||||
if consecutiveErrors > 10 {
|
if consecutiveErrors > 10 {
|
||||||
return
|
return
|
||||||
@@ -196,18 +162,11 @@ func (m *wpaSupplicantMonitor) monitorEvents(ctx context.Context, lastState adap
|
|||||||
|
|
||||||
msg := string(buf[:n])
|
msg := string(buf[:n])
|
||||||
if strings.Contains(msg, "CTRL-EVENT-CONNECTED") || strings.Contains(msg, "CTRL-EVENT-DISCONNECTED") {
|
if strings.Contains(msg, "CTRL-EVENT-CONNECTED") || strings.Contains(msg, "CTRL-EVENT-DISCONNECTED") {
|
||||||
debounceMutex.Lock()
|
state := m.ReadWIFIState()
|
||||||
if debounceTimer != nil {
|
if state != lastState {
|
||||||
debounceTimer.Stop()
|
lastState = state
|
||||||
|
m.callback(state)
|
||||||
}
|
}
|
||||||
debounceTimer = time.AfterFunc(500*time.Millisecond, func() {
|
|
||||||
state := m.ReadWIFIState()
|
|
||||||
if state != lastState {
|
|
||||||
lastState = state
|
|
||||||
m.callback(state)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
debounceMutex.Unlock()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -216,10 +175,5 @@ func (m *wpaSupplicantMonitor) Close() error {
|
|||||||
if m.cancel != nil {
|
if m.cancel != nil {
|
||||||
m.cancel()
|
m.cancel()
|
||||||
}
|
}
|
||||||
m.connMutex.Lock()
|
|
||||||
if m.monitorConn != nil {
|
|
||||||
m.monitorConn.Close()
|
|
||||||
}
|
|
||||||
m.connMutex.Unlock()
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
//go:build !linux && !windows
|
//go:build !linux
|
||||||
|
|
||||||
package settings
|
package settings
|
||||||
|
|
||||||
|
|||||||
@@ -1,144 +0,0 @@
|
|||||||
//go:build windows
|
|
||||||
|
|
||||||
package settings
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"fmt"
|
|
||||||
"strings"
|
|
||||||
"sync"
|
|
||||||
"syscall"
|
|
||||||
|
|
||||||
"github.com/sagernet/sing-box/adapter"
|
|
||||||
"github.com/sagernet/sing/common/winwlanapi"
|
|
||||||
|
|
||||||
"golang.org/x/sys/windows"
|
|
||||||
)
|
|
||||||
|
|
||||||
type windowsWIFIMonitor struct {
|
|
||||||
handle windows.Handle
|
|
||||||
callback func(adapter.WIFIState)
|
|
||||||
cancel context.CancelFunc
|
|
||||||
lastState adapter.WIFIState
|
|
||||||
mutex sync.Mutex
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewWIFIMonitor(callback func(adapter.WIFIState)) (WIFIMonitor, error) {
|
|
||||||
handle, err := winwlanapi.OpenHandle()
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
interfaces, err := winwlanapi.EnumInterfaces(handle)
|
|
||||||
if err != nil {
|
|
||||||
winwlanapi.CloseHandle(handle)
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
if len(interfaces) == 0 {
|
|
||||||
winwlanapi.CloseHandle(handle)
|
|
||||||
return nil, fmt.Errorf("no wireless interfaces found")
|
|
||||||
}
|
|
||||||
|
|
||||||
return &windowsWIFIMonitor{
|
|
||||||
handle: handle,
|
|
||||||
callback: callback,
|
|
||||||
}, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *windowsWIFIMonitor) ReadWIFIState() adapter.WIFIState {
|
|
||||||
interfaces, err := winwlanapi.EnumInterfaces(m.handle)
|
|
||||||
if err != nil || len(interfaces) == 0 {
|
|
||||||
return adapter.WIFIState{}
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, iface := range interfaces {
|
|
||||||
if iface.InterfaceState != winwlanapi.InterfaceStateConnected {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
guid := iface.InterfaceGUID
|
|
||||||
attrs, err := winwlanapi.QueryCurrentConnection(m.handle, &guid)
|
|
||||||
if err != nil {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
ssidLength := attrs.AssociationAttributes.SSID.Length
|
|
||||||
if ssidLength == 0 || ssidLength > winwlanapi.Dot11SSIDMaxLength {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
ssid := string(attrs.AssociationAttributes.SSID.SSID[:ssidLength])
|
|
||||||
bssid := formatBSSID(attrs.AssociationAttributes.BSSID)
|
|
||||||
|
|
||||||
return adapter.WIFIState{
|
|
||||||
SSID: strings.TrimSpace(ssid),
|
|
||||||
BSSID: bssid,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return adapter.WIFIState{}
|
|
||||||
}
|
|
||||||
|
|
||||||
func formatBSSID(mac winwlanapi.Dot11MacAddress) string {
|
|
||||||
return fmt.Sprintf("%02X%02X%02X%02X%02X%02X",
|
|
||||||
mac[0], mac[1], mac[2], mac[3], mac[4], mac[5])
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *windowsWIFIMonitor) Start() error {
|
|
||||||
if m.callback == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
ctx, cancel := context.WithCancel(context.Background())
|
|
||||||
m.cancel = cancel
|
|
||||||
|
|
||||||
m.lastState = m.ReadWIFIState()
|
|
||||||
|
|
||||||
callbackFunc := func(data *winwlanapi.NotificationData, callbackContext uintptr) uintptr {
|
|
||||||
if data.NotificationSource != winwlanapi.NotificationSourceACM {
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
switch data.NotificationCode {
|
|
||||||
case winwlanapi.NotificationACMConnectionComplete,
|
|
||||||
winwlanapi.NotificationACMDisconnected:
|
|
||||||
m.checkAndNotify()
|
|
||||||
}
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
callbackPointer := syscall.NewCallback(callbackFunc)
|
|
||||||
|
|
||||||
err := winwlanapi.RegisterNotification(m.handle, winwlanapi.NotificationSourceACM, callbackPointer, 0)
|
|
||||||
if err != nil {
|
|
||||||
cancel()
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
go func() {
|
|
||||||
<-ctx.Done()
|
|
||||||
}()
|
|
||||||
|
|
||||||
m.callback(m.lastState)
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *windowsWIFIMonitor) checkAndNotify() {
|
|
||||||
m.mutex.Lock()
|
|
||||||
defer m.mutex.Unlock()
|
|
||||||
|
|
||||||
state := m.ReadWIFIState()
|
|
||||||
if state != m.lastState {
|
|
||||||
m.lastState = state
|
|
||||||
if m.callback != nil {
|
|
||||||
m.callback(state)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *windowsWIFIMonitor) Close() error {
|
|
||||||
if m.cancel != nil {
|
|
||||||
m.cancel()
|
|
||||||
}
|
|
||||||
winwlanapi.UnregisterNotification(m.handle)
|
|
||||||
return winwlanapi.CloseHandle(m.handle)
|
|
||||||
}
|
|
||||||
@@ -51,7 +51,6 @@ func parseECHClientConfig(ctx context.Context, clientConfig ECHCapableConfig, op
|
|||||||
return &ECHClientConfig{
|
return &ECHClientConfig{
|
||||||
ECHCapableConfig: clientConfig,
|
ECHCapableConfig: clientConfig,
|
||||||
dnsRouter: service.FromContext[adapter.DNSRouter](ctx),
|
dnsRouter: service.FromContext[adapter.DNSRouter](ctx),
|
||||||
queryServerName: options.ECH.QueryServerName,
|
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -109,11 +108,10 @@ func parseECHKeys(echKey []byte) ([]tls.EncryptedClientHelloKey, error) {
|
|||||||
|
|
||||||
type ECHClientConfig struct {
|
type ECHClientConfig struct {
|
||||||
ECHCapableConfig
|
ECHCapableConfig
|
||||||
access sync.Mutex
|
access sync.Mutex
|
||||||
dnsRouter adapter.DNSRouter
|
dnsRouter adapter.DNSRouter
|
||||||
queryServerName string
|
lastTTL time.Duration
|
||||||
lastTTL time.Duration
|
lastUpdate time.Time
|
||||||
lastUpdate time.Time
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *ECHClientConfig) ClientHandshake(ctx context.Context, conn net.Conn) (aTLS.Conn, error) {
|
func (s *ECHClientConfig) ClientHandshake(ctx context.Context, conn net.Conn) (aTLS.Conn, error) {
|
||||||
@@ -132,17 +130,13 @@ func (s *ECHClientConfig) fetchAndHandshake(ctx context.Context, conn net.Conn)
|
|||||||
s.access.Lock()
|
s.access.Lock()
|
||||||
defer s.access.Unlock()
|
defer s.access.Unlock()
|
||||||
if len(s.ECHConfigList()) == 0 || s.lastTTL == 0 || time.Since(s.lastUpdate) > s.lastTTL {
|
if len(s.ECHConfigList()) == 0 || s.lastTTL == 0 || time.Since(s.lastUpdate) > s.lastTTL {
|
||||||
queryServerName := s.queryServerName
|
|
||||||
if queryServerName == "" {
|
|
||||||
queryServerName = s.ServerName()
|
|
||||||
}
|
|
||||||
message := &mDNS.Msg{
|
message := &mDNS.Msg{
|
||||||
MsgHdr: mDNS.MsgHdr{
|
MsgHdr: mDNS.MsgHdr{
|
||||||
RecursionDesired: true,
|
RecursionDesired: true,
|
||||||
},
|
},
|
||||||
Question: []mDNS.Question{
|
Question: []mDNS.Question{
|
||||||
{
|
{
|
||||||
Name: mDNS.Fqdn(queryServerName),
|
Name: mDNS.Fqdn(s.ServerName()),
|
||||||
Qtype: mDNS.TypeHTTPS,
|
Qtype: mDNS.TypeHTTPS,
|
||||||
Qclass: mDNS.ClassINET,
|
Qclass: mDNS.ClassINET,
|
||||||
},
|
},
|
||||||
@@ -181,12 +175,7 @@ func (s *ECHClientConfig) fetchAndHandshake(ctx context.Context, conn net.Conn)
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *ECHClientConfig) Clone() Config {
|
func (s *ECHClientConfig) Clone() Config {
|
||||||
return &ECHClientConfig{
|
return &ECHClientConfig{ECHCapableConfig: s.ECHCapableConfig.Clone().(ECHCapableConfig), dnsRouter: s.dnsRouter, lastUpdate: s.lastUpdate}
|
||||||
ECHCapableConfig: s.ECHCapableConfig.Clone().(ECHCapableConfig),
|
|
||||||
dnsRouter: s.dnsRouter,
|
|
||||||
queryServerName: s.queryServerName,
|
|
||||||
lastUpdate: s.lastUpdate,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func UnmarshalECHKeys(raw []byte) ([]tls.EncryptedClientHelloKey, error) {
|
func UnmarshalECHKeys(raw []byte) ([]tls.EncryptedClientHelloKey, error) {
|
||||||
|
|||||||
@@ -169,35 +169,6 @@ func NewSTDClient(ctx context.Context, logger logger.ContextLogger, serverAddres
|
|||||||
}
|
}
|
||||||
tlsConfig.RootCAs = certPool
|
tlsConfig.RootCAs = certPool
|
||||||
}
|
}
|
||||||
var clientCertificate []byte
|
|
||||||
if len(options.ClientCertificate) > 0 {
|
|
||||||
clientCertificate = []byte(strings.Join(options.ClientCertificate, "\n"))
|
|
||||||
} else if options.ClientCertificatePath != "" {
|
|
||||||
content, err := os.ReadFile(options.ClientCertificatePath)
|
|
||||||
if err != nil {
|
|
||||||
return nil, E.Cause(err, "read client certificate")
|
|
||||||
}
|
|
||||||
clientCertificate = content
|
|
||||||
}
|
|
||||||
var clientKey []byte
|
|
||||||
if len(options.ClientKey) > 0 {
|
|
||||||
clientKey = []byte(strings.Join(options.ClientKey, "\n"))
|
|
||||||
} else if options.ClientKeyPath != "" {
|
|
||||||
content, err := os.ReadFile(options.ClientKeyPath)
|
|
||||||
if err != nil {
|
|
||||||
return nil, E.Cause(err, "read client key")
|
|
||||||
}
|
|
||||||
clientKey = content
|
|
||||||
}
|
|
||||||
if len(clientCertificate) > 0 && len(clientKey) > 0 {
|
|
||||||
keyPair, err := tls.X509KeyPair(clientCertificate, clientKey)
|
|
||||||
if err != nil {
|
|
||||||
return nil, E.Cause(err, "parse client x509 key pair")
|
|
||||||
}
|
|
||||||
tlsConfig.Certificates = []tls.Certificate{keyPair}
|
|
||||||
} else if len(clientCertificate) > 0 || len(clientKey) > 0 {
|
|
||||||
return nil, E.New("client certificate and client key must be provided together")
|
|
||||||
}
|
|
||||||
var config Config = &STDClientConfig{ctx, &tlsConfig, options.Fragment, time.Duration(options.FragmentFallbackDelay), options.RecordFragment}
|
var config Config = &STDClientConfig{ctx, &tlsConfig, options.Fragment, time.Duration(options.FragmentFallbackDelay), options.RecordFragment}
|
||||||
if options.ECH != nil && options.ECH.Enabled {
|
if options.ECH != nil && options.ECH.Enabled {
|
||||||
var err error
|
var err error
|
||||||
|
|||||||
@@ -222,35 +222,6 @@ func NewUTLSClient(ctx context.Context, logger logger.ContextLogger, serverAddre
|
|||||||
}
|
}
|
||||||
tlsConfig.RootCAs = certPool
|
tlsConfig.RootCAs = certPool
|
||||||
}
|
}
|
||||||
var clientCertificate []byte
|
|
||||||
if len(options.ClientCertificate) > 0 {
|
|
||||||
clientCertificate = []byte(strings.Join(options.ClientCertificate, "\n"))
|
|
||||||
} else if options.ClientCertificatePath != "" {
|
|
||||||
content, err := os.ReadFile(options.ClientCertificatePath)
|
|
||||||
if err != nil {
|
|
||||||
return nil, E.Cause(err, "read client certificate")
|
|
||||||
}
|
|
||||||
clientCertificate = content
|
|
||||||
}
|
|
||||||
var clientKey []byte
|
|
||||||
if len(options.ClientKey) > 0 {
|
|
||||||
clientKey = []byte(strings.Join(options.ClientKey, "\n"))
|
|
||||||
} else if options.ClientKeyPath != "" {
|
|
||||||
content, err := os.ReadFile(options.ClientKeyPath)
|
|
||||||
if err != nil {
|
|
||||||
return nil, E.Cause(err, "read client key")
|
|
||||||
}
|
|
||||||
clientKey = content
|
|
||||||
}
|
|
||||||
if len(clientCertificate) > 0 && len(clientKey) > 0 {
|
|
||||||
keyPair, err := utls.X509KeyPair(clientCertificate, clientKey)
|
|
||||||
if err != nil {
|
|
||||||
return nil, E.Cause(err, "parse client x509 key pair")
|
|
||||||
}
|
|
||||||
tlsConfig.Certificates = []utls.Certificate{keyPair}
|
|
||||||
} else if len(clientCertificate) > 0 || len(clientKey) > 0 {
|
|
||||||
return nil, E.New("client certificate and client key must be provided together")
|
|
||||||
}
|
|
||||||
id, err := uTLSClientHelloID(options.UTLS.Fingerprint)
|
id, err := uTLSClientHelloID(options.UTLS.Fingerprint)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ import (
|
|||||||
M "github.com/sagernet/sing/common/metadata"
|
M "github.com/sagernet/sing/common/metadata"
|
||||||
N "github.com/sagernet/sing/common/network"
|
N "github.com/sagernet/sing/common/network"
|
||||||
"github.com/sagernet/sing/common/ntp"
|
"github.com/sagernet/sing/common/ntp"
|
||||||
"github.com/sagernet/sing/common/observable"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ adapter.URLTestHistoryStorage = (*HistoryStorage)(nil)
|
var _ adapter.URLTestHistoryStorage = (*HistoryStorage)(nil)
|
||||||
@@ -22,7 +21,7 @@ var _ adapter.URLTestHistoryStorage = (*HistoryStorage)(nil)
|
|||||||
type HistoryStorage struct {
|
type HistoryStorage struct {
|
||||||
access sync.RWMutex
|
access sync.RWMutex
|
||||||
delayHistory map[string]*adapter.URLTestHistory
|
delayHistory map[string]*adapter.URLTestHistory
|
||||||
updateHook *observable.Subscriber[struct{}]
|
updateHook chan<- struct{}
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewHistoryStorage() *HistoryStorage {
|
func NewHistoryStorage() *HistoryStorage {
|
||||||
@@ -31,7 +30,7 @@ func NewHistoryStorage() *HistoryStorage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *HistoryStorage) SetHook(hook *observable.Subscriber[struct{}]) {
|
func (s *HistoryStorage) SetHook(hook chan<- struct{}) {
|
||||||
s.updateHook = hook
|
s.updateHook = hook
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -61,7 +60,10 @@ func (s *HistoryStorage) StoreURLTestHistory(tag string, history *adapter.URLTes
|
|||||||
func (s *HistoryStorage) notifyUpdated() {
|
func (s *HistoryStorage) notifyUpdated() {
|
||||||
updateHook := s.updateHook
|
updateHook := s.updateHook
|
||||||
if updateHook != nil {
|
if updateHook != nil {
|
||||||
updateHook.Emit(struct{}{})
|
select {
|
||||||
|
case updateHook <- struct{}{}:
|
||||||
|
default:
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,5 +4,5 @@ import "time"
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
DHCPTTL = time.Hour
|
DHCPTTL = time.Hour
|
||||||
DHCPTimeout = 5 * time.Second
|
DHCPTimeout = time.Minute
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -28,8 +28,6 @@ const (
|
|||||||
TypeDERP = "derp"
|
TypeDERP = "derp"
|
||||||
TypeResolved = "resolved"
|
TypeResolved = "resolved"
|
||||||
TypeSSMAPI = "ssm-api"
|
TypeSSMAPI = "ssm-api"
|
||||||
TypeCCM = "ccm"
|
|
||||||
TypeOCM = "ocm"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package constant
|
|||||||
import "time"
|
import "time"
|
||||||
|
|
||||||
const (
|
const (
|
||||||
TCPKeepAliveInitial = 5 * time.Minute
|
TCPKeepAliveInitial = 10 * time.Minute
|
||||||
TCPKeepAliveInterval = 75 * time.Second
|
TCPKeepAliveInterval = 75 * time.Second
|
||||||
TCPConnectTimeout = 5 * time.Second
|
TCPConnectTimeout = 5 * time.Second
|
||||||
TCPTimeout = 15 * time.Second
|
TCPTimeout = 15 * time.Second
|
||||||
|
|||||||
@@ -7,12 +7,15 @@ import (
|
|||||||
"github.com/sagernet/sing-box"
|
"github.com/sagernet/sing-box"
|
||||||
"github.com/sagernet/sing-box/adapter"
|
"github.com/sagernet/sing-box/adapter"
|
||||||
"github.com/sagernet/sing-box/common/urltest"
|
"github.com/sagernet/sing-box/common/urltest"
|
||||||
|
C "github.com/sagernet/sing-box/constant"
|
||||||
|
"github.com/sagernet/sing-box/dns"
|
||||||
"github.com/sagernet/sing-box/experimental/deprecated"
|
"github.com/sagernet/sing-box/experimental/deprecated"
|
||||||
"github.com/sagernet/sing-box/include"
|
"github.com/sagernet/sing-box/include"
|
||||||
"github.com/sagernet/sing-box/option"
|
"github.com/sagernet/sing-box/option"
|
||||||
E "github.com/sagernet/sing/common/exceptions"
|
E "github.com/sagernet/sing/common/exceptions"
|
||||||
"github.com/sagernet/sing/common/json"
|
"github.com/sagernet/sing/common/json"
|
||||||
"github.com/sagernet/sing/service"
|
"github.com/sagernet/sing/service"
|
||||||
|
"github.com/sagernet/sing/service/filemanager"
|
||||||
"github.com/sagernet/sing/service/pause"
|
"github.com/sagernet/sing/service/pause"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -26,12 +29,23 @@ type Instance struct {
|
|||||||
urlTestHistoryStorage *urltest.HistoryStorage
|
urlTestHistoryStorage *urltest.HistoryStorage
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *StartedService) baseContext() context.Context {
|
||||||
|
dnsRegistry := include.DNSTransportRegistry()
|
||||||
|
if s.platform != nil && s.platform.UsePlatformLocalDNSTransport() {
|
||||||
|
dns.RegisterTransport[option.LocalDNSServerOptions](dnsRegistry, C.DNSTypeLocal, s.platform.LocalDNSTransport())
|
||||||
|
}
|
||||||
|
ctx := box.Context(s.ctx, include.InboundRegistry(), include.OutboundRegistry(), include.EndpointRegistry(), dnsRegistry, include.ServiceRegistry())
|
||||||
|
ctx = filemanager.WithDefault(ctx, s.workingDirectory, s.tempDirectory, s.userID, s.groupID)
|
||||||
|
return ctx
|
||||||
|
}
|
||||||
|
|
||||||
func (s *StartedService) CheckConfig(configContent string) error {
|
func (s *StartedService) CheckConfig(configContent string) error {
|
||||||
options, err := parseConfig(s.ctx, configContent)
|
ctx := s.baseContext()
|
||||||
|
options, err := parseConfig(ctx, configContent)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
ctx, cancel := context.WithCancel(s.ctx)
|
ctx, cancel := context.WithCancel(ctx)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
instance, err := box.New(box.Options{
|
instance, err := box.New(box.Options{
|
||||||
Context: ctx,
|
Context: ctx,
|
||||||
@@ -44,7 +58,7 @@ func (s *StartedService) CheckConfig(configContent string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *StartedService) FormatConfig(configContent string) (string, error) {
|
func (s *StartedService) FormatConfig(configContent string) (string, error) {
|
||||||
options, err := parseConfig(s.ctx, configContent)
|
options, err := parseConfig(s.baseContext(), configContent)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
@@ -65,7 +79,7 @@ type OverrideOptions struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *StartedService) newInstance(profileContent string, overrideOptions *OverrideOptions) (*Instance, error) {
|
func (s *StartedService) newInstance(profileContent string, overrideOptions *OverrideOptions) (*Instance, error) {
|
||||||
ctx := s.ctx
|
ctx := s.baseContext()
|
||||||
service.MustRegister[deprecated.Manager](ctx, new(deprecatedManager))
|
service.MustRegister[deprecated.Manager](ctx, new(deprecatedManager))
|
||||||
ctx, cancel := context.WithCancel(include.Context(ctx))
|
ctx, cancel := context.WithCancel(include.Context(ctx))
|
||||||
options, err := parseConfig(ctx, profileContent)
|
options, err := parseConfig(ctx, profileContent)
|
||||||
|
|||||||
@@ -1,5 +1,11 @@
|
|||||||
package daemon
|
package daemon
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/sagernet/sing-box/adapter"
|
||||||
|
"github.com/sagernet/sing-box/dns"
|
||||||
|
"github.com/sagernet/sing-box/option"
|
||||||
|
)
|
||||||
|
|
||||||
type PlatformHandler interface {
|
type PlatformHandler interface {
|
||||||
ServiceStop() error
|
ServiceStop() error
|
||||||
ServiceReload() error
|
ServiceReload() error
|
||||||
@@ -7,3 +13,10 @@ type PlatformHandler interface {
|
|||||||
SetSystemProxyEnabled(enabled bool) error
|
SetSystemProxyEnabled(enabled bool) error
|
||||||
WriteDebugMessage(message string)
|
WriteDebugMessage(message string)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type PlatformInterface interface {
|
||||||
|
adapter.PlatformInterface
|
||||||
|
|
||||||
|
UsePlatformLocalDNSTransport() bool
|
||||||
|
LocalDNSTransport() dns.TransportConstructorFunc[option.LocalDNSServerOptions]
|
||||||
|
}
|
||||||
|
|||||||
@@ -31,16 +31,16 @@ import (
|
|||||||
var _ StartedServiceServer = (*StartedService)(nil)
|
var _ StartedServiceServer = (*StartedService)(nil)
|
||||||
|
|
||||||
type StartedService struct {
|
type StartedService struct {
|
||||||
ctx context.Context
|
ctx context.Context
|
||||||
// platform adapter.PlatformInterface
|
platform PlatformInterface
|
||||||
handler PlatformHandler
|
platformHandler PlatformHandler
|
||||||
debug bool
|
debug bool
|
||||||
logMaxLines int
|
logMaxLines int
|
||||||
// workingDirectory string
|
workingDirectory string
|
||||||
// tempDirectory string
|
tempDirectory string
|
||||||
// userID int
|
userID int
|
||||||
// groupID int
|
groupID int
|
||||||
// systemProxyEnabled bool
|
systemProxyEnabled bool
|
||||||
serviceAccess sync.RWMutex
|
serviceAccess sync.RWMutex
|
||||||
serviceStatus *ServiceStatus
|
serviceStatus *ServiceStatus
|
||||||
serviceStatusSubscriber *observable.Subscriber[*ServiceStatus]
|
serviceStatusSubscriber *observable.Subscriber[*ServiceStatus]
|
||||||
@@ -58,30 +58,30 @@ type StartedService struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type ServiceOptions struct {
|
type ServiceOptions struct {
|
||||||
Context context.Context
|
Context context.Context
|
||||||
// Platform adapter.PlatformInterface
|
Platform PlatformInterface
|
||||||
Handler PlatformHandler
|
PlatformHandler PlatformHandler
|
||||||
Debug bool
|
Debug bool
|
||||||
LogMaxLines int
|
LogMaxLines int
|
||||||
// WorkingDirectory string
|
WorkingDirectory string
|
||||||
// TempDirectory string
|
TempDirectory string
|
||||||
// UserID int
|
UserID int
|
||||||
// GroupID int
|
GroupID int
|
||||||
// SystemProxyEnabled bool
|
SystemProxyEnabled bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewStartedService(options ServiceOptions) *StartedService {
|
func NewStartedService(options ServiceOptions) *StartedService {
|
||||||
s := &StartedService{
|
s := &StartedService{
|
||||||
ctx: options.Context,
|
ctx: options.Context,
|
||||||
// platform: options.Platform,
|
platform: options.Platform,
|
||||||
handler: options.Handler,
|
platformHandler: options.PlatformHandler,
|
||||||
debug: options.Debug,
|
debug: options.Debug,
|
||||||
logMaxLines: options.LogMaxLines,
|
logMaxLines: options.LogMaxLines,
|
||||||
// workingDirectory: options.WorkingDirectory,
|
workingDirectory: options.WorkingDirectory,
|
||||||
// tempDirectory: options.TempDirectory,
|
tempDirectory: options.TempDirectory,
|
||||||
// userID: options.UserID,
|
userID: options.UserID,
|
||||||
// groupID: options.GroupID,
|
groupID: options.GroupID,
|
||||||
// systemProxyEnabled: options.SystemProxyEnabled,
|
systemProxyEnabled: options.SystemProxyEnabled,
|
||||||
serviceStatus: &ServiceStatus{Status: ServiceStatus_IDLE},
|
serviceStatus: &ServiceStatus{Status: ServiceStatus_IDLE},
|
||||||
serviceStatusSubscriber: observable.NewSubscriber[*ServiceStatus](4),
|
serviceStatusSubscriber: observable.NewSubscriber[*ServiceStatus](4),
|
||||||
logSubscriber: observable.NewSubscriber[*log.Entry](128),
|
logSubscriber: observable.NewSubscriber[*log.Entry](128),
|
||||||
@@ -117,46 +117,6 @@ func (s *StartedService) updateStatusError(err error) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *StartedService) waitForStarted(ctx context.Context) error {
|
|
||||||
s.serviceAccess.RLock()
|
|
||||||
currentStatus := s.serviceStatus.Status
|
|
||||||
s.serviceAccess.RUnlock()
|
|
||||||
|
|
||||||
switch currentStatus {
|
|
||||||
case ServiceStatus_STARTED:
|
|
||||||
return nil
|
|
||||||
case ServiceStatus_STARTING:
|
|
||||||
default:
|
|
||||||
return os.ErrInvalid
|
|
||||||
}
|
|
||||||
|
|
||||||
subscription, done, err := s.serviceStatusObserver.Subscribe()
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
defer s.serviceStatusObserver.UnSubscribe(subscription)
|
|
||||||
|
|
||||||
for {
|
|
||||||
select {
|
|
||||||
case <-ctx.Done():
|
|
||||||
return ctx.Err()
|
|
||||||
case <-s.ctx.Done():
|
|
||||||
return s.ctx.Err()
|
|
||||||
case status := <-subscription:
|
|
||||||
switch status.Status {
|
|
||||||
case ServiceStatus_STARTED:
|
|
||||||
return nil
|
|
||||||
case ServiceStatus_FATAL:
|
|
||||||
return E.New(status.ErrorMessage)
|
|
||||||
case ServiceStatus_IDLE, ServiceStatus_STOPPING:
|
|
||||||
return os.ErrInvalid
|
|
||||||
}
|
|
||||||
case <-done:
|
|
||||||
return os.ErrClosed
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *StartedService) StartOrReloadService(profileContent string, options *OverrideOptions) error {
|
func (s *StartedService) StartOrReloadService(profileContent string, options *OverrideOptions) error {
|
||||||
s.serviceAccess.Lock()
|
s.serviceAccess.Lock()
|
||||||
switch s.serviceStatus.Status {
|
switch s.serviceStatus.Status {
|
||||||
@@ -165,13 +125,6 @@ func (s *StartedService) StartOrReloadService(profileContent string, options *Ov
|
|||||||
s.serviceAccess.Unlock()
|
s.serviceAccess.Unlock()
|
||||||
return os.ErrInvalid
|
return os.ErrInvalid
|
||||||
}
|
}
|
||||||
oldInstance := s.instance
|
|
||||||
if oldInstance != nil {
|
|
||||||
s.updateStatus(ServiceStatus_STOPPING)
|
|
||||||
s.serviceAccess.Unlock()
|
|
||||||
_ = oldInstance.Close()
|
|
||||||
s.serviceAccess.Lock()
|
|
||||||
}
|
|
||||||
s.updateStatus(ServiceStatus_STARTING)
|
s.updateStatus(ServiceStatus_STARTING)
|
||||||
s.resetLogs()
|
s.resetLogs()
|
||||||
instance, err := s.newInstance(profileContent, options)
|
instance, err := s.newInstance(profileContent, options)
|
||||||
@@ -179,10 +132,6 @@ func (s *StartedService) StartOrReloadService(profileContent string, options *Ov
|
|||||||
return s.updateStatusError(err)
|
return s.updateStatusError(err)
|
||||||
}
|
}
|
||||||
s.instance = instance
|
s.instance = instance
|
||||||
instance.urlTestHistoryStorage.SetHook(s.urlTestSubscriber)
|
|
||||||
if instance.clashServer != nil {
|
|
||||||
instance.clashServer.SetModeUpdateHook(s.clashModeSubscriber)
|
|
||||||
}
|
|
||||||
s.serviceAccess.Unlock()
|
s.serviceAccess.Unlock()
|
||||||
err = instance.Start()
|
err = instance.Start()
|
||||||
s.serviceAccess.Lock()
|
s.serviceAccess.Lock()
|
||||||
@@ -224,11 +173,12 @@ func (s *StartedService) CloseService() error {
|
|||||||
func (s *StartedService) SetError(err error) {
|
func (s *StartedService) SetError(err error) {
|
||||||
s.serviceAccess.Lock()
|
s.serviceAccess.Lock()
|
||||||
s.updateStatusError(err)
|
s.updateStatusError(err)
|
||||||
|
s.serviceAccess.Unlock()
|
||||||
s.WriteMessage(log.LevelError, err.Error())
|
s.WriteMessage(log.LevelError, err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *StartedService) StopService(ctx context.Context, empty *emptypb.Empty) (*emptypb.Empty, error) {
|
func (s *StartedService) StopService(ctx context.Context, empty *emptypb.Empty) (*emptypb.Empty, error) {
|
||||||
err := s.handler.ServiceStop()
|
err := s.platformHandler.ServiceStop()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -236,7 +186,7 @@ func (s *StartedService) StopService(ctx context.Context, empty *emptypb.Empty)
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *StartedService) ReloadService(ctx context.Context, empty *emptypb.Empty) (*emptypb.Empty, error) {
|
func (s *StartedService) ReloadService(ctx context.Context, empty *emptypb.Empty) (*emptypb.Empty, error) {
|
||||||
err := s.handler.ServiceReload()
|
err := s.platformHandler.ServiceReload()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -277,8 +227,8 @@ func (s *StartedService) SubscribeLog(empty *emptypb.Empty, server grpc.ServerSt
|
|||||||
for element := s.logLines.Front(); element != nil; element = element.Next() {
|
for element := s.logLines.Front(); element != nil; element = element.Next() {
|
||||||
savedLines = append(savedLines, element.Value)
|
savedLines = append(savedLines, element.Value)
|
||||||
}
|
}
|
||||||
subscription, done, err := s.logObserver.Subscribe()
|
|
||||||
s.logAccess.Unlock()
|
s.logAccess.Unlock()
|
||||||
|
subscription, done, err := s.logObserver.Subscribe()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -302,33 +252,30 @@ func (s *StartedService) SubscribeLog(empty *emptypb.Empty, server grpc.ServerSt
|
|||||||
case <-server.Context().Done():
|
case <-server.Context().Done():
|
||||||
return server.Context().Err()
|
return server.Context().Err()
|
||||||
case message := <-subscription:
|
case message := <-subscription:
|
||||||
var rawMessage Log
|
|
||||||
if message == nil {
|
if message == nil {
|
||||||
rawMessage.Reset_ = true
|
err = server.Send(&Log{Reset_: true})
|
||||||
} else {
|
if err != nil {
|
||||||
rawMessage.Messages = append(rawMessage.Messages, &Log_Message{
|
return err
|
||||||
Level: LogLevel(message.Level),
|
}
|
||||||
Message: message.Message,
|
continue
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
messages := []*Log_Message{{
|
||||||
|
Level: LogLevel(message.Level),
|
||||||
|
Message: message.Message,
|
||||||
|
}}
|
||||||
fetch:
|
fetch:
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case message = <-subscription:
|
case message = <-subscription:
|
||||||
if message == nil {
|
messages = append(messages, &Log_Message{
|
||||||
rawMessage.Messages = nil
|
Level: LogLevel(message.Level),
|
||||||
rawMessage.Reset_ = true
|
Message: message.Message,
|
||||||
} else {
|
})
|
||||||
rawMessage.Messages = append(rawMessage.Messages, &Log_Message{
|
|
||||||
Level: LogLevel(message.Level),
|
|
||||||
Message: message.Message,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
default:
|
default:
|
||||||
break fetch
|
break fetch
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
err = server.Send(&rawMessage)
|
err = server.Send(&Log{Messages: messages})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -351,11 +298,6 @@ func (s *StartedService) GetDefaultLogLevel(ctx context.Context, empty *emptypb.
|
|||||||
return &DefaultLogLevel{Level: LogLevel(logLevel)}, nil
|
return &DefaultLogLevel{Level: LogLevel(logLevel)}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *StartedService) ClearLogs(ctx context.Context, empty *emptypb.Empty) (*emptypb.Empty, error) {
|
|
||||||
s.resetLogs()
|
|
||||||
return &emptypb.Empty{}, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *StartedService) SubscribeStatus(request *SubscribeStatusRequest, server grpc.ServerStreamingServer[Status]) error {
|
func (s *StartedService) SubscribeStatus(request *SubscribeStatusRequest, server grpc.ServerStreamingServer[Status]) error {
|
||||||
interval := time.Duration(request.Interval)
|
interval := time.Duration(request.Interval)
|
||||||
if interval <= 0 {
|
if interval <= 0 {
|
||||||
@@ -393,9 +335,7 @@ func (s *StartedService) readStatus() *Status {
|
|||||||
status.Memory = memory.Inuse()
|
status.Memory = memory.Inuse()
|
||||||
status.Goroutines = int32(runtime.NumGoroutine())
|
status.Goroutines = int32(runtime.NumGoroutine())
|
||||||
status.ConnectionsOut = int32(conntrack.Count())
|
status.ConnectionsOut = int32(conntrack.Count())
|
||||||
s.serviceAccess.RLock()
|
|
||||||
nowService := s.instance
|
nowService := s.instance
|
||||||
s.serviceAccess.RUnlock()
|
|
||||||
if nowService != nil {
|
if nowService != nil {
|
||||||
if clashServer := nowService.clashServer; clashServer != nil {
|
if clashServer := nowService.clashServer; clashServer != nil {
|
||||||
status.TrafficAvailable = true
|
status.TrafficAvailable = true
|
||||||
@@ -408,10 +348,6 @@ func (s *StartedService) readStatus() *Status {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *StartedService) SubscribeGroups(empty *emptypb.Empty, server grpc.ServerStreamingServer[Groups]) error {
|
func (s *StartedService) SubscribeGroups(empty *emptypb.Empty, server grpc.ServerStreamingServer[Groups]) error {
|
||||||
err := s.waitForStarted(server.Context())
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
subscription, done, err := s.urlTestObserver.Subscribe()
|
subscription, done, err := s.urlTestObserver.Subscribe()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -419,16 +355,18 @@ func (s *StartedService) SubscribeGroups(empty *emptypb.Empty, server grpc.Serve
|
|||||||
defer s.urlTestObserver.UnSubscribe(subscription)
|
defer s.urlTestObserver.UnSubscribe(subscription)
|
||||||
for {
|
for {
|
||||||
s.serviceAccess.RLock()
|
s.serviceAccess.RLock()
|
||||||
if s.serviceStatus.Status != ServiceStatus_STARTED {
|
switch s.serviceStatus.Status {
|
||||||
|
case ServiceStatus_STARTING, ServiceStatus_STARTED:
|
||||||
|
groups := s.readGroups()
|
||||||
|
s.serviceAccess.RUnlock()
|
||||||
|
err = server.Send(groups)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
default:
|
||||||
s.serviceAccess.RUnlock()
|
s.serviceAccess.RUnlock()
|
||||||
return os.ErrInvalid
|
return os.ErrInvalid
|
||||||
}
|
}
|
||||||
groups := s.readGroups()
|
|
||||||
s.serviceAccess.RUnlock()
|
|
||||||
err = server.Send(groups)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
select {
|
select {
|
||||||
case <-subscription:
|
case <-subscription:
|
||||||
case <-s.ctx.Done():
|
case <-s.ctx.Done():
|
||||||
@@ -505,27 +443,12 @@ func (s *StartedService) GetClashModeStatus(ctx context.Context, empty *emptypb.
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *StartedService) SubscribeClashMode(empty *emptypb.Empty, server grpc.ServerStreamingServer[ClashMode]) error {
|
func (s *StartedService) SubscribeClashMode(empty *emptypb.Empty, server grpc.ServerStreamingServer[ClashMode]) error {
|
||||||
err := s.waitForStarted(server.Context())
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
subscription, done, err := s.clashModeObserver.Subscribe()
|
subscription, done, err := s.clashModeObserver.Subscribe()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
defer s.clashModeObserver.UnSubscribe(subscription)
|
defer s.clashModeObserver.UnSubscribe(subscription)
|
||||||
for {
|
for {
|
||||||
s.serviceAccess.RLock()
|
|
||||||
if s.serviceStatus.Status != ServiceStatus_STARTED {
|
|
||||||
s.serviceAccess.RUnlock()
|
|
||||||
return os.ErrInvalid
|
|
||||||
}
|
|
||||||
message := &ClashMode{Mode: s.instance.clashServer.Mode()}
|
|
||||||
s.serviceAccess.RUnlock()
|
|
||||||
err = server.Send(message)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
select {
|
select {
|
||||||
case <-subscription:
|
case <-subscription:
|
||||||
case <-s.ctx.Done():
|
case <-s.ctx.Done():
|
||||||
@@ -535,6 +458,16 @@ func (s *StartedService) SubscribeClashMode(empty *emptypb.Empty, server grpc.Se
|
|||||||
case <-done:
|
case <-done:
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
s.serviceAccess.RLock()
|
||||||
|
if s.serviceStatus.Status != ServiceStatus_STARTED {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
message := &ClashMode{Mode: s.instance.clashServer.Mode()}
|
||||||
|
s.serviceAccess.RUnlock()
|
||||||
|
err = server.Send(message)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -571,7 +504,12 @@ func (s *StartedService) URLTest(ctx context.Context, request *URLTestRequest) (
|
|||||||
if isURLTest {
|
if isURLTest {
|
||||||
go urlTest.CheckOutbounds()
|
go urlTest.CheckOutbounds()
|
||||||
} else {
|
} else {
|
||||||
historyStorage := boxService.urlTestHistoryStorage
|
var historyStorage adapter.URLTestHistoryStorage
|
||||||
|
if s.instance.clashServer != nil {
|
||||||
|
historyStorage = s.instance.clashServer.HistoryStorage()
|
||||||
|
} else {
|
||||||
|
return nil, E.New("Clash API is required for URLTest on non-URLTest group")
|
||||||
|
}
|
||||||
|
|
||||||
outbounds := common.Filter(common.Map(outboundGroup.All(), func(it string) adapter.Outbound {
|
outbounds := common.Filter(common.Map(outboundGroup.All(), func(it string) adapter.Outbound {
|
||||||
itOutbound, _ := boxService.instance.Outbound().Outbound(it)
|
itOutbound, _ := boxService.instance.Outbound().Outbound(it)
|
||||||
@@ -628,7 +566,6 @@ func (s *StartedService) SelectOutbound(ctx context.Context, request *SelectOutb
|
|||||||
if !selector.SelectOutbound(request.OutboundTag) {
|
if !selector.SelectOutbound(request.OutboundTag) {
|
||||||
return nil, E.New("outbound not found in selector: ", request.OutboundTag)
|
return nil, E.New("outbound not found in selector: ", request.OutboundTag)
|
||||||
}
|
}
|
||||||
s.urlTestObserver.Emit(struct{}{})
|
|
||||||
return &emptypb.Empty{}, nil
|
return &emptypb.Empty{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -652,11 +589,11 @@ func (s *StartedService) SetGroupExpand(ctx context.Context, request *SetGroupEx
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *StartedService) GetSystemProxyStatus(ctx context.Context, empty *emptypb.Empty) (*SystemProxyStatus, error) {
|
func (s *StartedService) GetSystemProxyStatus(ctx context.Context, empty *emptypb.Empty) (*SystemProxyStatus, error) {
|
||||||
return s.handler.SystemProxyStatus()
|
return s.platformHandler.SystemProxyStatus()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *StartedService) SetSystemProxyEnabled(ctx context.Context, request *SetSystemProxyEnabledRequest) (*emptypb.Empty, error) {
|
func (s *StartedService) SetSystemProxyEnabled(ctx context.Context, request *SetSystemProxyEnabledRequest) (*emptypb.Empty, error) {
|
||||||
err := s.handler.SetSystemProxyEnabled(request.Enabled)
|
err := s.platformHandler.SetSystemProxyEnabled(request.Enabled)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -664,11 +601,13 @@ func (s *StartedService) SetSystemProxyEnabled(ctx context.Context, request *Set
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *StartedService) SubscribeConnections(request *SubscribeConnectionsRequest, server grpc.ServerStreamingServer[Connections]) error {
|
func (s *StartedService) SubscribeConnections(request *SubscribeConnectionsRequest, server grpc.ServerStreamingServer[Connections]) error {
|
||||||
err := s.waitForStarted(server.Context())
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
s.serviceAccess.RLock()
|
s.serviceAccess.RLock()
|
||||||
|
switch s.serviceStatus.Status {
|
||||||
|
case ServiceStatus_STARTING, ServiceStatus_STARTED:
|
||||||
|
default:
|
||||||
|
s.serviceAccess.RUnlock()
|
||||||
|
return os.ErrInvalid
|
||||||
|
}
|
||||||
boxService := s.instance
|
boxService := s.instance
|
||||||
s.serviceAccess.RUnlock()
|
s.serviceAccess.RUnlock()
|
||||||
ticker := time.NewTicker(time.Duration(request.Interval))
|
ticker := time.NewTicker(time.Duration(request.Interval))
|
||||||
@@ -816,15 +755,15 @@ func (s *StartedService) mustEmbedUnimplementedStartedServiceServer() {
|
|||||||
|
|
||||||
func (s *StartedService) WriteMessage(level log.Level, message string) {
|
func (s *StartedService) WriteMessage(level log.Level, message string) {
|
||||||
item := &log.Entry{Level: level, Message: message}
|
item := &log.Entry{Level: level, Message: message}
|
||||||
|
s.logSubscriber.Emit(item)
|
||||||
s.logAccess.Lock()
|
s.logAccess.Lock()
|
||||||
s.logLines.PushBack(item)
|
s.logLines.PushBack(item)
|
||||||
if s.logLines.Len() > s.logMaxLines {
|
if s.logLines.Len() > s.logMaxLines {
|
||||||
s.logLines.Remove(s.logLines.Front())
|
s.logLines.Remove(s.logLines.Front())
|
||||||
}
|
}
|
||||||
s.logAccess.Unlock()
|
s.logAccess.Unlock()
|
||||||
s.logSubscriber.Emit(item)
|
|
||||||
if s.debug {
|
if s.debug {
|
||||||
s.handler.WriteDebugMessage(message)
|
s.platformHandler.WriteDebugMessage(message)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1746,14 +1746,13 @@ const file_daemon_started_service_proto_rawDesc = "" +
|
|||||||
"\x10ConnectionSortBy\x12\b\n" +
|
"\x10ConnectionSortBy\x12\b\n" +
|
||||||
"\x04DATE\x10\x00\x12\v\n" +
|
"\x04DATE\x10\x00\x12\v\n" +
|
||||||
"\aTRAFFIC\x10\x01\x12\x11\n" +
|
"\aTRAFFIC\x10\x01\x12\x11\n" +
|
||||||
"\rTOTAL_TRAFFIC\x10\x022\xb7\f\n" +
|
"\rTOTAL_TRAFFIC\x10\x022\xf8\v\n" +
|
||||||
"\x0eStartedService\x12=\n" +
|
"\x0eStartedService\x12=\n" +
|
||||||
"\vStopService\x12\x16.google.protobuf.Empty\x1a\x16.google.protobuf.Empty\x12?\n" +
|
"\vStopService\x12\x16.google.protobuf.Empty\x1a\x16.google.protobuf.Empty\x12?\n" +
|
||||||
"\rReloadService\x12\x16.google.protobuf.Empty\x1a\x16.google.protobuf.Empty\x12K\n" +
|
"\rReloadService\x12\x16.google.protobuf.Empty\x1a\x16.google.protobuf.Empty\x12K\n" +
|
||||||
"\x16SubscribeServiceStatus\x12\x16.google.protobuf.Empty\x1a\x15.daemon.ServiceStatus\"\x000\x01\x127\n" +
|
"\x16SubscribeServiceStatus\x12\x16.google.protobuf.Empty\x1a\x15.daemon.ServiceStatus\"\x000\x01\x127\n" +
|
||||||
"\fSubscribeLog\x12\x16.google.protobuf.Empty\x1a\v.daemon.Log\"\x000\x01\x12G\n" +
|
"\fSubscribeLog\x12\x16.google.protobuf.Empty\x1a\v.daemon.Log\"\x000\x01\x12G\n" +
|
||||||
"\x12GetDefaultLogLevel\x12\x16.google.protobuf.Empty\x1a\x17.daemon.DefaultLogLevel\"\x00\x12=\n" +
|
"\x12GetDefaultLogLevel\x12\x16.google.protobuf.Empty\x1a\x17.daemon.DefaultLogLevel\"\x00\x12E\n" +
|
||||||
"\tClearLogs\x12\x16.google.protobuf.Empty\x1a\x16.google.protobuf.Empty\"\x00\x12E\n" +
|
|
||||||
"\x0fSubscribeStatus\x12\x1e.daemon.SubscribeStatusRequest\x1a\x0e.daemon.Status\"\x000\x01\x12=\n" +
|
"\x0fSubscribeStatus\x12\x1e.daemon.SubscribeStatusRequest\x1a\x0e.daemon.Status\"\x000\x01\x12=\n" +
|
||||||
"\x0fSubscribeGroups\x12\x16.google.protobuf.Empty\x1a\x0e.daemon.Groups\"\x000\x01\x12G\n" +
|
"\x0fSubscribeGroups\x12\x16.google.protobuf.Empty\x1a\x0e.daemon.Groups\"\x000\x01\x12G\n" +
|
||||||
"\x12GetClashModeStatus\x12\x16.google.protobuf.Empty\x1a\x17.daemon.ClashModeStatus\"\x00\x12C\n" +
|
"\x12GetClashModeStatus\x12\x16.google.protobuf.Empty\x1a\x17.daemon.ClashModeStatus\"\x00\x12C\n" +
|
||||||
@@ -1836,47 +1835,45 @@ var file_daemon_started_service_proto_depIdxs = []int32{
|
|||||||
27, // 12: daemon.StartedService.SubscribeServiceStatus:input_type -> google.protobuf.Empty
|
27, // 12: daemon.StartedService.SubscribeServiceStatus:input_type -> google.protobuf.Empty
|
||||||
27, // 13: daemon.StartedService.SubscribeLog:input_type -> google.protobuf.Empty
|
27, // 13: daemon.StartedService.SubscribeLog:input_type -> google.protobuf.Empty
|
||||||
27, // 14: daemon.StartedService.GetDefaultLogLevel:input_type -> google.protobuf.Empty
|
27, // 14: daemon.StartedService.GetDefaultLogLevel:input_type -> google.protobuf.Empty
|
||||||
27, // 15: daemon.StartedService.ClearLogs:input_type -> google.protobuf.Empty
|
6, // 15: daemon.StartedService.SubscribeStatus:input_type -> daemon.SubscribeStatusRequest
|
||||||
6, // 16: daemon.StartedService.SubscribeStatus:input_type -> daemon.SubscribeStatusRequest
|
27, // 16: daemon.StartedService.SubscribeGroups:input_type -> google.protobuf.Empty
|
||||||
27, // 17: daemon.StartedService.SubscribeGroups:input_type -> google.protobuf.Empty
|
27, // 17: daemon.StartedService.GetClashModeStatus:input_type -> google.protobuf.Empty
|
||||||
27, // 18: daemon.StartedService.GetClashModeStatus:input_type -> google.protobuf.Empty
|
27, // 18: daemon.StartedService.SubscribeClashMode:input_type -> google.protobuf.Empty
|
||||||
27, // 19: daemon.StartedService.SubscribeClashMode:input_type -> google.protobuf.Empty
|
16, // 19: daemon.StartedService.SetClashMode:input_type -> daemon.ClashMode
|
||||||
16, // 20: daemon.StartedService.SetClashMode:input_type -> daemon.ClashMode
|
13, // 20: daemon.StartedService.URLTest:input_type -> daemon.URLTestRequest
|
||||||
13, // 21: daemon.StartedService.URLTest:input_type -> daemon.URLTestRequest
|
14, // 21: daemon.StartedService.SelectOutbound:input_type -> daemon.SelectOutboundRequest
|
||||||
14, // 22: daemon.StartedService.SelectOutbound:input_type -> daemon.SelectOutboundRequest
|
15, // 22: daemon.StartedService.SetGroupExpand:input_type -> daemon.SetGroupExpandRequest
|
||||||
15, // 23: daemon.StartedService.SetGroupExpand:input_type -> daemon.SetGroupExpandRequest
|
27, // 23: daemon.StartedService.GetSystemProxyStatus:input_type -> google.protobuf.Empty
|
||||||
27, // 24: daemon.StartedService.GetSystemProxyStatus:input_type -> google.protobuf.Empty
|
19, // 24: daemon.StartedService.SetSystemProxyEnabled:input_type -> daemon.SetSystemProxyEnabledRequest
|
||||||
19, // 25: daemon.StartedService.SetSystemProxyEnabled:input_type -> daemon.SetSystemProxyEnabledRequest
|
20, // 25: daemon.StartedService.SubscribeConnections:input_type -> daemon.SubscribeConnectionsRequest
|
||||||
20, // 26: daemon.StartedService.SubscribeConnections:input_type -> daemon.SubscribeConnectionsRequest
|
23, // 26: daemon.StartedService.CloseConnection:input_type -> daemon.CloseConnectionRequest
|
||||||
23, // 27: daemon.StartedService.CloseConnection:input_type -> daemon.CloseConnectionRequest
|
27, // 27: daemon.StartedService.CloseAllConnections:input_type -> google.protobuf.Empty
|
||||||
27, // 28: daemon.StartedService.CloseAllConnections:input_type -> google.protobuf.Empty
|
27, // 28: daemon.StartedService.GetDeprecatedWarnings:input_type -> google.protobuf.Empty
|
||||||
27, // 29: daemon.StartedService.GetDeprecatedWarnings:input_type -> google.protobuf.Empty
|
27, // 29: daemon.StartedService.SubscribeHelperEvents:input_type -> google.protobuf.Empty
|
||||||
27, // 30: daemon.StartedService.SubscribeHelperEvents:input_type -> google.protobuf.Empty
|
28, // 30: daemon.StartedService.SendHelperResponse:input_type -> daemon.HelperResponse
|
||||||
28, // 31: daemon.StartedService.SendHelperResponse:input_type -> daemon.HelperResponse
|
27, // 31: daemon.StartedService.StopService:output_type -> google.protobuf.Empty
|
||||||
27, // 32: daemon.StartedService.StopService:output_type -> google.protobuf.Empty
|
27, // 32: daemon.StartedService.ReloadService:output_type -> google.protobuf.Empty
|
||||||
27, // 33: daemon.StartedService.ReloadService:output_type -> google.protobuf.Empty
|
4, // 33: daemon.StartedService.SubscribeServiceStatus:output_type -> daemon.ServiceStatus
|
||||||
4, // 34: daemon.StartedService.SubscribeServiceStatus:output_type -> daemon.ServiceStatus
|
7, // 34: daemon.StartedService.SubscribeLog:output_type -> daemon.Log
|
||||||
7, // 35: daemon.StartedService.SubscribeLog:output_type -> daemon.Log
|
8, // 35: daemon.StartedService.GetDefaultLogLevel:output_type -> daemon.DefaultLogLevel
|
||||||
8, // 36: daemon.StartedService.GetDefaultLogLevel:output_type -> daemon.DefaultLogLevel
|
9, // 36: daemon.StartedService.SubscribeStatus:output_type -> daemon.Status
|
||||||
27, // 37: daemon.StartedService.ClearLogs:output_type -> google.protobuf.Empty
|
10, // 37: daemon.StartedService.SubscribeGroups:output_type -> daemon.Groups
|
||||||
9, // 38: daemon.StartedService.SubscribeStatus:output_type -> daemon.Status
|
17, // 38: daemon.StartedService.GetClashModeStatus:output_type -> daemon.ClashModeStatus
|
||||||
10, // 39: daemon.StartedService.SubscribeGroups:output_type -> daemon.Groups
|
16, // 39: daemon.StartedService.SubscribeClashMode:output_type -> daemon.ClashMode
|
||||||
17, // 40: daemon.StartedService.GetClashModeStatus:output_type -> daemon.ClashModeStatus
|
27, // 40: daemon.StartedService.SetClashMode:output_type -> google.protobuf.Empty
|
||||||
16, // 41: daemon.StartedService.SubscribeClashMode:output_type -> daemon.ClashMode
|
27, // 41: daemon.StartedService.URLTest:output_type -> google.protobuf.Empty
|
||||||
27, // 42: daemon.StartedService.SetClashMode:output_type -> google.protobuf.Empty
|
27, // 42: daemon.StartedService.SelectOutbound:output_type -> google.protobuf.Empty
|
||||||
27, // 43: daemon.StartedService.URLTest:output_type -> google.protobuf.Empty
|
27, // 43: daemon.StartedService.SetGroupExpand:output_type -> google.protobuf.Empty
|
||||||
27, // 44: daemon.StartedService.SelectOutbound:output_type -> google.protobuf.Empty
|
18, // 44: daemon.StartedService.GetSystemProxyStatus:output_type -> daemon.SystemProxyStatus
|
||||||
27, // 45: daemon.StartedService.SetGroupExpand:output_type -> google.protobuf.Empty
|
27, // 45: daemon.StartedService.SetSystemProxyEnabled:output_type -> google.protobuf.Empty
|
||||||
18, // 46: daemon.StartedService.GetSystemProxyStatus:output_type -> daemon.SystemProxyStatus
|
21, // 46: daemon.StartedService.SubscribeConnections:output_type -> daemon.Connections
|
||||||
27, // 47: daemon.StartedService.SetSystemProxyEnabled:output_type -> google.protobuf.Empty
|
27, // 47: daemon.StartedService.CloseConnection:output_type -> google.protobuf.Empty
|
||||||
21, // 48: daemon.StartedService.SubscribeConnections:output_type -> daemon.Connections
|
27, // 48: daemon.StartedService.CloseAllConnections:output_type -> google.protobuf.Empty
|
||||||
27, // 49: daemon.StartedService.CloseConnection:output_type -> google.protobuf.Empty
|
24, // 49: daemon.StartedService.GetDeprecatedWarnings:output_type -> daemon.DeprecatedWarnings
|
||||||
27, // 50: daemon.StartedService.CloseAllConnections:output_type -> google.protobuf.Empty
|
29, // 50: daemon.StartedService.SubscribeHelperEvents:output_type -> daemon.HelperRequest
|
||||||
24, // 51: daemon.StartedService.GetDeprecatedWarnings:output_type -> daemon.DeprecatedWarnings
|
27, // 51: daemon.StartedService.SendHelperResponse:output_type -> google.protobuf.Empty
|
||||||
29, // 52: daemon.StartedService.SubscribeHelperEvents:output_type -> daemon.HelperRequest
|
31, // [31:52] is the sub-list for method output_type
|
||||||
27, // 53: daemon.StartedService.SendHelperResponse:output_type -> google.protobuf.Empty
|
10, // [10:31] is the sub-list for method input_type
|
||||||
32, // [32:54] is the sub-list for method output_type
|
|
||||||
10, // [10:32] is the sub-list for method input_type
|
|
||||||
10, // [10:10] is the sub-list for extension type_name
|
10, // [10:10] is the sub-list for extension type_name
|
||||||
10, // [10:10] is the sub-list for extension extendee
|
10, // [10:10] is the sub-list for extension extendee
|
||||||
0, // [0:10] is the sub-list for field type_name
|
0, // [0:10] is the sub-list for field type_name
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ service StartedService {
|
|||||||
rpc SubscribeServiceStatus(google.protobuf.Empty) returns(stream ServiceStatus) {}
|
rpc SubscribeServiceStatus(google.protobuf.Empty) returns(stream ServiceStatus) {}
|
||||||
rpc SubscribeLog(google.protobuf.Empty) returns(stream Log) {}
|
rpc SubscribeLog(google.protobuf.Empty) returns(stream Log) {}
|
||||||
rpc GetDefaultLogLevel(google.protobuf.Empty) returns(DefaultLogLevel) {}
|
rpc GetDefaultLogLevel(google.protobuf.Empty) returns(DefaultLogLevel) {}
|
||||||
rpc ClearLogs(google.protobuf.Empty) returns(google.protobuf.Empty) {}
|
|
||||||
rpc SubscribeStatus(SubscribeStatusRequest) returns(stream Status) {}
|
rpc SubscribeStatus(SubscribeStatusRequest) returns(stream Status) {}
|
||||||
rpc SubscribeGroups(google.protobuf.Empty) returns(stream Groups) {}
|
rpc SubscribeGroups(google.protobuf.Empty) returns(stream Groups) {}
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ const (
|
|||||||
StartedService_SubscribeServiceStatus_FullMethodName = "/daemon.StartedService/SubscribeServiceStatus"
|
StartedService_SubscribeServiceStatus_FullMethodName = "/daemon.StartedService/SubscribeServiceStatus"
|
||||||
StartedService_SubscribeLog_FullMethodName = "/daemon.StartedService/SubscribeLog"
|
StartedService_SubscribeLog_FullMethodName = "/daemon.StartedService/SubscribeLog"
|
||||||
StartedService_GetDefaultLogLevel_FullMethodName = "/daemon.StartedService/GetDefaultLogLevel"
|
StartedService_GetDefaultLogLevel_FullMethodName = "/daemon.StartedService/GetDefaultLogLevel"
|
||||||
StartedService_ClearLogs_FullMethodName = "/daemon.StartedService/ClearLogs"
|
|
||||||
StartedService_SubscribeStatus_FullMethodName = "/daemon.StartedService/SubscribeStatus"
|
StartedService_SubscribeStatus_FullMethodName = "/daemon.StartedService/SubscribeStatus"
|
||||||
StartedService_SubscribeGroups_FullMethodName = "/daemon.StartedService/SubscribeGroups"
|
StartedService_SubscribeGroups_FullMethodName = "/daemon.StartedService/SubscribeGroups"
|
||||||
StartedService_GetClashModeStatus_FullMethodName = "/daemon.StartedService/GetClashModeStatus"
|
StartedService_GetClashModeStatus_FullMethodName = "/daemon.StartedService/GetClashModeStatus"
|
||||||
@@ -48,7 +47,6 @@ type StartedServiceClient interface {
|
|||||||
SubscribeServiceStatus(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (grpc.ServerStreamingClient[ServiceStatus], error)
|
SubscribeServiceStatus(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (grpc.ServerStreamingClient[ServiceStatus], error)
|
||||||
SubscribeLog(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (grpc.ServerStreamingClient[Log], error)
|
SubscribeLog(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (grpc.ServerStreamingClient[Log], error)
|
||||||
GetDefaultLogLevel(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*DefaultLogLevel, error)
|
GetDefaultLogLevel(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*DefaultLogLevel, error)
|
||||||
ClearLogs(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*emptypb.Empty, error)
|
|
||||||
SubscribeStatus(ctx context.Context, in *SubscribeStatusRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[Status], error)
|
SubscribeStatus(ctx context.Context, in *SubscribeStatusRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[Status], error)
|
||||||
SubscribeGroups(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (grpc.ServerStreamingClient[Groups], error)
|
SubscribeGroups(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (grpc.ServerStreamingClient[Groups], error)
|
||||||
GetClashModeStatus(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*ClashModeStatus, error)
|
GetClashModeStatus(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*ClashModeStatus, error)
|
||||||
@@ -143,16 +141,6 @@ func (c *startedServiceClient) GetDefaultLogLevel(ctx context.Context, in *empty
|
|||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *startedServiceClient) ClearLogs(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*emptypb.Empty, error) {
|
|
||||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
||||||
out := new(emptypb.Empty)
|
|
||||||
err := c.cc.Invoke(ctx, StartedService_ClearLogs_FullMethodName, in, out, cOpts...)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return out, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *startedServiceClient) SubscribeStatus(ctx context.Context, in *SubscribeStatusRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[Status], error) {
|
func (c *startedServiceClient) SubscribeStatus(ctx context.Context, in *SubscribeStatusRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[Status], error) {
|
||||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
stream, err := c.cc.NewStream(ctx, &StartedService_ServiceDesc.Streams[2], StartedService_SubscribeStatus_FullMethodName, cOpts...)
|
stream, err := c.cc.NewStream(ctx, &StartedService_ServiceDesc.Streams[2], StartedService_SubscribeStatus_FullMethodName, cOpts...)
|
||||||
@@ -367,7 +355,6 @@ type StartedServiceServer interface {
|
|||||||
SubscribeServiceStatus(*emptypb.Empty, grpc.ServerStreamingServer[ServiceStatus]) error
|
SubscribeServiceStatus(*emptypb.Empty, grpc.ServerStreamingServer[ServiceStatus]) error
|
||||||
SubscribeLog(*emptypb.Empty, grpc.ServerStreamingServer[Log]) error
|
SubscribeLog(*emptypb.Empty, grpc.ServerStreamingServer[Log]) error
|
||||||
GetDefaultLogLevel(context.Context, *emptypb.Empty) (*DefaultLogLevel, error)
|
GetDefaultLogLevel(context.Context, *emptypb.Empty) (*DefaultLogLevel, error)
|
||||||
ClearLogs(context.Context, *emptypb.Empty) (*emptypb.Empty, error)
|
|
||||||
SubscribeStatus(*SubscribeStatusRequest, grpc.ServerStreamingServer[Status]) error
|
SubscribeStatus(*SubscribeStatusRequest, grpc.ServerStreamingServer[Status]) error
|
||||||
SubscribeGroups(*emptypb.Empty, grpc.ServerStreamingServer[Groups]) error
|
SubscribeGroups(*emptypb.Empty, grpc.ServerStreamingServer[Groups]) error
|
||||||
GetClashModeStatus(context.Context, *emptypb.Empty) (*ClashModeStatus, error)
|
GetClashModeStatus(context.Context, *emptypb.Empty) (*ClashModeStatus, error)
|
||||||
@@ -414,10 +401,6 @@ func (UnimplementedStartedServiceServer) GetDefaultLogLevel(context.Context, *em
|
|||||||
return nil, status.Errorf(codes.Unimplemented, "method GetDefaultLogLevel not implemented")
|
return nil, status.Errorf(codes.Unimplemented, "method GetDefaultLogLevel not implemented")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (UnimplementedStartedServiceServer) ClearLogs(context.Context, *emptypb.Empty) (*emptypb.Empty, error) {
|
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method ClearLogs not implemented")
|
|
||||||
}
|
|
||||||
|
|
||||||
func (UnimplementedStartedServiceServer) SubscribeStatus(*SubscribeStatusRequest, grpc.ServerStreamingServer[Status]) error {
|
func (UnimplementedStartedServiceServer) SubscribeStatus(*SubscribeStatusRequest, grpc.ServerStreamingServer[Status]) error {
|
||||||
return status.Errorf(codes.Unimplemented, "method SubscribeStatus not implemented")
|
return status.Errorf(codes.Unimplemented, "method SubscribeStatus not implemented")
|
||||||
}
|
}
|
||||||
@@ -578,24 +561,6 @@ func _StartedService_GetDefaultLogLevel_Handler(srv interface{}, ctx context.Con
|
|||||||
return interceptor(ctx, in, info, handler)
|
return interceptor(ctx, in, info, handler)
|
||||||
}
|
}
|
||||||
|
|
||||||
func _StartedService_ClearLogs_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
||||||
in := new(emptypb.Empty)
|
|
||||||
if err := dec(in); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
if interceptor == nil {
|
|
||||||
return srv.(StartedServiceServer).ClearLogs(ctx, in)
|
|
||||||
}
|
|
||||||
info := &grpc.UnaryServerInfo{
|
|
||||||
Server: srv,
|
|
||||||
FullMethod: StartedService_ClearLogs_FullMethodName,
|
|
||||||
}
|
|
||||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
||||||
return srv.(StartedServiceServer).ClearLogs(ctx, req.(*emptypb.Empty))
|
|
||||||
}
|
|
||||||
return interceptor(ctx, in, info, handler)
|
|
||||||
}
|
|
||||||
|
|
||||||
func _StartedService_SubscribeStatus_Handler(srv interface{}, stream grpc.ServerStream) error {
|
func _StartedService_SubscribeStatus_Handler(srv interface{}, stream grpc.ServerStream) error {
|
||||||
m := new(SubscribeStatusRequest)
|
m := new(SubscribeStatusRequest)
|
||||||
if err := stream.RecvMsg(m); err != nil {
|
if err := stream.RecvMsg(m); err != nil {
|
||||||
@@ -868,10 +833,6 @@ var StartedService_ServiceDesc = grpc.ServiceDesc{
|
|||||||
MethodName: "GetDefaultLogLevel",
|
MethodName: "GetDefaultLogLevel",
|
||||||
Handler: _StartedService_GetDefaultLogLevel_Handler,
|
Handler: _StartedService_GetDefaultLogLevel_Handler,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
MethodName: "ClearLogs",
|
|
||||||
Handler: _StartedService_ClearLogs_Handler,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
MethodName: "GetClashModeStatus",
|
MethodName: "GetClashModeStatus",
|
||||||
Handler: _StartedService_GetClashModeStatus_Handler,
|
Handler: _StartedService_GetClashModeStatus_Handler,
|
||||||
|
|||||||
@@ -95,20 +95,6 @@ func (c *Client) Start() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func extractNegativeTTL(response *dns.Msg) (uint32, bool) {
|
|
||||||
for _, record := range response.Ns {
|
|
||||||
if soa, isSOA := record.(*dns.SOA); isSOA {
|
|
||||||
soaTTL := soa.Header().Ttl
|
|
||||||
soaMinimum := soa.Minttl
|
|
||||||
if soaTTL < soaMinimum {
|
|
||||||
return soaTTL, true
|
|
||||||
}
|
|
||||||
return soaMinimum, true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0, false
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Client) Exchange(ctx context.Context, transport adapter.DNSTransport, message *dns.Msg, options adapter.DNSQueryOptions, responseChecker func(responseAddrs []netip.Addr) bool) (*dns.Msg, error) {
|
func (c *Client) Exchange(ctx context.Context, transport adapter.DNSTransport, message *dns.Msg, options adapter.DNSQueryOptions, responseChecker func(responseAddrs []netip.Addr) bool) (*dns.Msg, error) {
|
||||||
if len(message.Question) == 0 {
|
if len(message.Question) == 0 {
|
||||||
if c.logger != nil {
|
if c.logger != nil {
|
||||||
@@ -228,7 +214,7 @@ func (c *Client) Exchange(ctx context.Context, transport adapter.DNSTransport, m
|
|||||||
response.Answer = append(response.Answer, validResponse.Answer...)
|
response.Answer = append(response.Answer, validResponse.Answer...)
|
||||||
}
|
}
|
||||||
}*/
|
}*/
|
||||||
disableCache = disableCache || (response.Rcode != dns.RcodeSuccess && response.Rcode != dns.RcodeNameError)
|
disableCache = disableCache || response.Rcode != dns.RcodeSuccess || len(response.Answer) == 0
|
||||||
if responseChecker != nil {
|
if responseChecker != nil {
|
||||||
var rejected bool
|
var rejected bool
|
||||||
// TODO: add accept_any rule and support to check response instead of addresses
|
// TODO: add accept_any rule and support to check response instead of addresses
|
||||||
@@ -265,17 +251,10 @@ func (c *Client) Exchange(ctx context.Context, transport adapter.DNSTransport, m
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
var timeToLive uint32
|
var timeToLive uint32
|
||||||
if len(response.Answer) == 0 {
|
for _, recordList := range [][]dns.RR{response.Answer, response.Ns, response.Extra} {
|
||||||
if soaTTL, hasSOA := extractNegativeTTL(response); hasSOA {
|
for _, record := range recordList {
|
||||||
timeToLive = soaTTL
|
if timeToLive == 0 || record.Header().Ttl > 0 && record.Header().Ttl < timeToLive {
|
||||||
}
|
timeToLive = record.Header().Ttl
|
||||||
}
|
|
||||||
if timeToLive == 0 {
|
|
||||||
for _, recordList := range [][]dns.RR{response.Answer, response.Ns, response.Extra} {
|
|
||||||
for _, record := range recordList {
|
|
||||||
if timeToLive == 0 || record.Header().Ttl > 0 && record.Header().Ttl < timeToLive {
|
|
||||||
timeToLive = record.Header().Ttl
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -385,18 +364,14 @@ func (c *Client) LookupCache(domain string, strategy C.DomainStrategy) ([]netip.
|
|||||||
Qtype: dns.TypeA,
|
Qtype: dns.TypeA,
|
||||||
Qclass: dns.ClassINET,
|
Qclass: dns.ClassINET,
|
||||||
}, nil)
|
}, nil)
|
||||||
if response4 == nil {
|
|
||||||
return nil, false
|
|
||||||
}
|
|
||||||
response6, _ := c.loadResponse(dns.Question{
|
response6, _ := c.loadResponse(dns.Question{
|
||||||
Name: dnsName,
|
Name: dnsName,
|
||||||
Qtype: dns.TypeAAAA,
|
Qtype: dns.TypeAAAA,
|
||||||
Qclass: dns.ClassINET,
|
Qclass: dns.ClassINET,
|
||||||
}, nil)
|
}, nil)
|
||||||
if response6 == nil {
|
if response4 != nil || response6 != nil {
|
||||||
return nil, false
|
return sortAddresses(MessageToAddresses(response4), MessageToAddresses(response6), strategy), true
|
||||||
}
|
}
|
||||||
return sortAddresses(MessageToAddresses(response4), MessageToAddresses(response6), strategy), true
|
|
||||||
}
|
}
|
||||||
return nil, false
|
return nil, false
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -385,7 +385,12 @@ func (r *Router) Lookup(ctx context.Context, domain string, options adapter.DNSQ
|
|||||||
if rule != nil {
|
if rule != nil {
|
||||||
switch action := rule.Action().(type) {
|
switch action := rule.Action().(type) {
|
||||||
case *R.RuleActionReject:
|
case *R.RuleActionReject:
|
||||||
return nil, &R.RejectedError{Cause: action.Error(ctx)}
|
switch action.Method {
|
||||||
|
case C.RuleActionRejectMethodDefault:
|
||||||
|
return nil, nil
|
||||||
|
case C.RuleActionRejectMethodDrop:
|
||||||
|
return nil, tun.ErrDrop
|
||||||
|
}
|
||||||
case *R.RuleActionPredefined:
|
case *R.RuleActionPredefined:
|
||||||
if action.Rcode != mDNS.RcodeSuccess {
|
if action.Rcode != mDNS.RcodeSuccess {
|
||||||
err = RcodeError(action.Rcode)
|
err = RcodeError(action.Rcode)
|
||||||
|
|||||||
@@ -49,7 +49,6 @@ type Transport struct {
|
|||||||
interfaceCallback *list.Element[tun.DefaultInterfaceUpdateCallback]
|
interfaceCallback *list.Element[tun.DefaultInterfaceUpdateCallback]
|
||||||
transportLock sync.RWMutex
|
transportLock sync.RWMutex
|
||||||
updatedAt time.Time
|
updatedAt time.Time
|
||||||
lastError error
|
|
||||||
servers []M.Socksaddr
|
servers []M.Socksaddr
|
||||||
search []string
|
search []string
|
||||||
ndots int
|
ndots int
|
||||||
@@ -93,7 +92,7 @@ func (t *Transport) Start(stage adapter.StartStage) error {
|
|||||||
t.interfaceCallback = t.networkManager.InterfaceMonitor().RegisterCallback(t.interfaceUpdated)
|
t.interfaceCallback = t.networkManager.InterfaceMonitor().RegisterCallback(t.interfaceUpdated)
|
||||||
}
|
}
|
||||||
go func() {
|
go func() {
|
||||||
_, err := t.fetch()
|
_, err := t.Fetch()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.logger.Error(E.Cause(err, "fetch DNS servers"))
|
t.logger.Error(E.Cause(err, "fetch DNS servers"))
|
||||||
}
|
}
|
||||||
@@ -109,7 +108,7 @@ func (t *Transport) Close() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (t *Transport) Exchange(ctx context.Context, message *mDNS.Msg) (*mDNS.Msg, error) {
|
func (t *Transport) Exchange(ctx context.Context, message *mDNS.Msg) (*mDNS.Msg, error) {
|
||||||
servers, err := t.fetch()
|
servers, err := t.Fetch()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -129,20 +128,11 @@ func (t *Transport) Exchange0(ctx context.Context, message *mDNS.Msg, servers []
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *Transport) Fetch() []M.Socksaddr {
|
func (t *Transport) Fetch() ([]M.Socksaddr, error) {
|
||||||
servers, _ := t.fetch()
|
|
||||||
return servers
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t *Transport) fetch() ([]M.Socksaddr, error) {
|
|
||||||
t.transportLock.RLock()
|
t.transportLock.RLock()
|
||||||
updatedAt := t.updatedAt
|
updatedAt := t.updatedAt
|
||||||
lastError := t.lastError
|
|
||||||
servers := t.servers
|
servers := t.servers
|
||||||
t.transportLock.RUnlock()
|
t.transportLock.RUnlock()
|
||||||
if lastError != nil {
|
|
||||||
return nil, lastError
|
|
||||||
}
|
|
||||||
if time.Since(updatedAt) < C.DHCPTTL {
|
if time.Since(updatedAt) < C.DHCPTTL {
|
||||||
return servers, nil
|
return servers, nil
|
||||||
}
|
}
|
||||||
@@ -153,7 +143,7 @@ func (t *Transport) fetch() ([]M.Socksaddr, error) {
|
|||||||
}
|
}
|
||||||
err := t.updateServers()
|
err := t.updateServers()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return servers, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return t.servers, nil
|
return t.servers, nil
|
||||||
}
|
}
|
||||||
@@ -183,15 +173,12 @@ func (t *Transport) updateServers() error {
|
|||||||
fetchCtx, cancel := context.WithTimeout(t.ctx, C.DHCPTimeout)
|
fetchCtx, cancel := context.WithTimeout(t.ctx, C.DHCPTimeout)
|
||||||
err = t.fetchServers0(fetchCtx, iface)
|
err = t.fetchServers0(fetchCtx, iface)
|
||||||
cancel()
|
cancel()
|
||||||
t.updatedAt = time.Now()
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.lastError = err
|
|
||||||
return err
|
return err
|
||||||
} else if len(t.servers) == 0 {
|
} else if len(t.servers) == 0 {
|
||||||
t.lastError = E.New("dhcp: empty DNS servers response")
|
return E.New("dhcp: empty DNS servers response")
|
||||||
return t.lastError
|
|
||||||
} else {
|
} else {
|
||||||
t.lastError = nil
|
t.updatedAt = time.Now()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -75,6 +75,5 @@ func (h *HTTPSTransportWrapper) Clone() *HTTPSTransportWrapper {
|
|||||||
http2Transport: &http2.Transport{
|
http2Transport: &http2.Transport{
|
||||||
DialTLSContext: h.http2Transport.DialTLSContext,
|
DialTLSContext: h.http2Transport.DialTLSContext,
|
||||||
},
|
},
|
||||||
fallback: h.fallback,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,15 +53,13 @@ func (t *Transport) Start(stage adapter.StartStage) error {
|
|||||||
switch stage {
|
switch stage {
|
||||||
case adapter.StartStateInitialize:
|
case adapter.StartStateInitialize:
|
||||||
if !t.preferGo {
|
if !t.preferGo {
|
||||||
if isSystemdResolvedManaged() {
|
resolvedResolver, err := NewResolvedResolver(t.ctx, t.logger)
|
||||||
resolvedResolver, err := NewResolvedResolver(t.ctx, t.logger)
|
if err == nil {
|
||||||
|
err = resolvedResolver.Start()
|
||||||
if err == nil {
|
if err == nil {
|
||||||
err = resolvedResolver.Start()
|
t.resolved = resolvedResolver
|
||||||
if err == nil {
|
} else {
|
||||||
t.resolved = resolvedResolver
|
t.logger.Warn(E.Cause(err, "initialize resolved resolver"))
|
||||||
} else {
|
|
||||||
t.logger.Warn(E.Cause(err, "initialize resolved resolver"))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -84,11 +82,12 @@ func (t *Transport) Exchange(ctx context.Context, message *mDNS.Msg) (*mDNS.Msg,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
question := message.Question[0]
|
question := message.Question[0]
|
||||||
|
domain := dns.FqdnToDomain(question.Name)
|
||||||
if question.Qtype == mDNS.TypeA || question.Qtype == mDNS.TypeAAAA {
|
if question.Qtype == mDNS.TypeA || question.Qtype == mDNS.TypeAAAA {
|
||||||
addresses := t.hosts.Lookup(dns.FqdnToDomain(question.Name))
|
addresses := t.hosts.Lookup(domain)
|
||||||
if len(addresses) > 0 {
|
if len(addresses) > 0 {
|
||||||
return dns.FixedResponse(message.Id, question, addresses, C.DefaultDNSTTL), nil
|
return dns.FixedResponse(message.Id, question, addresses, C.DefaultDNSTTL), nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return t.exchange(ctx, message, question.Name)
|
return t.exchange(ctx, message, domain)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ type Transport struct {
|
|||||||
|
|
||||||
type dhcpTransport interface {
|
type dhcpTransport interface {
|
||||||
adapter.DNSTransport
|
adapter.DNSTransport
|
||||||
Fetch() []M.Socksaddr
|
Fetch() ([]M.Socksaddr, error)
|
||||||
Exchange0(ctx context.Context, message *mDNS.Msg, servers []M.Socksaddr) (*mDNS.Msg, error)
|
Exchange0(ctx context.Context, message *mDNS.Msg, servers []M.Socksaddr) (*mDNS.Msg, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -74,12 +74,14 @@ func (t *Transport) Start(stage adapter.StartStage) error {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if t.fallback {
|
if !C.IsIos {
|
||||||
t.dhcpTransport = newDHCPTransport(t.TransportAdapter, log.ContextWithOverrideLevel(t.ctx, log.LevelDebug), t.dialer, t.logger)
|
if t.fallback {
|
||||||
if t.dhcpTransport != nil {
|
t.dhcpTransport = newDHCPTransport(t.TransportAdapter, log.ContextWithOverrideLevel(t.ctx, log.LevelDebug), t.dialer, t.logger)
|
||||||
err := t.dhcpTransport.Start(stage)
|
if t.dhcpTransport != nil {
|
||||||
if err != nil {
|
err := t.dhcpTransport.Start(stage)
|
||||||
return err
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -94,24 +96,27 @@ func (t *Transport) Close() error {
|
|||||||
|
|
||||||
func (t *Transport) Exchange(ctx context.Context, message *mDNS.Msg) (*mDNS.Msg, error) {
|
func (t *Transport) Exchange(ctx context.Context, message *mDNS.Msg) (*mDNS.Msg, error) {
|
||||||
question := message.Question[0]
|
question := message.Question[0]
|
||||||
|
domain := dns.FqdnToDomain(question.Name)
|
||||||
if question.Qtype == mDNS.TypeA || question.Qtype == mDNS.TypeAAAA {
|
if question.Qtype == mDNS.TypeA || question.Qtype == mDNS.TypeAAAA {
|
||||||
addresses := t.hosts.Lookup(dns.FqdnToDomain(question.Name))
|
addresses := t.hosts.Lookup(domain)
|
||||||
if len(addresses) > 0 {
|
if len(addresses) > 0 {
|
||||||
return dns.FixedResponse(message.Id, question, addresses, C.DefaultDNSTTL), nil
|
return dns.FixedResponse(message.Id, question, addresses, C.DefaultDNSTTL), nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if !t.fallback {
|
if !t.fallback {
|
||||||
return t.exchange(ctx, message, question.Name)
|
return t.exchange(ctx, message, domain)
|
||||||
}
|
}
|
||||||
if t.dhcpTransport != nil {
|
if !C.IsIos {
|
||||||
dhcpTransports := t.dhcpTransport.Fetch()
|
if t.dhcpTransport != nil {
|
||||||
if len(dhcpTransports) > 0 {
|
dhcpTransports, _ := t.dhcpTransport.Fetch()
|
||||||
return t.dhcpTransport.Exchange0(ctx, message, dhcpTransports)
|
if len(dhcpTransports) > 0 {
|
||||||
|
return t.dhcpTransport.Exchange0(ctx, message, dhcpTransports)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if t.preferGo {
|
if t.preferGo {
|
||||||
// Assuming the user knows what they are doing, we still execute the query which will fail.
|
// Assuming the user knows what they are doing, we still execute the query which will fail.
|
||||||
return t.exchange(ctx, message, question.Name)
|
return t.exchange(ctx, message, domain)
|
||||||
}
|
}
|
||||||
if question.Qtype == mDNS.TypeA || question.Qtype == mDNS.TypeAAAA {
|
if question.Qtype == mDNS.TypeA || question.Qtype == mDNS.TypeAAAA {
|
||||||
var network string
|
var network string
|
||||||
@@ -120,7 +125,7 @@ func (t *Transport) Exchange(ctx context.Context, message *mDNS.Msg) (*mDNS.Msg,
|
|||||||
} else {
|
} else {
|
||||||
network = "ip6"
|
network = "ip6"
|
||||||
}
|
}
|
||||||
addresses, err := t.resolver.LookupNetIP(ctx, network, question.Name)
|
addresses, err := t.resolver.LookupNetIP(ctx, network, domain)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
var dnsError *net.DNSError
|
var dnsError *net.DNSError
|
||||||
if errors.As(err, &dnsError) && dnsError.IsNotFound {
|
if errors.As(err, &dnsError) && dnsError.IsNotFound {
|
||||||
@@ -130,5 +135,9 @@ func (t *Transport) Exchange(ctx context.Context, message *mDNS.Msg) (*mDNS.Msg,
|
|||||||
}
|
}
|
||||||
return dns.FixedResponse(message.Id, question, addresses, C.DefaultDNSTTL), nil
|
return dns.FixedResponse(message.Id, question, addresses, C.DefaultDNSTTL), nil
|
||||||
}
|
}
|
||||||
return nil, E.New("only A and AAAA queries are supported on Apple platforms when using TUN and DHCP unavailable.")
|
if C.IsIos {
|
||||||
|
return nil, E.New("only A and AAAA queries are supported on iOS and tvOS when using NetworkExtension.")
|
||||||
|
} else {
|
||||||
|
return nil, E.New("only A and AAAA queries are supported on macOS when using NetworkExtension and DHCP unavailable.")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,9 @@
|
|||||||
package local
|
package local
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bufio"
|
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
|
||||||
"sync"
|
"sync"
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
|
|
||||||
@@ -24,25 +22,6 @@ import (
|
|||||||
mDNS "github.com/miekg/dns"
|
mDNS "github.com/miekg/dns"
|
||||||
)
|
)
|
||||||
|
|
||||||
func isSystemdResolvedManaged() bool {
|
|
||||||
resolvContent, err := os.Open("/etc/resolv.conf")
|
|
||||||
if err != nil {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
defer resolvContent.Close()
|
|
||||||
scanner := bufio.NewScanner(resolvContent)
|
|
||||||
for scanner.Scan() {
|
|
||||||
line := strings.TrimSpace(scanner.Text())
|
|
||||||
if line == "" || line[0] != '#' {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
if strings.Contains(line, "systemd-resolved") {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
type DBusResolvedResolver struct {
|
type DBusResolvedResolver struct {
|
||||||
ctx context.Context
|
ctx context.Context
|
||||||
logger logger.ContextLogger
|
logger logger.ContextLogger
|
||||||
@@ -209,7 +188,7 @@ func (t *DBusResolvedResolver) checkResolved(ctx context.Context) (*ResolvedObje
|
|||||||
int32(defaultInterface.Index),
|
int32(defaultInterface.Index),
|
||||||
)
|
)
|
||||||
if call.Err != nil {
|
if call.Err != nil {
|
||||||
return nil, call.Err
|
return nil, err
|
||||||
}
|
}
|
||||||
var linkPath dbus.ObjectPath
|
var linkPath dbus.ObjectPath
|
||||||
err = call.Store(&linkPath)
|
err = call.Store(&linkPath)
|
||||||
@@ -235,12 +214,15 @@ func (t *DBusResolvedResolver) checkResolved(ctx context.Context) (*ResolvedObje
|
|||||||
return nil, E.New("No appropriate name servers or networks for name found")
|
return nil, E.New("No appropriate name servers or networks for name found")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil, E.New("link has no DNS servers configured")
|
return &ResolvedObject{
|
||||||
|
BusObject: dbusObject,
|
||||||
|
}, nil
|
||||||
|
} else {
|
||||||
|
return &ResolvedObject{
|
||||||
|
BusObject: dbusObject,
|
||||||
|
InterfaceIndex: int32(defaultInterface.Index),
|
||||||
|
}, nil
|
||||||
}
|
}
|
||||||
return &ResolvedObject{
|
|
||||||
BusObject: dbusObject,
|
|
||||||
InterfaceIndex: int32(defaultInterface.Index),
|
|
||||||
}, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *DBusResolvedResolver) updateDefaultInterface(defaultInterface *control.Interface, flags int) {
|
func (t *DBusResolvedResolver) updateDefaultInterface(defaultInterface *control.Interface, flags int) {
|
||||||
|
|||||||
@@ -9,10 +9,6 @@ import (
|
|||||||
"github.com/sagernet/sing/common/logger"
|
"github.com/sagernet/sing/common/logger"
|
||||||
)
|
)
|
||||||
|
|
||||||
func isSystemdResolvedManaged() bool {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewResolvedResolver(ctx context.Context, logger logger.ContextLogger) (ResolvedResolver, error) {
|
func NewResolvedResolver(ctx context.Context, logger logger.ContextLogger) (ResolvedResolver, error) {
|
||||||
return nil, os.ErrInvalid
|
return nil, os.ErrInvalid
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,168 +2,10 @@
|
|||||||
icon: material/alert-decagram
|
icon: material/alert-decagram
|
||||||
---
|
---
|
||||||
|
|
||||||
#### 1.13.0-alpha.32
|
#### 1.13.0-alpha.20
|
||||||
|
|
||||||
* Remove `certificate_public_key_sha256` option for NaiveProxy outbound **1**
|
|
||||||
* Fixes and improvements
|
|
||||||
|
|
||||||
**1**:
|
|
||||||
|
|
||||||
Self-signed certificates change traffic behavior significantly, which defeats the purpose of NaiveProxy's design to resist traffic analysis.
|
|
||||||
For this reason, and due to maintenance costs, there is no reason to continue supporting `certificate_public_key_sha256`, which was designed to simplify the use of self-signed certificates.
|
|
||||||
|
|
||||||
#### 1.13.0-alpha.31
|
|
||||||
|
|
||||||
* Add QUIC support for NaiveProxy outbound **1**
|
|
||||||
* Add QUIC congestion control option for NaiveProxy **2**
|
|
||||||
* Fixes and improvements
|
|
||||||
|
|
||||||
**1**:
|
|
||||||
|
|
||||||
NaiveProxy outbound now supports QUIC.
|
|
||||||
|
|
||||||
See [NaiveProxy outbound](/configuration/outbound/naive/#quic).
|
|
||||||
|
|
||||||
**2**:
|
|
||||||
|
|
||||||
NaiveProxy inbound and outbound now supports configurable QUIC congestion control algorithms, including BBR and BBRv2.
|
|
||||||
|
|
||||||
See [NaiveProxy inbound](/configuration/inbound/naive/#quic_congestion_control) and [NaiveProxy outbound](/configuration/outbound/naive/#quic_congestion_control).
|
|
||||||
|
|
||||||
#### 1.13.0-alpha.30
|
|
||||||
|
|
||||||
* Add ECH support for NaiveProxy outbound **1**
|
|
||||||
* Add `tls.ech.query_server_name` option **2**
|
|
||||||
* Fix NaiveProxy outbound on Windows **3**
|
|
||||||
* Add OpenAI Codex Multiplexer service **4**
|
|
||||||
* Fixes and improvements
|
|
||||||
|
|
||||||
**1**:
|
|
||||||
|
|
||||||
See [NaiveProxy outbound](/configuration/outbound/naive/#tls).
|
|
||||||
|
|
||||||
**2**:
|
|
||||||
|
|
||||||
See [TLS](/configuration/shared/tls/#query_server_name).
|
|
||||||
|
|
||||||
**3**:
|
|
||||||
|
|
||||||
Each Windows release now includes `libcronet.dll`.
|
|
||||||
Ensure this file is in the same directory as `sing-box.exe` or in a directory listed in `PATH`.
|
|
||||||
|
|
||||||
**4**:
|
|
||||||
|
|
||||||
See [OCM](/configuration/service/ocm).
|
|
||||||
|
|
||||||
#### 1.13.0-alpha.29
|
|
||||||
|
|
||||||
* Add UDP over TCP support for naiveproxy outbound **1**
|
|
||||||
* Fixes and improvements
|
|
||||||
|
|
||||||
**1**:
|
|
||||||
|
|
||||||
See [NaiveProxy outbound](/configuration/outbound/naive/#udp_over_tcp).
|
|
||||||
|
|
||||||
#### 1.13.0-alpha.28
|
|
||||||
|
|
||||||
* Add naiveproxy outbound **1**
|
|
||||||
* Add `disable_tcp_keep_alive`, `tcp_keep_alive` and `tcp_keep_alive_interval` options for dial fields **2**
|
|
||||||
* Update default TCP keep-alive initial period from 10 minutes to 5 minutes
|
|
||||||
* Update quic-go to v0.57.1
|
|
||||||
* Fixes and improvements
|
|
||||||
|
|
||||||
**1**:
|
|
||||||
|
|
||||||
Only available on Apple platforms, Android, Windows and some Linux architectures.
|
|
||||||
|
|
||||||
See [NaiveProxy outbound](/configuration/outbound/naive/).
|
|
||||||
|
|
||||||
**2**:
|
|
||||||
|
|
||||||
See [Dial Fields](/configuration/shared/dial/#tcp_keep_alive).
|
|
||||||
|
|
||||||
* __Unfortunately, for non-technical reasons, we are currently unable to notarize the standalone version of the macOS client:
|
|
||||||
because system extensions require signatures to function, we have had to temporarily halt its release.__
|
|
||||||
|
|
||||||
__We plan to fix the App Store release issue and launch a new standalone desktop client, but until then,
|
|
||||||
only clients on TestFlight will be available (unless you have an Apple Developer Program and compile from source code).__
|
|
||||||
|
|
||||||
|
|
||||||
#### 1.12.13
|
|
||||||
|
|
||||||
* Fix naive inbound
|
|
||||||
* Fixes and improvements
|
|
||||||
|
|
||||||
__Unfortunately, for non-technical reasons, we are currently unable to notarize the standalone version of the macOS client:
|
|
||||||
because system extensions require signatures to function, we have had to temporarily halt its release.__
|
|
||||||
|
|
||||||
__We plan to fix the App Store release issue and launch a new standalone desktop client, but until then,
|
|
||||||
only clients on TestFlight will be available (unless you have an Apple Developer Program and compile from source code).__
|
|
||||||
|
|
||||||
#### 1.12.12
|
|
||||||
|
|
||||||
* Fixes and improvements
|
* Fixes and improvements
|
||||||
|
|
||||||
#### 1.13.0-alpha.26
|
|
||||||
|
|
||||||
* Update quic-go to v0.55.0
|
|
||||||
* Fix memory leak in hysteria2
|
|
||||||
* Fixes and improvements
|
|
||||||
|
|
||||||
#### 1.12.11
|
|
||||||
|
|
||||||
* Fixes and improvements
|
|
||||||
|
|
||||||
#### 1.13.0-alpha.24
|
|
||||||
|
|
||||||
* Add Claude Code Multiplexer service **1**
|
|
||||||
* Fixes and improvements
|
|
||||||
|
|
||||||
**1**:
|
|
||||||
|
|
||||||
CCM (Claude Code Multiplexer) service allows you to access your local Claude Code subscription remotely through custom tokens, eliminating the need for OAuth authentication on remote clients.
|
|
||||||
|
|
||||||
See [CCM](/configuration/service/ccm).
|
|
||||||
|
|
||||||
#### 1.13.0-alpha.23
|
|
||||||
|
|
||||||
* Fix compatibility with MPTCP **1**
|
|
||||||
* Fixes and improvements
|
|
||||||
|
|
||||||
**1**:
|
|
||||||
|
|
||||||
`auto_redirect` now rejects MPTCP connections by default to fix compatibility issues,
|
|
||||||
but you can change it to bypass the sing-box via the new `exclude_mptcp` option.
|
|
||||||
|
|
||||||
See [TUN](/configuration/inbound/tun/#exclude_mptcp).
|
|
||||||
|
|
||||||
#### 1.13.0-alpha.22
|
|
||||||
|
|
||||||
* Update uTLS to v1.8.1 **1**
|
|
||||||
* Fixes and improvements
|
|
||||||
|
|
||||||
**1**:
|
|
||||||
|
|
||||||
This update fixes an critical issue that could cause simulated Chrome fingerprints to be detected,
|
|
||||||
see https://github.com/refraction-networking/utls/pull/375.
|
|
||||||
|
|
||||||
#### 1.12.10
|
|
||||||
|
|
||||||
* Update uTLS to v1.8.1 **1**
|
|
||||||
* Fixes and improvements
|
|
||||||
|
|
||||||
**1**:
|
|
||||||
|
|
||||||
This update fixes an critical issue that could cause simulated Chrome fingerprints to be detected,
|
|
||||||
see https://github.com/refraction-networking/utls/pull/375.
|
|
||||||
|
|
||||||
#### 1.13.0-alpha.21
|
|
||||||
|
|
||||||
* Fix missing mTLS support in client options **1**
|
|
||||||
* Fixes and improvements
|
|
||||||
|
|
||||||
See [TLS](/configuration/shared/tls/).
|
|
||||||
|
|
||||||
#### 1.12.9
|
#### 1.12.9
|
||||||
|
|
||||||
* Fixes and improvements
|
* Fixes and improvements
|
||||||
@@ -285,8 +127,7 @@ See [Tailscale](/configuration/endpoint/tailscale/).
|
|||||||
|
|
||||||
Due to maintenance difficulties, sing-box 1.12.0 requires at least Go 1.23 to compile.
|
Due to maintenance difficulties, sing-box 1.12.0 requires at least Go 1.23 to compile.
|
||||||
|
|
||||||
For Windows 7 users, legacy binaries now continue to compile with Go 1.23 and patches
|
For Windows 7 users, legacy binaries now continue to compile with Go 1.23 and patches from [MetaCubeX/go](https://github.com/MetaCubeX/go).
|
||||||
from [MetaCubeX/go](https://github.com/MetaCubeX/go).
|
|
||||||
|
|
||||||
**7**:
|
**7**:
|
||||||
|
|
||||||
@@ -348,8 +189,7 @@ See [Tun](/configuration/inbound/tun/#loopback_address).
|
|||||||
|
|
||||||
We have significantly improved the performance of tun inbound on Apple platforms, especially in the gVisor stack.
|
We have significantly improved the performance of tun inbound on Apple platforms, especially in the gVisor stack.
|
||||||
|
|
||||||
The following data was tested
|
The following data was tested using [tun_bench](https://github.com/SagerNet/sing-box/blob/dev-next/cmd/internal/tun_bench/main.go) on M4 MacBook pro.
|
||||||
using [tun_bench](https://github.com/SagerNet/sing-box/blob/dev-next/cmd/internal/tun_bench/main.go) on M4 MacBook pro.
|
|
||||||
|
|
||||||
| Version | Stack | MTU | Upload | Download |
|
| Version | Stack | MTU | Upload | Download |
|
||||||
|-------------|--------|-------|--------|----------|
|
|-------------|--------|-------|--------|----------|
|
||||||
@@ -650,8 +490,7 @@ See [AnyTLS Inbound](/configuration/inbound/anytls/) and [AnyTLS Outbound](/conf
|
|||||||
|
|
||||||
**2**:
|
**2**:
|
||||||
|
|
||||||
`resolve` route action now accepts `disable_cache` and other options like in DNS route actions,
|
`resolve` route action now accepts `disable_cache` and other options like in DNS route actions, see [Route Action](/configuration/route/rule_action).
|
||||||
see [Route Action](/configuration/route/rule_action).
|
|
||||||
|
|
||||||
**3**:
|
**3**:
|
||||||
|
|
||||||
@@ -682,8 +521,7 @@ See [Tailscale](/configuration/endpoint/tailscale/).
|
|||||||
|
|
||||||
Due to maintenance difficulties, sing-box 1.12.0 requires at least Go 1.23 to compile.
|
Due to maintenance difficulties, sing-box 1.12.0 requires at least Go 1.23 to compile.
|
||||||
|
|
||||||
For Windows 7 users, legacy binaries now continue to compile with Go 1.23 and patches
|
For Windows 7 users, legacy binaries now continue to compile with Go 1.23 and patches from [MetaCubeX/go](https://github.com/MetaCubeX/go).
|
||||||
from [MetaCubeX/go](https://github.com/MetaCubeX/go).
|
|
||||||
|
|
||||||
### 1.11.3
|
### 1.11.3
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ platform-specific function implementation, such as TUN transparent proxy impleme
|
|||||||
|
|
||||||
!!! failure ""
|
!!! failure ""
|
||||||
|
|
||||||
Due to non-technical reasons, we are temporarily unable to update the sing-box app on the App Store and release the standalone version of the macOS client (TestFlight users are not affected)
|
We are temporarily unable to update sing-box apps on the App Store because the reviewer mistakenly found that we violated the rules (TestFlight users are not affected).
|
||||||
|
|
||||||
## :material-graph: Requirements
|
## :material-graph: Requirements
|
||||||
|
|
||||||
@@ -18,7 +18,7 @@ platform-specific function implementation, such as TUN transparent proxy impleme
|
|||||||
|
|
||||||
## :material-download: Download
|
## :material-download: Download
|
||||||
|
|
||||||
* ~~[App Store](https://apps.apple.com/app/sing-box-vt/id6673731168)~~
|
* [App Store](https://apps.apple.com/app/sing-box-vt/id6673731168)
|
||||||
* TestFlight (Beta)
|
* TestFlight (Beta)
|
||||||
|
|
||||||
TestFlight quota is only available to [sponsors](https://github.com/sponsors/nekohasekai)
|
TestFlight quota is only available to [sponsors](https://github.com/sponsors/nekohasekai)
|
||||||
@@ -26,15 +26,15 @@ TestFlight quota is only available to [sponsors](https://github.com/sponsors/nek
|
|||||||
Once you donate, you can get an invitation by join our Telegram group for sponsors from [@yet_another_sponsor_bot](https://t.me/yet_another_sponsor_bot)
|
Once you donate, you can get an invitation by join our Telegram group for sponsors from [@yet_another_sponsor_bot](https://t.me/yet_another_sponsor_bot)
|
||||||
or sending us your Apple ID [via email](mailto:contact@sagernet.org).
|
or sending us your Apple ID [via email](mailto:contact@sagernet.org).
|
||||||
|
|
||||||
## ~~:material-file-download: Download (macOS standalone version)~~
|
## :material-file-download: Download (macOS standalone version)
|
||||||
|
|
||||||
* ~~[Homebrew Cask](https://formulae.brew.sh/cask/sfm)~~
|
* [Homebrew Cask](https://formulae.brew.sh/cask/sfm)
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# brew install sfm
|
brew install sfm
|
||||||
```
|
```
|
||||||
|
|
||||||
* ~~[GitHub Releases](https://github.com/SagerNet/sing-box/releases)~~
|
* [GitHub Releases](https://github.com/SagerNet/sing-box/releases)
|
||||||
|
|
||||||
## :material-source-repository: Source code
|
## :material-source-repository: Source code
|
||||||
|
|
||||||
|
|||||||
@@ -412,7 +412,7 @@ Match default interface address.
|
|||||||
|
|
||||||
!!! quote ""
|
!!! quote ""
|
||||||
|
|
||||||
Only supported in graphical clients on Android and Apple platforms, or on Linux.
|
Only supported in graphical clients on Android and Apple platforms.
|
||||||
|
|
||||||
Match WiFi SSID.
|
Match WiFi SSID.
|
||||||
|
|
||||||
@@ -420,7 +420,7 @@ Match WiFi SSID.
|
|||||||
|
|
||||||
!!! quote ""
|
!!! quote ""
|
||||||
|
|
||||||
Only supported in graphical clients on Android and Apple platforms, or on Linux.
|
Only supported in graphical clients on Android and Apple platforms.
|
||||||
|
|
||||||
Match WiFi BSSID.
|
Match WiFi BSSID.
|
||||||
|
|
||||||
|
|||||||
@@ -411,7 +411,7 @@ Available values: `wifi`, `cellular`, `ethernet` and `other`.
|
|||||||
|
|
||||||
!!! quote ""
|
!!! quote ""
|
||||||
|
|
||||||
仅在 Android 与 Apple 平台图形客户端和 Linux 中支持。
|
仅在 Android 与 Apple 平台图形客户端中支持。
|
||||||
|
|
||||||
匹配 WiFi SSID。
|
匹配 WiFi SSID。
|
||||||
|
|
||||||
@@ -419,7 +419,7 @@ Available values: `wifi`, `cellular`, `ethernet` and `other`.
|
|||||||
|
|
||||||
!!! quote ""
|
!!! quote ""
|
||||||
|
|
||||||
仅在 Android 与 Apple 平台图形客户端和 Linux 中支持。
|
仅在 Android 与 Apple 平台图形客户端中支持。
|
||||||
|
|
||||||
匹配 WiFi BSSID。
|
匹配 WiFi BSSID。
|
||||||
|
|
||||||
|
|||||||
@@ -1,25 +1,20 @@
|
|||||||
!!! quote "Changes in sing-box 1.13.0"
|
|
||||||
|
|
||||||
:material-plus: [quic_congestion_control](#quic_congestion_control)
|
|
||||||
|
|
||||||
### Structure
|
### Structure
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"type": "naive",
|
"type": "naive",
|
||||||
"tag": "naive-in",
|
"tag": "naive-in",
|
||||||
"network": "udp",
|
"network": "udp",
|
||||||
...
|
|
||||||
// Listen Fields
|
|
||||||
|
|
||||||
"users": [
|
... // Listen Fields
|
||||||
{
|
|
||||||
"username": "sekai",
|
"users": [
|
||||||
"password": "password"
|
{
|
||||||
}
|
"username": "sekai",
|
||||||
],
|
"password": "password"
|
||||||
"quic_congestion_control": "",
|
}
|
||||||
"tls": {}
|
],
|
||||||
|
"tls": {}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -41,23 +36,6 @@ Both if empty.
|
|||||||
|
|
||||||
Naive users.
|
Naive users.
|
||||||
|
|
||||||
#### quic_congestion_control
|
|
||||||
|
|
||||||
!!! question "Since sing-box 1.13.0"
|
|
||||||
|
|
||||||
QUIC congestion control algorithm.
|
|
||||||
|
|
||||||
| Algorithm | Description |
|
|
||||||
|----------------|---------------------------------|
|
|
||||||
| `bbr` | BBR |
|
|
||||||
| `bbr_standard` | BBR (Standard version) |
|
|
||||||
| `bbr2` | BBRv2 |
|
|
||||||
| `bbr2_variant` | BBRv2 (An experimental variant) |
|
|
||||||
| `cubic` | CUBIC |
|
|
||||||
| `reno` | New Reno |
|
|
||||||
|
|
||||||
`bbr` is used by default (the default of QUICHE, used by Chromium which NaiveProxy is based on).
|
|
||||||
|
|
||||||
#### tls
|
#### tls
|
||||||
|
|
||||||
TLS configuration, see [TLS](/configuration/shared/tls/#inbound).
|
TLS configuration, see [TLS](/configuration/shared/tls/#inbound).
|
||||||
@@ -1,25 +1,20 @@
|
|||||||
!!! quote "sing-box 1.13.0 中的更改"
|
|
||||||
|
|
||||||
:material-plus: [quic_congestion_control](#quic_congestion_control)
|
|
||||||
|
|
||||||
### 结构
|
### 结构
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"type": "naive",
|
"type": "naive",
|
||||||
"tag": "naive-in",
|
"tag": "naive-in",
|
||||||
"network": "udp",
|
"network": "udp",
|
||||||
|
|
||||||
... // 监听字段
|
... // 监听字段
|
||||||
|
|
||||||
"users": [
|
"users": [
|
||||||
{
|
{
|
||||||
"username": "sekai",
|
"username": "sekai",
|
||||||
"password": "password"
|
"password": "password"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"quic_congestion_control": "",
|
"tls": {}
|
||||||
"tls": {}
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -41,23 +36,6 @@
|
|||||||
|
|
||||||
Naive 用户。
|
Naive 用户。
|
||||||
|
|
||||||
#### quic_congestion_control
|
|
||||||
|
|
||||||
!!! question "Since sing-box 1.13.0"
|
|
||||||
|
|
||||||
QUIC 拥塞控制算法。
|
|
||||||
|
|
||||||
| 算法 | 描述 |
|
|
||||||
|----------------|--------------------|
|
|
||||||
| `bbr` | BBR |
|
|
||||||
| `bbr_standard` | BBR (标准版) |
|
|
||||||
| `bbr2` | BBRv2 |
|
|
||||||
| `bbr2_variant` | BBRv2 (一种试验变体) |
|
|
||||||
| `cubic` | CUBIC |
|
|
||||||
| `reno` | New Reno |
|
|
||||||
|
|
||||||
默认使用 `bbr`(NaiveProxy 基于的 Chromium 使用的 QUICHE 的默认值)。
|
|
||||||
|
|
||||||
#### tls
|
#### tls
|
||||||
|
|
||||||
TLS 配置, 参阅 [TLS](/zh/configuration/shared/tls/#inbound)。
|
TLS 配置, 参阅 [TLS](/zh/configuration/shared/tls/#inbound)。
|
||||||
@@ -2,10 +2,6 @@
|
|||||||
icon: material/new-box
|
icon: material/new-box
|
||||||
---
|
---
|
||||||
|
|
||||||
!!! quote "Changes in sing-box 1.13.0"
|
|
||||||
|
|
||||||
:material-plus: [exclude_mptcp](#exclude_mptcp)
|
|
||||||
|
|
||||||
!!! quote "Changes in sing-box 1.12.0"
|
!!! quote "Changes in sing-box 1.12.0"
|
||||||
|
|
||||||
:material-plus: [loopback_address](#loopback_address)
|
:material-plus: [loopback_address](#loopback_address)
|
||||||
@@ -67,7 +63,6 @@ icon: material/new-box
|
|||||||
"auto_redirect": true,
|
"auto_redirect": true,
|
||||||
"auto_redirect_input_mark": "0x2023",
|
"auto_redirect_input_mark": "0x2023",
|
||||||
"auto_redirect_output_mark": "0x2024",
|
"auto_redirect_output_mark": "0x2024",
|
||||||
"exclude_mptcp": false,
|
|
||||||
"loopback_address": [
|
"loopback_address": [
|
||||||
"10.7.0.1"
|
"10.7.0.1"
|
||||||
],
|
],
|
||||||
@@ -283,20 +278,6 @@ Connection output mark used by `auto_redirect`.
|
|||||||
|
|
||||||
`0x2024` is used by default.
|
`0x2024` is used by default.
|
||||||
|
|
||||||
#### exclude_mptcp
|
|
||||||
|
|
||||||
!!! question "Since sing-box 1.13.0"
|
|
||||||
|
|
||||||
!!! quote ""
|
|
||||||
|
|
||||||
Only supported on Linux with nftables and requires `auto_route` and `auto_redirect` enabled.
|
|
||||||
|
|
||||||
MPTCP cannot be transparently proxied due to protocol limitations.
|
|
||||||
|
|
||||||
Such traffic is usually created by Apple systems.
|
|
||||||
|
|
||||||
When enabled, MPTCP connections will bypass sing-box and connect directly, otherwise, will be rejected to avoid errors by default.
|
|
||||||
|
|
||||||
#### loopback_address
|
#### loopback_address
|
||||||
|
|
||||||
!!! question "Since sing-box 1.12.0"
|
!!! question "Since sing-box 1.12.0"
|
||||||
|
|||||||
@@ -2,10 +2,6 @@
|
|||||||
icon: material/new-box
|
icon: material/new-box
|
||||||
---
|
---
|
||||||
|
|
||||||
!!! quote "sing-box 1.13.0 中的更改"
|
|
||||||
|
|
||||||
:material-plus: [exclude_mptcp](#exclude_mptcp)
|
|
||||||
|
|
||||||
!!! quote "sing-box 1.12.0 中的更改"
|
!!! quote "sing-box 1.12.0 中的更改"
|
||||||
|
|
||||||
:material-plus: [loopback_address](#loopback_address)
|
:material-plus: [loopback_address](#loopback_address)
|
||||||
@@ -67,7 +63,6 @@ icon: material/new-box
|
|||||||
"auto_redirect": true,
|
"auto_redirect": true,
|
||||||
"auto_redirect_input_mark": "0x2023",
|
"auto_redirect_input_mark": "0x2023",
|
||||||
"auto_redirect_output_mark": "0x2024",
|
"auto_redirect_output_mark": "0x2024",
|
||||||
"exclude_mptcp": false,
|
|
||||||
"loopback_address": [
|
"loopback_address": [
|
||||||
"10.7.0.1"
|
"10.7.0.1"
|
||||||
],
|
],
|
||||||
@@ -282,20 +277,6 @@ tun 接口的 IPv6 前缀。
|
|||||||
|
|
||||||
默认使用 `0x2024`。
|
默认使用 `0x2024`。
|
||||||
|
|
||||||
#### exclude_mptcp
|
|
||||||
|
|
||||||
!!! question "自 sing-box 1.13.0 起"
|
|
||||||
|
|
||||||
!!! quote ""
|
|
||||||
|
|
||||||
仅支持 Linux,且需要 nftables,`auto_route` 和 `auto_redirect` 已启用。
|
|
||||||
|
|
||||||
由于协议限制,MPTCP 无法被透明代理。
|
|
||||||
|
|
||||||
此类流量通常由 Apple 系统创建。
|
|
||||||
|
|
||||||
启用时,MPTCP 连接将绕过 sing-box 直接连接,否则,将被拒绝以避免错误。
|
|
||||||
|
|
||||||
#### loopback_address
|
#### loopback_address
|
||||||
|
|
||||||
!!! question "自 sing-box 1.12.0 起"
|
!!! question "自 sing-box 1.12.0 起"
|
||||||
|
|||||||
@@ -36,7 +36,6 @@
|
|||||||
| `dns` | [DNS](./dns/) |
|
| `dns` | [DNS](./dns/) |
|
||||||
| `selector` | [Selector](./selector/) |
|
| `selector` | [Selector](./selector/) |
|
||||||
| `urltest` | [URLTest](./urltest/) |
|
| `urltest` | [URLTest](./urltest/) |
|
||||||
| `naive` | [NaiveProxy](./naive/) |
|
|
||||||
|
|
||||||
#### tag
|
#### tag
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,6 @@
|
|||||||
| `dns` | [DNS](./dns/) |
|
| `dns` | [DNS](./dns/) |
|
||||||
| `selector` | [Selector](./selector/) |
|
| `selector` | [Selector](./selector/) |
|
||||||
| `urltest` | [URLTest](./urltest/) |
|
| `urltest` | [URLTest](./urltest/) |
|
||||||
| `naive` | [NaiveProxy](./naive/) |
|
|
||||||
|
|
||||||
#### tag
|
#### tag
|
||||||
|
|
||||||
|
|||||||
@@ -1,114 +0,0 @@
|
|||||||
---
|
|
||||||
icon: material/new-box
|
|
||||||
---
|
|
||||||
|
|
||||||
!!! question "Since sing-box 1.13.0"
|
|
||||||
|
|
||||||
### Structure
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"type": "naive",
|
|
||||||
"tag": "naive-out",
|
|
||||||
|
|
||||||
"server": "127.0.0.1",
|
|
||||||
"server_port": 443,
|
|
||||||
"username": "sekai",
|
|
||||||
"password": "password",
|
|
||||||
"insecure_concurrency": 0,
|
|
||||||
"extra_headers": {},
|
|
||||||
"udp_over_tcp": false | {},
|
|
||||||
"quic": false,
|
|
||||||
"quic_congestion_control": "",
|
|
||||||
"tls": {},
|
|
||||||
|
|
||||||
... // Dial Fields
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
!!! warning "Platform Support"
|
|
||||||
|
|
||||||
NaiveProxy outbound is only available on Apple platforms, Android, Windows and certain Linux builds.
|
|
||||||
|
|
||||||
**Official Release Build Variants:**
|
|
||||||
|
|
||||||
| Build Variant | Platforms | Description |
|
|
||||||
|---------------|-----------|-------------|
|
|
||||||
| (default) | Linux amd64/arm64 | purego build with `libcronet.so` included |
|
|
||||||
| `-glibc` | Linux 386/amd64/arm/arm64 | CGO build dynamically linked with glibc, requires glibc >= 2.31 |
|
|
||||||
| `-musl` | Linux 386/amd64/arm/arm64 | CGO build statically linked with musl, no system requirements |
|
|
||||||
| (default) | Windows amd64/arm64 | purego build with `libcronet.dll` included |
|
|
||||||
|
|
||||||
**Runtime Requirements:**
|
|
||||||
|
|
||||||
- **Linux purego**: `libcronet.so` must be in the same directory as the sing-box binary or in system library path
|
|
||||||
- **Windows**: `libcronet.dll` must be in the same directory as `sing-box.exe` or in a directory listed in `PATH`
|
|
||||||
|
|
||||||
For self-built binaries, see [Build from source](/installation/build-from-source/#with_naive_outbound).
|
|
||||||
|
|
||||||
### Fields
|
|
||||||
|
|
||||||
#### server
|
|
||||||
|
|
||||||
==Required==
|
|
||||||
|
|
||||||
The server address.
|
|
||||||
|
|
||||||
#### server_port
|
|
||||||
|
|
||||||
==Required==
|
|
||||||
|
|
||||||
The server port.
|
|
||||||
|
|
||||||
#### username
|
|
||||||
|
|
||||||
Authentication username.
|
|
||||||
|
|
||||||
#### password
|
|
||||||
|
|
||||||
Authentication password.
|
|
||||||
|
|
||||||
#### insecure_concurrency
|
|
||||||
|
|
||||||
Number of concurrent tunnel connections. Multiple connections make the tunneling easier to detect through traffic analysis, which defeats the purpose of NaiveProxy's design to resist traffic analysis.
|
|
||||||
|
|
||||||
#### extra_headers
|
|
||||||
|
|
||||||
Extra headers to send in HTTP requests.
|
|
||||||
|
|
||||||
#### udp_over_tcp
|
|
||||||
|
|
||||||
UDP over TCP protocol settings.
|
|
||||||
|
|
||||||
See [UDP Over TCP](/configuration/shared/udp-over-tcp/) for details.
|
|
||||||
|
|
||||||
#### quic
|
|
||||||
|
|
||||||
Use QUIC instead of HTTP/2.
|
|
||||||
|
|
||||||
#### quic_congestion_control
|
|
||||||
|
|
||||||
QUIC congestion control algorithm.
|
|
||||||
|
|
||||||
| Algorithm | Description |
|
|
||||||
|-----------|-------------|
|
|
||||||
| `bbr` | BBR |
|
|
||||||
| `bbr2` | BBRv2 |
|
|
||||||
| `cubic` | CUBIC |
|
|
||||||
| `reno` | New Reno |
|
|
||||||
|
|
||||||
`bbr` is used by default (the default of QUICHE, used by Chromium which NaiveProxy is based on).
|
|
||||||
|
|
||||||
#### tls
|
|
||||||
|
|
||||||
==Required==
|
|
||||||
|
|
||||||
TLS configuration, see [TLS](/configuration/shared/tls/#outbound).
|
|
||||||
|
|
||||||
Only `server_name`, `certificate`, `certificate_path` and `ech` are supported.
|
|
||||||
|
|
||||||
Self-signed certificates change traffic behavior significantly, which defeats the purpose of NaiveProxy's design to resist traffic analysis, and should not be used in production.
|
|
||||||
|
|
||||||
### Dial Fields
|
|
||||||
|
|
||||||
See [Dial Fields](/configuration/shared/dial/) for details.
|
|
||||||
@@ -1,114 +0,0 @@
|
|||||||
---
|
|
||||||
icon: material/new-box
|
|
||||||
---
|
|
||||||
|
|
||||||
!!! question "自 sing-box 1.13.0 起"
|
|
||||||
|
|
||||||
### 结构
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"type": "naive",
|
|
||||||
"tag": "naive-out",
|
|
||||||
|
|
||||||
"server": "127.0.0.1",
|
|
||||||
"server_port": 443,
|
|
||||||
"username": "sekai",
|
|
||||||
"password": "password",
|
|
||||||
"insecure_concurrency": 0,
|
|
||||||
"extra_headers": {},
|
|
||||||
"udp_over_tcp": false | {},
|
|
||||||
"quic": false,
|
|
||||||
"quic_congestion_control": "",
|
|
||||||
"tls": {},
|
|
||||||
|
|
||||||
... // 拨号字段
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
!!! warning "平台支持"
|
|
||||||
|
|
||||||
NaiveProxy 出站仅在 Apple 平台、Android、Windows 和特定 Linux 构建上可用。
|
|
||||||
|
|
||||||
**官方发布版本区别:**
|
|
||||||
|
|
||||||
| 构建变体 | 平台 | 说明 |
|
|
||||||
|-----------|------------------------|------------------------------------------|
|
|
||||||
| (默认) | Linux amd64/arm64 | purego 构建,包含 `libcronet.so` |
|
|
||||||
| `-glibc` | Linux 386/amd64/arm/arm64 | CGO 构建,动态链接 glibc,要求 glibc >= 2.31 |
|
|
||||||
| `-musl` | Linux 386/amd64/arm/arm64 | CGO 构建,静态链接 musl,无系统要求 |
|
|
||||||
| (默认) | Windows amd64/arm64 | purego 构建,包含 `libcronet.dll` |
|
|
||||||
|
|
||||||
**运行时要求:**
|
|
||||||
|
|
||||||
- **Linux purego**:`libcronet.so` 必须位于 sing-box 二进制文件相同目录或系统库路径中
|
|
||||||
- **Windows**:`libcronet.dll` 必须位于 `sing-box.exe` 相同目录或 `PATH` 中的任意目录
|
|
||||||
|
|
||||||
自行构建请参阅 [从源代码构建](/zh/installation/build-from-source/#with_naive_outbound)。
|
|
||||||
|
|
||||||
### 字段
|
|
||||||
|
|
||||||
#### server
|
|
||||||
|
|
||||||
==必填==
|
|
||||||
|
|
||||||
服务器地址。
|
|
||||||
|
|
||||||
#### server_port
|
|
||||||
|
|
||||||
==必填==
|
|
||||||
|
|
||||||
服务器端口。
|
|
||||||
|
|
||||||
#### username
|
|
||||||
|
|
||||||
认证用户名。
|
|
||||||
|
|
||||||
#### password
|
|
||||||
|
|
||||||
认证密码。
|
|
||||||
|
|
||||||
#### insecure_concurrency
|
|
||||||
|
|
||||||
并发隧道连接数。多连接使隧道更容易被流量分析检测,违背 NaiveProxy 抵抗流量分析的设计目的。
|
|
||||||
|
|
||||||
#### extra_headers
|
|
||||||
|
|
||||||
HTTP 请求中发送的额外头部。
|
|
||||||
|
|
||||||
#### udp_over_tcp
|
|
||||||
|
|
||||||
UDP over TCP 配置。
|
|
||||||
|
|
||||||
参阅 [UDP Over TCP](/zh/configuration/shared/udp-over-tcp/)。
|
|
||||||
|
|
||||||
#### quic
|
|
||||||
|
|
||||||
使用 QUIC 代替 HTTP/2。
|
|
||||||
|
|
||||||
#### quic_congestion_control
|
|
||||||
|
|
||||||
QUIC 拥塞控制算法。
|
|
||||||
|
|
||||||
| 算法 | 描述 |
|
|
||||||
|------|------|
|
|
||||||
| `bbr` | BBR |
|
|
||||||
| `bbr2` | BBRv2 |
|
|
||||||
| `cubic` | CUBIC |
|
|
||||||
| `reno` | New Reno |
|
|
||||||
|
|
||||||
默认使用 `bbr`(NaiveProxy 基于的 Chromium 使用的 QUICHE 的默认值)。
|
|
||||||
|
|
||||||
#### tls
|
|
||||||
|
|
||||||
==必填==
|
|
||||||
|
|
||||||
TLS 配置, 参阅 [TLS](/zh/configuration/shared/tls/#outbound)。
|
|
||||||
|
|
||||||
只有 `server_name`、`certificate`、`certificate_path` 和 `ech` 是被支持的。
|
|
||||||
|
|
||||||
自签名证书会显著改变流量行为,违背了 NaiveProxy 旨在抵抗流量分析的设计初衷,不应该在生产环境中使用。
|
|
||||||
|
|
||||||
### 拨号字段
|
|
||||||
|
|
||||||
参阅 [拨号字段](/zh/configuration/shared/dial/)。
|
|
||||||
@@ -430,7 +430,7 @@ Match default interface address.
|
|||||||
|
|
||||||
!!! quote ""
|
!!! quote ""
|
||||||
|
|
||||||
Only supported in graphical clients on Android and Apple platforms, or on Linux.
|
Only supported in graphical clients on Android and Apple platforms.
|
||||||
|
|
||||||
Match WiFi SSID.
|
Match WiFi SSID.
|
||||||
|
|
||||||
@@ -438,7 +438,7 @@ Match WiFi SSID.
|
|||||||
|
|
||||||
!!! quote ""
|
!!! quote ""
|
||||||
|
|
||||||
Only supported in graphical clients on Android and Apple platforms, or on Linux.
|
Only supported in graphical clients on Android and Apple platforms.
|
||||||
|
|
||||||
Match WiFi BSSID.
|
Match WiFi BSSID.
|
||||||
|
|
||||||
|
|||||||
@@ -427,7 +427,7 @@ icon: material/new-box
|
|||||||
|
|
||||||
!!! quote ""
|
!!! quote ""
|
||||||
|
|
||||||
仅在 Android 与 Apple 平台图形客户端和 Linux 中支持。
|
仅在 Android 与 Apple 平台图形客户端中支持。
|
||||||
|
|
||||||
匹配 WiFi SSID。
|
匹配 WiFi SSID。
|
||||||
|
|
||||||
@@ -435,7 +435,7 @@ icon: material/new-box
|
|||||||
|
|
||||||
!!! quote ""
|
!!! quote ""
|
||||||
|
|
||||||
仅在 Android 与 Apple 平台图形客户端和 Linux 中支持。
|
仅在 Android 与 Apple 平台图形客户端中支持。
|
||||||
|
|
||||||
匹配 WiFi BSSID。
|
匹配 WiFi BSSID。
|
||||||
|
|
||||||
|
|||||||
@@ -1,106 +0,0 @@
|
|||||||
---
|
|
||||||
icon: material/new-box
|
|
||||||
---
|
|
||||||
|
|
||||||
!!! question "Since sing-box 1.13.0"
|
|
||||||
|
|
||||||
# CCM
|
|
||||||
|
|
||||||
CCM (Claude Code Multiplexer) service is a multiplexing service that allows you to access your local Claude Code subscription remotely through custom tokens.
|
|
||||||
|
|
||||||
It handles OAuth authentication with Claude's API on your local machine while allowing remote Claude Code to authenticate using Auth Tokens via the `ANTHROPIC_AUTH_TOKEN` environment variable.
|
|
||||||
|
|
||||||
### Structure
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"type": "ccm",
|
|
||||||
|
|
||||||
... // Listen Fields
|
|
||||||
|
|
||||||
"credential_path": "",
|
|
||||||
"usages_path": "",
|
|
||||||
"users": [],
|
|
||||||
"headers": {},
|
|
||||||
"detour": "",
|
|
||||||
"tls": {}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Listen Fields
|
|
||||||
|
|
||||||
See [Listen Fields](/configuration/shared/listen/) for details.
|
|
||||||
|
|
||||||
### Fields
|
|
||||||
|
|
||||||
#### credential_path
|
|
||||||
|
|
||||||
Path to the Claude Code OAuth credentials file.
|
|
||||||
|
|
||||||
If not specified, defaults to:
|
|
||||||
- `$CLAUDE_CONFIG_DIR/.credentials.json` if `CLAUDE_CONFIG_DIR` environment variable is set
|
|
||||||
- `~/.claude/.credentials.json` otherwise
|
|
||||||
|
|
||||||
On macOS, credentials are read from the system keychain first, then fall back to the file if unavailable.
|
|
||||||
|
|
||||||
Refreshed tokens are automatically written back to the same location.
|
|
||||||
|
|
||||||
#### usages_path
|
|
||||||
|
|
||||||
Path to the file for storing aggregated API usage statistics.
|
|
||||||
|
|
||||||
Usage tracking is disabled if not specified.
|
|
||||||
|
|
||||||
When enabled, the service tracks and saves comprehensive statistics including:
|
|
||||||
- Request counts
|
|
||||||
- Token usage (input, output, cache read, cache creation)
|
|
||||||
- Calculated costs in USD based on Claude API pricing
|
|
||||||
|
|
||||||
Statistics are organized by model, context window (200k standard vs 1M premium), and optionally by user when authentication is enabled.
|
|
||||||
|
|
||||||
The statistics file is automatically saved every minute and upon service shutdown.
|
|
||||||
|
|
||||||
#### users
|
|
||||||
|
|
||||||
List of authorized users for token authentication.
|
|
||||||
|
|
||||||
If empty, no authentication is required.
|
|
||||||
|
|
||||||
Claude Code authenticates by setting the `ANTHROPIC_AUTH_TOKEN` environment variable to their token value.
|
|
||||||
|
|
||||||
#### headers
|
|
||||||
|
|
||||||
Custom HTTP headers to send to the Claude API.
|
|
||||||
|
|
||||||
These headers will override any existing headers with the same name.
|
|
||||||
|
|
||||||
#### detour
|
|
||||||
|
|
||||||
Outbound tag for connecting to the Claude API.
|
|
||||||
|
|
||||||
#### tls
|
|
||||||
|
|
||||||
TLS configuration, see [TLS](/configuration/shared/tls/#inbound).
|
|
||||||
|
|
||||||
### Example
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"services": [
|
|
||||||
{
|
|
||||||
"type": "ccm",
|
|
||||||
"listen": "127.0.0.1",
|
|
||||||
"listen_port": 8080
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
Connect to the CCM service:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
export ANTHROPIC_BASE_URL="http://127.0.0.1:8080"
|
|
||||||
export ANTHROPIC_AUTH_TOKEN="sk-ant-ccm-auth-token-not-required-in-this-context"
|
|
||||||
|
|
||||||
claude
|
|
||||||
```
|
|
||||||
@@ -1,106 +0,0 @@
|
|||||||
---
|
|
||||||
icon: material/new-box
|
|
||||||
---
|
|
||||||
|
|
||||||
!!! question "自 sing-box 1.13.0 起"
|
|
||||||
|
|
||||||
# CCM
|
|
||||||
|
|
||||||
CCM(Claude Code 多路复用器)服务是一个多路复用服务,允许您通过自定义令牌远程访问本地的 Claude Code 订阅。
|
|
||||||
|
|
||||||
它在本地机器上处理与 Claude API 的 OAuth 身份验证,同时允许远程 Claude Code 通过 `ANTHROPIC_AUTH_TOKEN` 环境变量使用认证令牌进行身份验证。
|
|
||||||
|
|
||||||
### 结构
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"type": "ccm",
|
|
||||||
|
|
||||||
... // 监听字段
|
|
||||||
|
|
||||||
"credential_path": "",
|
|
||||||
"usages_path": "",
|
|
||||||
"users": [],
|
|
||||||
"headers": {},
|
|
||||||
"detour": "",
|
|
||||||
"tls": {}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### 监听字段
|
|
||||||
|
|
||||||
参阅 [监听字段](/zh/configuration/shared/listen/) 了解详情。
|
|
||||||
|
|
||||||
### 字段
|
|
||||||
|
|
||||||
#### credential_path
|
|
||||||
|
|
||||||
Claude Code OAuth 凭据文件的路径。
|
|
||||||
|
|
||||||
如果未指定,默认值为:
|
|
||||||
- 如果设置了 `CLAUDE_CONFIG_DIR` 环境变量,则使用 `$CLAUDE_CONFIG_DIR/.credentials.json`
|
|
||||||
- 否则使用 `~/.claude/.credentials.json`
|
|
||||||
|
|
||||||
在 macOS 上,首先从系统钥匙串读取凭据,如果不可用则回退到文件。
|
|
||||||
|
|
||||||
刷新的令牌会自动写回相同位置。
|
|
||||||
|
|
||||||
#### usages_path
|
|
||||||
|
|
||||||
用于存储聚合 API 使用统计信息的文件路径。
|
|
||||||
|
|
||||||
如果未指定,使用跟踪将被禁用。
|
|
||||||
|
|
||||||
启用后,服务会跟踪并保存全面的统计信息,包括:
|
|
||||||
- 请求计数
|
|
||||||
- 令牌使用量(输入、输出、缓存读取、缓存创建)
|
|
||||||
- 基于 Claude API 定价计算的美元成本
|
|
||||||
|
|
||||||
统计信息按模型、上下文窗口(200k 标准版 vs 1M 高级版)以及可选的用户(启用身份验证时)进行组织。
|
|
||||||
|
|
||||||
统计文件每分钟自动保存一次,并在服务关闭时保存。
|
|
||||||
|
|
||||||
#### users
|
|
||||||
|
|
||||||
用于令牌身份验证的授权用户列表。
|
|
||||||
|
|
||||||
如果为空,则不需要身份验证。
|
|
||||||
|
|
||||||
Claude Code 通过设置 `ANTHROPIC_AUTH_TOKEN` 环境变量为其令牌值进行身份验证。
|
|
||||||
|
|
||||||
#### headers
|
|
||||||
|
|
||||||
发送到 Claude API 的自定义 HTTP 头。
|
|
||||||
|
|
||||||
这些头会覆盖同名的现有头。
|
|
||||||
|
|
||||||
#### detour
|
|
||||||
|
|
||||||
用于连接 Claude API 的出站标签。
|
|
||||||
|
|
||||||
#### tls
|
|
||||||
|
|
||||||
TLS 配置,参阅 [TLS](/zh/configuration/shared/tls/#inbound)。
|
|
||||||
|
|
||||||
### 示例
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"services": [
|
|
||||||
{
|
|
||||||
"type": "ccm",
|
|
||||||
"listen": "127.0.0.1",
|
|
||||||
"listen_port": 8080
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
连接到 CCM 服务:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
export ANTHROPIC_BASE_URL="http://127.0.0.1:8080"
|
|
||||||
export ANTHROPIC_AUTH_TOKEN="sk-ant-ccm-auth-token-not-required-in-this-context"
|
|
||||||
|
|
||||||
claude
|
|
||||||
```
|
|
||||||
@@ -23,9 +23,7 @@ icon: material/new-box
|
|||||||
|
|
||||||
| Type | Format |
|
| Type | Format |
|
||||||
|------------|------------------------|
|
|------------|------------------------|
|
||||||
| `ccm` | [CCM](./ccm) |
|
|
||||||
| `derp` | [DERP](./derp) |
|
| `derp` | [DERP](./derp) |
|
||||||
| `ocm` | [OCM](./ocm) |
|
|
||||||
| `resolved` | [Resolved](./resolved) |
|
| `resolved` | [Resolved](./resolved) |
|
||||||
| `ssm-api` | [SSM API](./ssm-api) |
|
| `ssm-api` | [SSM API](./ssm-api) |
|
||||||
|
|
||||||
|
|||||||
@@ -23,9 +23,7 @@ icon: material/new-box
|
|||||||
|
|
||||||
| 类型 | 格式 |
|
| 类型 | 格式 |
|
||||||
|-----------|------------------------|
|
|-----------|------------------------|
|
||||||
| `ccm` | [CCM](./ccm) |
|
|
||||||
| `derp` | [DERP](./derp) |
|
| `derp` | [DERP](./derp) |
|
||||||
| `ocm` | [OCM](./ocm) |
|
|
||||||
| `resolved`| [Resolved](./resolved) |
|
| `resolved`| [Resolved](./resolved) |
|
||||||
| `ssm-api` | [SSM API](./ssm-api) |
|
| `ssm-api` | [SSM API](./ssm-api) |
|
||||||
|
|
||||||
|
|||||||
@@ -1,171 +0,0 @@
|
|||||||
---
|
|
||||||
icon: material/new-box
|
|
||||||
---
|
|
||||||
|
|
||||||
!!! question "Since sing-box 1.13.0"
|
|
||||||
|
|
||||||
# OCM
|
|
||||||
|
|
||||||
OCM (OpenAI Codex Multiplexer) service is a multiplexing service that allows you to access your local OpenAI Codex subscription remotely through custom tokens.
|
|
||||||
|
|
||||||
It handles OAuth authentication with OpenAI's API on your local machine while allowing remote clients to authenticate using custom tokens.
|
|
||||||
|
|
||||||
### Structure
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"type": "ocm",
|
|
||||||
|
|
||||||
... // Listen Fields
|
|
||||||
|
|
||||||
"credential_path": "",
|
|
||||||
"usages_path": "",
|
|
||||||
"users": [],
|
|
||||||
"headers": {},
|
|
||||||
"detour": "",
|
|
||||||
"tls": {}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Listen Fields
|
|
||||||
|
|
||||||
See [Listen Fields](/configuration/shared/listen/) for details.
|
|
||||||
|
|
||||||
### Fields
|
|
||||||
|
|
||||||
#### credential_path
|
|
||||||
|
|
||||||
Path to the OpenAI OAuth credentials file.
|
|
||||||
|
|
||||||
If not specified, defaults to `~/.codex/auth.json`.
|
|
||||||
|
|
||||||
Refreshed tokens are automatically written back to the same location.
|
|
||||||
|
|
||||||
#### usages_path
|
|
||||||
|
|
||||||
Path to the file for storing aggregated API usage statistics.
|
|
||||||
|
|
||||||
Usage tracking is disabled if not specified.
|
|
||||||
|
|
||||||
When enabled, the service tracks and saves comprehensive statistics including:
|
|
||||||
- Request counts
|
|
||||||
- Token usage (input, output, cached)
|
|
||||||
- Calculated costs in USD based on OpenAI API pricing
|
|
||||||
|
|
||||||
Statistics are organized by model and optionally by user when authentication is enabled.
|
|
||||||
|
|
||||||
The statistics file is automatically saved every minute and upon service shutdown.
|
|
||||||
|
|
||||||
#### users
|
|
||||||
|
|
||||||
List of authorized users for token authentication.
|
|
||||||
|
|
||||||
If empty, no authentication is required.
|
|
||||||
|
|
||||||
Object format:
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"name": "",
|
|
||||||
"token": ""
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
Object fields:
|
|
||||||
|
|
||||||
- `name`: Username identifier for tracking purposes.
|
|
||||||
- `token`: Bearer token for authentication. Clients authenticate by setting the `Authorization: Bearer <token>` header.
|
|
||||||
|
|
||||||
#### headers
|
|
||||||
|
|
||||||
Custom HTTP headers to send to the OpenAI API.
|
|
||||||
|
|
||||||
These headers will override any existing headers with the same name.
|
|
||||||
|
|
||||||
#### detour
|
|
||||||
|
|
||||||
Outbound tag for connecting to the OpenAI API.
|
|
||||||
|
|
||||||
#### tls
|
|
||||||
|
|
||||||
TLS configuration, see [TLS](/configuration/shared/tls/#inbound).
|
|
||||||
|
|
||||||
### Example
|
|
||||||
|
|
||||||
#### Server
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"services": [
|
|
||||||
{
|
|
||||||
"type": "ocm",
|
|
||||||
"listen": "127.0.0.1",
|
|
||||||
"listen_port": 8080
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Client
|
|
||||||
|
|
||||||
Add to `~/.codex/config.toml`:
|
|
||||||
|
|
||||||
```toml
|
|
||||||
[model_providers.ocm]
|
|
||||||
name = "OCM Proxy"
|
|
||||||
base_url = "http://127.0.0.1:8080/v1"
|
|
||||||
wire_api = "responses"
|
|
||||||
requires_openai_auth = false
|
|
||||||
```
|
|
||||||
|
|
||||||
Then run:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
codex --model-provider ocm
|
|
||||||
```
|
|
||||||
|
|
||||||
### Example with Authentication
|
|
||||||
|
|
||||||
#### Server
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"services": [
|
|
||||||
{
|
|
||||||
"type": "ocm",
|
|
||||||
"listen": "0.0.0.0",
|
|
||||||
"listen_port": 8080,
|
|
||||||
"usages_path": "./codex-usages.json",
|
|
||||||
"users": [
|
|
||||||
{
|
|
||||||
"name": "alice",
|
|
||||||
"token": "sk-alice-secret-token"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "bob",
|
|
||||||
"token": "sk-bob-secret-token"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Client
|
|
||||||
|
|
||||||
Add to `~/.codex/config.toml`:
|
|
||||||
|
|
||||||
```toml
|
|
||||||
[model_providers.ocm]
|
|
||||||
name = "OCM Proxy"
|
|
||||||
base_url = "http://127.0.0.1:8080/v1"
|
|
||||||
wire_api = "responses"
|
|
||||||
requires_openai_auth = false
|
|
||||||
experimental_bearer_token = "sk-alice-secret-token"
|
|
||||||
```
|
|
||||||
|
|
||||||
Then run:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
codex --model-provider ocm
|
|
||||||
```
|
|
||||||
@@ -1,171 +0,0 @@
|
|||||||
---
|
|
||||||
icon: material/new-box
|
|
||||||
---
|
|
||||||
|
|
||||||
!!! question "自 sing-box 1.13.0 起"
|
|
||||||
|
|
||||||
# OCM
|
|
||||||
|
|
||||||
OCM(OpenAI Codex 多路复用器)服务是一个多路复用服务,允许您通过自定义令牌远程访问本地的 OpenAI Codex 订阅。
|
|
||||||
|
|
||||||
它在本地机器上处理与 OpenAI API 的 OAuth 身份验证,同时允许远程客户端使用自定义令牌进行身份验证。
|
|
||||||
|
|
||||||
### 结构
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"type": "ocm",
|
|
||||||
|
|
||||||
... // 监听字段
|
|
||||||
|
|
||||||
"credential_path": "",
|
|
||||||
"usages_path": "",
|
|
||||||
"users": [],
|
|
||||||
"headers": {},
|
|
||||||
"detour": "",
|
|
||||||
"tls": {}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### 监听字段
|
|
||||||
|
|
||||||
参阅 [监听字段](/zh/configuration/shared/listen/) 了解详情。
|
|
||||||
|
|
||||||
### 字段
|
|
||||||
|
|
||||||
#### credential_path
|
|
||||||
|
|
||||||
OpenAI OAuth 凭据文件的路径。
|
|
||||||
|
|
||||||
如果未指定,默认值为 `~/.codex/auth.json`。
|
|
||||||
|
|
||||||
刷新的令牌会自动写回相同位置。
|
|
||||||
|
|
||||||
#### usages_path
|
|
||||||
|
|
||||||
用于存储聚合 API 使用统计信息的文件路径。
|
|
||||||
|
|
||||||
如果未指定,使用跟踪将被禁用。
|
|
||||||
|
|
||||||
启用后,服务会跟踪并保存全面的统计信息,包括:
|
|
||||||
- 请求计数
|
|
||||||
- 令牌使用量(输入、输出、缓存)
|
|
||||||
- 基于 OpenAI API 定价计算的美元成本
|
|
||||||
|
|
||||||
统计信息按模型以及可选的用户(启用身份验证时)进行组织。
|
|
||||||
|
|
||||||
统计文件每分钟自动保存一次,并在服务关闭时保存。
|
|
||||||
|
|
||||||
#### users
|
|
||||||
|
|
||||||
用于令牌身份验证的授权用户列表。
|
|
||||||
|
|
||||||
如果为空,则不需要身份验证。
|
|
||||||
|
|
||||||
对象格式:
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"name": "",
|
|
||||||
"token": ""
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
对象字段:
|
|
||||||
|
|
||||||
- `name`:用于跟踪的用户名标识符。
|
|
||||||
- `token`:用于身份验证的 Bearer 令牌。客户端通过设置 `Authorization: Bearer <token>` 头进行身份验证。
|
|
||||||
|
|
||||||
#### headers
|
|
||||||
|
|
||||||
发送到 OpenAI API 的自定义 HTTP 头。
|
|
||||||
|
|
||||||
这些头会覆盖同名的现有头。
|
|
||||||
|
|
||||||
#### detour
|
|
||||||
|
|
||||||
用于连接 OpenAI API 的出站标签。
|
|
||||||
|
|
||||||
#### tls
|
|
||||||
|
|
||||||
TLS 配置,参阅 [TLS](/zh/configuration/shared/tls/#inbound)。
|
|
||||||
|
|
||||||
### 示例
|
|
||||||
|
|
||||||
#### 服务端
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"services": [
|
|
||||||
{
|
|
||||||
"type": "ocm",
|
|
||||||
"listen": "127.0.0.1",
|
|
||||||
"listen_port": 8080
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
#### 客户端
|
|
||||||
|
|
||||||
在 `~/.codex/config.toml` 中添加:
|
|
||||||
|
|
||||||
```toml
|
|
||||||
[model_providers.ocm]
|
|
||||||
name = "OCM Proxy"
|
|
||||||
base_url = "http://127.0.0.1:8080/v1"
|
|
||||||
wire_api = "responses"
|
|
||||||
requires_openai_auth = false
|
|
||||||
```
|
|
||||||
|
|
||||||
然后运行:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
codex --model-provider ocm
|
|
||||||
```
|
|
||||||
|
|
||||||
### 带身份验证的示例
|
|
||||||
|
|
||||||
#### 服务端
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"services": [
|
|
||||||
{
|
|
||||||
"type": "ocm",
|
|
||||||
"listen": "0.0.0.0",
|
|
||||||
"listen_port": 8080,
|
|
||||||
"usages_path": "./codex-usages.json",
|
|
||||||
"users": [
|
|
||||||
{
|
|
||||||
"name": "alice",
|
|
||||||
"token": "sk-alice-secret-token"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "bob",
|
|
||||||
"token": "sk-bob-secret-token"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
#### 客户端
|
|
||||||
|
|
||||||
在 `~/.codex/config.toml` 中添加:
|
|
||||||
|
|
||||||
```toml
|
|
||||||
[model_providers.ocm]
|
|
||||||
name = "OCM Proxy"
|
|
||||||
base_url = "http://127.0.0.1:8080/v1"
|
|
||||||
wire_api = "responses"
|
|
||||||
requires_openai_auth = false
|
|
||||||
experimental_bearer_token = "sk-alice-secret-token"
|
|
||||||
```
|
|
||||||
|
|
||||||
然后运行:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
codex --model-provider ocm
|
|
||||||
```
|
|
||||||
@@ -2,12 +2,6 @@
|
|||||||
icon: material/new-box
|
icon: material/new-box
|
||||||
---
|
---
|
||||||
|
|
||||||
!!! quote "Changes in sing-box 1.13.0"
|
|
||||||
|
|
||||||
:material-plus: [disable_tcp_keep_alive](#disable_tcp_keep_alive)
|
|
||||||
:material-plus: [tcp_keep_alive](#tcp_keep_alive)
|
|
||||||
:material-plus: [tcp_keep_alive_interval](#tcp_keep_alive_interval)
|
|
||||||
|
|
||||||
!!! quote "Changes in sing-box 1.12.0"
|
!!! quote "Changes in sing-box 1.12.0"
|
||||||
|
|
||||||
:material-plus: [domain_resolver](#domain_resolver)
|
:material-plus: [domain_resolver](#domain_resolver)
|
||||||
@@ -35,9 +29,6 @@ icon: material/new-box
|
|||||||
"connect_timeout": "",
|
"connect_timeout": "",
|
||||||
"tcp_fast_open": false,
|
"tcp_fast_open": false,
|
||||||
"tcp_multi_path": false,
|
"tcp_multi_path": false,
|
||||||
"disable_tcp_keep_alive": false,
|
|
||||||
"tcp_keep_alive": "",
|
|
||||||
"tcp_keep_alive_interval": "",
|
|
||||||
"udp_fragment": false,
|
"udp_fragment": false,
|
||||||
|
|
||||||
"domain_resolver": "", // or {}
|
"domain_resolver": "", // or {}
|
||||||
@@ -121,30 +112,6 @@ Enable TCP Fast Open.
|
|||||||
|
|
||||||
Enable TCP Multi Path.
|
Enable TCP Multi Path.
|
||||||
|
|
||||||
#### disable_tcp_keep_alive
|
|
||||||
|
|
||||||
!!! question "Since sing-box 1.13.0"
|
|
||||||
|
|
||||||
Disable TCP keep alive.
|
|
||||||
|
|
||||||
#### tcp_keep_alive
|
|
||||||
|
|
||||||
!!! question "Since sing-box 1.13.0"
|
|
||||||
|
|
||||||
Default value changed from `10m` to `5m`.
|
|
||||||
|
|
||||||
TCP keep-alive initial period.
|
|
||||||
|
|
||||||
`5m` will be used by default.
|
|
||||||
|
|
||||||
#### tcp_keep_alive_interval
|
|
||||||
|
|
||||||
!!! question "Since sing-box 1.13.0"
|
|
||||||
|
|
||||||
TCP keep-alive interval.
|
|
||||||
|
|
||||||
`75s` will be used by default.
|
|
||||||
|
|
||||||
#### udp_fragment
|
#### udp_fragment
|
||||||
|
|
||||||
Enable UDP fragmentation.
|
Enable UDP fragmentation.
|
||||||
|
|||||||
@@ -2,12 +2,6 @@
|
|||||||
icon: material/new-box
|
icon: material/new-box
|
||||||
---
|
---
|
||||||
|
|
||||||
!!! quote "sing-box 1.13.0 中的更改"
|
|
||||||
|
|
||||||
:material-plus: [disable_tcp_keep_alive](#disable_tcp_keep_alive)
|
|
||||||
:material-plus: [tcp_keep_alive](#tcp_keep_alive)
|
|
||||||
:material-plus: [tcp_keep_alive_interval](#tcp_keep_alive_interval)
|
|
||||||
|
|
||||||
!!! quote "sing-box 1.12.0 中的更改"
|
!!! quote "sing-box 1.12.0 中的更改"
|
||||||
|
|
||||||
:material-plus: [domain_resolver](#domain_resolver)
|
:material-plus: [domain_resolver](#domain_resolver)
|
||||||
@@ -35,11 +29,7 @@ icon: material/new-box
|
|||||||
"connect_timeout": "",
|
"connect_timeout": "",
|
||||||
"tcp_fast_open": false,
|
"tcp_fast_open": false,
|
||||||
"tcp_multi_path": false,
|
"tcp_multi_path": false,
|
||||||
"disable_tcp_keep_alive": false,
|
|
||||||
"tcp_keep_alive": "",
|
|
||||||
"tcp_keep_alive_interval": "",
|
|
||||||
"udp_fragment": false,
|
"udp_fragment": false,
|
||||||
|
|
||||||
"domain_resolver": "", // 或 {}
|
"domain_resolver": "", // 或 {}
|
||||||
"network_strategy": "",
|
"network_strategy": "",
|
||||||
"network_type": [],
|
"network_type": [],
|
||||||
@@ -119,30 +109,6 @@ icon: material/new-box
|
|||||||
|
|
||||||
启用 TCP Multi Path。
|
启用 TCP Multi Path。
|
||||||
|
|
||||||
#### disable_tcp_keep_alive
|
|
||||||
|
|
||||||
!!! question "自 sing-box 1.13.0 起"
|
|
||||||
|
|
||||||
禁用 TCP keep alive。
|
|
||||||
|
|
||||||
#### tcp_keep_alive
|
|
||||||
|
|
||||||
!!! question "自 sing-box 1.13.0 起"
|
|
||||||
|
|
||||||
默认值从 `10m` 更改为 `5m`。
|
|
||||||
|
|
||||||
TCP keep-alive 初始周期。
|
|
||||||
|
|
||||||
默认使用 `5m`。
|
|
||||||
|
|
||||||
#### tcp_keep_alive_interval
|
|
||||||
|
|
||||||
!!! question "自 sing-box 1.13.0 起"
|
|
||||||
|
|
||||||
TCP keep-alive 间隔。
|
|
||||||
|
|
||||||
默认使用 `75s`。
|
|
||||||
|
|
||||||
#### udp_fragment
|
#### udp_fragment
|
||||||
|
|
||||||
启用 UDP 分段。
|
启用 UDP 分段。
|
||||||
|
|||||||
@@ -2,11 +2,6 @@
|
|||||||
icon: material/new-box
|
icon: material/new-box
|
||||||
---
|
---
|
||||||
|
|
||||||
!!! quote "Changes in sing-box 1.13.0"
|
|
||||||
|
|
||||||
:material-plus: [disable_tcp_keep_alive](#disable_tcp_keep_alive)
|
|
||||||
:material-alert: [tcp_keep_alive](#tcp_keep_alive)
|
|
||||||
|
|
||||||
!!! quote "Changes in sing-box 1.12.0"
|
!!! quote "Changes in sing-box 1.12.0"
|
||||||
|
|
||||||
:material-plus: [netns](#netns)
|
:material-plus: [netns](#netns)
|
||||||
@@ -34,9 +29,6 @@ icon: material/new-box
|
|||||||
"netns": "",
|
"netns": "",
|
||||||
"tcp_fast_open": false,
|
"tcp_fast_open": false,
|
||||||
"tcp_multi_path": false,
|
"tcp_multi_path": false,
|
||||||
"disable_tcp_keep_alive": false,
|
|
||||||
"tcp_keep_alive": "",
|
|
||||||
"tcp_keep_alive_interval": "",
|
|
||||||
"udp_fragment": false,
|
"udp_fragment": false,
|
||||||
"udp_timeout": "",
|
"udp_timeout": "",
|
||||||
"detour": "",
|
"detour": "",
|
||||||
@@ -109,28 +101,6 @@ Enable TCP Fast Open.
|
|||||||
|
|
||||||
Enable TCP Multi Path.
|
Enable TCP Multi Path.
|
||||||
|
|
||||||
#### disable_tcp_keep_alive
|
|
||||||
|
|
||||||
!!! question "Since sing-box 1.13.0"
|
|
||||||
|
|
||||||
Disable TCP keep alive.
|
|
||||||
|
|
||||||
#### tcp_keep_alive
|
|
||||||
|
|
||||||
!!! question "Since sing-box 1.13.0"
|
|
||||||
|
|
||||||
Default value changed from `10m` to `5m`.
|
|
||||||
|
|
||||||
TCP keep alive initial period.
|
|
||||||
|
|
||||||
`5m` will be used by default.
|
|
||||||
|
|
||||||
#### tcp_keep_alive_interval
|
|
||||||
|
|
||||||
TCP keep-alive interval.
|
|
||||||
|
|
||||||
`75s` will be used by default.
|
|
||||||
|
|
||||||
#### udp_fragment
|
#### udp_fragment
|
||||||
|
|
||||||
Enable UDP fragmentation.
|
Enable UDP fragmentation.
|
||||||
|
|||||||
@@ -2,11 +2,6 @@
|
|||||||
icon: material/new-box
|
icon: material/new-box
|
||||||
---
|
---
|
||||||
|
|
||||||
!!! quote "sing-box 1.13.0 中的更改"
|
|
||||||
|
|
||||||
:material-plus: [disable_tcp_keep_alive](#disable_tcp_keep_alive)
|
|
||||||
:material-alert: [tcp_keep_alive](#tcp_keep_alive)
|
|
||||||
|
|
||||||
!!! quote "Changes in sing-box 1.12.0"
|
!!! quote "Changes in sing-box 1.12.0"
|
||||||
|
|
||||||
:material-plus: [netns](#netns)
|
:material-plus: [netns](#netns)
|
||||||
@@ -34,9 +29,6 @@ icon: material/new-box
|
|||||||
"netns": "",
|
"netns": "",
|
||||||
"tcp_fast_open": false,
|
"tcp_fast_open": false,
|
||||||
"tcp_multi_path": false,
|
"tcp_multi_path": false,
|
||||||
"disable_tcp_keep_alive": false,
|
|
||||||
"tcp_keep_alive": "",
|
|
||||||
"tcp_keep_alive_interval": "",
|
|
||||||
"udp_fragment": false,
|
"udp_fragment": false,
|
||||||
"udp_timeout": "",
|
"udp_timeout": "",
|
||||||
"detour": "",
|
"detour": "",
|
||||||
@@ -109,28 +101,6 @@ icon: material/new-box
|
|||||||
|
|
||||||
启用 TCP Multi Path。
|
启用 TCP Multi Path。
|
||||||
|
|
||||||
#### disable_tcp_keep_alive
|
|
||||||
|
|
||||||
!!! question "自 sing-box 1.13.0 起"
|
|
||||||
|
|
||||||
禁用 TCP keep alive。
|
|
||||||
|
|
||||||
#### tcp_keep_alive
|
|
||||||
|
|
||||||
!!! question "自 sing-box 1.13.0 起"
|
|
||||||
|
|
||||||
默认值从 `10m` 更改为 `5m`。
|
|
||||||
|
|
||||||
TCP keep alive 初始周期。
|
|
||||||
|
|
||||||
默认使用 `5m`。
|
|
||||||
|
|
||||||
#### tcp_keep_alive_interval
|
|
||||||
|
|
||||||
TCP keep-alive 间隔。
|
|
||||||
|
|
||||||
默认使用 `75s`。
|
|
||||||
|
|
||||||
#### udp_fragment
|
#### udp_fragment
|
||||||
|
|
||||||
启用 UDP 分段。
|
启用 UDP 分段。
|
||||||
|
|||||||
@@ -8,13 +8,10 @@ icon: material/new-box
|
|||||||
:material-plus: [kernel_rx](#kernel_rx)
|
:material-plus: [kernel_rx](#kernel_rx)
|
||||||
:material-plus: [curve_preferences](#curve_preferences)
|
:material-plus: [curve_preferences](#curve_preferences)
|
||||||
:material-plus: [certificate_public_key_sha256](#certificate_public_key_sha256)
|
:material-plus: [certificate_public_key_sha256](#certificate_public_key_sha256)
|
||||||
|
:material-plus: [client_authentication](#client_authentication)
|
||||||
:material-plus: [client_certificate](#client_certificate)
|
:material-plus: [client_certificate](#client_certificate)
|
||||||
:material-plus: [client_certificate_path](#client_certificate_path)
|
:material-plus: [client_certificate_path](#client_certificate_path)
|
||||||
:material-plus: [client_key](#client_key)
|
|
||||||
:material-plus: [client_key_path](#client_key_path)
|
|
||||||
:material-plus: [client_authentication](#client_authentication)
|
|
||||||
:material-plus: [client_certificate_public_key_sha256](#client_certificate_public_key_sha256)
|
:material-plus: [client_certificate_public_key_sha256](#client_certificate_public_key_sha256)
|
||||||
:material-plus: [ech.query_server_name](#query_server_name)
|
|
||||||
|
|
||||||
!!! quote "Changes in sing-box 1.12.0"
|
!!! quote "Changes in sing-box 1.12.0"
|
||||||
|
|
||||||
@@ -104,14 +101,9 @@ icon: material/new-box
|
|||||||
"min_version": "",
|
"min_version": "",
|
||||||
"max_version": "",
|
"max_version": "",
|
||||||
"cipher_suites": [],
|
"cipher_suites": [],
|
||||||
"curve_preferences": [],
|
|
||||||
"certificate": "",
|
"certificate": "",
|
||||||
"certificate_path": "",
|
"certificate_path": "",
|
||||||
"certificate_public_key_sha256": [],
|
"certificate_public_key_sha256": [],
|
||||||
"client_certificate": [],
|
|
||||||
"client_certificate_path": "",
|
|
||||||
"client_key": [],
|
|
||||||
"client_key_path": "",
|
|
||||||
"fragment": false,
|
"fragment": false,
|
||||||
"fragment_fallback_delay": "",
|
"fragment_fallback_delay": "",
|
||||||
"record_fragment": false,
|
"record_fragment": false,
|
||||||
@@ -119,7 +111,6 @@ icon: material/new-box
|
|||||||
"enabled": false,
|
"enabled": false,
|
||||||
"config": [],
|
"config": [],
|
||||||
"config_path": "",
|
"config_path": "",
|
||||||
"query_server_name": "",
|
|
||||||
|
|
||||||
// Deprecated
|
// Deprecated
|
||||||
"pq_signature_schemes_enabled": false,
|
"pq_signature_schemes_enabled": false,
|
||||||
@@ -267,38 +258,6 @@ openssl x509 -in certificate.pem -pubkey -noout | openssl pkey -pubin -outform d
|
|||||||
echo | openssl s_client -servername example.com -connect example.com:443 2>/dev/null | openssl x509 -pubkey -noout | openssl pkey -pubin -outform der | openssl dgst -sha256 -binary | openssl enc -base64
|
echo | openssl s_client -servername example.com -connect example.com:443 2>/dev/null | openssl x509 -pubkey -noout | openssl pkey -pubin -outform der | openssl dgst -sha256 -binary | openssl enc -base64
|
||||||
```
|
```
|
||||||
|
|
||||||
#### client_certificate
|
|
||||||
|
|
||||||
!!! question "Since sing-box 1.13.0"
|
|
||||||
|
|
||||||
==Client only==
|
|
||||||
|
|
||||||
Client certificate chain line array, in PEM format.
|
|
||||||
|
|
||||||
#### client_certificate_path
|
|
||||||
|
|
||||||
!!! question "Since sing-box 1.13.0"
|
|
||||||
|
|
||||||
==Client only==
|
|
||||||
|
|
||||||
The path to client certificate chain, in PEM format.
|
|
||||||
|
|
||||||
#### client_key
|
|
||||||
|
|
||||||
!!! question "Since sing-box 1.13.0"
|
|
||||||
|
|
||||||
==Client only==
|
|
||||||
|
|
||||||
Client private key line array, in PEM format.
|
|
||||||
|
|
||||||
#### client_key_path
|
|
||||||
|
|
||||||
!!! question "Since sing-box 1.13.0"
|
|
||||||
|
|
||||||
==Client only==
|
|
||||||
|
|
||||||
The path to client private key, in PEM format.
|
|
||||||
|
|
||||||
#### key
|
#### key
|
||||||
|
|
||||||
==Server only==
|
==Server only==
|
||||||
@@ -507,16 +466,6 @@ The path to ECH configuration, in PEM format.
|
|||||||
|
|
||||||
If empty, load from DNS will be attempted.
|
If empty, load from DNS will be attempted.
|
||||||
|
|
||||||
#### query_server_name
|
|
||||||
|
|
||||||
!!! question "Since sing-box 1.13.0"
|
|
||||||
|
|
||||||
==Client only==
|
|
||||||
|
|
||||||
Overrides the domain name used for ECH HTTPS record queries.
|
|
||||||
|
|
||||||
If empty, `server_name` is used for queries.
|
|
||||||
|
|
||||||
#### fragment
|
#### fragment
|
||||||
|
|
||||||
!!! question "Since sing-box 1.12.0"
|
!!! question "Since sing-box 1.12.0"
|
||||||
|
|||||||
@@ -8,13 +8,10 @@ icon: material/new-box
|
|||||||
:material-plus: [kernel_rx](#kernel_rx)
|
:material-plus: [kernel_rx](#kernel_rx)
|
||||||
:material-plus: [curve_preferences](#curve_preferences)
|
:material-plus: [curve_preferences](#curve_preferences)
|
||||||
:material-plus: [certificate_public_key_sha256](#certificate_public_key_sha256)
|
:material-plus: [certificate_public_key_sha256](#certificate_public_key_sha256)
|
||||||
|
:material-plus: [client_authentication](#client_authentication)
|
||||||
:material-plus: [client_certificate](#client_certificate)
|
:material-plus: [client_certificate](#client_certificate)
|
||||||
:material-plus: [client_certificate_path](#client_certificate_path)
|
:material-plus: [client_certificate_path](#client_certificate_path)
|
||||||
:material-plus: [client_key](#client_key)
|
|
||||||
:material-plus: [client_key_path](#client_key_path)
|
|
||||||
:material-plus: [client_authentication](#client_authentication)
|
|
||||||
:material-plus: [client_certificate_public_key_sha256](#client_certificate_public_key_sha256)
|
:material-plus: [client_certificate_public_key_sha256](#client_certificate_public_key_sha256)
|
||||||
:material-plus: [ech.query_server_name](#query_server_name)
|
|
||||||
|
|
||||||
!!! quote "sing-box 1.12.0 中的更改"
|
!!! quote "sing-box 1.12.0 中的更改"
|
||||||
|
|
||||||
@@ -104,14 +101,9 @@ icon: material/new-box
|
|||||||
"min_version": "",
|
"min_version": "",
|
||||||
"max_version": "",
|
"max_version": "",
|
||||||
"cipher_suites": [],
|
"cipher_suites": [],
|
||||||
"curve_preferences": [],
|
|
||||||
"certificate": "",
|
"certificate": "",
|
||||||
"certificate_path": "",
|
"certificate_path": "",
|
||||||
"certificate_public_key_sha256": [],
|
"certificate_public_key_sha256": [],
|
||||||
"client_certificate": [],
|
|
||||||
"client_certificate_path": "",
|
|
||||||
"client_key": [],
|
|
||||||
"client_key_path": "",
|
|
||||||
"fragment": false,
|
"fragment": false,
|
||||||
"fragment_fallback_delay": "",
|
"fragment_fallback_delay": "",
|
||||||
"record_fragment": false,
|
"record_fragment": false,
|
||||||
@@ -119,7 +111,6 @@ icon: material/new-box
|
|||||||
"enabled": false,
|
"enabled": false,
|
||||||
"config": [],
|
"config": [],
|
||||||
"config_path": "",
|
"config_path": "",
|
||||||
"query_server_name": "",
|
|
||||||
|
|
||||||
// 废弃的
|
// 废弃的
|
||||||
"pq_signature_schemes_enabled": false,
|
"pq_signature_schemes_enabled": false,
|
||||||
@@ -262,38 +253,6 @@ openssl x509 -in certificate.pem -pubkey -noout | openssl pkey -pubin -outform d
|
|||||||
echo | openssl s_client -servername example.com -connect example.com:443 2>/dev/null | openssl x509 -pubkey -noout | openssl pkey -pubin -outform der | openssl dgst -sha256 -binary | openssl enc -base64
|
echo | openssl s_client -servername example.com -connect example.com:443 2>/dev/null | openssl x509 -pubkey -noout | openssl pkey -pubin -outform der | openssl dgst -sha256 -binary | openssl enc -base64
|
||||||
```
|
```
|
||||||
|
|
||||||
#### client_certificate
|
|
||||||
|
|
||||||
!!! question "自 sing-box 1.13.0 起"
|
|
||||||
|
|
||||||
==仅客户端==
|
|
||||||
|
|
||||||
客户端证书链行数组,PEM 格式。
|
|
||||||
|
|
||||||
#### client_certificate_path
|
|
||||||
|
|
||||||
!!! question "自 sing-box 1.13.0 起"
|
|
||||||
|
|
||||||
==仅客户端==
|
|
||||||
|
|
||||||
客户端证书链路径,PEM 格式。
|
|
||||||
|
|
||||||
#### client_key
|
|
||||||
|
|
||||||
!!! question "自 sing-box 1.13.0 起"
|
|
||||||
|
|
||||||
==仅客户端==
|
|
||||||
|
|
||||||
客户端私钥行数组,PEM 格式。
|
|
||||||
|
|
||||||
#### client_key_path
|
|
||||||
|
|
||||||
!!! question "自 sing-box 1.13.0 起"
|
|
||||||
|
|
||||||
==仅客户端==
|
|
||||||
|
|
||||||
客户端私钥路径,PEM 格式。
|
|
||||||
|
|
||||||
#### key
|
#### key
|
||||||
|
|
||||||
==仅服务器==
|
==仅服务器==
|
||||||
@@ -505,16 +464,6 @@ ECH 配置路径,PEM 格式。
|
|||||||
|
|
||||||
如果为空,将尝试从 DNS 加载。
|
如果为空,将尝试从 DNS 加载。
|
||||||
|
|
||||||
#### query_server_name
|
|
||||||
|
|
||||||
!!! question "自 sing-box 1.13.0 起"
|
|
||||||
|
|
||||||
==仅客户端==
|
|
||||||
|
|
||||||
覆盖用于 ECH HTTPS 记录查询的域名。
|
|
||||||
|
|
||||||
如果为空,使用 `server_name` 查询。
|
|
||||||
|
|
||||||
#### fragment
|
#### fragment
|
||||||
|
|
||||||
!!! question "自 sing-box 1.12.0 起"
|
!!! question "自 sing-box 1.12.0 起"
|
||||||
|
|||||||
@@ -57,45 +57,6 @@ go build -tags "tag_a tag_b" ./cmd/sing-box
|
|||||||
| `with_v2ray_api` | :material-close:️ | Build with V2Ray API support, see [Experimental](/configuration/experimental#v2ray-api-fields). |
|
| `with_v2ray_api` | :material-close:️ | Build with V2Ray API support, see [Experimental](/configuration/experimental#v2ray-api-fields). |
|
||||||
| `with_gvisor` | :material-check: | Build with gVisor support, see [Tun inbound](/configuration/inbound/tun#stack) and [WireGuard outbound](/configuration/outbound/wireguard#system_interface). |
|
| `with_gvisor` | :material-check: | Build with gVisor support, see [Tun inbound](/configuration/inbound/tun#stack) and [WireGuard outbound](/configuration/outbound/wireguard#system_interface). |
|
||||||
| `with_embedded_tor` (CGO required) | :material-close:️ | Build with embedded Tor support, see [Tor outbound](/configuration/outbound/tor/). |
|
| `with_embedded_tor` (CGO required) | :material-close:️ | Build with embedded Tor support, see [Tor outbound](/configuration/outbound/tor/). |
|
||||||
| `with_tailscale` | :material-check: | Build with Tailscale support, see [Tailscale endpoint](/configuration/endpoint/tailscale) |
|
| `with_tailscale` | :material-check: | Build with Tailscale support, see [Tailscale endpoint](/configuration/endpoint/tailscale) |
|
||||||
| `with_naive_outbound` | :material-close:️ | Build with NaiveProxy outbound support, see [NaiveProxy outbound](/configuration/outbound/naive/). |
|
|
||||||
|
|
||||||
It is not recommended to change the default build tag list unless you really know what you are adding.
|
It is not recommended to change the default build tag list unless you really know what you are adding.
|
||||||
|
|
||||||
## :material-layers: with_naive_outbound
|
|
||||||
|
|
||||||
NaiveProxy outbound requires special build configurations depending on your target platform.
|
|
||||||
|
|
||||||
### Supported Platforms
|
|
||||||
|
|
||||||
| Platform | Architectures | Mode | Requirements |
|
|
||||||
|-----------------|------------------------|--------|---------------------------------------------------|
|
|
||||||
| Linux | amd64, arm64 | purego | None (library included in official releases) |
|
|
||||||
| Linux | 386, amd64, arm, arm64 | CGO | Chromium toolchain, glibc >= 2.31 at runtime |
|
|
||||||
| Linux (musl) | 386, amd64, arm, arm64 | CGO | Chromium toolchain |
|
|
||||||
| Windows | amd64, arm64 | purego | None (library included in official releases) |
|
|
||||||
| Apple platforms | * | CGO | Xcode |
|
|
||||||
| Android | * | CGO | Android NDK |
|
|
||||||
|
|
||||||
### Windows
|
|
||||||
|
|
||||||
Use `with_purego` tag.
|
|
||||||
|
|
||||||
For official releases, `libcronet.dll` is included in the archive. For self-built binaries, download from [cronet-go releases](https://github.com/sagernet/cronet-go/releases) and place in the same directory as `sing-box.exe` or in a directory listed in `PATH`.
|
|
||||||
|
|
||||||
### Linux (purego, amd64/arm64 only)
|
|
||||||
|
|
||||||
Use `with_purego` tag.
|
|
||||||
|
|
||||||
For official releases, `libcronet.so` is included in the archive. For self-built binaries, download from [cronet-go releases](https://github.com/sagernet/cronet-go/releases) and place in the same directory as sing-box binary or in system library path.
|
|
||||||
|
|
||||||
### Linux (CGO)
|
|
||||||
|
|
||||||
See [cronet-go](https://github.com/sagernet/cronet-go#linux-build-instructions).
|
|
||||||
|
|
||||||
- **glibc build**: Requires glibc >= 2.31 at runtime
|
|
||||||
- **musl build**: Use `with_musl` tag, statically linked, no runtime requirements
|
|
||||||
|
|
||||||
### Apple platforms / Android
|
|
||||||
|
|
||||||
See [cronet-go](https://github.com/sagernet/cronet-go).
|
|
||||||
|
|||||||
@@ -62,44 +62,5 @@ go build -tags "tag_a tag_b" ./cmd/sing-box
|
|||||||
| `with_gvisor` | :material-check: | Build with gVisor support, see [Tun inbound](/configuration/inbound/tun#stack) and [WireGuard outbound](/configuration/outbound/wireguard#system_interface). |
|
| `with_gvisor` | :material-check: | Build with gVisor support, see [Tun inbound](/configuration/inbound/tun#stack) and [WireGuard outbound](/configuration/outbound/wireguard#system_interface). |
|
||||||
| `with_embedded_tor` (CGO required) | :material-close:️ | Build with embedded Tor support, see [Tor outbound](/configuration/outbound/tor/). |
|
| `with_embedded_tor` (CGO required) | :material-close:️ | Build with embedded Tor support, see [Tor outbound](/configuration/outbound/tor/). |
|
||||||
| `with_tailscale` | :material-check: | Build with Tailscale support, see [Tailscale endpoint](/configuration/endpoint/tailscale) |
|
| `with_tailscale` | :material-check: | Build with Tailscale support, see [Tailscale endpoint](/configuration/endpoint/tailscale) |
|
||||||
| `with_naive_outbound` | :material-close:️ | 构建 NaiveProxy 出站支持,参阅 [NaiveProxy 出站](/zh/configuration/outbound/naive/)。 |
|
|
||||||
|
|
||||||
除非您确实知道您正在启用什么,否则不建议更改默认构建标签列表。
|
除非您确实知道您正在启用什么,否则不建议更改默认构建标签列表。
|
||||||
|
|
||||||
## :material-layers: with_naive_outbound
|
|
||||||
|
|
||||||
NaiveProxy 出站需要根据目标平台进行特殊的构建配置。
|
|
||||||
|
|
||||||
### 支持的平台
|
|
||||||
|
|
||||||
| 平台 | 架构 | 模式 | 要求 |
|
|
||||||
|---------------|------------------------|--------|--------------------------------|
|
|
||||||
| Linux | amd64, arm64 | purego | 无(官方发布版本已包含库文件) |
|
|
||||||
| Linux | 386, amd64, arm, arm64 | CGO | Chromium 工具链,运行时需要 glibc >= 2.31 |
|
|
||||||
| Linux (musl) | 386, amd64, arm, arm64 | CGO | Chromium 工具链 |
|
|
||||||
| Windows | amd64, arm64 | purego | 无(官方发布版本已包含库文件) |
|
|
||||||
| Apple 平台 | * | CGO | Xcode |
|
|
||||||
| Android | * | CGO | Android NDK |
|
|
||||||
|
|
||||||
### Windows
|
|
||||||
|
|
||||||
使用 `with_purego` 标记。
|
|
||||||
|
|
||||||
官方发布版本已包含 `libcronet.dll`。自行构建时,从 [cronet-go releases](https://github.com/sagernet/cronet-go/releases) 下载并放置在 `sing-box.exe` 相同目录或 `PATH` 中的任意目录。
|
|
||||||
|
|
||||||
### Linux (purego, 仅 amd64/arm64)
|
|
||||||
|
|
||||||
使用 `with_purego` 标记。
|
|
||||||
|
|
||||||
官方发布版本已包含 `libcronet.so`。自行构建时,从 [cronet-go releases](https://github.com/sagernet/cronet-go/releases) 下载并放置在 sing-box 二进制文件相同目录或系统库路径中。
|
|
||||||
|
|
||||||
### Linux (CGO)
|
|
||||||
|
|
||||||
参阅 [cronet-go](https://github.com/sagernet/cronet-go#linux-build-instructions)。
|
|
||||||
|
|
||||||
- **glibc 构建**:运行时需要 glibc >= 2.31
|
|
||||||
- **musl 构建**:使用 `with_musl` 标记,静态链接,无运行时要求
|
|
||||||
|
|
||||||
### Apple 平台 / Android
|
|
||||||
|
|
||||||
参阅 [cronet-go](https://github.com/sagernet/cronet-go)。
|
|
||||||
|
|||||||
@@ -11,22 +11,16 @@ the project maintainer via [GitHub Sponsors](https://github.com/sponsors/nekohas
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
## Commercial Sponsors
|
### Special Sponsors
|
||||||
|
|
||||||
> [Warp](https://go.warp.dev/sing-box), Built for coding with multiple AI agents.
|
**Viral Tech, Inc.**
|
||||||
|
|
||||||
[](https://go.warp.dev/sing-box)
|
|
||||||
|
|
||||||
## Special Sponsors
|
|
||||||
|
|
||||||
> Viral Tech, Inc.
|
|
||||||
|
|
||||||
Helping us re-list sing-box apps on the Apple Store.
|
Helping us re-list sing-box apps on the Apple Store.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
> [JetBrains](https://www.jetbrains.com)
|
[](https://www.jetbrains.com)
|
||||||
|
|
||||||
Free license for the amazing IDEs.
|
Free license for the amazing IDEs.
|
||||||
|
|
||||||
[](https://www.jetbrains.com)
|
---
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ import (
|
|||||||
E "github.com/sagernet/sing/common/exceptions"
|
E "github.com/sagernet/sing/common/exceptions"
|
||||||
"github.com/sagernet/sing/common/json"
|
"github.com/sagernet/sing/common/json"
|
||||||
N "github.com/sagernet/sing/common/network"
|
N "github.com/sagernet/sing/common/network"
|
||||||
"github.com/sagernet/sing/common/observable"
|
|
||||||
"github.com/sagernet/sing/service"
|
"github.com/sagernet/sing/service"
|
||||||
"github.com/sagernet/sing/service/filemanager"
|
"github.com/sagernet/sing/service/filemanager"
|
||||||
"github.com/sagernet/ws"
|
"github.com/sagernet/ws"
|
||||||
@@ -54,7 +53,7 @@ type Server struct {
|
|||||||
|
|
||||||
mode string
|
mode string
|
||||||
modeList []string
|
modeList []string
|
||||||
modeUpdateHook *observable.Subscriber[struct{}]
|
modeUpdateHook chan<- struct{}
|
||||||
|
|
||||||
externalController bool
|
externalController bool
|
||||||
externalUI string
|
externalUI string
|
||||||
@@ -204,7 +203,7 @@ func (s *Server) ModeList() []string {
|
|||||||
return s.modeList
|
return s.modeList
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Server) SetModeUpdateHook(hook *observable.Subscriber[struct{}]) {
|
func (s *Server) SetModeUpdateHook(hook chan<- struct{}) {
|
||||||
s.modeUpdateHook = hook
|
s.modeUpdateHook = hook
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -222,7 +221,10 @@ func (s *Server) SetMode(newMode string) {
|
|||||||
}
|
}
|
||||||
s.mode = newMode
|
s.mode = newMode
|
||||||
if s.modeUpdateHook != nil {
|
if s.modeUpdateHook != nil {
|
||||||
s.modeUpdateHook.Emit(struct{}{})
|
select {
|
||||||
|
case s.modeUpdateHook <- struct{}{}:
|
||||||
|
default:
|
||||||
|
}
|
||||||
}
|
}
|
||||||
s.dnsRouter.ClearCache()
|
s.dnsRouter.ClearCache()
|
||||||
cacheFile := service.FromContext[adapter.CacheFile](s.ctx)
|
cacheFile := service.FromContext[adapter.CacheFile](s.ctx)
|
||||||
|
|||||||
@@ -9,13 +9,13 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
C "github.com/sagernet/sing-box/constant"
|
||||||
"github.com/sagernet/sing-box/daemon"
|
"github.com/sagernet/sing-box/daemon"
|
||||||
"github.com/sagernet/sing/common"
|
"github.com/sagernet/sing/common"
|
||||||
E "github.com/sagernet/sing/common/exceptions"
|
E "github.com/sagernet/sing/common/exceptions"
|
||||||
|
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
"google.golang.org/grpc/credentials/insecure"
|
"google.golang.org/grpc/credentials/insecure"
|
||||||
"google.golang.org/grpc/metadata"
|
|
||||||
"google.golang.org/protobuf/types/known/emptypb"
|
"google.golang.org/protobuf/types/known/emptypb"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -30,14 +30,11 @@ type CommandClient struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type CommandClientOptions struct {
|
type CommandClientOptions struct {
|
||||||
commands []int32
|
Command int32
|
||||||
|
Commands Int32Iterator
|
||||||
StatusInterval int64
|
StatusInterval int64
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o *CommandClientOptions) AddCommand(command int32) {
|
|
||||||
o.commands = append(o.commands, command)
|
|
||||||
}
|
|
||||||
|
|
||||||
type CommandClientHandler interface {
|
type CommandClientHandler interface {
|
||||||
Connected()
|
Connected()
|
||||||
Disconnected(message string)
|
Disconnected(message string)
|
||||||
@@ -73,38 +70,24 @@ func NewCommandClient(handler CommandClientHandler, options *CommandClientOption
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func unaryClientAuthInterceptor(ctx context.Context, method string, req, reply any, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error {
|
|
||||||
if sCommandServerSecret != "" {
|
|
||||||
ctx = metadata.AppendToOutgoingContext(ctx, "x-command-secret", sCommandServerSecret)
|
|
||||||
}
|
|
||||||
return invoker(ctx, method, req, reply, cc, opts...)
|
|
||||||
}
|
|
||||||
|
|
||||||
func streamClientAuthInterceptor(ctx context.Context, desc *grpc.StreamDesc, cc *grpc.ClientConn, method string, streamer grpc.Streamer, opts ...grpc.CallOption) (grpc.ClientStream, error) {
|
|
||||||
if sCommandServerSecret != "" {
|
|
||||||
ctx = metadata.AppendToOutgoingContext(ctx, "x-command-secret", sCommandServerSecret)
|
|
||||||
}
|
|
||||||
return streamer(ctx, desc, cc, method, opts...)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *CommandClient) grpcDial() (*grpc.ClientConn, error) {
|
func (c *CommandClient) grpcDial() (*grpc.ClientConn, error) {
|
||||||
var target string
|
var target string
|
||||||
if sCommandServerListenPort == 0 {
|
if C.IsDarwin {
|
||||||
target = "unix://" + filepath.Join(sBasePath, "command.sock")
|
port := sCommandServerListenPort
|
||||||
|
if port == 0 {
|
||||||
|
port = 8964
|
||||||
|
}
|
||||||
|
target = net.JoinHostPort("127.0.0.1", strconv.Itoa(int(port)))
|
||||||
} else {
|
} else {
|
||||||
target = net.JoinHostPort("127.0.0.1", strconv.Itoa(int(sCommandServerListenPort)))
|
target = "unix://" + filepath.Join(sBasePath, "command.sock")
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
conn *grpc.ClientConn
|
conn *grpc.ClientConn
|
||||||
err error
|
err error
|
||||||
)
|
)
|
||||||
clientOptions := []grpc.DialOption{
|
|
||||||
grpc.WithTransportCredentials(insecure.NewCredentials()),
|
|
||||||
grpc.WithUnaryInterceptor(unaryClientAuthInterceptor),
|
|
||||||
grpc.WithStreamInterceptor(streamClientAuthInterceptor),
|
|
||||||
}
|
|
||||||
for i := 0; i < 10; i++ {
|
for i := 0; i < 10; i++ {
|
||||||
conn, err = grpc.NewClient(target, clientOptions...)
|
conn, err = grpc.NewClient(target, grpc.WithTransportCredentials(insecure.NewCredentials()))
|
||||||
if err == nil {
|
if err == nil {
|
||||||
return conn, nil
|
return conn, nil
|
||||||
}
|
}
|
||||||
@@ -127,8 +110,14 @@ func (c *CommandClient) Connect() error {
|
|||||||
c.ctx, c.cancel = context.WithCancel(context.Background())
|
c.ctx, c.cancel = context.WithCancel(context.Background())
|
||||||
c.clientMutex.Unlock()
|
c.clientMutex.Unlock()
|
||||||
|
|
||||||
|
var commands []int32
|
||||||
|
if c.options.Commands != nil {
|
||||||
|
commands = iteratorToArray[int32](c.options.Commands)
|
||||||
|
} else {
|
||||||
|
commands = []int32{c.options.Command}
|
||||||
|
}
|
||||||
c.handler.Connected()
|
c.handler.Connected()
|
||||||
for _, command := range c.options.commands {
|
for _, command := range commands {
|
||||||
switch command {
|
switch command {
|
||||||
case CommandLog:
|
case CommandLog:
|
||||||
go c.handleLogStream()
|
go c.handleLogStream()
|
||||||
@@ -274,12 +263,14 @@ func (c *CommandClient) handleClashModeStream() {
|
|||||||
|
|
||||||
if sFixAndroidStack {
|
if sFixAndroidStack {
|
||||||
go func() {
|
go func() {
|
||||||
|
c.handler.Connected()
|
||||||
c.handler.InitializeClashMode(newIterator(modeStatus.ModeList), modeStatus.CurrentMode)
|
c.handler.InitializeClashMode(newIterator(modeStatus.ModeList), modeStatus.CurrentMode)
|
||||||
if len(modeStatus.ModeList) == 0 {
|
if len(modeStatus.ModeList) == 0 {
|
||||||
c.handler.Disconnected(os.ErrInvalid.Error())
|
c.handler.Disconnected(os.ErrInvalid.Error())
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
} else {
|
} else {
|
||||||
|
c.handler.Connected()
|
||||||
c.handler.InitializeClashMode(newIterator(modeStatus.ModeList), modeStatus.CurrentMode)
|
c.handler.InitializeClashMode(newIterator(modeStatus.ModeList), modeStatus.CurrentMode)
|
||||||
if len(modeStatus.ModeList) == 0 {
|
if len(modeStatus.ModeList) == 0 {
|
||||||
c.handler.Disconnected(os.ErrInvalid.Error())
|
c.handler.Disconnected(os.ErrInvalid.Error())
|
||||||
@@ -410,16 +401,6 @@ func (c *CommandClient) ServiceClose() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *CommandClient) ClearLogs() error {
|
|
||||||
client, err := c.getClientForCall()
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
_, err = client.ClearLogs(context.Background(), &emptypb.Empty{})
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *CommandClient) GetSystemProxyStatus() (*SystemProxyStatus, error) {
|
func (c *CommandClient) GetSystemProxyStatus() (*SystemProxyStatus, error) {
|
||||||
client, err := c.getClientForCall()
|
client, err := c.getClientForCall()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -2,30 +2,29 @@ package libbox
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
|
||||||
"net"
|
"net"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strconv"
|
"strconv"
|
||||||
"syscall"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/sagernet/sing-box/adapter"
|
"github.com/sagernet/sing-box/adapter"
|
||||||
C "github.com/sagernet/sing-box/constant"
|
C "github.com/sagernet/sing-box/constant"
|
||||||
"github.com/sagernet/sing-box/daemon"
|
"github.com/sagernet/sing-box/daemon"
|
||||||
|
"github.com/sagernet/sing-box/experimental/deprecated"
|
||||||
"github.com/sagernet/sing-box/log"
|
"github.com/sagernet/sing-box/log"
|
||||||
"github.com/sagernet/sing/common"
|
"github.com/sagernet/sing/common"
|
||||||
E "github.com/sagernet/sing/common/exceptions"
|
E "github.com/sagernet/sing/common/exceptions"
|
||||||
"github.com/sagernet/sing/service"
|
"github.com/sagernet/sing/service"
|
||||||
|
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
"google.golang.org/grpc/codes"
|
|
||||||
"google.golang.org/grpc/metadata"
|
|
||||||
"google.golang.org/grpc/status"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type CommandServer struct {
|
type CommandServer struct {
|
||||||
*daemon.StartedService
|
*daemon.StartedService
|
||||||
|
|
||||||
|
ctx context.Context
|
||||||
|
cancel context.CancelFunc
|
||||||
handler CommandServerHandler
|
handler CommandServerHandler
|
||||||
platformInterface PlatformInterface
|
platformInterface PlatformInterface
|
||||||
platformWrapper *platformInterfaceWrapper
|
platformWrapper *platformInterfaceWrapper
|
||||||
@@ -44,88 +43,47 @@ type CommandServerHandler interface {
|
|||||||
|
|
||||||
func NewCommandServer(handler CommandServerHandler, platformInterface PlatformInterface) (*CommandServer, error) {
|
func NewCommandServer(handler CommandServerHandler, platformInterface PlatformInterface) (*CommandServer, error) {
|
||||||
ctx := BaseContext(platformInterface)
|
ctx := BaseContext(platformInterface)
|
||||||
|
service.MustRegister[deprecated.Manager](ctx, new(deprecatedManager))
|
||||||
|
ctx, cancel := context.WithCancel(ctx)
|
||||||
platformWrapper := &platformInterfaceWrapper{
|
platformWrapper := &platformInterfaceWrapper{
|
||||||
iif: platformInterface,
|
iif: platformInterface,
|
||||||
useProcFS: platformInterface.UseProcFS(),
|
useProcFS: platformInterface.UseProcFS(),
|
||||||
}
|
}
|
||||||
service.MustRegister[adapter.PlatformInterface](ctx, platformWrapper)
|
service.MustRegister[adapter.PlatformInterface](ctx, platformWrapper)
|
||||||
server := &CommandServer{
|
server := &CommandServer{
|
||||||
|
ctx: ctx,
|
||||||
|
cancel: cancel,
|
||||||
handler: handler,
|
handler: handler,
|
||||||
platformInterface: platformInterface,
|
platformInterface: platformInterface,
|
||||||
platformWrapper: platformWrapper,
|
platformWrapper: platformWrapper,
|
||||||
}
|
}
|
||||||
server.StartedService = daemon.NewStartedService(daemon.ServiceOptions{
|
server.StartedService = daemon.NewStartedService(daemon.ServiceOptions{
|
||||||
Context: ctx,
|
Context: ctx,
|
||||||
// Platform: platformWrapper,
|
Platform: platformWrapper,
|
||||||
Handler: (*platformHandler)(server),
|
PlatformHandler: (*platformHandler)(server),
|
||||||
Debug: sDebug,
|
Debug: sDebug,
|
||||||
LogMaxLines: sLogMaxLines,
|
LogMaxLines: sLogMaxLines,
|
||||||
// WorkingDirectory: sWorkingPath,
|
WorkingDirectory: sBasePath,
|
||||||
// TempDirectory: sTempPath,
|
TempDirectory: os.TempDir(),
|
||||||
// UserID: sUserID,
|
UserID: sUserID,
|
||||||
// GroupID: sGroupID,
|
GroupID: sGroupID,
|
||||||
// SystemProxyEnabled: false,
|
SystemProxyEnabled: false,
|
||||||
})
|
})
|
||||||
return server, nil
|
return server, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func unaryAuthInterceptor(ctx context.Context, req any, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (any, error) {
|
|
||||||
if sCommandServerSecret == "" {
|
|
||||||
return handler(ctx, req)
|
|
||||||
}
|
|
||||||
md, ok := metadata.FromIncomingContext(ctx)
|
|
||||||
if !ok {
|
|
||||||
return nil, status.Error(codes.Unauthenticated, "missing metadata")
|
|
||||||
}
|
|
||||||
values := md.Get("x-command-secret")
|
|
||||||
if len(values) == 0 {
|
|
||||||
return nil, status.Error(codes.Unauthenticated, "missing authentication secret")
|
|
||||||
}
|
|
||||||
if values[0] != sCommandServerSecret {
|
|
||||||
return nil, status.Error(codes.Unauthenticated, "invalid authentication secret")
|
|
||||||
}
|
|
||||||
return handler(ctx, req)
|
|
||||||
}
|
|
||||||
|
|
||||||
func streamAuthInterceptor(srv any, ss grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error {
|
|
||||||
if sCommandServerSecret == "" {
|
|
||||||
return handler(srv, ss)
|
|
||||||
}
|
|
||||||
md, ok := metadata.FromIncomingContext(ss.Context())
|
|
||||||
if !ok {
|
|
||||||
return status.Error(codes.Unauthenticated, "missing metadata")
|
|
||||||
}
|
|
||||||
values := md.Get("x-command-secret")
|
|
||||||
if len(values) == 0 {
|
|
||||||
return status.Error(codes.Unauthenticated, "missing authentication secret")
|
|
||||||
}
|
|
||||||
if values[0] != sCommandServerSecret {
|
|
||||||
return status.Error(codes.Unauthenticated, "invalid authentication secret")
|
|
||||||
}
|
|
||||||
return handler(srv, ss)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *CommandServer) Start() error {
|
func (s *CommandServer) Start() error {
|
||||||
var (
|
var (
|
||||||
listener net.Listener
|
listener net.Listener
|
||||||
err error
|
err error
|
||||||
)
|
)
|
||||||
if sCommandServerListenPort == 0 {
|
if C.IsAndroid && sCommandServerListenPort == 0 {
|
||||||
sockPath := filepath.Join(sBasePath, "command.sock")
|
sockPath := filepath.Join(sBasePath, "command.sock")
|
||||||
os.Remove(sockPath)
|
os.Remove(sockPath)
|
||||||
for i := 0; i < 30; i++ {
|
listener, err = net.ListenUnix("unix", &net.UnixAddr{
|
||||||
listener, err = net.ListenUnix("unix", &net.UnixAddr{
|
Name: sockPath,
|
||||||
Name: sockPath,
|
Net: "unix",
|
||||||
Net: "unix",
|
})
|
||||||
})
|
|
||||||
if err == nil {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
if !errors.Is(err, syscall.EROFS) {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
time.Sleep(time.Second)
|
|
||||||
}
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return E.Cause(err, "listen command server")
|
return E.Cause(err, "listen command server")
|
||||||
}
|
}
|
||||||
@@ -138,23 +96,24 @@ func (s *CommandServer) Start() error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
listener, err = net.Listen("tcp", net.JoinHostPort("127.0.0.1", strconv.Itoa(int(sCommandServerListenPort))))
|
port := sCommandServerListenPort
|
||||||
|
if port == 0 {
|
||||||
|
port = 8964
|
||||||
|
}
|
||||||
|
listener, err = net.Listen("tcp", net.JoinHostPort("127.0.0.1", strconv.Itoa(int(port))))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return E.Cause(err, "listen command server")
|
return E.Cause(err, "listen command server")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
s.listener = listener
|
s.listener = listener
|
||||||
serverOptions := []grpc.ServerOption{
|
s.grpcServer = grpc.NewServer()
|
||||||
grpc.UnaryInterceptor(unaryAuthInterceptor),
|
|
||||||
grpc.StreamInterceptor(streamAuthInterceptor),
|
|
||||||
}
|
|
||||||
s.grpcServer = grpc.NewServer(serverOptions...)
|
|
||||||
daemon.RegisterStartedServiceServer(s.grpcServer, s.StartedService)
|
daemon.RegisterStartedServiceServer(s.grpcServer, s.StartedService)
|
||||||
go s.grpcServer.Serve(listener)
|
go s.grpcServer.Serve(listener)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *CommandServer) Close() {
|
func (s *CommandServer) Close() {
|
||||||
|
s.cancel()
|
||||||
if s.grpcServer != nil {
|
if s.grpcServer != nil {
|
||||||
s.grpcServer.Stop()
|
s.grpcServer.Stop()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,33 @@
|
|||||||
package libbox
|
package libbox
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"sync"
|
||||||
|
|
||||||
"github.com/sagernet/sing-box/experimental/deprecated"
|
"github.com/sagernet/sing-box/experimental/deprecated"
|
||||||
|
"github.com/sagernet/sing/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var _ deprecated.Manager = (*deprecatedManager)(nil)
|
||||||
|
|
||||||
|
type deprecatedManager struct {
|
||||||
|
access sync.Mutex
|
||||||
|
notes []deprecated.Note
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *deprecatedManager) ReportDeprecated(feature deprecated.Note) {
|
||||||
|
m.access.Lock()
|
||||||
|
defer m.access.Unlock()
|
||||||
|
m.notes = common.Uniq(append(m.notes, feature))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *deprecatedManager) Get() []deprecated.Note {
|
||||||
|
m.access.Lock()
|
||||||
|
defer m.access.Unlock()
|
||||||
|
notes := m.notes
|
||||||
|
m.notes = nil
|
||||||
|
return notes
|
||||||
|
}
|
||||||
|
|
||||||
var _ = deprecated.Note(DeprecatedNote{})
|
var _ = deprecated.Note(DeprecatedNote{})
|
||||||
|
|
||||||
type DeprecatedNote struct {
|
type DeprecatedNote struct {
|
||||||
|
|||||||
@@ -5,10 +5,11 @@ package libbox
|
|||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
"runtime"
|
"runtime"
|
||||||
"runtime/debug"
|
|
||||||
|
"golang.org/x/sys/unix"
|
||||||
)
|
)
|
||||||
|
|
||||||
var crashOutputFile *os.File
|
var stderrFile *os.File
|
||||||
|
|
||||||
func RedirectStderr(path string) error {
|
func RedirectStderr(path string) error {
|
||||||
if stats, err := os.Stat(path); err == nil && stats.Size() > 0 {
|
if stats, err := os.Stat(path); err == nil && stats.Size() > 0 {
|
||||||
@@ -26,12 +27,12 @@ func RedirectStderr(path string) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
err = debug.SetCrashOutput(outputFile, debug.CrashOptions{})
|
err = unix.Dup2(int(outputFile.Fd()), int(os.Stderr.Fd()))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
outputFile.Close()
|
outputFile.Close()
|
||||||
os.Remove(outputFile.Name())
|
os.Remove(outputFile.Name())
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
crashOutputFile = outputFile
|
stderrFile = outputFile
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,19 +1,18 @@
|
|||||||
package libbox
|
package libbox
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"crypto/rand"
|
"context"
|
||||||
"encoding/hex"
|
|
||||||
"errors"
|
|
||||||
"net"
|
|
||||||
"net/netip"
|
"net/netip"
|
||||||
"runtime"
|
"runtime"
|
||||||
"strconv"
|
|
||||||
"sync"
|
"sync"
|
||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
"github.com/sagernet/sing-box/adapter"
|
"github.com/sagernet/sing-box/adapter"
|
||||||
C "github.com/sagernet/sing-box/constant"
|
C "github.com/sagernet/sing-box/constant"
|
||||||
|
"github.com/sagernet/sing-box/daemon"
|
||||||
|
"github.com/sagernet/sing-box/dns"
|
||||||
"github.com/sagernet/sing-box/experimental/libbox/internal/procfs"
|
"github.com/sagernet/sing-box/experimental/libbox/internal/procfs"
|
||||||
|
"github.com/sagernet/sing-box/log"
|
||||||
"github.com/sagernet/sing-box/option"
|
"github.com/sagernet/sing-box/option"
|
||||||
tun "github.com/sagernet/sing-tun"
|
tun "github.com/sagernet/sing-tun"
|
||||||
"github.com/sagernet/sing/common"
|
"github.com/sagernet/sing/common"
|
||||||
@@ -22,7 +21,7 @@ import (
|
|||||||
"github.com/sagernet/sing/common/logger"
|
"github.com/sagernet/sing/common/logger"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ adapter.PlatformInterface = (*platformInterfaceWrapper)(nil)
|
var _ daemon.PlatformInterface = (*platformInterfaceWrapper)(nil)
|
||||||
|
|
||||||
type platformInterfaceWrapper struct {
|
type platformInterfaceWrapper struct {
|
||||||
iif PlatformInterface
|
iif PlatformInterface
|
||||||
@@ -215,28 +214,16 @@ func (w *platformInterfaceWrapper) SendNotification(notification *adapter.Notifi
|
|||||||
return w.iif.SendNotification((*Notification)(notification))
|
return w.iif.SendNotification((*Notification)(notification))
|
||||||
}
|
}
|
||||||
|
|
||||||
func AvailablePort(startPort int32) (int32, error) {
|
func (w *platformInterfaceWrapper) UsePlatformLocalDNSTransport() bool {
|
||||||
for port := int(startPort); ; port++ {
|
return C.IsAndroid
|
||||||
if port > 65535 {
|
|
||||||
return 0, E.New("no available port found")
|
|
||||||
}
|
|
||||||
listener, err := net.Listen("tcp", net.JoinHostPort("127.0.0.1", strconv.Itoa(int(port))))
|
|
||||||
if err != nil {
|
|
||||||
if errors.Is(err, syscall.EADDRINUSE) {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
return 0, E.Cause(err, "find available port")
|
|
||||||
}
|
|
||||||
err = listener.Close()
|
|
||||||
if err != nil {
|
|
||||||
return 0, E.Cause(err, "close listener")
|
|
||||||
}
|
|
||||||
return int32(port), nil
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func RandomHex(length int32) *StringBox {
|
func (w *platformInterfaceWrapper) LocalDNSTransport() dns.TransportConstructorFunc[option.LocalDNSServerOptions] {
|
||||||
bytes := make([]byte, length)
|
localTransport := w.iif.LocalDNSTransport()
|
||||||
common.Must1(rand.Read(bytes))
|
if localTransport == nil {
|
||||||
return wrapString(hex.EncodeToString(bytes))
|
return nil
|
||||||
|
}
|
||||||
|
return func(ctx context.Context, logger log.ContextLogger, tag string, options option.LocalDNSServerOptions) (adapter.DNSTransport, error) {
|
||||||
|
return newPlatformTransport(localTransport, tag, options), nil
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
32
experimental/libbox/service_error.go
Normal file
32
experimental/libbox/service_error.go
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
package libbox
|
||||||
|
|
||||||
|
import (
|
||||||
|
"os"
|
||||||
|
"path/filepath"
|
||||||
|
)
|
||||||
|
|
||||||
|
func serviceErrorPath() string {
|
||||||
|
return filepath.Join(sWorkingPath, "network_extension_error")
|
||||||
|
}
|
||||||
|
|
||||||
|
func ClearServiceError() {
|
||||||
|
os.Remove(serviceErrorPath())
|
||||||
|
}
|
||||||
|
|
||||||
|
func ReadServiceError() (*StringBox, error) {
|
||||||
|
data, err := os.ReadFile(serviceErrorPath())
|
||||||
|
if err == nil {
|
||||||
|
os.Remove(serviceErrorPath())
|
||||||
|
}
|
||||||
|
return wrapString(string(data)), err
|
||||||
|
}
|
||||||
|
|
||||||
|
func WriteServiceError(message string) error {
|
||||||
|
errorFile, err := os.Create(serviceErrorPath())
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
errorFile.WriteString(message)
|
||||||
|
errorFile.Chown(sUserID, sGroupID)
|
||||||
|
return errorFile.Close()
|
||||||
|
}
|
||||||
52
go.mod
52
go.mod
@@ -3,45 +3,40 @@ module github.com/sagernet/sing-box
|
|||||||
go 1.24.7
|
go 1.24.7
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/anthropics/anthropic-sdk-go v1.14.0
|
|
||||||
github.com/anytls/sing-anytls v0.0.11
|
github.com/anytls/sing-anytls v0.0.11
|
||||||
github.com/caddyserver/certmagic v0.23.0
|
github.com/caddyserver/certmagic v0.23.0
|
||||||
github.com/coder/websocket v1.8.13
|
github.com/coder/websocket v1.8.13
|
||||||
github.com/cretz/bine v0.2.0
|
github.com/cretz/bine v0.2.0
|
||||||
github.com/database64128/tfo-go/v2 v2.3.1
|
github.com/database64128/tfo-go/v2 v2.2.2
|
||||||
github.com/go-chi/chi/v5 v5.2.2
|
github.com/go-chi/chi/v5 v5.2.2
|
||||||
github.com/go-chi/render v1.0.3
|
github.com/go-chi/render v1.0.3
|
||||||
github.com/godbus/dbus/v5 v5.1.1-0.20230522191255-76236955d466
|
github.com/godbus/dbus/v5 v5.1.1-0.20230522191255-76236955d466
|
||||||
github.com/gofrs/uuid/v5 v5.3.2
|
github.com/gofrs/uuid/v5 v5.3.2
|
||||||
github.com/insomniacslk/dhcp v0.0.0-20250417080101-5f8cf70e8c5f
|
github.com/insomniacslk/dhcp v0.0.0-20250417080101-5f8cf70e8c5f
|
||||||
github.com/keybase/go-keychain v0.0.1
|
|
||||||
github.com/libdns/alidns v1.0.5-libdns.v1.beta1
|
github.com/libdns/alidns v1.0.5-libdns.v1.beta1
|
||||||
github.com/libdns/cloudflare v0.2.2-0.20250708034226-c574dccb31a6
|
github.com/libdns/cloudflare v0.2.2-0.20250708034226-c574dccb31a6
|
||||||
github.com/logrusorgru/aurora v2.0.3+incompatible
|
github.com/logrusorgru/aurora v2.0.3+incompatible
|
||||||
github.com/metacubex/utls v1.8.3
|
github.com/metacubex/utls v1.8.0
|
||||||
github.com/mholt/acmez/v3 v3.1.2
|
github.com/mholt/acmez/v3 v3.1.2
|
||||||
github.com/miekg/dns v1.1.67
|
github.com/miekg/dns v1.1.67
|
||||||
github.com/openai/openai-go/v3 v3.13.0
|
|
||||||
github.com/oschwald/maxminddb-golang v1.13.1
|
github.com/oschwald/maxminddb-golang v1.13.1
|
||||||
github.com/sagernet/asc-go v0.0.0-20241217030726-d563060fe4e1
|
github.com/sagernet/asc-go v0.0.0-20241217030726-d563060fe4e1
|
||||||
github.com/sagernet/bbolt v0.0.0-20231014093535-ea5cb2fe9f0a
|
github.com/sagernet/bbolt v0.0.0-20231014093535-ea5cb2fe9f0a
|
||||||
github.com/sagernet/cors v1.2.1
|
github.com/sagernet/cors v1.2.1
|
||||||
github.com/sagernet/cronet-go v0.0.0-20251219080614-460b6a5fb79d
|
|
||||||
github.com/sagernet/cronet-go/all v0.0.0-20251219080614-460b6a5fb79d
|
|
||||||
github.com/sagernet/fswatch v0.1.1
|
github.com/sagernet/fswatch v0.1.1
|
||||||
github.com/sagernet/gomobile v0.1.10
|
github.com/sagernet/gomobile v0.1.8
|
||||||
github.com/sagernet/gvisor v0.0.0-20250811.0-sing-box-mod.1
|
github.com/sagernet/gvisor v0.0.0-20250811.0-sing-box-mod.1
|
||||||
github.com/sagernet/quic-go v0.57.1-sing-box-mod.3
|
github.com/sagernet/quic-go v0.54.0-sing-box-mod.3
|
||||||
github.com/sagernet/sing v0.8.0-beta.6.0.20251207063731-56fd482ce1c6
|
github.com/sagernet/sing v0.8.0-beta.5
|
||||||
github.com/sagernet/sing-mux v0.3.3
|
github.com/sagernet/sing-mux v0.3.3
|
||||||
github.com/sagernet/sing-quic v0.6.0-beta.5.0.20251218085114-6968f531a8c0
|
github.com/sagernet/sing-quic v0.6.0-beta.3
|
||||||
github.com/sagernet/sing-shadowsocks v0.2.8
|
github.com/sagernet/sing-shadowsocks v0.2.8
|
||||||
github.com/sagernet/sing-shadowsocks2 v0.2.1
|
github.com/sagernet/sing-shadowsocks2 v0.2.1
|
||||||
github.com/sagernet/sing-shadowtls v0.2.1-0.20250503051639-fcd445d33c11
|
github.com/sagernet/sing-shadowtls v0.2.1-0.20250503051639-fcd445d33c11
|
||||||
github.com/sagernet/sing-tun v0.8.0-beta.11.0.20251201004738-e9e3fbf0c15e
|
github.com/sagernet/sing-tun v0.8.0-beta.10
|
||||||
github.com/sagernet/sing-vmess v0.2.8-0.20250909125414-3aed155119a1
|
github.com/sagernet/sing-vmess v0.2.8-0.20250909125414-3aed155119a1
|
||||||
github.com/sagernet/smux v1.5.34-mod.2
|
github.com/sagernet/smux v1.5.34-mod.2
|
||||||
github.com/sagernet/tailscale v1.86.5-sing-box-1.13-mod.4
|
github.com/sagernet/tailscale v1.86.5-sing-box-1.13-mod.3
|
||||||
github.com/sagernet/wireguard-go v0.0.2-beta.1.0.20250917110311-16510ac47288
|
github.com/sagernet/wireguard-go v0.0.2-beta.1.0.20250917110311-16510ac47288
|
||||||
github.com/sagernet/ws v0.0.0-20231204124109-acfe8907c854
|
github.com/sagernet/ws v0.0.0-20231204124109-acfe8907c854
|
||||||
github.com/spf13/cobra v1.9.1
|
github.com/spf13/cobra v1.9.1
|
||||||
@@ -71,12 +66,11 @@ require (
|
|||||||
github.com/caddyserver/zerossl v0.1.3 // indirect
|
github.com/caddyserver/zerossl v0.1.3 // indirect
|
||||||
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
|
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
|
||||||
github.com/coreos/go-iptables v0.7.1-0.20240112124308-65c67c9f46e6 // indirect
|
github.com/coreos/go-iptables v0.7.1-0.20240112124308-65c67c9f46e6 // indirect
|
||||||
github.com/database64128/netx-go v0.1.1 // indirect
|
github.com/database64128/netx-go v0.0.0-20240905055117-62795b8b054a // indirect
|
||||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
|
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
|
||||||
github.com/dblohm7/wingoes v0.0.0-20240119213807-a09d6be7affa // indirect
|
github.com/dblohm7/wingoes v0.0.0-20240119213807-a09d6be7affa // indirect
|
||||||
github.com/dgrijalva/jwt-go/v4 v4.0.0-preview1 // indirect
|
github.com/dgrijalva/jwt-go/v4 v4.0.0-preview1 // indirect
|
||||||
github.com/digitalocean/go-smbios v0.0.0-20180907143718-390a4f403a8e // indirect
|
github.com/digitalocean/go-smbios v0.0.0-20180907143718-390a4f403a8e // indirect
|
||||||
github.com/ebitengine/purego v0.9.1 // indirect
|
|
||||||
github.com/fsnotify/fsnotify v1.7.0 // indirect
|
github.com/fsnotify/fsnotify v1.7.0 // indirect
|
||||||
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
|
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
|
||||||
github.com/gaissmai/bart v0.18.0 // indirect
|
github.com/gaissmai/bart v0.18.0 // indirect
|
||||||
@@ -106,30 +100,8 @@ require (
|
|||||||
github.com/pierrec/lz4/v4 v4.1.21 // indirect
|
github.com/pierrec/lz4/v4 v4.1.21 // indirect
|
||||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
|
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
|
||||||
github.com/prometheus-community/pro-bing v0.4.0 // indirect
|
github.com/prometheus-community/pro-bing v0.4.0 // indirect
|
||||||
github.com/quic-go/qpack v0.6.0 // indirect
|
github.com/quic-go/qpack v0.5.1 // indirect
|
||||||
github.com/safchain/ethtool v0.3.0 // indirect
|
github.com/safchain/ethtool v0.3.0 // indirect
|
||||||
github.com/sagernet/cronet-go/lib/android_386 v0.0.0-20251219080137-fbc9bf07b76b // indirect
|
|
||||||
github.com/sagernet/cronet-go/lib/android_amd64 v0.0.0-20251219080137-fbc9bf07b76b // indirect
|
|
||||||
github.com/sagernet/cronet-go/lib/android_arm v0.0.0-20251219080137-fbc9bf07b76b // indirect
|
|
||||||
github.com/sagernet/cronet-go/lib/android_arm64 v0.0.0-20251219080137-fbc9bf07b76b // indirect
|
|
||||||
github.com/sagernet/cronet-go/lib/darwin_amd64 v0.0.0-20251219080137-fbc9bf07b76b // indirect
|
|
||||||
github.com/sagernet/cronet-go/lib/darwin_arm64 v0.0.0-20251219080137-fbc9bf07b76b // indirect
|
|
||||||
github.com/sagernet/cronet-go/lib/ios_amd64_simulator v0.0.0-20251219080137-fbc9bf07b76b // indirect
|
|
||||||
github.com/sagernet/cronet-go/lib/ios_arm64 v0.0.0-20251219080137-fbc9bf07b76b // indirect
|
|
||||||
github.com/sagernet/cronet-go/lib/ios_arm64_simulator v0.0.0-20251219080137-fbc9bf07b76b // indirect
|
|
||||||
github.com/sagernet/cronet-go/lib/linux_386 v0.0.0-20251219080137-fbc9bf07b76b // indirect
|
|
||||||
github.com/sagernet/cronet-go/lib/linux_386_musl v0.0.0-20251219080137-fbc9bf07b76b // indirect
|
|
||||||
github.com/sagernet/cronet-go/lib/linux_amd64 v0.0.0-20251219080137-fbc9bf07b76b // indirect
|
|
||||||
github.com/sagernet/cronet-go/lib/linux_amd64_musl v0.0.0-20251219080137-fbc9bf07b76b // indirect
|
|
||||||
github.com/sagernet/cronet-go/lib/linux_arm v0.0.0-20251219080137-fbc9bf07b76b // indirect
|
|
||||||
github.com/sagernet/cronet-go/lib/linux_arm64 v0.0.0-20251219080137-fbc9bf07b76b // indirect
|
|
||||||
github.com/sagernet/cronet-go/lib/linux_arm64_musl v0.0.0-20251219080137-fbc9bf07b76b // indirect
|
|
||||||
github.com/sagernet/cronet-go/lib/linux_arm_musl v0.0.0-20251219080137-fbc9bf07b76b // indirect
|
|
||||||
github.com/sagernet/cronet-go/lib/tvos_amd64_simulator v0.0.0-20251219080137-fbc9bf07b76b // indirect
|
|
||||||
github.com/sagernet/cronet-go/lib/tvos_arm64 v0.0.0-20251219080137-fbc9bf07b76b // indirect
|
|
||||||
github.com/sagernet/cronet-go/lib/tvos_arm64_simulator v0.0.0-20251219080137-fbc9bf07b76b // indirect
|
|
||||||
github.com/sagernet/cronet-go/lib/windows_amd64 v0.0.0-20251219080137-fbc9bf07b76b // indirect
|
|
||||||
github.com/sagernet/cronet-go/lib/windows_arm64 v0.0.0-20251219080137-fbc9bf07b76b // indirect
|
|
||||||
github.com/sagernet/netlink v0.0.0-20240612041022-b9a21c07ac6a // indirect
|
github.com/sagernet/netlink v0.0.0-20240612041022-b9a21c07ac6a // indirect
|
||||||
github.com/sagernet/nftables v0.3.0-beta.4 // indirect
|
github.com/sagernet/nftables v0.3.0-beta.4 // indirect
|
||||||
github.com/spf13/pflag v1.0.6 // indirect
|
github.com/spf13/pflag v1.0.6 // indirect
|
||||||
@@ -141,10 +113,6 @@ require (
|
|||||||
github.com/tailscale/peercred v0.0.0-20250107143737-35a0c7bd7edc // indirect
|
github.com/tailscale/peercred v0.0.0-20250107143737-35a0c7bd7edc // indirect
|
||||||
github.com/tailscale/web-client-prebuilt v0.0.0-20250124233751-d4cd19a26976 // indirect
|
github.com/tailscale/web-client-prebuilt v0.0.0-20250124233751-d4cd19a26976 // indirect
|
||||||
github.com/tailscale/wireguard-go v0.0.0-20250716170648-1d0488a3d7da // indirect
|
github.com/tailscale/wireguard-go v0.0.0-20250716170648-1d0488a3d7da // indirect
|
||||||
github.com/tidwall/gjson v1.18.0 // indirect
|
|
||||||
github.com/tidwall/match v1.1.1 // indirect
|
|
||||||
github.com/tidwall/pretty v1.2.1 // indirect
|
|
||||||
github.com/tidwall/sjson v1.2.5 // indirect
|
|
||||||
github.com/u-root/uio v0.0.0-20240224005618-d2acac8f3701 // indirect
|
github.com/u-root/uio v0.0.0-20240224005618-d2acac8f3701 // indirect
|
||||||
github.com/x448/float16 v0.8.4 // indirect
|
github.com/x448/float16 v0.8.4 // indirect
|
||||||
github.com/zeebo/blake3 v0.2.4 // indirect
|
github.com/zeebo/blake3 v0.2.4 // indirect
|
||||||
|
|||||||
106
go.sum
106
go.sum
@@ -8,8 +8,6 @@ github.com/alexbrainman/sspi v0.0.0-20231016080023-1a75b4708caa h1:LHTHcTQiSGT7V
|
|||||||
github.com/alexbrainman/sspi v0.0.0-20231016080023-1a75b4708caa/go.mod h1:cEWa1LVoE5KvSD9ONXsZrj0z6KqySlCCNKHlLzbqAt4=
|
github.com/alexbrainman/sspi v0.0.0-20231016080023-1a75b4708caa/go.mod h1:cEWa1LVoE5KvSD9ONXsZrj0z6KqySlCCNKHlLzbqAt4=
|
||||||
github.com/andybalholm/brotli v1.1.0 h1:eLKJA0d02Lf0mVpIDgYnqXcUn0GqVmEFny3VuID1U3M=
|
github.com/andybalholm/brotli v1.1.0 h1:eLKJA0d02Lf0mVpIDgYnqXcUn0GqVmEFny3VuID1U3M=
|
||||||
github.com/andybalholm/brotli v1.1.0/go.mod h1:sms7XGricyQI9K10gOSf56VKKWS4oLer58Q+mhRPtnY=
|
github.com/andybalholm/brotli v1.1.0/go.mod h1:sms7XGricyQI9K10gOSf56VKKWS4oLer58Q+mhRPtnY=
|
||||||
github.com/anthropics/anthropic-sdk-go v1.14.0 h1:EzNQvnZlaDHe2UPkoUySDz3ixRgNbwKdH8KtFpv7pi4=
|
|
||||||
github.com/anthropics/anthropic-sdk-go v1.14.0/go.mod h1:WTz31rIUHUHqai2UslPpw5CwXrQP3geYBioRV4WOLvE=
|
|
||||||
github.com/anytls/sing-anytls v0.0.11 h1:w8e9Uj1oP3m4zxkyZDewPk0EcQbvVxb7Nn+rapEx4fc=
|
github.com/anytls/sing-anytls v0.0.11 h1:w8e9Uj1oP3m4zxkyZDewPk0EcQbvVxb7Nn+rapEx4fc=
|
||||||
github.com/anytls/sing-anytls v0.0.11/go.mod h1:7rjN6IukwysmdusYsrV51Fgu1uW6vsrdd6ctjnEAln8=
|
github.com/anytls/sing-anytls v0.0.11/go.mod h1:7rjN6IukwysmdusYsrV51Fgu1uW6vsrdd6ctjnEAln8=
|
||||||
github.com/caddyserver/certmagic v0.23.0 h1:CfpZ/50jMfG4+1J/u2LV6piJq4HOfO6ppOnOf7DkFEU=
|
github.com/caddyserver/certmagic v0.23.0 h1:CfpZ/50jMfG4+1J/u2LV6piJq4HOfO6ppOnOf7DkFEU=
|
||||||
@@ -27,10 +25,10 @@ github.com/coreos/go-iptables v0.7.1-0.20240112124308-65c67c9f46e6/go.mod h1:Qe8
|
|||||||
github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=
|
github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=
|
||||||
github.com/cretz/bine v0.2.0 h1:8GiDRGlTgz+o8H9DSnsl+5MeBK4HsExxgl6WgzOCuZo=
|
github.com/cretz/bine v0.2.0 h1:8GiDRGlTgz+o8H9DSnsl+5MeBK4HsExxgl6WgzOCuZo=
|
||||||
github.com/cretz/bine v0.2.0/go.mod h1:WU4o9QR9wWp8AVKtTM1XD5vUHkEqnf2vVSo6dBqbetI=
|
github.com/cretz/bine v0.2.0/go.mod h1:WU4o9QR9wWp8AVKtTM1XD5vUHkEqnf2vVSo6dBqbetI=
|
||||||
github.com/database64128/netx-go v0.1.1 h1:dT5LG7Gs7zFZBthFBbzWE6K8wAHjSNAaK7wCYZT7NzM=
|
github.com/database64128/netx-go v0.0.0-20240905055117-62795b8b054a h1:t4SDi0pmNkryzKdM4QF3o5vqSP4GRjeZD/6j3nyxNP0=
|
||||||
github.com/database64128/netx-go v0.1.1/go.mod h1:LNlYVipaYkQArRFDNNJ02VkNV+My9A5XR/IGS7sIBQc=
|
github.com/database64128/netx-go v0.0.0-20240905055117-62795b8b054a/go.mod h1:7K2NQKbabB5mBl41vF6YayYl5g7YpDwc4dQ5iMpP3Lg=
|
||||||
github.com/database64128/tfo-go/v2 v2.3.1 h1:EGE+ELd5/AQ0X6YBlQ9RgKs8+kciNhgN3d8lRvfEJQw=
|
github.com/database64128/tfo-go/v2 v2.2.2 h1:BxynF4qGF5ct3DpPLEG62uyJZ3LQhqaf0Ken+kyy7PM=
|
||||||
github.com/database64128/tfo-go/v2 v2.3.1/go.mod h1:k9wcpg/8i5zenspBkc9jUEYehpZZccBnCElzOJB++bU=
|
github.com/database64128/tfo-go/v2 v2.2.2/go.mod h1:2IW8jppdBwdVMjA08uEyMNnqiAHKUlqAA+J8NrsfktY=
|
||||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
|
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
|
||||||
@@ -41,8 +39,6 @@ github.com/dgrijalva/jwt-go/v4 v4.0.0-preview1 h1:CaO/zOnF8VvUfEbhRatPcwKVWamvbY
|
|||||||
github.com/dgrijalva/jwt-go/v4 v4.0.0-preview1/go.mod h1:+hnT3ywWDTAFrW5aE+u2Sa/wT555ZqwoCS+pk3p6ry4=
|
github.com/dgrijalva/jwt-go/v4 v4.0.0-preview1/go.mod h1:+hnT3ywWDTAFrW5aE+u2Sa/wT555ZqwoCS+pk3p6ry4=
|
||||||
github.com/digitalocean/go-smbios v0.0.0-20180907143718-390a4f403a8e h1:vUmf0yezR0y7jJ5pceLHthLaYf4bA5T14B6q39S4q2Q=
|
github.com/digitalocean/go-smbios v0.0.0-20180907143718-390a4f403a8e h1:vUmf0yezR0y7jJ5pceLHthLaYf4bA5T14B6q39S4q2Q=
|
||||||
github.com/digitalocean/go-smbios v0.0.0-20180907143718-390a4f403a8e/go.mod h1:YTIHhz/QFSYnu/EhlF2SpU2Uk+32abacUYA5ZPljz1A=
|
github.com/digitalocean/go-smbios v0.0.0-20180907143718-390a4f403a8e/go.mod h1:YTIHhz/QFSYnu/EhlF2SpU2Uk+32abacUYA5ZPljz1A=
|
||||||
github.com/ebitengine/purego v0.9.1 h1:a/k2f2HQU3Pi399RPW1MOaZyhKJL9w/xFpKAg4q1s0A=
|
|
||||||
github.com/ebitengine/purego v0.9.1/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ=
|
|
||||||
github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA=
|
github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA=
|
||||||
github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM=
|
github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM=
|
||||||
github.com/fxamacker/cbor/v2 v2.7.0 h1:iM5WgngdRBanHcxugY4JySA0nk1wZorNOpTgCMedv5E=
|
github.com/fxamacker/cbor/v2 v2.7.0 h1:iM5WgngdRBanHcxugY4JySA0nk1wZorNOpTgCMedv5E=
|
||||||
@@ -99,8 +95,6 @@ github.com/insomniacslk/dhcp v0.0.0-20250417080101-5f8cf70e8c5f/go.mod h1:zhFlBe
|
|||||||
github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
|
github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
|
||||||
github.com/jsimonetti/rtnetlink v1.4.0 h1:Z1BF0fRgcETPEa0Kt0MRk3yV5+kF1FWTni6KUFKrq2I=
|
github.com/jsimonetti/rtnetlink v1.4.0 h1:Z1BF0fRgcETPEa0Kt0MRk3yV5+kF1FWTni6KUFKrq2I=
|
||||||
github.com/jsimonetti/rtnetlink v1.4.0/go.mod h1:5W1jDvWdnthFJ7fxYX1GMK07BUpI4oskfOqvPteYS6E=
|
github.com/jsimonetti/rtnetlink v1.4.0/go.mod h1:5W1jDvWdnthFJ7fxYX1GMK07BUpI4oskfOqvPteYS6E=
|
||||||
github.com/keybase/go-keychain v0.0.1 h1:way+bWYa6lDppZoZcgMbYsvC7GxljxrskdNInRtuthU=
|
|
||||||
github.com/keybase/go-keychain v0.0.1/go.mod h1:PdEILRW3i9D8JcdM+FmY6RwkHGnhHxXwkPPMeUgOK1k=
|
|
||||||
github.com/klauspost/compress v1.17.11 h1:In6xLpyWOi1+C7tXUUWv2ot1QvBjxevKAaI6IXrJmUc=
|
github.com/klauspost/compress v1.17.11 h1:In6xLpyWOi1+C7tXUUWv2ot1QvBjxevKAaI6IXrJmUc=
|
||||||
github.com/klauspost/compress v1.17.11/go.mod h1:pMDklpSncoRMuLFrf1W9Ss9KT+0rH90U12bZKk7uwG0=
|
github.com/klauspost/compress v1.17.11/go.mod h1:pMDklpSncoRMuLFrf1W9Ss9KT+0rH90U12bZKk7uwG0=
|
||||||
github.com/klauspost/cpuid/v2 v2.2.10 h1:tBs3QSyvjDyFTq3uoc/9xFpCuOsJQFNPiAhYdw2skhE=
|
github.com/klauspost/cpuid/v2 v2.2.10 h1:tBs3QSyvjDyFTq3uoc/9xFpCuOsJQFNPiAhYdw2skhE=
|
||||||
@@ -122,8 +116,8 @@ github.com/mdlayher/sdnotify v1.0.0 h1:Ma9XeLVN/l0qpyx1tNeMSeTjCPH6NtuD6/N9XdTlQ
|
|||||||
github.com/mdlayher/sdnotify v1.0.0/go.mod h1:HQUmpM4XgYkhDLtd+Uad8ZFK1T9D5+pNxnXQjCeJlGE=
|
github.com/mdlayher/sdnotify v1.0.0/go.mod h1:HQUmpM4XgYkhDLtd+Uad8ZFK1T9D5+pNxnXQjCeJlGE=
|
||||||
github.com/mdlayher/socket v0.5.1 h1:VZaqt6RkGkt2OE9l3GcC6nZkqD3xKeQLyfleW/uBcos=
|
github.com/mdlayher/socket v0.5.1 h1:VZaqt6RkGkt2OE9l3GcC6nZkqD3xKeQLyfleW/uBcos=
|
||||||
github.com/mdlayher/socket v0.5.1/go.mod h1:TjPLHI1UgwEv5J1B5q0zTZq12A/6H7nKmtTanQE37IQ=
|
github.com/mdlayher/socket v0.5.1/go.mod h1:TjPLHI1UgwEv5J1B5q0zTZq12A/6H7nKmtTanQE37IQ=
|
||||||
github.com/metacubex/utls v1.8.3 h1:0m/yCxm3SK6kWve2lKiFb1pue1wHitJ8sQQD4Ikqde4=
|
github.com/metacubex/utls v1.8.0 h1:mSYi6FMnmc5riARl5UZDmWVy710z+P5b7xuGW0lV9ac=
|
||||||
github.com/metacubex/utls v1.8.3/go.mod h1:kncGGVhFaoGn5M3pFe3SXhZCzsbCJayNOH4UEqTKTko=
|
github.com/metacubex/utls v1.8.0/go.mod h1:FdjYzVfCtgtna19hX0ER1Xsa5uJInwdQ4IcaaI98lEQ=
|
||||||
github.com/mholt/acmez/v3 v3.1.2 h1:auob8J/0FhmdClQicvJvuDavgd5ezwLBfKuYmynhYzc=
|
github.com/mholt/acmez/v3 v3.1.2 h1:auob8J/0FhmdClQicvJvuDavgd5ezwLBfKuYmynhYzc=
|
||||||
github.com/mholt/acmez/v3 v3.1.2/go.mod h1:L1wOU06KKvq7tswuMDwKdcHeKpFFgkppZy/y0DFxagQ=
|
github.com/mholt/acmez/v3 v3.1.2/go.mod h1:L1wOU06KKvq7tswuMDwKdcHeKpFFgkppZy/y0DFxagQ=
|
||||||
github.com/miekg/dns v1.1.67 h1:kg0EHj0G4bfT5/oOys6HhZw4vmMlnoZ+gDu8tJ/AlI0=
|
github.com/miekg/dns v1.1.67 h1:kg0EHj0G4bfT5/oOys6HhZw4vmMlnoZ+gDu8tJ/AlI0=
|
||||||
@@ -132,8 +126,6 @@ github.com/mitchellh/go-ps v1.0.0 h1:i6ampVEEF4wQFF+bkYfwYgY+F/uYJDktmvLPf7qIgjc
|
|||||||
github.com/mitchellh/go-ps v1.0.0/go.mod h1:J4lOc8z8yJs6vUwklHw2XEIiT4z4C40KtWVN3nvg8Pg=
|
github.com/mitchellh/go-ps v1.0.0/go.mod h1:J4lOc8z8yJs6vUwklHw2XEIiT4z4C40KtWVN3nvg8Pg=
|
||||||
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 h1:zYyBkD/k9seD2A7fsi6Oo2LfFZAehjjQMERAvZLEDnQ=
|
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 h1:zYyBkD/k9seD2A7fsi6Oo2LfFZAehjjQMERAvZLEDnQ=
|
||||||
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646/go.mod h1:jpp1/29i3P1S/RLdc7JQKbRpFeM1dOBd8T9ki5s+AY8=
|
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646/go.mod h1:jpp1/29i3P1S/RLdc7JQKbRpFeM1dOBd8T9ki5s+AY8=
|
||||||
github.com/openai/openai-go/v3 v3.13.0 h1:arSFmVHcBHNVYG5iqspPJrLoin0Qqn2JcCLWWcTcM1Q=
|
|
||||||
github.com/openai/openai-go/v3 v3.13.0/go.mod h1:cdufnVK14cWcT9qA1rRtrXx4FTRsgbDPW7Ia7SS5cZo=
|
|
||||||
github.com/oschwald/maxminddb-golang v1.13.1 h1:G3wwjdN9JmIK2o/ermkHM+98oX5fS+k5MbwsmL4MRQE=
|
github.com/oschwald/maxminddb-golang v1.13.1 h1:G3wwjdN9JmIK2o/ermkHM+98oX5fS+k5MbwsmL4MRQE=
|
||||||
github.com/oschwald/maxminddb-golang v1.13.1/go.mod h1:K4pgV9N/GcK694KSTmVSDTODk4IsCNThNdTmnaBZ/F8=
|
github.com/oschwald/maxminddb-golang v1.13.1/go.mod h1:K4pgV9N/GcK694KSTmVSDTODk4IsCNThNdTmnaBZ/F8=
|
||||||
github.com/pierrec/lz4/v4 v4.1.21 h1:yOVMLb6qSIDP67pl/5F7RepeKYu/VmTyEXvuMI5d9mQ=
|
github.com/pierrec/lz4/v4 v4.1.21 h1:yOVMLb6qSIDP67pl/5F7RepeKYu/VmTyEXvuMI5d9mQ=
|
||||||
@@ -143,8 +135,8 @@ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRI
|
|||||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
github.com/prometheus-community/pro-bing v0.4.0 h1:YMbv+i08gQz97OZZBwLyvmmQEEzyfyrrjEaAchdy3R4=
|
github.com/prometheus-community/pro-bing v0.4.0 h1:YMbv+i08gQz97OZZBwLyvmmQEEzyfyrrjEaAchdy3R4=
|
||||||
github.com/prometheus-community/pro-bing v0.4.0/go.mod h1:b7wRYZtCcPmt4Sz319BykUU241rWLe1VFXyiyWK/dH4=
|
github.com/prometheus-community/pro-bing v0.4.0/go.mod h1:b7wRYZtCcPmt4Sz319BykUU241rWLe1VFXyiyWK/dH4=
|
||||||
github.com/quic-go/qpack v0.6.0 h1:g7W+BMYynC1LbYLSqRt8PBg5Tgwxn214ZZR34VIOjz8=
|
github.com/quic-go/qpack v0.5.1 h1:giqksBPnT/HDtZ6VhtFKgoLOWmlyo9Ei6u9PqzIMbhI=
|
||||||
github.com/quic-go/qpack v0.6.0/go.mod h1:lUpLKChi8njB4ty2bFLX2x4gzDqXwUpaO1DP9qMDZII=
|
github.com/quic-go/qpack v0.5.1/go.mod h1:+PC4XFrEskIVkcLzpEkbLqq1uCoxPhQuvK5rH1ZgaEg=
|
||||||
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||||
github.com/safchain/ethtool v0.3.0 h1:gimQJpsI6sc1yIqP/y8GYgiXn/NjgvpM0RNoWLVVmP0=
|
github.com/safchain/ethtool v0.3.0 h1:gimQJpsI6sc1yIqP/y8GYgiXn/NjgvpM0RNoWLVVmP0=
|
||||||
github.com/safchain/ethtool v0.3.0/go.mod h1:SA9BwrgyAqNo7M+uaL6IYbxpm5wk3L7Mm6ocLW+CJUs=
|
github.com/safchain/ethtool v0.3.0/go.mod h1:SA9BwrgyAqNo7M+uaL6IYbxpm5wk3L7Mm6ocLW+CJUs=
|
||||||
@@ -154,87 +146,39 @@ github.com/sagernet/bbolt v0.0.0-20231014093535-ea5cb2fe9f0a h1:+NkI2670SQpQWvkk
|
|||||||
github.com/sagernet/bbolt v0.0.0-20231014093535-ea5cb2fe9f0a/go.mod h1:63s7jpZqcDAIpj8oI/1v4Izok+npJOHACFCU6+huCkM=
|
github.com/sagernet/bbolt v0.0.0-20231014093535-ea5cb2fe9f0a/go.mod h1:63s7jpZqcDAIpj8oI/1v4Izok+npJOHACFCU6+huCkM=
|
||||||
github.com/sagernet/cors v1.2.1 h1:Cv5Z8y9YSD6Gm+qSpNrL3LO4lD3eQVvbFYJSG7JCMHQ=
|
github.com/sagernet/cors v1.2.1 h1:Cv5Z8y9YSD6Gm+qSpNrL3LO4lD3eQVvbFYJSG7JCMHQ=
|
||||||
github.com/sagernet/cors v1.2.1/go.mod h1:O64VyOjjhrkLmQIjF4KGRrJO/5dVXFdpEmCW/eISRAI=
|
github.com/sagernet/cors v1.2.1/go.mod h1:O64VyOjjhrkLmQIjF4KGRrJO/5dVXFdpEmCW/eISRAI=
|
||||||
github.com/sagernet/cronet-go v0.0.0-20251219080614-460b6a5fb79d h1:Wfs4UEnHE3d0hHHG1NedCCwU2lUVlsgKblBGuOps8k4=
|
|
||||||
github.com/sagernet/cronet-go v0.0.0-20251219080614-460b6a5fb79d/go.mod h1:hwFHBEjjthyEquDULbr4c4ucMedp8Drb6Jvm2kt/0Bw=
|
|
||||||
github.com/sagernet/cronet-go/all v0.0.0-20251219080614-460b6a5fb79d h1:DZy1I3zKP5bRaFGDYStZWAXrtlxn3W4ONbFUD027sw8=
|
|
||||||
github.com/sagernet/cronet-go/all v0.0.0-20251219080614-460b6a5fb79d/go.mod h1:eKeQLIddaQGZD2/jc0t+AdTnHve3Yo+uMujwgNOCfz0=
|
|
||||||
github.com/sagernet/cronet-go/lib/android_386 v0.0.0-20251219080137-fbc9bf07b76b h1:+WRqXRiHEom7+lZUEA4qPVfNQB7Rx4++6JEN8cd5CgQ=
|
|
||||||
github.com/sagernet/cronet-go/lib/android_386 v0.0.0-20251219080137-fbc9bf07b76b/go.mod h1:XXDwdjX/T8xftoeJxQmbBoYXZp8MAPFR2CwbFuTpEtw=
|
|
||||||
github.com/sagernet/cronet-go/lib/android_amd64 v0.0.0-20251219080137-fbc9bf07b76b h1:ofD/ZwijuG5ccz0afLcvbfssIG+q/Bp8A2sziYYlJ28=
|
|
||||||
github.com/sagernet/cronet-go/lib/android_amd64 v0.0.0-20251219080137-fbc9bf07b76b/go.mod h1:iNiUGoLtnr8/JTuVNj7XJbmpOAp2C6+B81KDrPxwaZM=
|
|
||||||
github.com/sagernet/cronet-go/lib/android_arm v0.0.0-20251219080137-fbc9bf07b76b h1:m3Hv8Hs6x6JdFNe93nzh1XhdZ7DmkfOKheloDmQmGQo=
|
|
||||||
github.com/sagernet/cronet-go/lib/android_arm v0.0.0-20251219080137-fbc9bf07b76b/go.mod h1:19ILNUOGIzRdOqa2mq+iY0JoHxuieB7/lnjYeaA2vEc=
|
|
||||||
github.com/sagernet/cronet-go/lib/android_arm64 v0.0.0-20251219080137-fbc9bf07b76b h1:gA8bzjowa5Lmih+hBjjh6xsjghmGTIojKNtPzVDG93A=
|
|
||||||
github.com/sagernet/cronet-go/lib/android_arm64 v0.0.0-20251219080137-fbc9bf07b76b/go.mod h1:JxzGyQf94Cr6sBShKqODGDyRUlESfJK/Njcz9Lz6qMQ=
|
|
||||||
github.com/sagernet/cronet-go/lib/darwin_amd64 v0.0.0-20251219080137-fbc9bf07b76b h1:0ASeUCDj66dAHaCU/HkgbuSm/1co+yHbrq13BokW/us=
|
|
||||||
github.com/sagernet/cronet-go/lib/darwin_amd64 v0.0.0-20251219080137-fbc9bf07b76b/go.mod h1:KN+9T9TBycGOLzmKU4QdcHAJEj6Nlx48ifnlTvvHMvs=
|
|
||||||
github.com/sagernet/cronet-go/lib/darwin_arm64 v0.0.0-20251219080137-fbc9bf07b76b h1:NsbDT3L2pLS0Qsh0MPEn+IPkL33XoL7eFs56EA0jBeo=
|
|
||||||
github.com/sagernet/cronet-go/lib/darwin_arm64 v0.0.0-20251219080137-fbc9bf07b76b/go.mod h1:kojvtUc29KKnk8hs2QIANynVR59921SnGWA9kXohHc0=
|
|
||||||
github.com/sagernet/cronet-go/lib/ios_amd64_simulator v0.0.0-20251219080137-fbc9bf07b76b h1:hIMIG2AuF3n9yelPvfUB3jyW2vWJnPiJfhE3hGUGJDk=
|
|
||||||
github.com/sagernet/cronet-go/lib/ios_amd64_simulator v0.0.0-20251219080137-fbc9bf07b76b/go.mod h1:hkQzRE5GDbaH1/ioqYh0Taho4L6i0yLRCVEZ5xHz5M0=
|
|
||||||
github.com/sagernet/cronet-go/lib/ios_arm64 v0.0.0-20251219080137-fbc9bf07b76b h1:/l1dS38ijnn0IHtAdFH3Y8cahAGw6ii0TYow0jUNBGM=
|
|
||||||
github.com/sagernet/cronet-go/lib/ios_arm64 v0.0.0-20251219080137-fbc9bf07b76b/go.mod h1:tzVJFTOm66UxLxy6K0ZN5Ic2PC79e+sKKnt+V9puEa4=
|
|
||||||
github.com/sagernet/cronet-go/lib/ios_arm64_simulator v0.0.0-20251219080137-fbc9bf07b76b h1:m29qbSNfdNuTYEgTkph9TQUIyu7wIrY3PAvbgl23OjA=
|
|
||||||
github.com/sagernet/cronet-go/lib/ios_arm64_simulator v0.0.0-20251219080137-fbc9bf07b76b/go.mod h1:M/pN6m3j0HFU6/y83n0HU6GLYys3tYdr/xTE8hVEGMo=
|
|
||||||
github.com/sagernet/cronet-go/lib/linux_386 v0.0.0-20251219080137-fbc9bf07b76b h1:mmOPED30mKTr0DucTYQeJBHtjAgvBO7huwdG3gL6Gyw=
|
|
||||||
github.com/sagernet/cronet-go/lib/linux_386 v0.0.0-20251219080137-fbc9bf07b76b/go.mod h1:cGh5hO6eljCo6KMQ/Cel8Xgq4+etL0awZLRBDVG1EZQ=
|
|
||||||
github.com/sagernet/cronet-go/lib/linux_386_musl v0.0.0-20251219080137-fbc9bf07b76b h1:y7V2c5QwMY07ME/M+cI/W1ZNw2QFT2oMw99GaPtK0MY=
|
|
||||||
github.com/sagernet/cronet-go/lib/linux_386_musl v0.0.0-20251219080137-fbc9bf07b76b/go.mod h1:JFE0/cxaKkx0wqPMZU7MgaplQlU0zudv82dROJjClKU=
|
|
||||||
github.com/sagernet/cronet-go/lib/linux_amd64 v0.0.0-20251219080137-fbc9bf07b76b h1:txNHLfT1miemCZgCrtrA+eTbGfsfN46wHIpOShALNzI=
|
|
||||||
github.com/sagernet/cronet-go/lib/linux_amd64 v0.0.0-20251219080137-fbc9bf07b76b/go.mod h1:vU8VftFeSt7fURCa3JXD6+k6ss1YAX+idQjPvHmJ2tI=
|
|
||||||
github.com/sagernet/cronet-go/lib/linux_amd64_musl v0.0.0-20251219080137-fbc9bf07b76b h1:FVPZ3TKAoIeM1hTCqUn0D7gHx6rDkKqhx+E8yaYNbXI=
|
|
||||||
github.com/sagernet/cronet-go/lib/linux_amd64_musl v0.0.0-20251219080137-fbc9bf07b76b/go.mod h1:vCe4OUuL+XOUge9v3MyTD45BnuAXiH+DkjN9quDXJzQ=
|
|
||||||
github.com/sagernet/cronet-go/lib/linux_arm v0.0.0-20251219080137-fbc9bf07b76b h1:4ei7Sz97XCFXh+FUi2cKGHrhqD0A8lxdjZxST7NzDrQ=
|
|
||||||
github.com/sagernet/cronet-go/lib/linux_arm v0.0.0-20251219080137-fbc9bf07b76b/go.mod h1:w9amBWrvjtohQzBGCKJ7LCh22LhTIJs4sE7cYaKQzM0=
|
|
||||||
github.com/sagernet/cronet-go/lib/linux_arm64 v0.0.0-20251219080137-fbc9bf07b76b h1:W0SrTDGPaKfcgjiZDkYeWqpICeVkwydaa228znP4q2c=
|
|
||||||
github.com/sagernet/cronet-go/lib/linux_arm64 v0.0.0-20251219080137-fbc9bf07b76b/go.mod h1:TqlsFtcYS/etTeck46kHBeT8Le0Igw1Q/AV88UnMS3s=
|
|
||||||
github.com/sagernet/cronet-go/lib/linux_arm64_musl v0.0.0-20251219080137-fbc9bf07b76b h1:WD7V83I/FDatR0zXq6gSxh8gGZCD+fUZjLb1f+OVuF0=
|
|
||||||
github.com/sagernet/cronet-go/lib/linux_arm64_musl v0.0.0-20251219080137-fbc9bf07b76b/go.mod h1:B6Qd0vys8sv9OKVRN6J9RqDzYRGE938Fb2zrYdBDyTQ=
|
|
||||||
github.com/sagernet/cronet-go/lib/linux_arm_musl v0.0.0-20251219080137-fbc9bf07b76b h1:M1V7j6Bke+v9aXeEK/NcWqoPwl84h97fmL3XSJJmNJw=
|
|
||||||
github.com/sagernet/cronet-go/lib/linux_arm_musl v0.0.0-20251219080137-fbc9bf07b76b/go.mod h1:3tXMMFY7AHugOVBZ5Al7cL7JKsnFOe5bMVr0hZPk3ow=
|
|
||||||
github.com/sagernet/cronet-go/lib/tvos_amd64_simulator v0.0.0-20251219080137-fbc9bf07b76b h1:DmLB0sgGw7vNao08a7NJ0xMJbZpeL49rAphknfRRs5I=
|
|
||||||
github.com/sagernet/cronet-go/lib/tvos_amd64_simulator v0.0.0-20251219080137-fbc9bf07b76b/go.mod h1:aaX0YGl8nhGmfRWI8bc3BtDjY8Vzx6O0cS/e1uqxDq4=
|
|
||||||
github.com/sagernet/cronet-go/lib/tvos_arm64 v0.0.0-20251219080137-fbc9bf07b76b h1:j8tKUY2VVnK/RxIvX75G/nLGu53to6LaDRH/NTzyLDw=
|
|
||||||
github.com/sagernet/cronet-go/lib/tvos_arm64 v0.0.0-20251219080137-fbc9bf07b76b/go.mod h1:EdzMKA96xITc42QEI+ct4SwqX8Dn3ltKK8wzdkLWpSc=
|
|
||||||
github.com/sagernet/cronet-go/lib/tvos_arm64_simulator v0.0.0-20251219080137-fbc9bf07b76b h1:+1hjEBE2hUGUxDKtNg+gBYYCHXPQao273PjimC67v38=
|
|
||||||
github.com/sagernet/cronet-go/lib/tvos_arm64_simulator v0.0.0-20251219080137-fbc9bf07b76b/go.mod h1:qix4kv1TTAJ5tY4lJ9vjhe9EY4mM+B7H5giOhbxDVcc=
|
|
||||||
github.com/sagernet/cronet-go/lib/windows_amd64 v0.0.0-20251219080137-fbc9bf07b76b h1:22Jx/y6cz2lVeUwbN/lmNOUjhEWYpohGEYpW/zdDcBk=
|
|
||||||
github.com/sagernet/cronet-go/lib/windows_amd64 v0.0.0-20251219080137-fbc9bf07b76b/go.mod h1:lm9w/oCCRyBiUa3G8lDQTT8x/ONUvgVR2iV9fVzUZB8=
|
|
||||||
github.com/sagernet/cronet-go/lib/windows_arm64 v0.0.0-20251219080137-fbc9bf07b76b h1:7juUKsCbreYSP8gALPf45kut0zdSpZXrk2TLIwQ2zOo=
|
|
||||||
github.com/sagernet/cronet-go/lib/windows_arm64 v0.0.0-20251219080137-fbc9bf07b76b/go.mod h1:n34YyLgapgjWdKa0IoeczjAFCwD3/dxbsH5sucKw0bw=
|
|
||||||
github.com/sagernet/fswatch v0.1.1 h1:YqID+93B7VRfqIH3PArW/XpJv5H4OLEVWDfProGoRQs=
|
github.com/sagernet/fswatch v0.1.1 h1:YqID+93B7VRfqIH3PArW/XpJv5H4OLEVWDfProGoRQs=
|
||||||
github.com/sagernet/fswatch v0.1.1/go.mod h1:nz85laH0mkQqJfaOrqPpkwtU1znMFNVTpT/5oRsVz/o=
|
github.com/sagernet/fswatch v0.1.1/go.mod h1:nz85laH0mkQqJfaOrqPpkwtU1znMFNVTpT/5oRsVz/o=
|
||||||
github.com/sagernet/gomobile v0.1.10 h1:ElqZ0OVDvyQlU91MU0C9cfU0FrILBbc65+NOKzZ1t0c=
|
github.com/sagernet/gomobile v0.1.8 h1:vXgoN0pjsMONAaYCTdsKBX2T1kxuS7sbT/mZ7PElGoo=
|
||||||
github.com/sagernet/gomobile v0.1.10/go.mod h1:A8l3FlHi2D/+mfcd4HHvk5DGFPW/ShFb9jHP5VmSiDY=
|
github.com/sagernet/gomobile v0.1.8/go.mod h1:A8l3FlHi2D/+mfcd4HHvk5DGFPW/ShFb9jHP5VmSiDY=
|
||||||
github.com/sagernet/gvisor v0.0.0-20250811.0-sing-box-mod.1 h1:AzCE2RhBjLJ4WIWc/GejpNh+z30d5H1hwaB0nD9eY3o=
|
github.com/sagernet/gvisor v0.0.0-20250811.0-sing-box-mod.1 h1:AzCE2RhBjLJ4WIWc/GejpNh+z30d5H1hwaB0nD9eY3o=
|
||||||
github.com/sagernet/gvisor v0.0.0-20250811.0-sing-box-mod.1/go.mod h1:NJKBtm9nVEK3iyOYWsUlrDQuoGh4zJ4KOPhSYVidvQ4=
|
github.com/sagernet/gvisor v0.0.0-20250811.0-sing-box-mod.1/go.mod h1:NJKBtm9nVEK3iyOYWsUlrDQuoGh4zJ4KOPhSYVidvQ4=
|
||||||
github.com/sagernet/netlink v0.0.0-20240612041022-b9a21c07ac6a h1:ObwtHN2VpqE0ZNjr6sGeT00J8uU7JF4cNUdb44/Duis=
|
github.com/sagernet/netlink v0.0.0-20240612041022-b9a21c07ac6a h1:ObwtHN2VpqE0ZNjr6sGeT00J8uU7JF4cNUdb44/Duis=
|
||||||
github.com/sagernet/netlink v0.0.0-20240612041022-b9a21c07ac6a/go.mod h1:xLnfdiJbSp8rNqYEdIW/6eDO4mVoogml14Bh2hSiFpM=
|
github.com/sagernet/netlink v0.0.0-20240612041022-b9a21c07ac6a/go.mod h1:xLnfdiJbSp8rNqYEdIW/6eDO4mVoogml14Bh2hSiFpM=
|
||||||
github.com/sagernet/nftables v0.3.0-beta.4 h1:kbULlAwAC3jvdGAC1P5Fa3GSxVwQJibNenDW2zaXr8I=
|
github.com/sagernet/nftables v0.3.0-beta.4 h1:kbULlAwAC3jvdGAC1P5Fa3GSxVwQJibNenDW2zaXr8I=
|
||||||
github.com/sagernet/nftables v0.3.0-beta.4/go.mod h1:OQXAjvjNGGFxaTgVCSTRIhYB5/llyVDeapVoENYBDS8=
|
github.com/sagernet/nftables v0.3.0-beta.4/go.mod h1:OQXAjvjNGGFxaTgVCSTRIhYB5/llyVDeapVoENYBDS8=
|
||||||
github.com/sagernet/quic-go v0.57.1-sing-box-mod.3 h1:Rah/tDukrowqlznHQgXD4E9/yEsVsEMIxBZzS2NorGc=
|
github.com/sagernet/quic-go v0.54.0-sing-box-mod.3 h1:12pJN/zdpRltLG8l8JA65QYy/a+Mz938yAN3ZQUinbo=
|
||||||
github.com/sagernet/quic-go v0.57.1-sing-box-mod.3/go.mod h1:OqILvS182CyOol5zNNo6bguvOGgXzV459+chpRaUC+4=
|
github.com/sagernet/quic-go v0.54.0-sing-box-mod.3/go.mod h1:OV+V5kEBb8kJS7k29MzDu6oj9GyMc7HA07sE1tedxz4=
|
||||||
github.com/sagernet/sing v0.6.9/go.mod h1:ARkL0gM13/Iv5VCZmci/NuoOlePoIsW0m7BWfln/Hak=
|
github.com/sagernet/sing v0.6.9/go.mod h1:ARkL0gM13/Iv5VCZmci/NuoOlePoIsW0m7BWfln/Hak=
|
||||||
github.com/sagernet/sing v0.8.0-beta.6.0.20251207063731-56fd482ce1c6 h1:EYaDzllFzNYnzQ9xH/ieSAXct4wQ8pD45kgNMo7RPZc=
|
github.com/sagernet/sing v0.8.0-beta.5 h1:Cm4CnLQGNyG5Jl1U9pKWAjFUcbjchGGqn1xeXzfI5kw=
|
||||||
github.com/sagernet/sing v0.8.0-beta.6.0.20251207063731-56fd482ce1c6/go.mod h1:ARkL0gM13/Iv5VCZmci/NuoOlePoIsW0m7BWfln/Hak=
|
github.com/sagernet/sing v0.8.0-beta.5/go.mod h1:ARkL0gM13/Iv5VCZmci/NuoOlePoIsW0m7BWfln/Hak=
|
||||||
github.com/sagernet/sing-mux v0.3.3 h1:YFgt9plMWzH994BMZLmyKL37PdIVaIilwP0Jg+EcLfw=
|
github.com/sagernet/sing-mux v0.3.3 h1:YFgt9plMWzH994BMZLmyKL37PdIVaIilwP0Jg+EcLfw=
|
||||||
github.com/sagernet/sing-mux v0.3.3/go.mod h1:pht8iFY4c9Xltj7rhVd208npkNaeCxzyXCgulDPLUDA=
|
github.com/sagernet/sing-mux v0.3.3/go.mod h1:pht8iFY4c9Xltj7rhVd208npkNaeCxzyXCgulDPLUDA=
|
||||||
github.com/sagernet/sing-quic v0.6.0-beta.5.0.20251218085114-6968f531a8c0 h1:YNXy008FFkVwfNjCR8GlVTlHbBXPwv8Y4ytDnSFUSDo=
|
github.com/sagernet/sing-quic v0.6.0-beta.3 h1:Z2vt49f9vNtHc9BbF9foI859n4+NAOV3gBeB1LuzL1Q=
|
||||||
github.com/sagernet/sing-quic v0.6.0-beta.5.0.20251218085114-6968f531a8c0/go.mod h1:Y3YVjPutLHLQvYjGtUFH+w8YmM4MTd19NDzxLZGNGIs=
|
github.com/sagernet/sing-quic v0.6.0-beta.3/go.mod h1:2/swrSS6wG6MyQA5Blq31VEWitHgBju+yZE8cPK1J5I=
|
||||||
github.com/sagernet/sing-shadowsocks v0.2.8 h1:PURj5PRoAkqeHh2ZW205RWzN9E9RtKCVCzByXruQWfE=
|
github.com/sagernet/sing-shadowsocks v0.2.8 h1:PURj5PRoAkqeHh2ZW205RWzN9E9RtKCVCzByXruQWfE=
|
||||||
github.com/sagernet/sing-shadowsocks v0.2.8/go.mod h1:lo7TWEMDcN5/h5B8S0ew+r78ZODn6SwVaFhvB6H+PTI=
|
github.com/sagernet/sing-shadowsocks v0.2.8/go.mod h1:lo7TWEMDcN5/h5B8S0ew+r78ZODn6SwVaFhvB6H+PTI=
|
||||||
github.com/sagernet/sing-shadowsocks2 v0.2.1 h1:dWV9OXCeFPuYGHb6IRqlSptVnSzOelnqqs2gQ2/Qioo=
|
github.com/sagernet/sing-shadowsocks2 v0.2.1 h1:dWV9OXCeFPuYGHb6IRqlSptVnSzOelnqqs2gQ2/Qioo=
|
||||||
github.com/sagernet/sing-shadowsocks2 v0.2.1/go.mod h1:RnXS0lExcDAovvDeniJ4IKa2IuChrdipolPYWBv9hWQ=
|
github.com/sagernet/sing-shadowsocks2 v0.2.1/go.mod h1:RnXS0lExcDAovvDeniJ4IKa2IuChrdipolPYWBv9hWQ=
|
||||||
github.com/sagernet/sing-shadowtls v0.2.1-0.20250503051639-fcd445d33c11 h1:tK+75l64tm9WvEFrYRE1t0YxoFdWQqw/h7Uhzj0vJ+w=
|
github.com/sagernet/sing-shadowtls v0.2.1-0.20250503051639-fcd445d33c11 h1:tK+75l64tm9WvEFrYRE1t0YxoFdWQqw/h7Uhzj0vJ+w=
|
||||||
github.com/sagernet/sing-shadowtls v0.2.1-0.20250503051639-fcd445d33c11/go.mod h1:sWqKnGlMipCHaGsw1sTTlimyUpgzP4WP3pjhCsYt9oA=
|
github.com/sagernet/sing-shadowtls v0.2.1-0.20250503051639-fcd445d33c11/go.mod h1:sWqKnGlMipCHaGsw1sTTlimyUpgzP4WP3pjhCsYt9oA=
|
||||||
github.com/sagernet/sing-tun v0.8.0-beta.11.0.20251201004738-e9e3fbf0c15e h1:ZEv+9vy7vC1vbr3LfwZGx3JAOkl/w4+hnGamHw4W36M=
|
github.com/sagernet/sing-tun v0.8.0-beta.10 h1:sHqSXTvzKPDF67AwZdoBV5FA91tFdWGfA1AbenIbpA4=
|
||||||
github.com/sagernet/sing-tun v0.8.0-beta.11.0.20251201004738-e9e3fbf0c15e/go.mod h1:eWETzl4AwaxGKiZTpDIDVJLTBz9cfIdoZwaZY1jlSjg=
|
github.com/sagernet/sing-tun v0.8.0-beta.10/go.mod h1:eWETzl4AwaxGKiZTpDIDVJLTBz9cfIdoZwaZY1jlSjg=
|
||||||
github.com/sagernet/sing-vmess v0.2.8-0.20250909125414-3aed155119a1 h1:aSwUNYUkVyVvdmBSufR8/nRFonwJeKSIROxHcm5br9o=
|
github.com/sagernet/sing-vmess v0.2.8-0.20250909125414-3aed155119a1 h1:aSwUNYUkVyVvdmBSufR8/nRFonwJeKSIROxHcm5br9o=
|
||||||
github.com/sagernet/sing-vmess v0.2.8-0.20250909125414-3aed155119a1/go.mod h1:P11scgTxMxVVQ8dlM27yNm3Cro40mD0+gHbnqrNGDuY=
|
github.com/sagernet/sing-vmess v0.2.8-0.20250909125414-3aed155119a1/go.mod h1:P11scgTxMxVVQ8dlM27yNm3Cro40mD0+gHbnqrNGDuY=
|
||||||
github.com/sagernet/smux v1.5.34-mod.2 h1:gkmBjIjlJ2zQKpLigOkFur5kBKdV6bNRoFu2WkltRQ4=
|
github.com/sagernet/smux v1.5.34-mod.2 h1:gkmBjIjlJ2zQKpLigOkFur5kBKdV6bNRoFu2WkltRQ4=
|
||||||
github.com/sagernet/smux v1.5.34-mod.2/go.mod h1:0KW0+R+ycvA2INW4gbsd7BNyg+HEfLIAxa5N02/28Zc=
|
github.com/sagernet/smux v1.5.34-mod.2/go.mod h1:0KW0+R+ycvA2INW4gbsd7BNyg+HEfLIAxa5N02/28Zc=
|
||||||
github.com/sagernet/tailscale v1.86.5-sing-box-1.13-mod.4 h1:Ceg+9Ug+qAFgEchGodlHmMOY2h7KktQQDAyuoIsPbos=
|
github.com/sagernet/tailscale v1.86.5-sing-box-1.13-mod.3 h1:OGoHEw76F3F4keIGcOwB/5U+P1N3i+hLlgC7rvSnub0=
|
||||||
github.com/sagernet/tailscale v1.86.5-sing-box-1.13-mod.4/go.mod h1:YdN/avjce8sqPFLT9E1uEh8gPewNSnC41U4ZhBJ+ACw=
|
github.com/sagernet/tailscale v1.86.5-sing-box-1.13-mod.3/go.mod h1:YdN/avjce8sqPFLT9E1uEh8gPewNSnC41U4ZhBJ+ACw=
|
||||||
github.com/sagernet/wireguard-go v0.0.2-beta.1.0.20250917110311-16510ac47288 h1:E2tZFeg9mGYGQ7E7BbxMv1cU35HxwgRm6tPKI2Pp7DA=
|
github.com/sagernet/wireguard-go v0.0.2-beta.1.0.20250917110311-16510ac47288 h1:E2tZFeg9mGYGQ7E7BbxMv1cU35HxwgRm6tPKI2Pp7DA=
|
||||||
github.com/sagernet/wireguard-go v0.0.2-beta.1.0.20250917110311-16510ac47288/go.mod h1:WUxgxUDZoCF2sxVmW+STSxatP02Qn3FcafTiI2BLtE0=
|
github.com/sagernet/wireguard-go v0.0.2-beta.1.0.20250917110311-16510ac47288/go.mod h1:WUxgxUDZoCF2sxVmW+STSxatP02Qn3FcafTiI2BLtE0=
|
||||||
github.com/sagernet/ws v0.0.0-20231204124109-acfe8907c854 h1:6uUiZcDRnZSAegryaUGwPC/Fj13JSHwiTftrXhMmYOc=
|
github.com/sagernet/ws v0.0.0-20231204124109-acfe8907c854 h1:6uUiZcDRnZSAegryaUGwPC/Fj13JSHwiTftrXhMmYOc=
|
||||||
@@ -272,16 +216,6 @@ github.com/tailscale/wireguard-go v0.0.0-20250716170648-1d0488a3d7da h1:jVRUZPRs
|
|||||||
github.com/tailscale/wireguard-go v0.0.0-20250716170648-1d0488a3d7da/go.mod h1:BOm5fXUBFM+m9woLNBoxI9TaBXXhGNP50LX/TGIvGb4=
|
github.com/tailscale/wireguard-go v0.0.0-20250716170648-1d0488a3d7da/go.mod h1:BOm5fXUBFM+m9woLNBoxI9TaBXXhGNP50LX/TGIvGb4=
|
||||||
github.com/tc-hib/winres v0.2.1 h1:YDE0FiP0VmtRaDn7+aaChp1KiF4owBiJa5l964l5ujA=
|
github.com/tc-hib/winres v0.2.1 h1:YDE0FiP0VmtRaDn7+aaChp1KiF4owBiJa5l964l5ujA=
|
||||||
github.com/tc-hib/winres v0.2.1/go.mod h1:C/JaNhH3KBvhNKVbvdlDWkbMDO9H4fKKDaN7/07SSuk=
|
github.com/tc-hib/winres v0.2.1/go.mod h1:C/JaNhH3KBvhNKVbvdlDWkbMDO9H4fKKDaN7/07SSuk=
|
||||||
github.com/tidwall/gjson v1.14.2/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
|
|
||||||
github.com/tidwall/gjson v1.18.0 h1:FIDeeyB800efLX89e5a8Y0BNH+LOngJyGrIWxG2FKQY=
|
|
||||||
github.com/tidwall/gjson v1.18.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
|
|
||||||
github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA=
|
|
||||||
github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
|
|
||||||
github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
|
|
||||||
github.com/tidwall/pretty v1.2.1 h1:qjsOFOWWQl+N3RsoF5/ssm1pHmJJwhjlSbZ51I6wMl4=
|
|
||||||
github.com/tidwall/pretty v1.2.1/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
|
|
||||||
github.com/tidwall/sjson v1.2.5 h1:kLy8mja+1c9jlljvWTlSazM7cKDRfJuR/bOJhcY5NcY=
|
|
||||||
github.com/tidwall/sjson v1.2.5/go.mod h1:Fvgq9kS/6ociJEDnK0Fk1cpYF4FIW6ZF7LAe+6jwd28=
|
|
||||||
github.com/u-root/uio v0.0.0-20240224005618-d2acac8f3701 h1:pyC9PaHYZFgEKFdlp3G8RaCKgVpHZnecvArXvPXcFkM=
|
github.com/u-root/uio v0.0.0-20240224005618-d2acac8f3701 h1:pyC9PaHYZFgEKFdlp3G8RaCKgVpHZnecvArXvPXcFkM=
|
||||||
github.com/u-root/uio v0.0.0-20240224005618-d2acac8f3701/go.mod h1:P3a5rG4X7tI17Nn3aOIAYr5HbIMukwXG0urG0WuL8OA=
|
github.com/u-root/uio v0.0.0-20240224005618-d2acac8f3701/go.mod h1:P3a5rG4X7tI17Nn3aOIAYr5HbIMukwXG0urG0WuL8OA=
|
||||||
github.com/vishvananda/netns v0.0.0-20200728191858-db3c7e526aae/go.mod h1:DD4vA1DwXk04H54A1oHXtwZmA0grkVMdPxx/VGLCah0=
|
github.com/vishvananda/netns v0.0.0-20200728191858-db3c7e526aae/go.mod h1:DD4vA1DwXk04H54A1oHXtwZmA0grkVMdPxx/VGLCah0=
|
||||||
|
|||||||
@@ -1,12 +0,0 @@
|
|||||||
//go:build with_ccm && (!darwin || cgo)
|
|
||||||
|
|
||||||
package include
|
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/sagernet/sing-box/adapter/service"
|
|
||||||
"github.com/sagernet/sing-box/service/ccm"
|
|
||||||
)
|
|
||||||
|
|
||||||
func registerCCMService(registry *service.Registry) {
|
|
||||||
ccm.RegisterService(registry)
|
|
||||||
}
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
//go:build !with_ccm
|
|
||||||
|
|
||||||
package include
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
|
|
||||||
"github.com/sagernet/sing-box/adapter"
|
|
||||||
"github.com/sagernet/sing-box/adapter/service"
|
|
||||||
C "github.com/sagernet/sing-box/constant"
|
|
||||||
"github.com/sagernet/sing-box/log"
|
|
||||||
"github.com/sagernet/sing-box/option"
|
|
||||||
E "github.com/sagernet/sing/common/exceptions"
|
|
||||||
)
|
|
||||||
|
|
||||||
func registerCCMService(registry *service.Registry) {
|
|
||||||
service.Register[option.CCMServiceOptions](registry, C.TypeCCM, func(ctx context.Context, logger log.ContextLogger, tag string, options option.CCMServiceOptions) (adapter.Service, error) {
|
|
||||||
return nil, E.New(`CCM is not included in this build, rebuild with -tags with_CCM`)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
//go:build with_ccm && darwin && !cgo
|
|
||||||
|
|
||||||
package include
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
|
|
||||||
"github.com/sagernet/sing-box/adapter"
|
|
||||||
"github.com/sagernet/sing-box/adapter/service"
|
|
||||||
C "github.com/sagernet/sing-box/constant"
|
|
||||||
"github.com/sagernet/sing-box/log"
|
|
||||||
"github.com/sagernet/sing-box/option"
|
|
||||||
E "github.com/sagernet/sing/common/exceptions"
|
|
||||||
)
|
|
||||||
|
|
||||||
func registerCCMService(registry *service.Registry) {
|
|
||||||
service.Register[option.CCMServiceOptions](registry, C.TypeCCM, func(ctx context.Context, logger log.ContextLogger, tag string, options option.CCMServiceOptions) (adapter.Service, error) {
|
|
||||||
return nil, E.New(`CCM requires CGO on darwin, rebuild with CGO_ENABLED=1`)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
//go:build with_naive_outbound
|
|
||||||
|
|
||||||
package include
|
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/sagernet/sing-box/adapter/outbound"
|
|
||||||
"github.com/sagernet/sing-box/protocol/naive"
|
|
||||||
)
|
|
||||||
|
|
||||||
func registerNaiveOutbound(registry *outbound.Registry) {
|
|
||||||
naive.RegisterOutbound(registry)
|
|
||||||
}
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
//go:build !with_naive_outbound
|
|
||||||
|
|
||||||
package include
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
|
|
||||||
"github.com/sagernet/sing-box/adapter"
|
|
||||||
"github.com/sagernet/sing-box/adapter/outbound"
|
|
||||||
C "github.com/sagernet/sing-box/constant"
|
|
||||||
"github.com/sagernet/sing-box/log"
|
|
||||||
"github.com/sagernet/sing-box/option"
|
|
||||||
E "github.com/sagernet/sing/common/exceptions"
|
|
||||||
)
|
|
||||||
|
|
||||||
func registerNaiveOutbound(registry *outbound.Registry) {
|
|
||||||
outbound.Register[option.NaiveOutboundOptions](registry, C.TypeNaive, func(ctx context.Context, router adapter.Router, logger log.ContextLogger, tag string, options option.NaiveOutboundOptions) (adapter.Outbound, error) {
|
|
||||||
return nil, E.New(`naive outbound is not included in this build, rebuild with -tags with_naive_outbound`)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
//go:build with_ocm
|
|
||||||
|
|
||||||
package include
|
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/sagernet/sing-box/adapter/service"
|
|
||||||
"github.com/sagernet/sing-box/service/ocm"
|
|
||||||
)
|
|
||||||
|
|
||||||
func registerOCMService(registry *service.Registry) {
|
|
||||||
ocm.RegisterService(registry)
|
|
||||||
}
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
//go:build !with_ocm
|
|
||||||
|
|
||||||
package include
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
|
|
||||||
"github.com/sagernet/sing-box/adapter"
|
|
||||||
"github.com/sagernet/sing-box/adapter/service"
|
|
||||||
C "github.com/sagernet/sing-box/constant"
|
|
||||||
"github.com/sagernet/sing-box/log"
|
|
||||||
"github.com/sagernet/sing-box/option"
|
|
||||||
E "github.com/sagernet/sing/common/exceptions"
|
|
||||||
)
|
|
||||||
|
|
||||||
func registerOCMService(registry *service.Registry) {
|
|
||||||
service.Register[option.OCMServiceOptions](registry, C.TypeOCM, func(ctx context.Context, logger log.ContextLogger, tag string, options option.OCMServiceOptions) (adapter.Service, error) {
|
|
||||||
return nil, E.New(`OCM is not included in this build, rebuild with -tags with_ocm`)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
@@ -44,7 +44,7 @@ func registerQUICInbounds(registry *inbound.Registry) {
|
|||||||
inbound.Register[option.Hysteria2InboundOptions](registry, C.TypeHysteria2, func(ctx context.Context, router adapter.Router, logger log.ContextLogger, tag string, options option.Hysteria2InboundOptions) (adapter.Inbound, error) {
|
inbound.Register[option.Hysteria2InboundOptions](registry, C.TypeHysteria2, func(ctx context.Context, router adapter.Router, logger log.ContextLogger, tag string, options option.Hysteria2InboundOptions) (adapter.Inbound, error) {
|
||||||
return nil, C.ErrQUICNotIncluded
|
return nil, C.ErrQUICNotIncluded
|
||||||
})
|
})
|
||||||
naive.ConfigureHTTP3ListenerFunc = func(ctx context.Context, logger logger.Logger, listener *listener.Listener, handler http.Handler, tlsConfig tls.ServerConfig, options option.NaiveInboundOptions) (io.Closer, error) {
|
naive.ConfigureHTTP3ListenerFunc = func(listener *listener.Listener, handler http.Handler, tlsConfig tls.ServerConfig, logger logger.Logger) (io.Closer, error) {
|
||||||
return nil, C.ErrQUICNotIncluded
|
return nil, C.ErrQUICNotIncluded
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -86,7 +86,6 @@ func OutboundRegistry() *outbound.Registry {
|
|||||||
shadowsocks.RegisterOutbound(registry)
|
shadowsocks.RegisterOutbound(registry)
|
||||||
vmess.RegisterOutbound(registry)
|
vmess.RegisterOutbound(registry)
|
||||||
trojan.RegisterOutbound(registry)
|
trojan.RegisterOutbound(registry)
|
||||||
registerNaiveOutbound(registry)
|
|
||||||
tor.RegisterOutbound(registry)
|
tor.RegisterOutbound(registry)
|
||||||
ssh.RegisterOutbound(registry)
|
ssh.RegisterOutbound(registry)
|
||||||
shadowtls.RegisterOutbound(registry)
|
shadowtls.RegisterOutbound(registry)
|
||||||
@@ -135,8 +134,6 @@ func ServiceRegistry() *service.Registry {
|
|||||||
ssmapi.RegisterService(registry)
|
ssmapi.RegisterService(registry)
|
||||||
|
|
||||||
registerDERPService(registry)
|
registerDERPService(registry)
|
||||||
registerCCMService(registry)
|
|
||||||
registerOCMService(registry)
|
|
||||||
|
|
||||||
return registry
|
return registry
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -158,7 +158,6 @@ nav:
|
|||||||
- Shadowsocks: configuration/outbound/shadowsocks.md
|
- Shadowsocks: configuration/outbound/shadowsocks.md
|
||||||
- VMess: configuration/outbound/vmess.md
|
- VMess: configuration/outbound/vmess.md
|
||||||
- Trojan: configuration/outbound/trojan.md
|
- Trojan: configuration/outbound/trojan.md
|
||||||
- Naive: configuration/outbound/naive.md
|
|
||||||
- WireGuard: configuration/outbound/wireguard.md
|
- WireGuard: configuration/outbound/wireguard.md
|
||||||
- Hysteria: configuration/outbound/hysteria.md
|
- Hysteria: configuration/outbound/hysteria.md
|
||||||
- ShadowTLS: configuration/outbound/shadowtls.md
|
- ShadowTLS: configuration/outbound/shadowtls.md
|
||||||
@@ -176,8 +175,6 @@ nav:
|
|||||||
- DERP: configuration/service/derp.md
|
- DERP: configuration/service/derp.md
|
||||||
- Resolved: configuration/service/resolved.md
|
- Resolved: configuration/service/resolved.md
|
||||||
- SSM API: configuration/service/ssm-api.md
|
- SSM API: configuration/service/ssm-api.md
|
||||||
- CCM: configuration/service/ccm.md
|
|
||||||
- OCM: configuration/service/ocm.md
|
|
||||||
markdown_extensions:
|
markdown_extensions:
|
||||||
- pymdownx.inlinehilite
|
- pymdownx.inlinehilite
|
||||||
- pymdownx.snippets
|
- pymdownx.snippets
|
||||||
|
|||||||
@@ -1,20 +0,0 @@
|
|||||||
package option
|
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/sagernet/sing/common/json/badoption"
|
|
||||||
)
|
|
||||||
|
|
||||||
type CCMServiceOptions struct {
|
|
||||||
ListenOptions
|
|
||||||
InboundTLSOptionsContainer
|
|
||||||
CredentialPath string `json:"credential_path,omitempty"`
|
|
||||||
Users []CCMUser `json:"users,omitempty"`
|
|
||||||
Headers badoption.HTTPHeader `json:"headers,omitempty"`
|
|
||||||
Detour string `json:"detour,omitempty"`
|
|
||||||
UsagesPath string `json:"usages_path,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type CCMUser struct {
|
|
||||||
Name string `json:"name,omitempty"`
|
|
||||||
Token string `json:"token,omitempty"`
|
|
||||||
}
|
|
||||||
@@ -65,7 +65,6 @@ type ListenOptions struct {
|
|||||||
RoutingMark FwMark `json:"routing_mark,omitempty"`
|
RoutingMark FwMark `json:"routing_mark,omitempty"`
|
||||||
ReuseAddr bool `json:"reuse_addr,omitempty"`
|
ReuseAddr bool `json:"reuse_addr,omitempty"`
|
||||||
NetNs string `json:"netns,omitempty"`
|
NetNs string `json:"netns,omitempty"`
|
||||||
DisableTCPKeepAlive bool `json:"disable_tcp_keep_alive,omitempty"`
|
|
||||||
TCPKeepAlive badoption.Duration `json:"tcp_keep_alive,omitempty"`
|
TCPKeepAlive badoption.Duration `json:"tcp_keep_alive,omitempty"`
|
||||||
TCPKeepAliveInterval badoption.Duration `json:"tcp_keep_alive_interval,omitempty"`
|
TCPKeepAliveInterval badoption.Duration `json:"tcp_keep_alive_interval,omitempty"`
|
||||||
TCPFastOpen bool `json:"tcp_fast_open,omitempty"`
|
TCPFastOpen bool `json:"tcp_fast_open,omitempty"`
|
||||||
|
|||||||
@@ -1,37 +1,10 @@
|
|||||||
package option
|
package option
|
||||||
|
|
||||||
import (
|
import "github.com/sagernet/sing/common/auth"
|
||||||
"github.com/sagernet/sing/common/auth"
|
|
||||||
"github.com/sagernet/sing/common/json/badoption"
|
|
||||||
)
|
|
||||||
|
|
||||||
type QuicheCongestionControl string
|
|
||||||
|
|
||||||
const (
|
|
||||||
QuicheCongestionControlDefault QuicheCongestionControl = ""
|
|
||||||
QuicheCongestionControlBBR QuicheCongestionControl = "TBBR"
|
|
||||||
QuicheCongestionControlBBRv2 QuicheCongestionControl = "B2ON"
|
|
||||||
QuicheCongestionControlCubic QuicheCongestionControl = "QBIC"
|
|
||||||
QuicheCongestionControlReno QuicheCongestionControl = "RENO"
|
|
||||||
)
|
|
||||||
|
|
||||||
type NaiveInboundOptions struct {
|
type NaiveInboundOptions struct {
|
||||||
ListenOptions
|
ListenOptions
|
||||||
Users []auth.User `json:"users,omitempty"`
|
Users []auth.User `json:"users,omitempty"`
|
||||||
Network NetworkList `json:"network,omitempty"`
|
Network NetworkList `json:"network,omitempty"`
|
||||||
QUICCongestionControl string `json:"quic_congestion_control,omitempty"`
|
|
||||||
InboundTLSOptionsContainer
|
InboundTLSOptionsContainer
|
||||||
}
|
}
|
||||||
|
|
||||||
type NaiveOutboundOptions struct {
|
|
||||||
DialerOptions
|
|
||||||
ServerOptions
|
|
||||||
Username string `json:"username,omitempty"`
|
|
||||||
Password string `json:"password,omitempty"`
|
|
||||||
InsecureConcurrency int `json:"insecure_concurrency,omitempty"`
|
|
||||||
ExtraHeaders badoption.HTTPHeader `json:"extra_headers,omitempty"`
|
|
||||||
UDPOverTCP *UDPOverTCPOptions `json:"udp_over_tcp,omitempty"`
|
|
||||||
QUIC bool `json:"quic,omitempty"`
|
|
||||||
QUICCongestionControl string `json:"quic_congestion_control,omitempty"`
|
|
||||||
OutboundTLSOptionsContainer
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,20 +0,0 @@
|
|||||||
package option
|
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/sagernet/sing/common/json/badoption"
|
|
||||||
)
|
|
||||||
|
|
||||||
type OCMServiceOptions struct {
|
|
||||||
ListenOptions
|
|
||||||
InboundTLSOptionsContainer
|
|
||||||
CredentialPath string `json:"credential_path,omitempty"`
|
|
||||||
Users []OCMUser `json:"users,omitempty"`
|
|
||||||
Headers badoption.HTTPHeader `json:"headers,omitempty"`
|
|
||||||
Detour string `json:"detour,omitempty"`
|
|
||||||
UsagesPath string `json:"usages_path,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type OCMUser struct {
|
|
||||||
Name string `json:"name,omitempty"`
|
|
||||||
Token string `json:"token,omitempty"`
|
|
||||||
}
|
|
||||||
@@ -65,27 +65,24 @@ type DialerOptionsWrapper interface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type DialerOptions struct {
|
type DialerOptions struct {
|
||||||
Detour string `json:"detour,omitempty"`
|
Detour string `json:"detour,omitempty"`
|
||||||
BindInterface string `json:"bind_interface,omitempty"`
|
BindInterface string `json:"bind_interface,omitempty"`
|
||||||
Inet4BindAddress *badoption.Addr `json:"inet4_bind_address,omitempty"`
|
Inet4BindAddress *badoption.Addr `json:"inet4_bind_address,omitempty"`
|
||||||
Inet6BindAddress *badoption.Addr `json:"inet6_bind_address,omitempty"`
|
Inet6BindAddress *badoption.Addr `json:"inet6_bind_address,omitempty"`
|
||||||
ProtectPath string `json:"protect_path,omitempty"`
|
ProtectPath string `json:"protect_path,omitempty"`
|
||||||
RoutingMark FwMark `json:"routing_mark,omitempty"`
|
RoutingMark FwMark `json:"routing_mark,omitempty"`
|
||||||
ReuseAddr bool `json:"reuse_addr,omitempty"`
|
ReuseAddr bool `json:"reuse_addr,omitempty"`
|
||||||
NetNs string `json:"netns,omitempty"`
|
NetNs string `json:"netns,omitempty"`
|
||||||
ConnectTimeout badoption.Duration `json:"connect_timeout,omitempty"`
|
ConnectTimeout badoption.Duration `json:"connect_timeout,omitempty"`
|
||||||
TCPFastOpen bool `json:"tcp_fast_open,omitempty"`
|
TCPFastOpen bool `json:"tcp_fast_open,omitempty"`
|
||||||
TCPMultiPath bool `json:"tcp_multi_path,omitempty"`
|
TCPMultiPath bool `json:"tcp_multi_path,omitempty"`
|
||||||
DisableTCPKeepAlive bool `json:"disable_tcp_keep_alive,omitempty"`
|
UDPFragment *bool `json:"udp_fragment,omitempty"`
|
||||||
TCPKeepAlive badoption.Duration `json:"tcp_keep_alive,omitempty"`
|
UDPFragmentDefault bool `json:"-"`
|
||||||
TCPKeepAliveInterval badoption.Duration `json:"tcp_keep_alive_interval,omitempty"`
|
DomainResolver *DomainResolveOptions `json:"domain_resolver,omitempty"`
|
||||||
UDPFragment *bool `json:"udp_fragment,omitempty"`
|
NetworkStrategy *NetworkStrategy `json:"network_strategy,omitempty"`
|
||||||
UDPFragmentDefault bool `json:"-"`
|
NetworkType badoption.Listable[InterfaceType] `json:"network_type,omitempty"`
|
||||||
DomainResolver *DomainResolveOptions `json:"domain_resolver,omitempty"`
|
FallbackNetworkType badoption.Listable[InterfaceType] `json:"fallback_network_type,omitempty"`
|
||||||
NetworkStrategy *NetworkStrategy `json:"network_strategy,omitempty"`
|
FallbackDelay badoption.Duration `json:"fallback_delay,omitempty"`
|
||||||
NetworkType badoption.Listable[InterfaceType] `json:"network_type,omitempty"`
|
|
||||||
FallbackNetworkType badoption.Listable[InterfaceType] `json:"fallback_network_type,omitempty"`
|
|
||||||
FallbackDelay badoption.Duration `json:"fallback_delay,omitempty"`
|
|
||||||
|
|
||||||
// Deprecated: migrated to domain resolver
|
// Deprecated: migrated to domain resolver
|
||||||
DomainStrategy DomainStrategy `json:"domain_strategy,omitempty"`
|
DomainStrategy DomainStrategy `json:"domain_strategy,omitempty"`
|
||||||
|
|||||||
@@ -107,10 +107,6 @@ type OutboundTLSOptions struct {
|
|||||||
Certificate badoption.Listable[string] `json:"certificate,omitempty"`
|
Certificate badoption.Listable[string] `json:"certificate,omitempty"`
|
||||||
CertificatePath string `json:"certificate_path,omitempty"`
|
CertificatePath string `json:"certificate_path,omitempty"`
|
||||||
CertificatePublicKeySHA256 badoption.Listable[[]byte] `json:"certificate_public_key_sha256,omitempty"`
|
CertificatePublicKeySHA256 badoption.Listable[[]byte] `json:"certificate_public_key_sha256,omitempty"`
|
||||||
ClientCertificate badoption.Listable[string] `json:"client_certificate,omitempty"`
|
|
||||||
ClientCertificatePath string `json:"client_certificate_path,omitempty"`
|
|
||||||
ClientKey badoption.Listable[string] `json:"client_key,omitempty"`
|
|
||||||
ClientKeyPath string `json:"client_key_path,omitempty"`
|
|
||||||
Fragment bool `json:"fragment,omitempty"`
|
Fragment bool `json:"fragment,omitempty"`
|
||||||
FragmentFallbackDelay badoption.Duration `json:"fragment_fallback_delay,omitempty"`
|
FragmentFallbackDelay badoption.Duration `json:"fragment_fallback_delay,omitempty"`
|
||||||
RecordFragment bool `json:"record_fragment,omitempty"`
|
RecordFragment bool `json:"record_fragment,omitempty"`
|
||||||
@@ -215,10 +211,9 @@ type InboundECHOptions struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type OutboundECHOptions struct {
|
type OutboundECHOptions struct {
|
||||||
Enabled bool `json:"enabled,omitempty"`
|
Enabled bool `json:"enabled,omitempty"`
|
||||||
Config badoption.Listable[string] `json:"config,omitempty"`
|
Config badoption.Listable[string] `json:"config,omitempty"`
|
||||||
ConfigPath string `json:"config_path,omitempty"`
|
ConfigPath string `json:"config_path,omitempty"`
|
||||||
QueryServerName string `json:"query_server_name,omitempty"`
|
|
||||||
|
|
||||||
// Deprecated: not supported by stdlib
|
// Deprecated: not supported by stdlib
|
||||||
PQSignatureSchemesEnabled bool `json:"pq_signature_schemes_enabled,omitempty"`
|
PQSignatureSchemesEnabled bool `json:"pq_signature_schemes_enabled,omitempty"`
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user