[−][src]Struct trust_dns_resolver::Resolver
The Resolver is used for performing DNS queries.
For forward (A) lookups, hostname -> IP address, see: Resolver::lookup_ip
Special note about resource consumption. The Resolver and all TRust-DNS software is built around the Tokio async-io library. This synchronous Resolver is intended to be a simpler wrapper for of the [trust_dns_resolver::ResolverFuture
]. To allow the Resolver to be Send
+ Sync
, the construction of the ResolverFuture
is lazy, this means some of the features of the ResolverFuture
, like performance based resolution via the most efficient NameServer
will be lost (the lookup cache is shared across invocations of the Resolver
). If these other features of the TRust-DNS Resolver are desired, please use the tokio based ResolverFuture
.
Methods
impl Resolver
[src]
impl Resolver
pub fn new(config: ResolverConfig, options: ResolverOpts) -> Result<Self> | [src] |
Constructs a new Resolver with the specified configuration.
Arguments
config
- configuration for the resolveroptions
- resolver options for performing lookupsclient_connection
- ClientConnection for establishing the connection to the DNS server
Returns
A new Resolver or an error if there was an error with the configuration.
pub fn default() -> Result<Self> | [src] |
Constructs a new Resolver with default config and default options.
See [ResolverConfig::default
] and [ResolverOpts::default
] for more information.
Returns
A new Resolver or an error if there was an error with the configuration.
pub fn from_system_conf() -> Result<Self> | [src] |
Constructs a new Resolver with the system configuration.
This will use /etc/resolv.conf
on Unix OSes and the registry on Windows.
pub fn lookup( | [src] |
Generic lookup for any RecordType
WARNING This interface may change in the future, please use [Self::lookup_ip
] or another variant for more stable interfaces.
Arguments
name
- name of the record to lookup, if name is not a valid domain name, an error will be returnedrecord_type
- type of record to lookup
pub fn lookup_ip(&self, host: &str) -> ResolveResult<LookupIp> | [src] |
Performs a dual-stack DNS lookup for the IP for the given hostname.
See the configuration and options parameters for controlling the way in which A(Ipv4) and AAAA(Ipv6) lookups will be performed. For the least expensive query a fully-qualified-domain-name, FQDN, which ends in a final .
, e.g. www.example.com.
, will only issue one query. Anything else will always incur the cost of querying the ResolverConfig::domain
and ResolverConfig::search
.
Arguments
host
- string hostname, if this is an invalid hostname, an error will be returned.
pub fn lookup_service( | [src] |
use lookup_srv instead, this interface is none ideal
Performs a DNS lookup for an SRV record for the specified service type and protocol at the given name.
This is a convenience method over lookup_srv
, it combines the service, protocol and name into a single name: _service._protocol.name
.
Arguments
service
- service to lookup, e.g. ldap or httpprotocol
- wire protocol, e.g. udp or tcpname
- zone or other name at which the service is located.
pub fn lookup_srv(&self, name: &str) -> ResolveResult<SrvLookup> | [src] |
Lookup an SRV record.
pub fn reverse_lookup(&self, query: IpAddr) -> ResolveResult<ReverseLookup> | [src] |
Performs a lookup for the associated type.
Arguments
query
- a type which can be converted toName
viaFrom
.
pub fn ipv4_lookup(&self, query: &str) -> ResolveResult<Ipv4Lookup> | [src] |
Performs a lookup for the associated type.
hint queries that end with a '.' are fully qualified names and are cheaper lookups
Arguments
query
- a str which parses to a domain name, failure to parse will return an error
pub fn ipv6_lookup(&self, query: &str) -> ResolveResult<Ipv6Lookup> | [src] |
Performs a lookup for the associated type.
hint queries that end with a '.' are fully qualified names and are cheaper lookups
Arguments
query
- a str which parses to a domain name, failure to parse will return an error
pub fn mx_lookup(&self, query: &str) -> ResolveResult<MxLookup> | [src] |
Performs a lookup for the associated type.
hint queries that end with a '.' are fully qualified names and are cheaper lookups
Arguments
query
- a str which parses to a domain name, failure to parse will return an error
pub fn srv_lookup(&self, query: &str) -> ResolveResult<SrvLookup> | [src] |
Performs a lookup for the associated type.
hint queries that end with a '.' are fully qualified names and are cheaper lookups
Arguments
query
- a str which parses to a domain name, failure to parse will return an error
pub fn txt_lookup(&self, query: &str) -> ResolveResult<TxtLookup> | [src] |
Performs a lookup for the associated type.
hint queries that end with a '.' are fully qualified names and are cheaper lookups
Arguments
query
- a str which parses to a domain name, failure to parse will return an error
Auto Trait Implementations
Blanket Implementations
impl<T> From for T
[src]
impl<T> From for T
impl<T, U> Into for T where
U: From<T>,
[src]
impl<T, U> Into for T where
U: From<T>,
impl<T, U> TryFrom for T where
T: From<U>,
[src]
impl<T, U> TryFrom for T where
T: From<U>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error> | [src] |
impl<T> Borrow for T where
T: ?Sized,
[src]
impl<T> Borrow for T where
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
impl<T> Any for T where
T: 'static + ?Sized,
fn get_type_id(&self) -> TypeId | [src] |
impl<T> BorrowMut for T where
T: ?Sized,
[src]
impl<T> BorrowMut for T where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T | [src] |
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error> | [src] |
impl<T> Erased for T
impl<T> Erased for T