mirror of
https://github.com/tailscale/tailscale.git
synced 2024-11-25 19:15:34 +00:00
net/dns: fix staticcheck errors.
Signed-off-by: David Anderson <danderson@tailscale.com>
This commit is contained in:
parent
79109f4965
commit
cca230cc23
@ -9,7 +9,7 @@
|
||||
func NewOSConfigurator(logf logger.Logf, interfaceName string) OSConfigurator {
|
||||
switch {
|
||||
case isResolvedActive():
|
||||
return newResolvedManager()
|
||||
return newResolvedManager(logf)
|
||||
case isNMActive():
|
||||
return newNMManager(interfaceName)
|
||||
case isResolvconfActive():
|
||||
|
@ -5,7 +5,6 @@
|
||||
// +build linux
|
||||
|
||||
//lint:file-ignore U1000 refactoring, temporarily unused code.
|
||||
//lint:file-ignore SA9003 WIP code
|
||||
|
||||
package dns
|
||||
|
||||
@ -18,6 +17,7 @@
|
||||
"golang.org/x/sys/unix"
|
||||
"inet.af/netaddr"
|
||||
"tailscale.com/net/interfaces"
|
||||
"tailscale.com/types/logger"
|
||||
"tailscale.com/util/dnsname"
|
||||
)
|
||||
|
||||
@ -83,10 +83,14 @@ func isResolvedActive() bool {
|
||||
}
|
||||
|
||||
// resolvedManager uses the systemd-resolved DBus API.
|
||||
type resolvedManager struct{}
|
||||
type resolvedManager struct {
|
||||
logf logger.Logf
|
||||
}
|
||||
|
||||
func newResolvedManager() resolvedManager {
|
||||
return resolvedManager{}
|
||||
func newResolvedManager(logf logger.Logf) resolvedManager {
|
||||
return resolvedManager{
|
||||
logf: logf,
|
||||
}
|
||||
}
|
||||
|
||||
// Up implements managerImpl.
|
||||
@ -187,28 +191,26 @@ func (m resolvedManager) SetDNS(config OSConfig) error {
|
||||
|
||||
// Disable LLMNR, we don't do multicast.
|
||||
if call := resolved.CallWithContext(ctx, "org.freedesktop.resolve1.Manager.SetLinkLLMNR", 0, iface.Index, "no"); call.Err != nil {
|
||||
// TODO: log
|
||||
m.logf("[v1] failed to disable LLMNR: %v", call.Err)
|
||||
}
|
||||
|
||||
// Disable mdns.
|
||||
if call := resolved.CallWithContext(ctx, "org.freedesktop.resolve1.Manager.SetLinkMulticastDNS", 0, iface.Index, "no"); call.Err != nil {
|
||||
// TODO: log
|
||||
m.logf("[v1] failed to disable mdns: %v", call.Err)
|
||||
}
|
||||
|
||||
// We don't support dnssec consistently right now, force it off to
|
||||
// avoid partial failures when we split DNS internally.
|
||||
if call := resolved.CallWithContext(ctx, "org.freedesktop.resolve1.Manager.SetLinkDNSSEC", 0, iface.Index, "no"); call.Err != nil {
|
||||
// TODO: log
|
||||
m.logf("[v1] failed to disable DNSSEC: %v", call.Err)
|
||||
}
|
||||
|
||||
if call := resolved.CallWithContext(ctx, "org.freedesktop.resolve1.Manager.SetLinkDNSOverTLS", 0, iface.Index, "no"); call.Err != nil {
|
||||
// TODO: log
|
||||
m.logf("[v1] failed to disable DoT: %v", call.Err)
|
||||
}
|
||||
|
||||
err = resolved.CallWithContext(
|
||||
ctx, "org.freedesktop.resolve1.Manager.FlushCaches", 0).Store()
|
||||
if err != nil {
|
||||
// TODO: log
|
||||
if call := resolved.CallWithContext(ctx, "org.freedesktop.resolve1.Manager.FlushCaches", 0); call.Err != nil {
|
||||
m.logf("failed to flush resolved DNS cache: %v", call.Err)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
Loading…
Reference in New Issue
Block a user