mirror of
https://github.com/Control-D-Inc/ctrld.git
synced 2026-02-03 22:18:39 +00:00
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:
committed by
Cuong Manh Le
parent
028475a193
commit
1560455ca3
@@ -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,
|
||||
|
||||
@@ -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...)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user