Skip to main content

resolveDns

function Deno.resolveDns
allow-net
Jump to headingresolveDns(
query: string,
recordType:
"A"
| "AAAA"
| "ANAME"
| "CNAME"
| "NS"
| "PTR"
,
): 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 Jump to heading

Jump to headingquery: string
Jump to headingrecordType:
"A"
| "AAAA"
| "ANAME"
| "CNAME"
| "NS"
| "PTR"

Return Type Jump to heading

Promise<string[]>
Jump to headingresolveDns(
query: string,
recordType: "CAA",
): 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 Jump to heading

Jump to headingquery: string
Jump to headingrecordType: "CAA"

Return Type Jump to heading

Promise<CaaRecord[]>
Jump to headingresolveDns(
query: string,
recordType: "MX",
): 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 Jump to heading

Jump to headingquery: string
Jump to headingrecordType: "MX"

Return Type Jump to heading

Promise<MxRecord[]>
Jump to headingresolveDns(
query: string,
recordType: "NAPTR",
): Promise<NaptrRecord[]>

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 Jump to heading

Jump to headingquery: string
Jump to headingrecordType: "NAPTR"

Return Type Jump to heading

Promise<NaptrRecord[]>
Jump to headingresolveDns(
query: string,
recordType: "SOA",
): 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 Jump to heading

Jump to headingquery: string
Jump to headingrecordType: "SOA"

Return Type Jump to heading

Promise<SoaRecord[]>
Jump to headingresolveDns(
query: string,
recordType: "SRV",
): 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 Jump to heading

Jump to headingquery: string
Jump to headingrecordType: "SRV"

Return Type Jump to heading

Promise<SrvRecord[]>
Jump to headingresolveDns(
query: string,
recordType: "TXT",
): 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 Jump to heading

Jump to headingquery: string
Jump to headingrecordType: "TXT"

Return Type Jump to heading

Promise<string[][]>
Jump to headingresolveDns(
query: string,
recordType: RecordType,
): Promise<
string[]
| CaaRecord[]
| MxRecord[]
| NaptrRecord[]
| SoaRecord[]
| SrvRecord[]
| 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 Jump to heading

Return Type Jump to heading

Promise<
string[]
| CaaRecord[]
| MxRecord[]
| NaptrRecord[]
| SoaRecord[]
| SrvRecord[]
| string[][]
>
Back to top