Struct trust_dns_resolver::AsyncResolver [−][src]
pub struct AsyncResolver<C: DnsHandle<Error = ResolveError>, P: ConnectionProvider<Conn = C>> { /* fields omitted */ }
Expand description
An asynchronous resolver for DNS generic over async Runtimes.
Creating a AsyncResolver
returns a new handle and a future that should
be spawned on an executor to drive the background work. The lookup methods
on AsyncResolver
request lookups from the background task.
The futures returned by a AsyncResolver
and the corresponding background
task need not be spawned on the same executor, or be in the same thread.
Additionally, one background task may have any number of handles; calling
clone()
on a handle will create a new handle linked to the same
background task.
NOTE If lookup futures returned by a AsyncResolver
and the background
future are spawned on two separate CurrentThread
executors, one thread
cannot run both executors simultaneously, so the run
or block_on
functions will cause the thread to deadlock. If both the background work
and the lookup futures are intended to be run on the same thread, they
should be spawned on the same executor.
The background task manages the name server pool and other state used
to drive lookups. When this future is spawned on an executor, it will
first construct and configure the necessary client state, before checking
for any incoming lookup requests, handling them, and yielding. It will
continue to do so as long as there are still any AsyncResolver
handle
linked to it. When all of its AsyncResolver
s have been dropped, the
background future will finish.
Implementations
impl AsyncResolver<GenericConnection, GenericConnectionProvider<TokioRuntime>>
[src]
impl AsyncResolver<GenericConnection, GenericConnectionProvider<TokioRuntime>>
[src]pub fn tokio(
config: ResolverConfig,
options: ResolverOpts
) -> Result<Self, ResolveError>
[src]
pub fn tokio(
config: ResolverConfig,
options: ResolverOpts
) -> Result<Self, ResolveError>
[src]Construct a new Tokio based AsyncResolver
with the provided configuration.
Arguments
config
- configuration, name_servers, etc. for the Resolveroptions
- basic lookup options for the resolver
Returns
A tuple containing the new AsyncResolver
and a future that drives the
background task that runs resolutions for the AsyncResolver
. See the
documentation for AsyncResolver
for more information on how to use
the background future.
pub fn tokio_from_system_conf() -> Result<Self, ResolveError>
[src]
pub fn tokio_from_system_conf() -> Result<Self, ResolveError>
[src]Constructs a new Tokio based Resolver with the system configuration.
This will use /etc/resolv.conf
on Unix OSes and the registry on Windows.
impl<R: RuntimeProvider> AsyncResolver<GenericConnection, GenericConnectionProvider<R>>
[src]
impl<R: RuntimeProvider> AsyncResolver<GenericConnection, GenericConnectionProvider<R>>
[src]pub fn new(
config: ResolverConfig,
options: ResolverOpts,
runtime: R::Handle
) -> Result<Self, ResolveError>
[src]
pub fn new(
config: ResolverConfig,
options: ResolverOpts,
runtime: R::Handle
) -> Result<Self, ResolveError>
[src]Construct a new generic AsyncResolver
with the provided configuration.
see [crate::trust_dns_resolver::TokioAsyncResolver::tokio] instead.
Arguments
config
- configuration, name_servers, etc. for the Resolveroptions
- basic lookup options for the resolver
Returns
A tuple containing the new AsyncResolver
and a future that drives the
background task that runs resolutions for the AsyncResolver
. See the
documentation for AsyncResolver
for more information on how to use
the background future.
pub fn from_system_conf(runtime: R::Handle) -> Result<Self, ResolveError>
[src]
pub fn from_system_conf(runtime: R::Handle) -> Result<Self, ResolveError>
[src]Constructs a new Resolver with the system configuration.
see [crate::trust_dns_resolver::TokioAsyncResolver::tokio_from_system_conf] instead.
This will use /etc/resolv.conf
on Unix OSes and the registry on Windows.
impl<C: DnsHandle<Error = ResolveError>, P: ConnectionProvider<Conn = C>> AsyncResolver<C, P>
[src]
impl<C: DnsHandle<Error = ResolveError>, P: ConnectionProvider<Conn = C>> AsyncResolver<C, P>
[src]pub fn lookup<N: IntoName>(
&self,
name: N,
record_type: RecordType,
options: DnsRequestOptions
) -> impl Future<Output = Result<Lookup, ResolveError>> + Send + Unpin + 'static
[src]
pub fn lookup<N: IntoName>(
&self,
name: N,
record_type: RecordType,
options: DnsRequestOptions
) -> impl Future<Output = Result<Lookup, ResolveError>> + Send + Unpin + 'static
[src]Generic lookup for any RecordType
WARNING this interface may change in the future, see if one of the specializations would be better.
Arguments
name
- name of the record to lookup, if name is not a valid domain name, an error will be returnedrecord_type
- type of record to lookup, all RecordData responses will be filtered to this type
Returns
pub async fn lookup_ip<N: IntoName + TryParseIp>(
&self,
host: N
) -> Result<LookupIp, ResolveError>
[src]
pub async fn lookup_ip<N: IntoName + TryParseIp>(
&self,
host: N
) -> Result<LookupIp, ResolveError>
[src]Performs a dual-stack DNS lookup for the IP for the given hostname.
See the configuration and options parameters for controlling the way in which A(Ipv4) and AAAA(Ipv6) lookups will be performed. For the least expensive query a fully-qualified-domain-name, FQDN, which ends in a final .
, e.g. www.example.com.
, will only issue one query. Anything else will always incur the cost of querying the ResolverConfig::domain
and ResolverConfig::search
.
Arguments
host
- string hostname, if this is an invalid hostname, an error will be returned.
pub async fn reverse_lookup(
&self,
query: IpAddr
) -> Result<ReverseLookup, ResolveError>
[src]
pub async fn reverse_lookup(
&self,
query: IpAddr
) -> Result<ReverseLookup, ResolveError>
[src]Performs a lookup for the associated type.
Arguments
query
- a type which can be converted toName
viaFrom
.
pub async fn ipv4_lookup<N: IntoName>(
&self,
query: N
) -> Result<Ipv4Lookup, ResolveError>
[src]
pub async fn ipv4_lookup<N: IntoName>(
&self,
query: N
) -> Result<Ipv4Lookup, ResolveError>
[src]Performs a lookup for the associated type.
hint queries that end with a ‘.’ are fully qualified names and are cheaper lookups
Arguments
query
- a string which parses to a domain name, failure to parse will return an error
pub async fn ipv6_lookup<N: IntoName>(
&self,
query: N
) -> Result<Ipv6Lookup, ResolveError>
[src]
pub async fn ipv6_lookup<N: IntoName>(
&self,
query: N
) -> Result<Ipv6Lookup, ResolveError>
[src]Performs a lookup for the associated type.
hint queries that end with a ‘.’ are fully qualified names and are cheaper lookups
Arguments
query
- a string which parses to a domain name, failure to parse will return an error
pub async fn mx_lookup<N: IntoName>(
&self,
query: N
) -> Result<MxLookup, ResolveError>
[src]
pub async fn mx_lookup<N: IntoName>(
&self,
query: N
) -> Result<MxLookup, ResolveError>
[src]Performs a lookup for the associated type.
hint queries that end with a ‘.’ are fully qualified names and are cheaper lookups
Arguments
query
- a string which parses to a domain name, failure to parse will return an error
pub async fn ns_lookup<N: IntoName>(
&self,
query: N
) -> Result<NsLookup, ResolveError>
[src]
pub async fn ns_lookup<N: IntoName>(
&self,
query: N
) -> Result<NsLookup, ResolveError>
[src]Performs a lookup for the associated type.
hint queries that end with a ‘.’ are fully qualified names and are cheaper lookups
Arguments
query
- a string which parses to a domain name, failure to parse will return an error
pub async fn soa_lookup<N: IntoName>(
&self,
query: N
) -> Result<SoaLookup, ResolveError>
[src]
pub async fn soa_lookup<N: IntoName>(
&self,
query: N
) -> Result<SoaLookup, ResolveError>
[src]Performs a lookup for the associated type.
hint queries that end with a ‘.’ are fully qualified names and are cheaper lookups
Arguments
query
- a string which parses to a domain name, failure to parse will return an error
pub async fn srv_lookup<N: IntoName>(
&self,
query: N
) -> Result<SrvLookup, ResolveError>
[src]
pub async fn srv_lookup<N: IntoName>(
&self,
query: N
) -> Result<SrvLookup, ResolveError>
[src]Performs a lookup for the associated type.
hint queries that end with a ‘.’ are fully qualified names and are cheaper lookups
Arguments
query
- a string which parses to a domain name, failure to parse will return an error
pub async fn tlsa_lookup<N: IntoName>(
&self,
query: N
) -> Result<TlsaLookup, ResolveError>
[src]
pub async fn tlsa_lookup<N: IntoName>(
&self,
query: N
) -> Result<TlsaLookup, ResolveError>
[src]Performs a lookup for the associated type.
hint queries that end with a ‘.’ are fully qualified names and are cheaper lookups
Arguments
query
- a string which parses to a domain name, failure to parse will return an error
pub async fn txt_lookup<N: IntoName>(
&self,
query: N
) -> Result<TxtLookup, ResolveError>
[src]
pub async fn txt_lookup<N: IntoName>(
&self,
query: N
) -> Result<TxtLookup, ResolveError>
[src]Performs a lookup for the associated type.
hint queries that end with a ‘.’ are fully qualified names and are cheaper lookups
Arguments
query
- a string which parses to a domain name, failure to parse will return an error
Trait Implementations
impl<C: Clone + DnsHandle<Error = ResolveError>, P: Clone + ConnectionProvider<Conn = C>> Clone for AsyncResolver<C, P>
[src]
impl<C: Clone + DnsHandle<Error = ResolveError>, P: Clone + ConnectionProvider<Conn = C>> Clone for AsyncResolver<C, P>
[src]fn clone(&self) -> AsyncResolver<C, P>
[src]
fn clone(&self) -> AsyncResolver<C, P>
[src]Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]Performs copy-assignment from source
. Read more
impl<C: DnsHandle<Error = ResolveError>, P: ConnectionProvider<Conn = C>> Debug for AsyncResolver<C, P>
[src]
impl<C: DnsHandle<Error = ResolveError>, P: ConnectionProvider<Conn = C>> Debug for AsyncResolver<C, P>
[src]Auto Trait Implementations
impl<C, P> !RefUnwindSafe for AsyncResolver<C, P>
impl<C, P> Send for AsyncResolver<C, P>
impl<C, P> Sync for AsyncResolver<C, P>
impl<C, P> Unpin for AsyncResolver<C, P>
impl<C, P> !UnwindSafe for AsyncResolver<C, P>
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,