pub struct NodeAddr {
pub node_id: NodeId,
pub info: AddrInfo,
}Expand description
Network-level addressing information for an iroh-net node.
This combines a node’s identifier with network-level addressing information of how to contact the node.
To establish a network connection to a node both the NodeId and one or more network
paths are needed. The network paths can come from various sources:
-
A discovery service which can provide routing information for a given
NodeId. -
A
RelayUrlof the node’s home relay, this allows establishing the connection via the Relay server and is very reliable. -
One or more direct addresses on which the node might be reachable. Depending on the network location of both nodes it might not be possible to establish a direct connection without the help of a Relay server.
This structure will always contain the required NodeId and will contain an optional
number of network-level addressing information. It is a generic addressing type used
whenever a connection to other nodes needs to be established.
Fields§
§node_id: NodeIdThe node’s identifier.
info: AddrInfoAddressing information to connect to Self::node_id.
Implementations§
source§impl NodeAddr
impl NodeAddr
sourcepub fn with_relay_url(self, relay_url: RelayUrl) -> Self
pub fn with_relay_url(self, relay_url: RelayUrl) -> Self
Adds a relay url to the node’s AddrInfo.
sourcepub fn with_direct_addresses(
self,
addresses: impl IntoIterator<Item = SocketAddr>,
) -> Self
pub fn with_direct_addresses( self, addresses: impl IntoIterator<Item = SocketAddr>, ) -> Self
Adds the given direct addresses to the peer’s AddrInfo.
sourcepub fn from_parts(
node_id: PublicKey,
relay_url: Option<RelayUrl>,
direct_addresses: Vec<SocketAddr>,
) -> Self
pub fn from_parts( node_id: PublicKey, relay_url: Option<RelayUrl>, direct_addresses: Vec<SocketAddr>, ) -> Self
Creates a new NodeAddr from its parts.
sourcepub fn apply_options(&mut self, opts: AddrInfoOptions)
pub fn apply_options(&mut self, opts: AddrInfoOptions)
sourcepub fn direct_addresses(&self) -> impl Iterator<Item = &SocketAddr>
pub fn direct_addresses(&self) -> impl Iterator<Item = &SocketAddr>
Returns the direct addresses of this peer.
Trait Implementations§
source§impl<'de> Deserialize<'de> for NodeAddr
impl<'de> Deserialize<'de> for NodeAddr
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
source§impl From<NodeAddr> for NodeTicket
impl From<NodeAddr> for NodeTicket
source§impl From<NodeTicket> for NodeAddr
impl From<NodeTicket> for NodeAddr
source§fn from(ticket: NodeTicket) -> Self
fn from(ticket: NodeTicket) -> Self
Returns the addressing info from given ticket.
source§impl Ord for NodeAddr
impl Ord for NodeAddr
source§impl PartialOrd for NodeAddr
impl PartialOrd for NodeAddr
impl Eq for NodeAddr
impl StructuralPartialEq for NodeAddr
Auto Trait Implementations§
impl Freeze for NodeAddr
impl RefUnwindSafe for NodeAddr
impl Send for NodeAddr
impl Sync for NodeAddr
impl Unpin for NodeAddr
impl UnwindSafe for NodeAddr
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)