ipn/ipnstate, wgengine: make PeerStatusLite.LastHandshake zero Time means none

... rather than 1970. Code was using IsZero against the 1970 team
(which isn't a zero value), but fortunately not anywhere that seems to
have mattered.

Updates #cleanup

Change-Id: I708a3f2a9398aaaedc9503678b4a8a311e0e019e
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
Brad Fitzpatrick
2024-02-27 20:00:04 -08:00
committed by Brad Fitzpatrick
parent 3dd8ae2f26
commit 74b8985e19
2 changed files with 17 additions and 7 deletions

View File

@@ -1025,8 +1025,10 @@ func (e *userspaceEngine) getPeerStatusLite(pk key.NodePublic) (status ipnstate.
status.NodeKey = pk
status.RxBytes = int64(wgint.PeerRxBytes(peer))
status.TxBytes = int64(wgint.PeerTxBytes(peer))
status.LastHandshake = time.Unix(0, wgint.PeerLastHandshakeNano(peer))
status.HandshakeAttempts = wgint.PeerHandshakeAttempts(peer)
if nano := wgint.PeerLastHandshakeNano(peer); nano != 0 {
status.LastHandshake = time.Unix(0, nano)
}
return status, true
}