Use all available nameservers in lookupIP

Some systems may be configured with public DNS only, so relying solely
on LAN servers could make the lookup process failed unexpectedly.
This commit is contained in:
Cuong Manh Le authored and Cuong Manh Le committed 2025-02-02 11:48:25 +07:00
1 parent 028475a193
commit 1560455ca3
2 files changed
+5

No files matched your search

+4
View File
@@ -2,12 +2,16 @@ package ctrld
import (
"net/url"
"os"
"testing"
"github.com/rs/zerolog"
"github.com/stretchr/testify/assert"
)
func TestUpstreamConfig_SetupBootstrapIP(t *testing.T) {
l := zerolog.New(os.Stdout)
ProxyLogger.Store(&l)
uc := &UpstreamConfig{
Name: "test",
Type: ResolverTypeDOH,
+1
View File
@@ -367,6 +367,7 @@ func lookupIP(domain string, timeout int, withBootstrapDNS bool) (ips []string)
or = newResolverWithNameserver(defaultNameservers())
}
nss := *or.lanServers.Load()
nss = append(nss, *or.publicServers.Load()...)
if withBootstrapDNS {
nss = append([]string{net.JoinHostPort(controldBootstrapDns, "53")}, nss...)
}