headscale/hscontrol
Kristoffer Dalby c8ebbede54
Simplify map session management (#1931)
This PR removes the complicated session management introduced in https://github.com/juanfont/headscale/pull/1791 which kept track of the sessions in a map, in addition to the channel already kept track of in the notifier.

Instead of trying to close the mapsession, it will now be replaced by the new one and closed after so all new updates goes to the right place.

The map session serve function is also split into a streaming and a non-streaming version for better readability.

RemoveNode in the notifier will not remove a node if the channel is not matching the one that has been passed (e.g. it has been replaced with a new one).

A new tuning parameter has been added to added to set timeout before the notifier gives up to send an update to a node.

Add a keep alive resetter so we wait with sending keep alives if a node has just received an update.

In addition it adds a bunch of env debug flags that can be set:

- `HEADSCALE_DEBUG_HIGH_CARDINALITY_METRICS`: make certain metrics include per node.id, not recommended to use in prod. 
- `HEADSCALE_DEBUG_PROFILING_ENABLED`: activate tracing 
- `HEADSCALE_DEBUG_PROFILING_PATH`: where to store traces 
- `HEADSCALE_DEBUG_DUMP_CONFIG`: calls `spew.Dump` on the config object startup
- `HEADSCALE_DEBUG_DEADLOCK`: enable go-deadlock to dump goroutines if it looks like a deadlock has occured, enabled in integration tests.

Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
2024-05-24 10:15:34 +02:00
..
assets update flake, fix prettier lint 2023-09-05 08:47:43 +02:00
db Fix typos (#1860) 2024-05-19 23:49:27 +02:00
derp Fix typos (#1860) 2024-05-19 23:49:27 +02:00
mapper Restore foreign keys and add constraints (#1562) 2024-05-15 20:40:14 -04:00
notifier Simplify map session management (#1931) 2024-05-24 10:15:34 +02:00
policy Fix typos (#1860) 2024-05-19 23:49:27 +02:00
templates update flake, fix prettier lint 2023-09-05 08:47:43 +02:00
types Simplify map session management (#1931) 2024-05-24 10:15:34 +02:00
util Migrate IP fields in database to dedicated columns (#1869) 2024-04-17 07:03:06 +02:00
app.go Simplify map session management (#1931) 2024-05-24 10:15:34 +02:00
auth_noise.go metrics, tuning in tests, db cleanups, fix concurrency issue (#1895) 2024-04-21 18:28:17 +02:00
auth.go update tailscale go dep (#1948) 2024-05-17 08:58:33 -04:00
grpcv1_test.go rename package name to hscontrol 2023-05-10 20:47:51 +02:00
grpcv1.go chore: use errors.New to replace fmt.Errorf with no parameters will much better 2024-04-21 20:23:25 +02:00
handlers.go Rework map session 2024-04-15 12:31:53 +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 Simplify map session management (#1931) 2024-05-24 10:15:34 +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