Struct c_ares_resolver::BlockingResolver
source · pub struct BlockingResolver { /* private fields */ }
Expand description
A blocking DNS resolver.
Implementations§
source§impl BlockingResolver
impl BlockingResolver
sourcepub fn with_options(options: Options) -> Result<Self, Error>
pub fn with_options(options: Options) -> Result<Self, Error>
Create a new BlockingResolver
, with the given Options
.
sourcepub fn set_servers(&self, servers: &[&str]) -> Result<&Self>
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
.
sourcepub fn get_servers(&self) -> AresString
pub fn get_servers(&self) -> AresString
Retrieves the list of servers in comma delimited format.
sourcepub fn set_local_ipv4(&self, ipv4: Ipv4Addr) -> &Self
pub fn set_local_ipv4(&self, ipv4: Ipv4Addr) -> &Self
Set the local IPv4 address from which to make queries.
sourcepub fn set_local_ipv6(&self, ipv6: &Ipv6Addr) -> &Self
pub fn set_local_ipv6(&self, ipv6: &Ipv6Addr) -> &Self
Set the local IPv6 address from which to make queries.
sourcepub fn set_local_device(&self, device: &str) -> &Self
pub fn set_local_device(&self, device: &str) -> &Self
Set the local device from which to make queries.
sourcepub fn set_sortlist(&self, sortlist: &[&str]) -> Result<&Self>
pub fn set_sortlist(&self, sortlist: &[&str]) -> Result<&Self>
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”.
sourcepub fn set_server_state_callback<F>(&self, callback: F) -> &Self
pub fn set_server_state_callback<F>(&self, callback: F) -> &Self
Set a callback function to be invoked whenever a query on the channel completes.
callback(server, success, flags)
will be called when a query completes.
server
indicates the DNS server that was used for the query.success
indicates whether the query succeeded or not.flags
is a bitmask of flags describing various aspects of the query.
sourcepub fn query_a(&self, name: &str) -> Result<AResults>
pub fn query_a(&self, name: &str) -> Result<AResults>
Look up the A records associated with name
.
sourcepub fn search_a(&self, name: &str) -> Result<AResults>
pub fn search_a(&self, name: &str) -> Result<AResults>
Search for the A records associated with name
.
sourcepub fn query_aaaa(&self, name: &str) -> Result<AAAAResults>
pub fn query_aaaa(&self, name: &str) -> Result<AAAAResults>
Look up the AAAA records associated with name
.
sourcepub fn search_aaaa(&self, name: &str) -> Result<AAAAResults>
pub fn search_aaaa(&self, name: &str) -> Result<AAAAResults>
Search for the AAAA records associated with name
.
sourcepub fn query_caa(&self, name: &str) -> Result<CAAResults>
pub fn query_caa(&self, name: &str) -> Result<CAAResults>
Look up the CAA records associated with name
.
sourcepub fn search_caa(&self, name: &str) -> Result<CAAResults>
pub fn search_caa(&self, name: &str) -> Result<CAAResults>
Search for the CAA records associated with name
.
sourcepub fn query_cname(&self, name: &str) -> Result<CNameResults>
pub fn query_cname(&self, name: &str) -> Result<CNameResults>
Look up the CNAME records associated with name
.
sourcepub fn search_cname(&self, name: &str) -> Result<CNameResults>
pub fn search_cname(&self, name: &str) -> Result<CNameResults>
Search for the CNAME records associated with name
.
sourcepub fn query_mx(&self, name: &str) -> Result<MXResults>
pub fn query_mx(&self, name: &str) -> Result<MXResults>
Look up the MX records associated with name
.
sourcepub fn search_mx(&self, name: &str) -> Result<MXResults>
pub fn search_mx(&self, name: &str) -> Result<MXResults>
Search for the MX records associated with name
.
sourcepub fn query_naptr(&self, name: &str) -> Result<NAPTRResults>
pub fn query_naptr(&self, name: &str) -> Result<NAPTRResults>
Look up the NAPTR records associated with name
.
sourcepub fn search_naptr(&self, name: &str) -> Result<NAPTRResults>
pub fn search_naptr(&self, name: &str) -> Result<NAPTRResults>
Search for the NAPTR records associated with name
.
sourcepub fn query_ns(&self, name: &str) -> Result<NSResults>
pub fn query_ns(&self, name: &str) -> Result<NSResults>
Look up the NS records associated with name
.
sourcepub fn search_ns(&self, name: &str) -> Result<NSResults>
pub fn search_ns(&self, name: &str) -> Result<NSResults>
Search for the NS records associated with name
.
sourcepub fn query_ptr(&self, name: &str) -> Result<PTRResults>
pub fn query_ptr(&self, name: &str) -> Result<PTRResults>
Look up the PTR records associated with name
.
sourcepub fn search_ptr(&self, name: &str) -> Result<PTRResults>
pub fn search_ptr(&self, name: &str) -> Result<PTRResults>
Search for the PTR records associated with name
.
sourcepub fn query_soa(&self, name: &str) -> Result<SOAResult>
pub fn query_soa(&self, name: &str) -> Result<SOAResult>
Look up the SOA records associated with name
.
sourcepub fn search_soa(&self, name: &str) -> Result<SOAResult>
pub fn search_soa(&self, name: &str) -> Result<SOAResult>
Search for the SOA records associated with name
.
sourcepub fn query_srv(&self, name: &str) -> Result<SRVResults>
pub fn query_srv(&self, name: &str) -> Result<SRVResults>
Look up the SRV records associated with name
.
sourcepub fn search_srv(&self, name: &str) -> Result<SRVResults>
pub fn search_srv(&self, name: &str) -> Result<SRVResults>
Search for the SRV records associated with name
.
sourcepub fn query_txt(&self, name: &str) -> Result<TXTResults>
pub fn query_txt(&self, name: &str) -> Result<TXTResults>
Look up the TXT records associated with name
.
sourcepub fn search_txt(&self, name: &str) -> Result<TXTResults>
pub fn search_txt(&self, name: &str) -> Result<TXTResults>
Search for the TXT records associated with name
.
sourcepub fn query_uri(&self, name: &str) -> Result<URIResults>
pub fn query_uri(&self, name: &str) -> Result<URIResults>
Look up the URI records associated with name
.
sourcepub fn search_uri(&self, name: &str) -> Result<URIResults>
pub fn search_uri(&self, name: &str) -> Result<URIResults>
Search for the URI records associated with name
.
sourcepub fn get_host_by_address(&self, address: &IpAddr) -> Result<HostResults>
pub fn get_host_by_address(&self, address: &IpAddr) -> Result<HostResults>
Perform a host query by address.
This method is one of the very few places where this library performs strictly more
allocation than the underlying c-ares
code. If this is a problem for you, you should
prefer to use the analogous method on the Resolver
.
sourcepub fn get_host_by_name(
&self,
name: &str,
family: AddressFamily
) -> Result<HostResults>
pub fn get_host_by_name( &self, name: &str, family: AddressFamily ) -> Result<HostResults>
Perform a host query by name.
This method is one of the very few places where this library performs strictly more
allocation than the underlying c-ares
code. If this is a problem for you, you should
prefer to use the analogous method on the Resolver
.
sourcepub fn get_name_info<F>(
&self,
address: &SocketAddr,
flags: NIFlags
) -> Result<NameInfoResult>
pub fn get_name_info<F>( &self, address: &SocketAddr, flags: NIFlags ) -> Result<NameInfoResult>
Address-to-nodename translation in protocol-independent manner.
This method is one of the very few places where this library performs strictly more
allocation than the underlying c-ares
code. If this is a problem for you, you should
prefer to use the analogous method on the Resolver
.
sourcepub fn query(
&self,
name: &str,
dns_class: u16,
query_type: u16
) -> Result<Vec<u8>>
pub fn query( &self, name: &str, dns_class: u16, query_type: u16 ) -> Result<Vec<u8>>
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
.
This method is one of the very few places where this library performs strictly more
allocation than the underlying c-ares
code. If this is a problem for you, you should
prefer to use the analogous method on the Resolver
.
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.
sourcepub fn search(
&self,
name: &str,
dns_class: u16,
query_type: u16
) -> Result<Vec<u8>>
pub fn search( &self, name: &str, dns_class: u16, query_type: u16 ) -> Result<Vec<u8>>
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
.
This method is one of the very few places where this library performs strictly more
allocation than the underlying c-ares
code. If this is a problem for you, you should
prefer to use the analogous method on the Resolver
.
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.
Auto Trait Implementations§
impl Freeze for BlockingResolver
impl RefUnwindSafe for BlockingResolver
impl Send for BlockingResolver
impl Sync for BlockingResolver
impl Unpin for BlockingResolver
impl UnwindSafe for BlockingResolver
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