W3cubDocs

/Deno

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, e.g. nameServer.port is beyond the range of 16-bit unsigned integer
  • 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.

function resolveDns(
query: string,
recordType:
| "A"
| "AAAA"
| "ANAME"
| "CNAME"
| "PTR"
,
options?: ResolveDnsOptions,
): Promise<string[]>;
function resolveDns(
query: string,
recordType: "MX",
options?: ResolveDnsOptions,
): Promise<MXRecord[]>;
function resolveDns(
query: string,
recordType: "SRV",
options?: ResolveDnsOptions,
): Promise<SRVRecord[]>;
function resolveDns(
query: string,
recordType: "TXT",
options?: ResolveDnsOptions,
): Promise<string[][]>;
function resolveDns(
query: string,
recordType: RecordType,
options?: ResolveDnsOptions,
): Promise<string[] | MXRecord[] | SRVRecord[] | string[][]>;
resolveDns(query: string, recordType: "A" | "AAAA" | "ANAME" | "CNAME" | "PTR", options?: ResolveDnsOptions): Promise<string[]>

Parameters

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

Return Type

Promise<string[]>
resolveDns(query: string, recordType: "MX", options?: ResolveDnsOptions): Promise<MXRecord[]>

Parameters

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

Return Type

Promise<MXRecord[]>
resolveDns(query: string, recordType: "SRV", options?: ResolveDnsOptions): Promise<SRVRecord[]>

Parameters

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

Return Type

Promise<SRVRecord[]>
resolveDns(query: string, recordType: "TXT", options?: ResolveDnsOptions): Promise<string[][]>

Parameters

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

Return Type

Promise<string[][]>
resolveDns(query: string, recordType: RecordType, options?: ResolveDnsOptions): Promise<string[] | MXRecord[] | 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, e.g. nameServer.port is beyond the range of 16-bit unsigned integer
  • 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
options?: ResolveDnsOptions optional

Return Type

Promise<string[] | MXRecord[] | SRVRecord[] | string[][]>

© 2018–2021 the Deno authors
https://doc.deno.land/deno/stable/~/Deno.resolveDns