mirror of
https://github.com/SagerNet/sing-box.git
synced 2026-04-13 20:28:32 +10:00
Compare commits
115 Commits
v1.12.0-be
...
dev-dns-ti
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0d8c15932f | ||
|
|
70371c3cbe | ||
|
|
32bc8b48f1 | ||
|
|
b5df508bc9 | ||
|
|
4789846113 | ||
|
|
ad94f94cfb | ||
|
|
1f9de9f321 | ||
|
|
344bbf9494 | ||
|
|
b7e16e70ab | ||
|
|
391153ecb8 | ||
|
|
3d821db0b2 | ||
|
|
344ecd3798 | ||
|
|
a8a3f863cd | ||
|
|
ea190ca428 | ||
|
|
e65b78d1e4 | ||
|
|
84f7d80da7 | ||
|
|
2b57eb0b30 | ||
|
|
9884f81298 | ||
|
|
8493b4f1da | ||
|
|
8f1a8add85 | ||
|
|
85ee6bb266 | ||
|
|
c4387f7c37 | ||
|
|
dcb7a5caed | ||
|
|
ae77cdeedd | ||
|
|
ec05d4e5e3 | ||
|
|
1f766d2b89 | ||
|
|
a5a6c1f7d4 | ||
|
|
cd43786279 | ||
|
|
43a211db28 | ||
|
|
d4f6bdf792 | ||
|
|
99cf27bedd | ||
|
|
0a14c5ab1f | ||
|
|
533b31e1f6 | ||
|
|
8ed6523872 | ||
|
|
e5c162222d | ||
|
|
88babbf3a7 | ||
|
|
49a03e0b23 | ||
|
|
9a8e9a34c0 | ||
|
|
17551db7be | ||
|
|
83201bb088 | ||
|
|
f0f1942f1f | ||
|
|
c7e318be61 | ||
|
|
2a5e0d0c92 | ||
|
|
956e485342 | ||
|
|
23ede74e74 | ||
|
|
03317e61dd | ||
|
|
fc81bd9a5b | ||
|
|
4d406cad84 | ||
|
|
1f0282de9c | ||
|
|
b097912418 | ||
|
|
056c29e73a | ||
|
|
7aa0a57e60 | ||
|
|
2673e64bcb | ||
|
|
3d3c1709d7 | ||
|
|
9de29a590f | ||
|
|
a5282b08ec | ||
|
|
b26c2083bf | ||
|
|
c1f4c691dc | ||
|
|
c0ef6eb728 | ||
|
|
074d61021f | ||
|
|
246c9d4e40 | ||
|
|
3e3466c8d7 | ||
|
|
f73415a732 | ||
|
|
ecabe9ffe1 | ||
|
|
2dae1ee284 | ||
|
|
2afb24d698 | ||
|
|
ade83ee758 | ||
|
|
ac9c300ca7 | ||
|
|
e6eb3cec2b | ||
|
|
601b79371b | ||
|
|
56b957d30d | ||
|
|
eb87b1a708 | ||
|
|
c0a5561bd4 | ||
|
|
4a3fe1d41c | ||
|
|
4cbbcfb04d | ||
|
|
b3ad4e0e39 | ||
|
|
49f9c0011d | ||
|
|
c8c165af87 | ||
|
|
3f790ff8c9 | ||
|
|
f2272ae1e7 | ||
|
|
b40c264c0a | ||
|
|
29fc8d6a86 | ||
|
|
46ca27c926 | ||
|
|
243a5dd477 | ||
|
|
844e9f09a6 | ||
|
|
9aa673f79e | ||
|
|
5abd74ffe3 | ||
|
|
68a32960bd | ||
|
|
1e62e3e5d4 | ||
|
|
40c03a9913 | ||
|
|
2ea4029868 | ||
|
|
66f5cdd014 | ||
|
|
89da2b6355 | ||
|
|
ee2b8498e6 | ||
|
|
b1eaf537bd | ||
|
|
63739c1621 | ||
|
|
3c8ddee029 | ||
|
|
23aad70045 | ||
|
|
0d67b51267 | ||
|
|
c02f939265 | ||
|
|
36b84e25c2 | ||
|
|
9fd4b0e9ae | ||
|
|
e68cdcc98a | ||
|
|
2691617c5e | ||
|
|
04056a1357 | ||
|
|
faac858e5d | ||
|
|
a818c8abeb | ||
|
|
15cbe9fc87 | ||
|
|
e186f2d31e | ||
|
|
e9323481a4 | ||
|
|
a0a41ff2bb | ||
|
|
549daf9d41 | ||
|
|
fa370f7d04 | ||
|
|
795cb17bfa | ||
|
|
00d8add761 |
4
Makefile
4
Makefile
@@ -245,8 +245,8 @@ lib:
|
|||||||
go run ./cmd/internal/build_libbox -target ios
|
go run ./cmd/internal/build_libbox -target ios
|
||||||
|
|
||||||
lib_install:
|
lib_install:
|
||||||
go install -v github.com/sagernet/gomobile/cmd/gomobile@v0.1.7
|
go install -v github.com/sagernet/gomobile/cmd/gomobile@v0.1.6
|
||||||
go install -v github.com/sagernet/gomobile/cmd/gobind@v0.1.7
|
go install -v github.com/sagernet/gomobile/cmd/gobind@v0.1.6
|
||||||
|
|
||||||
docs:
|
docs:
|
||||||
venv/bin/mkdocs serve
|
venv/bin/mkdocs serve
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package adapter
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"net/netip"
|
"net/netip"
|
||||||
|
"time"
|
||||||
|
|
||||||
C "github.com/sagernet/sing-box/constant"
|
C "github.com/sagernet/sing-box/constant"
|
||||||
"github.com/sagernet/sing-box/log"
|
"github.com/sagernet/sing-box/log"
|
||||||
@@ -36,6 +37,7 @@ type DNSQueryOptions struct {
|
|||||||
Transport DNSTransport
|
Transport DNSTransport
|
||||||
Strategy C.DomainStrategy
|
Strategy C.DomainStrategy
|
||||||
LookupStrategy C.DomainStrategy
|
LookupStrategy C.DomainStrategy
|
||||||
|
Timeout time.Duration
|
||||||
DisableCache bool
|
DisableCache bool
|
||||||
RewriteTTL *uint32
|
RewriteTTL *uint32
|
||||||
ClientSubnet netip.Prefix
|
ClientSubnet netip.Prefix
|
||||||
@@ -53,6 +55,7 @@ func DNSQueryOptionsFrom(ctx context.Context, options *option.DomainResolveOptio
|
|||||||
return &DNSQueryOptions{
|
return &DNSQueryOptions{
|
||||||
Transport: transport,
|
Transport: transport,
|
||||||
Strategy: C.DomainStrategy(options.Strategy),
|
Strategy: C.DomainStrategy(options.Strategy),
|
||||||
|
Timeout: time.Duration(options.Timeout),
|
||||||
DisableCache: options.DisableCache,
|
DisableCache: options.DisableCache,
|
||||||
RewriteTTL: options.RewriteTTL,
|
RewriteTTL: options.RewriteTTL,
|
||||||
ClientSubnet: options.ClientSubnet.Build(netip.Prefix{}),
|
ClientSubnet: options.ClientSubnet.Build(netip.Prefix{}),
|
||||||
@@ -70,6 +73,7 @@ type DNSTransport interface {
|
|||||||
Type() string
|
Type() string
|
||||||
Tag() string
|
Tag() string
|
||||||
Dependencies() []string
|
Dependencies() []string
|
||||||
|
HasDetour() bool
|
||||||
Exchange(ctx context.Context, message *dns.Msg) (*dns.Msg, error)
|
Exchange(ctx context.Context, message *dns.Msg) (*dns.Msg, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -177,7 +177,7 @@ func publishTestflight(ctx context.Context) error {
|
|||||||
}
|
}
|
||||||
log.Info(string(platform), " ", tag, " publish")
|
log.Info(string(platform), " ", tag, " publish")
|
||||||
response, err := client.TestFlight.AddBuildsToBetaGroup(ctx, groupID, []string{build.ID})
|
response, err := client.TestFlight.AddBuildsToBetaGroup(ctx, groupID, []string{build.ID})
|
||||||
if response != nil && (response.StatusCode == http.StatusUnprocessableEntity || response.StatusCode == http.StatusNotFound) {
|
if response != nil && response.StatusCode == http.StatusUnprocessableEntity {
|
||||||
log.Info("waiting for process")
|
log.Info("waiting for process")
|
||||||
time.Sleep(15 * time.Second)
|
time.Sleep(15 * time.Second)
|
||||||
continue
|
continue
|
||||||
|
|||||||
@@ -46,9 +46,8 @@ var (
|
|||||||
sharedFlags []string
|
sharedFlags []string
|
||||||
debugFlags []string
|
debugFlags []string
|
||||||
sharedTags []string
|
sharedTags []string
|
||||||
darwinTags []string
|
iosTags []string
|
||||||
memcTags []string
|
memcTags []string
|
||||||
notMemcTags []string
|
|
||||||
debugTags []string
|
debugTags []string
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -63,9 +62,8 @@ func init() {
|
|||||||
debugFlags = append(debugFlags, "-ldflags", "-X github.com/sagernet/sing-box/constant.Version="+currentTag)
|
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")
|
sharedTags = append(sharedTags, "with_gvisor", "with_quic", "with_wireguard", "with_utls", "with_clash_api", "with_conntrack")
|
||||||
darwinTags = append(darwinTags, "with_dhcp")
|
iosTags = append(iosTags, "with_dhcp", "with_low_memory")
|
||||||
memcTags = append(memcTags, "with_tailscale")
|
memcTags = append(memcTags, "with_tailscale")
|
||||||
notMemcTags = append(notMemcTags, "with_low_memory")
|
|
||||||
debugTags = append(debugTags, "debug")
|
debugTags = append(debugTags, "debug")
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -155,7 +153,6 @@ func buildApple() {
|
|||||||
"-v",
|
"-v",
|
||||||
"-target", bindTarget,
|
"-target", bindTarget,
|
||||||
"-libname=box",
|
"-libname=box",
|
||||||
"-tags-not-macos=with_low_memory",
|
|
||||||
}
|
}
|
||||||
if !withTailscale {
|
if !withTailscale {
|
||||||
args = append(args, "-tags-macos="+strings.Join(memcTags, ","))
|
args = append(args, "-tags-macos="+strings.Join(memcTags, ","))
|
||||||
@@ -167,7 +164,7 @@ func buildApple() {
|
|||||||
args = append(args, debugFlags...)
|
args = append(args, debugFlags...)
|
||||||
}
|
}
|
||||||
|
|
||||||
tags := append(sharedTags, darwinTags...)
|
tags := append(sharedTags, iosTags...)
|
||||||
if withTailscale {
|
if withTailscale {
|
||||||
tags = append(tags, memcTags...)
|
tags = append(tags, memcTags...)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -89,6 +89,7 @@ func NewWithOptions(options Options) (N.Dialer, error) {
|
|||||||
dnsQueryOptions = adapter.DNSQueryOptions{
|
dnsQueryOptions = adapter.DNSQueryOptions{
|
||||||
Transport: transport,
|
Transport: transport,
|
||||||
Strategy: strategy,
|
Strategy: strategy,
|
||||||
|
Timeout: time.Duration(dialOptions.DomainResolver.Timeout),
|
||||||
DisableCache: dialOptions.DomainResolver.DisableCache,
|
DisableCache: dialOptions.DomainResolver.DisableCache,
|
||||||
RewriteTTL: dialOptions.DomainResolver.RewriteTTL,
|
RewriteTTL: dialOptions.DomainResolver.RewriteTTL,
|
||||||
ClientSubnet: dialOptions.DomainResolver.ClientSubnet.Build(netip.Prefix{}),
|
ClientSubnet: dialOptions.DomainResolver.ClientSubnet.Build(netip.Prefix{}),
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ const (
|
|||||||
TCPTimeout = 15 * time.Second
|
TCPTimeout = 15 * time.Second
|
||||||
ReadPayloadTimeout = 300 * time.Millisecond
|
ReadPayloadTimeout = 300 * time.Millisecond
|
||||||
DNSTimeout = 10 * time.Second
|
DNSTimeout = 10 * time.Second
|
||||||
|
DirectDNSTimeout = 5 * time.Second
|
||||||
UDPTimeout = 5 * time.Minute
|
UDPTimeout = 5 * time.Minute
|
||||||
DefaultURLTestInterval = 3 * time.Minute
|
DefaultURLTestInterval = 3 * time.Minute
|
||||||
DefaultURLTestIdleTimeout = 30 * time.Minute
|
DefaultURLTestIdleTimeout = 30 * time.Minute
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ var (
|
|||||||
var _ adapter.DNSClient = (*Client)(nil)
|
var _ adapter.DNSClient = (*Client)(nil)
|
||||||
|
|
||||||
type Client struct {
|
type Client struct {
|
||||||
timeout time.Duration
|
|
||||||
disableCache bool
|
disableCache bool
|
||||||
disableExpire bool
|
disableExpire bool
|
||||||
independentCache bool
|
independentCache bool
|
||||||
@@ -43,7 +42,6 @@ type Client struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type ClientOptions struct {
|
type ClientOptions struct {
|
||||||
Timeout time.Duration
|
|
||||||
DisableCache bool
|
DisableCache bool
|
||||||
DisableExpire bool
|
DisableExpire bool
|
||||||
IndependentCache bool
|
IndependentCache bool
|
||||||
@@ -55,7 +53,6 @@ type ClientOptions struct {
|
|||||||
|
|
||||||
func NewClient(options ClientOptions) *Client {
|
func NewClient(options ClientOptions) *Client {
|
||||||
client := &Client{
|
client := &Client{
|
||||||
timeout: options.Timeout,
|
|
||||||
disableCache: options.DisableCache,
|
disableCache: options.DisableCache,
|
||||||
disableExpire: options.DisableExpire,
|
disableExpire: options.DisableExpire,
|
||||||
independentCache: options.IndependentCache,
|
independentCache: options.IndependentCache,
|
||||||
@@ -63,9 +60,6 @@ func NewClient(options ClientOptions) *Client {
|
|||||||
initRDRCFunc: options.RDRC,
|
initRDRCFunc: options.RDRC,
|
||||||
logger: options.Logger,
|
logger: options.Logger,
|
||||||
}
|
}
|
||||||
if client.timeout == 0 {
|
|
||||||
client.timeout = C.DNSTimeout
|
|
||||||
}
|
|
||||||
cacheCapacity := options.CacheCapacity
|
cacheCapacity := options.CacheCapacity
|
||||||
if cacheCapacity < 1024 {
|
if cacheCapacity < 1024 {
|
||||||
cacheCapacity = 1024
|
cacheCapacity = 1024
|
||||||
@@ -153,7 +147,15 @@ func (c *Client) Exchange(ctx context.Context, transport adapter.DNSTransport, m
|
|||||||
return nil, ErrResponseRejectedCached
|
return nil, ErrResponseRejectedCached
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ctx, cancel := context.WithTimeout(ctx, c.timeout)
|
timeout := options.Timeout
|
||||||
|
if timeout == 0 {
|
||||||
|
if transport.HasDetour() {
|
||||||
|
timeout = C.DNSTimeout
|
||||||
|
} else {
|
||||||
|
timeout = C.DirectDNSTimeout
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ctx, cancel := context.WithTimeout(ctx, timeout)
|
||||||
response, err := transport.Exchange(ctx, message)
|
response, err := transport.Exchange(ctx, message)
|
||||||
cancel()
|
cancel()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -158,6 +158,9 @@ func (r *Router) matchDNS(ctx context.Context, allowFakeIP bool, ruleIndex int,
|
|||||||
if action.Strategy != C.DomainStrategyAsIS {
|
if action.Strategy != C.DomainStrategyAsIS {
|
||||||
options.Strategy = action.Strategy
|
options.Strategy = action.Strategy
|
||||||
}
|
}
|
||||||
|
if action.Timeout > 0 {
|
||||||
|
options.Timeout = action.Timeout
|
||||||
|
}
|
||||||
if isFakeIP || action.DisableCache {
|
if isFakeIP || action.DisableCache {
|
||||||
options.DisableCache = true
|
options.DisableCache = true
|
||||||
}
|
}
|
||||||
@@ -180,6 +183,9 @@ func (r *Router) matchDNS(ctx context.Context, allowFakeIP bool, ruleIndex int,
|
|||||||
if action.Strategy != C.DomainStrategyAsIS {
|
if action.Strategy != C.DomainStrategyAsIS {
|
||||||
options.Strategy = action.Strategy
|
options.Strategy = action.Strategy
|
||||||
}
|
}
|
||||||
|
if action.Timeout > 0 {
|
||||||
|
options.Timeout = action.Timeout
|
||||||
|
}
|
||||||
if action.DisableCache {
|
if action.DisableCache {
|
||||||
options.DisableCache = true
|
options.DisableCache = true
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ type Transport struct {
|
|||||||
dns.TransportAdapter
|
dns.TransportAdapter
|
||||||
ctx context.Context
|
ctx context.Context
|
||||||
dialer N.Dialer
|
dialer N.Dialer
|
||||||
|
hasDetour bool
|
||||||
logger logger.ContextLogger
|
logger logger.ContextLogger
|
||||||
networkManager adapter.NetworkManager
|
networkManager adapter.NetworkManager
|
||||||
interfaceName string
|
interfaceName string
|
||||||
@@ -59,6 +60,7 @@ func NewTransport(ctx context.Context, logger log.ContextLogger, tag string, opt
|
|||||||
TransportAdapter: dns.NewTransportAdapterWithLocalOptions(C.DNSTypeDHCP, tag, options.LocalDNSServerOptions),
|
TransportAdapter: dns.NewTransportAdapterWithLocalOptions(C.DNSTypeDHCP, tag, options.LocalDNSServerOptions),
|
||||||
ctx: ctx,
|
ctx: ctx,
|
||||||
dialer: transportDialer,
|
dialer: transportDialer,
|
||||||
|
hasDetour: options.Detour != "",
|
||||||
logger: logger,
|
logger: logger,
|
||||||
networkManager: service.FromContext[adapter.NetworkManager](ctx),
|
networkManager: service.FromContext[adapter.NetworkManager](ctx),
|
||||||
interfaceName: options.Interface,
|
interfaceName: options.Interface,
|
||||||
@@ -89,6 +91,10 @@ func (t *Transport) Close() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (t *Transport) HasDetour() bool {
|
||||||
|
return t.hasDetour
|
||||||
|
}
|
||||||
|
|
||||||
func (t *Transport) Exchange(ctx context.Context, message *mDNS.Msg) (*mDNS.Msg, error) {
|
func (t *Transport) Exchange(ctx context.Context, message *mDNS.Msg) (*mDNS.Msg, error) {
|
||||||
err := t.fetchServers()
|
err := t.fetchServers()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ type TransportAdapter struct {
|
|||||||
transportType string
|
transportType string
|
||||||
transportTag string
|
transportTag string
|
||||||
dependencies []string
|
dependencies []string
|
||||||
|
hasDetour bool
|
||||||
strategy C.DomainStrategy
|
strategy C.DomainStrategy
|
||||||
clientSubnet netip.Prefix
|
clientSubnet netip.Prefix
|
||||||
}
|
}
|
||||||
@@ -35,6 +36,7 @@ func NewTransportAdapterWithLocalOptions(transportType string, transportTag stri
|
|||||||
transportType: transportType,
|
transportType: transportType,
|
||||||
transportTag: transportTag,
|
transportTag: transportTag,
|
||||||
dependencies: dependencies,
|
dependencies: dependencies,
|
||||||
|
hasDetour: localOptions.Detour != "",
|
||||||
strategy: C.DomainStrategy(localOptions.LegacyStrategy),
|
strategy: C.DomainStrategy(localOptions.LegacyStrategy),
|
||||||
clientSubnet: localOptions.LegacyClientSubnet,
|
clientSubnet: localOptions.LegacyClientSubnet,
|
||||||
}
|
}
|
||||||
@@ -69,6 +71,10 @@ func (a *TransportAdapter) Dependencies() []string {
|
|||||||
return a.dependencies
|
return a.dependencies
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (a *TransportAdapter) HasDetour() bool {
|
||||||
|
return a.hasDetour
|
||||||
|
}
|
||||||
|
|
||||||
func (a *TransportAdapter) LegacyStrategy() C.DomainStrategy {
|
func (a *TransportAdapter) LegacyStrategy() C.DomainStrategy {
|
||||||
return a.strategy
|
return a.strategy
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,15 +2,10 @@
|
|||||||
icon: material/alert-decagram
|
icon: material/alert-decagram
|
||||||
---
|
---
|
||||||
|
|
||||||
#### 1.12.0-beta.31
|
#### 1.12.0-beta.30
|
||||||
|
|
||||||
* Improve tun performance on Apple platforms **1**
|
|
||||||
* Fixes and improvements
|
* Fixes and improvements
|
||||||
|
|
||||||
**1**:
|
|
||||||
|
|
||||||
We have significantly improved the performance of tun inbound on Apple platforms, especially in the gVisor stack.
|
|
||||||
|
|
||||||
### 1.11.14
|
### 1.11.14
|
||||||
|
|
||||||
* Fixes and improvements
|
* Fixes and improvements
|
||||||
|
|||||||
6
go.mod
6
go.mod
@@ -25,16 +25,16 @@ require (
|
|||||||
github.com/sagernet/bbolt v0.0.0-20231014093535-ea5cb2fe9f0a
|
github.com/sagernet/bbolt v0.0.0-20231014093535-ea5cb2fe9f0a
|
||||||
github.com/sagernet/cors v1.2.1
|
github.com/sagernet/cors v1.2.1
|
||||||
github.com/sagernet/fswatch v0.1.1
|
github.com/sagernet/fswatch v0.1.1
|
||||||
github.com/sagernet/gomobile v0.1.7
|
github.com/sagernet/gomobile v0.1.6
|
||||||
github.com/sagernet/gvisor v0.0.0-20250325023245-7a9c0f5725fb
|
github.com/sagernet/gvisor v0.0.0-20250325023245-7a9c0f5725fb
|
||||||
github.com/sagernet/quic-go v0.52.0-beta.1
|
github.com/sagernet/quic-go v0.52.0-beta.1
|
||||||
github.com/sagernet/sing v0.6.12-0.20250703120903-7081a0c40539
|
github.com/sagernet/sing v0.6.11-0.20250521033217-30d675ea099b
|
||||||
github.com/sagernet/sing-mux v0.3.2
|
github.com/sagernet/sing-mux v0.3.2
|
||||||
github.com/sagernet/sing-quic v0.5.0-beta.2
|
github.com/sagernet/sing-quic v0.5.0-beta.2
|
||||||
github.com/sagernet/sing-shadowsocks v0.2.8
|
github.com/sagernet/sing-shadowsocks v0.2.8
|
||||||
github.com/sagernet/sing-shadowsocks2 v0.2.1
|
github.com/sagernet/sing-shadowsocks2 v0.2.1
|
||||||
github.com/sagernet/sing-shadowtls v0.2.1-0.20250503051639-fcd445d33c11
|
github.com/sagernet/sing-shadowtls v0.2.1-0.20250503051639-fcd445d33c11
|
||||||
github.com/sagernet/sing-tun v0.6.10-0.20250703121732-a0881ada3251
|
github.com/sagernet/sing-tun v0.6.10-0.20250630100036-8763c24e4935
|
||||||
github.com/sagernet/sing-vmess v0.2.4-0.20250605032146-38cc72672c88
|
github.com/sagernet/sing-vmess v0.2.4-0.20250605032146-38cc72672c88
|
||||||
github.com/sagernet/smux v1.5.34-mod.2
|
github.com/sagernet/smux v1.5.34-mod.2
|
||||||
github.com/sagernet/tailscale v1.80.3-mod.5
|
github.com/sagernet/tailscale v1.80.3-mod.5
|
||||||
|
|||||||
12
go.sum
12
go.sum
@@ -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/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 h1:YqID+93B7VRfqIH3PArW/XpJv5H4OLEVWDfProGoRQs=
|
||||||
github.com/sagernet/fswatch v0.1.1/go.mod h1:nz85laH0mkQqJfaOrqPpkwtU1znMFNVTpT/5oRsVz/o=
|
github.com/sagernet/fswatch v0.1.1/go.mod h1:nz85laH0mkQqJfaOrqPpkwtU1znMFNVTpT/5oRsVz/o=
|
||||||
github.com/sagernet/gomobile v0.1.7 h1:I9jCJZTH0weP5MsuydvYHX5QfN/r6Fe8ptAIj1+SJVg=
|
github.com/sagernet/gomobile v0.1.6 h1:JkR1ToKOrdoiwULte4pYS5HYdPBzl2N+JNuuwVuLs0k=
|
||||||
github.com/sagernet/gomobile v0.1.7/go.mod h1:Pqq2+ZVvs10U7xK+UwJgwYWUykewi8H6vlslAO73n9E=
|
github.com/sagernet/gomobile v0.1.6/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 h1:pprQtDqNgqXkRsXn+0E8ikKOemzmum8bODjSfDene38=
|
||||||
github.com/sagernet/gvisor v0.0.0-20250325023245-7a9c0f5725fb/go.mod h1:QkkPEJLw59/tfxgapHta14UL5qMUah5NXhO0Kw2Kan4=
|
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=
|
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 h1:hWkojLg64zjV+MJOvJU/kOeWndm3tiEfBLx5foisszs=
|
||||||
github.com/sagernet/quic-go v0.52.0-beta.1/go.mod h1:OV+V5kEBb8kJS7k29MzDu6oj9GyMc7HA07sE1tedxz4=
|
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.9/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.11-0.20250521033217-30d675ea099b h1:ZjTCYPb5f7aHdf1UpUvE22dVmf7BL8eQ/zLZhjgh7Wo=
|
||||||
github.com/sagernet/sing v0.6.12-0.20250703120903-7081a0c40539/go.mod h1:ARkL0gM13/Iv5VCZmci/NuoOlePoIsW0m7BWfln/Hak=
|
github.com/sagernet/sing v0.6.11-0.20250521033217-30d675ea099b/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 h1:meZVFiiStvHThb/trcpAkCrmtJOuItG5Dzl1RRP5/NE=
|
||||||
github.com/sagernet/sing-mux v0.3.2/go.mod h1:pht8iFY4c9Xltj7rhVd208npkNaeCxzyXCgulDPLUDA=
|
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=
|
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-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 h1:tK+75l64tm9WvEFrYRE1t0YxoFdWQqw/h7Uhzj0vJ+w=
|
||||||
github.com/sagernet/sing-shadowtls v0.2.1-0.20250503051639-fcd445d33c11/go.mod h1:sWqKnGlMipCHaGsw1sTTlimyUpgzP4WP3pjhCsYt9oA=
|
github.com/sagernet/sing-shadowtls v0.2.1-0.20250503051639-fcd445d33c11/go.mod h1:sWqKnGlMipCHaGsw1sTTlimyUpgzP4WP3pjhCsYt9oA=
|
||||||
github.com/sagernet/sing-tun v0.6.10-0.20250703121732-a0881ada3251 h1:eH9naJXvyF/DZDk0V1SYkL6ypYD+A1tUFWLcT7PRezg=
|
github.com/sagernet/sing-tun v0.6.10-0.20250630100036-8763c24e4935 h1:wha4BG4mrEKaIoouVyiU5BcPfKD1n0LkiL4vqdjaVps=
|
||||||
github.com/sagernet/sing-tun v0.6.10-0.20250703121732-a0881ada3251/go.mod h1:fisFCbC4Vfb6HqQNcwPJi2CDK2bf0Xapyz3j3t4cnHE=
|
github.com/sagernet/sing-tun v0.6.10-0.20250630100036-8763c24e4935/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 h1:0pVm8sPOel+BoiCddW3pV3cKDKEaSioVTYDdTSKjyFI=
|
||||||
github.com/sagernet/sing-vmess v0.2.4-0.20250605032146-38cc72672c88/go.mod h1:IL8Rr+EGwuqijszZkNrEFTQDKhilEpkqFqOlvdpS6/w=
|
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=
|
github.com/sagernet/smux v1.5.34-mod.2 h1:gkmBjIjlJ2zQKpLigOkFur5kBKdV6bNRoFu2WkltRQ4=
|
||||||
|
|||||||
@@ -91,6 +91,7 @@ type DialerOptions struct {
|
|||||||
type _DomainResolveOptions struct {
|
type _DomainResolveOptions struct {
|
||||||
Server string `json:"server"`
|
Server string `json:"server"`
|
||||||
Strategy DomainStrategy `json:"strategy,omitempty"`
|
Strategy DomainStrategy `json:"strategy,omitempty"`
|
||||||
|
Timeout badoption.Duration `json:"timeout,omitempty"`
|
||||||
DisableCache bool `json:"disable_cache,omitempty"`
|
DisableCache bool `json:"disable_cache,omitempty"`
|
||||||
RewriteTTL *uint32 `json:"rewrite_ttl,omitempty"`
|
RewriteTTL *uint32 `json:"rewrite_ttl,omitempty"`
|
||||||
ClientSubnet *badoption.Prefixable `json:"client_subnet,omitempty"`
|
ClientSubnet *badoption.Prefixable `json:"client_subnet,omitempty"`
|
||||||
@@ -102,6 +103,7 @@ func (o DomainResolveOptions) MarshalJSON() ([]byte, error) {
|
|||||||
if o.Server == "" {
|
if o.Server == "" {
|
||||||
return []byte("{}"), nil
|
return []byte("{}"), nil
|
||||||
} else if o.Strategy == DomainStrategy(C.DomainStrategyAsIS) &&
|
} else if o.Strategy == DomainStrategy(C.DomainStrategyAsIS) &&
|
||||||
|
o.Timeout == 0 &&
|
||||||
!o.DisableCache &&
|
!o.DisableCache &&
|
||||||
o.RewriteTTL == nil &&
|
o.RewriteTTL == nil &&
|
||||||
o.ClientSubnet == nil {
|
o.ClientSubnet == nil {
|
||||||
|
|||||||
@@ -180,6 +180,7 @@ func (r *RouteOptionsActionOptions) UnmarshalJSON(data []byte) error {
|
|||||||
type DNSRouteActionOptions struct {
|
type DNSRouteActionOptions struct {
|
||||||
Server string `json:"server,omitempty"`
|
Server string `json:"server,omitempty"`
|
||||||
Strategy DomainStrategy `json:"strategy,omitempty"`
|
Strategy DomainStrategy `json:"strategy,omitempty"`
|
||||||
|
Timeout badoption.Duration `json:"timeout,omitempty"`
|
||||||
DisableCache bool `json:"disable_cache,omitempty"`
|
DisableCache bool `json:"disable_cache,omitempty"`
|
||||||
RewriteTTL *uint32 `json:"rewrite_ttl,omitempty"`
|
RewriteTTL *uint32 `json:"rewrite_ttl,omitempty"`
|
||||||
ClientSubnet *badoption.Prefixable `json:"client_subnet,omitempty"`
|
ClientSubnet *badoption.Prefixable `json:"client_subnet,omitempty"`
|
||||||
@@ -187,6 +188,7 @@ type DNSRouteActionOptions struct {
|
|||||||
|
|
||||||
type _DNSRouteOptionsActionOptions struct {
|
type _DNSRouteOptionsActionOptions struct {
|
||||||
Strategy DomainStrategy `json:"strategy,omitempty"`
|
Strategy DomainStrategy `json:"strategy,omitempty"`
|
||||||
|
Timeout badoption.Duration `json:"timeout,omitempty"`
|
||||||
DisableCache bool `json:"disable_cache,omitempty"`
|
DisableCache bool `json:"disable_cache,omitempty"`
|
||||||
RewriteTTL *uint32 `json:"rewrite_ttl,omitempty"`
|
RewriteTTL *uint32 `json:"rewrite_ttl,omitempty"`
|
||||||
ClientSubnet *badoption.Prefixable `json:"client_subnet,omitempty"`
|
ClientSubnet *badoption.Prefixable `json:"client_subnet,omitempty"`
|
||||||
|
|||||||
@@ -130,14 +130,9 @@ func NewInbound(ctx context.Context, router adapter.Router, logger log.ContextLo
|
|||||||
deprecated.Report(ctx, deprecated.OptionTUNGSO)
|
deprecated.Report(ctx, deprecated.OptionTUNGSO)
|
||||||
}
|
}
|
||||||
|
|
||||||
platformInterface := service.FromContext[platform.Interface](ctx)
|
|
||||||
tunMTU := options.MTU
|
tunMTU := options.MTU
|
||||||
if tunMTU == 0 {
|
if tunMTU == 0 {
|
||||||
if platformInterface != nil && platformInterface.UnderNetworkExtension() {
|
tunMTU = 9000
|
||||||
tunMTU = 4000
|
|
||||||
} else {
|
|
||||||
tunMTU = 9000
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
var udpTimeout time.Duration
|
var udpTimeout time.Duration
|
||||||
if options.UDPTimeout != 0 {
|
if options.UDPTimeout != 0 {
|
||||||
@@ -213,7 +208,7 @@ func NewInbound(ctx context.Context, router adapter.Router, logger log.ContextLo
|
|||||||
},
|
},
|
||||||
udpTimeout: udpTimeout,
|
udpTimeout: udpTimeout,
|
||||||
stack: options.Stack,
|
stack: options.Stack,
|
||||||
platformInterface: platformInterface,
|
platformInterface: service.FromContext[platform.Interface](ctx),
|
||||||
platformOptions: common.PtrValueOrDefault(options.Platform),
|
platformOptions: common.PtrValueOrDefault(options.Platform),
|
||||||
}
|
}
|
||||||
for _, routeAddressSet := range options.RouteAddressSet {
|
for _, routeAddressSet := range options.RouteAddressSet {
|
||||||
|
|||||||
@@ -76,6 +76,7 @@ func NewNetworkManager(ctx context.Context, logger logger.ContextLogger, routeOp
|
|||||||
DomainResolver: defaultDomainResolver.Server,
|
DomainResolver: defaultDomainResolver.Server,
|
||||||
DomainResolveOptions: adapter.DNSQueryOptions{
|
DomainResolveOptions: adapter.DNSQueryOptions{
|
||||||
Strategy: C.DomainStrategy(defaultDomainResolver.Strategy),
|
Strategy: C.DomainStrategy(defaultDomainResolver.Strategy),
|
||||||
|
Timeout: time.Duration(defaultDomainResolver.Timeout),
|
||||||
DisableCache: defaultDomainResolver.DisableCache,
|
DisableCache: defaultDomainResolver.DisableCache,
|
||||||
RewriteTTL: defaultDomainResolver.RewriteTTL,
|
RewriteTTL: defaultDomainResolver.RewriteTTL,
|
||||||
ClientSubnet: defaultDomainResolver.ClientSubnet.Build(netip.Prefix{}),
|
ClientSubnet: defaultDomainResolver.ClientSubnet.Build(netip.Prefix{}),
|
||||||
|
|||||||
@@ -666,6 +666,7 @@ func (r *Router) actionResolve(ctx context.Context, metadata *adapter.InboundCon
|
|||||||
addresses, err := r.dns.Lookup(adapter.WithContext(ctx, metadata), metadata.Destination.Fqdn, adapter.DNSQueryOptions{
|
addresses, err := r.dns.Lookup(adapter.WithContext(ctx, metadata), metadata.Destination.Fqdn, adapter.DNSQueryOptions{
|
||||||
Transport: transport,
|
Transport: transport,
|
||||||
Strategy: action.Strategy,
|
Strategy: action.Strategy,
|
||||||
|
Timeout: action.Timeout,
|
||||||
DisableCache: action.DisableCache,
|
DisableCache: action.DisableCache,
|
||||||
RewriteTTL: action.RewriteTTL,
|
RewriteTTL: action.RewriteTTL,
|
||||||
ClientSubnet: action.ClientSubnet,
|
ClientSubnet: action.ClientSubnet,
|
||||||
|
|||||||
@@ -113,6 +113,7 @@ func NewDNSRuleAction(logger logger.ContextLogger, action option.DNSRuleAction)
|
|||||||
Server: action.RouteOptions.Server,
|
Server: action.RouteOptions.Server,
|
||||||
RuleActionDNSRouteOptions: RuleActionDNSRouteOptions{
|
RuleActionDNSRouteOptions: RuleActionDNSRouteOptions{
|
||||||
Strategy: C.DomainStrategy(action.RouteOptions.Strategy),
|
Strategy: C.DomainStrategy(action.RouteOptions.Strategy),
|
||||||
|
Timeout: time.Duration(action.RouteOptions.Timeout),
|
||||||
DisableCache: action.RouteOptions.DisableCache,
|
DisableCache: action.RouteOptions.DisableCache,
|
||||||
RewriteTTL: action.RouteOptions.RewriteTTL,
|
RewriteTTL: action.RouteOptions.RewriteTTL,
|
||||||
ClientSubnet: netip.Prefix(common.PtrValueOrDefault(action.RouteOptions.ClientSubnet)),
|
ClientSubnet: netip.Prefix(common.PtrValueOrDefault(action.RouteOptions.ClientSubnet)),
|
||||||
@@ -121,6 +122,7 @@ func NewDNSRuleAction(logger logger.ContextLogger, action option.DNSRuleAction)
|
|||||||
case C.RuleActionTypeRouteOptions:
|
case C.RuleActionTypeRouteOptions:
|
||||||
return &RuleActionDNSRouteOptions{
|
return &RuleActionDNSRouteOptions{
|
||||||
Strategy: C.DomainStrategy(action.RouteOptionsOptions.Strategy),
|
Strategy: C.DomainStrategy(action.RouteOptionsOptions.Strategy),
|
||||||
|
Timeout: time.Duration(action.RouteOptionsOptions.Timeout),
|
||||||
DisableCache: action.RouteOptionsOptions.DisableCache,
|
DisableCache: action.RouteOptionsOptions.DisableCache,
|
||||||
RewriteTTL: action.RouteOptionsOptions.RewriteTTL,
|
RewriteTTL: action.RouteOptionsOptions.RewriteTTL,
|
||||||
ClientSubnet: netip.Prefix(common.PtrValueOrDefault(action.RouteOptionsOptions.ClientSubnet)),
|
ClientSubnet: netip.Prefix(common.PtrValueOrDefault(action.RouteOptionsOptions.ClientSubnet)),
|
||||||
@@ -235,20 +237,13 @@ func (r *RuleActionDNSRoute) Type() string {
|
|||||||
func (r *RuleActionDNSRoute) String() string {
|
func (r *RuleActionDNSRoute) String() string {
|
||||||
var descriptions []string
|
var descriptions []string
|
||||||
descriptions = append(descriptions, r.Server)
|
descriptions = append(descriptions, r.Server)
|
||||||
if r.DisableCache {
|
descriptions = append(descriptions, r.Descriptions()...)
|
||||||
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, ","), ")")
|
return F.ToString("route(", strings.Join(descriptions, ","), ")")
|
||||||
}
|
}
|
||||||
|
|
||||||
type RuleActionDNSRouteOptions struct {
|
type RuleActionDNSRouteOptions struct {
|
||||||
Strategy C.DomainStrategy
|
Strategy C.DomainStrategy
|
||||||
|
Timeout time.Duration
|
||||||
DisableCache bool
|
DisableCache bool
|
||||||
RewriteTTL *uint32
|
RewriteTTL *uint32
|
||||||
ClientSubnet netip.Prefix
|
ClientSubnet netip.Prefix
|
||||||
@@ -259,7 +254,17 @@ func (r *RuleActionDNSRouteOptions) Type() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (r *RuleActionDNSRouteOptions) String() string {
|
func (r *RuleActionDNSRouteOptions) String() string {
|
||||||
|
return F.ToString("route-options(", strings.Join(r.Descriptions(), ","), ")")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *RuleActionDNSRouteOptions) Descriptions() []string {
|
||||||
var 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 {
|
if r.DisableCache {
|
||||||
descriptions = append(descriptions, "disable-cache")
|
descriptions = append(descriptions, "disable-cache")
|
||||||
}
|
}
|
||||||
@@ -269,7 +274,7 @@ func (r *RuleActionDNSRouteOptions) String() string {
|
|||||||
if r.ClientSubnet.IsValid() {
|
if r.ClientSubnet.IsValid() {
|
||||||
descriptions = append(descriptions, F.ToString("client-subnet=", r.ClientSubnet))
|
descriptions = append(descriptions, F.ToString("client-subnet=", r.ClientSubnet))
|
||||||
}
|
}
|
||||||
return F.ToString("route-options(", strings.Join(descriptions, ","), ")")
|
return descriptions
|
||||||
}
|
}
|
||||||
|
|
||||||
type RuleActionDirect struct {
|
type RuleActionDirect struct {
|
||||||
@@ -421,6 +426,7 @@ func (r *RuleActionSniff) String() string {
|
|||||||
type RuleActionResolve struct {
|
type RuleActionResolve struct {
|
||||||
Server string
|
Server string
|
||||||
Strategy C.DomainStrategy
|
Strategy C.DomainStrategy
|
||||||
|
Timeout time.Duration
|
||||||
DisableCache bool
|
DisableCache bool
|
||||||
RewriteTTL *uint32
|
RewriteTTL *uint32
|
||||||
ClientSubnet netip.Prefix
|
ClientSubnet netip.Prefix
|
||||||
@@ -438,6 +444,9 @@ func (r *RuleActionResolve) String() string {
|
|||||||
if r.Strategy != C.DomainStrategyAsIS {
|
if r.Strategy != C.DomainStrategyAsIS {
|
||||||
options = append(options, F.ToString(option.DomainStrategy(r.Strategy)))
|
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 {
|
if r.DisableCache {
|
||||||
options = append(options, "disable_cache")
|
options = append(options, "disable_cache")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,9 +31,6 @@ type HTTPConn struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewHTTP1Conn(conn net.Conn, request *http.Request) *HTTPConn {
|
func NewHTTP1Conn(conn net.Conn, request *http.Request) *HTTPConn {
|
||||||
if request.Header.Get("Host") == "" {
|
|
||||||
request.Header.Set("Host", request.Host)
|
|
||||||
}
|
|
||||||
return &HTTPConn{
|
return &HTTPConn{
|
||||||
Conn: conn,
|
Conn: conn,
|
||||||
request: request,
|
request: request,
|
||||||
@@ -92,6 +89,9 @@ func (c *HTTPConn) writeRequest(payload []byte) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
if c.request.Header.Get("Host") == "" {
|
||||||
|
c.request.Header.Set("Host", c.request.Host)
|
||||||
|
}
|
||||||
for key, value := range c.request.Header {
|
for key, value := range c.request.Header {
|
||||||
_, err = writer.Write([]byte(F.ToString(key, ": ", strings.Join(value, ", "), CRLF)))
|
_, err = writer.Write([]byte(F.ToString(key, ": ", strings.Join(value, ", "), CRLF)))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user