Documentation
¶
Index ¶
- func BuildExpectedWireGuardRoutes(peers []Peer, nodesByName map[string]Node) ([]ExpectedRoute, []ExpectedRoute)
- func BuildGatewayPoolRoutedCIDRSetByPool(poolRoutedCIDRs map[string][]string) map[string]map[string]struct{}
- func BuildLocalGatewayHostCIDRSetFromPodCIDRs(podCIDRs []string) map[string]struct{}
- func BuildNormalizedCIDRSet(cidrs []string) map[string]struct{}
- func BuildSiteNodeCIDRSetBySite(siteNodeCIDRs map[string][]string) map[string]map[string]struct{}
- func BuildSitePodCIDRSetBySite(nodesByName map[string]Node) map[string]map[string]struct{}
- func CIDRMaskSize(destination string) (int, int, bool)
- func DedupePathHops(paths [][]PathHop) [][]PathHop
- func ExpectedDestinationsForPeer(peer Peer, nodesByName map[string]Node) []string
- func FilterGatewayAdvertisedRoutes(advertisement GatewayRouteAdvertisement, fallback []string, mySiteName string, ...) ([]string, map[string]int, map[string]LearnedRoute)
- func FirstUsableHostCIDRFromCIDR(cidr string) string
- func HostCIDRForIP(address string) string
- func NormalizeCIDR(cidr string) string
- func NormalizeIP(address string) string
- func NormalizeRouteDestination(destination string) (string, int)
- func PathHasHop(path []PathHop, hopType, hopName string) bool
- func RoutePathLength(route LearnedRoute) int
- type ExpectedRoute
- type GatewayRouteAdvertisement
- type LearnedRoute
- type Node
- type PathHop
- type Peer
- type RouteInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildExpectedWireGuardRoutes ¶
func BuildExpectedWireGuardRoutes(peers []Peer, nodesByName map[string]Node) ([]ExpectedRoute, []ExpectedRoute)
BuildExpectedWireGuardRoutes builds expected IPv4 and IPv6 WireGuard routes.
func BuildGatewayPoolRoutedCIDRSetByPool ¶
func BuildGatewayPoolRoutedCIDRSetByPool(poolRoutedCIDRs map[string][]string) map[string]map[string]struct{}
BuildGatewayPoolRoutedCIDRSetByPool builds normalized routed CIDR destinations grouped by gateway pool.
func BuildLocalGatewayHostCIDRSetFromPodCIDRs ¶
BuildLocalGatewayHostCIDRSetFromPodCIDRs returns cbr0-style gateway host CIDRs from pod CIDRs.
func BuildNormalizedCIDRSet ¶
BuildNormalizedCIDRSet creates a canonical set of CIDRs.
func BuildSiteNodeCIDRSetBySite ¶
BuildSiteNodeCIDRSetBySite builds normalized site node CIDR destinations grouped by site.
func BuildSitePodCIDRSetBySite ¶
BuildSitePodCIDRSetBySite builds normalized pod CIDR destinations grouped by site.
func CIDRMaskSize ¶
CIDRMaskSize returns mask size details for a normalized CIDR.
func DedupePathHops ¶
DedupePathHops removes duplicate paths while preserving deterministic ordering.
func ExpectedDestinationsForPeer ¶
ExpectedDestinationsForPeer computes expected route destinations for a peer.
func FilterGatewayAdvertisedRoutes ¶
func FilterGatewayAdvertisedRoutes( advertisement GatewayRouteAdvertisement, fallback []string, mySiteName string, localGatewayPools []string, now time.Time, staleAfter time.Duration, ) ([]string, map[string]int, map[string]LearnedRoute)
FilterGatewayAdvertisedRoutes filters stale or inapplicable gateway-advertised routes.
func FirstUsableHostCIDRFromCIDR ¶
FirstUsableHostCIDRFromCIDR returns the first usable host route for a CIDR.
func HostCIDRForIP ¶
HostCIDRForIP converts an IP string to a host CIDR form.
func NormalizeCIDR ¶
NormalizeCIDR canonicalizes CIDRs and returns empty string for invalid input.
func NormalizeIP ¶
NormalizeIP canonicalizes an IP string and returns empty when invalid.
func NormalizeRouteDestination ¶
NormalizeRouteDestination converts CIDR or host IP inputs to canonical CIDR form.
func PathHasHop ¶
PathHasHop reports whether a route path includes the given hop.
func RoutePathLength ¶
func RoutePathLength(route LearnedRoute) int
RoutePathLength returns the shortest non-empty path length for a route.
Types ¶
type ExpectedRoute ¶
type ExpectedRoute struct {
Destination string
Gateway string
Device string
Distance int
Weight int
Family int
}
ExpectedRoute describes one expected kernel route entry.
type GatewayRouteAdvertisement ¶
type GatewayRouteAdvertisement struct {
Name string
LastUpdated time.Time
Routes map[string]LearnedRoute
}
GatewayRouteAdvertisement captures a gateway's advertised routed CIDRs.
type LearnedRoute ¶
type LearnedRoute struct {
Paths [][]PathHop
}
LearnedRoute describes one destination and its learned path alternatives.
type Node ¶
type Node struct {
Name string
SiteName string
PodCIDRs []string
InternalIPs []string
ExternalIPs []string
}
Node captures route-relevant node identity and addressing.
type Peer ¶
type Peer struct {
Name string
PeerType string // site or gateway
SiteName string
SitePeered bool
SkipPodCIDRRoutes bool
Interface string
Endpoint string
PodCIDRGateways []string
AllowedIPs []string
RouteDistances map[string]int
}
Peer captures the route-relevant view of a WireGuard peer.
type RouteInfo ¶
RouteInfo identifies the object and route type associated with a destination.
func ClassifyRouteInfoForPeerDestination ¶
func ClassifyRouteInfoForPeerDestination( normalizedDestination string, peerNames []string, peerByName map[string]Peer, nodeByName map[string]Node, sitePodCIDRs map[string]map[string]struct{}, siteNodeCIDRs map[string]map[string]struct{}, gatewayPoolRoutedCIDRs map[string]map[string]struct{}, ) *RouteInfo
ClassifyRouteInfoForPeerDestination classifies a destination for UI/status output.