libp2p::dns

Struct ResolverOpts

#[non_exhaustive]
pub struct ResolverOpts {
Show 22 fields pub ndots: usize, pub timeout: Duration, pub attempts: usize, pub rotate: bool, 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 authentic_data: bool, pub shuffle_dns_servers: bool, pub avoid_local_udp_ports: Arc<HashSet<u16>>,
}
Available on crate feature dns only.
Expand description

Configuration for the Resolver

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§ndots: usize

Sets 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: Duration

Specify the timeout for a request. Defaults to 5 seconds

§attempts: usize

Number of retries after lookup failure before giving up. Defaults to 2

§rotate: bool

Rotate through the resource records in the response (if there is more than one for a given name)

§check_names: bool

Validate the names in the response, not implemented don’t really see the point unless you need to support badly configured DNS

§edns0: bool

Enable edns, for larger records

§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: ResolveHosts

Check /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: usize

Number 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: bool

Preserve all intermediate records in the lookup response, such as CNAME records

§try_tcp_on_error: bool

Try queries over TCP if they fail over UDP.

§server_ordering_strategy: ServerOrderingStrategy

The server ordering strategy that the resolver should use.

§recursion_desired: bool

Request 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.

§authentic_data: bool

This is true by default, disabling this is useful for requesting single records, but may prevent successful resolution.

§shuffle_dns_servers: bool

Shuffle DNS servers before each query.

§avoid_local_udp_ports: Arc<HashSet<u16>>

Local UDP ports to avoid when making outgoing queries

Trait Implementations§

§

impl Clone for ResolverOpts

§

fn clone(&self) -> ResolverOpts

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl Debug for ResolverOpts

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl Default for 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§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> ErasedDestructor for T
where T: 'static,

§

impl<T> MaybeSendSync for T