From b27bc45cf2550e00823e799a313f8226443aa58e Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 23 Jan 2024 10:35:18 +0000 Subject: [PATCH 01/27] [dependencies] Update actions/cache action to v4 --- .github/workflows/debug.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/debug.yml b/.github/workflows/debug.yml index 09eac9d5e3..9409d84261 100644 --- a/.github/workflows/debug.yml +++ b/.github/workflows/debug.yml @@ -46,7 +46,7 @@ jobs: with: go-version: ~1.18 - name: Cache go module - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: | ~/go/pkg/mod @@ -66,7 +66,7 @@ jobs: with: go-version: ^1.20 - name: Cache go module - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: | ~/go/pkg/mod From 46be319976f03e349bcba1f0c0e9e56956f91761 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Wed, 7 Feb 2024 13:52:04 +0800 Subject: [PATCH 02/27] Fix external controller crash before started --- route/router.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/route/router.go b/route/router.go index adbdbd2082..7a7c535a45 100644 --- a/route/router.go +++ b/route/router.go @@ -415,6 +415,9 @@ func (r *Router) Initialize(inbounds []adapter.Inbound, outbounds []adapter.Outb } func (r *Router) Outbounds() []adapter.Outbound { + if !r.started { + return nil + } return r.outbounds } From e2090923db572b412d0f5b295539aacf77fdb620 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Wed, 7 Feb 2024 14:11:20 +0800 Subject: [PATCH 03/27] Bump Go version --- .github/workflows/debug.yml | 24 ++++++++++++++++++++++-- .github/workflows/lint.yml | 2 +- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/.github/workflows/debug.yml b/.github/workflows/debug.yml index 9409d84261..5ccfc35b4b 100644 --- a/.github/workflows/debug.yml +++ b/.github/workflows/debug.yml @@ -28,7 +28,7 @@ jobs: - name: Setup Go uses: actions/setup-go@v5 with: - go-version: ^1.21 + go-version: ^1.22 continue-on-error: true - name: Run Test run: | @@ -64,7 +64,7 @@ jobs: - name: Setup Go uses: actions/setup-go@v5 with: - go-version: ^1.20 + go-version: ~1.20 - name: Cache go module uses: actions/cache@v4 with: @@ -73,6 +73,26 @@ jobs: key: go120-${{ hashFiles('**/go.sum') }} - name: Run Test run: make ci_build + build_go121: + name: Debug build (Go 1.21) + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 + with: + fetch-depth: 0 + - name: Setup Go + uses: actions/setup-go@v5 + with: + go-version: ~1.21 + - name: Cache go module + uses: actions/cache@v4 + with: + path: | + ~/go/pkg/mod + key: go121-${{ hashFiles('**/go.sum') }} + - name: Run Test + run: make ci_build cross: strategy: matrix: diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index ab67a616a0..1cdafd3526 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -28,7 +28,7 @@ jobs: - name: Setup Go uses: actions/setup-go@v4 with: - go-version: ^1.21 + go-version: ^1.22 - name: Setup Go uses: actions/setup-go@v5 with: From e6885e9967e831fbcc72f1a6febb1be7fcef6a78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Thu, 8 Feb 2024 22:14:09 +0800 Subject: [PATCH 04/27] platform: Ignore momentary pause on iOS --- experimental/libbox/service.go | 12 ++------ experimental/libbox/service_pause.go | 45 ++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 10 deletions(-) create mode 100644 experimental/libbox/service_pause.go diff --git a/experimental/libbox/service.go b/experimental/libbox/service.go index a484c64b23..b30ca22fac 100644 --- a/experimental/libbox/service.go +++ b/experimental/libbox/service.go @@ -32,6 +32,8 @@ type BoxService struct { instance *box.Box pauseManager pause.Manager urlTestHistoryStorage *urltest.HistoryStorage + + servicePauseFields } func NewService(configContent string, platformInterface PlatformInterface) (*BoxService, error) { @@ -75,16 +77,6 @@ func (s *BoxService) Close() error { return s.instance.Close() } -func (s *BoxService) Sleep() { - s.pauseManager.DevicePause() - _ = s.instance.Router().ResetNetwork() -} - -func (s *BoxService) Wake() { - s.pauseManager.DeviceWake() - _ = s.instance.Router().ResetNetwork() -} - var ( _ platform.Interface = (*platformInterfaceWrapper)(nil) _ log.PlatformWriter = (*platformInterfaceWrapper)(nil) diff --git a/experimental/libbox/service_pause.go b/experimental/libbox/service_pause.go new file mode 100644 index 0000000000..4a58fb50e2 --- /dev/null +++ b/experimental/libbox/service_pause.go @@ -0,0 +1,45 @@ +package libbox + +import ( + "sync" + "time" +) + +type servicePauseFields struct { + pauseAccess sync.Mutex + pauseTimer *time.Timer +} + +func (s *BoxService) Pause() { + s.pauseAccess.Lock() + defer s.pauseAccess.Unlock() + + if s.pauseTimer != nil { + s.pauseTimer.Stop() + } + + s.pauseTimer = time.AfterFunc(time.Minute, s.pause) +} + +func (s *BoxService) pause() { + s.pauseAccess.Lock() + defer s.pauseAccess.Unlock() + + s.pauseManager.DevicePause() + _ = s.instance.Router().ResetNetwork() + s.pauseTimer = nil +} + +func (s *BoxService) Wake() { + s.pauseAccess.Lock() + defer s.pauseAccess.Unlock() + + if s.pauseTimer != nil { + s.pauseTimer.Stop() + s.pauseTimer = nil + return + } + + s.pauseManager.DeviceWake() + _ = s.instance.Router().ResetNetwork() +} From 71e7d517a8d391451198fc2e46c52855acfb1c4b Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 9 Feb 2024 19:03:57 +0000 Subject: [PATCH 05/27] [dependencies] Update github-actions --- .github/workflows/lint.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 1cdafd3526..42b3a06488 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -26,7 +26,7 @@ jobs: with: fetch-depth: 0 - name: Setup Go - uses: actions/setup-go@v4 + uses: actions/setup-go@v5 with: go-version: ^1.22 - name: Setup Go @@ -34,7 +34,7 @@ jobs: with: go-version: ${{ steps.version.outputs.go_version }} - name: golangci-lint - uses: golangci/golangci-lint-action@v3 + uses: golangci/golangci-lint-action@v4 with: version: latest args: --timeout=30m From d0f7a59e9b0381ceadcf8399ca875de04fa7d9b9 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 9 Feb 2024 11:46:00 +0000 Subject: [PATCH 06/27] [dependencies] Update golang Docker tag to v1.22 --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 52adff513c..db890fd439 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM --platform=$BUILDPLATFORM golang:1.21-alpine AS builder +FROM --platform=$BUILDPLATFORM golang:1.22-alpine AS builder LABEL maintainer="nekohasekai " COPY . /go/src/github.com/sagernet/sing-box WORKDIR /go/src/github.com/sagernet/sing-box From 31b88344276df3e26e3248240d05f2ce1380154b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Sat, 10 Feb 2024 12:01:09 +0800 Subject: [PATCH 07/27] documentation: Fix description for `with_ech` --- .github/workflows/debug.yml | 2 +- .goreleaser.yaml | 1 - Makefile | 9 +++++++-- docs/installation/build-from-source.md | 3 ++- docs/installation/build-from-source.zh.md | 3 ++- 5 files changed, 12 insertions(+), 6 deletions(-) diff --git a/.github/workflows/debug.yml b/.github/workflows/debug.yml index 5ccfc35b4b..50ea05d7ba 100644 --- a/.github/workflows/debug.yml +++ b/.github/workflows/debug.yml @@ -72,7 +72,7 @@ jobs: ~/go/pkg/mod key: go120-${{ hashFiles('**/go.sum') }} - name: Run Test - run: make ci_build + run: make ci_build_go120 build_go121: name: Debug build (Go 1.21) runs-on: ubuntu-latest diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 2fe2e27704..41578ab1fc 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -54,7 +54,6 @@ builds: - with_quic - with_dhcp - with_wireguard - - with_ech - with_utls - with_reality_server - with_acme diff --git a/Makefile b/Makefile index d2aa65d988..322f8f6911 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,9 @@ NAME = sing-box COMMIT = $(shell git rev-parse --short HEAD) TAGS_GO118 = with_gvisor,with_dhcp,with_wireguard,with_reality_server,with_clash_api -TAGS_GO120 = with_quic,with_ech,with_utls -TAGS ?= $(TAGS_GO118),$(TAGS_GO120) +TAGS_GO120 = with_quic,with_utls +TAGS_GO121 = with_ech +TAGS ?= $(TAGS_GO118),$(TAGS_GO120),$(TAGS_GO121) TAGS_TEST ?= with_gvisor,with_quic,with_wireguard,with_grpc,with_ech,with_utls,with_reality_server GOHOSTOS = $(shell go env GOHOSTOS) @@ -23,6 +24,10 @@ ci_build_go118: go build $(PARAMS) $(MAIN) go build $(PARAMS) -tags "$(TAGS_GO118)" $(MAIN) +ci_build_go120: + go build $(PARAMS) $(MAIN) + go build $(PARAMS) -tags "$(TAGS_GO118),$(TAGS_GO120)" $(MAIN) + ci_build: go build $(PARAMS) $(MAIN) go build $(MAIN_PARAMS) $(MAIN) diff --git a/docs/installation/build-from-source.md b/docs/installation/build-from-source.md index fc78d87f87..d6c9a1ce0e 100644 --- a/docs/installation/build-from-source.md +++ b/docs/installation/build-from-source.md @@ -23,7 +23,8 @@ Since sing-box 1.5.0: Since sing-box 1.8.0: * Go 1.18.5 - ~ -* Go 1.20.0 - ~ with tag `with_quic`, `with_ech`, or `with_utls` enabled +* Go 1.20.0 - ~ with tag `with_quic`, or `with_utls` enabled +* Go 1.21.0 - ~ with tag `with_ech` enabled You can download and install Go from: https://go.dev/doc/install, latest version is recommended. diff --git a/docs/installation/build-from-source.zh.md b/docs/installation/build-from-source.zh.md index a1a09b9312..dd9bfcc4e9 100644 --- a/docs/installation/build-from-source.zh.md +++ b/docs/installation/build-from-source.zh.md @@ -23,7 +23,8 @@ sing-box 1.4.0 前: 从 sing-box 1.8.0: * Go 1.18.5 - ~ -* Go 1.20.0 - ~ 如果启用构建标记 `with_quic`、`with_ech` 或 `with_utls` +* Go 1.20.0 - ~ 如果启用构建标记 `with_quic` 或 `with_utls` +* Go 1.20.1 - ~ 如果启用构建标记 `with_ech` 您可以从 https://go.dev/doc/install 下载并安装 Go,推荐使用最新版本。 From d0ba69ad22151e8bfb0ce0c75a7452e767b14f8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Sat, 10 Feb 2024 21:22:02 +0800 Subject: [PATCH 08/27] Fix TUN unaligned panic on windows --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 0d9ed54929..0116b46e45 100644 --- a/go.mod +++ b/go.mod @@ -33,7 +33,7 @@ require ( github.com/sagernet/sing-shadowsocks v0.2.6 github.com/sagernet/sing-shadowsocks2 v0.2.0 github.com/sagernet/sing-shadowtls v0.1.4 - github.com/sagernet/sing-tun v0.2.1 + github.com/sagernet/sing-tun v0.2.2-beta.1 github.com/sagernet/sing-vmess v0.1.8 github.com/sagernet/smux v0.0.0-20231208180855-7041f6ea79e7 github.com/sagernet/tfo-go v0.0.0-20231209031829-7b5343ac1dc6 diff --git a/go.sum b/go.sum index f8fba7c333..05c5d25a9e 100644 --- a/go.sum +++ b/go.sum @@ -123,8 +123,8 @@ github.com/sagernet/sing-shadowsocks2 v0.2.0 h1:wpZNs6wKnR7mh1wV9OHwOyUr21VkS3wK github.com/sagernet/sing-shadowsocks2 v0.2.0/go.mod h1:RnXS0lExcDAovvDeniJ4IKa2IuChrdipolPYWBv9hWQ= github.com/sagernet/sing-shadowtls v0.1.4 h1:aTgBSJEgnumzFenPvc+kbD9/W0PywzWevnVpEx6Tw3k= github.com/sagernet/sing-shadowtls v0.1.4/go.mod h1:F8NBgsY5YN2beQavdgdm1DPlhaKQlaL6lpDdcBglGK4= -github.com/sagernet/sing-tun v0.2.1 h1:xZ/MkQbAX4yuOXq/s1pfhWa0lK1Ld7t4gOpSUbRl1Rs= -github.com/sagernet/sing-tun v0.2.1/go.mod h1:w1HTPPEL575m+Ob3GOIWaTs3ZrTdgLIwoldce/p3WPU= +github.com/sagernet/sing-tun v0.2.2-beta.1 h1:B/P2TbV4ORNyZbLad4V74ZVCkgcsZG7vYqugEmof/Gc= +github.com/sagernet/sing-tun v0.2.2-beta.1/go.mod h1:w1HTPPEL575m+Ob3GOIWaTs3ZrTdgLIwoldce/p3WPU= github.com/sagernet/sing-vmess v0.1.8 h1:XVWad1RpTy9b5tPxdm5MCU8cGfrTGdR8qCq6HV2aCNc= github.com/sagernet/sing-vmess v0.1.8/go.mod h1:vhx32UNzTDUkNwOyIjcZQohre1CaytquC5mPplId8uA= github.com/sagernet/smux v0.0.0-20231208180855-7041f6ea79e7 h1:DImB4lELfQhplLTxeq2z31Fpv8CQqqrUwTbrIRumZqQ= From 8332878cdce81aea5dcb297800c50965f0e7b8a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Sat, 10 Feb 2024 22:35:35 +0800 Subject: [PATCH 09/27] Fix destination IP CIDR match in DNS --- route/rule_item_cidr.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/route/rule_item_cidr.go b/route/rule_item_cidr.go index 0e15e67441..85b9c8d7d3 100644 --- a/route/rule_item_cidr.go +++ b/route/rule_item_cidr.go @@ -73,7 +73,7 @@ func NewRawIPCIDRItem(isSource bool, ipSet *netipx.IPSet) *IPCIDRItem { } func (r *IPCIDRItem) Match(metadata *adapter.InboundContext) bool { - if r.isSource || metadata.QueryType != 0 || metadata.IPCIDRMatchSource { + if r.isSource || metadata.IPCIDRMatchSource { return r.ipSet.Contains(metadata.Source.Addr) } else { if metadata.Destination.IsIP() { From bca0b86549125bc84395188a5d6c5925d75cd415 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Sat, 10 Feb 2024 23:46:52 +0800 Subject: [PATCH 10/27] Copy DNS message struct instead of deep copy --- outbound/dns.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/outbound/dns.go b/outbound/dns.go index 0f003377cb..df32a019d7 100644 --- a/outbound/dns.go +++ b/outbound/dns.go @@ -270,7 +270,8 @@ func truncateDNSMessage(response *mDNS.Msg, maxLen int) *mDNS.Msg { if responseLen <= maxLen { return response } - response = response.Copy() + newResponse := *response + response = &newResponse for len(response.Answer) > 0 && responseLen > maxLen { response.Answer = response.Answer[:len(response.Answer)-1] response.Truncated = true From 5583e01c990d6082cac20489c093637c113199ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Fri, 16 Feb 2024 13:06:34 +0800 Subject: [PATCH 11/27] platform: Export `NeedWIFIState` for Android --- adapter/router.go | 2 ++ experimental/libbox/service.go | 4 ++++ route/router.go | 15 +++++++++------ 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/adapter/router.go b/adapter/router.go index 5828ab3530..9d8bcb3e8a 100644 --- a/adapter/router.go +++ b/adapter/router.go @@ -33,6 +33,8 @@ type Router interface { RuleSet(tag string) (RuleSet, bool) + NeedWIFIState() bool + Exchange(ctx context.Context, message *mdns.Msg) (*mdns.Msg, error) Lookup(ctx context.Context, domain string, strategy dns.DomainStrategy) ([]netip.Addr, error) LookupDefault(ctx context.Context, domain string) ([]netip.Addr, error) diff --git a/experimental/libbox/service.go b/experimental/libbox/service.go index b30ca22fac..a516c4c5d6 100644 --- a/experimental/libbox/service.go +++ b/experimental/libbox/service.go @@ -77,6 +77,10 @@ func (s *BoxService) Close() error { return s.instance.Close() } +func (s *BoxService) NeedWIFIState() bool { + return s.instance.Router().NeedWIFIState() +} + var ( _ platform.Interface = (*platformInterfaceWrapper)(nil) _ log.PlatformWriter = (*platformInterfaceWrapper)(nil) diff --git a/route/router.go b/route/router.go index 7a7c535a45..df1a54a07c 100644 --- a/route/router.go +++ b/route/router.go @@ -560,13 +560,12 @@ func (r *Router) Start() error { } } } - if needWIFIStateFromRuleSet || r.needWIFIState { + if (needWIFIStateFromRuleSet || r.needWIFIState) && r.platformInterface != nil { monitor.Start("initialize WIFI state") - if r.platformInterface != nil && r.interfaceMonitor != nil { - r.interfaceMonitor.RegisterCallback(func(_ int) { - r.updateWIFIState() - }) - } + r.needWIFIState = true + r.interfaceMonitor.RegisterCallback(func(_ int) { + r.updateWIFIState() + }) r.updateWIFIState() monitor.Finish() } @@ -716,6 +715,10 @@ func (r *Router) RuleSet(tag string) (adapter.RuleSet, bool) { return ruleSet, loaded } +func (r *Router) NeedWIFIState() bool { + return r.needWIFIState +} + func (r *Router) RouteConnection(ctx context.Context, conn net.Conn, metadata adapter.InboundContext) error { if r.pauseManager.IsDevicePaused() { return E.New("reject connection to ", metadata.Destination, " while device paused") From 80d1aebcb77037258448a6fbb18c8e1a53eb5a3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Fri, 16 Feb 2024 13:28:58 +0800 Subject: [PATCH 12/27] platform: Unify client versions --- .github/update_clients.sh | 14 +++++++++ .gitmodules | 6 ++++ Makefile | 3 +- clients/android | 1 + clients/apple | 1 + cmd/internal/build_shared/sdk.go | 10 +++++++ cmd/internal/update_android_version/main.go | 33 ++++++++++++++------- 7 files changed, 57 insertions(+), 11 deletions(-) create mode 100755 .github/update_clients.sh create mode 100644 .gitmodules create mode 160000 clients/android create mode 160000 clients/apple diff --git a/.github/update_clients.sh b/.github/update_clients.sh new file mode 100755 index 0000000000..c77afbb446 --- /dev/null +++ b/.github/update_clients.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +PROJECTS=$(dirname "$0")/../.. + +function updateClient() { + pushd clients/$1 + git fetch + git reset FETCH_HEAD --hard + popd + git add clients/$1 +} + +updateClient "apple" +updateClient "android" diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000000..45ffb5639b --- /dev/null +++ b/.gitmodules @@ -0,0 +1,6 @@ +[submodule "clients/apple"] + path = clients/apple + url = https://github.com/SagerNet/sing-box-for-apple.git +[submodule "clients/android"] + path = clients/android + url = https://github.com/SagerNet/sing-box-for-android.git diff --git a/Makefile b/Makefile index 322f8f6911..4a18aa16bf 100644 --- a/Makefile +++ b/Makefile @@ -78,11 +78,12 @@ update_android_version: go run ./cmd/internal/update_android_version build_android: - cd ../sing-box-for-android && ./gradlew :app:assemblePlayRelease && ./gradlew --stop + cd ../sing-box-for-android && ./gradlew :app:assemblePlayRelease && ./gradlew :app:assembleOtherRelease && ./gradlew --stop upload_android: mkdir -p dist/release_android cp ../sing-box-for-android/app/build/outputs/apk/play/release/*.apk dist/release_android + cp ../sing-box-for-android/app/build/outputs/apk/other/release/*-universal.apk dist/release_android ghr --replace --draft --prerelease -p 3 "v${VERSION}" dist/release_android rm -rf dist/release_android diff --git a/clients/android b/clients/android new file mode 160000 index 0000000000..3b9d24a0bb --- /dev/null +++ b/clients/android @@ -0,0 +1 @@ +Subproject commit 3b9d24a0bb757a0b55f5590485934e1012757ba6 diff --git a/clients/apple b/clients/apple new file mode 160000 index 0000000000..60f96985a3 --- /dev/null +++ b/clients/apple @@ -0,0 +1 @@ +Subproject commit 60f96985a39c8af7dd66d57efd08bb0b150fcb6d diff --git a/cmd/internal/build_shared/sdk.go b/cmd/internal/build_shared/sdk.go index 1bcd40bb89..0c447ba132 100644 --- a/cmd/internal/build_shared/sdk.go +++ b/cmd/internal/build_shared/sdk.go @@ -11,7 +11,9 @@ import ( "github.com/sagernet/sing-box/log" "github.com/sagernet/sing/common" + E "github.com/sagernet/sing/common/exceptions" "github.com/sagernet/sing/common/rw" + "github.com/sagernet/sing/common/shell" ) var ( @@ -40,6 +42,14 @@ func FindSDK() { log.Fatal("android NDK not found") } + javaVersion, err := shell.Exec("java", "--version").ReadOutput() + if err != nil { + log.Fatal(E.Cause(err, "check java version")) + } + if !strings.Contains(javaVersion, "openjdk 17") { + log.Fatal("java version should be openjdk 17") + } + os.Setenv("ANDROID_HOME", androidSDKPath) os.Setenv("ANDROID_SDK_HOME", androidSDKPath) os.Setenv("ANDROID_NDK_HOME", androidNDKPath) diff --git a/cmd/internal/update_android_version/main.go b/cmd/internal/update_android_version/main.go index ce380b98b2..040ba5d2d3 100644 --- a/cmd/internal/update_android_version/main.go +++ b/cmd/internal/update_android_version/main.go @@ -3,6 +3,7 @@ package main import ( "os" "path/filepath" + "runtime" "strconv" "strings" @@ -18,34 +19,46 @@ func main() { log.Fatal(err) } common.Must(os.Chdir(androidPath)) - localProps := common.Must1(os.ReadFile("local.properties")) + localProps := common.Must1(os.ReadFile("version.properties")) var propsList [][]string for _, propLine := range strings.Split(string(localProps), "\n") { propsList = append(propsList, strings.Split(propLine, "=")) } + var ( + versionUpdated bool + goVersionUpdated bool + ) for _, propPair := range propsList { - if propPair[0] == "VERSION_NAME" { - if propPair[1] == newVersion.String() { - log.Info("version not changed") - return + switch propPair[0] { + case "VERSION_NAME": + if propPair[1] != newVersion.String() { + versionUpdated = true + propPair[1] = newVersion.String() + log.Info("updated version to ", newVersion.String()) + } + case "GO_VERSION": + if propPair[1] != runtime.Version() { + goVersionUpdated = true + propPair[1] = runtime.Version() + log.Info("updated Go version to ", runtime.Version()) } - propPair[1] = newVersion.String() - log.Info("updated version to ", newVersion.String()) } } + if !(versionUpdated || goVersionUpdated) { + log.Info("version not changed") + return + } for _, propPair := range propsList { switch propPair[0] { case "VERSION_CODE": versionCode := common.Must1(strconv.ParseInt(propPair[1], 10, 64)) propPair[1] = strconv.Itoa(int(versionCode + 1)) log.Info("updated version code to ", propPair[1]) - case "RELEASE_NOTES": - propPair[1] = "sing-box " + newVersion.String() } } var newProps []string for _, propPair := range propsList { newProps = append(newProps, strings.Join(propPair, "=")) } - common.Must(os.WriteFile("local.properties", []byte(strings.Join(newProps, "\n")), 0o644)) + common.Must(os.WriteFile("version.properties", []byte(strings.Join(newProps, "\n")), 0o644)) } From 8db2ae0c8357ef173bb4c8719200d3a72b1ae88e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Fri, 16 Feb 2024 15:06:59 +0800 Subject: [PATCH 13/27] Fix documentation --- docs/deprecated.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/docs/deprecated.md b/docs/deprecated.md index 0613122e86..270aaaea72 100644 --- a/docs/deprecated.md +++ b/docs/deprecated.md @@ -32,8 +32,6 @@ suffers from a number of problems, including lack of maintenance, inaccurate rul sing-box 1.8.0 introduces [Rule Set](/configuration/rule-set/), which can completely replace Geosite, check [Migration](/migration/#migrate-geosite-to-rule-sets). -Geosite,即由 V2Ray 维护的 domain-list-community 项目,作为早期流量绕过解决方案,存在着大量问题,包括缺少维护、规则不准确、管理困难。 - ## 1.6.0 The following features will be marked deprecated in 1.5.0 and removed entirely in 1.6.0. From 4a44aa3c2170c01ae3264a928a3d5ab184793eed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Thu, 22 Feb 2024 20:53:58 +0800 Subject: [PATCH 14/27] Fix HTTP inbound --- go.mod | 4 ++-- go.sum | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index 0116b46e45..d03cb18ffe 100644 --- a/go.mod +++ b/go.mod @@ -26,7 +26,7 @@ require ( github.com/sagernet/gvisor v0.0.0-20231209105102-8d27a30e436e github.com/sagernet/quic-go v0.40.1 github.com/sagernet/reality v0.0.0-20230406110435-ee17307e7691 - github.com/sagernet/sing v0.3.0 + github.com/sagernet/sing v0.3.2 github.com/sagernet/sing-dns v0.1.12 github.com/sagernet/sing-mux v0.2.0 github.com/sagernet/sing-quic v0.1.8 @@ -46,7 +46,7 @@ require ( go4.org/netipx v0.0.0-20231129151722-fdeea329fbba golang.org/x/crypto v0.18.0 golang.org/x/net v0.20.0 - golang.org/x/sys v0.16.0 + golang.org/x/sys v0.17.0 golang.zx2c4.com/wireguard/wgctrl v0.0.0-20230429144221-925a1e7659e6 google.golang.org/grpc v1.60.1 google.golang.org/protobuf v1.32.0 diff --git a/go.sum b/go.sum index 05c5d25a9e..b23196992a 100644 --- a/go.sum +++ b/go.sum @@ -109,8 +109,8 @@ github.com/sagernet/quic-go v0.40.1/go.mod h1:CcKTpzTAISxrM4PA5M20/wYuz9Tj6Tx4Dw github.com/sagernet/reality v0.0.0-20230406110435-ee17307e7691 h1:5Th31OC6yj8byLGkEnIYp6grlXfo1QYUfiYFGjewIdc= github.com/sagernet/reality v0.0.0-20230406110435-ee17307e7691/go.mod h1:B8lp4WkQ1PwNnrVMM6KyuFR20pU8jYBD+A4EhJovEXU= github.com/sagernet/sing v0.2.18/go.mod h1:OL6k2F0vHmEzXz2KW19qQzu172FDgSbUSODylighuVo= -github.com/sagernet/sing v0.3.0 h1:PIDVFZHnQAAYRL1UYqNM+0k5s8f/tb1lUW6UDcQiOc8= -github.com/sagernet/sing v0.3.0/go.mod h1:9pfuAH6mZfgnz/YjP6xu5sxx882rfyjpcrTdUpd6w3g= +github.com/sagernet/sing v0.3.2 h1:CwWcxUBPkMvwgfe2/zUgY5oHG9qOL8Aob/evIFYK9jo= +github.com/sagernet/sing v0.3.2/go.mod h1:qHySJ7u8po9DABtMYEkNBcOumx7ZZJf/fbv2sfTkNHE= github.com/sagernet/sing-dns v0.1.12 h1:1HqZ+ln+Rezx/aJMStaS0d7oPeX2EobSV1NT537kyj4= github.com/sagernet/sing-dns v0.1.12/go.mod h1:rx/DTOisneQpCgNQ4jbFU/JNEtnz0lYcHXenlVzpjEU= github.com/sagernet/sing-mux v0.2.0 h1:4C+vd8HztJCWNYfufvgL49xaOoOHXty2+EAjnzN3IYo= @@ -188,8 +188,8 @@ golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= -golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= +golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.16.0 h1:m+B6fahuftsE9qjo0VWp2FW0mB3MTJvR0BaMQrq0pmE= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= From 3c24411e142ae8a0b1cbde0960facb358338d246 Mon Sep 17 00:00:00 2001 From: hatune-miku <38491024+hatune-miku@users.noreply.github.com> Date: Thu, 22 Feb 2024 18:08:15 +0800 Subject: [PATCH 15/27] documentation: Fix navigation menu --- mkdocs.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mkdocs.yml b/mkdocs.yml index e786cfdefb..877d73c40e 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -133,7 +133,6 @@ nav: - WireGuard: configuration/outbound/wireguard.md - Hysteria: configuration/outbound/hysteria.md - ShadowTLS: configuration/outbound/shadowtls.md - - ShadowsocksR: configuration/outbound/shadowsocksr.md - VLESS: configuration/outbound/vless.md - TUIC: configuration/outbound/tuic.md - Hysteria2: configuration/outbound/hysteria2.md @@ -236,4 +235,4 @@ plugins: Manual: 手册 reconfigure_material: true - reconfigure_search: true \ No newline at end of file + reconfigure_search: true From f8c400cffcfda668d8b7dd75ae3f1c2838eed8a5 Mon Sep 17 00:00:00 2001 From: hiddify Date: Tue, 6 Feb 2024 09:21:41 +0100 Subject: [PATCH 16/27] platform: Remove duplicated close --- experimental/libbox/command_clash_mode.go | 3 --- experimental/libbox/command_group.go | 2 -- experimental/libbox/command_select.go | 1 - experimental/libbox/command_system_proxy.go | 2 -- experimental/libbox/command_urltest.go | 1 - 5 files changed, 9 deletions(-) diff --git a/experimental/libbox/command_clash_mode.go b/experimental/libbox/command_clash_mode.go index 0f850ea490..3377ae3afd 100644 --- a/experimental/libbox/command_clash_mode.go +++ b/experimental/libbox/command_clash_mode.go @@ -30,7 +30,6 @@ func (c *CommandClient) SetClashMode(newMode string) error { } func (s *CommandServer) handleSetClashMode(conn net.Conn) error { - defer conn.Close() newMode, err := rw.ReadVString(conn) if err != nil { return err @@ -61,7 +60,6 @@ func (c *CommandClient) handleModeConn(conn net.Conn) { } func (s *CommandServer) handleModeConn(conn net.Conn) error { - defer conn.Close() ctx := connKeepAlive(conn) for s.service == nil { select { @@ -73,7 +71,6 @@ func (s *CommandServer) handleModeConn(conn net.Conn) error { } clashServer := s.service.instance.Router().ClashServer() if clashServer == nil { - defer conn.Close() return binary.Write(conn, binary.BigEndian, uint16(0)) } err := writeClashModeList(conn, clashServer) diff --git a/experimental/libbox/command_group.go b/experimental/libbox/command_group.go index 2fc69b98b4..7f7f5c57e8 100644 --- a/experimental/libbox/command_group.go +++ b/experimental/libbox/command_group.go @@ -58,7 +58,6 @@ func (c *CommandClient) handleGroupConn(conn net.Conn) { } func (s *CommandServer) handleGroupConn(conn net.Conn) error { - defer conn.Close() ctx := connKeepAlive(conn) for { service := s.service @@ -274,7 +273,6 @@ func (c *CommandClient) SetGroupExpand(groupTag string, isExpand bool) error { } func (s *CommandServer) handleSetGroupExpand(conn net.Conn) error { - defer conn.Close() groupTag, err := rw.ReadVString(conn) if err != nil { return err diff --git a/experimental/libbox/command_select.go b/experimental/libbox/command_select.go index a434aa0ec9..e7d5b08f86 100644 --- a/experimental/libbox/command_select.go +++ b/experimental/libbox/command_select.go @@ -31,7 +31,6 @@ func (c *CommandClient) SelectOutbound(groupTag string, outboundTag string) erro } func (s *CommandServer) handleSelectOutbound(conn net.Conn) error { - defer conn.Close() groupTag, err := rw.ReadVString(conn) if err != nil { return err diff --git a/experimental/libbox/command_system_proxy.go b/experimental/libbox/command_system_proxy.go index d72abf7bd9..8a534ae8cb 100644 --- a/experimental/libbox/command_system_proxy.go +++ b/experimental/libbox/command_system_proxy.go @@ -35,7 +35,6 @@ func (c *CommandClient) GetSystemProxyStatus() (*SystemProxyStatus, error) { } func (s *CommandServer) handleGetSystemProxyStatus(conn net.Conn) error { - defer conn.Close() status := s.handler.GetSystemProxyStatus() err := binary.Write(conn, binary.BigEndian, status.Available) if err != nil { @@ -68,7 +67,6 @@ func (c *CommandClient) SetSystemProxyEnabled(isEnabled bool) error { } func (s *CommandServer) handleSetSystemProxyEnabled(conn net.Conn) error { - defer conn.Close() var isEnabled bool err := binary.Read(conn, binary.BigEndian, &isEnabled) if err != nil { diff --git a/experimental/libbox/command_urltest.go b/experimental/libbox/command_urltest.go index 3563d8c6a3..19ddf3da3c 100644 --- a/experimental/libbox/command_urltest.go +++ b/experimental/libbox/command_urltest.go @@ -33,7 +33,6 @@ func (c *CommandClient) URLTest(groupTag string) error { } func (s *CommandServer) handleURLTest(conn net.Conn) error { - defer conn.Close() groupTag, err := rw.ReadVString(conn) if err != nil { return err From aaf30bf92bc4bf4323ee6a15906e26e4a192238f Mon Sep 17 00:00:00 2001 From: hiddify Date: Tue, 6 Feb 2024 15:56:22 +0800 Subject: [PATCH 17/27] platform: Fix group update interval not taking effect --- experimental/libbox/command_group.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/experimental/libbox/command_group.go b/experimental/libbox/command_group.go index 7f7f5c57e8..21fd39d29a 100644 --- a/experimental/libbox/command_group.go +++ b/experimental/libbox/command_group.go @@ -58,6 +58,13 @@ func (c *CommandClient) handleGroupConn(conn net.Conn) { } func (s *CommandServer) handleGroupConn(conn net.Conn) error { + var interval int64 + err := binary.Read(conn, binary.BigEndian, &interval) + if err != nil { + return E.Cause(err, "read interval") + } + ticker := time.NewTicker(time.Duration(interval)) + defer ticker.Stop() ctx := connKeepAlive(conn) for { service := s.service @@ -75,7 +82,7 @@ func (s *CommandServer) handleGroupConn(conn net.Conn) error { select { case <-ctx.Done(): return ctx.Err() - case <-time.After(2 * time.Second): + case <-ticker.C: } select { case <-ctx.Done(): From bb355d17b2de2fb165b3620ae0e9834b04c088b1 Mon Sep 17 00:00:00 2001 From: Aleksandr Razumov Date: Wed, 24 Jan 2024 00:27:13 +0300 Subject: [PATCH 18/27] Add `riscv64` to platform list in release --- .goreleaser.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 41578ab1fc..e15f166b7a 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -30,6 +30,7 @@ builds: - linux_arm64 - linux_arm_7 - linux_s390x + - linux_riscv64 - windows_amd64_v1 - windows_amd64_v3 - windows_386 From 4823023806fd80aee79fc8ab818d6aafaefdcbc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Thu, 22 Feb 2024 21:03:51 +0800 Subject: [PATCH 19/27] Remove invalid archlinux packages from release --- Makefile | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 4a18aa16bf..5994b6d409 100644 --- a/Makefile +++ b/Makefile @@ -66,7 +66,14 @@ proto_install: release: go run ./cmd/internal/build goreleaser release --clean --skip-publish || exit 1 mkdir dist/release - mv dist/*.tar.gz dist/*.zip dist/*.deb dist/*.rpm dist/*.pkg.tar.zst dist/release + mv dist/*.tar.gz \ + dist/*.zip \ + dist/*.deb \ + dist/*.rpm \ + dist/*_amd64.pkg.tar.zst \ + dist/*_amd64v3.pkg.tar.zst \ + dist/*_arm64.pkg.tar.zst \ + dist/release ghr --replace --draft --prerelease -p 3 "v${VERSION}" dist/release rm -r dist/release From d32c30c4b7eebaef62dc2b7351dd85e9140def62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Fri, 16 Feb 2024 15:06:59 +0800 Subject: [PATCH 20/27] documentation: Bump version --- docs/changelog.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/changelog.md b/docs/changelog.md index a117b4729d..b78b402faf 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -2,6 +2,10 @@ icon: material/alert-decagram --- +#### 1.8.6 + +* Fixes and improvements + #### 1.8.5 * Fixes and improvements From de998c5119061d654c99e4fa7a9da929d2bf642a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Sat, 24 Feb 2024 21:51:39 +0800 Subject: [PATCH 21/27] Fix docker workflow --- .github/workflows/docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 285af2aba0..89b5ae9fb0 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -3,7 +3,7 @@ name: Build Docker Images on: release: types: - - published + - released jobs: build: From 3077a826508e1186d56d2a39930653bdf270c3b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Sat, 24 Feb 2024 19:41:24 +0800 Subject: [PATCH 22/27] Fix reproducible builds --- .goreleaser.yaml | 12 ------------ Makefile | 4 ++-- clients/android | 2 +- clients/apple | 2 +- cmd/internal/build_libbox/main.go | 6 +++--- go.mod | 2 +- go.sum | 4 ++-- 7 files changed, 10 insertions(+), 22 deletions(-) diff --git a/.goreleaser.yaml b/.goreleaser.yaml index e15f166b7a..7f9087f58b 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -5,10 +5,6 @@ builds: flags: - -v - -trimpath - asmflags: - - all=-trimpath={{.Env.GOPATH}} - gcflags: - - all=-trimpath={{.Env.GOPATH}} ldflags: - -X github.com/sagernet/sing-box/constant.Version={{ .Version }} -s -w -buildid= tags: @@ -44,10 +40,6 @@ builds: flags: - -v - -trimpath - asmflags: - - all=-trimpath={{.Env.GOPATH}} - gcflags: - - all=-trimpath={{.Env.GOPATH}} ldflags: - -X github.com/sagernet/sing-box/constant.Version={{ .Version }} -s -w -buildid= tags: @@ -73,10 +65,6 @@ builds: flags: - -v - -trimpath - asmflags: - - all=-trimpath={{.Env.GOPATH}} - gcflags: - - all=-trimpath={{.Env.GOPATH}} ldflags: - -X github.com/sagernet/sing-box/constant.Version={{ .Version }} -s -w -buildid= tags: diff --git a/Makefile b/Makefile index 5994b6d409..104c232f8e 100644 --- a/Makefile +++ b/Makefile @@ -191,8 +191,8 @@ lib: go run ./cmd/internal/build_libbox -target ios lib_install: - go install -v github.com/sagernet/gomobile/cmd/gomobile@v0.1.1 - go install -v github.com/sagernet/gomobile/cmd/gobind@v0.1.1 + go install -v github.com/sagernet/gomobile/cmd/gomobile@v0.1.3 + go install -v github.com/sagernet/gomobile/cmd/gobind@v0.1.3 docs: mkdocs serve diff --git a/clients/android b/clients/android index 3b9d24a0bb..6602817671 160000 --- a/clients/android +++ b/clients/android @@ -1 +1 @@ -Subproject commit 3b9d24a0bb757a0b55f5590485934e1012757ba6 +Subproject commit 660281767171d26795018bad577f77e7e6bcdb91 diff --git a/clients/apple b/clients/apple index 60f96985a3..45b4e58b3f 160000 --- a/clients/apple +++ b/clients/apple @@ -1 +1 @@ -Subproject commit 60f96985a39c8af7dd66d57efd08bb0b150fcb6d +Subproject commit 45b4e58b3f108f047e5f72e9322ddabcc37497a4 diff --git a/cmd/internal/build_libbox/main.go b/cmd/internal/build_libbox/main.go index d50e03b375..ae0fe34a6b 100644 --- a/cmd/internal/build_libbox/main.go +++ b/cmd/internal/build_libbox/main.go @@ -46,13 +46,13 @@ var ( func init() { sharedFlags = append(sharedFlags, "-trimpath") - sharedFlags = append(sharedFlags, "-ldflags") + sharedFlags = append(sharedFlags, "-buildvcs=false") currentTag, err := build_shared.ReadTag() if err != nil { currentTag = "unknown" } - sharedFlags = append(sharedFlags, "-X github.com/sagernet/sing-box/constant.Version="+currentTag+" -s -w -buildid=") - debugFlags = append(debugFlags, "-X github.com/sagernet/sing-box/constant.Version="+currentTag) + sharedFlags = append(sharedFlags, "-ldflags", "-X github.com/sagernet/sing-box/constant.Version="+currentTag+" -s -w -buildid=") + debugFlags = append(debugFlags, "-ldflags", "-X github.com/sagernet/sing-box/constant.Version="+currentTag) sharedTags = append(sharedTags, "with_gvisor", "with_quic", "with_wireguard", "with_ech", "with_utls", "with_clash_api") iosTags = append(iosTags, "with_dhcp", "with_low_memory", "with_conntrack") diff --git a/go.mod b/go.mod index d03cb18ffe..bb57226dfa 100644 --- a/go.mod +++ b/go.mod @@ -22,7 +22,7 @@ require ( github.com/oschwald/maxminddb-golang v1.12.0 github.com/sagernet/bbolt v0.0.0-20231014093535-ea5cb2fe9f0a github.com/sagernet/cloudflare-tls v0.0.0-20231208171750-a4483c1b7cd1 - github.com/sagernet/gomobile v0.1.1 + github.com/sagernet/gomobile v0.1.3 github.com/sagernet/gvisor v0.0.0-20231209105102-8d27a30e436e github.com/sagernet/quic-go v0.40.1 github.com/sagernet/reality v0.0.0-20230406110435-ee17307e7691 diff --git a/go.sum b/go.sum index b23196992a..2af8d2f6b3 100644 --- a/go.sum +++ b/go.sum @@ -98,8 +98,8 @@ 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/cloudflare-tls v0.0.0-20231208171750-a4483c1b7cd1 h1:YbmpqPQEMdlk9oFSKYWRqVuu9qzNiOayIonKmv1gCXY= github.com/sagernet/cloudflare-tls v0.0.0-20231208171750-a4483c1b7cd1/go.mod h1:J2yAxTFPDjrDPhuAi9aWFz2L3ox9it4qAluBBbN0H5k= -github.com/sagernet/gomobile v0.1.1 h1:3vihRGyUfFTToHMeeak0UK6/ldt2MV2bcWKFi2VyECU= -github.com/sagernet/gomobile v0.1.1/go.mod h1:Pqq2+ZVvs10U7xK+UwJgwYWUykewi8H6vlslAO73n9E= +github.com/sagernet/gomobile v0.1.3 h1:ohjIb1Ou2+1558PnZour3od69suSuvkdSVOlO1tC4B8= +github.com/sagernet/gomobile v0.1.3/go.mod h1:Pqq2+ZVvs10U7xK+UwJgwYWUykewi8H6vlslAO73n9E= github.com/sagernet/gvisor v0.0.0-20231209105102-8d27a30e436e h1:DOkjByVeAR56dkszjnMZke4wr7yM/1xHaJF3G9olkEE= github.com/sagernet/gvisor v0.0.0-20231209105102-8d27a30e436e/go.mod h1:fLxq/gtp0qzkaEwywlRRiGmjOK5ES/xUzyIKIFP2Asw= github.com/sagernet/netlink v0.0.0-20220905062125-8043b4a9aa97 h1:iL5gZI3uFp0X6EslacyapiRz7LLSJyr4RajF/BhMVyE= From 96ac931b118a0e51cab45c3b2da563e31dcbc72f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Mon, 26 Feb 2024 13:24:19 +0800 Subject: [PATCH 23/27] Fix network/interface monitor --- go.mod | 6 +++--- go.sum | 14 +++++++------- route/router.go | 6 +++++- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/go.mod b/go.mod index bb57226dfa..7155a3a812 100644 --- a/go.mod +++ b/go.mod @@ -33,7 +33,7 @@ require ( github.com/sagernet/sing-shadowsocks v0.2.6 github.com/sagernet/sing-shadowsocks2 v0.2.0 github.com/sagernet/sing-shadowtls v0.1.4 - github.com/sagernet/sing-tun v0.2.2-beta.1 + github.com/sagernet/sing-tun v0.2.3 github.com/sagernet/sing-vmess v0.1.8 github.com/sagernet/smux v0.0.0-20231208180855-7041f6ea79e7 github.com/sagernet/tfo-go v0.0.0-20231209031829-7b5343ac1dc6 @@ -44,8 +44,8 @@ require ( github.com/stretchr/testify v1.8.4 go.uber.org/zap v1.26.0 go4.org/netipx v0.0.0-20231129151722-fdeea329fbba - golang.org/x/crypto v0.18.0 - golang.org/x/net v0.20.0 + golang.org/x/crypto v0.19.0 + golang.org/x/net v0.21.0 golang.org/x/sys v0.17.0 golang.zx2c4.com/wireguard/wgctrl v0.0.0-20230429144221-925a1e7659e6 google.golang.org/grpc v1.60.1 diff --git a/go.sum b/go.sum index 2af8d2f6b3..0c97a30dbc 100644 --- a/go.sum +++ b/go.sum @@ -123,8 +123,8 @@ github.com/sagernet/sing-shadowsocks2 v0.2.0 h1:wpZNs6wKnR7mh1wV9OHwOyUr21VkS3wK github.com/sagernet/sing-shadowsocks2 v0.2.0/go.mod h1:RnXS0lExcDAovvDeniJ4IKa2IuChrdipolPYWBv9hWQ= github.com/sagernet/sing-shadowtls v0.1.4 h1:aTgBSJEgnumzFenPvc+kbD9/W0PywzWevnVpEx6Tw3k= github.com/sagernet/sing-shadowtls v0.1.4/go.mod h1:F8NBgsY5YN2beQavdgdm1DPlhaKQlaL6lpDdcBglGK4= -github.com/sagernet/sing-tun v0.2.2-beta.1 h1:B/P2TbV4ORNyZbLad4V74ZVCkgcsZG7vYqugEmof/Gc= -github.com/sagernet/sing-tun v0.2.2-beta.1/go.mod h1:w1HTPPEL575m+Ob3GOIWaTs3ZrTdgLIwoldce/p3WPU= +github.com/sagernet/sing-tun v0.2.3 h1:PTxsxgC9/j83ZAJ/c8PP6h2RjH+FpPg2jCOcktvGiUI= +github.com/sagernet/sing-tun v0.2.3/go.mod h1:GtKY1Sr2CCWLHPjVj9GZpBFZ/KoXOzVBSxXvmCCPxT4= github.com/sagernet/sing-vmess v0.1.8 h1:XVWad1RpTy9b5tPxdm5MCU8cGfrTGdR8qCq6HV2aCNc= github.com/sagernet/sing-vmess v0.1.8/go.mod h1:vhx32UNzTDUkNwOyIjcZQohre1CaytquC5mPplId8uA= github.com/sagernet/smux v0.0.0-20231208180855-7041f6ea79e7 h1:DImB4lELfQhplLTxeq2z31Fpv8CQqqrUwTbrIRumZqQ= @@ -168,16 +168,16 @@ go4.org/netipx v0.0.0-20231129151722-fdeea329fbba h1:0b9z3AuHCjxk0x/opv64kcgZLBs go4.org/netipx v0.0.0-20231129151722-fdeea329fbba/go.mod h1:PLyyIXexvUFg3Owu6p/WfdlivPbZJsZdgWZlrGope/Y= golang.org/x/crypto v0.0.0-20190404164418-38d8ce5564a5/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE= golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8= -golang.org/x/crypto v0.18.0 h1:PGVlW0xEltQnzFZ55hkuX5+KLyrMYhHld1YHO4AKcdc= -golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg= +golang.org/x/crypto v0.19.0 h1:ENy+Az/9Y1vSrlrvBSyna3PITt4tiZLf7sgCjZBX7Wo= +golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= golang.org/x/exp v0.0.0-20240119083558-1b970713d09a h1:Q8/wZp0KX97QFTc2ywcOE0YRjZPVIx+MXInMzdvQqcA= golang.org/x/exp v0.0.0-20240119083558-1b970713d09a/go.mod h1:idGWGoKP1toJGkd5/ig9ZLuPcZBC3ewk7SzmH0uou08= golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0= golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo= -golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= +golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4= +golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ= golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200217220822-9197077df867/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -191,7 +191,7 @@ golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.16.0 h1:m+B6fahuftsE9qjo0VWp2FW0mB3MTJvR0BaMQrq0pmE= +golang.org/x/term v0.17.0 h1:mkTF7LCd6WGJNL3K1Ad7kwxNfYAW6a8a8QqtMblp/4U= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= diff --git a/route/router.go b/route/router.go index df1a54a07c..a62a318b8b 100644 --- a/route/router.go +++ b/route/router.go @@ -1182,6 +1182,10 @@ func (r *Router) updateWIFIState() { state := r.platformInterface.ReadWIFIState() if state != r.wifiState { r.wifiState = state - r.logger.Info("updated WIFI state: SSID=", state.SSID, ", BSSID=", state.BSSID) + if state.SSID == "" && state.BSSID == "" { + r.logger.Info("updated WIFI state: disconnected") + } else { + r.logger.Info("updated WIFI state: SSID=", state.SSID, ", BSSID=", state.BSSID) + } } } From 02b7041de653efa27abf98577e76b182a74efaed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Mon, 26 Feb 2024 13:25:23 +0800 Subject: [PATCH 24/27] Update dependencies --- go.mod | 8 ++++---- go.sum | 20 ++++++++++---------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/go.mod b/go.mod index 7155a3a812..3dbeb5507f 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ require ( github.com/cloudflare/circl v1.3.7 github.com/cretz/bine v0.2.0 github.com/fsnotify/fsnotify v1.7.0 - github.com/go-chi/chi/v5 v5.0.11 + github.com/go-chi/chi/v5 v5.0.12 github.com/go-chi/cors v1.2.1 github.com/go-chi/render v1.0.3 github.com/gofrs/uuid/v5 v5.0.0 @@ -42,13 +42,13 @@ require ( github.com/sagernet/ws v0.0.0-20231204124109-acfe8907c854 github.com/spf13/cobra v1.8.0 github.com/stretchr/testify v1.8.4 - go.uber.org/zap v1.26.0 + go.uber.org/zap v1.27.0 go4.org/netipx v0.0.0-20231129151722-fdeea329fbba golang.org/x/crypto v0.19.0 golang.org/x/net v0.21.0 golang.org/x/sys v0.17.0 golang.zx2c4.com/wireguard/wgctrl v0.0.0-20230429144221-925a1e7659e6 - google.golang.org/grpc v1.60.1 + google.golang.org/grpc v1.62.0 google.golang.org/protobuf v1.32.0 howett.net/plist v1.0.1 ) @@ -91,7 +91,7 @@ require ( golang.org/x/text v0.14.0 // indirect golang.org/x/time v0.5.0 // indirect golang.org/x/tools v0.17.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240123012728-ef4313101c80 // indirect gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect gopkg.in/yaml.v3 v3.0.1 // indirect lukechampine.com/blake3 v1.2.1 // indirect diff --git a/go.sum b/go.sum index 0c97a30dbc..82db68112f 100644 --- a/go.sum +++ b/go.sum @@ -19,8 +19,8 @@ github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nos github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= github.com/gaukas/godicttls v0.0.4 h1:NlRaXb3J6hAnTmWdsEKb9bcSBD6BvcIjdGdeb0zfXbk= github.com/gaukas/godicttls v0.0.4/go.mod h1:l6EenT4TLWgTdwslVb4sEMOCf7Bv0JAK67deKr9/NCI= -github.com/go-chi/chi/v5 v5.0.11 h1:BnpYbFZ3T3S1WMpD79r7R5ThWX40TaFB7L31Y8xqSwA= -github.com/go-chi/chi/v5 v5.0.11/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8= +github.com/go-chi/chi/v5 v5.0.12 h1:9euLV5sTrTNTRUU9POmDUvfxyj6LAABLUcEWO+JJb4s= +github.com/go-chi/chi/v5 v5.0.12/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8= github.com/go-chi/cors v1.2.1 h1:xEC8UT3Rlp2QuWNEr4Fs/c2EAGVKBwy/1vHx3bppil4= github.com/go-chi/cors v1.2.1/go.mod h1:sSbTewc+6wYHBBCW7ytsFSn836hqM7JxpglAy2Vzc58= github.com/go-chi/render v1.0.3 h1:AsXqd2a1/INaIfUSKq3G5uA8weYx20FOsM7uSoCyyt4= @@ -42,7 +42,7 @@ github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiu github.com/google/btree v1.1.2 h1:xf4v41cLI2Z6FxbKm+8Bu+m8ifhj15JuZ9sa0jZCMUU= github.com/google/btree v1.1.2/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/pprof v0.0.0-20231101202521-4ca4178f5c7a h1:fEBsGL/sjAuJrgah5XqmmYsTLzJp/TO9Lhy39gkverk= github.com/google/pprof v0.0.0-20231101202521-4ca4178f5c7a/go.mod h1:czg5+yv1E0ZGTi6S6vVK1mke0fV+FaUhNGcd6VRS9Ik= github.com/hashicorp/yamux v0.1.1 h1:yrQxtgseBDrq9Y652vSRDvsKCJKOUD+GzTS4Y0Y8pvE= @@ -159,11 +159,11 @@ github.com/zeebo/blake3 v0.2.3 h1:TFoLXsjeXqRNFxSbk35Dk4YtszE/MQQGK10BH4ptoTg= github.com/zeebo/blake3 v0.2.3/go.mod h1:mjJjZpnsyIVtVgTOSpJ9vmRE4wgDeyt2HU3qXvvKCaQ= github.com/zeebo/pcg v1.0.1 h1:lyqfGeWiv4ahac6ttHs+I5hwtH/+1mrhlCtVNQM2kHo= github.com/zeebo/pcg v1.0.1/go.mod h1:09F0S9iiKrwn9rlI5yjLkmrug154/YRW6KnnXVDM/l4= -go.uber.org/goleak v1.2.0 h1:xqgm/S+aQvhWFTtR0XK3Jvg7z8kGV8P4X14IzwN3Eqk= +go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= -go.uber.org/zap v1.26.0 h1:sI7k6L95XOKS281NhVKOFCUNIvv9e0w4BF8N3u+tCRo= -go.uber.org/zap v1.26.0/go.mod h1:dtElttAiwGvoJ/vj4IwHBS/gXsEu/pZ50mUIRWuG0so= +go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8= +go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= go4.org/netipx v0.0.0-20231129151722-fdeea329fbba h1:0b9z3AuHCjxk0x/opv64kcgZLBseWJUpBw5I82+2U4M= go4.org/netipx v0.0.0-20231129151722-fdeea329fbba/go.mod h1:PLyyIXexvUFg3Owu6p/WfdlivPbZJsZdgWZlrGope/Y= golang.org/x/crypto v0.0.0-20190404164418-38d8ce5564a5/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE= @@ -204,10 +204,10 @@ golang.org/x/tools v0.17.0/go.mod h1:xsh6VxdV005rRVaS6SSAf9oiAqljS7UZUacMZ8Bnsps golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.zx2c4.com/wireguard/wgctrl v0.0.0-20230429144221-925a1e7659e6 h1:CawjfCvYQH2OU3/TnxLx97WDSUDRABfT18pCOYwc2GE= golang.zx2c4.com/wireguard/wgctrl v0.0.0-20230429144221-925a1e7659e6/go.mod h1:3rxYc4HtVcSG9gVaTs2GEBdehh+sYPOwKtyUWEOTb80= -google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97 h1:6GQBEOdGkX6MMTLT9V+TjtIRZCw9VPD5Z+yHY9wMgS0= -google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97/go.mod h1:v7nGkzlmW8P3n/bKmWBn2WpBjpOEx8Q6gMueudAmKfY= -google.golang.org/grpc v1.60.1 h1:26+wFr+cNqSGFcOXcabYC0lUVJVRa2Sb2ortSK7VrEU= -google.golang.org/grpc v1.60.1/go.mod h1:OlCHIeLYqSSsLi6i49B5QGdzaMZK9+M7LXN2FKz4eGM= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240123012728-ef4313101c80 h1:AjyfHzEPEFp/NpvfN5g+KDla3EMojjhRVZc1i7cj+oM= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240123012728-ef4313101c80/go.mod h1:PAREbraiVEVGVdTZsVWjSbbTtSyGbAgIIvni8a8CD5s= +google.golang.org/grpc v1.62.0 h1:HQKZ/fa1bXkX1oFOvSjmZEUL8wLSaZTjCcLAlmZRtdk= +google.golang.org/grpc v1.62.0/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= From 7359fdf1954363c772985a95f8a6b2726cea011f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Mon, 26 Feb 2024 22:49:48 +0800 Subject: [PATCH 25/27] platform: Upgrade NDK to the latest LTS version --- .goreleaser.yaml | 8 ++++---- clients/android | 2 +- cmd/internal/build_shared/sdk.go | 23 +++++++++++++---------- 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 7f9087f58b..873e8a0134 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -84,8 +84,8 @@ builds: goarch: arm goarm: 7 env: - - CC=armv7a-linux-androideabi19-clang - - CXX=armv7a-linux-androideabi19-clang++ + - CC=armv7a-linux-androideabi21-clang + - CXX=armv7a-linux-androideabi21-clang++ - goos: android goarch: arm64 env: @@ -94,8 +94,8 @@ builds: - goos: android goarch: 386 env: - - CC=i686-linux-android19-clang - - CXX=i686-linux-android19-clang++ + - CC=i686-linux-android21-clang + - CXX=i686-linux-android21-clang++ - goos: android goarch: amd64 goamd64: v1 diff --git a/clients/android b/clients/android index 6602817671..c8db11f062 160000 --- a/clients/android +++ b/clients/android @@ -1 +1 @@ -Subproject commit 660281767171d26795018bad577f77e7e6bcdb91 +Subproject commit c8db11f06251e861a2733db596bf74e5497658cf diff --git a/cmd/internal/build_shared/sdk.go b/cmd/internal/build_shared/sdk.go index 0c447ba132..ce7f0c86d0 100644 --- a/cmd/internal/build_shared/sdk.go +++ b/cmd/internal/build_shared/sdk.go @@ -30,7 +30,7 @@ func FindSDK() { } for _, path := range searchPath { path = os.ExpandEnv(path) - if rw.FileExists(path + "/licenses/android-sdk-license") { + if rw.FileExists(filepath.Join(path, "licenses", "android-sdk-license")) { androidSDKPath = path break } @@ -58,11 +58,13 @@ func FindSDK() { } func findNDK() bool { - if rw.FileExists(androidSDKPath + "/ndk/25.1.8937393") { - androidNDKPath = androidSDKPath + "/ndk/25.1.8937393" + const fixedVersion = "26.2.11394342" + const versionFile = "source.properties" + if fixedPath := filepath.Join(androidSDKPath, "ndk", fixedVersion); rw.FileExists(filepath.Join(fixedPath, versionFile)) { + androidNDKPath = fixedPath return true } - ndkVersions, err := os.ReadDir(androidSDKPath + "/ndk") + ndkVersions, err := os.ReadDir(filepath.Join(androidSDKPath, "ndk")) if err != nil { return false } @@ -83,8 +85,10 @@ func findNDK() bool { return true }) for _, versionName := range versionNames { - if rw.FileExists(androidSDKPath + "/ndk/" + versionName) { - androidNDKPath = androidSDKPath + "/ndk/" + versionName + currentNDKPath := filepath.Join(androidSDKPath, "ndk", versionName) + if rw.FileExists(filepath.Join(androidSDKPath, versionFile)) { + androidNDKPath = currentNDKPath + log.Warn("reproducibility warning: using NDK version " + versionName + " instead of " + fixedVersion) return true } } @@ -95,13 +99,12 @@ var GoBinPath string func FindMobile() { goBin := filepath.Join(build.Default.GOPATH, "bin") - if runtime.GOOS == "windows" { - if !rw.FileExists(goBin + "/" + "gobind.exe") { - log.Fatal("missing gomobile.exe installation") + if !rw.FileExists(filepath.Join(goBin, "gobind.exe")) { + log.Fatal("missing gomobile installation") } } else { - if !rw.FileExists(goBin + "/" + "gobind") { + if !rw.FileExists(filepath.Join(goBin, "gobind")) { log.Fatal("missing gomobile installation") } } From 1bc893a73ad48145f26fc3cc73711ef6e9bc028f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Wed, 28 Feb 2024 12:01:34 +0800 Subject: [PATCH 26/27] documentation: Update privacy policy to make Play Store happy --- docs/clients/privacy.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/clients/privacy.md b/docs/clients/privacy.md index f8b51afd1a..b1ecd2aa34 100644 --- a/docs/clients/privacy.md +++ b/docs/clients/privacy.md @@ -6,3 +6,9 @@ icon: material/security sing-box and official graphics clients do not collect or share personal data, and the data generated by the software is always on your device. + +## Android + +If your configuration contains `wifi_ssid` or `wifi_bssid` routing rules, +sing-box uses the location permission in the background +to get information about the connected Wi-Fi network to make them work. From f288e3898b047a0287b3c2041826e03a691221f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Mon, 26 Feb 2024 22:56:04 +0800 Subject: [PATCH 27/27] Bump version --- docs/changelog.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/changelog.md b/docs/changelog.md index b78b402faf..76f9a2cfbb 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -2,6 +2,10 @@ icon: material/alert-decagram --- +#### 1.8.7 + +* Fixes and improvements + #### 1.8.6 * Fixes and improvements