headscale/hscontrol/policy
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
..
matcher all: fix golangci-lint issues (#3064) 2026-02-06 21:45:32 +01:00
policyutil policy/v2: implement CapGrant compilation with companion capabilities 2026-04-01 14:10:42 +01:00
v2 policy/v2,state,mapper: implement per-viewer via route steering 2026-04-01 14:10:42 +01:00
pm.go policy/v2,state,mapper: implement per-viewer via route steering 2026-04-01 14:10:42 +01:00
policy.go all: upgrade to Go 1.26rc2 and modernize codebase 2026-02-08 12:35:23 +01:00
policy_autoapprove_test.go policy/v2: refactor alias resolution to use ResolvedAddresses 2026-04-01 14:10:42 +01:00
policy_route_approval_test.go all: apply golangci-lint 2.9.0 fixes 2026-02-19 08:21:23 +01:00
policy_test.go policy/v2: add localpart:*@domain SSH user compilation 2026-02-28 05:14:11 -08:00
route_approval_test.go all: upgrade to Go 1.26rc2 and modernize codebase 2026-02-08 12:35:23 +01:00