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

§Parameters

§
query: string
[src]
§
recordType: "A" | "AAAA" | "ANAME" | "CNAME" | "PTR"
[src]
§
options?: ResolveDnsOptions optional
[src]

§Return Type

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

§Parameters

§
query: string
[src]
§
recordType: "MX"
[src]
§
options?: ResolveDnsOptions optional
[src]

§Return Type

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

§Parameters

§
query: string
[src]
§
recordType: "SRV"
[src]
§
options?: ResolveDnsOptions optional
[src]

§Return Type

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

§Parameters

§
query: string
[src]
§
recordType: "TXT"
[src]
§
options?: ResolveDnsOptions optional
[src]

§Return Type

§
Promise<string[][]>
[src]
§
resolveDns(query: string, recordType: RecordType, options?: ResolveDnsOptions): Promise<string[] | MXRecord[] | SRVRecord[] | string[][]>
[src]

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
[src]
§
recordType: RecordType
[src]
§
options?: ResolveDnsOptions optional
[src]

§Return Type

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