Struct c_ares_resolver::Resolver [−][src]
pub struct Resolver { /* fields omitted */ }
Expand description
An asynchronous DNS resolver, which returns results via callbacks.
Note that dropping the resolver will cause all outstanding requests to fail with result
c_ares::Error::EDESTRUCTION
.
Implementations
Create a new Resolver
, with the given Options
.
Set the list of servers to contact, instead of the servers specified in resolv.conf or the local named.
String format is host[:port]
. IPv6 addresses with ports require square brackets eg
[2001:4860:4860::8888]:53
.
Set the local IPv4 address from which to make queries.
Set the local IPv6 address from which to make queries.
Set the local device from which to make queries.
Initializes an address sortlist configuration, so that addresses returned by
get_host_by_name()
are sorted according to the sortlist.
Each element of the sortlist holds an IP-address/netmask pair. The netmask is optional but follows the address after a slash if present. For example: “130.155.160.0/255.255.240.0”, or “130.155.0.0”.
Look up the A records associated with name
.
On completion, handler
is called with the result.
Search for the A records associated with name
.
On completion, handler
is called with the result.
pub fn query_aaaa<F>(&self, name: &str, handler: F) where
F: FnOnce(Result<AAAAResults>) + Send + 'static,
pub fn query_aaaa<F>(&self, name: &str, handler: F) where
F: FnOnce(Result<AAAAResults>) + Send + 'static,
Look up the AAAA records associated with name
.
On completion, handler
is called with the result.
pub fn search_aaaa<F>(&self, name: &str, handler: F) where
F: FnOnce(Result<AAAAResults>) + Send + 'static,
pub fn search_aaaa<F>(&self, name: &str, handler: F) where
F: FnOnce(Result<AAAAResults>) + Send + 'static,
Search for the AAAA records associated with name
.
On completion, handler
is called with the result.
Look up the CAA records associated with name
.
On completion, handler
is called with the result.
pub fn search_caa<F>(&self, name: &str, handler: F) where
F: FnOnce(Result<CAAResults>) + Send + 'static,
pub fn search_caa<F>(&self, name: &str, handler: F) where
F: FnOnce(Result<CAAResults>) + Send + 'static,
Search for the CAA records associated with name
.
On completion, handler
is called with the result.
pub fn query_cname<F>(&self, name: &str, handler: F) where
F: FnOnce(Result<CNameResults>) + Send + 'static,
pub fn query_cname<F>(&self, name: &str, handler: F) where
F: FnOnce(Result<CNameResults>) + Send + 'static,
Look up the CNAME records associated with name
.
On completion, handler
is called with the result.
pub fn search_cname<F>(&self, name: &str, handler: F) where
F: FnOnce(Result<CNameResults>) + Send + 'static,
pub fn search_cname<F>(&self, name: &str, handler: F) where
F: FnOnce(Result<CNameResults>) + Send + 'static,
Search for the CNAME records associated with name
.
On completion, handler
is called with the result.
Look up the MX records associated with name
.
On completion, handler
is called with the result.
Search for the MX records associated with name
.
On completion, handler
is called with the result.
pub fn query_naptr<F>(&self, name: &str, handler: F) where
F: FnOnce(Result<NAPTRResults>) + Send + 'static,
pub fn query_naptr<F>(&self, name: &str, handler: F) where
F: FnOnce(Result<NAPTRResults>) + Send + 'static,
Look up the NAPTR records associated with name
.
On completion, handler
is called with the result.
pub fn search_naptr<F>(&self, name: &str, handler: F) where
F: FnOnce(Result<NAPTRResults>) + Send + 'static,
pub fn search_naptr<F>(&self, name: &str, handler: F) where
F: FnOnce(Result<NAPTRResults>) + Send + 'static,
Search for the NAPTR records associated with name
.
On completion, handler
is called with the result.
Look up the NS records associated with name
.
On completion, handler
is called with the result.
Search for the NS records associated with name
.
On completion, handler
is called with the result.
Look up the PTR records associated with name
.
On completion, handler
is called with the result.
pub fn search_ptr<F>(&self, name: &str, handler: F) where
F: FnOnce(Result<PTRResults>) + Send + 'static,
pub fn search_ptr<F>(&self, name: &str, handler: F) where
F: FnOnce(Result<PTRResults>) + Send + 'static,
Search for the PTR records associated with name
.
On completion, handler
is called with the result.
Look up the SOA record associated with name
.
On completion, handler
is called with the result.
Search for the SOA record associated with name
.
On completion, handler
is called with the result.
Look up the SRV records associated with name
.
On completion, handler
is called with the result.
pub fn search_srv<F>(&self, name: &str, handler: F) where
F: FnOnce(Result<SRVResults>) + Send + 'static,
pub fn search_srv<F>(&self, name: &str, handler: F) where
F: FnOnce(Result<SRVResults>) + Send + 'static,
Search for the SRV records associated with name
.
On completion, handler
is called with the result.
Look up the TXT records associated with name
.
On completion, handler
is called with the result.
pub fn search_txt<F>(&self, name: &str, handler: F) where
F: FnOnce(Result<TXTResults>) + Send + 'static,
pub fn search_txt<F>(&self, name: &str, handler: F) where
F: FnOnce(Result<TXTResults>) + Send + 'static,
Search for the TXT records associated with name
.
On completion, handler
is called with the result.
Look up the URI records associated with name
.
On completion, handler
is called with the result.
pub fn search_uri<F>(&self, name: &str, handler: F) where
F: FnOnce(Result<URIResults>) + Send + 'static,
pub fn search_uri<F>(&self, name: &str, handler: F) where
F: FnOnce(Result<URIResults>) + Send + 'static,
Search for the URI records associated with name
.
On completion, handler
is called with the result.
pub fn get_host_by_address<F>(&self, address: &IpAddr, handler: F) where
F: FnOnce(Result<HostResults<'_>>) + Send + 'static,
pub fn get_host_by_address<F>(&self, address: &IpAddr, handler: F) where
F: FnOnce(Result<HostResults<'_>>) + Send + 'static,
Perform a host query by address.
On completion, handler
is called with the result.
pub fn get_host_by_name<F>(&self, name: &str, family: AddressFamily, handler: F) where
F: FnOnce(Result<HostResults<'_>>) + Send + 'static,
pub fn get_host_by_name<F>(&self, name: &str, family: AddressFamily, handler: F) where
F: FnOnce(Result<HostResults<'_>>) + Send + 'static,
Perform a host query by name.
On completion, handler
is called with the result.
pub fn get_name_info<F>(&self, address: &SocketAddr, flags: NIFlags, handler: F) where
F: FnOnce(Result<NameInfoResult<'_>>) + Send + 'static,
pub fn get_name_info<F>(&self, address: &SocketAddr, flags: NIFlags, handler: F) where
F: FnOnce(Result<NameInfoResult<'_>>) + Send + 'static,
Address-to-nodename translation in protocol-independent manner.
On completion, handler
is called with the result.
Initiate a single-question DNS query for name
. The class and type of the query are per
the provided parameters, taking values as defined in arpa/nameser.h
.
On completion, handler
is called with the result.
This method is provided so that users can query DNS types for which c-ares
does not
provide a parser; or in case a third-party parser is preferred. Usually, if a suitable
query_xxx()
is available, that should be used.
Initiate a series of single-question DNS queries for name
. The class and type of the
query are per the provided parameters, taking values as defined in arpa/nameser.h
.
On completion, handler
is called with the result.
This method is provided so that users can search DNS types for which c-ares
does not
provide a parser; or in case a third-party parser is preferred. Usually, if a suitable
search_xxx()
is available, that should be used.