Do not send legacy DNS queries to bootstrap DNS

This commit is contained in:
Cuong Manh Le
2025-03-13 21:04:00 +07:00
committed by Cuong Manh Le
parent 8bf654aece
commit 2de1b9929a
4 changed files with 8 additions and 24 deletions
+4 -10
View File
@@ -41,10 +41,7 @@ const (
ResolverTypeSDNS = "sdns"
)
const (
controldBootstrapDns = "76.76.2.22"
controldPublicDns = "76.76.2.0"
)
const controldPublicDns = "76.76.2.0"
var controldPublicDnsWithPort = net.JoinHostPort(controldPublicDns, "53")
@@ -440,7 +437,7 @@ type legacyResolver struct {
func (r *legacyResolver) Resolve(ctx context.Context, msg *dns.Msg) (*dns.Msg, error) {
// See comment in (*dotResolver).resolve method.
dialer := newDialer(net.JoinHostPort(controldBootstrapDns, "53"))
dialer := newDialer(net.JoinHostPort(controldPublicDns, "53"))
dnsTyp := uint16(0)
if msg != nil && len(msg.Question) > 0 {
dnsTyp = msg.Question[0].Qtype
@@ -472,10 +469,10 @@ func (d dummyResolver) Resolve(ctx context.Context, msg *dns.Msg) (*dns.Msg, err
// LookupIP looks up host using OS resolver.
// It returns a slice of that host's IPv4 and IPv6 addresses.
func LookupIP(domain string) []string {
return lookupIP(domain, -1, true)
return lookupIP(domain, -1)
}
func lookupIP(domain string, timeout int, withBootstrapDNS bool) (ips []string) {
func lookupIP(domain string, timeout int) (ips []string) {
resolverMutex.Lock()
if or == nil {
ProxyLogger.Load().Debug().Msgf("Initialize OS resolver in lookupIP")
@@ -485,9 +482,6 @@ func lookupIP(domain string, timeout int, withBootstrapDNS bool) (ips []string)
nss := *or.lanServers.Load()
nss = append(nss, *or.publicServers.Load()...)
if withBootstrapDNS {
nss = append([]string{net.JoinHostPort(controldBootstrapDns, "53")}, nss...)
}
resolver := newResolverWithNameserver(nss)
ProxyLogger.Load().Debug().Msgf("resolving %q using bootstrap DNS %q", domain, nss)
timeoutMs := 2000