Struct c_ares_resolver::Resolver [−][src]
pub struct Resolver { /* fields omitted */ }
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
.
Methods
impl Resolver
[src]
impl Resolver
pub fn new() -> Result<Resolver, Error>
[src]
pub fn new() -> Result<Resolver, Error>
Create a new Resolver
, using default Options
.
pub fn with_options(options: Options) -> Result<Resolver, Error>
[src]
pub fn with_options(options: Options) -> Result<Resolver, Error>
Create a new Resolver
, with the given Options
.
pub fn set_servers(&self, servers: &[&str]) -> Result<&Self>
[src]
pub fn set_servers(&self, servers: &[&str]) -> Result<&Self>
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
.
pub fn set_local_ipv4(&self, ipv4: Ipv4Addr) -> &Self
[src]
pub fn set_local_ipv4(&self, ipv4: Ipv4Addr) -> &Self
Set the local IPv4 address from which to make queries.
pub fn set_local_ipv6(&self, ipv6: &Ipv6Addr) -> &Self
[src]
pub fn set_local_ipv6(&self, ipv6: &Ipv6Addr) -> &Self
Set the local IPv6 address from which to make queries.
pub fn set_local_device(&self, device: &str) -> &Self
[src]
pub fn set_local_device(&self, device: &str) -> &Self
Set the local device from which to make queries.
pub fn query_a<F>(&self, name: &str, handler: F) where
F: FnOnce(Result<AResults>) + Send + 'static,
[src]
pub fn query_a<F>(&self, name: &str, handler: F) where
F: FnOnce(Result<AResults>) + Send + 'static,
Look up the A records associated with name
.
On completion, handler
is called with the result.
pub fn search_a<F>(&self, name: &str, handler: F) where
F: FnOnce(Result<AResults>) + Send + 'static,
[src]
pub fn search_a<F>(&self, name: &str, handler: F) where
F: FnOnce(Result<AResults>) + Send + 'static,
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,
[src]
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,
[src]
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.
pub fn query_cname<F>(&self, name: &str, handler: F) where
F: FnOnce(Result<CNameResults>) + Send + 'static,
[src]
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,
[src]
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.
pub fn query_mx<F>(&self, name: &str, handler: F) where
F: FnOnce(Result<MXResults>) + Send + 'static,
[src]
pub fn query_mx<F>(&self, name: &str, handler: F) where
F: FnOnce(Result<MXResults>) + Send + 'static,
Look up the MX records associated with name
.
On completion, handler
is called with the result.
pub fn search_mx<F>(&self, name: &str, handler: F) where
F: FnOnce(Result<MXResults>) + Send + 'static,
[src]
pub fn search_mx<F>(&self, name: &str, handler: F) where
F: FnOnce(Result<MXResults>) + Send + 'static,
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,
[src]
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,
[src]
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.
pub fn query_ns<F>(&self, name: &str, handler: F) where
F: FnOnce(Result<NSResults>) + Send + 'static,
[src]
pub fn query_ns<F>(&self, name: &str, handler: F) where
F: FnOnce(Result<NSResults>) + Send + 'static,
Look up the NS records associated with name
.
On completion, handler
is called with the result.
pub fn search_ns<F>(&self, name: &str, handler: F) where
F: FnOnce(Result<NSResults>) + Send + 'static,
[src]
pub fn search_ns<F>(&self, name: &str, handler: F) where
F: FnOnce(Result<NSResults>) + Send + 'static,
Search for the NS records associated with name
.
On completion, handler
is called with the result.
pub fn query_ptr<F>(&self, name: &str, handler: F) where
F: FnOnce(Result<PTRResults>) + Send + 'static,
[src]
pub fn query_ptr<F>(&self, name: &str, handler: F) where
F: FnOnce(Result<PTRResults>) + Send + 'static,
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,
[src]
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.
pub fn query_soa<F>(&self, name: &str, handler: F) where
F: FnOnce(Result<SOAResult>) + Send + 'static,
[src]
pub fn query_soa<F>(&self, name: &str, handler: F) where
F: FnOnce(Result<SOAResult>) + Send + 'static,
Look up the SOA record associated with name
.
On completion, handler
is called with the result.
pub fn search_soa<F>(&self, name: &str, handler: F) where
F: FnOnce(Result<SOAResult>) + Send + 'static,
[src]
pub fn search_soa<F>(&self, name: &str, handler: F) where
F: FnOnce(Result<SOAResult>) + Send + 'static,
Search for the SOA record associated with name
.
On completion, handler
is called with the result.
pub fn query_srv<F>(&self, name: &str, handler: F) where
F: FnOnce(Result<SRVResults>) + Send + 'static,
[src]
pub fn query_srv<F>(&self, name: &str, handler: F) where
F: FnOnce(Result<SRVResults>) + Send + 'static,
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,
[src]
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.
pub fn query_txt<F>(&self, name: &str, handler: F) where
F: FnOnce(Result<TXTResults>) + Send + 'static,
[src]
pub fn query_txt<F>(&self, name: &str, handler: F) where
F: FnOnce(Result<TXTResults>) + Send + 'static,
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,
[src]
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.
pub fn get_host_by_address<F>(&self, address: &IpAddr, handler: F) where
F: FnOnce(Result<HostResults>) + Send + 'static,
[src]
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,
[src]
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,
[src]
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.
pub fn query<F>(&self, name: &str, dns_class: u16, query_type: u16, handler: F) where
F: FnOnce(Result<&[u8]>) + Send + 'static,
[src]
pub fn query<F>(&self, name: &str, dns_class: u16, query_type: u16, handler: F) where
F: FnOnce(Result<&[u8]>) + Send + 'static,
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.
pub fn search<F>(&self, name: &str, dns_class: u16, query_type: u16, handler: F) where
F: FnOnce(Result<&[u8]>) + Send + 'static,
[src]
pub fn search<F>(&self, name: &str, dns_class: u16, query_type: u16, handler: F) where
F: FnOnce(Result<&[u8]>) + Send + 'static,
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.
pub fn cancel(&self)
[src]
pub fn cancel(&self)
Cancel all requests made on this Resolver
.