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: Option<RelayUrl>) -> Self
pub fn with_relay_url(self, relay_url: Option<RelayUrl>) -> Self
Sets the relay URL and returns the updated endpoint info.
Sourcepub fn with_ip_addrs(self, addrs: BTreeSet<SocketAddr>) -> Self
pub fn with_ip_addrs(self, addrs: BTreeSet<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 without cloning.
Sourcepub fn from_txt_lookup(
domain_name: String,
lookup: impl Iterator<Item = TxtRecordData>,
) -> Result<Self, ParseError>
Available on non-wasm_browser only.
pub fn from_txt_lookup( domain_name: String, lookup: impl Iterator<Item = TxtRecordData>, ) -> Result<Self, ParseError>
wasm_browser only.Parses a EndpointInfo from DNS TXT lookup.
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.
Methods from Deref<Target = EndpointData>§
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 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 Deref for EndpointInfo
impl Deref for EndpointInfo
Source§impl DerefMut for EndpointInfo
impl DerefMut 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§
§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.§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