Skip to main content

HickoryDnsResolver

Struct HickoryDnsResolver 

Source
pub struct HickoryDnsResolver { /* private fields */ }
Expand description

Wrapper around an AsyncResolver, which implements the Resolve trait.

Typical use involves instantiating using the Default implementation and then resolving using methods or trait implementations.

The default initialization uses a shared underlying AsyncResolver. If a thread local resolver is required use thread_resolver() to build a resolver with an independently instantiated internal AsyncResolver.

Implementations§

Source§

impl HickoryDnsResolver

Source

pub fn shared() -> Self

Returns an instance of the shared resolver.

Source

pub async fn resolve_str( &self, name: &str, ) -> Result<impl Iterator<Item = IpAddr> + use<>, ResolveError>

Attempt to resolve a domain name to a set of [‘IpAddr’]s

Source

pub fn thread_resolver() -> Self

Create a (lazy-initialized) resolver that is not shared across threads.

Source

pub fn use_system_resolver(&self)

Swap the primary internal resolver to the system resolver rather than the configured custom resolver.

Source

pub fn use_configured_resolver(&self)

Swap the primary internal resolver to the configured custom resolver rather than the system resolver.

Source

pub fn clear_preresolve(&self)

Clear entries from the static table that would return entries during the pre-resolve stage. This means that all lookups will attempt to use the network resolver again before the static table is consulted.

Entries elevated to pre-resolve from fallback (added from default or using [set_fallback]) will have their cache timeout cleared. Entries added directly to pre-resolve (using [Self::set_static_preresolve`]) will be removed.

Source

pub fn get_static_fallbacks(&self) -> Option<HashMap<String, Vec<IpAddr>>>

Get the current map of hostnames to addresses used in the fallback static lookup stage if one exists.

Source

pub fn set_fallback_addrs(&mut self, addrs: HashMap<String, Vec<IpAddr>>)

Set (or overwrite) the map of addresses used in the fallback static hostname lookup

Source

pub fn get_static_preresolve(&self) -> Option<HashMap<String, Vec<IpAddr>>>

Get the current map of hostnames to addresses used in the preresolve static lookup stage if one exists.

Source

pub fn set_static_preresolve(&mut self, addrs: HashMap<String, Vec<IpAddr>>)

Set (or overwrite) the map of addresses used in the preresolve static hostname lookup

Source

pub fn all_configured_name_servers(&self) -> Vec<NameServerConfig>

Get the list of currently available nameserver configs.

Source

pub fn active_name_servers(&self) -> Vec<NameServerConfig>

Get the list of currently used nameserver configs.

Source

pub async fn trial_nameservers(&self)

Do a trial resolution using each nameserver individually to test which are working and which fail to complete a lookup. This will always try the full set of default configured resolvers.

Trait Implementations§

Source§

impl Clone for HickoryDnsResolver

Source§

fn clone(&self) -> HickoryDnsResolver

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for HickoryDnsResolver

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for HickoryDnsResolver

Source§

fn default() -> Self

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

impl Resolve for HickoryDnsResolver

Source§

fn resolve(&self, name: Name) -> Resolving

Performs DNS resolution on a Name. The return type is a future containing an iterator of SocketAddr. Read more

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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, 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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