Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/deno/cli/dts/lib.deno.ns.d.ts>Deno.resolveDns

A modern runtime for JavaScript and TypeScript.
Go to Latest
function Deno.resolveDns
allow-net
import { Deno } from "https://deno.land/x/deno@v1.28.0/cli/dts/lib.deno.ns.d.ts";
const { resolveDns } = Deno;

Performs DNS resolution against the given query, returning resolved records.

Fails in the cases such as:

  • the query is in invalid format.
  • the options have an invalid parameter. For example nameServer.port is beyond the range of 16-bit unsigned integer.
  • the request timed out.
const a = await Deno.resolveDns("example.com", "A");

const aaaa = await Deno.resolveDns("example.com", "AAAA", {
  nameServer: { ipAddr: "8.8.8.8", port: 53 },
});

Requires allow-net permission.

Parameters

query: string
recordType:
| "A"
| "AAAA"
| "ANAME"
| "CNAME"
| "NS"
| "PTR"
optional
options: ResolveDnsOptions

Returns

Promise<string[]>

Performs DNS resolution against the given query, returning resolved records.

Fails in the cases such as:

  • the query is in invalid format.
  • the options have an invalid parameter. For example nameServer.port is beyond the range of 16-bit unsigned integer.
  • the request timed out.
const a = await Deno.resolveDns("example.com", "A");

const aaaa = await Deno.resolveDns("example.com", "AAAA", {
  nameServer: { ipAddr: "8.8.8.8", port: 53 },
});

Requires allow-net permission.

Parameters

query: string
recordType: "CAA"
optional
options: ResolveDnsOptions

Returns

Promise<CAARecord[]>

Performs DNS resolution against the given query, returning resolved records.

Fails in the cases such as:

  • the query is in invalid format.
  • the options have an invalid parameter. For example nameServer.port is beyond the range of 16-bit unsigned integer.
  • the request timed out.
const a = await Deno.resolveDns("example.com", "A");

const aaaa = await Deno.resolveDns("example.com", "AAAA", {
  nameServer: { ipAddr: "8.8.8.8", port: 53 },
});

Requires allow-net permission.

Parameters

query: string
recordType: "MX"
optional
options: ResolveDnsOptions

Returns

Promise<MXRecord[]>

Performs DNS resolution against the given query, returning resolved records.

Fails in the cases such as:

  • the query is in invalid format.
  • the options have an invalid parameter. For example nameServer.port is beyond the range of 16-bit unsigned integer.
  • the request timed out.
const a = await Deno.resolveDns("example.com", "A");

const aaaa = await Deno.resolveDns("example.com", "AAAA", {
  nameServer: { ipAddr: "8.8.8.8", port: 53 },
});

Requires allow-net permission.

Parameters

query: string
recordType: "NAPTR"
optional
options: ResolveDnsOptions

Performs DNS resolution against the given query, returning resolved records.

Fails in the cases such as:

  • the query is in invalid format.
  • the options have an invalid parameter. For example nameServer.port is beyond the range of 16-bit unsigned integer.
  • the request timed out.
const a = await Deno.resolveDns("example.com", "A");

const aaaa = await Deno.resolveDns("example.com", "AAAA", {
  nameServer: { ipAddr: "8.8.8.8", port: 53 },
});

Requires allow-net permission.

Parameters

query: string
recordType: "SOA"
optional
options: ResolveDnsOptions

Returns

Promise<SOARecord[]>

Performs DNS resolution against the given query, returning resolved records.

Fails in the cases such as:

  • the query is in invalid format.
  • the options have an invalid parameter. For example nameServer.port is beyond the range of 16-bit unsigned integer.
  • the request timed out.
const a = await Deno.resolveDns("example.com", "A");

const aaaa = await Deno.resolveDns("example.com", "AAAA", {
  nameServer: { ipAddr: "8.8.8.8", port: 53 },
});

Requires allow-net permission.

Parameters

query: string
recordType: "SRV"
optional
options: ResolveDnsOptions

Returns

Promise<SRVRecord[]>

Performs DNS resolution against the given query, returning resolved records.

Fails in the cases such as:

  • the query is in invalid format.
  • the options have an invalid parameter. For example nameServer.port is beyond the range of 16-bit unsigned integer.
  • the request timed out.
const a = await Deno.resolveDns("example.com", "A");

const aaaa = await Deno.resolveDns("example.com", "AAAA", {
  nameServer: { ipAddr: "8.8.8.8", port: 53 },
});

Requires allow-net permission.

Parameters

query: string
recordType: "TXT"
optional
options: ResolveDnsOptions

Returns

Promise<string[][]>

Performs DNS resolution against the given query, returning resolved records.

Fails in the cases such as:

  • the query is in invalid format.
  • the options have an invalid parameter. For example nameServer.port is beyond the range of 16-bit unsigned integer.
  • the request timed out.
const a = await Deno.resolveDns("example.com", "A");

const aaaa = await Deno.resolveDns("example.com", "AAAA", {
  nameServer: { ipAddr: "8.8.8.8", port: 53 },
});

Requires allow-net permission.

Parameters

query: string
recordType: RecordType
optional
options: ResolveDnsOptions

Returns

Promise<
| string[]
| string[][]
>