pub struct EndpointData { /* private fields */ }Expand description
Data about an endpoint that may be published to and resolved from discovery services.
This includes an optional RelayUrl, a set of direct addresses, and the optional
UserData, a string that can be set by applications and is not parsed or used by iroh
itself.
This struct does not include the endpoint’s EndpointId, only the data about a certain
endpoint. See EndpointInfo for a struct that contains a EndpointId with associated EndpointData.
Implementations§
Source§impl EndpointData
impl EndpointData
Sourcepub fn new(addrs: impl IntoIterator<Item = TransportAddr>) -> EndpointData
pub fn new(addrs: impl IntoIterator<Item = TransportAddr>) -> EndpointData
Creates a new EndpointData with a relay URL and a set of direct addresses.
Sourcepub fn with_relay_url(self, relay_url: Option<RelayUrl>) -> EndpointData
pub fn with_relay_url(self, relay_url: Option<RelayUrl>) -> EndpointData
Sets the relay URL and returns the updated endpoint data.
Sourcepub fn with_ip_addrs(self, addresses: BTreeSet<SocketAddr>) -> EndpointData
pub fn with_ip_addrs(self, addresses: BTreeSet<SocketAddr>) -> EndpointData
Sets the direct addresses and returns the updated endpoint data.
Sourcepub fn with_user_data(self, user_data: Option<UserData>) -> EndpointData
pub fn with_user_data(self, user_data: Option<UserData>) -> EndpointData
Sets the user-defined data and returns the updated endpoint data.
Sourcepub fn relay_urls(&self) -> impl Iterator<Item = &RelayUrl>
pub fn relay_urls(&self) -> impl Iterator<Item = &RelayUrl>
Returns the relay URL of the endpoint.
Sourcepub fn user_data(&self) -> Option<&UserData>
pub fn user_data(&self) -> Option<&UserData>
Returns the optional user-defined data of the endpoint.
Sourcepub fn ip_addrs(&self) -> impl Iterator<Item = &SocketAddr>
pub fn ip_addrs(&self) -> impl Iterator<Item = &SocketAddr>
Returns the direct addresses of the endpoint.
Sourcepub fn clear_ip_addrs(&mut self)
pub fn clear_ip_addrs(&mut self)
Removes all direct addresses from the endpoint data.
Sourcepub fn clear_relay_urls(&mut self)
pub fn clear_relay_urls(&mut self)
Removes all direct addresses from the endpoint data.
Sourcepub fn add_addrs(&mut self, addrs: impl IntoIterator<Item = TransportAddr>)
pub fn add_addrs(&mut self, addrs: impl IntoIterator<Item = TransportAddr>)
Add addresses to the endpoint data.
Sourcepub fn set_user_data(&mut self, user_data: Option<UserData>)
pub fn set_user_data(&mut self, user_data: Option<UserData>)
Sets the user-defined data of the endpoint data.
Sourcepub fn addrs(&self) -> impl Iterator<Item = &TransportAddr>
pub fn addrs(&self) -> impl Iterator<Item = &TransportAddr>
Returns the full list of all known addresses
Trait Implementations§
Source§impl Clone for EndpointData
impl Clone for EndpointData
Source§fn clone(&self) -> EndpointData
fn clone(&self) -> EndpointData
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for EndpointData
impl Debug for EndpointData
Source§impl Default for EndpointData
impl Default for EndpointData
Source§fn default() -> EndpointData
fn default() -> EndpointData
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 PartialEq for EndpointData
impl PartialEq for EndpointData
impl Eq for EndpointData
impl StructuralPartialEq for EndpointData
Auto Trait Implementations§
impl Freeze for EndpointData
impl RefUnwindSafe for EndpointData
impl Send for EndpointData
impl Sync for EndpointData
impl Unpin for EndpointData
impl UnwindSafe for EndpointData
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<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.