Disable fallback DNS resolver

This commit is contained in:
世界
2025-04-22 18:10:57 +08:00
parent 91aa96b79c
commit 0418117a4b
3 changed files with 12 additions and 15 deletions

View File

@@ -36,7 +36,6 @@ import (
"github.com/sagernet/tailscale/ipn/ipnstate"
"github.com/sagernet/tailscale/logtail"
"github.com/sagernet/tailscale/net/dnscache"
"github.com/sagernet/tailscale/net/dnsfallback"
"github.com/sagernet/tailscale/net/netmon"
"github.com/sagernet/tailscale/net/netutil"
"github.com/sagernet/tailscale/net/netx"
@@ -271,11 +270,11 @@ func NewDirect(opts Options) (*Direct, error) {
}
dnsCache := &dnscache.Resolver{
Forward: dnscache.Get().Forward, // use default cache's forwarder
UseLastGood: true,
LookupIPFallback: dnsfallback.MakeLookupFunc(opts.Logf, netMon),
Logf: opts.Logf,
LookupHook: opts.LookupHook,
Forward: dnscache.Get().Forward, // use default cache's forwarder
UseLastGood: true,
// LookupIPFallback: dnsfallback.MakeLookupFunc(opts.Logf, netMon),
Logf: opts.Logf,
LookupHook: opts.LookupHook,
}
httpc := opts.HTTPTestClient

View File

@@ -43,7 +43,6 @@ import (
"github.com/sagernet/tailscale/feature/buildfeatures"
"github.com/sagernet/tailscale/health"
"github.com/sagernet/tailscale/net/dnscache"
"github.com/sagernet/tailscale/net/dnsfallback"
"github.com/sagernet/tailscale/net/netutil"
"github.com/sagernet/tailscale/net/netx"
"github.com/sagernet/tailscale/net/sockstats"
@@ -369,10 +368,10 @@ func (a *Dialer) resolver() *dnscache.Resolver {
}
return &dnscache.Resolver{
Forward: dnscache.Get().Forward,
LookupIPFallback: dnsfallback.MakeLookupFunc(a.logf, a.NetMon),
UseLastGood: true,
Logf: a.Logf, // not a.logf method; we want to propagate nil-ness
Forward: dnscache.Get().Forward,
// LookupIPFallback: dnsfallback.MakeLookupFunc(a.logf, a.NetMon),
UseLastGood: true,
Logf: a.Logf, // not a.logf method; we want to propagate nil-ness
}
}

View File

@@ -38,7 +38,6 @@ import (
"github.com/sagernet/tailscale/logtail"
"github.com/sagernet/tailscale/logtail/filch"
"github.com/sagernet/tailscale/net/dnscache"
"github.com/sagernet/tailscale/net/dnsfallback"
"github.com/sagernet/tailscale/net/netknob"
"github.com/sagernet/tailscale/net/netmon"
"github.com/sagernet/tailscale/net/netns"
@@ -828,9 +827,9 @@ func dialContext(ctx context.Context, netw, addr string, netMon *netmon.Monitor,
// If we failed to dial, try again with bootstrap DNS.
logf("logtail: dial %q failed: %v (in %v), trying bootstrap...", addr, err, d)
dnsCache := &dnscache.Resolver{
Forward: dnscache.Get().Forward, // use default cache's forwarder
UseLastGood: true,
LookupIPFallback: dnsfallback.MakeLookupFunc(logf, netMon),
Forward: dnscache.Get().Forward, // use default cache's forwarder
UseLastGood: true,
// LookupIPFallback: dnsfallback.MakeLookupFunc(logf, netMon),
}
dialer := dnscache.Dialer(nd.DialContext, dnsCache)
c, err = dialer(ctx, netw, addr)