Compare commits

..

118 Commits

Author SHA1 Message Date
renovate[bot]
e8be848b6f
[dependencies] Update golangci/golangci-lint-action action to v8 2025-06-29 12:06:14 +00:00
世界
1f74074ff5
documentation: Bump version 2025-06-29 19:23:34 +08:00
世界
e3735b6177
Fix missing IdleConnTimeout for DoH client 2025-06-29 19:23:34 +08:00
世界
4789846113
Update libresolv usage 2025-06-29 19:20:31 +08:00
yu
ad94f94cfb
documentation: Update client configuration manual 2025-06-29 19:11:15 +08:00
yanwo
1f9de9f321
documentation: Fix typo
Signed-off-by: yanwo <ogilvy@gmail.com>
2025-06-29 19:11:15 +08:00
anytinz
344bbf9494
documentation: Fix wrong SideStore loopback ip 2025-06-29 18:57:04 +08:00
世界
b7e16e70ab
Revert "release: Add IPA build"
After testing, it seems that since extensions are not handled correctly, it cannot be installed by SideStore.
2025-06-29 18:57:04 +08:00
世界
391153ecb8
release: Add IPA build 2025-06-29 18:57:03 +08:00
世界
3d821db0b2
Add API to dump AdGuard rules 2025-06-29 18:57:03 +08:00
Sukka
344ecd3798
Improve AdGuard rule-set parser 2025-06-29 18:57:03 +08:00
Restia-Ashbell
a8a3f863cd
Add ECH support for uTLS 2025-06-29 18:57:02 +08:00
世界
ea190ca428
Improve TLS fragments 2025-06-29 18:57:02 +08:00
世界
e65b78d1e4
Add cache support for ssm-api 2025-06-29 18:57:02 +08:00
世界
84f7d80da7
Fix service will not be closed 2025-06-29 18:57:02 +08:00
世界
2b57eb0b30
Add loopback address support for tun 2025-06-29 18:57:01 +08:00
世界
9884f81298
Fix tproxy listener 2025-06-29 18:57:01 +08:00
世界
8493b4f1da
Fix systemd package 2025-06-29 18:57:01 +08:00
世界
8f1a8add85
Fix missing home for derp service 2025-06-29 18:57:01 +08:00
Zero Clover
85ee6bb266
documentation: Fix services 2025-06-29 18:57:01 +08:00
世界
c4387f7c37
Fix dns.client_subnet ignored 2025-06-29 18:57:01 +08:00
世界
dcb7a5caed
documentation: Minor fixes 2025-06-29 18:57:00 +08:00
世界
ae77cdeedd
Fix tailscale forward 2025-06-29 18:57:00 +08:00
世界
ec05d4e5e3
Minor fixes 2025-06-29 18:56:59 +08:00
世界
1f766d2b89
Add SSM API service 2025-06-29 18:56:59 +08:00
世界
a5a6c1f7d4
Add resolved service and DNS server 2025-06-29 18:56:59 +08:00
世界
cd43786279
Add DERP service 2025-06-29 18:56:59 +08:00
世界
43a211db28
Add service component type 2025-06-29 18:56:58 +08:00
世界
d4f6bdf792
Fix tproxy tcp control 2025-06-29 18:56:58 +08:00
愚者
99cf27bedd
release: Fix build tags for android
Signed-off-by: 愚者 <11926619+FansChou@users.noreply.github.com>
2025-06-29 18:56:58 +08:00
世界
0a14c5ab1f
prevent creation of bind and mark controls on unsupported platforms 2025-06-29 18:56:58 +08:00
PuerNya
533b31e1f6
documentation: Fix description of reject DNS action behavior 2025-06-29 18:56:57 +08:00
Restia-Ashbell
8ed6523872
Fix TLS record fragment 2025-06-29 18:56:57 +08:00
世界
e5c162222d
Add missing accept_routes option for Tailscale 2025-06-29 18:56:57 +08:00
世界
88babbf3a7
Add TLS record fragment support 2025-06-29 18:56:56 +08:00
世界
49a03e0b23
Fix set edns0 client subnet 2025-06-29 18:56:56 +08:00
世界
9a8e9a34c0
Update minor dependencies 2025-06-29 18:56:56 +08:00
世界
17551db7be
Update certmagic and providers 2025-06-29 18:56:56 +08:00
世界
83201bb088
Update protobuf and grpc 2025-06-29 18:56:56 +08:00
世界
f0f1942f1f
Add control options for listeners 2025-06-29 18:56:55 +08:00
世界
c7e318be61
Update quic-go to v0.52.0 2025-06-29 18:56:54 +08:00
世界
2a5e0d0c92
Update utls to v1.7.2 2025-06-29 18:56:54 +08:00
世界
956e485342
Handle EDNS version downgrade 2025-06-29 18:56:54 +08:00
世界
23ede74e74
documentation: Fix anytls padding scheme description 2025-06-29 18:56:54 +08:00
安容
03317e61dd
Report invalid DNS address early 2025-06-29 18:56:54 +08:00
世界
fc81bd9a5b
Fix wireguard listen_port 2025-06-29 18:56:53 +08:00
世界
4d406cad84
clash-api: Add more meta api 2025-06-29 18:56:53 +08:00
世界
1f0282de9c
Fix DNS lookup 2025-06-29 18:56:53 +08:00
世界
b097912418
Fix fetch ECH configs 2025-06-29 18:56:52 +08:00
reletor
056c29e73a
documentation: Minor fixes 2025-06-29 18:56:52 +08:00
caelansar
7aa0a57e60
Fix callback deletion in UDP transport 2025-06-29 18:56:52 +08:00
世界
2673e64bcb
documentation: Try to make the play review happy 2025-06-29 18:56:51 +08:00
世界
3d3c1709d7
Fix missing handling of legacy domain_strategy options 2025-06-29 18:56:51 +08:00
世界
9de29a590f
Improve local DNS server 2025-06-29 18:56:50 +08:00
anytls
a5282b08ec
Update anytls
Co-authored-by: anytls <anytls>
2025-06-29 18:56:50 +08:00
世界
b26c2083bf
Fix DNS dialer 2025-06-29 18:56:50 +08:00
世界
c1f4c691dc
release: Skip override version for iOS 2025-06-29 18:56:49 +08:00
iikira
c0ef6eb728
Fix UDP DNS server crash
Signed-off-by: iikira <i2@mail.iikira.com>
2025-06-29 18:56:49 +08:00
ReleTor
074d61021f
Fix fetch ECH configs 2025-06-29 18:56:49 +08:00
世界
246c9d4e40
Allow direct outbounds without domain_resolver 2025-06-29 18:56:49 +08:00
世界
3e3466c8d7
Fix Tailscale dialer 2025-06-29 18:56:48 +08:00
dyhkwong
f73415a732
Fix DNS over QUIC stream close 2025-06-29 18:56:48 +08:00
anytls
ecabe9ffe1
Update anytls
Co-authored-by: anytls <anytls>
2025-06-29 18:56:48 +08:00
Rambling2076
2dae1ee284
Fix missing with_tailscale in Dockerfile
Signed-off-by: Rambling2076 <Rambling2076@proton.me>
2025-06-29 18:56:47 +08:00
世界
2afb24d698
Fail when default DNS server not found 2025-06-29 18:56:47 +08:00
世界
ade83ee758
Update gVisor to 20250319.0 2025-06-29 18:56:47 +08:00
世界
ac9c300ca7
Explicitly reject detour to empty direct outbounds 2025-06-29 18:56:47 +08:00
世界
e6eb3cec2b
Add netns support 2025-06-29 18:56:46 +08:00
世界
601b79371b
Add wildcard name support for predefined records 2025-06-29 18:56:46 +08:00
世界
56b957d30d
Remove map usage in options 2025-06-29 18:56:45 +08:00
世界
eb87b1a708
Fix unhandled DNS loop 2025-06-29 18:56:45 +08:00
世界
c0a5561bd4
Add wildcard-sni support for shadow-tls inbound 2025-06-29 18:56:45 +08:00
k9982874
4a3fe1d41c
Add ntp protocol sniffing 2025-06-29 18:56:45 +08:00
世界
4cbbcfb04d
option: Fix marshal legacy DNS options 2025-06-29 18:56:44 +08:00
世界
b3ad4e0e39
Make domain_resolver optional when only one DNS server is configured 2025-06-29 18:56:44 +08:00
世界
49f9c0011d
Fix DNS lookup context pollution 2025-06-29 18:56:44 +08:00
世界
c8c165af87
Fix http3 DNS server connecting to wrong address 2025-06-29 18:56:43 +08:00
Restia-Ashbell
3f790ff8c9
documentation: Fix typo 2025-06-29 18:56:43 +08:00
anytls
f2272ae1e7
Update sing-anytls
Co-authored-by: anytls <anytls>
2025-06-29 18:56:43 +08:00
k9982874
b40c264c0a
Fix hosts DNS server 2025-06-29 18:56:43 +08:00
世界
29fc8d6a86
Fix UDP DNS server crash 2025-06-29 18:56:43 +08:00
世界
46ca27c926
documentation: Fix missing ip_accept_any DNS rule option 2025-06-29 18:56:42 +08:00
世界
243a5dd477
Fix anytls dialer usage 2025-06-29 18:56:42 +08:00
世界
844e9f09a6
Move predefined DNS server to rule action 2025-06-29 18:56:41 +08:00
世界
9aa673f79e
Fix domain resolver on direct outbound 2025-06-29 18:56:41 +08:00
Zephyruso
5abd74ffe3
Fix missing AnyTLS display name 2025-06-29 18:56:41 +08:00
anytls
68a32960bd
Update sing-anytls
Co-authored-by: anytls <anytls>
2025-06-29 18:56:41 +08:00
Estel
1e62e3e5d4
documentation: Fix typo
Signed-off-by: Estel <callmebedrockdigger@gmail.com>
2025-06-29 18:56:41 +08:00
TargetLocked
40c03a9913
Fix parsing legacy DNS options 2025-06-29 18:56:40 +08:00
世界
2ea4029868
Fix DNS fallback 2025-06-29 18:56:40 +08:00
世界
66f5cdd014
documentation: Fix missing hosts DNS server 2025-06-29 18:56:39 +08:00
anytls
89da2b6355
Add MinIdleSession option to AnyTLS outbound
Co-authored-by: anytls <anytls>
2025-06-29 18:56:39 +08:00
ReleTor
ee2b8498e6
documentation: Minor fixes 2025-06-29 18:56:39 +08:00
libtry486
b1eaf537bd
documentation: Fix typo
fix typo

Signed-off-by: libtry486 <89328481+libtry486@users.noreply.github.com>
2025-06-29 18:56:39 +08:00
Alireza Ahmadi
63739c1621
Fix Outbound deadlock 2025-06-29 18:56:38 +08:00
世界
3c8ddee029
documentation: Fix AnyTLS doc 2025-06-29 18:56:38 +08:00
anytls
23aad70045
Add AnyTLS protocol 2025-06-29 18:56:38 +08:00
世界
0d67b51267
Migrate to stdlib ECH support 2025-06-29 18:56:37 +08:00
世界
c02f939265
Add fallback local DNS server for iOS 2025-06-29 18:56:37 +08:00
世界
36b84e25c2
Get darwin local DNS server from libresolv 2025-06-29 18:56:37 +08:00
世界
9fd4b0e9ae
Improve resolve action 2025-06-29 18:56:36 +08:00
世界
e68cdcc98a
Add back port hopping to hysteria 1 2025-06-29 18:56:36 +08:00
xchacha20-poly1305
2691617c5e
Remove single quotes of raw Moziila certs 2025-06-29 18:56:35 +08:00
世界
04056a1357
Add Tailscale endpoint 2025-06-29 18:56:35 +08:00
世界
faac858e5d
Build legacy binaries with latest Go 2025-06-29 18:56:35 +08:00
世界
a818c8abeb
documentation: Remove outdated icons 2025-06-29 18:56:34 +08:00
世界
15cbe9fc87
documentation: Certificate store 2025-06-29 18:56:34 +08:00
世界
e186f2d31e
documentation: TLS fragment 2025-06-29 18:56:34 +08:00
世界
e9323481a4
documentation: Outbound domain resolver 2025-06-29 18:56:33 +08:00
世界
a0a41ff2bb
documentation: Refactor DNS 2025-06-29 18:56:33 +08:00
世界
549daf9d41
Add certificate store 2025-06-29 18:56:33 +08:00
世界
fa370f7d04
Add TLS fragment support 2025-06-29 18:56:33 +08:00
世界
795cb17bfa
refactor: Outbound domain resolver 2025-06-29 18:56:32 +08:00
世界
00d8add761
refactor: DNS 2025-06-29 18:56:32 +08:00
Kyson
36db31c55a
documentation: Fix typo
Co-authored-by: chenqixin <chenqixin@bytedance.com>
2025-06-29 18:54:05 +08:00
世界
4dbbf59c82
Fix logger for acme 2025-06-29 18:44:40 +08:00
世界
832eb4458d
release: Fix xcode version 2025-06-29 18:44:40 +08:00
dyhkwong
2cf989d306
Fix inbound with v2ray transport missing InboundOptions 2025-06-25 13:20:00 +08:00
15 changed files with 152 additions and 259 deletions

View File

@ -437,24 +437,28 @@ jobs:
platform: ios
scheme: SFI
destination: 'generic/platform=iOS'
archive: build/SFI.xcarchive
upload: SFI/Upload.plist
- name: macOS
if: ${{ github.event_name != 'workflow_dispatch' || inputs.build == 'All' || inputs.build == 'Apple' || inputs.build == 'app-store'|| inputs.build == 'macOS' }}
platform: macos
scheme: SFM
destination: 'generic/platform=macOS'
archive: build/SFM.xcarchive
upload: SFI/Upload.plist
- name: tvOS
if: ${{ github.event_name != 'workflow_dispatch' || inputs.build == 'All' || inputs.build == 'Apple' || inputs.build == 'app-store'|| inputs.build == 'tvOS' }}
platform: tvos
scheme: SFT
destination: 'generic/platform=tvOS'
archive: build/SFT.xcarchive
upload: SFI/Upload.plist
- name: macOS-standalone
if: ${{ github.event_name != 'workflow_dispatch' || inputs.build == 'All' || inputs.build == 'Apple' || inputs.build == 'macOS-standalone' }}
platform: macos
scheme: SFM.System
destination: 'generic/platform=macOS'
archive: build/SFM.System.xcarchive
export: SFM.System/Export.plist
export_path: build/SFM.System
steps:
@ -472,11 +476,11 @@ jobs:
- name: Setup Xcode stable
if: matrix.if && github.ref == 'refs/heads/main-next'
run: |-
sudo xcode-select -s /Applications/Xcode_16.2.app
sudo xcode-select -s /Applications/Xcode_16.4.app
- name: Setup Xcode beta
if: matrix.if && github.ref == 'refs/heads/dev-next'
run: |-
sudo xcode-select -s /Applications/Xcode_16.2.app
sudo xcode-select -s /Applications/Xcode_16.4.app
- name: Set tag
if: matrix.if
run: |-
@ -539,12 +543,6 @@ jobs:
export PATH="$PATH:$(go env GOPATH)/bin"
go run ./cmd/internal/build_libbox -target apple -platform ${{ matrix.platform }}
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
if: matrix.if && matrix.name == 'macOS' && github.event_name == 'workflow_dispatch'
run: |-
@ -563,71 +561,18 @@ jobs:
-scheme "${{ matrix.scheme }}" \
-configuration Release \
-destination "${{ matrix.destination }}" \
-archivePath "build/${{ matrix.scheme }}.xcarchive" \
-archivePath "${{ matrix.archive }}" \
-allowProvisioningUpdates \
-authenticationKeyPath $ASC_KEY_PATH \
-authenticationKeyID $ASC_KEY_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
if: matrix.if && matrix.name != 'macOS-standalone' && github.event_name == 'workflow_dispatch'
run: |-
go run -v ./cmd/internal/app_store_connect cancel_app_store ${{ matrix.platform }}
cd clients/apple
xcodebuild -exportArchive \
-archivePath "build/${{ matrix.scheme }}.xcarchive" \
-archivePath "${{ matrix.archive }}" \
-exportOptionsPlist ${{ matrix.upload }} \
-allowProvisioningUpdates \
-authenticationKeyPath $ASC_KEY_PATH \
@ -642,7 +587,7 @@ jobs:
run: |-
pushd clients/apple
xcodebuild -exportArchive \
-archivePath "build/${{ matrix.scheme }}.xcarchive" \
-archivePath "${{ matrix.archive }}" \
-exportOptionsPlist ${{ matrix.export }} \
-exportPath "${{ matrix.export_path }}"
brew install create-dmg
@ -655,13 +600,13 @@ jobs:
--skip-jenkins \
SFM.dmg "${{ matrix.export_path }}/SFM.app"
xcrun notarytool submit "SFM.dmg" --wait --keychain-profile "notarytool-password"
cd "build/${{ matrix.scheme }}.xcarchive"
cd "${{ matrix.archive }}"
zip -r SFM.dSYMs.zip dSYMs
popd
mkdir -p dist
cp clients/apple/SFM.dmg "dist/SFM-${VERSION}-universal.dmg"
cp "clients/apple/build/${{ matrix.scheme }}.xcarchive/SFM.dSYMs.zip" "dist/SFM-${VERSION}-universal.dSYMs.zip"
cp "clients/apple/${{ matrix.archive }}/SFM.dSYMs.zip" "dist/SFM-${VERSION}-universal.dSYMs.zip"
- name: Upload image
if: matrix.if && matrix.name == 'macOS-standalone' && github.event_name == 'workflow_dispatch'
uses: actions/upload-artifact@v4
@ -670,7 +615,7 @@ jobs:
path: 'dist'
upload:
name: Upload builds
if: always() && github.event_name == 'workflow_dispatch' && (inputs.build == 'All' || inputs.build == 'Binary' || inputs.build == 'Android' || inputs.build == 'Apple' || inputs.build == 'macOS-standalone')
if: "!failure() && github.event_name == 'workflow_dispatch' && (inputs.build == 'All' || inputs.build == 'Binary' || inputs.build == 'Android' || inputs.build == 'Apple' || inputs.build == 'macOS-standalone')"
runs-on: ubuntu-latest
needs:
- calculate_version

View File

@ -26,7 +26,7 @@ func init() {
flag.BoolVar(&debugEnabled, "debug", false, "enable debug")
flag.StringVar(&target, "target", "android", "target platform")
flag.StringVar(&platform, "platform", "", "specify platform")
flag.BoolVar(&withTailscale, "tailscale", false, "build tailscale for iOS and tvOS")
flag.BoolVar(&withTailscale, "with-tailscale", false, "build tailscale for iOS and tvOS")
}
func main() {
@ -154,7 +154,7 @@ func buildApple() {
"-target", bindTarget,
"-libname=box",
}
if withTailscale {
if !withTailscale {
args = append(args, "-tags-macos="+strings.Join(memcTags, ","))
}

View File

@ -5,13 +5,13 @@ package tls
import (
"context"
"crypto/tls"
"os"
"strings"
"github.com/sagernet/sing-box/adapter"
C "github.com/sagernet/sing-box/constant"
"github.com/sagernet/sing-box/option"
E "github.com/sagernet/sing/common/exceptions"
"github.com/sagernet/sing/common/logger"
"github.com/caddyserver/certmagic"
"github.com/libdns/alidns"
@ -37,7 +37,38 @@ func (w *acmeWrapper) Close() error {
return nil
}
func startACME(ctx context.Context, options option.InboundACMEOptions) (*tls.Config, adapter.SimpleLifecycle, error) {
type acmeLogWriter struct {
logger logger.Logger
}
func (w *acmeLogWriter) Write(p []byte) (n int, err error) {
logLine := strings.ReplaceAll(string(p), " ", ": ")
switch {
case strings.HasPrefix(logLine, "error: "):
w.logger.Error(logLine[7:])
case strings.HasPrefix(logLine, "warn: "):
w.logger.Warn(logLine[6:])
case strings.HasPrefix(logLine, "info: "):
w.logger.Info(logLine[6:])
case strings.HasPrefix(logLine, "debug: "):
w.logger.Debug(logLine[7:])
default:
w.logger.Debug(logLine)
}
return len(p), nil
}
func (w *acmeLogWriter) Sync() error {
return nil
}
func encoderConfig() zapcore.EncoderConfig {
config := zap.NewProductionEncoderConfig()
config.TimeKey = zapcore.OmitKey
return config
}
func startACME(ctx context.Context, logger logger.Logger, options option.InboundACMEOptions) (*tls.Config, adapter.SimpleLifecycle, error) {
var acmeServer string
switch options.Provider {
case "", "letsencrypt":
@ -58,14 +89,15 @@ func startACME(ctx context.Context, options option.InboundACMEOptions) (*tls.Con
} else {
storage = certmagic.Default.Storage
}
zapLogger := zap.New(zapcore.NewCore(
zapcore.NewConsoleEncoder(encoderConfig()),
&acmeLogWriter{logger: logger},
zap.DebugLevel,
))
config := &certmagic.Config{
DefaultServerName: options.DefaultServerName,
Storage: storage,
Logger: zap.New(zapcore.NewCore(
zapcore.NewConsoleEncoder(zap.NewProductionEncoderConfig()),
os.Stderr,
zap.InfoLevel,
)),
Logger: zapLogger,
}
acmeConfig := certmagic.ACMEIssuer{
CA: acmeServer,
@ -75,7 +107,7 @@ func startACME(ctx context.Context, options option.InboundACMEOptions) (*tls.Con
DisableTLSALPNChallenge: options.DisableTLSALPNChallenge,
AltHTTPPort: int(options.AlternativeHTTPPort),
AltTLSALPNPort: int(options.AlternativeTLSPort),
Logger: config.Logger,
Logger: zapLogger,
}
if dnsOptions := options.DNS01Challenge; dnsOptions != nil && dnsOptions.Provider != "" {
var solver certmagic.DNS01Solver
@ -103,6 +135,7 @@ func startACME(ctx context.Context, options option.InboundACMEOptions) (*tls.Con
GetConfigForCert: func(certificate certmagic.Certificate) (*certmagic.Config, error) {
return config, nil
},
Logger: zapLogger,
})
config = certmagic.New(cache, *config)
var tlsConfig *tls.Config

View File

@ -9,8 +9,9 @@ import (
"github.com/sagernet/sing-box/adapter"
"github.com/sagernet/sing-box/option"
E "github.com/sagernet/sing/common/exceptions"
"github.com/sagernet/sing/common/logger"
)
func startACME(ctx context.Context, options option.InboundACMEOptions) (*tls.Config, adapter.SimpleLifecycle, error) {
func startACME(ctx context.Context, logger logger.Logger, options option.InboundACMEOptions) (*tls.Config, adapter.SimpleLifecycle, error) {
return nil, nil, E.New(`ACME is not included in this build, rebuild with -tags with_acme`)
}

View File

@ -169,7 +169,7 @@ func NewSTDServer(ctx context.Context, logger log.Logger, options option.Inbound
var err error
if options.ACME != nil && len(options.ACME.Domain) > 0 {
//nolint:staticcheck
tlsConfig, acmeService, err = startACME(ctx, common.PtrValueOrDefault(options.ACME))
tlsConfig, acmeService, err = startACME(ctx, logger, common.PtrValueOrDefault(options.ACME))
if err != nil {
return nil, err
}

View File

@ -122,6 +122,7 @@ func NewHTTPSRaw(
var transport *http.Transport
if tlsConfig != nil {
transport = &http.Transport{
IdleConnTimeout: C.TCPKeepAliveInitial,
ForceAttemptHTTP2: true,
DialTLSContext: func(ctx context.Context, network, addr string) (net.Conn, error) {
tcpConn, hErr := dialer.DialContext(ctx, network, serverAddr)
@ -138,6 +139,7 @@ func NewHTTPSRaw(
}
} else {
transport = &http.Transport{
IdleConnTimeout: C.TCPKeepAliveInitial,
DialContext: func(ctx context.Context, network, addr string) (net.Conn, error) {
return dialer.DialContext(ctx, network, serverAddr)
},

View File

@ -20,7 +20,8 @@ import (
)
func dnsReadConfig(_ context.Context, _ string) *dnsConfig {
if C.res_init() != 0 {
var state C.res_state
if C.res_ninit(state) != 0 {
return &dnsConfig{
servers: defaultNS,
search: dnsDefaultSearch(),
@ -33,10 +34,10 @@ func dnsReadConfig(_ context.Context, _ string) *dnsConfig {
conf := &dnsConfig{
ndots: 1,
timeout: 5 * time.Second,
attempts: int(C._res.retry),
attempts: int(state.retry),
}
for i := 0; i < int(C._res.nscount); i++ {
ns := C._res.nsaddr_list[i]
for i := 0; i < int(state.nscount); i++ {
ns := state.nsaddr_list[i]
addr := C.inet_ntoa(ns.sin_addr)
if addr == nil {
continue
@ -44,7 +45,7 @@ func dnsReadConfig(_ context.Context, _ string) *dnsConfig {
conf.servers = append(conf.servers, C.GoString(addr))
}
for i := 0; ; i++ {
search := C._res.dnsrch[i]
search := state.dnsrch[i]
if search == nil {
break
}

View File

@ -2,7 +2,7 @@
icon: material/alert-decagram
---
#### 1.12.0-beta.28
#### 1.12.0-beta.29
* Fixes and improvements

View File

@ -19,21 +19,13 @@ platform-specific function implementation, such as TUN transparent proxy impleme
## :material-download: Download
* [App Store](https://apps.apple.com/app/sing-box-vt/id6673731168)
* TestFlight (Beta) **1**
* [GitHub Releases](https://github.com/SagerNet/sing-box/releases) **2**
**1**:
* TestFlight (Beta)
TestFlight quota is only available to [sponsors](https://github.com/sponsors/nekohasekai)
(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)
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)
* [Homebrew Cask](https://formulae.brew.sh/cask/sfm)

View File

@ -25,7 +25,7 @@ icon: material/new-box
| 类型 | 格式 |
|-------------|---------------------------|
| `wireguard` | [WireGuard](./wiregaurd/) |
| `wireguard` | [WireGuard](./wireguard/) |
| `tailscale` | [Tailscale](./tailscale/) |
#### tag

View File

@ -59,7 +59,7 @@
{
"external_controller": "0.0.0.0:9090",
"external_ui": "dashboard"
// external_ui_download_detour: "direct"
// "external_ui_download_detour": "direct"
}
```

View File

@ -59,7 +59,7 @@
{
"external_controller": "0.0.0.0:9090",
"external_ui": "dashboard"
// external_ui_download_detour: "direct"
// "external_ui_download_detour": "direct"
}
```

View File

@ -94,18 +94,13 @@ flowchart TB
"servers": [
{
"tag": "google",
"address": "tls://8.8.8.8"
"type": "tls",
"server": "8.8.8.8"
},
{
"tag": "local",
"address": "223.5.5.5",
"detour": "direct"
}
],
"rules": [
{
"outbound": "any",
"server": "local"
"type": "udp",
"server": "223.5.5.5"
}
],
"strategy": "ipv4_only"
@ -115,7 +110,8 @@ flowchart TB
"type": "tun",
"inet4_address": "172.19.0.1/30",
"auto_route": true,
"strict_route": false
// "auto_redirect": true, // On linux
"strict_route": true
}
],
"outbounds": [
@ -123,25 +119,23 @@ flowchart TB
{
"type": "direct",
"tag": "direct"
},
{
"type": "dns",
"tag": "dns-out"
}
],
"route": {
"rules": [
{
"protocol": "dns",
"outbound": "dns-out"
"action": "sniff"
},
{
"geoip": [
"private"
],
"protocol": "dns",
"action": "hijack-dns"
},
{
"ip_is_private": true,
"outbound": "direct"
}
],
"default_domain_resolver": "local",
"auto_detect_interface": true
}
}
@ -155,18 +149,13 @@ flowchart TB
"servers": [
{
"tag": "google",
"address": "tls://8.8.8.8"
"type": "tls",
"server": "8.8.8.8"
},
{
"tag": "local",
"address": "223.5.5.5",
"detour": "direct"
}
],
"rules": [
{
"outbound": "any",
"server": "local"
"type": "udp",
"server": "223.5.5.5"
}
]
},
@ -176,7 +165,8 @@ flowchart TB
"inet4_address": "172.19.0.1/30",
"inet6_address": "fdfe:dcba:9876::1/126",
"auto_route": true,
"strict_route": false
// "auto_redirect": true, // On linux
"strict_route": true
}
],
"outbounds": [
@ -184,25 +174,23 @@ flowchart TB
{
"type": "direct",
"tag": "direct"
},
{
"type": "dns",
"tag": "dns-out"
}
],
"route": {
"rules": [
{
"protocol": "dns",
"outbound": "dns-out"
"action": "sniff"
},
{
"geoip": [
"private"
],
"protocol": "dns",
"action": "hijack-dns"
},
{
"ip_is_private": true,
"outbound": "direct"
}
],
"default_domain_resolver": "local",
"auto_detect_interface": true
}
}
@ -216,23 +204,22 @@ flowchart TB
"servers": [
{
"tag": "google",
"address": "tls://8.8.8.8"
"type": "tls",
"server": "8.8.8.8"
},
{
"tag": "local",
"address": "223.5.5.5",
"detour": "direct"
"type": "udp",
"server": "223.5.5.5"
},
{
"tag": "remote",
"address": "fakeip"
"type": "fakeip",
"inet4_range": "198.18.0.0/15",
"inet6_range": "fc00::/18"
}
],
"rules": [
{
"outbound": "any",
"server": "local"
},
{
"query_type": [
"A",
@ -241,11 +228,6 @@ flowchart TB
"server": "remote"
}
],
"fakeip": {
"enabled": true,
"inet4_range": "198.18.0.0/15",
"inet6_range": "fc00::/18"
},
"independent_cache": true
},
"inbounds": [
@ -254,6 +236,7 @@ flowchart TB
"inet4_address": "172.19.0.1/30",
"inet6_address": "fdfe:dcba:9876::1/126",
"auto_route": true,
// "auto_redirect": true, // On linux
"strict_route": true
}
],
@ -262,25 +245,23 @@ flowchart TB
{
"type": "direct",
"tag": "direct"
},
{
"type": "dns",
"tag": "dns-out"
}
],
"route": {
"rules": [
{
"protocol": "dns",
"outbound": "dns-out"
"action": "sniff"
},
{
"geoip": [
"private"
],
"protocol": "dns",
"action": "hijack-dns"
},
{
"ip_is_private": true,
"outbound": "direct"
}
],
"default_domain_resolver": "local",
"auto_detect_interface": true
}
}
@ -290,54 +271,6 @@ flowchart TB
=== ":material-dns: DNS rules"
```json
{
"dns": {
"servers": [
{
"tag": "google",
"address": "tls://8.8.8.8"
},
{
"tag": "local",
"address": "223.5.5.5",
"detour": "direct"
}
],
"rules": [
{
"outbound": "any",
"server": "local"
},
{
"clash_mode": "Direct",
"server": "local"
},
{
"clash_mode": "Global",
"server": "google"
},
{
"rule_set": "geosite-geolocation-cn",
"server": "local"
}
]
},
"route": {
"rule_set": [
{
"type": "remote",
"tag": "geosite-geolocation-cn",
"format": "binary",
"url": "https://raw.githubusercontent.com/SagerNet/sing-geosite/rule-set/geosite-geolocation-cn.srs"
}
]
}
}
```
=== ":material-dns: DNS rules (Enhanced, but slower) (1.9.0+)"
=== ":material-shield-off: With DNS leaks"
```json
@ -346,35 +279,20 @@ flowchart TB
"servers": [
{
"tag": "google",
"address": "tls://8.8.8.8"
"type": "tls",
"server": "8.8.8.8"
},
{
"tag": "local",
"address": "https://223.5.5.5/dns-query",
"detour": "direct"
"type": "https",
"server": "223.5.5.5"
}
],
"rules": [
{
"outbound": "any",
"server": "local"
},
{
"clash_mode": "Direct",
"server": "local"
},
{
"clash_mode": "Global",
"server": "google"
},
{
"rule_set": "geosite-geolocation-cn",
"server": "local"
},
{
"clash_mode": "Default",
"server": "google"
},
{
"type": "logical",
"mode": "and",
@ -392,6 +310,7 @@ flowchart TB
]
},
"route": {
"default_domain_resolver": "local",
"rule_set": [
{
"type": "remote",
@ -425,7 +344,7 @@ flowchart TB
}
```
=== ":material-security: Without DNS leaks, but slower (1.9.0-alpha.2+)"
=== ":material-security: Without DNS leaks, but slower"
```json
{
@ -433,27 +352,16 @@ flowchart TB
"servers": [
{
"tag": "google",
"address": "tls://8.8.8.8"
"type": "tls",
"server": "8.8.8.8"
},
{
"tag": "local",
"address": "https://223.5.5.5/dns-query",
"detour": "direct"
"type": "https",
"server": "223.5.5.5"
}
],
"rules": [
{
"outbound": "any",
"server": "local"
},
{
"clash_mode": "Direct",
"server": "local"
},
{
"clash_mode": "Global",
"server": "google"
},
{
"rule_set": "geosite-geolocation-cn",
"server": "local"
@ -476,6 +384,7 @@ flowchart TB
]
},
"route": {
"default_domain_resolver": "local",
"rule_set": [
{
"type": "remote",
@ -517,14 +426,13 @@ flowchart TB
{
"type": "direct",
"tag": "direct"
},
{
"type": "block",
"tag": "block"
}
],
"route": {
"rules": [
{
"action": "sniff"
},
{
"type": "logical",
"mode": "or",
@ -536,20 +444,12 @@ flowchart TB
"port": 53
}
],
"outbound": "dns"
"action": "hijack-dns"
},
{
"ip_is_private": true,
"outbound": "direct"
},
{
"clash_mode": "Direct",
"outbound": "direct"
},
{
"clash_mode": "Global",
"outbound": "default"
},
{
"type": "logical",
"mode": "or",
@ -565,12 +465,23 @@ flowchart TB
"protocol": "stun"
}
],
"outbound": "block"
"action": "reject"
},
{
"rule_set": [
"geoip-cn",
"geosite-geolocation-cn"
"rule_set": "geosite-geolocation-cn",
"outbound": "direct"
},
{
"type": "logical",
"mode": "and",
"rules": [
{
"rule_set": "geoip-cn"
},
{
"rule_set": "geosite-geolocation-!cn",
"invert": true
}
],
"outbound": "direct"
}

View File

@ -205,6 +205,10 @@ func (h *inboundTransportHandler) NewConnectionEx(ctx context.Context, conn net.
var metadata adapter.InboundContext
metadata.Source = source
metadata.Destination = destination
//nolint:staticcheck
metadata.InboundDetour = h.listener.ListenOptions().Detour
//nolint:staticcheck
metadata.InboundOptions = h.listener.ListenOptions().InboundOptions
h.logger.InfoContext(ctx, "inbound connection from ", metadata.Source)
(*Inbound)(h).NewConnectionEx(ctx, conn, metadata, onClose)
}

View File

@ -219,6 +219,10 @@ func (h *inboundTransportHandler) NewConnectionEx(ctx context.Context, conn net.
var metadata adapter.InboundContext
metadata.Source = source
metadata.Destination = destination
//nolint:staticcheck
metadata.InboundDetour = h.listener.ListenOptions().Detour
//nolint:staticcheck
metadata.InboundOptions = h.listener.ListenOptions().InboundOptions
h.logger.InfoContext(ctx, "inbound connection from ", metadata.Source)
(*Inbound)(h).NewConnectionEx(ctx, conn, metadata, onClose)
}