Skip to main content
Deno.resolveDns - Deno documentation
function Deno.resolveDns
allow-net
resolveDns(
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. ```ts 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

Return Type

Promise<string[]>
resolveDns(
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. ```ts 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

Return Type

Promise<CaaRecord[]>
resolveDns(
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. ```ts 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

Return Type

Promise<MxRecord[]>
resolveDns(
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. ```ts 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

Return Type

Promise<NaptrRecord[]>
resolveDns(
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. ```ts 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

Return Type

Promise<SoaRecord[]>
resolveDns(
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. ```ts 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

Return Type

Promise<SrvRecord[]>
resolveDns(
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. ```ts 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

Return Type

Promise<string[][]>
resolveDns(
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. ```ts 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

Return Type

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