Struct trust_dns_resolver::Resolver
[−]
[src]
pub struct Resolver { /* fields omitted */ }
The Resolver is used for performing DNS queries.
For forward (A) lookups, hostname -> IP address, see: Resolver::lookup_ip
Methods
impl Resolver
[src]
fn new(config: ResolverConfig, options: ResolverOpts) -> Result<Self>
Construct a new Resolver with the given ClientConnection, see UdpClientConnection and/or TcpCLientConnection
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
fn lookup_ip(&mut self, host: &str) -> Result<LookupIp>
Performs a DNS lookup for the IP for the given hostname.
Based on the configuration and options passed in, this may do either a A or a AAAA lookup, returning IpV4 or IpV6 addresses. (Note: current release only queries A, IPv4)
Arguments
host
- string hostname, if this is an invalid hostname, an error will be thrown. Currently this must be a FQDN, with a trailing.
, e.g.www.example.com.
. This will be fixed in a future release.