headscale/hscontrol/types
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
..
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 Simplify map session management (#1931) 2024-05-24 10:15:34 +02:00
const.go improve testing of route failover logic 2024-04-15 12:31:53 +02:00
node_test.go Migrate IP fields in database to dedicated columns (#1869) 2024-04-17 07:03:06 +02:00
node.go Simplify map session management (#1931) 2024-05-24 10:15:34 +02:00
preauth_key.go Restore foreign keys and add constraints (#1562) 2024-05-15 20:40:14 -04:00
routes_test.go ensure online status and route changes are propagated (#1564) 2023-12-09 18:09:24 +01:00
routes.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