diff --git a/hub/api/api.go b/hub/api/api.go index e5ab748..8551803 100644 --- a/hub/api/api.go +++ b/hub/api/api.go @@ -204,7 +204,7 @@ func (a *API) Peer_Init(peer *Peer, args m.PeerInitArgs) error { // we held the lock, so it may be stale under concurrent requests. current, err := db.Peer_Get(a.db, peer.NetworkID, peer.PeerIP) if err != nil { - return err + return errs.DB(err) } if len(current.WGPubKey) != 0 { return errs.ErrAlreadyExists diff --git a/hub/errs/db.go b/hub/errs/db.go index 4d3eea5..98515ec 100644 --- a/hub/errs/db.go +++ b/hub/errs/db.go @@ -17,7 +17,7 @@ func DB(err error) error { return err } - if err == sql.ErrNoRows { + if errors.Is(err, sql.ErrNoRows) { return ErrNotFound } diff --git a/peer/remote.go b/peer/remote.go index 6e20cee..bdd860a 100644 --- a/peer/remote.go +++ b/peer/remote.go @@ -29,7 +29,7 @@ type Peer struct { EndpointLAN netip.AddrPort // Discovered via multicast. RTT time.Duration // Round-trip time. State PeerState // Current routing state; updated on each devXxx call. - Role control.Role // Client initiates pings; server responds. + Role control.Role // Role in relation to the local application. SignPubKey [32]byte // nacl/sign public key for verifying multicast beacons. }