From 66fffd69ced2e5080b3a8dc22c5422b792d9289f Mon Sep 17 00:00:00 2001 From: Juan Font Alonso Date: Thu, 16 Jun 2022 18:43:50 +0200 Subject: [PATCH 1/2] Send Online field of tailcfg.Node based on LastSeen --- machine.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/machine.go b/machine.go index c2276459..cf6b8876 100644 --- a/machine.go +++ b/machine.go @@ -637,6 +637,10 @@ func (machine Machine) toNode( hostInfo := machine.GetHostInfo() + // A node is Online if it is connected to the control server, + // and we now we update LastSeen every keepAliveInterval duration at least. + online := machine.LastSeen.After(time.Now().Add(-keepAliveInterval)) + node := tailcfg.Node{ ID: tailcfg.NodeID(machine.ID), // this is the actual ID StableID: tailcfg.StableNodeID( @@ -653,6 +657,7 @@ func (machine Machine) toNode( Endpoints: machine.Endpoints, DERP: derp, + Online: &online, Hostinfo: hostInfo.View(), Created: machine.CreatedAt, LastSeen: machine.LastSeen, From 1e4678c02feeee11e1462dd21e371da43c4254d9 Mon Sep 17 00:00:00 2001 From: Juan Font Alonso Date: Thu, 16 Jun 2022 18:48:32 +0200 Subject: [PATCH 2/2] Updated changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c34e6f54..eba5d4aa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,7 @@ - Use new ACL syntax [#618](https://github.com/juanfont/headscale/pull/618) - Add -c option to specify config file from command line [#285](https://github.com/juanfont/headscale/issues/285) [#612](https://github.com/juanfont/headscale/pull/601) - Add configuration option to allow Tailscale clients to use a random WireGuard port. [kb/1181/firewalls](https://tailscale.com/kb/1181/firewalls) [#624](https://github.com/juanfont/headscale/pull/624) +- Fix nodes being shown as 'offline' in `tailscale status` [648](https://github.com/juanfont/headscale/pull/648) ## 0.15.0 (2022-03-20)