Struct ResolverOpts  
#[non_exhaustive]pub struct ResolverOpts {Show 22 fields
    pub ndots: usize,
    pub timeout: Duration,
    pub attempts: usize,
    pub check_names: bool,
    pub edns0: bool,
    pub validate: bool,
    pub ip_strategy: LookupIpStrategy,
    pub cache_size: usize,
    pub use_hosts_file: ResolveHosts,
    pub positive_min_ttl: Option<Duration>,
    pub negative_min_ttl: Option<Duration>,
    pub positive_max_ttl: Option<Duration>,
    pub negative_max_ttl: Option<Duration>,
    pub num_concurrent_reqs: usize,
    pub preserve_intermediates: bool,
    pub try_tcp_on_error: bool,
    pub server_ordering_strategy: ServerOrderingStrategy,
    pub recursion_desired: bool,
    pub avoid_local_udp_ports: Arc<HashSet<u16>>,
    pub os_port_selection: bool,
    pub case_randomization: bool,
    pub trust_anchor: Option<PathBuf>,
}dns only.Expand description
Configuration for the Resolver
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.ndots: usizeSets the number of dots that must appear (unless it’s a final dot representing the root)
before a query is assumed 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: DurationSpecify the timeout for a request. Defaults to 5 seconds
attempts: usizeNumber of retries after lookup failure before giving up. Defaults to 2
check_names: boolValidate the names in the response, not implemented don’t really see the point unless you need to support badly configured DNS
edns0: boolEnable edns, for larger records
validate: boolUse DNSSEC to validate the request
ip_strategy: LookupIpStrategyThe ip_strategy for the Resolver to use when lookup Ipv4 or Ipv6 addresses
cache_size: usizeCache size is in number of records (some records can be large)
use_hosts_file: ResolveHostsCheck /etc/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 negative 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 negative 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.
num_concurrent_reqs: usizeNumber of concurrent requests per query
Where more than one nameserver is configured, this configures the resolver to send queries to a number of servers in parallel. Defaults to 2; 0 or 1 will execute requests serially.
preserve_intermediates: boolPreserve all intermediate records in the lookup response, such as CNAME records
try_tcp_on_error: boolTry queries over TCP if they fail over UDP.
server_ordering_strategy: ServerOrderingStrategyThe server ordering strategy that the resolver should use.
recursion_desired: boolRequest upstream recursive resolvers to not perform any recursion.
This is true by default, disabling this is useful for requesting single records, but may prevent successful resolution.
avoid_local_udp_ports: Arc<HashSet<u16>>Local UDP ports to avoid when making outgoing queries
os_port_selection: boolRequest UDP bind ephemeral ports directly from the OS
Boolean parameter to specify whether to use the operating system’s standard UDP port selection logic instead of Hickory’s logic to securely select a random source port. We do not recommend using this option unless absolutely necessary, as the operating system may select ephemeral ports from a smaller range than Hickory, which can make response poisoning attacks easier to conduct. Some operating systems (notably, Windows) might display a user-prompt to allow a Hickory-specified port to be used, and setting this option will prevent those prompts from being displayed. If os_port_selection is true, avoid_local_udp_ports will be ignored.
case_randomization: boolEnable case randomization.
Randomize the case of letters in query names, and require that responses preserve the case of the query name, in order to mitigate spoofing attacks. This is only applied over UDP.
This implements the mechanism described in draft-vixie-dnsext-dns0x20-00.
trust_anchor: Option<PathBuf>Path to a DNSSEC trust anchor file.
If this is provided, validate will automatically be set to true, enabling DNSSEC validation.
Trait Implementations§
§impl Clone for ResolverOpts
 
impl Clone for ResolverOpts
§fn clone(&self) -> ResolverOpts
 
fn clone(&self) -> ResolverOpts
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
 
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for ResolverOpts
 
impl Debug for ResolverOpts
§impl Default for ResolverOpts
 
impl Default for ResolverOpts
§fn default() -> ResolverOpts
 
fn default() -> ResolverOpts
Default values for the Resolver configuration.
This follows the resolv.conf defaults as defined in the Linux man pages
Auto Trait Implementations§
impl Freeze for ResolverOpts
impl RefUnwindSafe for ResolverOpts
impl Send for ResolverOpts
impl Sync for ResolverOpts
impl Unpin for ResolverOpts
impl UnwindSafe for ResolverOpts
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
    T: 'a,
 
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
    T: 'a,
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
    T: 'a,
 
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
    T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
    T: 'a,
 
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
    T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
    T: 'a,
 
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
    T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
    T: ?Sized,
 
impl<T> BorrowMut<T> for Twhere
    T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
 
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
    T: Clone,
 
impl<T> CloneToUninit for Twhere
    T: Clone,
§impl<T> Instrument for T
 
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
 
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
 
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
 
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
 
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more