Documentation
¶
Overview ¶
Package addrspace provides policy-agnostic address-space primitives for comparing route CIDRs and deriving site IDs from Tailscale 4via6 prefixes. It knows nothing about ACL policy text or live device inventories: tail-acl and tailnet-audit supply their own CIDR strings and classify the results.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsViaPrefix ¶
IsViaPrefix reports whether cidr, once masked to its own prefix length, lies within the Tailscale 4via6 "via" range. cidr must be a full CIDR string (a bare or bracketed address without an explicit prefix length is rejected, unlike Overlaps/OverlappingPairs). It requires cidr to be no wider than the via range itself (/64), but deliberately does not validate a prefix length of at least /96 or the embedded site ID, allowing callers to distinguish a malformed via prefix from an ordinary route.
func OverlappingPairs ¶
OverlappingPairs returns the index pairs (i, j), i < j, of cidrs entries that overlap, and any per-entry parse errors keyed by index. A malformed entry is reported in the returned error map and excluded from every pairwise comparison rather than aborting the whole call, so one bad entry in a larger set never hides the overlaps among the rest. A nil error map means every entry parsed. Pairs are returned sorted ascending by (i, j); downstream callers such as tail-ipam's subnet-pool registry overlap validation depend on this ordering for deterministic error messages.
func Overlaps ¶
Overlaps reports whether a and b share any address. Each argument may be a CIDR prefix or a bare address (optionally bracketed, as Tailscale IPv6 addresses sometimes are). It returns an error if either argument fails to parse as either form.
func SiteID ¶
SiteID extracts the 4via6 site ID embedded in a Tailscale "via" IPv6 prefix. cidr must be a full CIDR string (a bare or bracketed address without an explicit prefix length is rejected, unlike Overlaps/OverlappingPairs). ok is false if cidr is outside the via range, has a prefix length shorter than /96, contains a site ID above 65535, or is not a CIDR.
Types ¶
This section is empty.