1
0
mirror of https://github.com/juanfont/headscale.git synced 2024-10-17 20:05:55 +02:00

Show online in CLI & API when isOnline() reports so

This commit is contained in:
Juan Font 2022-12-13 22:29:50 +00:00 committed by Kristoffer Dalby
parent 4532915be1
commit 000c02dad9
2 changed files with 2 additions and 3 deletions

View File

@ -513,9 +513,7 @@ func nodesToPtables(
} }
var online string var online string
if lastSeen.After( if machine.Online {
time.Now().Add(-5 * time.Minute),
) { // TODO: Find a better way to reliably show if online
online = pterm.LightGreen("online") online = pterm.LightGreen("online")
} else { } else {
online = pterm.LightRed("offline") online = pterm.LightRed("offline")

View File

@ -767,6 +767,7 @@ func (machine *Machine) toProto() *v1.Machine {
GivenName: machine.GivenName, GivenName: machine.GivenName,
Namespace: machine.Namespace.toProto(), Namespace: machine.Namespace.toProto(),
ForcedTags: machine.ForcedTags, ForcedTags: machine.ForcedTags,
Online: machine.isOnline(),
// TODO(kradalby): Implement register method enum converter // TODO(kradalby): Implement register method enum converter
// RegisterMethod: , // RegisterMethod: ,