pub struct ResolverOpts {
    pub ndots: usize,
    pub timeout: Duration,
    pub attempts: usize,
    pub validate: bool,
    pub ip_strategy: LookupIpStrategy,
    pub cache_size: usize,
    pub use_hosts_file: bool,
    pub positive_min_ttl: Option<Duration>,
    pub negative_min_ttl: Option<Duration>,
    pub positive_max_ttl: Option<Duration>,
    pub negative_max_ttl: Option<Duration>,
    /* private fields */
}
Expand description

Configuration for the Resolver

Fields

ndots: usize

Sets the number of dots that must appear (unless it’s a final dot representing the root) that must appear before a query is assumted to include the TLD. The default is one, which means that www would never be assumed to be a TLD, and would always be appended to either the search

timeout: Duration

Specify the timeout for a request. Defaults to 5 seconds

attempts: usize

Number of attempts before giving up. Defaults to 2

validate: bool

Use DNSSec to validate the request

ip_strategy: LookupIpStrategy

The ip_strategy for the Resolver to use when lookup Ipv4 or Ipv6 addresses

cache_size: usize

Cache size is in number of records (some records can be large)

use_hosts_file: bool

Check /ect/hosts file before dns requery (only works for unix like OS)

positive_min_ttl: Option<Duration>

Optional minimum TTL for positive responses.

If this is set, any positive responses with a TTL lower than this value will have a TTL of positive_min_ttl instead. Otherwise, this will default to 0 seconds.

negative_min_ttl: Option<Duration>

Optional minimum TTL for negative (NXDOMAIN) responses.

If this is set, any positive responses with a TTL lower than this value will have a TTL of negative_min_ttl instead. Otherwise, this will default to 0 seconds.

positive_max_ttl: Option<Duration>

Optional maximum TTL for positive responses.

If this is set, any positive responses with a TTL higher than this value will have a TTL of positive_max_ttl instead. Otherwise, this will default to MAX_TTL seconds.

negative_max_ttl: Option<Duration>

Optional maximum TTL for negative (NXDOMAIN) responses.

If this is set, any positive responses with a TTL higher than this value will have a TTL of negative_max_ttl instead. Otherwise, this will default to MAX_TTL seconds.

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more

Default values for the Reolver configuration.

This follows the resolv.conf defaults as defined in the Linux man pages

This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

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

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
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.