Compare commits

..

117 Commits

Author SHA1 Message Date
世界
989034b8f7 documentation: Bump version 2025-07-03 22:20:37 +08:00
世界
fef0a17bf8 release: Fix publish testflight 2025-07-03 21:49:38 +08:00
世界
c54f87e722 Improve darwin tun performance 2025-07-03 21:49:38 +08:00
世界
9bd9e5ab83 Improve nftables rules for openwrt 2025-07-03 21:49:37 +08:00
世界
7eb72226ab Fixed DoH server recover from conn freezes 2025-07-03 21:49:37 +08:00
世界
1b08cdeb0a Update libresolv usage 2025-07-03 21:49:37 +08:00
yu
88f989b934 documentation: Update client configuration manual 2025-07-03 21:49:36 +08:00
yanwo
65af6c7cdf documentation: Fix typo
Signed-off-by: yanwo <ogilvy@gmail.com>
2025-07-03 21:49:36 +08:00
anytinz
7935126887 documentation: Fix wrong SideStore loopback ip 2025-07-03 21:49:36 +08:00
世界
1a78d3d28d Revert "release: Add IPA build"
After testing, it seems that since extensions are not handled correctly, it cannot be installed by SideStore.
2025-07-03 21:49:36 +08:00
世界
0314c83afd release: Add IPA build 2025-07-03 21:49:36 +08:00
世界
beb8741925 Add API to dump AdGuard rules 2025-07-03 21:49:35 +08:00
Sukka
74478e5f84 Improve AdGuard rule-set parser 2025-07-03 21:49:35 +08:00
Restia-Ashbell
82b9af7418 Add ECH support for uTLS 2025-07-03 21:49:35 +08:00
世界
3a5e6ee8fd Improve TLS fragments 2025-07-03 21:49:34 +08:00
世界
cb20c6ec7f Add cache support for ssm-api 2025-07-03 21:49:34 +08:00
世界
a5aef88073 Fix service will not be closed 2025-07-03 21:49:34 +08:00
世界
ab0af2960d Add loopback address support for tun 2025-07-03 21:49:34 +08:00
世界
32a081d229 Fix tproxy listener 2025-07-03 21:49:33 +08:00
世界
6b7b1b2eac Fix systemd package 2025-07-03 21:49:33 +08:00
世界
81364e3294 Fix missing home for derp service 2025-07-03 21:49:33 +08:00
Zero Clover
ee9474dd07 documentation: Fix services 2025-07-03 21:49:32 +08:00
世界
ec6b78d1b6 Fix dns.client_subnet ignored 2025-07-03 21:49:32 +08:00
世界
078fb5555d documentation: Minor fixes 2025-07-03 21:49:32 +08:00
世界
99ea71119a Fix tailscale forward 2025-07-03 21:49:31 +08:00
世界
d0ed53dae3 Minor fixes 2025-07-03 21:49:31 +08:00
世界
79deb889b1 Add SSM API service 2025-07-03 21:49:31 +08:00
世界
480d92901e Add resolved service and DNS server 2025-07-03 21:49:30 +08:00
世界
3510a228e2 Add DERP service 2025-07-03 21:49:30 +08:00
世界
135e8e673f Add service component type 2025-07-03 21:49:30 +08:00
世界
97fb38d8bf Fix tproxy tcp control 2025-07-03 21:49:29 +08:00
愚者
f376bf834f release: Fix build tags for android
Signed-off-by: 愚者 <11926619+FansChou@users.noreply.github.com>
2025-07-03 21:49:29 +08:00
世界
b9f53ec6cc prevent creation of bind and mark controls on unsupported platforms 2025-07-03 21:49:29 +08:00
PuerNya
9208dd58c2 documentation: Fix description of reject DNS action behavior 2025-07-03 21:49:29 +08:00
Restia-Ashbell
c548a90f4a Fix TLS record fragment 2025-07-03 21:49:28 +08:00
世界
e57e5f4415 Add missing accept_routes option for Tailscale 2025-07-03 21:49:28 +08:00
世界
63520226a0 Add TLS record fragment support 2025-07-03 21:49:28 +08:00
世界
02aeaca87a Fix set edns0 client subnet 2025-07-03 21:49:27 +08:00
世界
c00373d930 Update minor dependencies 2025-07-03 21:49:27 +08:00
世界
db8ece9667 Update certmagic and providers 2025-07-03 21:49:27 +08:00
世界
763ca0c3f8 Update protobuf and grpc 2025-07-03 21:49:27 +08:00
世界
d641c152a7 Add control options for listeners 2025-07-03 21:49:26 +08:00
世界
5ccb67f1a5 Update quic-go to v0.52.0 2025-07-03 21:49:26 +08:00
世界
b763a2f178 Update utls to v1.7.2 2025-07-03 21:49:26 +08:00
世界
81a14bb5f2 Handle EDNS version downgrade 2025-07-03 21:49:25 +08:00
世界
5dbc9d2fc5 documentation: Fix anytls padding scheme description 2025-07-03 21:49:25 +08:00
安容
a35c4a6a96 Report invalid DNS address early 2025-07-03 21:49:25 +08:00
世界
ea2d355907 Fix wireguard listen_port 2025-07-03 21:49:24 +08:00
世界
ee58016702 clash-api: Add more meta api 2025-07-03 21:49:24 +08:00
世界
b1dc45898b Fix DNS lookup 2025-07-03 21:49:24 +08:00
世界
f51c2a4e66 Fix fetch ECH configs 2025-07-03 21:49:24 +08:00
reletor
3cd42b6d37 documentation: Minor fixes 2025-07-03 21:49:23 +08:00
caelansar
9494f2ae21 Fix callback deletion in UDP transport 2025-07-03 21:49:23 +08:00
世界
23c24cace8 documentation: Try to make the play review happy 2025-07-03 21:49:23 +08:00
世界
e225a6476e Fix missing handling of legacy domain_strategy options 2025-07-03 21:49:23 +08:00
世界
53ea9cb4c7 Improve local DNS server 2025-07-03 21:49:22 +08:00
anytls
7b5eef8ae2 Update anytls
Co-authored-by: anytls <anytls>
2025-07-03 21:49:22 +08:00
世界
ffa70c0288 Fix DNS dialer 2025-07-03 21:49:21 +08:00
世界
1cb605924a release: Skip override version for iOS 2025-07-03 21:49:21 +08:00
iikira
90320bc80d Fix UDP DNS server crash
Signed-off-by: iikira <i2@mail.iikira.com>
2025-07-03 21:49:21 +08:00
ReleTor
b4402e27d9 Fix fetch ECH configs 2025-07-03 21:49:20 +08:00
世界
14bcf34f86 Allow direct outbounds without domain_resolver 2025-07-03 21:49:20 +08:00
世界
e41cb6d559 Fix Tailscale dialer 2025-07-03 21:49:20 +08:00
dyhkwong
d90dec5381 Fix DNS over QUIC stream close 2025-07-03 21:49:20 +08:00
anytls
e09aa7ca84 Update anytls
Co-authored-by: anytls <anytls>
2025-07-03 21:49:20 +08:00
Rambling2076
832d37b808 Fix missing with_tailscale in Dockerfile
Signed-off-by: Rambling2076 <Rambling2076@proton.me>
2025-07-03 21:49:19 +08:00
世界
3a70ae7afe Fail when default DNS server not found 2025-07-03 21:49:19 +08:00
世界
cf1058de4c Update gVisor to 20250319.0 2025-07-03 21:49:19 +08:00
世界
73e6bbb49a Explicitly reject detour to empty direct outbounds 2025-07-03 21:49:18 +08:00
世界
329d4bb4c9 Add netns support 2025-07-03 21:49:18 +08:00
世界
b43615ef35 Add wildcard name support for predefined records 2025-07-03 21:49:18 +08:00
世界
e7479dea90 Remove map usage in options 2025-07-03 21:49:17 +08:00
世界
f1f1406eb1 Fix unhandled DNS loop 2025-07-03 21:49:17 +08:00
世界
fe9cc7461b Add wildcard-sni support for shadow-tls inbound 2025-07-03 21:49:17 +08:00
k9982874
710ca243aa Add ntp protocol sniffing 2025-07-03 21:49:16 +08:00
世界
a249770e24 option: Fix marshal legacy DNS options 2025-07-03 21:49:16 +08:00
世界
6d2bd2116b Make domain_resolver optional when only one DNS server is configured 2025-07-03 21:49:16 +08:00
世界
2e1698fa78 Fix DNS lookup context pollution 2025-07-03 21:49:16 +08:00
世界
6946ec37cf Fix http3 DNS server connecting to wrong address 2025-07-03 21:49:15 +08:00
Restia-Ashbell
25f844ec6d documentation: Fix typo 2025-07-03 21:49:15 +08:00
anytls
5a5c906fb2 Update sing-anytls
Co-authored-by: anytls <anytls>
2025-07-03 21:49:15 +08:00
k9982874
31c191debb Fix hosts DNS server 2025-07-03 21:49:15 +08:00
世界
1b02fca33f Fix UDP DNS server crash 2025-07-03 21:49:14 +08:00
世界
5308c46e07 documentation: Fix missing ip_accept_any DNS rule option 2025-07-03 21:49:14 +08:00
世界
0cfcaf2c62 Fix anytls dialer usage 2025-07-03 21:49:14 +08:00
世界
a2bd384c32 Move predefined DNS server to rule action 2025-07-03 21:49:13 +08:00
世界
3723dd2583 Fix domain resolver on direct outbound 2025-07-03 21:49:13 +08:00
Zephyruso
9bbc3dabc8 Fix missing AnyTLS display name 2025-07-03 21:49:13 +08:00
anytls
6827d67a09 Update sing-anytls
Co-authored-by: anytls <anytls>
2025-07-03 21:49:13 +08:00
Estel
5ae3e97388 documentation: Fix typo
Signed-off-by: Estel <callmebedrockdigger@gmail.com>
2025-07-03 21:49:13 +08:00
TargetLocked
f6d1099b69 Fix parsing legacy DNS options 2025-07-03 21:49:12 +08:00
世界
ca1b5bbcdf Fix DNS fallback 2025-07-03 21:49:12 +08:00
世界
1c6c48ea8d documentation: Fix missing hosts DNS server 2025-07-03 21:49:11 +08:00
anytls
0d86d225a3 Add MinIdleSession option to AnyTLS outbound
Co-authored-by: anytls <anytls>
2025-07-03 21:49:11 +08:00
ReleTor
b75e6b88b7 documentation: Minor fixes 2025-07-03 21:49:11 +08:00
libtry486
000f7b1045 documentation: Fix typo
fix typo

Signed-off-by: libtry486 <89328481+libtry486@users.noreply.github.com>
2025-07-03 21:49:11 +08:00
Alireza Ahmadi
b39204f4aa Fix Outbound deadlock 2025-07-03 21:49:10 +08:00
世界
2b2655ffc7 documentation: Fix AnyTLS doc 2025-07-03 21:49:10 +08:00
anytls
3f9f41caed Add AnyTLS protocol 2025-07-03 21:49:10 +08:00
世界
0231e3c575 Migrate to stdlib ECH support 2025-07-03 21:49:09 +08:00
世界
918b70b1cc Add fallback local DNS server for iOS 2025-07-03 21:49:09 +08:00
世界
af4c4d1841 Get darwin local DNS server from libresolv 2025-07-03 21:49:09 +08:00
世界
88e830b5d8 Improve resolve action 2025-07-03 21:49:08 +08:00
世界
7eb14cfe9f Add back port hopping to hysteria 1 2025-07-03 21:49:08 +08:00
xchacha20-poly1305
e6761fa538 Remove single quotes of raw Moziila certs 2025-07-03 21:49:08 +08:00
世界
485d28ceec Add Tailscale endpoint 2025-07-03 21:49:07 +08:00
世界
159a2858e2 Build legacy binaries with latest Go 2025-07-03 21:49:07 +08:00
世界
b6691707e9 documentation: Remove outdated icons 2025-07-03 21:49:07 +08:00
世界
38f1736f78 documentation: Certificate store 2025-07-03 21:49:06 +08:00
世界
ff77bf63f5 documentation: TLS fragment 2025-07-03 21:49:06 +08:00
世界
9dad482e70 documentation: Outbound domain resolver 2025-07-03 21:49:06 +08:00
世界
d43791307c documentation: Refactor DNS 2025-07-03 21:49:05 +08:00
世界
0a82b8a9ad Add certificate store 2025-07-03 21:49:05 +08:00
世界
7bf91fb2af Add TLS fragment support 2025-07-03 21:49:05 +08:00
世界
81d2eb5f3f refactor: Outbound domain resolver 2025-07-03 21:49:05 +08:00
世界
ee731a32c8 refactor: DNS 2025-07-03 21:49:04 +08:00
世界
6f804adf39 Fix v2rayhttp crash 2025-07-03 21:48:10 +08:00
20 changed files with 51 additions and 79 deletions

View File

@@ -245,8 +245,8 @@ lib:
go run ./cmd/internal/build_libbox -target ios
lib_install:
go install -v github.com/sagernet/gomobile/cmd/gomobile@v0.1.6
go install -v github.com/sagernet/gomobile/cmd/gobind@v0.1.6
go install -v github.com/sagernet/gomobile/cmd/gomobile@v0.1.7
go install -v github.com/sagernet/gomobile/cmd/gobind@v0.1.7
docs:
venv/bin/mkdocs serve

View File

@@ -3,7 +3,6 @@ package adapter
import (
"context"
"net/netip"
"time"
C "github.com/sagernet/sing-box/constant"
"github.com/sagernet/sing-box/log"
@@ -37,7 +36,6 @@ type DNSQueryOptions struct {
Transport DNSTransport
Strategy C.DomainStrategy
LookupStrategy C.DomainStrategy
Timeout time.Duration
DisableCache bool
RewriteTTL *uint32
ClientSubnet netip.Prefix
@@ -55,7 +53,6 @@ func DNSQueryOptionsFrom(ctx context.Context, options *option.DomainResolveOptio
return &DNSQueryOptions{
Transport: transport,
Strategy: C.DomainStrategy(options.Strategy),
Timeout: time.Duration(options.Timeout),
DisableCache: options.DisableCache,
RewriteTTL: options.RewriteTTL,
ClientSubnet: options.ClientSubnet.Build(netip.Prefix{}),
@@ -73,7 +70,6 @@ type DNSTransport interface {
Type() string
Tag() string
Dependencies() []string
HasDetour() bool
Exchange(ctx context.Context, message *dns.Msg) (*dns.Msg, error)
}

View File

@@ -177,7 +177,7 @@ func publishTestflight(ctx context.Context) error {
}
log.Info(string(platform), " ", tag, " publish")
response, err := client.TestFlight.AddBuildsToBetaGroup(ctx, groupID, []string{build.ID})
if response != nil && response.StatusCode == http.StatusUnprocessableEntity {
if response != nil && (response.StatusCode == http.StatusUnprocessableEntity || response.StatusCode == http.StatusNotFound) {
log.Info("waiting for process")
time.Sleep(15 * time.Second)
continue

View File

@@ -46,8 +46,9 @@ var (
sharedFlags []string
debugFlags []string
sharedTags []string
iosTags []string
darwinTags []string
memcTags []string
notMemcTags []string
debugTags []string
)
@@ -62,8 +63,9 @@ func init() {
debugFlags = append(debugFlags, "-ldflags", "-X github.com/sagernet/sing-box/constant.Version="+currentTag)
sharedTags = append(sharedTags, "with_gvisor", "with_quic", "with_wireguard", "with_utls", "with_clash_api", "with_conntrack")
iosTags = append(iosTags, "with_dhcp", "with_low_memory")
darwinTags = append(darwinTags, "with_dhcp")
memcTags = append(memcTags, "with_tailscale")
notMemcTags = append(notMemcTags, "with_low_memory")
debugTags = append(debugTags, "debug")
}
@@ -153,6 +155,7 @@ func buildApple() {
"-v",
"-target", bindTarget,
"-libname=box",
"-tags-not-macos=with_low_memory",
}
if !withTailscale {
args = append(args, "-tags-macos="+strings.Join(memcTags, ","))
@@ -164,7 +167,7 @@ func buildApple() {
args = append(args, debugFlags...)
}
tags := append(sharedTags, iosTags...)
tags := append(sharedTags, darwinTags...)
if withTailscale {
tags = append(tags, memcTags...)
}

View File

@@ -89,7 +89,6 @@ func NewWithOptions(options Options) (N.Dialer, error) {
dnsQueryOptions = adapter.DNSQueryOptions{
Transport: transport,
Strategy: strategy,
Timeout: time.Duration(dialOptions.DomainResolver.Timeout),
DisableCache: dialOptions.DomainResolver.DisableCache,
RewriteTTL: dialOptions.DomainResolver.RewriteTTL,
ClientSubnet: dialOptions.DomainResolver.ClientSubnet.Build(netip.Prefix{}),

View File

@@ -9,7 +9,6 @@ const (
TCPTimeout = 15 * time.Second
ReadPayloadTimeout = 300 * time.Millisecond
DNSTimeout = 10 * time.Second
DirectDNSTimeout = 5 * time.Second
UDPTimeout = 5 * time.Minute
DefaultURLTestInterval = 3 * time.Minute
DefaultURLTestIdleTimeout = 30 * time.Minute

View File

@@ -30,6 +30,7 @@ var (
var _ adapter.DNSClient = (*Client)(nil)
type Client struct {
timeout time.Duration
disableCache bool
disableExpire bool
independentCache bool
@@ -42,6 +43,7 @@ type Client struct {
}
type ClientOptions struct {
Timeout time.Duration
DisableCache bool
DisableExpire bool
IndependentCache bool
@@ -53,6 +55,7 @@ type ClientOptions struct {
func NewClient(options ClientOptions) *Client {
client := &Client{
timeout: options.Timeout,
disableCache: options.DisableCache,
disableExpire: options.DisableExpire,
independentCache: options.IndependentCache,
@@ -60,6 +63,9 @@ func NewClient(options ClientOptions) *Client {
initRDRCFunc: options.RDRC,
logger: options.Logger,
}
if client.timeout == 0 {
client.timeout = C.DNSTimeout
}
cacheCapacity := options.CacheCapacity
if cacheCapacity < 1024 {
cacheCapacity = 1024
@@ -147,15 +153,7 @@ func (c *Client) Exchange(ctx context.Context, transport adapter.DNSTransport, m
return nil, ErrResponseRejectedCached
}
}
timeout := options.Timeout
if timeout == 0 {
if transport.HasDetour() {
timeout = C.DNSTimeout
} else {
timeout = C.DirectDNSTimeout
}
}
ctx, cancel := context.WithTimeout(ctx, timeout)
ctx, cancel := context.WithTimeout(ctx, c.timeout)
response, err := transport.Exchange(ctx, message)
cancel()
if err != nil {

View File

@@ -158,9 +158,6 @@ func (r *Router) matchDNS(ctx context.Context, allowFakeIP bool, ruleIndex int,
if action.Strategy != C.DomainStrategyAsIS {
options.Strategy = action.Strategy
}
if action.Timeout > 0 {
options.Timeout = action.Timeout
}
if isFakeIP || action.DisableCache {
options.DisableCache = true
}
@@ -183,9 +180,6 @@ func (r *Router) matchDNS(ctx context.Context, allowFakeIP bool, ruleIndex int,
if action.Strategy != C.DomainStrategyAsIS {
options.Strategy = action.Strategy
}
if action.Timeout > 0 {
options.Timeout = action.Timeout
}
if action.DisableCache {
options.DisableCache = true
}

View File

@@ -41,7 +41,6 @@ type Transport struct {
dns.TransportAdapter
ctx context.Context
dialer N.Dialer
hasDetour bool
logger logger.ContextLogger
networkManager adapter.NetworkManager
interfaceName string
@@ -60,7 +59,6 @@ func NewTransport(ctx context.Context, logger log.ContextLogger, tag string, opt
TransportAdapter: dns.NewTransportAdapterWithLocalOptions(C.DNSTypeDHCP, tag, options.LocalDNSServerOptions),
ctx: ctx,
dialer: transportDialer,
hasDetour: options.Detour != "",
logger: logger,
networkManager: service.FromContext[adapter.NetworkManager](ctx),
interfaceName: options.Interface,
@@ -91,10 +89,6 @@ func (t *Transport) Close() error {
return nil
}
func (t *Transport) HasDetour() bool {
return t.hasDetour
}
func (t *Transport) Exchange(ctx context.Context, message *mDNS.Msg) (*mDNS.Msg, error) {
err := t.fetchServers()
if err != nil {

View File

@@ -14,7 +14,6 @@ type TransportAdapter struct {
transportType string
transportTag string
dependencies []string
hasDetour bool
strategy C.DomainStrategy
clientSubnet netip.Prefix
}
@@ -36,7 +35,6 @@ func NewTransportAdapterWithLocalOptions(transportType string, transportTag stri
transportType: transportType,
transportTag: transportTag,
dependencies: dependencies,
hasDetour: localOptions.Detour != "",
strategy: C.DomainStrategy(localOptions.LegacyStrategy),
clientSubnet: localOptions.LegacyClientSubnet,
}
@@ -71,10 +69,6 @@ func (a *TransportAdapter) Dependencies() []string {
return a.dependencies
}
func (a *TransportAdapter) HasDetour() bool {
return a.hasDetour
}
func (a *TransportAdapter) LegacyStrategy() C.DomainStrategy {
return a.strategy
}

View File

@@ -2,10 +2,15 @@
icon: material/alert-decagram
---
#### 1.12.0-beta.30
#### 1.12.0-beta.31
* Improve tun performance on Apple platforms **1**
* Fixes and improvements
**1**:
We have significantly improved the performance of tun inbound on Apple platforms, especially in the gVisor stack.
### 1.11.14
* Fixes and improvements

6
go.mod
View File

@@ -25,16 +25,16 @@ require (
github.com/sagernet/bbolt v0.0.0-20231014093535-ea5cb2fe9f0a
github.com/sagernet/cors v1.2.1
github.com/sagernet/fswatch v0.1.1
github.com/sagernet/gomobile v0.1.6
github.com/sagernet/gomobile v0.1.7
github.com/sagernet/gvisor v0.0.0-20250325023245-7a9c0f5725fb
github.com/sagernet/quic-go v0.52.0-beta.1
github.com/sagernet/sing v0.6.11-0.20250521033217-30d675ea099b
github.com/sagernet/sing v0.6.12-0.20250703120903-7081a0c40539
github.com/sagernet/sing-mux v0.3.2
github.com/sagernet/sing-quic v0.5.0-beta.2
github.com/sagernet/sing-shadowsocks v0.2.8
github.com/sagernet/sing-shadowsocks2 v0.2.1
github.com/sagernet/sing-shadowtls v0.2.1-0.20250503051639-fcd445d33c11
github.com/sagernet/sing-tun v0.6.10-0.20250630100036-8763c24e4935
github.com/sagernet/sing-tun v0.6.10-0.20250703121732-a0881ada3251
github.com/sagernet/sing-vmess v0.2.4-0.20250605032146-38cc72672c88
github.com/sagernet/smux v1.5.34-mod.2
github.com/sagernet/tailscale v1.80.3-mod.5

12
go.sum
View File

@@ -157,8 +157,8 @@ github.com/sagernet/cors v1.2.1 h1:Cv5Z8y9YSD6Gm+qSpNrL3LO4lD3eQVvbFYJSG7JCMHQ=
github.com/sagernet/cors v1.2.1/go.mod h1:O64VyOjjhrkLmQIjF4KGRrJO/5dVXFdpEmCW/eISRAI=
github.com/sagernet/fswatch v0.1.1 h1:YqID+93B7VRfqIH3PArW/XpJv5H4OLEVWDfProGoRQs=
github.com/sagernet/fswatch v0.1.1/go.mod h1:nz85laH0mkQqJfaOrqPpkwtU1znMFNVTpT/5oRsVz/o=
github.com/sagernet/gomobile v0.1.6 h1:JkR1ToKOrdoiwULte4pYS5HYdPBzl2N+JNuuwVuLs0k=
github.com/sagernet/gomobile v0.1.6/go.mod h1:Pqq2+ZVvs10U7xK+UwJgwYWUykewi8H6vlslAO73n9E=
github.com/sagernet/gomobile v0.1.7 h1:I9jCJZTH0weP5MsuydvYHX5QfN/r6Fe8ptAIj1+SJVg=
github.com/sagernet/gomobile v0.1.7/go.mod h1:Pqq2+ZVvs10U7xK+UwJgwYWUykewi8H6vlslAO73n9E=
github.com/sagernet/gvisor v0.0.0-20250325023245-7a9c0f5725fb h1:pprQtDqNgqXkRsXn+0E8ikKOemzmum8bODjSfDene38=
github.com/sagernet/gvisor v0.0.0-20250325023245-7a9c0f5725fb/go.mod h1:QkkPEJLw59/tfxgapHta14UL5qMUah5NXhO0Kw2Kan4=
github.com/sagernet/netlink v0.0.0-20240612041022-b9a21c07ac6a h1:ObwtHN2VpqE0ZNjr6sGeT00J8uU7JF4cNUdb44/Duis=
@@ -168,8 +168,8 @@ github.com/sagernet/nftables v0.3.0-beta.4/go.mod h1:OQXAjvjNGGFxaTgVCSTRIhYB5/l
github.com/sagernet/quic-go v0.52.0-beta.1 h1:hWkojLg64zjV+MJOvJU/kOeWndm3tiEfBLx5foisszs=
github.com/sagernet/quic-go v0.52.0-beta.1/go.mod h1:OV+V5kEBb8kJS7k29MzDu6oj9GyMc7HA07sE1tedxz4=
github.com/sagernet/sing v0.6.9/go.mod h1:ARkL0gM13/Iv5VCZmci/NuoOlePoIsW0m7BWfln/Hak=
github.com/sagernet/sing v0.6.11-0.20250521033217-30d675ea099b h1:ZjTCYPb5f7aHdf1UpUvE22dVmf7BL8eQ/zLZhjgh7Wo=
github.com/sagernet/sing v0.6.11-0.20250521033217-30d675ea099b/go.mod h1:ARkL0gM13/Iv5VCZmci/NuoOlePoIsW0m7BWfln/Hak=
github.com/sagernet/sing v0.6.12-0.20250703120903-7081a0c40539 h1:SK4M4FCNdwV4EiYKIUZ9qM4lr/1NQogJe1YoyYw5DV8=
github.com/sagernet/sing v0.6.12-0.20250703120903-7081a0c40539/go.mod h1:ARkL0gM13/Iv5VCZmci/NuoOlePoIsW0m7BWfln/Hak=
github.com/sagernet/sing-mux v0.3.2 h1:meZVFiiStvHThb/trcpAkCrmtJOuItG5Dzl1RRP5/NE=
github.com/sagernet/sing-mux v0.3.2/go.mod h1:pht8iFY4c9Xltj7rhVd208npkNaeCxzyXCgulDPLUDA=
github.com/sagernet/sing-quic v0.5.0-beta.2 h1:j7KAbBuGmsKwSxVAQL5soJ+wDqxim4/llK2kxB0hSKk=
@@ -180,8 +180,8 @@ github.com/sagernet/sing-shadowsocks2 v0.2.1 h1:dWV9OXCeFPuYGHb6IRqlSptVnSzOelnq
github.com/sagernet/sing-shadowsocks2 v0.2.1/go.mod h1:RnXS0lExcDAovvDeniJ4IKa2IuChrdipolPYWBv9hWQ=
github.com/sagernet/sing-shadowtls v0.2.1-0.20250503051639-fcd445d33c11 h1:tK+75l64tm9WvEFrYRE1t0YxoFdWQqw/h7Uhzj0vJ+w=
github.com/sagernet/sing-shadowtls v0.2.1-0.20250503051639-fcd445d33c11/go.mod h1:sWqKnGlMipCHaGsw1sTTlimyUpgzP4WP3pjhCsYt9oA=
github.com/sagernet/sing-tun v0.6.10-0.20250630100036-8763c24e4935 h1:wha4BG4mrEKaIoouVyiU5BcPfKD1n0LkiL4vqdjaVps=
github.com/sagernet/sing-tun v0.6.10-0.20250630100036-8763c24e4935/go.mod h1:fisFCbC4Vfb6HqQNcwPJi2CDK2bf0Xapyz3j3t4cnHE=
github.com/sagernet/sing-tun v0.6.10-0.20250703121732-a0881ada3251 h1:eH9naJXvyF/DZDk0V1SYkL6ypYD+A1tUFWLcT7PRezg=
github.com/sagernet/sing-tun v0.6.10-0.20250703121732-a0881ada3251/go.mod h1:fisFCbC4Vfb6HqQNcwPJi2CDK2bf0Xapyz3j3t4cnHE=
github.com/sagernet/sing-vmess v0.2.4-0.20250605032146-38cc72672c88 h1:0pVm8sPOel+BoiCddW3pV3cKDKEaSioVTYDdTSKjyFI=
github.com/sagernet/sing-vmess v0.2.4-0.20250605032146-38cc72672c88/go.mod h1:IL8Rr+EGwuqijszZkNrEFTQDKhilEpkqFqOlvdpS6/w=
github.com/sagernet/smux v1.5.34-mod.2 h1:gkmBjIjlJ2zQKpLigOkFur5kBKdV6bNRoFu2WkltRQ4=

View File

@@ -91,7 +91,6 @@ type DialerOptions struct {
type _DomainResolveOptions struct {
Server string `json:"server"`
Strategy DomainStrategy `json:"strategy,omitempty"`
Timeout badoption.Duration `json:"timeout,omitempty"`
DisableCache bool `json:"disable_cache,omitempty"`
RewriteTTL *uint32 `json:"rewrite_ttl,omitempty"`
ClientSubnet *badoption.Prefixable `json:"client_subnet,omitempty"`
@@ -103,7 +102,6 @@ func (o DomainResolveOptions) MarshalJSON() ([]byte, error) {
if o.Server == "" {
return []byte("{}"), nil
} else if o.Strategy == DomainStrategy(C.DomainStrategyAsIS) &&
o.Timeout == 0 &&
!o.DisableCache &&
o.RewriteTTL == nil &&
o.ClientSubnet == nil {

View File

@@ -180,7 +180,6 @@ func (r *RouteOptionsActionOptions) UnmarshalJSON(data []byte) error {
type DNSRouteActionOptions struct {
Server string `json:"server,omitempty"`
Strategy DomainStrategy `json:"strategy,omitempty"`
Timeout badoption.Duration `json:"timeout,omitempty"`
DisableCache bool `json:"disable_cache,omitempty"`
RewriteTTL *uint32 `json:"rewrite_ttl,omitempty"`
ClientSubnet *badoption.Prefixable `json:"client_subnet,omitempty"`
@@ -188,7 +187,6 @@ type DNSRouteActionOptions struct {
type _DNSRouteOptionsActionOptions struct {
Strategy DomainStrategy `json:"strategy,omitempty"`
Timeout badoption.Duration `json:"timeout,omitempty"`
DisableCache bool `json:"disable_cache,omitempty"`
RewriteTTL *uint32 `json:"rewrite_ttl,omitempty"`
ClientSubnet *badoption.Prefixable `json:"client_subnet,omitempty"`

View File

@@ -130,9 +130,14 @@ func NewInbound(ctx context.Context, router adapter.Router, logger log.ContextLo
deprecated.Report(ctx, deprecated.OptionTUNGSO)
}
platformInterface := service.FromContext[platform.Interface](ctx)
tunMTU := options.MTU
if tunMTU == 0 {
tunMTU = 9000
if platformInterface != nil && platformInterface.UnderNetworkExtension() {
tunMTU = 4000
} else {
tunMTU = 9000
}
}
var udpTimeout time.Duration
if options.UDPTimeout != 0 {
@@ -208,7 +213,7 @@ func NewInbound(ctx context.Context, router adapter.Router, logger log.ContextLo
},
udpTimeout: udpTimeout,
stack: options.Stack,
platformInterface: service.FromContext[platform.Interface](ctx),
platformInterface: platformInterface,
platformOptions: common.PtrValueOrDefault(options.Platform),
}
for _, routeAddressSet := range options.RouteAddressSet {

View File

@@ -76,7 +76,6 @@ func NewNetworkManager(ctx context.Context, logger logger.ContextLogger, routeOp
DomainResolver: defaultDomainResolver.Server,
DomainResolveOptions: adapter.DNSQueryOptions{
Strategy: C.DomainStrategy(defaultDomainResolver.Strategy),
Timeout: time.Duration(defaultDomainResolver.Timeout),
DisableCache: defaultDomainResolver.DisableCache,
RewriteTTL: defaultDomainResolver.RewriteTTL,
ClientSubnet: defaultDomainResolver.ClientSubnet.Build(netip.Prefix{}),

View File

@@ -666,7 +666,6 @@ func (r *Router) actionResolve(ctx context.Context, metadata *adapter.InboundCon
addresses, err := r.dns.Lookup(adapter.WithContext(ctx, metadata), metadata.Destination.Fqdn, adapter.DNSQueryOptions{
Transport: transport,
Strategy: action.Strategy,
Timeout: action.Timeout,
DisableCache: action.DisableCache,
RewriteTTL: action.RewriteTTL,
ClientSubnet: action.ClientSubnet,

View File

@@ -113,7 +113,6 @@ func NewDNSRuleAction(logger logger.ContextLogger, action option.DNSRuleAction)
Server: action.RouteOptions.Server,
RuleActionDNSRouteOptions: RuleActionDNSRouteOptions{
Strategy: C.DomainStrategy(action.RouteOptions.Strategy),
Timeout: time.Duration(action.RouteOptions.Timeout),
DisableCache: action.RouteOptions.DisableCache,
RewriteTTL: action.RouteOptions.RewriteTTL,
ClientSubnet: netip.Prefix(common.PtrValueOrDefault(action.RouteOptions.ClientSubnet)),
@@ -122,7 +121,6 @@ func NewDNSRuleAction(logger logger.ContextLogger, action option.DNSRuleAction)
case C.RuleActionTypeRouteOptions:
return &RuleActionDNSRouteOptions{
Strategy: C.DomainStrategy(action.RouteOptionsOptions.Strategy),
Timeout: time.Duration(action.RouteOptionsOptions.Timeout),
DisableCache: action.RouteOptionsOptions.DisableCache,
RewriteTTL: action.RouteOptionsOptions.RewriteTTL,
ClientSubnet: netip.Prefix(common.PtrValueOrDefault(action.RouteOptionsOptions.ClientSubnet)),
@@ -237,13 +235,20 @@ func (r *RuleActionDNSRoute) Type() string {
func (r *RuleActionDNSRoute) String() string {
var descriptions []string
descriptions = append(descriptions, r.Server)
descriptions = append(descriptions, r.Descriptions()...)
if r.DisableCache {
descriptions = append(descriptions, "disable-cache")
}
if r.RewriteTTL != nil {
descriptions = append(descriptions, F.ToString("rewrite-ttl=", *r.RewriteTTL))
}
if r.ClientSubnet.IsValid() {
descriptions = append(descriptions, F.ToString("client-subnet=", r.ClientSubnet))
}
return F.ToString("route(", strings.Join(descriptions, ","), ")")
}
type RuleActionDNSRouteOptions struct {
Strategy C.DomainStrategy
Timeout time.Duration
DisableCache bool
RewriteTTL *uint32
ClientSubnet netip.Prefix
@@ -254,17 +259,7 @@ func (r *RuleActionDNSRouteOptions) Type() string {
}
func (r *RuleActionDNSRouteOptions) String() string {
return F.ToString("route-options(", strings.Join(r.Descriptions(), ","), ")")
}
func (r *RuleActionDNSRouteOptions) Descriptions() []string {
var descriptions []string
if r.Strategy != C.DomainStrategyAsIS {
descriptions = append(descriptions, F.ToString("strategy=", option.DomainStrategy(r.Strategy)))
}
if r.Timeout > 0 {
descriptions = append(descriptions, F.ToString("timeout=", r.Timeout.String()))
}
if r.DisableCache {
descriptions = append(descriptions, "disable-cache")
}
@@ -274,7 +269,7 @@ func (r *RuleActionDNSRouteOptions) Descriptions() []string {
if r.ClientSubnet.IsValid() {
descriptions = append(descriptions, F.ToString("client-subnet=", r.ClientSubnet))
}
return descriptions
return F.ToString("route-options(", strings.Join(descriptions, ","), ")")
}
type RuleActionDirect struct {
@@ -426,7 +421,6 @@ func (r *RuleActionSniff) String() string {
type RuleActionResolve struct {
Server string
Strategy C.DomainStrategy
Timeout time.Duration
DisableCache bool
RewriteTTL *uint32
ClientSubnet netip.Prefix
@@ -444,9 +438,6 @@ func (r *RuleActionResolve) String() string {
if r.Strategy != C.DomainStrategyAsIS {
options = append(options, F.ToString(option.DomainStrategy(r.Strategy)))
}
if r.Timeout > 0 {
options = append(options, F.ToString("timeout=", r.Timeout.String()))
}
if r.DisableCache {
options = append(options, "disable_cache")
}

View File

@@ -31,6 +31,9 @@ type HTTPConn struct {
}
func NewHTTP1Conn(conn net.Conn, request *http.Request) *HTTPConn {
if request.Header.Get("Host") == "" {
request.Header.Set("Host", request.Host)
}
return &HTTPConn{
Conn: conn,
request: request,
@@ -89,9 +92,6 @@ func (c *HTTPConn) writeRequest(payload []byte) error {
if err != nil {
return err
}
if c.request.Header.Get("Host") == "" {
c.request.Header.Set("Host", c.request.Host)
}
for key, value := range c.request.Header {
_, err = writer.Write([]byte(F.ToString(key, ": ", strings.Join(value, ", "), CRLF)))
if err != nil {