mirror of
https://github.com/tailscale/tailscale.git
synced 2025-12-03 02:21:58 +00:00
wgengine/magicsock, controlclient, net/dns: reduce some logspam
Updates #cleanup Change-Id: I78b0697a01e94baa33f3de474b591e616fa5e6af Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
committed by
Brad Fitzpatrick
parent
08302c0731
commit
3b32d6c679
@@ -8,6 +8,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/netip"
|
||||
"strings"
|
||||
|
||||
"tailscale.com/types/logger"
|
||||
"tailscale.com/util/dnsname"
|
||||
@@ -65,6 +66,42 @@ type OSConfig struct {
|
||||
MatchDomains []dnsname.FQDN
|
||||
}
|
||||
|
||||
func (o *OSConfig) WriteToBufioWriter(w *bufio.Writer) {
|
||||
if o == nil {
|
||||
w.WriteString("<nil>")
|
||||
return
|
||||
}
|
||||
w.WriteString("{")
|
||||
if len(o.Hosts) > 0 {
|
||||
fmt.Fprintf(w, "Hosts:%v ", o.Hosts)
|
||||
}
|
||||
if len(o.Nameservers) > 0 {
|
||||
fmt.Fprintf(w, "Nameservers:%v ", o.Nameservers)
|
||||
}
|
||||
if len(o.SearchDomains) > 0 {
|
||||
fmt.Fprintf(w, "SearchDomains:%v ", o.SearchDomains)
|
||||
}
|
||||
if len(o.MatchDomains) > 0 {
|
||||
w.WriteString("SearchDomains:[")
|
||||
sp := ""
|
||||
var numARPA int
|
||||
for _, s := range o.MatchDomains {
|
||||
if strings.HasSuffix(string(s), ".arpa.") {
|
||||
numARPA++
|
||||
continue
|
||||
}
|
||||
w.WriteString(sp)
|
||||
w.WriteString(string(s))
|
||||
sp = " "
|
||||
}
|
||||
w.WriteString("]")
|
||||
if numARPA > 0 {
|
||||
fmt.Fprintf(w, "+%darpa", numARPA)
|
||||
}
|
||||
}
|
||||
w.WriteString("}")
|
||||
}
|
||||
|
||||
func (o OSConfig) IsZero() bool {
|
||||
return len(o.Nameservers) == 0 && len(o.SearchDomains) == 0 && len(o.MatchDomains) == 0
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user