headscale/hscontrol/types
Kristoffer Dalby 7e62031444
replace ephemeral deletion logic (#2008)
* replace ephemeral deletion logic

this commit replaces the way we remove ephemeral nodes,
currently they are deleted in a loop and we look at last seen
time. This time is now only set when a node disconnects and
there was a bug (#2006) where nodes that had never disconnected
was deleted since they did not have a last seen.

The new logic will start an expiry timer when the node disconnects
and delete the node from the database when the timer is up.

If the node reconnects within the expiry, the timer is cancelled.

Fixes #2006

Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>

* use uint64 as authekyid and ptr helper in tests

Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>

* add test db helper

Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>

* add list ephemeral node func

Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>

* schedule ephemeral nodes for removal on startup

Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>

* fix gorm query for postgres

Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>

* add godoc

Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>

---------

Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
2024-07-18 10:01:59 +02:00
..
api_key.go Split code into modules 2023-05-26 12:24:50 +02:00
common.go batch updates in notifier (#1905) 2024-04-27 10:47:39 +02:00
config.go feat: implements apis for managing headscale policy (#1792) 2024-07-18 07:38:25 +02:00
const.go improve testing of route failover logic 2024-04-15 12:31:53 +02:00
node.go replace ephemeral deletion logic (#2008) 2024-07-18 10:01:59 +02:00
node_test.go fix(1996): Implement register method enum converter (#2013) 2024-07-17 13:12:16 +02:00
policy.go feat: implements apis for managing headscale policy (#1792) 2024-07-18 07:38:25 +02:00
preauth_key.go Restore foreign keys and add constraints (#1562) 2024-05-15 20:40:14 -04:00
routes.go ensure online status and route changes are propagated (#1564) 2023-12-09 18:09:24 +01:00
routes_test.go ensure online status and route changes are propagated (#1564) 2023-12-09 18:09:24 +01:00
users.go Replace database locks with transactions (#1701) 2024-02-08 17:28:19 +01:00