+ expired status

This commit is contained in:
Callan Bryant 2020-03-06 22:57:05 +00:00
parent 503427031b
commit 13a8f58ab9
No known key found for this signature in database
GPG Key ID: C31FA9DF3ACBFFAA
2 changed files with 3 additions and 1 deletions

View File

@ -20,5 +20,5 @@ const (
TIMEOUT = 50 * time.Second TIMEOUT = 50 * time.Second
// when is a peer considered gone forever? (could remove) // when is a peer considered gone forever? (could remove)
EXPIRY_DAYS = 28 EXPIRY = 28 * time.Hour * 24
) )

View File

@ -88,6 +88,8 @@ func GenerateReport(dev *wgtypes.Device, conf *DsnetConfig, oldReport *DsnetRepo
status = StatusOnline status = StatusOnline
// TODO same test but with rx byte data from last report (otherwise // TODO same test but with rx byte data from last report (otherwise
// peer can fake online status by disabling handshake) // peer can fake online status by disabling handshake)
} else if !wgPeer.LastHandshakeTime.IsZero() && time.Since(wgPeer.LastHandshakeTime) > EXPIRY {
status = StatusExpired
} else { } else {
status = StatusOffline status = StatusOffline
} }