Skip to content

Commit

Permalink
Fix lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
hurricanehrndz committed Aug 21, 2024
1 parent 2196243 commit aa5c94f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
1 change: 0 additions & 1 deletion client/internal/dns/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
10 changes: 8 additions & 2 deletions client/internal/dns/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion client/internal/dns/upstream.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
5 changes: 4 additions & 1 deletion client/internal/dns/upstream_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit aa5c94f

Please sign in to comment.