Struct Dns

Source
pub struct Dns<C: DnsClient> { /* private fields */ }
Expand description

The main interface to this library. It provides all functions to query records.

Implementations§

Source§

impl<C: DnsClient> Dns<C>

Source

pub fn with_servers(servers: &[DnsHttpsServer]) -> Result<Dns<C>, DnsError>

Creates an instance with the given servers along with their respective timeouts (in seconds). These servers are tried in the given order. If a request fails on the first one, each subsequent server is tried. Only on certain failures a new request is retried such as a connection failure or certain server return codes.

Source

pub async fn resolve_mx_and_sort( &self, domain: &str, ) -> Result<Vec<DnsAnswer>, DnsError>

Returns MX records in order of priority for the given name. It removes the priorities from the data.

Source§

impl<C: DnsClient> Dns<C>

Source

pub async fn resolve_a(&self, name: &str) -> Result<Vec<DnsAnswer>, DnsError>

Queries a host address for the given name.

Source

pub async fn resolve_aaaa(&self, name: &str) -> Result<Vec<DnsAnswer>, DnsError>

Queries an IP6 Address for the given name.

Source

pub async fn resolve_any(&self, name: &str) -> Result<Vec<DnsAnswer>, DnsError>

Queries all record types for a given name.

Source

pub async fn resolve_caa(&self, name: &str) -> Result<Vec<DnsAnswer>, DnsError>

Queries a certification authority restriction record for the given name.

Source

pub async fn resolve_cds(&self, name: &str) -> Result<Vec<DnsAnswer>, DnsError>

Queries a child DS record for the given name.

Source

pub async fn resolve_cert(&self, name: &str) -> Result<Vec<DnsAnswer>, DnsError>

Queries a CERT record for the given name.

Source

pub async fn resolve_cname( &self, name: &str, ) -> Result<Vec<DnsAnswer>, DnsError>

Queries the canonical name for an alias for the given name.

Source

pub async fn resolve_dname( &self, name: &str, ) -> Result<Vec<DnsAnswer>, DnsError>

Queries a DNAME record for the given name.

Source

pub async fn resolve_dnskey( &self, name: &str, ) -> Result<Vec<DnsAnswer>, DnsError>

Queries a DNSKEY record for the given name.

Source

pub async fn resolve_ds(&self, name: &str) -> Result<Vec<DnsAnswer>, DnsError>

Queries a delegation signer record for the given name.

Source

pub async fn resolve_hinfo( &self, name: &str, ) -> Result<Vec<DnsAnswer>, DnsError>

Queries a host information record for the given name.

Source

pub async fn resolve_ipseckey( &self, name: &str, ) -> Result<Vec<DnsAnswer>, DnsError>

Queries a IPSECKEY record for the given name.

Source

pub async fn resolve_mx(&self, name: &str) -> Result<Vec<DnsAnswer>, DnsError>

Queries a mail exchange record for the given name.

Source

pub async fn resolve_naptr( &self, name: &str, ) -> Result<Vec<DnsAnswer>, DnsError>

Queries a naming authority pointer record for the given name.

Source

pub async fn resolve_ns(&self, name: &str) -> Result<Vec<DnsAnswer>, DnsError>

Queries an authoritative name server record for the given name.

Source

pub async fn resolve_nsec(&self, name: &str) -> Result<Vec<DnsAnswer>, DnsError>

Queries a NSEC record for the given name.

Source

pub async fn resolve_nsec3( &self, name: &str, ) -> Result<Vec<DnsAnswer>, DnsError>

Queries a NSEC3 record for the given name.

Source

pub async fn resolve_nsec3param( &self, name: &str, ) -> Result<Vec<DnsAnswer>, DnsError>

Queries a NSEC3PARAM record for the given name.

Source

pub async fn resolve_ptr(&self, name: &str) -> Result<Vec<DnsAnswer>, DnsError>

Queries a domain name pointer record for the given name.

Source

pub async fn resolve_rp(&self, name: &str) -> Result<Vec<DnsAnswer>, DnsError>

Queries a responsible person record for the given name.

Source

pub async fn resolve_rrsig( &self, name: &str, ) -> Result<Vec<DnsAnswer>, DnsError>

Queries a RRSIG record for the given name.

Source

pub async fn resolve_soa(&self, name: &str) -> Result<Vec<DnsAnswer>, DnsError>

Queries the start of a zone of authority record for the given name.

Source

pub async fn resolve_spf(&self, name: &str) -> Result<Vec<DnsAnswer>, DnsError>

Queries an SPF record for the given name. See RFC7208.

Source

pub async fn resolve_srv(&self, name: &str) -> Result<Vec<DnsAnswer>, DnsError>

Queries a server selection record for the given name.

Source

pub async fn resolve_sshfp( &self, name: &str, ) -> Result<Vec<DnsAnswer>, DnsError>

Queries an SSH key fingerprint record for the given name.

Source

pub async fn resolve_tlsa(&self, name: &str) -> Result<Vec<DnsAnswer>, DnsError>

Queries a TLSA record for the given name.

Source

pub async fn resolve_txt(&self, name: &str) -> Result<Vec<DnsAnswer>, DnsError>

Queries a text strings record for the given name.

Source

pub async fn resolve_wks(&self, name: &str) -> Result<Vec<DnsAnswer>, DnsError>

Queries a well known service description record for the given name.

Source

pub async fn resolve_str_type( &self, name: &str, rtype: &str, ) -> Result<Vec<DnsAnswer>, DnsError>

Source

pub fn rtype_to_name(&self, rtype: u32) -> String

Converts the given record type to a string representation.

Trait Implementations§

Source§

impl Default for Dns<HyperDnsClient>

Source§

fn default() -> Dns<HyperDnsClient>

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<C> Freeze for Dns<C>
where C: Freeze,

§

impl<C> RefUnwindSafe for Dns<C>
where C: RefUnwindSafe,

§

impl<C> Send for Dns<C>
where C: Send,

§

impl<C> Sync for Dns<C>
where C: Sync,

§

impl<C> Unpin for Dns<C>
where C: Unpin,

§

impl<C> UnwindSafe for Dns<C>
where C: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more