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
impl HickoryDnsResolver
Returns an instance of the shared resolver.
Sourcepub async fn resolve_str(
&self,
name: &str,
) -> Result<impl Iterator<Item = IpAddr> + use<>, ResolveError>
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
Sourcepub fn thread_resolver() -> Self
pub fn thread_resolver() -> Self
Create a (lazy-initialized) resolver that is not shared across threads.
Sourcepub fn use_system_resolver(&self)
pub fn use_system_resolver(&self)
Swap the primary internal resolver to the system resolver rather than the configured custom resolver.
Sourcepub fn use_configured_resolver(&self)
pub fn use_configured_resolver(&self)
Swap the primary internal resolver to the configured custom resolver rather than the system resolver.
Sourcepub fn clear_preresolve(&self)
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.
Sourcepub fn get_static_fallbacks(&self) -> Option<HashMap<String, Vec<IpAddr>>>
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.
Sourcepub fn set_fallback_addrs(&mut self, addrs: HashMap<String, Vec<IpAddr>>)
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
Sourcepub fn get_static_preresolve(&self) -> Option<HashMap<String, Vec<IpAddr>>>
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.
Sourcepub fn set_static_preresolve(&mut self, addrs: HashMap<String, Vec<IpAddr>>)
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
Sourcepub fn all_configured_name_servers(&self) -> Vec<NameServerConfig>
pub fn all_configured_name_servers(&self) -> Vec<NameServerConfig>
Get the list of currently available nameserver configs.
Sourcepub fn active_name_servers(&self) -> Vec<NameServerConfig>
pub fn active_name_servers(&self) -> Vec<NameServerConfig>
Get the list of currently used nameserver configs.
Sourcepub async fn trial_nameservers(&self)
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
impl Clone for HickoryDnsResolver
Source§fn clone(&self) -> HickoryDnsResolver
fn clone(&self) -> HickoryDnsResolver
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for HickoryDnsResolver
impl Debug for HickoryDnsResolver
Source§impl Default for HickoryDnsResolver
impl Default for HickoryDnsResolver
Auto Trait Implementations§
impl Freeze for HickoryDnsResolver
impl !RefUnwindSafe for HickoryDnsResolver
impl Send for HickoryDnsResolver
impl Sync for HickoryDnsResolver
impl Unpin for HickoryDnsResolver
impl UnsafeUnpin for HickoryDnsResolver
impl !UnwindSafe for HickoryDnsResolver
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,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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