mirror of
https://github.com/juanfont/headscale.git
synced 2026-07-11 02:21:24 +09:00
3feb307a12
Add primaries + isPrimary fields to Snapshot. snapshotFromNodes now elects per-prefix primary advertisers from the current node set, mirroring routes.PrimaryRoutes.updatePrimaryLocked: skip exit routes, prefer the previous primary if still a valid healthy advertiser, fall back to the lowest healthy NodeID, then to the lowest NodeID overall when all are unhealthy. Anti-flap memory rides the previous snapshot through applyBatch. Caller-side coordination is unnecessary; the writer goroutine serialises every mutation that could change the primary set. Add NodeStore reader methods (PrimaryFor, PrimaryRoutesForNode, HANodes, IsNodeHealthy) that mirror the legacy routes.PrimaryRoutes API on the snapshot. Consumers will switch in the next commit. No behaviour change yet — primaries are computed but not read. Updates #3203