mirror of
https://github.com/tailscale/tailscale.git
synced 2024-11-25 19:15:34 +00:00
net/dns/resolvd: store nameservers
Currently only search domains are stored. This was an oversight (under?) on my part. As things are now, when MagicDNS is on and "Override local DNS" is off, the dns forwarder has to timeout before names resolve. This introduces a pretty annoying lang that makes everything feel extremely slow. You will also see an error: "upstream nameservers not set". I tested with "Override local DNS" on and off. In both situations things seem to function as expected (and quickly). Signed-off-by: Aaron Bieber <aaron@bolddaemon.com>
This commit is contained in:
parent
c64af5e676
commit
411c6c316c
@ -16,6 +16,7 @@
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
"inet.af/netaddr"
|
||||
"tailscale.com/types/logger"
|
||||
"tailscale.com/util/dnsname"
|
||||
)
|
||||
@ -130,6 +131,25 @@ func (m resolvdManager) readResolvConf() (config OSConfig, err error) {
|
||||
config.SearchDomains = append(config.SearchDomains, fqdn)
|
||||
continue
|
||||
}
|
||||
|
||||
if strings.HasPrefix(line, "nameserver") {
|
||||
s := strings.TrimPrefix(line, "nameserver")
|
||||
parts := strings.Split(s, " # ")
|
||||
if len(parts) == 0 {
|
||||
return OSConfig{}, err
|
||||
}
|
||||
nameserver := strings.TrimSpace(parts[0])
|
||||
ip, err := netaddr.ParseIP(nameserver)
|
||||
if err != nil {
|
||||
return OSConfig{}, err
|
||||
}
|
||||
config.Nameservers = append(config.Nameservers, ip)
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
if err = scanner.Err(); err != nil {
|
||||
return OSConfig{}, err
|
||||
}
|
||||
|
||||
return config, nil
|
||||
|
Loading…
Reference in New Issue
Block a user