DNS over HTTPS
DNS over HTTPS (DoH) uses the HTTPS protocol for DNS resolution, providing improved security and privacy.
import DNS from "embedded:network/dns-over-https";Constructor
Section titled “Constructor”DNS(options)
Section titled “DNS(options)”Creates a new DNS over HTTPS object instance.
DNS(options)Parameters
Section titled “Parameters”options
url- A string containing the DoH server URL.
headers(optional) - An object of additional HTTP headers to include in requests.
Instance Methods
Section titled “Instance Methods”close()
Section titled “close()”Closes the DNS client.
close()resolve(options[, callback])
Section titled “resolve(options[, callback])”Resolves a hostname to an IP address.
resolve(options, callback)Parameters
Section titled “Parameters”options
host- A string containing the hostname to resolve.
callback
callback(error, name, address)
error- AnErrorobject if the operation failed, ornullif successful.
name- The hostname that was resolved.
address- The resolved IP address as a string.