pub struct PeerAddr {
pub addr: [u8; 16],
pub port: u16,
pub scope_id: u32,
}Expand description
An IPv6 address and port — where a Matter message came from, or goes to.
Matter is IPv6-only for operational communication (Core §2.5.6): “This protocol uses IPv6 addressing for its operational communication.” An IPv4 address cannot be a peer, which is why this type has no variant for one.
Fields§
§addr: [u8; 16]The 128-bit address, in network byte order.
port: u16The UDP port; crate::PORT unless the peer announced another.
scope_id: u32The scope zone for a link-local address, which is meaningless for other scopes.
A link-local address (fe80::/10) is ambiguous without the interface it was seen
on, and Matter uses link-local addresses routinely — a Thread node may have no
other kind.
Implementations§
Source§impl PeerAddr
impl PeerAddr
Sourcepub const fn new(addr: [u8; 16]) -> Self
pub const fn new(addr: [u8; 16]) -> Self
Builds an address with the standard Matter port and no scope.
Sourcepub const fn with_port(addr: [u8; 16], port: u16) -> Self
pub const fn with_port(addr: [u8; 16], port: u16) -> Self
Builds an address with an explicit port.
Sourcepub const fn is_link_local(&self) -> bool
pub const fn is_link_local(&self) -> bool
Whether this is a link-local address (fe80::/10), for which Self::scope_id
is significant.
Sourcepub const fn is_multicast(&self) -> bool
pub const fn is_multicast(&self) -> bool
Whether this is a multicast address (ff00::/8).