net/dns: handle all possible translations of high-level DNS config.

With this change, all OSes can sort-of do split DNS, except that the
default upstream is hardcoded to 8.8.8.8 pending further plumbing.
Additionally, Windows 8-10 can do split DNS fully correctly, without
the 8.8.8.8 hack.

Part of #953.

Signed-off-by: David Anderson <danderson@tailscale.com>
This commit is contained in:
David Anderson
2021-04-06 22:00:59 -07:00
committed by Dave Anderson
parent 939861773d
commit da4cc8bbb4
3 changed files with 213 additions and 31 deletions

View File

@@ -1618,10 +1618,9 @@ func (b *LocalBackend) initPeerAPIListener() {
}
// magicDNSRootDomains returns the subset of nm.DNS.Domains that are the search domains for MagicDNS.
// Each entry has a trailing period.
func magicDNSRootDomains(nm *netmap.NetworkMap) []string {
if v := nm.MagicDNSSuffix(); v != "" {
return []string{strings.Trim(v, ".") + "."}
return []string{strings.Trim(v, ".")}
}
return nil
}