headscale/hscontrol
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
..
assets update flake, fix prettier lint 2023-09-05 08:47:43 +02:00
db replace ephemeral deletion logic (#2008) 2024-07-18 10:01:59 +02:00
derp Remove allocations of lists before use (#1989) 2024-06-23 22:06:50 +02:00
mapper feat: implements apis for managing headscale policy (#1792) 2024-07-18 07:38:25 +02:00
notifier Remove allocations of lists before use (#1989) 2024-06-23 22:06:50 +02:00
policy feat: implements apis for managing headscale policy (#1792) 2024-07-18 07:38:25 +02:00
templates update flake, fix prettier lint 2023-09-05 08:47:43 +02:00
types replace ephemeral deletion logic (#2008) 2024-07-18 10:01:59 +02:00
util Migrate IP fields in database to dedicated columns (#1869) 2024-04-17 07:03:06 +02:00
app.go replace ephemeral deletion logic (#2008) 2024-07-18 10:01:59 +02:00
auth.go replace ephemeral deletion logic (#2008) 2024-07-18 10:01:59 +02:00
auth_noise.go metrics, tuning in tests, db cleanups, fix concurrency issue (#1895) 2024-04-21 18:28:17 +02:00
grpcv1.go feat: implements apis for managing headscale policy (#1792) 2024-07-18 07:38:25 +02:00
grpcv1_test.go rename package name to hscontrol 2023-05-10 20:47:51 +02:00
handlers.go Make registration screen easier to use (#1975) 2024-06-15 09:40:49 +02:00
metrics.go Simplify map session management (#1931) 2024-05-24 10:15:34 +02:00
noise.go Simplify map session management (#1931) 2024-05-24 10:15:34 +02:00
oidc.go metrics, tuning in tests, db cleanups, fix concurrency issue (#1895) 2024-04-21 18:28:17 +02:00
platform_config.go rename package name to hscontrol 2023-05-10 20:47:51 +02:00
poll.go replace ephemeral deletion logic (#2008) 2024-07-18 10:01:59 +02:00
suite_test.go new IP allocator and add postgres to integration tests. (#1756) 2024-02-18 19:31:29 +01:00
tailsql.go Use result of fmt.Errorf call (#1668) 2024-02-15 11:02:54 +01:00