mirror of
https://github.com/juanfont/headscale.git
synced 2024-11-26 08:53:05 +00:00
Merge pull request #648 from juanfont/show-nodes-online
Send Online field of tailcfg.Node based on LastSeen
This commit is contained in:
commit
3ae340527f
2 changed files with 6 additions and 0 deletions
|
@ -30,6 +30,7 @@
|
|||
- 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)
|
||||
- Improve obtuse UX regarding missing configuration (`ephemeral_node_inactivity_timeout` not set) [#639](https://github.com/juanfont/headscale/pull/639)
|
||||
- Fix nodes being shown as 'offline' in `tailscale status` [648](https://github.com/juanfont/headscale/pull/648)
|
||||
|
||||
## 0.15.0 (2022-03-20)
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue