From aa5c94f75bce39577b4a15e99fd88e3a7bb36c29 Mon Sep 17 00:00:00 2001 From: Carlos Hernandez Date: Wed, 21 Aug 2024 14:52:53 -0600 Subject: [PATCH] Fix lint issues --- client/internal/dns/server.go | 1 - client/internal/dns/server_test.go | 10 ++++++++-- client/internal/dns/upstream.go | 2 +- client/internal/dns/upstream_test.go | 5 ++++- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/client/internal/dns/server.go b/client/internal/dns/server.go index 974576b5684..17afb188c10 100644 --- a/client/internal/dns/server.go +++ b/client/internal/dns/server.go @@ -609,7 +609,6 @@ func (s *DefaultServer) updateNSGroupStates(groups []*nbdns.NameServerGroup) { servers = append(servers, fmt.Sprintf("%s:%d", ns.IP, ns.Port)) } - // Automatically disbled if peer == 0 and IP is private state := peer.NSGroupState{ ID: generateGroupKey(group), Servers: servers, diff --git a/client/internal/dns/server_test.go b/client/internal/dns/server_test.go index 62cd5916f32..13d2c7adc39 100644 --- a/client/internal/dns/server_test.go +++ b/client/internal/dns/server_test.go @@ -285,13 +285,19 @@ func TestUpdateDNSServer(t *testing.T) { }() statusRecorder := peer.NewRecorder("https://mgm") key := "abc" - statusRecorder.AddPeer(key, "abc.netbird") - statusRecorder.UpdatePeerState(peer.State{ + err = statusRecorder.AddPeer(key, "abc.netbird") + if err != nil { + t.Fatal(err) + } + err = statusRecorder.UpdatePeerState(peer.State{ PubKey: key, Mux: new(sync.RWMutex), ConnStatus: peer.StatusConnected, ConnStatusUpdate: time.Now(), }) + if err != nil { + t.Fatal(err) + } dnsServer, err := NewDefaultServer(context.Background(), wgIface, "", statusRecorder) if err != nil { t.Fatal(err) diff --git a/client/internal/dns/upstream.go b/client/internal/dns/upstream.go index 10a69771f1f..d6167f89981 100644 --- a/client/internal/dns/upstream.go +++ b/client/internal/dns/upstream.go @@ -318,7 +318,7 @@ func (u *upstreamResolverBase) waitUntilResponse() { u.probeAvailability() } - // check if still disbaled + // check if still disabled if u.disabled { log.Tracef("checking connectivity with upstreams %s failed. Retrying in %s", u.upstreamServers, exponentialBackOff.NextBackOff()) return fmt.Errorf("upstream check call error") diff --git a/client/internal/dns/upstream_test.go b/client/internal/dns/upstream_test.go index c754f22d1f3..0d8b27086ab 100644 --- a/client/internal/dns/upstream_test.go +++ b/client/internal/dns/upstream_test.go @@ -61,7 +61,10 @@ func TestUpstreamResolver_ServeDNS(t *testing.T) { statusRecorder := peer.NewRecorder("https://mgm") key := "abc" // Public resolvers being used so peer not required - statusRecorder.AddPeer(key, "abc.netbird") + err := statusRecorder.AddPeer(key, "abc.netbird") + if err != nil { + t.Fatal(err) + } // PubKey: key, resolver, _ := newUpstreamResolver(ctx, "", net.IP{}, &net.IPNet{}, statusRecorder, nil) resolver.upstreamServers = testCase.InputServers