net/dns/resolver: remove unused err return value.

Signed-off-by: David Anderson <danderson@tailscale.com>
crawshaw/localapi404
David Anderson 4 years ago committed by Dave Anderson
parent 6a206fd0fb
commit 1bf91c8123

@ -98,7 +98,7 @@ type Resolver struct {
// New returns a new resolver. // New returns a new resolver.
// linkMon optionally specifies a link monitor to use for socket rebinding. // linkMon optionally specifies a link monitor to use for socket rebinding.
func New(logf logger.Logf, linkMon *monitor.Mon) (*Resolver, error) { func New(logf logger.Logf, linkMon *monitor.Mon) *Resolver {
r := &Resolver{ r := &Resolver{
logf: logger.WithPrefix(logf, "dns: "), logf: logger.WithPrefix(logf, "dns: "),
linkMon: linkMon, linkMon: linkMon,
@ -117,7 +117,7 @@ func New(logf logger.Logf, linkMon *monitor.Mon) (*Resolver, error) {
r.wg.Add(1) r.wg.Add(1)
go r.poll() go r.poll()
return r, nil return r
} }
func isFQDN(s string) bool { func isFQDN(s string) bool {

@ -187,10 +187,7 @@ func TestRDNSNameToIPv6(t *testing.T) {
} }
func TestResolveLocal(t *testing.T) { func TestResolveLocal(t *testing.T) {
r, err := New(t.Logf, nil) r := New(t.Logf, nil)
if err != nil {
t.Fatalf("start: %v", err)
}
defer r.Close() defer r.Close()
r.SetConfig(dnsCfg) r.SetConfig(dnsCfg)
@ -230,10 +227,7 @@ func TestResolveLocal(t *testing.T) {
} }
func TestResolveLocalReverse(t *testing.T) { func TestResolveLocalReverse(t *testing.T) {
r, err := New(t.Logf, nil) r := New(t.Logf, nil)
if err != nil {
t.Fatalf("start: %v", err)
}
defer r.Close() defer r.Close()
r.SetConfig(dnsCfg) r.SetConfig(dnsCfg)
@ -287,10 +281,7 @@ func TestDelegate(t *testing.T) {
"nxdomain.site.", resolveToNXDOMAIN) "nxdomain.site.", resolveToNXDOMAIN)
defer v6server.Shutdown() defer v6server.Shutdown()
r, err := New(t.Logf, nil) r := New(t.Logf, nil)
if err != nil {
t.Fatalf("start: %v", err)
}
defer r.Close() defer r.Close()
cfg := dnsCfg cfg := dnsCfg
@ -365,10 +356,7 @@ func TestDelegateSplitRoute(t *testing.T) {
"test.other.", resolveToIP(test4, test6, "dns.other.")) "test.other.", resolveToIP(test4, test6, "dns.other."))
defer server2.Shutdown() defer server2.Shutdown()
r, err := New(t.Logf, nil) r := New(t.Logf, nil)
if err != nil {
t.Fatalf("start: %v", err)
}
defer r.Close() defer r.Close()
cfg := dnsCfg cfg := dnsCfg
@ -425,10 +413,7 @@ func TestDelegateCollision(t *testing.T) {
"test.site.", resolveToIP(testipv4, testipv6, "dns.test.site.")) "test.site.", resolveToIP(testipv4, testipv6, "dns.test.site."))
defer server.Shutdown() defer server.Shutdown()
r, err := New(t.Logf, nil) r := New(t.Logf, nil)
if err != nil {
t.Fatalf("start: %v", err)
}
defer r.Close() defer r.Close()
cfg := dnsCfg cfg := dnsCfg
@ -642,10 +627,7 @@ var emptyResponse = []byte{
} }
func TestFull(t *testing.T) { func TestFull(t *testing.T) {
r, err := New(t.Logf, nil) r := New(t.Logf, nil)
if err != nil {
t.Fatalf("start: %v", err)
}
defer r.Close() defer r.Close()
r.SetConfig(dnsCfg) r.SetConfig(dnsCfg)
@ -681,10 +663,7 @@ func TestFull(t *testing.T) {
} }
func TestAllocs(t *testing.T) { func TestAllocs(t *testing.T) {
r, err := New(t.Logf, nil) r := New(t.Logf, nil)
if err != nil {
t.Fatalf("start: %v", err)
}
defer r.Close() defer r.Close()
r.SetConfig(dnsCfg) r.SetConfig(dnsCfg)
@ -739,10 +718,7 @@ func BenchmarkFull(b *testing.B) {
"test.site.", resolveToIP(testipv4, testipv6, "dns.test.site.")) "test.site.", resolveToIP(testipv4, testipv6, "dns.test.site."))
defer server.Shutdown() defer server.Shutdown()
r, err := New(b.Logf, nil) r := New(b.Logf, nil)
if err != nil {
b.Fatalf("start: %v", err)
}
defer r.Close() defer r.Close()
cfg := dnsCfg cfg := dnsCfg

@ -230,11 +230,7 @@ func NewUserspaceEngine(logf logger.Logf, conf Config) (_ Engine, reterr error)
e.linkMonOwned = true e.linkMonOwned = true
} }
var err error e.resolver = resolver.New(logf, e.linkMon)
e.resolver, err = resolver.New(logf, e.linkMon)
if err != nil {
return nil, err
}
logf("link state: %+v", e.linkMon.InterfaceState()) logf("link state: %+v", e.linkMon.InterfaceState())
@ -262,6 +258,7 @@ func NewUserspaceEngine(logf logger.Logf, conf Config) (_ Engine, reterr error)
LinkMonitor: e.linkMon, LinkMonitor: e.linkMon,
} }
var err error
e.magicConn, err = magicsock.NewConn(magicsockOpts) e.magicConn, err = magicsock.NewConn(magicsockOpts)
if err != nil { if err != nil {
return nil, fmt.Errorf("wgengine: %v", err) return nil, fmt.Errorf("wgengine: %v", err)

Loading…
Cancel
Save