Struct domain::resolv::Resolver[][src]

pub struct Resolver(_);

Access to a DNS resolver.

This type collects all information making it possible to start DNS queries. You can create a new resoler using the system’s configuration using the new() associate function or using your own configuration with from_conf(). Either function will spawn everything necessary into a tokio_core reactor core represented by a handle.

Resolver values can be cloned relatively cheaply as they keep all information behind an arc. This is may already be useful when starting a query using the query() method. Since queries need their own copy of resolver, the method consumes the resolver leaving it to clone it if you need it later on or saving a clone if you don’t.

If you want to run a single query or lookup on a resolver synchronously, you can safe yourself all the boiler plate of creating a reactor core (even if this is nowhere near as dangerous as it sounds) and resolver by using the run() or run_with_conf() associated functions.


impl Resolver

Creates a new resolver using the system’s default configuration.

All the networking components of the resolver will be spawned into the reactor core referenced by reactor.

Creates a new resolver using the given configuration.

All the components of the resolver will be spawned into the reactor referenced by reactor.

Trades the resolver for a DNS query.

This starts a query for something that can be turned into a question. In particular, both a tripel of a domain name, record type, and class as well as a pair of domain name and record type can be turned into a question, the latter assuming the class IN.

If you need to keep the resolver, clone it before calling query().

Returns a reference to the configuration of this resolver.

Returns a reference to the configuration options of this resolver.

impl Resolver

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 Resolver and returning a future. Whatever that future resolves to will be returned.

Synchronously perform a DNS operation atop a configuredresolver.

This is like run() but also takes a resolver configuration for tailor-making your own resolver.

Trait Implementations

impl Clone for Resolver

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Debug for Resolver

Formats the value using the given formatter. Read more

Auto Trait Implementations

impl Send for Resolver

impl Sync for Resolver