pub enum NextHopAddress {
Ipv4(Ipv4Addr),
Ipv6(Ipv6Addr),
Ipv6LinkLocal(Ipv6Addr, Ipv6Addr),
VpnIpv6(RouteDistinguisher, Ipv6Addr),
VpnIpv6LinkLocal(RouteDistinguisher, Ipv6Addr, RouteDistinguisher, Ipv6Addr),
}Expand description
enum that represents the type of the next hop address.
NextHopAddress is used when parsing for next hops in Nlri. RFC 8950 extends this to support VPN next-hops with Route Distinguishers.
Variants§
Ipv4(Ipv4Addr)
Ipv6(Ipv6Addr)
Ipv6LinkLocal(Ipv6Addr, Ipv6Addr)
VpnIpv6(RouteDistinguisher, Ipv6Addr)
VPN-IPv6 next hop - RFC 8950, Section 4 Contains Route Distinguisher (8 bytes) + IPv6 address (16 bytes) = 24 bytes total
VpnIpv6LinkLocal(RouteDistinguisher, Ipv6Addr, RouteDistinguisher, Ipv6Addr)
VPN-IPv6 next hop with link-local - RFC 8950, Section 4
Contains RD (8 bytes) + IPv6 (16 bytes) + RD (8 bytes) + IPv6 link-local (16 bytes) = 48 bytes total
Implementations§
Source§impl NextHopAddress
impl NextHopAddress
Sourcepub const fn is_link_local(&self) -> bool
pub const fn is_link_local(&self) -> bool
Returns true if the next hop is a link local address
Sourcepub const fn addr(&self) -> IpAddr
pub const fn addr(&self) -> IpAddr
Returns the address that this next hop points to — the first address
of a pair, in wire order. See global_addr to
resolve by scope instead.
Sourcepub const fn global_addr(&self) -> IpAddr
pub const fn global_addr(&self) -> IpAddr
Returns the global-scope address of the next hop. Pairs are resolved
by scope, not position — a reversed RFC 2545 pair still yields the
global address; same-scope pairs and single addresses fall back to
addr.
Sourcepub const fn link_local_addr(&self) -> Option<Ipv6Addr>
pub const fn link_local_addr(&self) -> Option<Ipv6Addr>
Returns the link-local half of a pair (RFC 2545): the address
global_addr does not return, when link-local.
Single addresses yield None, even link-local ones.
Trait Implementations§
Source§impl Clone for NextHopAddress
impl Clone for NextHopAddress
Source§fn clone(&self) -> NextHopAddress
fn clone(&self) -> NextHopAddress
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for NextHopAddress
Source§impl Debug for NextHopAddress
impl Debug for NextHopAddress
Source§impl Display for NextHopAddress
Renders the address; pairs render comma-joined in wire order, round-tripping
with FromStr (non-VPN forms). Route Distinguishers are not rendered.
impl Display for NextHopAddress
Renders the address; pairs render comma-joined in wire order, round-tripping
with FromStr (non-VPN forms). Route Distinguishers are not rendered.
impl Eq for NextHopAddress
Source§impl From<IpAddr> for NextHopAddress
impl From<IpAddr> for NextHopAddress
Source§impl FromStr for NextHopAddress
Parses a single IPv4/IPv6 address, or a comma-joined IPv6 pair as RIS Live
renders an RFC 2545 next hop ("2001:db8::1,fe80::1"), stored positionally
as NextHopAddress::Ipv6LinkLocal. Whitespace around the separator is
tolerated.
impl FromStr for NextHopAddress
Parses a single IPv4/IPv6 address, or a comma-joined IPv6 pair as RIS Live
renders an RFC 2545 next hop ("2001:db8::1,fe80::1"), stored positionally
as NextHopAddress::Ipv6LinkLocal. Whitespace around the separator is
tolerated.
Source§impl Hash for NextHopAddress
impl Hash for NextHopAddress
Source§impl PartialEq for NextHopAddress
impl PartialEq for NextHopAddress
impl StructuralPartialEq for NextHopAddress
Auto Trait Implementations§
impl Freeze for NextHopAddress
impl RefUnwindSafe for NextHopAddress
impl Send for NextHopAddress
impl Sync for NextHopAddress
impl Unpin for NextHopAddress
impl UnsafeUnpin for NextHopAddress
impl UnwindSafe for NextHopAddress
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more