← Back to index
function Deno.resolveDns

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"

Return Type

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

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"

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"

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"

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"

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"

Return Type

🔗
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.

Return Type

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