Compare commits

..

87 Commits

Author SHA1 Message Date
renovate[bot]
68386928b7
[dependencies] Update golangci/golangci-lint-action action to v7 2025-04-26 09:27:45 +00:00
世界
7c62db5dbd
Fix wireguard listen_port 2025-04-26 17:26:56 +08:00
世界
631abda983
documentation: Bump version 2025-04-25 16:28:21 +08:00
世界
c6553b9579
clash-api: Add more meta api 2025-04-25 16:28:21 +08:00
世界
80013ab822
Fix DNS lookup 2025-04-25 16:28:21 +08:00
世界
f4eb5d1d37
Fix tailscale sending unexpected stuff 2025-04-25 16:04:47 +08:00
世界
bac004a7db
Fix fetch ECH configs 2025-04-25 16:04:47 +08:00
reletor
1f6d91afac
documentation: Minor fixes 2025-04-25 16:04:46 +08:00
caelansar
5c90562ab4
Fix callback deletion in UDP transport 2025-04-25 16:04:46 +08:00
世界
5e7bee2344
documentation: Try to make the play review happy 2025-04-25 16:04:46 +08:00
世界
88ad93ec68
Fix missing handling of legacy domain_strategy options 2025-04-25 16:04:46 +08:00
世界
c5d056dccc
Improve local DNS server 2025-04-25 16:04:45 +08:00
anytls
a5f0975f16
Update anytls
Co-authored-by: anytls <anytls>
2025-04-25 16:04:45 +08:00
世界
12f708fc1b
Fix DNS dialer 2025-04-25 16:04:45 +08:00
世界
ed2d228766
release: Skip override version for iOS 2025-04-25 16:04:45 +08:00
iikira
2666d2422d
Fix UDP DNS server crash
Signed-off-by: iikira <i2@mail.iikira.com>
2025-04-25 16:04:45 +08:00
ReleTor
2d3cbcf3a6
Fix fetch ECH configs 2025-04-25 16:04:45 +08:00
世界
dc3a7dfff6
release: Update Go to 1.24.2 2025-04-25 16:04:44 +08:00
世界
ceff797cde
Allow direct outbounds without domain_resolver 2025-04-25 16:04:44 +08:00
世界
4bdda8e37c
Fix Tailscale dialer 2025-04-25 16:04:44 +08:00
dyhkwong
02b4b87a2b
Fix DNS over QUIC stream close 2025-04-25 16:04:44 +08:00
anytls
b3620d76a7
Update anytls
Co-authored-by: anytls <anytls>
2025-04-25 16:04:43 +08:00
Rambling2076
e8a2c95f1c
Fix missing with_tailscale in Dockerfile
Signed-off-by: Rambling2076 <Rambling2076@proton.me>
2025-04-25 16:04:43 +08:00
世界
b562536258
Fail when default DNS server not found 2025-04-25 16:04:43 +08:00
世界
768aa8fb4d
Update gVisor to 20250319.0 2025-04-25 16:04:42 +08:00
世界
f44ed1c5f6
release: Do not build tailscale on iOS and tvOS 2025-04-25 16:04:42 +08:00
世界
b661886be9
Explicitly reject detour to empty direct outbounds 2025-04-25 16:04:42 +08:00
世界
6f3ba8f895
Add netns support 2025-04-25 16:04:41 +08:00
世界
67736a27be
Add wildcard name support for predefined records 2025-04-25 16:04:41 +08:00
世界
7e3ee707f8
Remove map usage in options 2025-04-25 16:04:41 +08:00
世界
628e76098c
Fix unhandled DNS loop 2025-04-25 16:04:41 +08:00
世界
efb29260f3
Add wildcard-sni support for shadow-tls inbound 2025-04-25 16:04:40 +08:00
世界
93bba2c835
Fix Tailscale DNS 2025-04-25 16:04:40 +08:00
k9982874
080e94c136
Add ntp protocol sniffing 2025-04-25 16:04:39 +08:00
世界
a042a31fed
option: Fix marshal legacy DNS options 2025-04-25 16:04:39 +08:00
世界
2ff596d1a2
Make domain_resolver optional when only one DNS server is configured 2025-04-25 16:04:39 +08:00
世界
8a3f44f911
Fix DNS lookup context pollution 2025-04-25 16:04:39 +08:00
世界
69def3ca9c
Fix http3 DNS server connecting to wrong address 2025-04-25 16:04:38 +08:00
Restia-Ashbell
908055c425
documentation: Fix typo 2025-04-25 16:04:38 +08:00
anytls
510bc15f56
Update sing-anytls
Co-authored-by: anytls <anytls>
2025-04-25 16:04:38 +08:00
k9982874
8a8376b723
Fix hosts DNS server 2025-04-25 16:04:38 +08:00
世界
890e48f892
Fix UDP DNS server crash 2025-04-25 16:04:38 +08:00
世界
1ab3541973
documentation: Fix missing ip_accept_any DNS rule option 2025-04-25 16:04:37 +08:00
世界
1e6f22d4a7
Fix anytls dialer usage 2025-04-25 16:04:37 +08:00
世界
035f8bae99
Move predefined DNS server to rule action 2025-04-25 16:04:36 +08:00
世界
cddb987365
Fix domain resolver on direct outbound 2025-04-25 16:04:36 +08:00
Zephyruso
d4697de3a0
Fix missing AnyTLS display name 2025-04-25 16:04:36 +08:00
anytls
9650bfd628
Update sing-anytls
Co-authored-by: anytls <anytls>
2025-04-25 16:04:36 +08:00
Estel
78899b6a96
documentation: Fix typo
Signed-off-by: Estel <callmebedrockdigger@gmail.com>
2025-04-25 16:04:35 +08:00
TargetLocked
2822d1c4a2
Fix parsing legacy DNS options 2025-04-25 16:04:35 +08:00
世界
e6a974f879
Fix DNS fallback 2025-04-25 16:04:35 +08:00
世界
2736dc1531
documentation: Fix missing hosts DNS server 2025-04-25 16:04:35 +08:00
anytls
5fde4b5be9
Add MinIdleSession option to AnyTLS outbound
Co-authored-by: anytls <anytls>
2025-04-25 16:04:35 +08:00
ReleTor
3051698f69
documentation: Minor fixes 2025-04-25 16:04:34 +08:00
libtry486
bd87fd7cdd
documentation: Fix typo
fix typo

Signed-off-by: libtry486 <89328481+libtry486@users.noreply.github.com>
2025-04-25 16:04:34 +08:00
Alireza Ahmadi
aa56698987
Fix Outbound deadlock 2025-04-25 16:04:34 +08:00
世界
4fef6a9845
documentation: Fix AnyTLS doc 2025-04-25 16:04:33 +08:00
anytls
f3ebc3f532
Add AnyTLS protocol 2025-04-25 16:04:33 +08:00
世界
ee3069b83e
Migrate to stdlib ECH support 2025-04-25 16:04:33 +08:00
世界
ba176cbf73
Add fallback local DNS server for iOS 2025-04-25 16:04:32 +08:00
世界
c91b6cdf58
Get darwin local DNS server from libresolv 2025-04-25 16:04:32 +08:00
世界
49e4d3d5f5
Improve resolve action 2025-04-25 16:04:32 +08:00
世界
7d012c2c40
Fix toolchain version 2025-04-25 16:04:32 +08:00
世界
4fed223ad9
Add back port hopping to hysteria 1 2025-04-25 16:04:32 +08:00
世界
1e6fb9ac23
Update dependencies 2025-04-25 16:04:31 +08:00
xchacha20-poly1305
c077840ba8
Remove single quotes of raw Moziila certs 2025-04-25 16:04:31 +08:00
世界
7e1125d3a6
Add Tailscale endpoint 2025-04-25 16:04:30 +08:00
世界
1e02ad27e2
Build legacy binaries with latest Go 2025-04-25 16:04:30 +08:00
世界
eeeaf942e8
documentation: Remove outdated icons 2025-04-25 16:04:30 +08:00
世界
fad6402a33
documentation: Certificate store 2025-04-25 16:04:30 +08:00
世界
9007333163
documentation: TLS fragment 2025-04-25 16:04:30 +08:00
世界
f1343b8e2d
documentation: Outbound domain resolver 2025-04-25 16:04:29 +08:00
世界
23786f4fc6
documentation: Refactor DNS 2025-04-25 16:04:29 +08:00
世界
56771b5341
Add certificate store 2025-04-25 16:04:29 +08:00
世界
753048fec6
Add TLS fragment support 2025-04-25 16:04:29 +08:00
世界
389b7b1015
refactor: Outbound domain resolver 2025-04-25 16:04:28 +08:00
世界
f7edf03836
refactor: DNS 2025-04-25 16:04:28 +08:00
世界
d8b2d5142f
Fix panic on some stupid input 2025-04-25 16:03:58 +08:00
世界
134802d1ee
Fix ssh outbound 2025-04-25 16:03:57 +08:00
世界
e5e81b4de1
Fix wireguard listening 2025-04-25 16:03:57 +08:00
世界
300c961efa
option: Fix listable again and again 2025-04-25 16:03:57 +08:00
世界
7c7f512405
option: Fix omitempty reject method 2025-04-25 16:03:57 +08:00
世界
03e8d029c2
release: Fix apt-get install 2025-04-25 16:03:57 +08:00
世界
787b5f1931
Fix set wireguard reserved on Linux 2025-04-25 16:03:57 +08:00
世界
56a7624618
Fix vmess working with zero uuids 2025-04-25 16:03:57 +08:00
世界
3a84acf122
Fix hysteria1 server panic 2025-04-25 16:03:57 +08:00
世界
f600e02e47
Fix DNS crash 2025-04-25 16:03:57 +08:00
11 changed files with 57 additions and 24 deletions

View File

@ -341,6 +341,16 @@ func (d *DefaultDialer) ListenSerialInterfacePacket(ctx context.Context, destina
}
func (d *DefaultDialer) ListenPacketCompat(network, address string) (net.PacketConn, error) {
udpListener := d.udpListener
udpListener.Control = control.Append(udpListener.Control, func(network, address string, conn syscall.RawConn) error {
for _, wgControlFn := range WgControlFns {
err := wgControlFn(network, address, conn)
if err != nil {
return err
}
}
return nil
})
return d.udpListener.ListenPacket(context.Background(), network, address)
}

View File

@ -268,13 +268,10 @@ func (c *Client) Lookup(ctx context.Context, transport adapter.DNSTransport, dom
return nil
})
err := group.Run(ctx)
if len(response4) > 0 || len(response6) > 0 {
return sortAddresses(response4, response6, options.Strategy), nil
} else if err != nil {
if len(response4) == 0 && len(response6) == 0 {
return nil, err
} else {
return nil, RcodeError(dns.RcodeNameError)
}
return sortAddresses(response4, response6, options.Strategy), nil
}
func (c *Client) ClearCache() {

View File

@ -323,6 +323,9 @@ func (r *Router) Lookup(ctx context.Context, domain string, options adapter.DNSQ
err error
)
printResult := func() {
if err == nil && len(responseAddrs) == 0 {
err = E.New("empty result")
}
if err != nil {
if errors.Is(err, ErrResponseRejectedCached) {
r.logger.DebugContext(ctx, "response rejected for ", domain, " (cached)")
@ -331,14 +334,15 @@ func (r *Router) Lookup(ctx context.Context, domain string, options adapter.DNSQ
} else {
r.logger.ErrorContext(ctx, E.Cause(err, "lookup failed for ", domain))
}
} else if len(responseAddrs) == 0 {
panic("unexpected empty result")
}
if err != nil {
err = E.Cause(err, "lookup ", domain)
}
}
responseAddrs, cached = r.client.LookupCache(domain, options.Strategy)
if cached {
if len(responseAddrs) == 0 {
return nil, RcodeNameError
return nil, E.New("lookup ", domain, ": empty result (cached)")
}
return responseAddrs, nil
}

View File

@ -3,6 +3,7 @@ package local
import (
"context"
"math/rand"
"net/netip"
"time"
"github.com/sagernet/sing-box/adapter"
@ -90,8 +91,9 @@ func (t *Transport) exchangeParallel(ctx context.Context, systemConfig *dnsConfi
startRacer := func(ctx context.Context, fqdn string) {
response, err := t.tryOneName(ctx, systemConfig, fqdn, message)
if err == nil {
addresses, _ := dns.MessageToAddresses(response)
if len(addresses) == 0 {
var addresses []netip.Addr
addresses, err = dns.MessageToAddresses(response)
if err == nil && len(addresses) == 0 {
err = E.New(fqdn, ": empty result")
}
}

View File

@ -9,7 +9,6 @@ import (
"os"
"runtime"
"strings"
"sync"
"syscall"
"time"
@ -50,7 +49,6 @@ type Server struct {
httpServer *http.Server
trafficManager *trafficontrol.Manager
urlTestHistory adapter.URLTestHistoryStorage
uiUpdateAccess sync.Mutex
logDebug bool
mode string

View File

@ -37,8 +37,6 @@ func (s *Server) checkAndDownloadExternalUI() {
}
func (s *Server) downloadExternalUI() error {
s.uiUpdateAccess.Lock()
defer s.uiUpdateAccess.Unlock()
var downloadURL string
if s.externalUIDownloadURL != "" {
downloadURL = s.externalUIDownloadURL

View File

@ -83,7 +83,6 @@ type DialerOptions struct {
NetworkType badoption.Listable[InterfaceType] `json:"network_type,omitempty"`
FallbackNetworkType badoption.Listable[InterfaceType] `json:"fallback_network_type,omitempty"`
FallbackDelay badoption.Duration `json:"fallback_delay,omitempty"`
IsWireGuardListener bool `json:"-"`
// Deprecated: migrated to domain resolver
DomainStrategy DomainStrategy `json:"domain_strategy,omitempty"`

View File

@ -45,8 +45,8 @@ func NewEndpoint(ctx context.Context, router adapter.Router, logger log.ContextL
logger: logger,
localAddresses: options.Address,
}
if options.Detour == "" {
options.IsWireGuardListener = true
if options.Detour != "" && options.ListenPort != 0 {
return nil, E.New("`listen_port` is conflict with `detour`")
}
outboundDialer, err := dialer.NewWithOptions(dialer.Options{
Context: ctx,

View File

@ -46,9 +46,7 @@ func NewOutbound(ctx context.Context, router adapter.Router, logger log.ContextL
logger: logger,
localAddresses: options.LocalAddress,
}
if options.Detour == "" {
options.IsWireGuardListener = true
} else if options.GSO {
if options.Detour != "" && options.GSO {
return nil, E.New("gso is conflict with detour")
}
outboundDialer, err := dialer.NewWithOptions(dialer.Options{

View File

@ -7,6 +7,7 @@ import (
"net"
"net/netip"
"os"
"strings"
"sync"
"sync/atomic"
"time"
@ -66,7 +67,17 @@ func (m *ConnectionManager) NewConnection(ctx context.Context, this N.Dialer, co
remoteConn, err = this.DialContext(ctx, N.NetworkTCP, metadata.Destination)
}
if err != nil {
err = E.Cause(err, "open outbound connection")
var remoteString string
if len(metadata.DestinationAddresses) > 0 {
remoteString = "[" + strings.Join(common.Map(metadata.DestinationAddresses, netip.Addr.String), ",") + "]"
} else {
remoteString = metadata.Destination.String()
}
var dialerString string
if outbound, isOutbound := this.(adapter.Outbound); isOutbound {
dialerString = " using outbound/" + outbound.Type() + "[" + outbound.Tag() + "]"
}
err = E.Cause(err, "open connection to ", remoteString, dialerString)
N.CloseOnHandshakeFailure(conn, onClose, err)
m.logger.ErrorContext(ctx, err)
return
@ -133,8 +144,19 @@ func (m *ConnectionManager) NewPacketConnection(ctx context.Context, this N.Dial
remoteConn, err = this.DialContext(ctx, N.NetworkUDP, metadata.Destination)
}
if err != nil {
var remoteString string
if len(metadata.DestinationAddresses) > 0 {
remoteString = "[" + strings.Join(common.Map(metadata.DestinationAddresses, netip.Addr.String), ",") + "]"
} else {
remoteString = metadata.Destination.String()
}
var dialerString string
if outbound, isOutbound := this.(adapter.Outbound); isOutbound {
dialerString = " using outbound/" + outbound.Type() + "[" + outbound.Tag() + "]"
}
err = E.Cause(err, "open packet connection to ", remoteString, dialerString)
N.CloseOnHandshakeFailure(conn, onClose, err)
m.logger.ErrorContext(ctx, "open outbound packet connection: ", err)
m.logger.ErrorContext(ctx, err)
return
}
remotePacketConn = bufio.NewUnbindPacketConn(remoteConn)
@ -149,8 +171,13 @@ func (m *ConnectionManager) NewPacketConnection(ctx context.Context, this N.Dial
remotePacketConn, err = this.ListenPacket(ctx, metadata.Destination)
}
if err != nil {
var dialerString string
if outbound, isOutbound := this.(adapter.Outbound); isOutbound {
dialerString = " using outbound/" + outbound.Type() + "[" + outbound.Tag() + "]"
}
err = E.Cause(err, "listen packet connection using ", dialerString)
N.CloseOnHandshakeFailure(conn, onClose, err)
m.logger.ErrorContext(ctx, "listen outbound packet connection: ", err)
m.logger.ErrorContext(ctx, err)
return
}
}

View File

@ -141,7 +141,7 @@ func (e *Endpoint) Start(resolve bool) error {
return nil
}
var bind conn.Bind
wgListener, isWgListener := e.options.Dialer.(conn.Listener)
wgListener, isWgListener := common.Cast[conn.Listener](e.options.Dialer)
if isWgListener {
bind = conn.NewStdNetBind(wgListener)
} else {