mirror of
https://github.com/Control-D-Inc/ctrld.git
synced 2026-07-04 01:07:49 +02:00
all: fix OS resolver looping issue on Windows
By making dnsFromAdapter ignores DNS server which is the same IP address of the adapter. While at it, also changes OS resolver to use ctrld bootstrap DNS only if there's no available nameservers.
This commit is contained in:
committed by
Cuong Manh Le
parent
96085147ff
commit
19020a96bf
+5
-2
@@ -39,10 +39,13 @@ var OsNameservers = defaultNameservers()
|
||||
// or is the Resolver used for ResolverTypeOS.
|
||||
var or = &osResolver{nameservers: OsNameservers}
|
||||
|
||||
// defaultNameservers returns OS nameservers plus ctrld bootstrap nameserver.
|
||||
// defaultNameservers returns nameservers used by the OS.
|
||||
// If no nameservers can be found, ctrld bootstrap nameserver will be used.
|
||||
func defaultNameservers() []string {
|
||||
ns := nameservers()
|
||||
ns = append(ns, net.JoinHostPort(bootstrapDNS, "53"))
|
||||
if len(ns) == 0 {
|
||||
ns = append(ns, net.JoinHostPort(bootstrapDNS, "53"))
|
||||
}
|
||||
return ns
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user