Struct trust_dns_resolver::Resolver[][src]

pub struct Resolver { /* fields omitted */ }
Expand description

The Resolver is used for performing DNS queries.

For forward (A) lookups, hostname -> IP address, see: Resolver::lookup_ip

Special note about resource consumption. The Resolver and all Trust-DNS software is built around the Tokio async-io library. This synchronous Resolver is intended to be a simpler wrapper for of the AsyncResolver. To allow the Resolver to be Send + Sync, the construction of the AsyncResolver is lazy, this means some of the features of the AsyncResolver, like performance based resolution via the most efficient NameServer will be lost (the lookup cache is shared across invocations of the Resolver). If these other features of the Trust-DNS Resolver are desired, please use the tokio based AsyncResolver.

Note: Threaded/Sync usage: In multithreaded scenarios, the internal Tokio Runtime will block on an internal Mutex for the tokio Runtime in use. For higher performance, it’s recommended to use the AsyncResolver.

Implementations

Constructs a new Resolver with the specified configuration.

Arguments
  • config - configuration for the resolver
  • options - resolver options for performing lookups
Returns

A new Resolver or an error if there was an error with the configuration.

Constructs a new Resolver with default config and default options.

See ResolverConfig::default and ResolverOpts::default for more information.

Returns

A new Resolver or an error if there was an error with the configuration.

Constructs a new Resolver with the system configuration.

This will use /etc/resolv.conf on Unix OSes and the registry on Windows.

Generic lookup for any RecordType

WARNING This interface may change in the future, please use Self::lookup_ip or another variant for more stable interfaces.

Arguments
  • name - name of the record to lookup, if name is not a valid domain name, an error will be returned
  • record_type - type of record to lookup

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.

Performs a lookup for the associated type.

Arguments
  • query - a type which can be converted to Name via From.

Performs a lookup for the associated type.

hint queries that end with a ‘.’ are fully qualified names and are cheaper lookups

Arguments
  • query - a &str which parses to a domain name, failure to parse will return an error

Performs a lookup for the associated type.

hint queries that end with a ‘.’ are fully qualified names and are cheaper lookups

Arguments
  • query - a &str which parses to a domain name, failure to parse will return an error

Performs a lookup for the associated type.

hint queries that end with a ‘.’ are fully qualified names and are cheaper lookups

Arguments
  • query - a &str which parses to a domain name, failure to parse will return an error

Performs a lookup for the associated type.

hint queries that end with a ‘.’ are fully qualified names and are cheaper lookups

Arguments
  • query - a &str which parses to a domain name, failure to parse will return an error

Performs a lookup for the associated type.

hint queries that end with a ‘.’ are fully qualified names and are cheaper lookups

Arguments
  • query - a &str which parses to a domain name, failure to parse will return an error

Performs a lookup for the associated type.

hint queries that end with a ‘.’ are fully qualified names and are cheaper lookups

Arguments
  • query - a &str which parses to a domain name, failure to parse will return an error

Performs a lookup for the associated type.

hint queries that end with a ‘.’ are fully qualified names and are cheaper lookups

Arguments
  • query - a &str which parses to a domain name, failure to parse will return an error

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.