pub struct EndpointInfo {
pub endpoint_id: EndpointId,
pub data: EndpointData,
}Expand description
Information about an endpoint that may be published to and resolved from discovery services.
This struct couples a EndpointId with its associated EndpointData.
Fields§
§endpoint_id: EndpointIdThe EndpointId of the endpoint this is about.
data: EndpointDataThe information published about the endpoint.
Implementations§
Source§impl EndpointInfo
impl EndpointInfo
Sourcepub fn new(endpoint_id: EndpointId) -> Self
pub fn new(endpoint_id: EndpointId) -> Self
Creates a new EndpointInfo with an empty EndpointData.
Sourcepub fn from_parts(endpoint_id: EndpointId, data: EndpointData) -> Self
pub fn from_parts(endpoint_id: EndpointId, data: EndpointData) -> Self
Creates a new EndpointInfo from its parts.
Sourcepub fn with_relay_url(self, relay_url: RelayUrl) -> Self
pub fn with_relay_url(self, relay_url: RelayUrl) -> Self
Adds the relay URL and returns the updated endpoint info.
Sourcepub fn with_ip_addrs(self, addrs: Vec<SocketAddr>) -> Self
pub fn with_ip_addrs(self, addrs: Vec<SocketAddr>) -> Self
Sets the IP based addresses and returns the updated endpoint info.
Sourcepub fn with_user_data(self, user_data: Option<UserData>) -> Self
pub fn with_user_data(self, user_data: Option<UserData>) -> Self
Sets the user-defined data and returns the updated endpoint info.
Sourcepub fn to_endpoint_addr(&self) -> EndpointAddr
pub fn to_endpoint_addr(&self) -> EndpointAddr
Converts into a EndpointAddr by cloning the needed fields.
Sourcepub fn into_endpoint_addr(self) -> EndpointAddr
pub fn into_endpoint_addr(self) -> EndpointAddr
Converts into a EndpointAddr.
Sourcepub fn addrs(&self) -> impl Iterator<Item = &TransportAddr>
pub fn addrs(&self) -> impl Iterator<Item = &TransportAddr>
Returns the transport addr information.
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 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 from_txt_lookup(
domain_name: String,
lookup: impl Iterator<Item = impl Display>,
) -> Result<Self, ParseError>
pub fn from_txt_lookup( domain_name: String, lookup: impl Iterator<Item = impl Display>, ) -> Result<Self, ParseError>
Parses a EndpointInfo from DNS TXT lookup results.
The domain_name is the queried DNS name (e.g. _iroh.<z32>.<origin>).
The lookup iterator yields TXT record values that implement Display.
Sourcepub fn from_pkarr_signed_packet(
packet: &SignedPacket,
) -> Result<Self, ParseError>
pub fn from_pkarr_signed_packet( packet: &SignedPacket, ) -> Result<Self, ParseError>
Parses a EndpointInfo from a pkarr::SignedPacket.
Sourcepub fn to_pkarr_signed_packet(
&self,
secret_key: &SecretKey,
ttl: u32,
) -> Result<SignedPacket, EncodingError>
pub fn to_pkarr_signed_packet( &self, secret_key: &SecretKey, ttl: u32, ) -> Result<SignedPacket, EncodingError>
Creates a pkarr::SignedPacket.
This constructs a DNS packet and signs it with a SecretKey.
Sourcepub fn to_txt_strings(&self) -> Vec<String>
pub fn to_txt_strings(&self) -> Vec<String>
Converts into a list of {key}={value} strings.
Trait Implementations§
Source§impl Clone for EndpointInfo
impl Clone for EndpointInfo
Source§fn clone(&self) -> EndpointInfo
fn clone(&self) -> EndpointInfo
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for EndpointInfo
impl Debug for EndpointInfo
Source§impl From<EndpointAddr> for EndpointInfo
impl From<EndpointAddr> for EndpointInfo
Source§fn from(addr: EndpointAddr) -> Self
fn from(addr: EndpointAddr) -> Self
Source§impl From<EndpointInfo> for EndpointAddr
impl From<EndpointInfo> for EndpointAddr
Source§fn from(value: EndpointInfo) -> Self
fn from(value: EndpointInfo) -> Self
Source§impl PartialEq for EndpointInfo
impl PartialEq for EndpointInfo
impl Eq for EndpointInfo
impl StructuralPartialEq for EndpointInfo
Auto Trait Implementations§
impl Freeze for EndpointInfo
impl RefUnwindSafe for EndpointInfo
impl Send for EndpointInfo
impl Sync for EndpointInfo
impl Unpin for EndpointInfo
impl UnwindSafe for EndpointInfo
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,
§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.