Struct domain::resolv::stub::StubResolver
source · pub struct StubResolver { /* private fields */ }
resolv
only.Expand description
A DNS stub resolver.
This type collects all information making it possible to start DNS
queries. You can create a new resolver using the system’s configuration
using the new
associate function or using your own configuration with
from_conf
.
Stub resolver values can be cloned relatively cheaply as they keep all information behind an arc.
If you want to run a single query or lookup on a resolver synchronously,
you can do so simply by using the run
or run_with_conf
associated
functions.
Implementations§
source§impl StubResolver
impl StubResolver
source§impl StubResolver
impl StubResolver
pub async fn lookup_addr( &self, addr: IpAddr ) -> Result<FoundAddrs<&Self>, Error>
pub async fn lookup_host( &self, qname: impl ToName ) -> Result<FoundHosts<&Self>, Error>
pub async fn search_host( &self, qname: impl ToRelativeName ) -> Result<FoundHosts<&Self>, Error>
sourcepub async fn lookup_srv(
&self,
service: impl ToRelativeName,
name: impl ToName,
fallback_port: u16
) -> Result<Option<FoundSrvs>, SrvError>
pub async fn lookup_srv( &self, service: impl ToRelativeName, name: impl ToName, fallback_port: u16 ) -> Result<Option<FoundSrvs>, SrvError>
Performs an SRV lookup using this resolver.
See the documentation for the lookup_srv
function for details.
source§impl StubResolver
impl StubResolver
sourcepub fn run<R, T, E, F>(op: F) -> R::Output
Available on crate feature resolv-sync
only.
pub fn run<R, T, E, F>(op: F) -> R::Output
resolv-sync
only.Synchronously perform a DNS operation atop a standard resolver.
This associated functions removes almost all boiler plate for the case that you want to perform some DNS operation, either a query or lookup, on a resolver using the system’s configuration and wait for the result.
The only argument is a closure taking a reference to a StubResolver
and returning a future. Whatever that future resolves to will be
returned.
sourcepub fn run_with_conf<R, T, E, F>(conf: ResolvConf, op: F) -> R::Output
Available on crate feature resolv-sync
only.
pub fn run_with_conf<R, T, E, F>(conf: ResolvConf, op: F) -> R::Output
resolv-sync
only.Synchronously perform a DNS operation atop a configured resolver.
This is like run
but also takes a resolver configuration for
tailor-making your own resolver.