pub struct Options { /* private fields */ }
Expand description
Used to configure the behaviour of the resolver.
Implementations§
Source§impl Options
impl Options
Sourcepub fn set_flags(&mut self, flags: Flags) -> &mut Self
pub fn set_flags(&mut self, flags: Flags) -> &mut Self
Set flags controlling the behaviour of the resolver.
Sourcepub fn set_timeout(&mut self, ms: u32) -> &mut Self
pub fn set_timeout(&mut self, ms: u32) -> &mut Self
Set the number of milliseconds each name server is given to respond to a query on the first try. (After the first try, the timeout algorithm becomes more complicated, but scales linearly with the value of timeout). The default is 5000ms.
Sourcepub fn set_tries(&mut self, tries: u32) -> &mut Self
pub fn set_tries(&mut self, tries: u32) -> &mut Self
Set the number of tries the resolver will try contacting each name server before giving up. The default is four tries.
Sourcepub fn set_ndots(&mut self, ndots: u32) -> &mut Self
pub fn set_ndots(&mut self, ndots: u32) -> &mut Self
Set the number of dots which must be present in a domain name for it to be queried for “as is” prior to querying for it with the default domain extensions appended. The default value is 1 unless set otherwise by resolv.conf or the RES_OPTIONS environment variable.
Sourcepub fn set_udp_port(&mut self, udp_port: u16) -> &mut Self
pub fn set_udp_port(&mut self, udp_port: u16) -> &mut Self
Set the UDP port to use for queries. The default value is 53, the standard name service port.
Sourcepub fn set_tcp_port(&mut self, tcp_port: u16) -> &mut Self
pub fn set_tcp_port(&mut self, tcp_port: u16) -> &mut Self
Set the TCP port to use for queries. The default value is 53, the standard name service port.
Sourcepub fn set_domains(&mut self, domains: &[&str]) -> &mut Self
pub fn set_domains(&mut self, domains: &[&str]) -> &mut Self
Set the domains to search, instead of the domains specified in resolv.conf or the domain derived from the kernel hostname variable.
Sourcepub fn set_lookups(&mut self, lookups: &str) -> &mut Self
pub fn set_lookups(&mut self, lookups: &str) -> &mut Self
Set the lookups to perform for host queries. lookups
should be set to a string of the
characters “b” or “f”, where “b” indicates a DNS lookup and “f” indicates a lookup in the
hosts file.
Sourcepub fn set_sock_send_buffer_size(&mut self, size: u32) -> &mut Self
pub fn set_sock_send_buffer_size(&mut self, size: u32) -> &mut Self
Set the socket send buffer size.
Sourcepub fn set_sock_receive_buffer_size(&mut self, size: u32) -> &mut Self
pub fn set_sock_receive_buffer_size(&mut self, size: u32) -> &mut Self
Set the socket receive buffer size.
Sourcepub fn set_rotate(&mut self) -> &mut Self
pub fn set_rotate(&mut self) -> &mut Self
Configure round robin selection of nameservers.
Sourcepub fn set_no_rotate(&mut self) -> &mut Self
pub fn set_no_rotate(&mut self) -> &mut Self
Prevent round robin selection of nameservers.
Sourcepub fn set_ednspsz(&mut self, size: u32) -> &mut Self
pub fn set_ednspsz(&mut self, size: u32) -> &mut Self
Set the EDNS packet size.
Sourcepub fn set_resolvconf_path(&mut self, resolvconf_path: &str) -> &mut Self
pub fn set_resolvconf_path(&mut self, resolvconf_path: &str) -> &mut Self
Set the path to use for reading the resolv.conf file. The resolvconf_path
should be set
to a path string, and will be honoured on *nix like systems. The default is
/etc/resolv.conf.
Sourcepub fn set_hosts_path(&mut self, hosts_path: &str) -> &mut Self
pub fn set_hosts_path(&mut self, hosts_path: &str) -> &mut Self
Set the path to use for reading the hosts file. The hosts_path
should be set to a path
string, and will be honoured on *nix like systems. The default is /etc/hosts.
Sourcepub fn set_udp_max_queries(&mut self, udp_max_queries: i32) -> &mut Self
pub fn set_udp_max_queries(&mut self, udp_max_queries: i32) -> &mut Self
Set the maximum number of udp queries that can be sent on a single ephemeral port to a given DNS server before a new ephemeral port is assigned. Any value of 0 or less will be considered unlimited, and is the default.
Sourcepub fn set_max_timeout(&mut self, max_timeout: i32) -> &mut Self
pub fn set_max_timeout(&mut self, max_timeout: i32) -> &mut Self
Set the upper bound for timeout between sequential retry attempts, in milliseconds. When retrying queries, the timeout is increased from the requested timeout parameter, this caps the value.
Sourcepub fn set_query_cache_max_ttl(&mut self, qcache_max_ttl: u32) -> &mut Self
pub fn set_query_cache_max_ttl(&mut self, qcache_max_ttl: u32) -> &mut Self
Enable the built-in query cache. Will cache queries based on the returned TTL in the DNS message. Only fully successful and NXDOMAIN query results will be cached.
The provided value is the maximum number of seconds a query result may be cached; this will override a larger TTL in the response message. This must be a non-zero value otherwise the cache will be disabled.
Sourcepub fn set_server_failover_options(
&mut self,
server_failover_options: &ServerFailoverOptions,
) -> &mut Self
pub fn set_server_failover_options( &mut self, server_failover_options: &ServerFailoverOptions, ) -> &mut Self
Set server failover options.
When a DNS server fails to respond to a query, c-ares will deprioritize the server. On
subsequent queries, servers with fewer consecutive failures will be selected in preference.
However, in order to detect when such a server has recovered, c-ares will occasionally
retry failed servers. c_ares::ServerFailoverOptions
contains options to control this
behaviour.
If this option is not specified then c-ares will use a retry chance of 10% and a minimum delay of 5 seconds.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Options
impl !RefUnwindSafe for Options
impl Send for Options
impl Sync for Options
impl Unpin for Options
impl !UnwindSafe for Options
Blanket Implementations§
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> 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