mirror of
https://github.com/denoland/deno.git
synced 2025-01-20 20:42:19 -05:00
feat(ts/dns): RecordWithTtl interface
This commit is contained in:
parent
974e2f44b2
commit
406162d7b8
1 changed files with 48 additions and 0 deletions
48
cli/tsc/dts/lib.deno.ns.d.ts
vendored
48
cli/tsc/dts/lib.deno.ns.d.ts
vendored
|
@ -4674,6 +4674,22 @@ declare namespace Deno {
|
|||
* and the promise returned will be rejected with an AbortError.
|
||||
*/
|
||||
signal?: AbortSignal;
|
||||
/** */
|
||||
ttl?: boolean;
|
||||
}
|
||||
|
||||
export interface RecordWithTtl {
|
||||
/** */
|
||||
data:
|
||||
| string
|
||||
| CaaRecord
|
||||
| MxRecord
|
||||
| NaptrRecord
|
||||
| SoaRecord
|
||||
| SrvRecord
|
||||
| string[];
|
||||
/** */
|
||||
ttl: number;
|
||||
}
|
||||
|
||||
/** If {@linkcode Deno.resolveDns} is called with `"CAA"` record type
|
||||
|
@ -4748,6 +4764,37 @@ declare namespace Deno {
|
|||
target: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs DNS resolution against the given query, returning resolved
|
||||
* records with ttl values.
|
||||
*
|
||||
* 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", { ttl: true });
|
||||
*
|
||||
* const aaaa = await Deno.resolveDns("example.com", "AAAA", {
|
||||
* nameServer: { ipAddr: "8.8.8.8", port: 53 },
|
||||
* ttl: true,
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* Requires `allow-net` permission.
|
||||
*
|
||||
* @tags allow-net
|
||||
* @category Network
|
||||
*/
|
||||
export function resolveDns(
|
||||
query: string,
|
||||
recordType: RecordType,
|
||||
options?: { ttl: true } & ResolveDnsOptions,
|
||||
): Promise<RecordWithTtl[]>;
|
||||
|
||||
/**
|
||||
* Performs DNS resolution against the given query, returning resolved
|
||||
* records.
|
||||
|
@ -4994,6 +5041,7 @@ declare namespace Deno {
|
|||
| SoaRecord[]
|
||||
| SrvRecord[]
|
||||
| string[][]
|
||||
| RecordWithTtl[]
|
||||
>;
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue