Struct dnsoverhttps::Client
[−]
[src]
pub struct Client { /* fields omitted */ }
A DoH client
It will use the configured DoH server to send all resolve queries to.
Example
let client = dnsoverhttps::Client::from_url("https://1.1.1.1/dns-query").unwrap(); let addr = client.resolve_host("example.com");
Methods
impl Client
[src]
pub fn from_url(url: &str) -> Result<Client, Error>
[src]
Create a new DoH client using the given query URL.
The URL's host will be resolved using the system's resolver.
The host will be queried using a POST
request using the application/dns-message
content-type for the body.
pub fn from_url_with_hostname(url: &str, host: String) -> Result<Client, Error>
[src]
Create a new DoH client using the given query URL and host.
This should be used to bootstrap DoH resolving without the system's resolver. The URL can
contain the host's IP and the hostname is used in the HTTP request.
The host will be queried using a POST
request using the application/dns-message
content-type for the body.
Caution
This will disable hostname verification of the TLS server certificate. The certificate is still checked for validity.
pub fn resolve_host(&self, host: &str) -> Result<Vec<IpAddr>, Error>
[src]
Resolve the host specified by host
as a list of IpAddr
.
This method queries the configured server over HTTPS for both IPv4 and IPv6 addresses.
If the host cannot be found, the list will be empty. If any errors are encountered during the resolving, the error is returned.