Resolves a name to A records (the default type): the IPv4 addresses as strings.
The domain name.
The IPv4 addresses; empty on NXDOMAIN or no records.
Resolves a name to a string array (A/AAAA/NS/CNAME/PTR).
Resolves TXT records (each an array of its character-strings).
Resolves the SOA record (or undefined).
Resolves HTTPS or SVCB service-binding records.
Resolves the type named in opts.type (with resolver/tls/dnssec options).
Resolves with options; a numeric or omitted TYPE yields raw records.
Resolves a numeric record TYPE to its raw records.
Resolves a DNS name in a single call, opening and closing a connection around one query.
The return type narrows on the requested TYPE (see ResolveResult);
Aaddresses come back asstring[],MXas MxRecord[], and so on. NXDOMAIN and "no records" both yield an empty array (never a throw); a server error rcode (SERVFAIL,REFUSED, ...) throws a ProtocolError. Passserverto choose the resolver - inside a Worker this must be a non-Cloudflare resolver such asRESOLVERS.google, because the1.1.1.1default is blocked by the runtime.Param: name
The domain name to resolve.
Param: typeOrOpts
A record TYPE (name or number) or a ResolveOptions object.
Returns
The resolved records, typed per the TYPE.
Throws
On a server error rcode or a malformed response.
Throws
If the resolver cannot be reached.
Throws
If the query deadline elapses.
Since
1.0.4
Example