net/dns{,/resolver}: quiet DNS output logging
It was a huge chunk of the overall log output and made debugging difficult. Omit and summarize the spammy *.arpa parts instead. Fixes tailscale/corp#2066 (to which nobody had opinions, so)
This commit is contained in:
@ -5,9 +5,12 @@
|
||||
package dns
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"fmt"
|
||||
"sort"
|
||||
|
||||
"inet.af/netaddr"
|
||||
"tailscale.com/net/dns/resolver"
|
||||
"tailscale.com/util/dnsname"
|
||||
)
|
||||
|
||||
@ -38,6 +41,20 @@ type Config struct {
|
||||
Hosts map[dnsname.FQDN][]netaddr.IP
|
||||
}
|
||||
|
||||
// WriteToBufioWriter write a debug version of c for logs to w, omitting
|
||||
// spammy stuff like *.arpa entries and replacing it with a total count.
|
||||
func (c *Config) WriteToBufioWriter(w *bufio.Writer) {
|
||||
w.WriteString("{DefaultResolvers:")
|
||||
resolver.WriteIPPorts(w, c.DefaultResolvers)
|
||||
|
||||
w.WriteString(" Routes:")
|
||||
resolver.WriteRoutes(w, c.Routes)
|
||||
|
||||
fmt.Fprintf(w, " SearchDomains:%v", c.SearchDomains)
|
||||
fmt.Fprintf(w, " Hosts:%v", len(c.Hosts))
|
||||
w.WriteString("}")
|
||||
}
|
||||
|
||||
// needsAnyResolvers reports whether c requires a resolver to be set
|
||||
// at the OS level.
|
||||
func (c Config) needsOSResolver() bool {
|
||||
|
Reference in New Issue
Block a user