DNS over UDP
DNS over UDP uses the traditional DNS protocol over UDP for hostname resolution.
import DNSServer from "embedded:network/dns-over-udp";Constructor
Section titled “Constructor”DNSServer(options)
Section titled “DNSServer(options)”Creates a new DNS over UDP server object instance.
DNSServer(options)Parameters
Section titled “Parameters”options
address- A string representing the DNS server IP address.
port- The DNS server port number.
Instance Methods
Section titled “Instance Methods”close()
Section titled “close()”Closes the DNS server.
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.