pub struct NodeAddr {
pub node_id: PublicKey,
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
RelayUrl
of 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: PublicKey
The node’s identifier.
info: AddrInfo
Addressing information to connect to Self::node_id
.
Implementations§
Source§impl NodeAddr
impl NodeAddr
Sourcepub fn with_relay_url(self, relay_url: RelayUrl) -> NodeAddr
pub fn with_relay_url(self, relay_url: RelayUrl) -> NodeAddr
Adds a relay url to the node’s AddrInfo
.
Sourcepub fn with_direct_addresses(
self,
addresses: impl IntoIterator<Item = SocketAddr>,
) -> NodeAddr
pub fn with_direct_addresses( self, addresses: impl IntoIterator<Item = SocketAddr>, ) -> NodeAddr
Adds the given direct addresses to the peer’s AddrInfo
.
Sourcepub fn from_parts(
node_id: PublicKey,
relay_url: Option<RelayUrl>,
direct_addresses: impl IntoIterator<Item = SocketAddr>,
) -> NodeAddr
pub fn from_parts( node_id: PublicKey, relay_url: Option<RelayUrl>, direct_addresses: impl IntoIterator<Item = SocketAddr>, ) -> NodeAddr
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<NodeAddr, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<NodeAddr, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl From<NodeAddr> for NodeTicket
impl From<NodeAddr> for NodeTicket
Source§fn from(addr: NodeAddr) -> NodeTicket
fn from(addr: NodeAddr) -> NodeTicket
Creates a ticket from given addressing info.
Source§impl From<NodeTicket> for NodeAddr
impl From<NodeTicket> for NodeAddr
Source§fn from(ticket: NodeTicket) -> NodeAddr
fn from(ticket: NodeTicket) -> NodeAddr
Returns the addressing info from given ticket.
Source§impl From<RemoteInfo> for NodeAddr
impl From<RemoteInfo> for NodeAddr
Source§fn from(info: RemoteInfo) -> Self
fn from(info: RemoteInfo) -> Self
Source§impl Ord for NodeAddr
impl Ord for NodeAddr
Source§impl PartialOrd for NodeAddr
impl PartialOrd for NodeAddr
Source§impl Serialize for NodeAddr
impl Serialize for NodeAddr
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
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<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
)Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
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.