TZH-nh/moonwire/routing does not have a README file

    RoutingError

    pub(all) suberror RoutingError {
    MissingPrefixLength(String)
    InvalidPrefixLength(Int)
    Address(
    PacketError
    )
    } derive(Eq,
    Debug
    )

    Cidr

    pub(all) struct Cidr {
    network :
    IpAddr

    prefix_len : Int
    } derive(Eq,
    Debug
    )

    Canonical masked IPv4 (0..=32) or IPv6 (0..=128) CIDR network prefix.
    impl Show for Cidr

    Cidr::contains_cidr

    fn Cidr::contains_cidr(self : Cidr, sub : Cidr) -> Bool

    Return true if super_cidr covers sub_cidr (super_cidr.prefix_len <= sub_cidr.prefix_len and prefixes match).

    Cidr::to_text

    fn Cidr::to_text(self : Cidr) -> String

    RouteOverlapFinding

    pub(all) struct RouteOverlapFinding {
    kind : RouteOverlapKind
    wider_peer : String
    wider_cidr : Cidr
    narrower_peer : String
    narrower_cidr : Cidr
    } derive(Eq,
    Debug
    )

    RouteOverlapKind

    pub(all) enum RouteOverlapKind {
    ExactDuplicateConflict
    RedundantSelfSubset
    CrossPeerSubnetCarve
    } derive(Eq,
    Debug
    )

    Static routing overlap / shadowing findings across peer AllowedIPs declarations.

    RoutingTable

    pub struct RoutingTable[V] {
    // private fields
    }

    WireGuard Cryptokey Routing longest-prefix-match binary radix trie (§4) supporting both IPv4 and IPv6.

    RoutingTable::insert

    fn[V] RoutingTable::insert(self : RoutingTable[V], cidr : Cidr, peer : V) -> Unit

    Associate cidr with peer in the Cryptokey Routing table.

    RoutingTable::lookup

    fn[V] RoutingTable::lookup(self : RoutingTable[V], addr :
    IpAddr
    ) -> V?

    Longest-prefix-match lookup for destination or source addr.

    RoutingTable::new

    fn[V] RoutingTable::new() -> RoutingTable[V]

    RoutingTable::verify_source

    fn[V : Eq] RoutingTable::verify_source(self : RoutingTable[V], src_addr :
    IpAddr
    , expected_peer : V) -> Bool

    Cryptokey Routing reverse-path source IP check (§4): returns true iff src_addr longest-prefix-matches expected_peer.

    analyze_overlaps

    fn analyze_overlaps(peer_routes : Array[(String, Array[Cidr])]) -> Array[RouteOverlapFinding]

    Analyze a list of (peer_id, allowed_cidrs) pairs for exact route collisions, self-redundant subsets, and cross-peer subnet carving.

    parse_cidr

    fn parse_cidr(text : StringView) -> Cidr raise RoutingError

    Parse "<ip>/<prefix>" and canonicalize host bits to zero.

    parse_cidr_detailed

    fn parse_cidr_detailed(text : StringView) -> (Cidr, Bool) raise RoutingError

    Parse "<ip>/<prefix>" into (canonical_cidr, had_nonzero_host_bits).

    Source Files