Просмотр исходного кода

wgengine: fix macos staticcheck errors (#557)

Signed-off-by: Wendi <[email protected]>
Wendi Yu 5 лет назад
Родитель
Сommit
c3736250a4

+ 0 - 7
wgengine/monitor/monitor.go

@@ -20,13 +20,6 @@ type message interface {
 	ignore() bool
 	ignore() bool
 }
 }
 
 
-// unspecifiedMessage is a minimal message implementation that should not
-// be ignored. In general, OS-specific implementations should use better
-// types and avoid this if they can.
-type unspecifiedMessage struct{}
-
-func (unspecifiedMessage) ignore() bool { return false }
-
 // osMon is the interface that each operating system-specific
 // osMon is the interface that each operating system-specific
 // implementation of the link monitor must implement.
 // implementation of the link monitor must implement.
 type osMon interface {
 type osMon interface {

+ 7 - 0
wgengine/monitor/monitor_freebsd.go

@@ -13,6 +13,13 @@ import (
 	"tailscale.com/types/logger"
 	"tailscale.com/types/logger"
 )
 )
 
 
+// unspecifiedMessage is a minimal message implementation that should not
+// be ignored. In general, OS-specific implementations should use better
+// types and avoid this if they can.
+type unspecifiedMessage struct{}
+
+func (unspecifiedMessage) ignore() bool { return false }
+
 // devdConn implements osMon using devd(8).
 // devdConn implements osMon using devd(8).
 type devdConn struct {
 type devdConn struct {
 	conn net.Conn
 	conn net.Conn

+ 7 - 0
wgengine/monitor/monitor_linux.go

@@ -19,6 +19,13 @@ import (
 	"tailscale.com/types/logger"
 	"tailscale.com/types/logger"
 )
 )
 
 
+// unspecifiedMessage is a minimal message implementation that should not
+// be ignored. In general, OS-specific implementations should use better
+// types and avoid this if they can.
+type unspecifiedMessage struct{}
+
+func (unspecifiedMessage) ignore() bool { return false }
+
 // nlConn wraps a *netlink.Conn and returns a monitor.Message
 // nlConn wraps a *netlink.Conn and returns a monitor.Message
 // instead of a netlink.Message. Currently, messages are discarded,
 // instead of a netlink.Message. Currently, messages are discarded,
 // but down the line, when messages trigger different logic depending
 // but down the line, when messages trigger different logic depending

+ 0 - 9
wgengine/router/dns.go

@@ -5,8 +5,6 @@
 package router
 package router
 
 
 import (
 import (
-	"time"
-
 	"inet.af/netaddr"
 	"inet.af/netaddr"
 )
 )
 
 
@@ -46,13 +44,6 @@ func (lhs DNSConfig) EquivalentTo(rhs DNSConfig) bool {
 	return true
 	return true
 }
 }
 
 
-// dnsReconfigTimeout is the timeout for DNS reconfiguration.
-//
-// This is useful because certain conditions can cause indefinite hangs
-// (such as improper dbus auth followed by contextless dbus.Object.Call).
-// Such operations should be wrapped in a timeout context.
-const dnsReconfigTimeout = time.Second
-
 // dnsMode determines how DNS settings are managed.
 // dnsMode determines how DNS settings are managed.
 type dnsMode uint8
 type dnsMode uint8
 
 

+ 8 - 0
wgengine/router/dns_resolved.go

@@ -11,6 +11,7 @@ import (
 	"errors"
 	"errors"
 	"fmt"
 	"fmt"
 	"os/exec"
 	"os/exec"
+	"time"
 
 
 	"github.com/godbus/dbus/v5"
 	"github.com/godbus/dbus/v5"
 	"golang.org/x/sys/unix"
 	"golang.org/x/sys/unix"
@@ -35,6 +36,13 @@ import (
 // this address is, in fact, hard-coded into resolved.
 // this address is, in fact, hard-coded into resolved.
 var resolvedListenAddr = netaddr.IPv4(127, 0, 0, 53)
 var resolvedListenAddr = netaddr.IPv4(127, 0, 0, 53)
 
 
+// dnsReconfigTimeout is the timeout for DNS reconfiguration.
+//
+// This is useful because certain conditions can cause indefinite hangs
+// (such as improper dbus auth followed by contextless dbus.Object.Call).
+// Such operations should be wrapped in a timeout context.
+const dnsReconfigTimeout = time.Second
+
 var errNotReady = errors.New("interface not ready")
 var errNotReady = errors.New("interface not ready")
 
 
 type resolvedLinkNameserver struct {
 type resolvedLinkNameserver struct {