Struct EndpointInfo
pub struct EndpointInfo {
pub endpoint_id: PublicKey,
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: PublicKeyThe EndpointId of the endpoint this is about.
data: EndpointDataThe information published about the endpoint.
Implementations§
§impl EndpointInfo
impl EndpointInfo
pub fn new(endpoint_id: PublicKey) -> EndpointInfo
pub fn new(endpoint_id: PublicKey) -> EndpointInfo
Creates a new EndpointInfo with an empty EndpointData.
pub fn from_parts(endpoint_id: PublicKey, data: EndpointData) -> EndpointInfo
pub fn from_parts(endpoint_id: PublicKey, data: EndpointData) -> EndpointInfo
Creates a new EndpointInfo from its parts.
pub fn with_relay_url(self, relay_url: Option<RelayUrl>) -> EndpointInfo
pub fn with_relay_url(self, relay_url: Option<RelayUrl>) -> EndpointInfo
Sets the relay URL and returns the updated endpoint info.
pub fn with_ip_addrs(self, addrs: BTreeSet<SocketAddr>) -> EndpointInfo
pub fn with_ip_addrs(self, addrs: BTreeSet<SocketAddr>) -> EndpointInfo
Sets the IP based addresses and returns the updated endpoint info.
pub fn with_user_data(self, user_data: Option<UserData>) -> EndpointInfo
pub fn with_user_data(self, user_data: Option<UserData>) -> EndpointInfo
Sets the user-defined data and returns the updated endpoint info.
pub fn to_endpoint_addr(&self) -> EndpointAddr
pub fn to_endpoint_addr(&self) -> EndpointAddr
Converts into a EndpointAddr by cloning the needed fields.
pub fn into_endpoint_addr(self) -> EndpointAddr
pub fn into_endpoint_addr(self) -> EndpointAddr
Converts into a EndpointAddr without cloning.
pub fn from_txt_lookup(
domain_name: String,
lookup: impl Iterator<Item = TxtRecordData>,
) -> Result<EndpointInfo, ParseError>
pub fn from_txt_lookup( domain_name: String, lookup: impl Iterator<Item = TxtRecordData>, ) -> Result<EndpointInfo, ParseError>
Parses a EndpointInfo from DNS TXT lookup.
pub fn from_pkarr_signed_packet(
packet: &SignedPacket,
) -> Result<EndpointInfo, ParseError>
pub fn from_pkarr_signed_packet( packet: &SignedPacket, ) -> Result<EndpointInfo, ParseError>
Parses a EndpointInfo from a [pkarr::SignedPacket].
pub 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.
pub 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>§
pub fn relay_urls(&self) -> impl Iterator<Item = &RelayUrl>
pub fn relay_urls(&self) -> impl Iterator<Item = &RelayUrl>
Returns the relay URL of the endpoint.
pub fn ip_addrs(&self) -> impl Iterator<Item = &SocketAddr>
pub fn ip_addrs(&self) -> impl Iterator<Item = &SocketAddr>
Returns the direct addresses of the endpoint.
pub fn clear_ip_addrs(&mut self)
pub fn clear_ip_addrs(&mut self)
Removes all direct addresses from the endpoint data.
pub fn clear_relay_urls(&mut self)
pub fn clear_relay_urls(&mut self)
Removes all direct addresses from the endpoint data.
pub 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.
pub 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.
pub 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§
§impl Clone for EndpointInfo
impl Clone for EndpointInfo
§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 more§impl Debug for EndpointInfo
impl Debug for EndpointInfo
§impl DerefMut for EndpointInfo
impl DerefMut for EndpointInfo
§fn deref_mut(&mut self) -> &mut <EndpointInfo as Deref>::Target
fn deref_mut(&mut self) -> &mut <EndpointInfo as Deref>::Target
§impl From<&TxtAttrs<IrohAttr>> for EndpointInfo
impl From<&TxtAttrs<IrohAttr>> for EndpointInfo
§fn from(attrs: &TxtAttrs<IrohAttr>) -> EndpointInfo
fn from(attrs: &TxtAttrs<IrohAttr>) -> EndpointInfo
§impl From<EndpointAddr> for EndpointInfo
impl From<EndpointAddr> for EndpointInfo
§fn from(addr: EndpointAddr) -> EndpointInfo
fn from(addr: EndpointAddr) -> EndpointInfo
§impl From<EndpointInfo> for EndpointAddr
impl From<EndpointInfo> for EndpointAddr
§fn from(value: EndpointInfo) -> EndpointAddr
fn from(value: EndpointInfo) -> EndpointAddr
§impl From<Item> for EndpointInfo
impl From<Item> for EndpointInfo
§fn from(item: Item) -> EndpointInfo
fn from(item: Item) -> EndpointInfo
§impl From<TxtAttrs<IrohAttr>> for EndpointInfo
impl From<TxtAttrs<IrohAttr>> for EndpointInfo
§fn from(attrs: TxtAttrs<IrohAttr>) -> EndpointInfo
fn from(attrs: TxtAttrs<IrohAttr>) -> EndpointInfo
§impl PartialEq for EndpointInfo
impl PartialEq for EndpointInfo
§impl Deref for EndpointInfo
impl Deref for EndpointInfo
§type Target = EndpointData
type Target = EndpointData
§fn deref(&self) -> &<EndpointInfo as Deref>::Target
fn deref(&self) -> &<EndpointInfo as Deref>::Target
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 UnsafeUnpin 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<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
§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<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> ⓘ
§impl<D> OwoColorize for D
impl<D> OwoColorize for D
§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg] or
a color-specific method, such as [OwoColorize::green], Read more§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg] or
a color-specific method, such as [OwoColorize::on_yellow], Read more