headscale/hscontrol/types
Kristoffer Dalby 8358017dcf policy/v2,state,mapper: implement per-viewer via route steering
Via grants steer routes to specific nodes per viewer. Until now,
all clients saw the same routes for each peer because route
assembly was viewer-independent. This implements per-viewer route
visibility so that via-designated peers serve routes only to
matching viewers, while non-designated peers have those routes
withdrawn.

Add ViaRouteResult type (Include/Exclude prefix lists) and
ViaRoutesForPeer to the PolicyManager interface. The v2
implementation iterates via grants, resolves sources against the
viewer, matches destinations against the peer's advertised routes
(both subnet and exit), and categorizes prefixes by whether the
peer has the via tag.

Add RoutesForPeer to State which composes global primary election,
via Include/Exclude filtering, exit routes, and ACL reduction.
When no via grants exist, it falls back to existing behavior.

Update the mapper to call RoutesForPeer per-peer instead of using
a single route function for all peers. The route function now
returns all routes (subnet + exit), and TailNode filters exit
routes out of the PrimaryRoutes field for HA tracking.

Updates #2180
2026-04-01 14:10:42 +01:00
..
change all: apply golangci-lint 2.9.0 fixes 2026-02-19 08:21:23 +01:00
testdata Restore support for "Override local DNS" (#2438) 2025-04-17 17:16:59 +02:00
api_key.go types: add MarshalZerologObject to domain types 2026-02-06 07:40:29 +01:00
common.go all: fix test flakiness and improve test infrastructure 2026-03-14 02:52:28 -07:00
common_test.go mapper: produce map before poll (#2628) 2025-07-28 11:15:53 +02:00
config.go fix: align banner right-side border to consistent 64-char width 2026-03-19 07:08:35 +01:00
config_test.go all: fix golangci-lint issues (#3064) 2026-02-06 21:45:32 +01:00
const.go improve testing of route failover logic 2024-04-15 12:31:53 +02:00
main_test.go all: fix test flakiness and improve test infrastructure 2026-03-14 02:52:28 -07:00
node.go policy/v2,state,mapper: implement per-viewer via route steering 2026-04-01 14:10:42 +01:00
node_benchmark_test.go types: avoid NodeView clone in CanAccess 2026-02-26 19:15:07 -08:00
node_tags_test.go all: upgrade to Go 1.26rc2 and modernize codebase 2026-02-08 12:35:23 +01:00
node_test.go types: include ExitRoutes in HasNetworkChanges 2026-04-01 14:10:42 +01:00
policy.go feat: implements apis for managing headscale policy (#1792) 2024-07-18 07:38:25 +02:00
preauth_key.go all: fix golangci-lint issues (#3064) 2026-02-06 21:45:32 +01:00
preauth_key_test.go all: upgrade to Go 1.26rc2 and modernize codebase 2026-02-08 12:35:23 +01:00
routes.go Redo route code (#2422) 2025-02-26 16:22:55 +01:00
types_clone.go make tags first class node owner (#2885) 2025-12-02 12:01:25 +01:00
types_view.go hscontrol/types: regenerate types_view.go 2026-02-20 21:51:00 +01:00
users.go all: fix golangci-lint issues (#3064) 2026-02-06 21:45:32 +01:00
users_test.go all: fix golangci-lint issues (#3064) 2026-02-06 21:45:32 +01:00
version.go all: fix golangci-lint issues (#3064) 2026-02-06 21:45:32 +01:00