mirror of
https://github.com/Control-D-Inc/ctrld.git
synced 2026-05-27 12:52:27 +02:00
Prefer LAN server answer over public one
While at it, also implementing new OS resolver chosing logic, keeping only 2 LAN servers at any time, 1 for current one, and 1 for last used one.
This commit is contained in:
committed by
Cuong Manh Le
parent
f87220a908
commit
0cdff0d368
+2
-3
@@ -1,9 +1,8 @@
|
||||
package ctrld
|
||||
|
||||
import "net"
|
||||
|
||||
type dnsFn func() []string
|
||||
|
||||
// nameservers returns DNS nameservers from system settings.
|
||||
func nameservers() []string {
|
||||
var dns []string
|
||||
seen := make(map[string]bool)
|
||||
@@ -21,7 +20,7 @@ func nameservers() []string {
|
||||
continue
|
||||
}
|
||||
seen[ns] = true
|
||||
dns = append(dns, net.JoinHostPort(ns, "53"))
|
||||
dns = append(dns, ns)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user