Skip to content

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";

Creates a new DNS over HTTPS object instance.

DNS(options)

options

url - A string containing the DoH server URL.

headers (optional) - An object of additional HTTP headers to include in requests.

Closes the DNS client.

close()

Resolves a hostname to an IP address.

resolve(options, callback)

options

host - A string containing the hostname to resolve.

callback

callback(error, name, address)

error - An Error object if the operation failed, or null if successful.

name - The hostname that was resolved.

address - The resolved IP address as a string.

DNS over HTTPS (DoH)