pub struct EndpointAddr {
pub id: PublicKey,
pub addrs: BTreeSet<TransportAddr>,
}Expand description
Network-level addressing information for an iroh endpoint.
This combines an endpoint’s identifier with network-level addressing information of how to contact the endpoint.
To establish a network connection to an endpoint both the EndpointId and one or more network
paths are needed. The network paths can come from various sources, current sources can come from
-
An Address Lookup service which can provide routing information for a given
EndpointId. -
A
RelayUrlof the endpoint’s home relay, this allows establishing the connection via the Relay server and is very reliable. -
One or more IP based addresses on which the endpoint might be reachable. Depending on the network location of both endpoints it might not be possible to establish a direct connection without the help of a Relay server.
This structure will always contain the required EndpointId and will contain an optional
number of other addressing information. It is a generic addressing type used whenever a connection
to other endpoints needs to be established.
Fields§
§id: PublicKeyThe endpoint’s identifier.
addrs: BTreeSet<TransportAddr>The endpoint’s addresses
Implementations§
Source§impl EndpointAddr
impl EndpointAddr
Sourcepub fn new(id: PublicKey) -> EndpointAddr
pub fn new(id: PublicKey) -> EndpointAddr
Creates a new EndpointAddr with no network level addresses.
This still is usable with e.g. an address lookup service to establish a connection, depending on the situation.
Sourcepub fn from_parts(
id: PublicKey,
addrs: impl IntoIterator<Item = TransportAddr>,
) -> EndpointAddr
pub fn from_parts( id: PublicKey, addrs: impl IntoIterator<Item = TransportAddr>, ) -> EndpointAddr
Creates a new EndpointAddr from its parts.
Sourcepub fn with_relay_url(self, relay_url: RelayUrl) -> EndpointAddr
pub fn with_relay_url(self, relay_url: RelayUrl) -> EndpointAddr
Adds a RelayUrl address.
Sourcepub fn with_ip_addr(self, addr: SocketAddr) -> EndpointAddr
pub fn with_ip_addr(self, addr: SocketAddr) -> EndpointAddr
Adds an IP based address.
Sourcepub fn with_addrs(
self,
addrs: impl IntoIterator<Item = TransportAddr>,
) -> EndpointAddr
pub fn with_addrs( self, addrs: impl IntoIterator<Item = TransportAddr>, ) -> EndpointAddr
Adds a list of addresses.
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Returns true, if only a EndpointId is present.
Sourcepub fn ip_addrs(&self) -> impl Iterator<Item = &SocketAddr>
pub fn ip_addrs(&self) -> impl Iterator<Item = &SocketAddr>
Returns a list of IP addresses of this peer.
Sourcepub fn relay_urls(&self) -> impl Iterator<Item = &RelayUrl>
pub fn relay_urls(&self) -> impl Iterator<Item = &RelayUrl>
Returns a list of relay urls of this peer.
In practice this is expected to be zero or one home relay for all known cases currently.
Trait Implementations§
Source§impl Clone for EndpointAddr
impl Clone for EndpointAddr
Source§fn clone(&self) -> EndpointAddr
fn clone(&self) -> EndpointAddr
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for EndpointAddr
impl Debug for EndpointAddr
Source§impl<'de> Deserialize<'de> for EndpointAddr
impl<'de> Deserialize<'de> for EndpointAddr
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<EndpointAddr, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<EndpointAddr, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl From<EndpointAddr> for EndpointData
impl From<EndpointAddr> for EndpointData
Source§fn from(endpoint_addr: EndpointAddr) -> EndpointData
fn from(endpoint_addr: EndpointAddr) -> EndpointData
Source§impl From<EndpointAddr> for EndpointInfo
impl From<EndpointAddr> for EndpointInfo
Source§fn from(addr: EndpointAddr) -> EndpointInfo
fn from(addr: EndpointAddr) -> EndpointInfo
Source§impl From<EndpointInfo> for EndpointAddr
impl From<EndpointInfo> for EndpointAddr
Source§fn from(value: EndpointInfo) -> EndpointAddr
fn from(value: EndpointInfo) -> EndpointAddr
Source§impl From<PublicKey> for EndpointAddr
impl From<PublicKey> for EndpointAddr
Source§fn from(endpoint_id: PublicKey) -> EndpointAddr
fn from(endpoint_id: PublicKey) -> EndpointAddr
Source§impl Hash for EndpointAddr
impl Hash for EndpointAddr
Source§impl Ord for EndpointAddr
impl Ord for EndpointAddr
Source§fn cmp(&self, other: &EndpointAddr) -> Ordering
fn cmp(&self, other: &EndpointAddr) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for EndpointAddr
impl PartialEq for EndpointAddr
Source§impl PartialOrd for EndpointAddr
impl PartialOrd for EndpointAddr
Source§impl Serialize for EndpointAddr
impl Serialize for EndpointAddr
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 EndpointAddr
impl StructuralPartialEq for EndpointAddr
Auto Trait Implementations§
impl Freeze for EndpointAddr
impl RefUnwindSafe for EndpointAddr
impl Send for EndpointAddr
impl Sync for EndpointAddr
impl Unpin for EndpointAddr
impl UnwindSafe for EndpointAddr
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§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,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<T> CompatExt for T
impl<T> CompatExt for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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