mirror of
https://github.com/SagerNet/sing-box.git
synced 2025-08-27 04:27:35 +08:00
Compare commits
112 Commits
35df5635c5
...
b7a622cac0
Author | SHA1 | Date | |
---|---|---|---|
![]() |
b7a622cac0 | ||
![]() |
a7d14d4044 | ||
![]() |
8802c88243 | ||
![]() |
182d85269d | ||
![]() |
1da72a6532 | ||
![]() |
16e05be1be | ||
![]() |
259a140453 | ||
![]() |
54760eeaaa | ||
![]() |
a870c36d2d | ||
![]() |
1054f58751 | ||
![]() |
6981dfe0c0 | ||
![]() |
719d0d3c31 | ||
![]() |
8f5fad3f9d | ||
![]() |
c2e9c30efc | ||
![]() |
3da06f0db8 | ||
![]() |
acb5065198 | ||
![]() |
c6a7d8c587 | ||
![]() |
a9ff1cbf78 | ||
![]() |
94e0d6b4ab | ||
![]() |
93c866a900 | ||
![]() |
40451f8957 | ||
![]() |
2a2ca1bef6 | ||
![]() |
e156abb0ab | ||
![]() |
94d70a2a97 | ||
![]() |
4b2cda1c76 | ||
![]() |
6e8e007352 | ||
![]() |
d18a35c414 | ||
![]() |
ea31ebb2a3 | ||
![]() |
0951711c08 | ||
![]() |
fdd8d3e23e | ||
![]() |
53feae6a6e | ||
![]() |
b63eba13ef | ||
![]() |
a2c52fb21b | ||
![]() |
01d06c0d29 | ||
![]() |
01b11f3d4e | ||
![]() |
567c98dc9e | ||
![]() |
f8a64a6554 | ||
![]() |
5dd021e979 | ||
![]() |
a3f9196fdc | ||
![]() |
42102b3fc4 | ||
![]() |
c0e5fe78ab | ||
![]() |
ad7bb47bf6 | ||
![]() |
58779f99ce | ||
![]() |
b14782771b | ||
![]() |
51816e0cd2 | ||
![]() |
0b7ea0c6c6 | ||
![]() |
cac33150d8 | ||
![]() |
31bd6bb5cb | ||
![]() |
7f26d21a28 | ||
![]() |
14a8e87e2f | ||
![]() |
38e3766c33 | ||
![]() |
1be391470a | ||
![]() |
560f567881 | ||
![]() |
53dfdd1ec6 | ||
![]() |
69fe3b16f1 | ||
![]() |
85d80deec8 | ||
![]() |
2570b11ea4 | ||
![]() |
d4d1ea7129 | ||
![]() |
5852b5ba94 | ||
![]() |
655674bb9b | ||
![]() |
a55d597212 | ||
![]() |
183aed8253 | ||
![]() |
8f1885bef8 | ||
![]() |
4a13f9828c | ||
![]() |
659b4988ce | ||
![]() |
de1053f2cf | ||
![]() |
f7200c72f2 | ||
![]() |
0febed9b60 | ||
![]() |
ba2ad571d3 | ||
![]() |
36c171aeac | ||
![]() |
76630b474a | ||
![]() |
9a0d4e4ec6 | ||
![]() |
9eaebb970b | ||
![]() |
8f890bcd9a | ||
![]() |
529c0a1e64 | ||
![]() |
00fd52854b | ||
![]() |
043954df8c | ||
![]() |
5acf9344f1 | ||
![]() |
96f96b5b28 | ||
![]() |
2ad59c6bf1 | ||
![]() |
a3bbdaf61e | ||
![]() |
344ee5df43 | ||
![]() |
47c35f5e7a | ||
![]() |
7101407b87 | ||
![]() |
79f84b4333 | ||
![]() |
b9d37ce9f7 | ||
![]() |
e73bb73290 | ||
![]() |
f1623edb5a | ||
![]() |
f42aba5d46 | ||
![]() |
67d934a301 | ||
![]() |
9fbbc0a74e | ||
![]() |
ec0c882efe | ||
![]() |
167a674b8c | ||
![]() |
8df3f470a0 | ||
![]() |
e338c88a5d | ||
![]() |
4b28d626b5 | ||
![]() |
aa9bceecb2 | ||
![]() |
f10bce28a3 | ||
![]() |
7d4f76abea | ||
![]() |
9e27c304b9 | ||
![]() |
b2cb1a39a6 | ||
![]() |
0b790fbabe | ||
![]() |
56e6653c6e | ||
![]() |
5738174060 | ||
![]() |
909893afa9 | ||
![]() |
efdf801332 | ||
![]() |
88fa375f7e | ||
![]() |
f7797e9d34 | ||
![]() |
fb7a7239fd | ||
![]() |
bca97c10a4 | ||
![]() |
7d3ee29bd0 | ||
![]() |
cba0e46aba |
73
.github/workflows/build.yml
vendored
73
.github/workflows/build.yml
vendored
@ -437,28 +437,24 @@ jobs:
|
|||||||
platform: ios
|
platform: ios
|
||||||
scheme: SFI
|
scheme: SFI
|
||||||
destination: 'generic/platform=iOS'
|
destination: 'generic/platform=iOS'
|
||||||
archive: build/SFI.xcarchive
|
|
||||||
upload: SFI/Upload.plist
|
upload: SFI/Upload.plist
|
||||||
- name: macOS
|
- name: macOS
|
||||||
if: ${{ github.event_name != 'workflow_dispatch' || inputs.build == 'All' || inputs.build == 'Apple' || inputs.build == 'app-store'|| inputs.build == 'macOS' }}
|
if: ${{ github.event_name != 'workflow_dispatch' || inputs.build == 'All' || inputs.build == 'Apple' || inputs.build == 'app-store'|| inputs.build == 'macOS' }}
|
||||||
platform: macos
|
platform: macos
|
||||||
scheme: SFM
|
scheme: SFM
|
||||||
destination: 'generic/platform=macOS'
|
destination: 'generic/platform=macOS'
|
||||||
archive: build/SFM.xcarchive
|
|
||||||
upload: SFI/Upload.plist
|
upload: SFI/Upload.plist
|
||||||
- name: tvOS
|
- name: tvOS
|
||||||
if: ${{ github.event_name != 'workflow_dispatch' || inputs.build == 'All' || inputs.build == 'Apple' || inputs.build == 'app-store'|| inputs.build == 'tvOS' }}
|
if: ${{ github.event_name != 'workflow_dispatch' || inputs.build == 'All' || inputs.build == 'Apple' || inputs.build == 'app-store'|| inputs.build == 'tvOS' }}
|
||||||
platform: tvos
|
platform: tvos
|
||||||
scheme: SFT
|
scheme: SFT
|
||||||
destination: 'generic/platform=tvOS'
|
destination: 'generic/platform=tvOS'
|
||||||
archive: build/SFT.xcarchive
|
|
||||||
upload: SFI/Upload.plist
|
upload: SFI/Upload.plist
|
||||||
- name: macOS-standalone
|
- name: macOS-standalone
|
||||||
if: ${{ github.event_name != 'workflow_dispatch' || inputs.build == 'All' || inputs.build == 'Apple' || inputs.build == 'macOS-standalone' }}
|
if: ${{ github.event_name != 'workflow_dispatch' || inputs.build == 'All' || inputs.build == 'Apple' || inputs.build == 'macOS-standalone' }}
|
||||||
platform: macos
|
platform: macos
|
||||||
scheme: SFM.System
|
scheme: SFM.System
|
||||||
destination: 'generic/platform=macOS'
|
destination: 'generic/platform=macOS'
|
||||||
archive: build/SFM.System.xcarchive
|
|
||||||
export: SFM.System/Export.plist
|
export: SFM.System/Export.plist
|
||||||
export_path: build/SFM.System
|
export_path: build/SFM.System
|
||||||
steps:
|
steps:
|
||||||
@ -543,6 +539,12 @@ jobs:
|
|||||||
export PATH="$PATH:$(go env GOPATH)/bin"
|
export PATH="$PATH:$(go env GOPATH)/bin"
|
||||||
go run ./cmd/internal/build_libbox -target apple -platform ${{ matrix.platform }}
|
go run ./cmd/internal/build_libbox -target apple -platform ${{ matrix.platform }}
|
||||||
mv Libbox.xcframework clients/apple
|
mv Libbox.xcframework clients/apple
|
||||||
|
- name: Build library with tailscale
|
||||||
|
if: matrix.if && (matrix.name == 'iOS' || matrix.name == 'tvOS')
|
||||||
|
run: |-
|
||||||
|
export PATH="$PATH:$(go env GOPATH)/bin"
|
||||||
|
go run ./cmd/internal/build_libbox -target apple -platform ${{ matrix.platform }} -tailscale
|
||||||
|
mv Libbox.xcframework clients/apple/Libbox.WithTailscale.xcframework
|
||||||
- name: Update macOS version
|
- name: Update macOS version
|
||||||
if: matrix.if && matrix.name == 'macOS' && github.event_name == 'workflow_dispatch'
|
if: matrix.if && matrix.name == 'macOS' && github.event_name == 'workflow_dispatch'
|
||||||
run: |-
|
run: |-
|
||||||
@ -561,18 +563,71 @@ jobs:
|
|||||||
-scheme "${{ matrix.scheme }}" \
|
-scheme "${{ matrix.scheme }}" \
|
||||||
-configuration Release \
|
-configuration Release \
|
||||||
-destination "${{ matrix.destination }}" \
|
-destination "${{ matrix.destination }}" \
|
||||||
-archivePath "${{ matrix.archive }}" \
|
-archivePath "build/${{ matrix.scheme }}.xcarchive" \
|
||||||
-allowProvisioningUpdates \
|
-allowProvisioningUpdates \
|
||||||
-authenticationKeyPath $ASC_KEY_PATH \
|
-authenticationKeyPath $ASC_KEY_PATH \
|
||||||
-authenticationKeyID $ASC_KEY_ID \
|
-authenticationKeyID $ASC_KEY_ID \
|
||||||
-authenticationKeyIssuerID $ASC_KEY_ISSUER_ID
|
-authenticationKeyIssuerID $ASC_KEY_ISSUER_ID
|
||||||
|
- name: Build with Tailscale
|
||||||
|
if: matrix.if && (matrix.name == 'iOS' || matrix.name == 'tvOS')
|
||||||
|
run: |-
|
||||||
|
cd clients/apple
|
||||||
|
mv Libbox.xcframework Libbox.WithoutTailscale.xcframework
|
||||||
|
mv Libbox.WithTailscale.xcframework Libbox.xcframework
|
||||||
|
xcodebuild archive \
|
||||||
|
-scheme "${{ matrix.scheme }}" \
|
||||||
|
-configuration Release \
|
||||||
|
-destination "${{ matrix.destination }}" \
|
||||||
|
-archivePath "build/${{ matrix.scheme }}.WithTailscale.xcarchive" \
|
||||||
|
-allowProvisioningUpdates \
|
||||||
|
-authenticationKeyPath $ASC_KEY_PATH \
|
||||||
|
-authenticationKeyID $ASC_KEY_ID \
|
||||||
|
-authenticationKeyIssuerID $ASC_KEY_ISSUER_ID
|
||||||
|
- name: Export IPA
|
||||||
|
if: matrix.if && (matrix.name == 'iOS' || matrix.name == 'tvOS') && github.event_name == 'workflow_dispatch'
|
||||||
|
run: |-
|
||||||
|
pushd clients/apple
|
||||||
|
xcodebuild -exportArchive \
|
||||||
|
-archivePath "build/${{ matrix.scheme }}.xcarchive" \
|
||||||
|
-exportOptionsPlist SFI/Export.plist \
|
||||||
|
-exportPath "build/${{ matrix.scheme }}" \
|
||||||
|
-allowProvisioningUpdates \
|
||||||
|
-authenticationKeyPath $ASC_KEY_PATH \
|
||||||
|
-authenticationKeyID $ASC_KEY_ID \
|
||||||
|
-authenticationKeyIssuerID $ASC_KEY_ISSUER_ID
|
||||||
|
cp build/${{ matrix.scheme }}/sing-box.ipa .
|
||||||
|
popd
|
||||||
|
mkdir -p dist
|
||||||
|
cp clients/apple/sing-box.ipa "dist/${{ matrix.scheme }}-${{ needs.calculate_version.outputs.version }}.ipa"
|
||||||
|
- name: Export IPA with Tailscale
|
||||||
|
if: matrix.if && (matrix.name == 'iOS' || matrix.name == 'tvOS') && github.event_name == 'workflow_dispatch'
|
||||||
|
run: |-
|
||||||
|
pushd clients/apple
|
||||||
|
xcodebuild -exportArchive \
|
||||||
|
-archivePath "build/${{ matrix.scheme }}.WithTailscale.xcarchive" \
|
||||||
|
-exportOptionsPlist SFI/Export.plist \
|
||||||
|
-exportPath "build/${{ matrix.scheme }}.WithTailscale" \
|
||||||
|
-allowProvisioningUpdates \
|
||||||
|
-authenticationKeyPath $ASC_KEY_PATH \
|
||||||
|
-authenticationKeyID $ASC_KEY_ID \
|
||||||
|
-authenticationKeyIssuerID $ASC_KEY_ISSUER_ID
|
||||||
|
cp build/${{ matrix.scheme }}.WithTailscale/sing-box.ipa .
|
||||||
|
popd
|
||||||
|
mkdir -p dist
|
||||||
|
cp clients/apple/sing-box.ipa "dist/${{ matrix.scheme }}-${{ needs.calculate_version.outputs.version }}-WithTailscale.ipa"
|
||||||
|
- name: Upload IPA
|
||||||
|
if: matrix.if && (matrix.name == 'iOS' || matrix.name == 'tvOS') && github.event_name == 'workflow_dispatch'
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: binary-${{ matrix.name }}-ipa
|
||||||
|
path: 'dist'
|
||||||
- name: Upload to App Store Connect
|
- name: Upload to App Store Connect
|
||||||
if: matrix.if && matrix.name != 'macOS-standalone' && github.event_name == 'workflow_dispatch'
|
if: matrix.if && matrix.name != 'macOS-standalone' && github.event_name == 'workflow_dispatch'
|
||||||
run: |-
|
run: |-
|
||||||
go run -v ./cmd/internal/app_store_connect cancel_app_store ${{ matrix.platform }}
|
go run -v ./cmd/internal/app_store_connect cancel_app_store ${{ matrix.platform }}
|
||||||
cd clients/apple
|
cd clients/apple
|
||||||
xcodebuild -exportArchive \
|
xcodebuild -exportArchive \
|
||||||
-archivePath "${{ matrix.archive }}" \
|
-archivePath "build/${{ matrix.scheme }}.xcarchive" \
|
||||||
-exportOptionsPlist ${{ matrix.upload }} \
|
-exportOptionsPlist ${{ matrix.upload }} \
|
||||||
-allowProvisioningUpdates \
|
-allowProvisioningUpdates \
|
||||||
-authenticationKeyPath $ASC_KEY_PATH \
|
-authenticationKeyPath $ASC_KEY_PATH \
|
||||||
@ -587,7 +642,7 @@ jobs:
|
|||||||
run: |-
|
run: |-
|
||||||
pushd clients/apple
|
pushd clients/apple
|
||||||
xcodebuild -exportArchive \
|
xcodebuild -exportArchive \
|
||||||
-archivePath "${{ matrix.archive }}" \
|
-archivePath "build/${{ matrix.scheme }}.xcarchive" \
|
||||||
-exportOptionsPlist ${{ matrix.export }} \
|
-exportOptionsPlist ${{ matrix.export }} \
|
||||||
-exportPath "${{ matrix.export_path }}"
|
-exportPath "${{ matrix.export_path }}"
|
||||||
brew install create-dmg
|
brew install create-dmg
|
||||||
@ -600,13 +655,13 @@ jobs:
|
|||||||
--skip-jenkins \
|
--skip-jenkins \
|
||||||
SFM.dmg "${{ matrix.export_path }}/SFM.app"
|
SFM.dmg "${{ matrix.export_path }}/SFM.app"
|
||||||
xcrun notarytool submit "SFM.dmg" --wait --keychain-profile "notarytool-password"
|
xcrun notarytool submit "SFM.dmg" --wait --keychain-profile "notarytool-password"
|
||||||
cd "${{ matrix.archive }}"
|
cd "build/${{ matrix.scheme }}.xcarchive"
|
||||||
zip -r SFM.dSYMs.zip dSYMs
|
zip -r SFM.dSYMs.zip dSYMs
|
||||||
popd
|
popd
|
||||||
|
|
||||||
mkdir -p dist
|
mkdir -p dist
|
||||||
cp clients/apple/SFM.dmg "dist/SFM-${VERSION}-universal.dmg"
|
cp clients/apple/SFM.dmg "dist/SFM-${VERSION}-universal.dmg"
|
||||||
cp "clients/apple/${{ matrix.archive }}/SFM.dSYMs.zip" "dist/SFM-${VERSION}-universal.dSYMs.zip"
|
cp "clients/apple/build/${{ matrix.scheme }}.xcarchive/SFM.dSYMs.zip" "dist/SFM-${VERSION}-universal.dSYMs.zip"
|
||||||
- name: Upload image
|
- name: Upload image
|
||||||
if: matrix.if && matrix.name == 'macOS-standalone' && github.event_name == 'workflow_dispatch'
|
if: matrix.if && matrix.name == 'macOS-standalone' && github.event_name == 'workflow_dispatch'
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
|
20
Makefile
20
Makefile
@ -108,6 +108,16 @@ upload_ios_app_store:
|
|||||||
cd ../sing-box-for-apple && \
|
cd ../sing-box-for-apple && \
|
||||||
xcodebuild -exportArchive -archivePath build/SFI.xcarchive -exportOptionsPlist SFI/Upload.plist -allowProvisioningUpdates
|
xcodebuild -exportArchive -archivePath build/SFI.xcarchive -exportOptionsPlist SFI/Upload.plist -allowProvisioningUpdates
|
||||||
|
|
||||||
|
export_ios_ipa:
|
||||||
|
cd ../sing-box-for-apple && \
|
||||||
|
xcodebuild -exportArchive -archivePath build/SFI.xcarchive -exportOptionsPlist SFI/Export.plist -allowProvisioningUpdates -exportPath build/SFI && \
|
||||||
|
cp build/SFI/sing-box.ipa dist/SFI.ipa
|
||||||
|
|
||||||
|
upload_ios_ipa:
|
||||||
|
cd dist && \
|
||||||
|
cp SFI.ipa "SFI-${VERSION}.ipa" && \
|
||||||
|
ghr --replace --draft --prerelease "v${VERSION}" "SFI-${VERSION}.ipa"
|
||||||
|
|
||||||
release_ios: build_ios upload_ios_app_store
|
release_ios: build_ios upload_ios_app_store
|
||||||
|
|
||||||
build_macos:
|
build_macos:
|
||||||
@ -175,6 +185,16 @@ upload_tvos_app_store:
|
|||||||
cd ../sing-box-for-apple && \
|
cd ../sing-box-for-apple && \
|
||||||
xcodebuild -exportArchive -archivePath "build/SFT.xcarchive" -exportOptionsPlist SFI/Upload.plist -allowProvisioningUpdates
|
xcodebuild -exportArchive -archivePath "build/SFT.xcarchive" -exportOptionsPlist SFI/Upload.plist -allowProvisioningUpdates
|
||||||
|
|
||||||
|
export_tvos_ipa:
|
||||||
|
cd ../sing-box-for-apple && \
|
||||||
|
xcodebuild -exportArchive -archivePath "build/SFT.xcarchive" -exportOptionsPlist SFI/Export.plist -allowProvisioningUpdates -exportPath build/SFT && \
|
||||||
|
cp build/SFT/sing-box.ipa dist/SFT.ipa
|
||||||
|
|
||||||
|
upload_tvos_ipa:
|
||||||
|
cd dist && \
|
||||||
|
cp SFT.ipa "SFT-${VERSION}.ipa" && \
|
||||||
|
ghr --replace --draft --prerelease "v${VERSION}" "SFT-${VERSION}.ipa"
|
||||||
|
|
||||||
release_tvos: build_tvos upload_tvos_app_store
|
release_tvos: build_tvos upload_tvos_app_store
|
||||||
|
|
||||||
update_apple_version:
|
update_apple_version:
|
||||||
|
@ -53,11 +53,11 @@ type InboundContext struct {
|
|||||||
|
|
||||||
// sniffer
|
// sniffer
|
||||||
|
|
||||||
Protocol string
|
Protocol string
|
||||||
Domain string
|
Domain string
|
||||||
Client string
|
Client string
|
||||||
SniffContext any
|
SniffContext any
|
||||||
PacketSniffError error
|
SniffError error
|
||||||
|
|
||||||
// cache
|
// cache
|
||||||
|
|
||||||
|
@ -16,15 +16,17 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
debugEnabled bool
|
debugEnabled bool
|
||||||
target string
|
target string
|
||||||
platform string
|
platform string
|
||||||
|
withTailscale bool
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
flag.BoolVar(&debugEnabled, "debug", false, "enable debug")
|
flag.BoolVar(&debugEnabled, "debug", false, "enable debug")
|
||||||
flag.StringVar(&target, "target", "android", "target platform")
|
flag.StringVar(&target, "target", "android", "target platform")
|
||||||
flag.StringVar(&platform, "platform", "", "specify platform")
|
flag.StringVar(&platform, "platform", "", "specify platform")
|
||||||
|
flag.BoolVar(&withTailscale, "tailscale", false, "build tailscale for iOS and tvOS")
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
@ -151,7 +153,9 @@ func buildApple() {
|
|||||||
"-v",
|
"-v",
|
||||||
"-target", bindTarget,
|
"-target", bindTarget,
|
||||||
"-libname=box",
|
"-libname=box",
|
||||||
"-tags-macos=" + strings.Join(memcTags, ","),
|
}
|
||||||
|
if withTailscale {
|
||||||
|
args = append(args, "-tags-macos="+strings.Join(memcTags, ","))
|
||||||
}
|
}
|
||||||
|
|
||||||
if !debugEnabled {
|
if !debugEnabled {
|
||||||
@ -161,6 +165,9 @@ func buildApple() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
tags := append(sharedTags, iosTags...)
|
tags := append(sharedTags, iosTags...)
|
||||||
|
if withTailscale {
|
||||||
|
tags = append(tags, memcTags...)
|
||||||
|
}
|
||||||
if debugEnabled {
|
if debugEnabled {
|
||||||
tags = append(tags, debugTags...)
|
tags = append(tags, debugTags...)
|
||||||
}
|
}
|
||||||
|
@ -96,7 +96,7 @@ parseLine:
|
|||||||
}
|
}
|
||||||
if !ignored {
|
if !ignored {
|
||||||
ignoredLines++
|
ignoredLines++
|
||||||
logger.Debug("ignored unsupported rule with modifier: ", paramParts[0], ": ", ruleLine)
|
logger.Debug("ignored unsupported rule with modifier: ", paramParts[0], ": ", originRuleLine)
|
||||||
continue parseLine
|
continue parseLine
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -124,34 +124,35 @@ parseLine:
|
|||||||
ruleLine = ruleLine[1 : len(ruleLine)-1]
|
ruleLine = ruleLine[1 : len(ruleLine)-1]
|
||||||
if ignoreIPCIDRRegexp(ruleLine) {
|
if ignoreIPCIDRRegexp(ruleLine) {
|
||||||
ignoredLines++
|
ignoredLines++
|
||||||
logger.Debug("ignored unsupported rule with IPCIDR regexp: ", ruleLine)
|
logger.Debug("ignored unsupported rule with IPCIDR regexp: ", originRuleLine)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
isRegexp = true
|
isRegexp = true
|
||||||
} else {
|
} else {
|
||||||
if strings.Contains(ruleLine, "://") {
|
if strings.Contains(ruleLine, "://") {
|
||||||
ruleLine = common.SubstringAfter(ruleLine, "://")
|
ruleLine = common.SubstringAfter(ruleLine, "://")
|
||||||
|
isSuffix = true
|
||||||
}
|
}
|
||||||
if strings.Contains(ruleLine, "/") {
|
if strings.Contains(ruleLine, "/") {
|
||||||
ignoredLines++
|
ignoredLines++
|
||||||
logger.Debug("ignored unsupported rule with path: ", ruleLine)
|
logger.Debug("ignored unsupported rule with path: ", originRuleLine)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if strings.Contains(ruleLine, "?") || strings.Contains(ruleLine, "&") {
|
if strings.Contains(ruleLine, "?") || strings.Contains(ruleLine, "&") {
|
||||||
ignoredLines++
|
ignoredLines++
|
||||||
logger.Debug("ignored unsupported rule with query: ", ruleLine)
|
logger.Debug("ignored unsupported rule with query: ", originRuleLine)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if strings.Contains(ruleLine, "[") || strings.Contains(ruleLine, "]") ||
|
if strings.Contains(ruleLine, "[") || strings.Contains(ruleLine, "]") ||
|
||||||
strings.Contains(ruleLine, "(") || strings.Contains(ruleLine, ")") ||
|
strings.Contains(ruleLine, "(") || strings.Contains(ruleLine, ")") ||
|
||||||
strings.Contains(ruleLine, "!") || strings.Contains(ruleLine, "#") {
|
strings.Contains(ruleLine, "!") || strings.Contains(ruleLine, "#") {
|
||||||
ignoredLines++
|
ignoredLines++
|
||||||
logger.Debug("ignored unsupported cosmetic filter: ", ruleLine)
|
logger.Debug("ignored unsupported cosmetic filter: ", originRuleLine)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if strings.Contains(ruleLine, "~") {
|
if strings.Contains(ruleLine, "~") {
|
||||||
ignoredLines++
|
ignoredLines++
|
||||||
logger.Debug("ignored unsupported rule modifier: ", ruleLine)
|
logger.Debug("ignored unsupported rule modifier: ", originRuleLine)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
var domainCheck string
|
var domainCheck string
|
||||||
@ -170,13 +171,13 @@ parseLine:
|
|||||||
_, ipErr := parseADGuardIPCIDRLine(ruleLine)
|
_, ipErr := parseADGuardIPCIDRLine(ruleLine)
|
||||||
if ipErr == nil {
|
if ipErr == nil {
|
||||||
ignoredLines++
|
ignoredLines++
|
||||||
logger.Debug("ignored unsupported rule with IPCIDR: ", ruleLine)
|
logger.Debug("ignored unsupported rule with IPCIDR: ", originRuleLine)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if M.ParseSocksaddr(domainCheck).Port != 0 {
|
if M.ParseSocksaddr(domainCheck).Port != 0 {
|
||||||
logger.Debug("ignored unsupported rule with port: ", ruleLine)
|
logger.Debug("ignored unsupported rule with port: ", originRuleLine)
|
||||||
} else {
|
} else {
|
||||||
logger.Debug("ignored unsupported rule with invalid domain: ", ruleLine)
|
logger.Debug("ignored unsupported rule with invalid domain: ", originRuleLine)
|
||||||
}
|
}
|
||||||
ignoredLines++
|
ignoredLines++
|
||||||
continue
|
continue
|
||||||
@ -407,11 +408,9 @@ func ignoreIPCIDRRegexp(ruleLine string) bool {
|
|||||||
ruleLine = ruleLine[13:]
|
ruleLine = ruleLine[13:]
|
||||||
} else if strings.HasPrefix(ruleLine, "^") {
|
} else if strings.HasPrefix(ruleLine, "^") {
|
||||||
ruleLine = ruleLine[1:]
|
ruleLine = ruleLine[1:]
|
||||||
} else {
|
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
_, parseErr := strconv.ParseUint(common.SubstringBefore(ruleLine, "\\."), 10, 8)
|
return common.Error(strconv.ParseUint(common.SubstringBefore(ruleLine, "\\."), 10, 8)) == nil ||
|
||||||
return parseErr == nil
|
common.Error(strconv.ParseUint(common.SubstringBefore(ruleLine, "."), 10, 8)) == nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func parseAdGuardHostLine(ruleLine string) (string, error) {
|
func parseAdGuardHostLine(ruleLine string) (string, error) {
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
icon: material/alert-decagram
|
icon: material/alert-decagram
|
||||||
---
|
---
|
||||||
|
|
||||||
#### 1.12.0-beta.27
|
#### 1.12.0-beta.28
|
||||||
|
|
||||||
* Fixes and improvements
|
* Fixes and improvements
|
||||||
|
|
||||||
|
@ -19,13 +19,21 @@ 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) **1**
|
||||||
|
* [GitHub Releases](https://github.com/SagerNet/sing-box/releases) **2**
|
||||||
|
|
||||||
|
**1**:
|
||||||
|
|
||||||
TestFlight quota is only available to [sponsors](https://github.com/sponsors/nekohasekai)
|
TestFlight quota is only available to [sponsors](https://github.com/sponsors/nekohasekai)
|
||||||
(one-time sponsorships are accepted).
|
(one-time sponsorships are accepted).
|
||||||
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).
|
||||||
|
|
||||||
|
**2**:
|
||||||
|
|
||||||
|
You can now download compiled IPAs for iOS and tvOS directly from GitHub releases,
|
||||||
|
but you need to purchase the **Apple Developer Program** to install them through AltStore or SideStore.
|
||||||
|
|
||||||
## :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)
|
||||||
|
@ -64,7 +64,7 @@ icon: material/new-box
|
|||||||
"auto_redirect_input_mark": "0x2023",
|
"auto_redirect_input_mark": "0x2023",
|
||||||
"auto_redirect_output_mark": "0x2024",
|
"auto_redirect_output_mark": "0x2024",
|
||||||
"loopback_address": [
|
"loopback_address": [
|
||||||
"10.0.7.1"
|
"10.7.0.1"
|
||||||
],
|
],
|
||||||
"strict_route": true,
|
"strict_route": true,
|
||||||
"route_address": [
|
"route_address": [
|
||||||
@ -284,7 +284,7 @@ Connection output mark used by `auto_redirect`.
|
|||||||
|
|
||||||
Loopback addresses make TCP connections to the specified address connect to the source address.
|
Loopback addresses make TCP connections to the specified address connect to the source address.
|
||||||
|
|
||||||
Setting option value to `10.0.7.1` achieves the same behavior as SideStore/StosVPN.
|
Setting option value to `10.7.0.1` achieves the same behavior as SideStore/StosVPN.
|
||||||
|
|
||||||
When `auto_redirect` is enabled, the same behavior can be achieved for LAN devices (not just local) as a gateway.
|
When `auto_redirect` is enabled, the same behavior can be achieved for LAN devices (not just local) as a gateway.
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ icon: material/new-box
|
|||||||
"auto_redirect_input_mark": "0x2023",
|
"auto_redirect_input_mark": "0x2023",
|
||||||
"auto_redirect_output_mark": "0x2024",
|
"auto_redirect_output_mark": "0x2024",
|
||||||
"loopback_address": [
|
"loopback_address": [
|
||||||
"10.0.7.1"
|
"10.7.0.1"
|
||||||
],
|
],
|
||||||
"strict_route": true,
|
"strict_route": true,
|
||||||
"route_address": [
|
"route_address": [
|
||||||
@ -283,7 +283,7 @@ tun 接口的 IPv6 前缀。
|
|||||||
|
|
||||||
环回地址是用于使指向指定地址的 TCP 连接连接到来源地址的。
|
环回地址是用于使指向指定地址的 TCP 连接连接到来源地址的。
|
||||||
|
|
||||||
将选项值设置为 `10.0.7.1` 可实现与 SideStore/StosVPN 相同的行为。
|
将选项值设置为 `10.7.0.1` 可实现与 SideStore/StosVPN 相同的行为。
|
||||||
|
|
||||||
当启用 `auto_redirect` 时,可以作为网关为局域网设备(而不仅仅是本地)实现相同的行为。
|
当启用 `auto_redirect` 时,可以作为网关为局域网设备(而不仅仅是本地)实现相同的行为。
|
||||||
|
|
||||||
|
@ -501,6 +501,9 @@ func (r *Router) actionSniff(
|
|||||||
if inputConn != nil {
|
if inputConn != nil {
|
||||||
if len(action.StreamSniffers) == 0 && len(action.PacketSniffers) > 0 {
|
if len(action.StreamSniffers) == 0 && len(action.PacketSniffers) > 0 {
|
||||||
return
|
return
|
||||||
|
} else if metadata.SniffError != nil && !errors.Is(metadata.SniffError, sniff.ErrNeedMoreData) {
|
||||||
|
r.logger.DebugContext(ctx, "packet sniff skipped due to previous error: ", metadata.SniffError)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
var streamSniffers []sniff.StreamSniffer
|
var streamSniffers []sniff.StreamSniffer
|
||||||
if len(action.StreamSniffers) > 0 {
|
if len(action.StreamSniffers) > 0 {
|
||||||
@ -525,6 +528,7 @@ func (r *Router) actionSniff(
|
|||||||
action.Timeout,
|
action.Timeout,
|
||||||
streamSniffers...,
|
streamSniffers...,
|
||||||
)
|
)
|
||||||
|
metadata.SniffError = err
|
||||||
if err == nil {
|
if err == nil {
|
||||||
//goland:noinspection GoDeprecation
|
//goland:noinspection GoDeprecation
|
||||||
if action.OverrideDestination && M.IsDomainName(metadata.Domain) {
|
if action.OverrideDestination && M.IsDomainName(metadata.Domain) {
|
||||||
@ -549,8 +553,8 @@ func (r *Router) actionSniff(
|
|||||||
} else if inputPacketConn != nil {
|
} else if inputPacketConn != nil {
|
||||||
if len(action.PacketSniffers) == 0 && len(action.StreamSniffers) > 0 {
|
if len(action.PacketSniffers) == 0 && len(action.StreamSniffers) > 0 {
|
||||||
return
|
return
|
||||||
} else if metadata.PacketSniffError != nil && !errors.Is(metadata.PacketSniffError, sniff.ErrNeedMoreData) {
|
} else if metadata.SniffError != nil && !errors.Is(metadata.SniffError, sniff.ErrNeedMoreData) {
|
||||||
r.logger.DebugContext(ctx, "packet sniff skipped due to previous error: ", metadata.PacketSniffError)
|
r.logger.DebugContext(ctx, "packet sniff skipped due to previous error: ", metadata.SniffError)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
var packetSniffers []sniff.PacketSniffer
|
var packetSniffers []sniff.PacketSniffer
|
||||||
@ -598,7 +602,7 @@ func (r *Router) actionSniff(
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if len(packetBuffers) > 0 || metadata.PacketSniffError != nil {
|
if len(packetBuffers) > 0 || metadata.SniffError != nil {
|
||||||
err = sniff.PeekPacket(
|
err = sniff.PeekPacket(
|
||||||
ctx,
|
ctx,
|
||||||
metadata,
|
metadata,
|
||||||
@ -618,7 +622,7 @@ func (r *Router) actionSniff(
|
|||||||
Destination: destination,
|
Destination: destination,
|
||||||
}
|
}
|
||||||
packetBuffers = append(packetBuffers, packetBuffer)
|
packetBuffers = append(packetBuffers, packetBuffer)
|
||||||
metadata.PacketSniffError = err
|
metadata.SniffError = err
|
||||||
if errors.Is(err, sniff.ErrNeedMoreData) {
|
if errors.Is(err, sniff.ErrNeedMoreData) {
|
||||||
// TODO: replace with generic message when there are more multi-packet protocols
|
// TODO: replace with generic message when there are more multi-packet protocols
|
||||||
r.logger.DebugContext(ctx, "attempt to sniff fragmented QUIC client hello")
|
r.logger.DebugContext(ctx, "attempt to sniff fragmented QUIC client hello")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user