pub struct TxtAttrs<T> { /* private fields */ }
Expand description
Attributes parsed from IROH_TXT_NAME
TXT records.
This struct is generic over the key type. When using with String
, this will parse
all attributes. Can also be used with an enum, if it implements FromStr
and
Display
.
Implementations§
Source§impl<T: FromStr + Display + Hash + Ord> TxtAttrs<T>
impl<T: FromStr + Display + Hash + Ord> TxtAttrs<T>
Sourcepub fn from_parts(
node_id: NodeId,
pairs: impl Iterator<Item = (T, String)>,
) -> Self
pub fn from_parts( node_id: NodeId, pairs: impl Iterator<Item = (T, String)>, ) -> Self
Creates TxtAttrs
from a node id and an iterator of key-value pairs.
Sourcepub fn from_strings(
node_id: NodeId,
strings: impl Iterator<Item = String>,
) -> Result<Self>
pub fn from_strings( node_id: NodeId, strings: impl Iterator<Item = String>, ) -> Result<Self>
Creates TxtAttrs
from a node id and an iterator of “{key}={value}” strings.
Sourcepub async fn lookup_by_id(
resolver: &TokioAsyncResolver,
node_id: &NodeId,
origin: &str,
) -> Result<Self>
pub async fn lookup_by_id( resolver: &TokioAsyncResolver, node_id: &NodeId, origin: &str, ) -> Result<Self>
Looks up attributes by NodeId
and origin domain.
Sourcepub async fn lookup_by_name(
resolver: &TokioAsyncResolver,
name: &str,
) -> Result<Self>
pub async fn lookup_by_name( resolver: &TokioAsyncResolver, name: &str, ) -> Result<Self>
Looks up attributes by DNS name.
Sourcepub fn from_pkarr_signed_packet(packet: &SignedPacket) -> Result<Self>
pub fn from_pkarr_signed_packet(packet: &SignedPacket) -> Result<Self>
Parses a pkarr::SignedPacket
.
Sourcepub fn from_hickory_records(records: &[Record]) -> Result<Self>
pub fn from_hickory_records(records: &[Record]) -> Result<Self>
Parses a set of DNS resource records.
Sourcepub fn to_hickory_records(
&self,
origin: &str,
ttl: u32,
) -> Result<impl Iterator<Item = Record> + '_>
pub fn to_hickory_records( &self, origin: &str, ttl: u32, ) -> Result<impl Iterator<Item = Record> + '_>
Converts to a list of hickory_proto::rr::Record
resource records.
Sourcepub fn to_pkarr_signed_packet(
&self,
secret_key: &SecretKey,
ttl: u32,
) -> Result<SignedPacket>
pub fn to_pkarr_signed_packet( &self, secret_key: &SecretKey, ttl: u32, ) -> Result<SignedPacket>
Creates a pkarr::SignedPacket
This constructs a DNS packet and signs it with a SecretKey
.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for TxtAttrs<T>
impl<T> RefUnwindSafe for TxtAttrs<T>where
T: RefUnwindSafe,
impl<T> Send for TxtAttrs<T>where
T: Send,
impl<T> Sync for TxtAttrs<T>where
T: Sync,
impl<T> Unpin for TxtAttrs<T>
impl<T> UnwindSafe for TxtAttrs<T>where
T: RefUnwindSafe,
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§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
Mutably borrows from an owned value. Read more