mirror of
https://github.com/shtorm-7/sing-box-extended.git
synced 2026-12-01 14:18:36 +00:00
merge: Merge upstream v1.14.6
This commit is contained in:
@@ -1 +1 @@
|
||||
0d28acc44093df24b2526dea3d6ffefd6b0a54f0
|
||||
ccefd17767e7b91299e0d54a6b1bb0468cf9173f
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
--- a/src/internal/cpu/cpu_arm64_other.go
|
||||
+++ b/src/internal/cpu/cpu_arm64_other.go
|
||||
@@ -2,7 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
-//go:build arm64 && !linux && !freebsd && !android && (!darwin || ios) && !openbsd
|
||||
+//go:build arm64 && !linux && !freebsd && !android && (!darwin || ios) && !openbsd && !windows
|
||||
|
||||
package cpu
|
||||
|
||||
--- a/src/internal/cpu/cpu_arm64_windows.go
|
||||
+++ b/src/internal/cpu/cpu_arm64_windows.go
|
||||
@@ -0,0 +1,26 @@
|
||||
+// Copyright 2026 The Go Authors. All rights reserved.
|
||||
+// Use of this source code is governed by a BSD-style
|
||||
+// license that can be found in the LICENSE file.
|
||||
+
|
||||
+//go:build arm64
|
||||
+
|
||||
+package cpu
|
||||
+
|
||||
+func osInit() {
|
||||
+ // TODO(brainman): we don't know how to retrieve those bits form user space - leaving them as false for now
|
||||
+ // https://github.com/golang/go/issues/76791#issuecomment-3877873959
|
||||
+ ARM64.HasCPUID = false
|
||||
+ ARM64.HasDIT = false
|
||||
+ ARM64.IsNeoverse = false
|
||||
+
|
||||
+ if isProcessorFeaturePresent(_PF_ARM_V8_CRYPTO_INSTRUCTIONS_AVAILABLE) {
|
||||
+ ARM64.HasAES = true
|
||||
+ ARM64.HasPMULL = true
|
||||
+ ARM64.HasSHA1 = true
|
||||
+ ARM64.HasSHA2 = true
|
||||
+ }
|
||||
+ ARM64.HasSHA3 = isProcessorFeaturePresent(_PF_ARM_SHA3_INSTRUCTIONS_AVAILABLE)
|
||||
+ ARM64.HasCRC32 = isProcessorFeaturePresent(_PF_ARM_V8_CRC32_INSTRUCTIONS_AVAILABLE)
|
||||
+ ARM64.HasSHA512 = isProcessorFeaturePresent(_PF_ARM_SHA512_INSTRUCTIONS_AVAILABLE)
|
||||
+ ARM64.HasATOMICS = isProcessorFeaturePresent(_PF_ARM_V81_ATOMIC_INSTRUCTIONS_AVAILABLE)
|
||||
+}
|
||||
--- a/src/internal/cpu/cpu_windows.go
|
||||
+++ b/src/internal/cpu/cpu_windows.go
|
||||
@@ -0,0 +1,20 @@
|
||||
+// Copyright 2026 The Go Authors. All rights reserved.
|
||||
+// Use of this source code is governed by a BSD-style
|
||||
+// license that can be found in the LICENSE file.
|
||||
+
|
||||
+package cpu
|
||||
+
|
||||
+import _ "unsafe" // for linkname
|
||||
+
|
||||
+const (
|
||||
+ _PF_ARM_V8_CRYPTO_INSTRUCTIONS_AVAILABLE = 30
|
||||
+ _PF_ARM_V8_CRC32_INSTRUCTIONS_AVAILABLE = 31
|
||||
+ _PF_ARM_V81_ATOMIC_INSTRUCTIONS_AVAILABLE = 34
|
||||
+ _PF_ARM_SHA3_INSTRUCTIONS_AVAILABLE = 64
|
||||
+ _PF_ARM_SHA512_INSTRUCTIONS_AVAILABLE = 65
|
||||
+)
|
||||
+
|
||||
+// isProcessorFeaturePresent calls windows IsProcessorFeaturePresent API.
|
||||
+//
|
||||
+//go:linkname isProcessorFeaturePresent
|
||||
+func isProcessorFeaturePresent(processorFeature uint32) bool // Implemented in runtime package.
|
||||
--- a/src/runtime/os_windows.go
|
||||
+++ b/src/runtime/os_windows.go
|
||||
@@ -39,6 +39,7 @@ const (
|
||||
//go:cgo_import_dynamic runtime._GetSystemDirectoryA GetSystemDirectoryA%2 "kernel32.dll"
|
||||
//go:cgo_import_dynamic runtime._GetSystemInfo GetSystemInfo%1 "kernel32.dll"
|
||||
//go:cgo_import_dynamic runtime._GetThreadContext GetThreadContext%2 "kernel32.dll"
|
||||
+//go:cgo_import_dynamic runtime._IsProcessorFeaturePresent IsProcessorFeaturePresent%1 "kernel32.dll"
|
||||
//go:cgo_import_dynamic runtime._SetThreadContext SetThreadContext%2 "kernel32.dll"
|
||||
//go:cgo_import_dynamic runtime._LoadLibraryExW LoadLibraryExW%3 "kernel32.dll"
|
||||
//go:cgo_import_dynamic runtime._PostQueuedCompletionStatus PostQueuedCompletionStatus%4 "kernel32.dll"
|
||||
@@ -96,6 +97,7 @@ var (
|
||||
_GetSystemDirectoryA,
|
||||
_GetSystemInfo,
|
||||
_GetThreadContext,
|
||||
+ _IsProcessorFeaturePresent,
|
||||
_SetThreadContext,
|
||||
_LoadLibraryExW,
|
||||
_PostQueuedCompletionStatus,
|
||||
@@ -261,6 +263,12 @@ func windows_QueryPerformanceFrequency() int64 {
|
||||
return frequency
|
||||
}
|
||||
|
||||
+//go:linkname cpu_isProcessorFeaturePresent internal/cpu.isProcessorFeaturePresent
|
||||
+func cpu_isProcessorFeaturePresent(processorFeature uint32) bool {
|
||||
+ ret := stdcall(_IsProcessorFeaturePresent, uintptr(processorFeature))
|
||||
+ return ret != 0
|
||||
+}
|
||||
+
|
||||
func loadOptionalSyscalls() {
|
||||
bcryptPrimitives := windowsLoadSystemLib(bcryptprimitivesdll[:])
|
||||
if bcryptPrimitives == 0 {
|
||||
Executable
+31
@@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
# Go's internal/cpu never detects ARM64 features on windows/arm64 before Go 1.27,
|
||||
# so crypto/aes, AES-GCM and crypto/sha256 use their generic implementations.
|
||||
# Backport of https://go.dev/cl/745560 (golang/go#76791).
|
||||
#
|
||||
# Remove once the Go release used by the Windows builds includes the fix.
|
||||
|
||||
export GOTOOLCHAIN=local
|
||||
|
||||
GOROOT="$(go env GOROOT)"
|
||||
PATCH_FILE="$(cd "$(dirname "$0")" && pwd)/go_windows_arm64_cpu_features.patch"
|
||||
|
||||
cd "$GOROOT"
|
||||
if [[ -f src/internal/cpu/cpu_arm64_windows.go ]]; then
|
||||
echo "already patched"
|
||||
else
|
||||
patch --verbose -p1 < "$PATCH_FILE"
|
||||
fi
|
||||
|
||||
CPU_FILES="$(GOOS=windows GOARCH=arm64 CGO_ENABLED=0 go list -f '{{.GoFiles}}' internal/cpu)"
|
||||
echo "internal/cpu files for windows/arm64: $CPU_FILES"
|
||||
case "$CPU_FILES" in
|
||||
*cpu_arm64_windows.go*) ;;
|
||||
*)
|
||||
echo "patch is not effective" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
VERSION="1.26.8"
|
||||
VERSION="1.26.11"
|
||||
PATCH_COMMITS=(
|
||||
"f080b0c6346eb690c0dc82497b35925f385b35ac"
|
||||
"2d9c12887c342fb9051d231aa5388743cb7e9cb6"
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
VERSION="1.26.8"
|
||||
VERSION="1.26.11"
|
||||
PATCH_COMMITS=(
|
||||
"a4ae550aa148b04c9d4890e98bee63aede5c4b53"
|
||||
"95b851f661584711faa8115b3234a461044f4510"
|
||||
|
||||
+45
-18
@@ -54,7 +54,7 @@ jobs:
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: 1.26.8
|
||||
go-version: 1.26.11
|
||||
cache: false
|
||||
- name: Cache Go modules
|
||||
uses: actions/cache/restore@v4
|
||||
@@ -145,7 +145,7 @@ jobs:
|
||||
if: ${{ ! matrix.legacy_win7 }}
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: 1.26.8
|
||||
go-version: 1.26.11
|
||||
cache: false
|
||||
- name: Cache Go modules
|
||||
uses: actions/cache/restore@v4
|
||||
@@ -160,7 +160,7 @@ jobs:
|
||||
with:
|
||||
path: |
|
||||
~/go/go_win7
|
||||
key: go_win7_1268
|
||||
key: go_win7_12611
|
||||
- name: Setup Go for Windows 7
|
||||
if: matrix.legacy_win7 && steps.cache-go-for-windows7.outputs.cache-hit != 'true'
|
||||
env:
|
||||
@@ -224,6 +224,8 @@ jobs:
|
||||
set -xeuo pipefail
|
||||
if [[ "${{ matrix.naive }}" == "true" ]]; then
|
||||
TAGS=$(cat release/DEFAULT_BUILD_TAGS)
|
||||
elif [[ "${{ matrix.legacy_win7 }}" == "true" ]]; then
|
||||
TAGS=$(sed 's/,with_usbip//' release/DEFAULT_BUILD_TAGS_OTHERS)
|
||||
else
|
||||
TAGS=$(cat release/DEFAULT_BUILD_TAGS_OTHERS)
|
||||
fi
|
||||
@@ -488,7 +490,7 @@ jobs:
|
||||
if: ${{ ! matrix.legacy_osx }}
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: 1.26.8
|
||||
go-version: 1.26.11
|
||||
cache: false
|
||||
- name: Cache Go modules
|
||||
uses: actions/cache/restore@v4
|
||||
@@ -503,7 +505,7 @@ jobs:
|
||||
with:
|
||||
path: |
|
||||
~/go/go_osx
|
||||
key: go_osx_1268
|
||||
key: go_osx_12611
|
||||
- name: Setup Go for macOS 10.13
|
||||
if: matrix.legacy_osx && steps.cache-go-for-macos1013.outputs.cache-hit != 'true'
|
||||
env:
|
||||
@@ -587,8 +589,12 @@ jobs:
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: 1.26.8
|
||||
go-version: 1.26.11
|
||||
cache: false
|
||||
- name: Patch Go for Windows ARM64
|
||||
if: matrix.arch == 'arm64'
|
||||
shell: bash
|
||||
run: .github/patch_go_for_windows_arm64.sh
|
||||
- name: Cache Go modules
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
@@ -690,7 +696,7 @@ jobs:
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: 1.26.8
|
||||
go-version: 1.26.11
|
||||
cache: false
|
||||
- name: Cache Go modules
|
||||
uses: actions/cache@v4
|
||||
@@ -754,7 +760,7 @@ jobs:
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: 1.26.8
|
||||
go-version: 1.26.11
|
||||
cache: false
|
||||
- name: Cache Go modules
|
||||
uses: actions/cache/restore@v4
|
||||
@@ -862,7 +868,7 @@ jobs:
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: 1.26.8
|
||||
go-version: 1.26.11
|
||||
cache: false
|
||||
- name: Cache Go modules
|
||||
uses: actions/cache/restore@v4
|
||||
@@ -975,8 +981,12 @@ jobs:
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: 1.26.8
|
||||
go-version: 1.26.11
|
||||
cache: false
|
||||
- name: Patch Go for Windows ARM64
|
||||
if: matrix.desktop_arch == 'arm64'
|
||||
shell: bash
|
||||
run: .github/patch_go_for_windows_arm64.sh
|
||||
- name: Cache Go modules
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
@@ -1066,9 +1076,9 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- { desktop_arch: x64, go_arch: amd64 }
|
||||
- { desktop_arch: arm64, go_arch: arm64 }
|
||||
- { desktop_arch: armv7l, go_arch: arm, go_arm: "7" }
|
||||
- { desktop_arch: x64, go_arch: amd64, rust_target: x86_64-unknown-linux-gnu }
|
||||
- { desktop_arch: arm64, go_arch: arm64, rust_target: aarch64-unknown-linux-gnu }
|
||||
- { desktop_arch: armv7l, go_arch: arm, go_arm: "7", rust_target: armv7-unknown-linux-gnueabihf }
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
|
||||
@@ -1087,7 +1097,7 @@ jobs:
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: 1.26.8
|
||||
go-version: 1.26.11
|
||||
cache: false
|
||||
- name: Cache Go modules
|
||||
uses: actions/cache@v4
|
||||
@@ -1095,6 +1105,23 @@ jobs:
|
||||
path: ~/go/pkg/mod
|
||||
key: go-mod-desktop-linux-${{ hashFiles('go.sum') }}
|
||||
restore-keys: go-mod-desktop-linux-
|
||||
- name: Setup Rust
|
||||
uses: dtolnay/rust-toolchain@1.88.0
|
||||
with:
|
||||
targets: ${{ matrix.rust_target }}
|
||||
- name: Setup Zig
|
||||
uses: mlugg/setup-zig@v2
|
||||
with:
|
||||
version: 0.16.0
|
||||
- name: Cache Wayland menu module
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/git
|
||||
~/.cargo/registry
|
||||
clients/desktop/bin/wayland-menu-toolchain
|
||||
key: wayland-menu-${{ matrix.rust_target }}-${{ hashFiles('clients/desktop/native/wayland-menu/Cargo.lock') }}
|
||||
restore-keys: wayland-menu-${{ matrix.rust_target }}-
|
||||
- name: Setup pnpm
|
||||
uses: pnpm/action-setup@v4
|
||||
with:
|
||||
@@ -1244,7 +1271,7 @@ jobs:
|
||||
if: matrix.build
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: 1.26.8
|
||||
go-version: 1.26.11
|
||||
cache: false
|
||||
- name: Patch Go for iOS
|
||||
if: matrix.build && (matrix.platform == 'ios/arm64' || matrix.platform == 'tvos/arm64')
|
||||
@@ -1261,8 +1288,8 @@ jobs:
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/Library/Caches/go-build
|
||||
key: libbox-go-build-${{ matrix.artifact }}-1.26.8-${{ hashFiles('go.sum') }}
|
||||
restore-keys: libbox-go-build-${{ matrix.artifact }}-1.26.8-
|
||||
key: libbox-go-build-${{ matrix.artifact }}-1.26.11-${{ hashFiles('go.sum') }}
|
||||
restore-keys: libbox-go-build-${{ matrix.artifact }}-1.26.11-
|
||||
- name: Set tag
|
||||
if: matrix.build
|
||||
run: git tag v${{ needs.calculate_version.outputs.version }} -f
|
||||
@@ -1331,7 +1358,7 @@ jobs:
|
||||
if: matrix.if
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: 1.26.8
|
||||
go-version: 1.26.11
|
||||
cache: false
|
||||
- name: Cache Go modules
|
||||
if: matrix.if
|
||||
|
||||
@@ -55,7 +55,7 @@ jobs:
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: 1.26.8
|
||||
go-version: 1.26.11
|
||||
- name: Clone cronet-go
|
||||
if: matrix.naive
|
||||
run: |
|
||||
|
||||
@@ -29,7 +29,7 @@ jobs:
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: 1.26.8
|
||||
go-version: 1.26.11
|
||||
- name: Check input version
|
||||
if: github.event_name == 'workflow_dispatch'
|
||||
run: |-
|
||||
@@ -72,7 +72,7 @@ jobs:
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: 1.26.8
|
||||
go-version: 1.26.11
|
||||
- name: Clone cronet-go
|
||||
if: matrix.naive
|
||||
run: |
|
||||
|
||||
@@ -33,7 +33,6 @@ jobs:
|
||||
- windows-latest
|
||||
- macos-latest
|
||||
go:
|
||||
- ~1.25
|
||||
- ~1.26
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
|
||||
Reference in New Issue
Block a user