@aligent/cdk-prerender-proxy 0.2.4-beta1 → 0.2.5-beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +1 -2
- package/index.js +2 -4
- package/lib/handlers/cache-control.ts +7 -20
- package/lib/handlers/error-response.ts +8 -51
- package/lib/handlers/node_modules/.package-lock.json +32 -3
- package/lib/handlers/node_modules/@aligent/cdk-lambda-at-edge-handlers/index.d.ts +6 -0
- package/lib/handlers/node_modules/@aligent/cdk-lambda-at-edge-handlers/index.js +14 -0
- package/lib/handlers/node_modules/@aligent/cdk-lambda-at-edge-handlers/lib/cache-control.d.ts +3 -0
- package/lib/handlers/node_modules/@aligent/cdk-lambda-at-edge-handlers/lib/cache-control.js +24 -0
- package/lib/handlers/node_modules/@aligent/cdk-lambda-at-edge-handlers/lib/error-response.d.ts +3 -0
- package/lib/handlers/node_modules/@aligent/cdk-lambda-at-edge-handlers/lib/error-response.js +50 -0
- package/lib/handlers/node_modules/@aligent/cdk-lambda-at-edge-handlers/lib/prerender-check.d.ts +3 -0
- package/lib/handlers/node_modules/@aligent/cdk-lambda-at-edge-handlers/lib/prerender-check.js +28 -0
- package/lib/handlers/node_modules/@aligent/cdk-lambda-at-edge-handlers/lib/prerender.d.ts +3 -0
- package/lib/handlers/node_modules/@aligent/cdk-lambda-at-edge-handlers/lib/prerender.js +49 -0
- package/lib/handlers/node_modules/@aligent/cdk-lambda-at-edge-handlers/lib/redirect.d.ts +3 -0
- package/lib/handlers/node_modules/@aligent/cdk-lambda-at-edge-handlers/lib/redirect.js +33 -0
- package/lib/handlers/node_modules/@aligent/cdk-lambda-at-edge-handlers/package.json +27 -0
- package/lib/handlers/node_modules/@aligent/cdk-lambda-at-edge-handlers/tsconfig.json +3 -0
- package/lib/handlers/node_modules/@middy/core/LICENSE +21 -0
- package/lib/handlers/node_modules/@middy/core/README.md +65 -0
- package/lib/handlers/node_modules/@middy/core/index.cjs +207 -0
- package/lib/handlers/node_modules/@middy/core/index.d.ts +91 -0
- package/lib/handlers/node_modules/@middy/core/index.js +199 -0
- package/lib/handlers/node_modules/@middy/core/package.json +65 -0
- package/lib/handlers/node_modules/@types/node/README.md +4 -4
- package/lib/handlers/node_modules/@types/node/assert/strict.d.ts +5 -1
- package/lib/handlers/node_modules/@types/node/assert.d.ts +904 -67
- package/lib/handlers/node_modules/@types/node/async_hooks.d.ts +371 -96
- package/lib/handlers/node_modules/@types/node/buffer.d.ts +2199 -25
- package/lib/handlers/node_modules/@types/node/child_process.d.ts +1151 -308
- package/lib/handlers/node_modules/@types/node/cluster.d.ts +356 -208
- package/lib/handlers/node_modules/@types/node/console.d.ts +324 -45
- package/lib/handlers/node_modules/@types/node/constants.d.ts +8 -3
- package/lib/handlers/node_modules/@types/node/crypto.d.ts +3230 -846
- package/lib/handlers/node_modules/@types/node/dgram.d.ts +478 -74
- package/lib/handlers/node_modules/@types/node/diagnostics_channel.d.ts +153 -0
- package/lib/handlers/node_modules/@types/node/dns/promises.d.ts +308 -35
- package/lib/handlers/node_modules/@types/node/dns.d.ts +444 -107
- package/lib/handlers/node_modules/@types/node/dom-events.d.ts +126 -0
- package/lib/handlers/node_modules/@types/node/domain.d.ts +162 -16
- package/lib/handlers/node_modules/@types/node/events.d.ts +624 -39
- package/lib/handlers/node_modules/@types/node/fs/promises.d.ts +911 -365
- package/lib/handlers/node_modules/@types/node/fs.d.ts +2611 -978
- package/lib/handlers/node_modules/@types/node/globals.d.ts +66 -421
- package/lib/handlers/node_modules/@types/node/globals.global.d.ts +1 -1
- package/lib/handlers/node_modules/@types/node/http.d.ts +1416 -199
- package/lib/handlers/node_modules/@types/node/http2.d.ts +1688 -530
- package/lib/handlers/node_modules/@types/node/https.d.ts +532 -26
- package/lib/handlers/node_modules/@types/node/index.d.ts +92 -16
- package/lib/handlers/node_modules/@types/node/inspector.d.ts +511 -811
- package/lib/handlers/node_modules/@types/node/module.d.ts +75 -13
- package/lib/handlers/node_modules/@types/node/net.d.ts +710 -167
- package/lib/handlers/node_modules/@types/node/os.d.ts +252 -25
- package/lib/handlers/node_modules/@types/node/package.json +30 -25
- package/lib/handlers/node_modules/@types/node/path.d.ts +59 -31
- package/lib/handlers/node_modules/@types/node/perf_hooks.d.ts +420 -105
- package/lib/handlers/node_modules/@types/node/process.d.ts +1249 -228
- package/lib/handlers/node_modules/@types/node/punycode.d.ts +67 -25
- package/lib/handlers/node_modules/@types/node/querystring.d.ts +113 -10
- package/lib/handlers/node_modules/@types/node/readline/promises.d.ts +143 -0
- package/lib/handlers/node_modules/@types/node/readline.d.ts +570 -109
- package/lib/handlers/node_modules/@types/node/repl.d.ts +154 -125
- package/lib/handlers/node_modules/@types/node/stream/consumers.d.ts +12 -0
- package/lib/handlers/node_modules/@types/node/stream/promises.d.ts +18 -43
- package/lib/handlers/node_modules/@types/node/stream/web.d.ts +330 -0
- package/lib/handlers/node_modules/@types/node/stream.d.ts +1117 -248
- package/lib/handlers/node_modules/@types/node/string_decoder.d.ts +60 -0
- package/lib/handlers/node_modules/@types/node/test.d.ts +446 -0
- package/lib/handlers/node_modules/@types/node/timers/promises.d.ts +81 -9
- package/lib/handlers/node_modules/@types/node/timers.d.ts +84 -17
- package/lib/handlers/node_modules/@types/node/tls.d.ts +510 -275
- package/lib/handlers/node_modules/@types/node/trace_events.d.ts +120 -10
- package/lib/handlers/node_modules/@types/node/ts4.8/assert/strict.d.ts +8 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/assert.d.ts +961 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/async_hooks.d.ts +501 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/buffer.d.ts +2259 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/child_process.d.ts +1369 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/cluster.d.ts +410 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/console.d.ts +412 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/constants.d.ts +18 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/crypto.d.ts +3964 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/dgram.d.ts +545 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/diagnostics_channel.d.ts +153 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/dns/promises.d.ts +370 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/dns.d.ts +659 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/dom-events.d.ts +126 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/domain.d.ts +170 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/events.d.ts +678 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/fs/promises.d.ts +1138 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/fs.d.ts +3872 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/globals.d.ts +294 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/globals.global.d.ts +1 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/http.d.ts +1651 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/http2.d.ts +2134 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/https.d.ts +542 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/index.d.ts +88 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/inspector.d.ts +2741 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/module.d.ts +114 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/net.d.ts +869 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/os.d.ts +466 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/path.d.ts +191 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/perf_hooks.d.ts +625 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/process.d.ts +1482 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/punycode.d.ts +117 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/querystring.d.ts +131 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/readline/promises.d.ts +143 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/readline.d.ts +653 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/repl.d.ts +424 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/stream/consumers.d.ts +12 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/stream/promises.d.ts +42 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/stream/web.d.ts +330 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/stream.d.ts +1340 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/string_decoder.d.ts +67 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/test.d.ts +446 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/timers/promises.d.ts +93 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/timers.d.ts +94 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/tls.d.ts +1028 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/trace_events.d.ts +171 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/tty.d.ts +206 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/url.d.ts +897 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/util.d.ts +1926 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/v8.d.ts +396 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/vm.d.ts +509 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/wasi.d.ts +158 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/worker_threads.d.ts +689 -0
- package/lib/handlers/node_modules/@types/node/ts4.8/zlib.d.ts +517 -0
- package/lib/handlers/node_modules/@types/node/tty.d.ts +163 -23
- package/lib/handlers/node_modules/@types/node/url.d.ts +825 -44
- package/lib/handlers/node_modules/@types/node/util.d.ts +1842 -72
- package/lib/handlers/node_modules/@types/node/v8.d.ts +276 -78
- package/lib/handlers/node_modules/@types/node/vm.d.ts +410 -53
- package/lib/handlers/node_modules/@types/node/wasi.d.ts +102 -30
- package/lib/handlers/node_modules/@types/node/worker_threads.d.ts +559 -152
- package/lib/handlers/node_modules/@types/node/zlib.d.ts +234 -78
- package/lib/handlers/node_modules/esbuild/README.md +3 -0
- package/lib/handlers/node_modules/esbuild/bin/esbuild +0 -0
- package/lib/handlers/node_modules/esbuild/install.js +256 -0
- package/lib/handlers/node_modules/esbuild/lib/main.d.ts +397 -0
- package/lib/handlers/node_modules/esbuild/lib/main.js +1939 -0
- package/lib/handlers/node_modules/esbuild/package.json +15 -0
- package/lib/handlers/package-lock.json +62 -6
- package/lib/handlers/package.json +6 -1
- package/lib/handlers/prerender-check.ts +8 -27
- package/lib/handlers/prerender.ts +8 -43
- package/package.json +1 -1
- package/lib/handlers/node_modules/@types/node/base.d.ts +0 -19
- package/lib/handlers/node_modules/@types/node/diagnostic_channel.d.ts +0 -34
- package/lib/handlers/node_modules/@types/node/ts3.6/assert.d.ts +0 -98
- package/lib/handlers/node_modules/@types/node/ts3.6/base.d.ts +0 -68
- package/lib/handlers/node_modules/@types/node/ts3.6/index.d.ts +0 -7
- package/lib/handlers/node_modules/@types/node/util/types.d.ts +0 -53
- package/lib/handlers/prerender-handler.ts +0 -13
- package/lib/sendToPrerender.d.ts +0 -2
- package/lib/sendToPrerender.js +0 -42
|
@@ -1,6 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `dns` module enables name resolution. For example, use it to look up IP
|
|
3
|
+
* addresses of host names.
|
|
4
|
+
*
|
|
5
|
+
* Although named for the [Domain Name System (DNS)](https://en.wikipedia.org/wiki/Domain_Name_System), it does not always use the
|
|
6
|
+
* DNS protocol for lookups. {@link lookup} uses the operating system
|
|
7
|
+
* facilities to perform name resolution. It may not need to perform any network
|
|
8
|
+
* communication. To perform name resolution the way other applications on the same
|
|
9
|
+
* system do, use {@link lookup}.
|
|
10
|
+
*
|
|
11
|
+
* ```js
|
|
12
|
+
* const dns = require('dns');
|
|
13
|
+
*
|
|
14
|
+
* dns.lookup('example.org', (err, address, family) => {
|
|
15
|
+
* console.log('address: %j family: IPv%s', address, family);
|
|
16
|
+
* });
|
|
17
|
+
* // address: "93.184.216.34" family: IPv4
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* All other functions in the `dns` module connect to an actual DNS server to
|
|
21
|
+
* perform name resolution. They will always use the network to perform DNS
|
|
22
|
+
* queries. These functions do not use the same set of configuration files used by {@link lookup} (e.g. `/etc/hosts`). Use these functions to always perform
|
|
23
|
+
* DNS queries, bypassing other name-resolution facilities.
|
|
24
|
+
*
|
|
25
|
+
* ```js
|
|
26
|
+
* const dns = require('dns');
|
|
27
|
+
*
|
|
28
|
+
* dns.resolve4('archive.org', (err, addresses) => {
|
|
29
|
+
* if (err) throw err;
|
|
30
|
+
*
|
|
31
|
+
* console.log(`addresses: ${JSON.stringify(addresses)}`);
|
|
32
|
+
*
|
|
33
|
+
* addresses.forEach((a) => {
|
|
34
|
+
* dns.reverse(a, (err, hostnames) => {
|
|
35
|
+
* if (err) {
|
|
36
|
+
* throw err;
|
|
37
|
+
* }
|
|
38
|
+
* console.log(`reverse for ${a}: ${JSON.stringify(hostnames)}`);
|
|
39
|
+
* });
|
|
40
|
+
* });
|
|
41
|
+
* });
|
|
42
|
+
* ```
|
|
43
|
+
*
|
|
44
|
+
* See the `Implementation considerations section` for more information.
|
|
45
|
+
* @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/dns.js)
|
|
46
|
+
*/
|
|
1
47
|
declare module 'dns' {
|
|
2
|
-
import * as dnsPromises from
|
|
3
|
-
|
|
48
|
+
import * as dnsPromises from 'node:dns/promises';
|
|
4
49
|
// Supported getaddrinfo flags.
|
|
5
50
|
export const ADDRCONFIG: number;
|
|
6
51
|
export const V4MAPPED: number;
|
|
@@ -9,88 +54,140 @@ declare module 'dns' {
|
|
|
9
54
|
* well as IPv4 mapped IPv6 addresses.
|
|
10
55
|
*/
|
|
11
56
|
export const ALL: number;
|
|
12
|
-
|
|
13
57
|
export interface LookupOptions {
|
|
14
|
-
family?: number;
|
|
15
|
-
hints?: number;
|
|
16
|
-
all?: boolean;
|
|
17
|
-
|
|
58
|
+
family?: number | undefined;
|
|
59
|
+
hints?: number | undefined;
|
|
60
|
+
all?: boolean | undefined;
|
|
61
|
+
/**
|
|
62
|
+
* @default true
|
|
63
|
+
*/
|
|
64
|
+
verbatim?: boolean | undefined;
|
|
18
65
|
}
|
|
19
|
-
|
|
20
66
|
export interface LookupOneOptions extends LookupOptions {
|
|
21
|
-
all?: false;
|
|
67
|
+
all?: false | undefined;
|
|
22
68
|
}
|
|
23
|
-
|
|
24
69
|
export interface LookupAllOptions extends LookupOptions {
|
|
25
70
|
all: true;
|
|
26
71
|
}
|
|
27
|
-
|
|
28
72
|
export interface LookupAddress {
|
|
29
73
|
address: string;
|
|
30
74
|
family: number;
|
|
31
75
|
}
|
|
32
|
-
|
|
76
|
+
/**
|
|
77
|
+
* Resolves a host name (e.g. `'nodejs.org'`) into the first found A (IPv4) or
|
|
78
|
+
* AAAA (IPv6) record. All `option` properties are optional. If `options` is an
|
|
79
|
+
* integer, then it must be `4` or `6` – if `options` is not provided, then IPv4
|
|
80
|
+
* and IPv6 addresses are both returned if found.
|
|
81
|
+
*
|
|
82
|
+
* With the `all` option set to `true`, the arguments for `callback` change to`(err, addresses)`, with `addresses` being an array of objects with the
|
|
83
|
+
* properties `address` and `family`.
|
|
84
|
+
*
|
|
85
|
+
* On error, `err` is an `Error` object, where `err.code` is the error code.
|
|
86
|
+
* Keep in mind that `err.code` will be set to `'ENOTFOUND'` not only when
|
|
87
|
+
* the host name does not exist but also when the lookup fails in other ways
|
|
88
|
+
* such as no available file descriptors.
|
|
89
|
+
*
|
|
90
|
+
* `dns.lookup()` does not necessarily have anything to do with the DNS protocol.
|
|
91
|
+
* The implementation uses an operating system facility that can associate names
|
|
92
|
+
* with addresses, and vice versa. This implementation can have subtle but
|
|
93
|
+
* important consequences on the behavior of any Node.js program. Please take some
|
|
94
|
+
* time to consult the `Implementation considerations section` before using`dns.lookup()`.
|
|
95
|
+
*
|
|
96
|
+
* Example usage:
|
|
97
|
+
*
|
|
98
|
+
* ```js
|
|
99
|
+
* const dns = require('dns');
|
|
100
|
+
* const options = {
|
|
101
|
+
* family: 6,
|
|
102
|
+
* hints: dns.ADDRCONFIG | dns.V4MAPPED,
|
|
103
|
+
* };
|
|
104
|
+
* dns.lookup('example.com', options, (err, address, family) =>
|
|
105
|
+
* console.log('address: %j family: IPv%s', address, family));
|
|
106
|
+
* // address: "2606:2800:220:1:248:1893:25c8:1946" family: IPv6
|
|
107
|
+
*
|
|
108
|
+
* // When options.all is true, the result will be an Array.
|
|
109
|
+
* options.all = true;
|
|
110
|
+
* dns.lookup('example.com', options, (err, addresses) =>
|
|
111
|
+
* console.log('addresses: %j', addresses));
|
|
112
|
+
* // addresses: [{"address":"2606:2800:220:1:248:1893:25c8:1946","family":6}]
|
|
113
|
+
* ```
|
|
114
|
+
*
|
|
115
|
+
* If this method is invoked as its `util.promisify()` ed version, and `all`is not set to `true`, it returns a `Promise` for an `Object` with `address` and`family` properties.
|
|
116
|
+
* @since v0.1.90
|
|
117
|
+
*/
|
|
33
118
|
export function lookup(hostname: string, family: number, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void): void;
|
|
34
119
|
export function lookup(hostname: string, options: LookupOneOptions, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void): void;
|
|
35
120
|
export function lookup(hostname: string, options: LookupAllOptions, callback: (err: NodeJS.ErrnoException | null, addresses: LookupAddress[]) => void): void;
|
|
36
121
|
export function lookup(hostname: string, options: LookupOptions, callback: (err: NodeJS.ErrnoException | null, address: string | LookupAddress[], family: number) => void): void;
|
|
37
122
|
export function lookup(hostname: string, callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void): void;
|
|
38
|
-
|
|
39
|
-
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
|
|
40
123
|
export namespace lookup {
|
|
41
124
|
function __promisify__(hostname: string, options: LookupAllOptions): Promise<LookupAddress[]>;
|
|
42
125
|
function __promisify__(hostname: string, options?: LookupOneOptions | number): Promise<LookupAddress>;
|
|
43
126
|
function __promisify__(hostname: string, options: LookupOptions): Promise<LookupAddress | LookupAddress[]>;
|
|
44
127
|
}
|
|
45
|
-
|
|
128
|
+
/**
|
|
129
|
+
* Resolves the given `address` and `port` into a host name and service using
|
|
130
|
+
* the operating system's underlying `getnameinfo` implementation.
|
|
131
|
+
*
|
|
132
|
+
* If `address` is not a valid IP address, a `TypeError` will be thrown.
|
|
133
|
+
* The `port` will be coerced to a number. If it is not a legal port, a `TypeError`will be thrown.
|
|
134
|
+
*
|
|
135
|
+
* On an error, `err` is an `Error` object, where `err.code` is the error code.
|
|
136
|
+
*
|
|
137
|
+
* ```js
|
|
138
|
+
* const dns = require('dns');
|
|
139
|
+
* dns.lookupService('127.0.0.1', 22, (err, hostname, service) => {
|
|
140
|
+
* console.log(hostname, service);
|
|
141
|
+
* // Prints: localhost ssh
|
|
142
|
+
* });
|
|
143
|
+
* ```
|
|
144
|
+
*
|
|
145
|
+
* If this method is invoked as its `util.promisify()` ed version, it returns a`Promise` for an `Object` with `hostname` and `service` properties.
|
|
146
|
+
* @since v0.11.14
|
|
147
|
+
*/
|
|
46
148
|
export function lookupService(address: string, port: number, callback: (err: NodeJS.ErrnoException | null, hostname: string, service: string) => void): void;
|
|
47
|
-
|
|
48
149
|
export namespace lookupService {
|
|
49
|
-
function __promisify__(
|
|
150
|
+
function __promisify__(
|
|
151
|
+
address: string,
|
|
152
|
+
port: number
|
|
153
|
+
): Promise<{
|
|
154
|
+
hostname: string;
|
|
155
|
+
service: string;
|
|
156
|
+
}>;
|
|
50
157
|
}
|
|
51
|
-
|
|
52
158
|
export interface ResolveOptions {
|
|
53
159
|
ttl: boolean;
|
|
54
160
|
}
|
|
55
|
-
|
|
56
161
|
export interface ResolveWithTtlOptions extends ResolveOptions {
|
|
57
162
|
ttl: true;
|
|
58
163
|
}
|
|
59
|
-
|
|
60
164
|
export interface RecordWithTtl {
|
|
61
165
|
address: string;
|
|
62
166
|
ttl: number;
|
|
63
167
|
}
|
|
64
|
-
|
|
65
168
|
/** @deprecated Use `AnyARecord` or `AnyAaaaRecord` instead. */
|
|
66
169
|
export type AnyRecordWithTtl = AnyARecord | AnyAaaaRecord;
|
|
67
|
-
|
|
68
170
|
export interface AnyARecord extends RecordWithTtl {
|
|
69
|
-
type:
|
|
171
|
+
type: 'A';
|
|
70
172
|
}
|
|
71
|
-
|
|
72
173
|
export interface AnyAaaaRecord extends RecordWithTtl {
|
|
73
|
-
type:
|
|
174
|
+
type: 'AAAA';
|
|
74
175
|
}
|
|
75
|
-
|
|
76
176
|
export interface CaaRecord {
|
|
77
177
|
critial: number;
|
|
78
|
-
issue?: string;
|
|
79
|
-
issuewild?: string;
|
|
80
|
-
iodef?: string;
|
|
81
|
-
contactemail?: string;
|
|
82
|
-
contactphone?: string;
|
|
178
|
+
issue?: string | undefined;
|
|
179
|
+
issuewild?: string | undefined;
|
|
180
|
+
iodef?: string | undefined;
|
|
181
|
+
contactemail?: string | undefined;
|
|
182
|
+
contactphone?: string | undefined;
|
|
83
183
|
}
|
|
84
|
-
|
|
85
184
|
export interface MxRecord {
|
|
86
185
|
priority: number;
|
|
87
186
|
exchange: string;
|
|
88
187
|
}
|
|
89
|
-
|
|
90
188
|
export interface AnyMxRecord extends MxRecord {
|
|
91
|
-
type:
|
|
189
|
+
type: 'MX';
|
|
92
190
|
}
|
|
93
|
-
|
|
94
191
|
export interface NaptrRecord {
|
|
95
192
|
flags: string;
|
|
96
193
|
service: string;
|
|
@@ -99,11 +196,9 @@ declare module 'dns' {
|
|
|
99
196
|
order: number;
|
|
100
197
|
preference: number;
|
|
101
198
|
}
|
|
102
|
-
|
|
103
199
|
export interface AnyNaptrRecord extends NaptrRecord {
|
|
104
|
-
type:
|
|
200
|
+
type: 'NAPTR';
|
|
105
201
|
}
|
|
106
|
-
|
|
107
202
|
export interface SoaRecord {
|
|
108
203
|
nsname: string;
|
|
109
204
|
hostmaster: string;
|
|
@@ -113,159 +208,340 @@ declare module 'dns' {
|
|
|
113
208
|
expire: number;
|
|
114
209
|
minttl: number;
|
|
115
210
|
}
|
|
116
|
-
|
|
117
211
|
export interface AnySoaRecord extends SoaRecord {
|
|
118
|
-
type:
|
|
212
|
+
type: 'SOA';
|
|
119
213
|
}
|
|
120
|
-
|
|
121
214
|
export interface SrvRecord {
|
|
122
215
|
priority: number;
|
|
123
216
|
weight: number;
|
|
124
217
|
port: number;
|
|
125
218
|
name: string;
|
|
126
219
|
}
|
|
127
|
-
|
|
128
220
|
export interface AnySrvRecord extends SrvRecord {
|
|
129
|
-
type:
|
|
221
|
+
type: 'SRV';
|
|
130
222
|
}
|
|
131
|
-
|
|
132
223
|
export interface AnyTxtRecord {
|
|
133
|
-
type:
|
|
224
|
+
type: 'TXT';
|
|
134
225
|
entries: string[];
|
|
135
226
|
}
|
|
136
|
-
|
|
137
227
|
export interface AnyNsRecord {
|
|
138
|
-
type:
|
|
228
|
+
type: 'NS';
|
|
139
229
|
value: string;
|
|
140
230
|
}
|
|
141
|
-
|
|
142
231
|
export interface AnyPtrRecord {
|
|
143
|
-
type:
|
|
232
|
+
type: 'PTR';
|
|
144
233
|
value: string;
|
|
145
234
|
}
|
|
146
|
-
|
|
147
235
|
export interface AnyCnameRecord {
|
|
148
|
-
type:
|
|
236
|
+
type: 'CNAME';
|
|
149
237
|
value: string;
|
|
150
238
|
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
239
|
+
export type AnyRecord = AnyARecord | AnyAaaaRecord | AnyCnameRecord | AnyMxRecord | AnyNaptrRecord | AnyNsRecord | AnyPtrRecord | AnySoaRecord | AnySrvRecord | AnyTxtRecord;
|
|
240
|
+
/**
|
|
241
|
+
* Uses the DNS protocol to resolve a host name (e.g. `'nodejs.org'`) into an array
|
|
242
|
+
* of the resource records. The `callback` function has arguments`(err, records)`. When successful, `records` will be an array of resource
|
|
243
|
+
* records. The type and structure of individual results varies based on `rrtype`:
|
|
244
|
+
*
|
|
245
|
+
* <omitted>
|
|
246
|
+
*
|
|
247
|
+
* On error, `err` is an `Error` object, where `err.code` is one of the `DNS error codes`.
|
|
248
|
+
* @since v0.1.27
|
|
249
|
+
* @param hostname Host name to resolve.
|
|
250
|
+
* @param [rrtype='A'] Resource record type.
|
|
251
|
+
*/
|
|
163
252
|
export function resolve(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
|
|
164
|
-
export function resolve(hostname: string, rrtype:
|
|
165
|
-
export function resolve(hostname: string, rrtype:
|
|
166
|
-
export function resolve(hostname: string, rrtype:
|
|
167
|
-
export function resolve(hostname: string, rrtype:
|
|
168
|
-
export function resolve(hostname: string, rrtype:
|
|
169
|
-
export function resolve(hostname: string, rrtype:
|
|
170
|
-
export function resolve(hostname: string, rrtype:
|
|
171
|
-
export function resolve(hostname: string, rrtype:
|
|
172
|
-
export function resolve(hostname: string, rrtype:
|
|
173
|
-
export function resolve(hostname: string, rrtype:
|
|
174
|
-
export function resolve(hostname: string, rrtype:
|
|
253
|
+
export function resolve(hostname: string, rrtype: 'A', callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
|
|
254
|
+
export function resolve(hostname: string, rrtype: 'AAAA', callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
|
|
255
|
+
export function resolve(hostname: string, rrtype: 'ANY', callback: (err: NodeJS.ErrnoException | null, addresses: AnyRecord[]) => void): void;
|
|
256
|
+
export function resolve(hostname: string, rrtype: 'CNAME', callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
|
|
257
|
+
export function resolve(hostname: string, rrtype: 'MX', callback: (err: NodeJS.ErrnoException | null, addresses: MxRecord[]) => void): void;
|
|
258
|
+
export function resolve(hostname: string, rrtype: 'NAPTR', callback: (err: NodeJS.ErrnoException | null, addresses: NaptrRecord[]) => void): void;
|
|
259
|
+
export function resolve(hostname: string, rrtype: 'NS', callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
|
|
260
|
+
export function resolve(hostname: string, rrtype: 'PTR', callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
|
|
261
|
+
export function resolve(hostname: string, rrtype: 'SOA', callback: (err: NodeJS.ErrnoException | null, addresses: SoaRecord) => void): void;
|
|
262
|
+
export function resolve(hostname: string, rrtype: 'SRV', callback: (err: NodeJS.ErrnoException | null, addresses: SrvRecord[]) => void): void;
|
|
263
|
+
export function resolve(hostname: string, rrtype: 'TXT', callback: (err: NodeJS.ErrnoException | null, addresses: string[][]) => void): void;
|
|
175
264
|
export function resolve(
|
|
176
265
|
hostname: string,
|
|
177
266
|
rrtype: string,
|
|
178
|
-
callback: (err: NodeJS.ErrnoException | null, addresses: string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][] | AnyRecord[]) => void
|
|
267
|
+
callback: (err: NodeJS.ErrnoException | null, addresses: string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][] | AnyRecord[]) => void
|
|
179
268
|
): void;
|
|
180
|
-
|
|
181
|
-
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
|
|
182
269
|
export namespace resolve {
|
|
183
|
-
function __promisify__(hostname: string, rrtype?:
|
|
184
|
-
function __promisify__(hostname: string, rrtype:
|
|
185
|
-
function __promisify__(hostname: string, rrtype:
|
|
186
|
-
function __promisify__(hostname: string, rrtype:
|
|
187
|
-
function __promisify__(hostname: string, rrtype:
|
|
188
|
-
function __promisify__(hostname: string, rrtype:
|
|
189
|
-
function __promisify__(hostname: string, rrtype:
|
|
270
|
+
function __promisify__(hostname: string, rrtype?: 'A' | 'AAAA' | 'CNAME' | 'NS' | 'PTR'): Promise<string[]>;
|
|
271
|
+
function __promisify__(hostname: string, rrtype: 'ANY'): Promise<AnyRecord[]>;
|
|
272
|
+
function __promisify__(hostname: string, rrtype: 'MX'): Promise<MxRecord[]>;
|
|
273
|
+
function __promisify__(hostname: string, rrtype: 'NAPTR'): Promise<NaptrRecord[]>;
|
|
274
|
+
function __promisify__(hostname: string, rrtype: 'SOA'): Promise<SoaRecord>;
|
|
275
|
+
function __promisify__(hostname: string, rrtype: 'SRV'): Promise<SrvRecord[]>;
|
|
276
|
+
function __promisify__(hostname: string, rrtype: 'TXT'): Promise<string[][]>;
|
|
190
277
|
function __promisify__(hostname: string, rrtype: string): Promise<string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][] | AnyRecord[]>;
|
|
191
278
|
}
|
|
192
|
-
|
|
279
|
+
/**
|
|
280
|
+
* Uses the DNS protocol to resolve a IPv4 addresses (`A` records) for the`hostname`. The `addresses` argument passed to the `callback` function
|
|
281
|
+
* will contain an array of IPv4 addresses (e.g.`['74.125.79.104', '74.125.79.105', '74.125.79.106']`).
|
|
282
|
+
* @since v0.1.16
|
|
283
|
+
* @param hostname Host name to resolve.
|
|
284
|
+
*/
|
|
193
285
|
export function resolve4(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
|
|
194
286
|
export function resolve4(hostname: string, options: ResolveWithTtlOptions, callback: (err: NodeJS.ErrnoException | null, addresses: RecordWithTtl[]) => void): void;
|
|
195
287
|
export function resolve4(hostname: string, options: ResolveOptions, callback: (err: NodeJS.ErrnoException | null, addresses: string[] | RecordWithTtl[]) => void): void;
|
|
196
|
-
|
|
197
|
-
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
|
|
198
288
|
export namespace resolve4 {
|
|
199
289
|
function __promisify__(hostname: string): Promise<string[]>;
|
|
200
290
|
function __promisify__(hostname: string, options: ResolveWithTtlOptions): Promise<RecordWithTtl[]>;
|
|
201
291
|
function __promisify__(hostname: string, options?: ResolveOptions): Promise<string[] | RecordWithTtl[]>;
|
|
202
292
|
}
|
|
203
|
-
|
|
293
|
+
/**
|
|
294
|
+
* Uses the DNS protocol to resolve a IPv6 addresses (`AAAA` records) for the`hostname`. The `addresses` argument passed to the `callback` function
|
|
295
|
+
* will contain an array of IPv6 addresses.
|
|
296
|
+
* @since v0.1.16
|
|
297
|
+
* @param hostname Host name to resolve.
|
|
298
|
+
*/
|
|
204
299
|
export function resolve6(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
|
|
205
300
|
export function resolve6(hostname: string, options: ResolveWithTtlOptions, callback: (err: NodeJS.ErrnoException | null, addresses: RecordWithTtl[]) => void): void;
|
|
206
301
|
export function resolve6(hostname: string, options: ResolveOptions, callback: (err: NodeJS.ErrnoException | null, addresses: string[] | RecordWithTtl[]) => void): void;
|
|
207
|
-
|
|
208
|
-
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
|
|
209
302
|
export namespace resolve6 {
|
|
210
303
|
function __promisify__(hostname: string): Promise<string[]>;
|
|
211
304
|
function __promisify__(hostname: string, options: ResolveWithTtlOptions): Promise<RecordWithTtl[]>;
|
|
212
305
|
function __promisify__(hostname: string, options?: ResolveOptions): Promise<string[] | RecordWithTtl[]>;
|
|
213
306
|
}
|
|
214
|
-
|
|
307
|
+
/**
|
|
308
|
+
* Uses the DNS protocol to resolve `CNAME` records for the `hostname`. The`addresses` argument passed to the `callback` function
|
|
309
|
+
* will contain an array of canonical name records available for the `hostname`(e.g. `['bar.example.com']`).
|
|
310
|
+
* @since v0.3.2
|
|
311
|
+
*/
|
|
215
312
|
export function resolveCname(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
|
|
216
313
|
export namespace resolveCname {
|
|
217
314
|
function __promisify__(hostname: string): Promise<string[]>;
|
|
218
315
|
}
|
|
219
|
-
|
|
316
|
+
/**
|
|
317
|
+
* Uses the DNS protocol to resolve `CAA` records for the `hostname`. The`addresses` argument passed to the `callback` function
|
|
318
|
+
* will contain an array of certification authority authorization records
|
|
319
|
+
* available for the `hostname` (e.g. `[{critical: 0, iodef: 'mailto:pki@example.com'}, {critical: 128, issue: 'pki.example.com'}]`).
|
|
320
|
+
* @since v15.0.0, v14.17.0
|
|
321
|
+
*/
|
|
220
322
|
export function resolveCaa(hostname: string, callback: (err: NodeJS.ErrnoException | null, records: CaaRecord[]) => void): void;
|
|
221
323
|
export namespace resolveCaa {
|
|
222
324
|
function __promisify__(hostname: string): Promise<CaaRecord[]>;
|
|
223
325
|
}
|
|
224
|
-
|
|
326
|
+
/**
|
|
327
|
+
* Uses the DNS protocol to resolve mail exchange records (`MX` records) for the`hostname`. The `addresses` argument passed to the `callback` function will
|
|
328
|
+
* contain an array of objects containing both a `priority` and `exchange`property (e.g. `[{priority: 10, exchange: 'mx.example.com'}, ...]`).
|
|
329
|
+
* @since v0.1.27
|
|
330
|
+
*/
|
|
225
331
|
export function resolveMx(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: MxRecord[]) => void): void;
|
|
226
332
|
export namespace resolveMx {
|
|
227
333
|
function __promisify__(hostname: string): Promise<MxRecord[]>;
|
|
228
334
|
}
|
|
229
|
-
|
|
335
|
+
/**
|
|
336
|
+
* Uses the DNS protocol to resolve regular expression based records (`NAPTR`records) for the `hostname`. The `addresses` argument passed to the `callback`function will contain an array of
|
|
337
|
+
* objects with the following properties:
|
|
338
|
+
*
|
|
339
|
+
* * `flags`
|
|
340
|
+
* * `service`
|
|
341
|
+
* * `regexp`
|
|
342
|
+
* * `replacement`
|
|
343
|
+
* * `order`
|
|
344
|
+
* * `preference`
|
|
345
|
+
*
|
|
346
|
+
* ```js
|
|
347
|
+
* {
|
|
348
|
+
* flags: 's',
|
|
349
|
+
* service: 'SIP+D2U',
|
|
350
|
+
* regexp: '',
|
|
351
|
+
* replacement: '_sip._udp.example.com',
|
|
352
|
+
* order: 30,
|
|
353
|
+
* preference: 100
|
|
354
|
+
* }
|
|
355
|
+
* ```
|
|
356
|
+
* @since v0.9.12
|
|
357
|
+
*/
|
|
230
358
|
export function resolveNaptr(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: NaptrRecord[]) => void): void;
|
|
231
359
|
export namespace resolveNaptr {
|
|
232
360
|
function __promisify__(hostname: string): Promise<NaptrRecord[]>;
|
|
233
361
|
}
|
|
234
|
-
|
|
362
|
+
/**
|
|
363
|
+
* Uses the DNS protocol to resolve name server records (`NS` records) for the`hostname`. The `addresses` argument passed to the `callback` function will
|
|
364
|
+
* contain an array of name server records available for `hostname`(e.g. `['ns1.example.com', 'ns2.example.com']`).
|
|
365
|
+
* @since v0.1.90
|
|
366
|
+
*/
|
|
235
367
|
export function resolveNs(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
|
|
236
368
|
export namespace resolveNs {
|
|
237
369
|
function __promisify__(hostname: string): Promise<string[]>;
|
|
238
370
|
}
|
|
239
|
-
|
|
371
|
+
/**
|
|
372
|
+
* Uses the DNS protocol to resolve pointer records (`PTR` records) for the`hostname`. The `addresses` argument passed to the `callback` function will
|
|
373
|
+
* be an array of strings containing the reply records.
|
|
374
|
+
* @since v6.0.0
|
|
375
|
+
*/
|
|
240
376
|
export function resolvePtr(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void): void;
|
|
241
377
|
export namespace resolvePtr {
|
|
242
378
|
function __promisify__(hostname: string): Promise<string[]>;
|
|
243
379
|
}
|
|
244
|
-
|
|
380
|
+
/**
|
|
381
|
+
* Uses the DNS protocol to resolve a start of authority record (`SOA` record) for
|
|
382
|
+
* the `hostname`. The `address` argument passed to the `callback` function will
|
|
383
|
+
* be an object with the following properties:
|
|
384
|
+
*
|
|
385
|
+
* * `nsname`
|
|
386
|
+
* * `hostmaster`
|
|
387
|
+
* * `serial`
|
|
388
|
+
* * `refresh`
|
|
389
|
+
* * `retry`
|
|
390
|
+
* * `expire`
|
|
391
|
+
* * `minttl`
|
|
392
|
+
*
|
|
393
|
+
* ```js
|
|
394
|
+
* {
|
|
395
|
+
* nsname: 'ns.example.com',
|
|
396
|
+
* hostmaster: 'root.example.com',
|
|
397
|
+
* serial: 2013101809,
|
|
398
|
+
* refresh: 10000,
|
|
399
|
+
* retry: 2400,
|
|
400
|
+
* expire: 604800,
|
|
401
|
+
* minttl: 3600
|
|
402
|
+
* }
|
|
403
|
+
* ```
|
|
404
|
+
* @since v0.11.10
|
|
405
|
+
*/
|
|
245
406
|
export function resolveSoa(hostname: string, callback: (err: NodeJS.ErrnoException | null, address: SoaRecord) => void): void;
|
|
246
407
|
export namespace resolveSoa {
|
|
247
408
|
function __promisify__(hostname: string): Promise<SoaRecord>;
|
|
248
409
|
}
|
|
249
|
-
|
|
410
|
+
/**
|
|
411
|
+
* Uses the DNS protocol to resolve service records (`SRV` records) for the`hostname`. The `addresses` argument passed to the `callback` function will
|
|
412
|
+
* be an array of objects with the following properties:
|
|
413
|
+
*
|
|
414
|
+
* * `priority`
|
|
415
|
+
* * `weight`
|
|
416
|
+
* * `port`
|
|
417
|
+
* * `name`
|
|
418
|
+
*
|
|
419
|
+
* ```js
|
|
420
|
+
* {
|
|
421
|
+
* priority: 10,
|
|
422
|
+
* weight: 5,
|
|
423
|
+
* port: 21223,
|
|
424
|
+
* name: 'service.example.com'
|
|
425
|
+
* }
|
|
426
|
+
* ```
|
|
427
|
+
* @since v0.1.27
|
|
428
|
+
*/
|
|
250
429
|
export function resolveSrv(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: SrvRecord[]) => void): void;
|
|
251
430
|
export namespace resolveSrv {
|
|
252
431
|
function __promisify__(hostname: string): Promise<SrvRecord[]>;
|
|
253
432
|
}
|
|
254
|
-
|
|
433
|
+
/**
|
|
434
|
+
* Uses the DNS protocol to resolve text queries (`TXT` records) for the`hostname`. The `records` argument passed to the `callback` function is a
|
|
435
|
+
* two-dimensional array of the text records available for `hostname` (e.g.`[ ['v=spf1 ip4:0.0.0.0 ', '~all' ] ]`). Each sub-array contains TXT chunks of
|
|
436
|
+
* one record. Depending on the use case, these could be either joined together or
|
|
437
|
+
* treated separately.
|
|
438
|
+
* @since v0.1.27
|
|
439
|
+
*/
|
|
255
440
|
export function resolveTxt(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: string[][]) => void): void;
|
|
256
441
|
export namespace resolveTxt {
|
|
257
442
|
function __promisify__(hostname: string): Promise<string[][]>;
|
|
258
443
|
}
|
|
259
|
-
|
|
444
|
+
/**
|
|
445
|
+
* Uses the DNS protocol to resolve all records (also known as `ANY` or `*` query).
|
|
446
|
+
* The `ret` argument passed to the `callback` function will be an array containing
|
|
447
|
+
* various types of records. Each object has a property `type` that indicates the
|
|
448
|
+
* type of the current record. And depending on the `type`, additional properties
|
|
449
|
+
* will be present on the object:
|
|
450
|
+
*
|
|
451
|
+
* <omitted>
|
|
452
|
+
*
|
|
453
|
+
* Here is an example of the `ret` object passed to the callback:
|
|
454
|
+
*
|
|
455
|
+
* ```js
|
|
456
|
+
* [ { type: 'A', address: '127.0.0.1', ttl: 299 },
|
|
457
|
+
* { type: 'CNAME', value: 'example.com' },
|
|
458
|
+
* { type: 'MX', exchange: 'alt4.aspmx.l.example.com', priority: 50 },
|
|
459
|
+
* { type: 'NS', value: 'ns1.example.com' },
|
|
460
|
+
* { type: 'TXT', entries: [ 'v=spf1 include:_spf.example.com ~all' ] },
|
|
461
|
+
* { type: 'SOA',
|
|
462
|
+
* nsname: 'ns1.example.com',
|
|
463
|
+
* hostmaster: 'admin.example.com',
|
|
464
|
+
* serial: 156696742,
|
|
465
|
+
* refresh: 900,
|
|
466
|
+
* retry: 900,
|
|
467
|
+
* expire: 1800,
|
|
468
|
+
* minttl: 60 } ]
|
|
469
|
+
* ```
|
|
470
|
+
*
|
|
471
|
+
* DNS server operators may choose not to respond to `ANY`queries. It may be better to call individual methods like {@link resolve4},{@link resolveMx}, and so on. For more details, see [RFC
|
|
472
|
+
* 8482](https://tools.ietf.org/html/rfc8482).
|
|
473
|
+
*/
|
|
260
474
|
export function resolveAny(hostname: string, callback: (err: NodeJS.ErrnoException | null, addresses: AnyRecord[]) => void): void;
|
|
261
475
|
export namespace resolveAny {
|
|
262
476
|
function __promisify__(hostname: string): Promise<AnyRecord[]>;
|
|
263
477
|
}
|
|
264
|
-
|
|
478
|
+
/**
|
|
479
|
+
* Performs a reverse DNS query that resolves an IPv4 or IPv6 address to an
|
|
480
|
+
* array of host names.
|
|
481
|
+
*
|
|
482
|
+
* On error, `err` is an `Error` object, where `err.code` is
|
|
483
|
+
* one of the `DNS error codes`.
|
|
484
|
+
* @since v0.1.16
|
|
485
|
+
*/
|
|
265
486
|
export function reverse(ip: string, callback: (err: NodeJS.ErrnoException | null, hostnames: string[]) => void): void;
|
|
487
|
+
/**
|
|
488
|
+
* Sets the IP address and port of servers to be used when performing DNS
|
|
489
|
+
* resolution. The `servers` argument is an array of [RFC 5952](https://tools.ietf.org/html/rfc5952#section-6) formatted
|
|
490
|
+
* addresses. If the port is the IANA default DNS port (53) it can be omitted.
|
|
491
|
+
*
|
|
492
|
+
* ```js
|
|
493
|
+
* dns.setServers([
|
|
494
|
+
* '4.4.4.4',
|
|
495
|
+
* '[2001:4860:4860::8888]',
|
|
496
|
+
* '4.4.4.4:1053',
|
|
497
|
+
* '[2001:4860:4860::8888]:1053',
|
|
498
|
+
* ]);
|
|
499
|
+
* ```
|
|
500
|
+
*
|
|
501
|
+
* An error will be thrown if an invalid address is provided.
|
|
502
|
+
*
|
|
503
|
+
* The `dns.setServers()` method must not be called while a DNS query is in
|
|
504
|
+
* progress.
|
|
505
|
+
*
|
|
506
|
+
* The {@link setServers} method affects only {@link resolve},`dns.resolve*()` and {@link reverse} (and specifically _not_ {@link lookup}).
|
|
507
|
+
*
|
|
508
|
+
* This method works much like [resolve.conf](https://man7.org/linux/man-pages/man5/resolv.conf.5.html).
|
|
509
|
+
* That is, if attempting to resolve with the first server provided results in a`NOTFOUND` error, the `resolve()` method will _not_ attempt to resolve with
|
|
510
|
+
* subsequent servers provided. Fallback DNS servers will only be used if the
|
|
511
|
+
* earlier ones time out or result in some other error.
|
|
512
|
+
* @since v0.11.3
|
|
513
|
+
* @param servers array of `RFC 5952` formatted addresses
|
|
514
|
+
*/
|
|
266
515
|
export function setServers(servers: ReadonlyArray<string>): void;
|
|
516
|
+
/**
|
|
517
|
+
* Returns an array of IP address strings, formatted according to [RFC 5952](https://tools.ietf.org/html/rfc5952#section-6),
|
|
518
|
+
* that are currently configured for DNS resolution. A string will include a port
|
|
519
|
+
* section if a custom port is used.
|
|
520
|
+
*
|
|
521
|
+
* ```js
|
|
522
|
+
* [
|
|
523
|
+
* '4.4.4.4',
|
|
524
|
+
* '2001:4860:4860::8888',
|
|
525
|
+
* '4.4.4.4:1053',
|
|
526
|
+
* '[2001:4860:4860::8888]:1053',
|
|
527
|
+
* ]
|
|
528
|
+
* ```
|
|
529
|
+
* @since v0.11.3
|
|
530
|
+
*/
|
|
267
531
|
export function getServers(): string[];
|
|
268
|
-
|
|
532
|
+
/**
|
|
533
|
+
* Set the default value of `verbatim` in {@link lookup} and `dnsPromises.lookup()`. The value could be:
|
|
534
|
+
*
|
|
535
|
+
* * `ipv4first`: sets default `verbatim` `false`.
|
|
536
|
+
* * `verbatim`: sets default `verbatim` `true`.
|
|
537
|
+
*
|
|
538
|
+
* The default is `ipv4first` and {@link setDefaultResultOrder} have higher
|
|
539
|
+
* priority than `--dns-result-order`. When using `worker threads`,{@link setDefaultResultOrder} from the main thread won't affect the default
|
|
540
|
+
* dns orders in workers.
|
|
541
|
+
* @since v16.4.0, v14.18.0
|
|
542
|
+
* @param order must be `'ipv4first'` or `'verbatim'`.
|
|
543
|
+
*/
|
|
544
|
+
export function setDefaultResultOrder(order: 'ipv4first' | 'verbatim'): void;
|
|
269
545
|
// Error codes
|
|
270
546
|
export const NODATA: string;
|
|
271
547
|
export const FORMERR: string;
|
|
@@ -291,14 +567,58 @@ declare module 'dns' {
|
|
|
291
567
|
export const LOADIPHLPAPI: string;
|
|
292
568
|
export const ADDRGETNETWORKPARAMS: string;
|
|
293
569
|
export const CANCELLED: string;
|
|
294
|
-
|
|
295
570
|
export interface ResolverOptions {
|
|
296
|
-
timeout?: number;
|
|
571
|
+
timeout?: number | undefined;
|
|
572
|
+
/**
|
|
573
|
+
* @default 4
|
|
574
|
+
*/
|
|
575
|
+
tries?: number;
|
|
297
576
|
}
|
|
298
|
-
|
|
577
|
+
/**
|
|
578
|
+
* An independent resolver for DNS requests.
|
|
579
|
+
*
|
|
580
|
+
* Creating a new resolver uses the default server settings. Setting
|
|
581
|
+
* the servers used for a resolver using `resolver.setServers()` does not affect
|
|
582
|
+
* other resolvers:
|
|
583
|
+
*
|
|
584
|
+
* ```js
|
|
585
|
+
* const { Resolver } = require('dns');
|
|
586
|
+
* const resolver = new Resolver();
|
|
587
|
+
* resolver.setServers(['4.4.4.4']);
|
|
588
|
+
*
|
|
589
|
+
* // This request will use the server at 4.4.4.4, independent of global settings.
|
|
590
|
+
* resolver.resolve4('example.org', (err, addresses) => {
|
|
591
|
+
* // ...
|
|
592
|
+
* });
|
|
593
|
+
* ```
|
|
594
|
+
*
|
|
595
|
+
* The following methods from the `dns` module are available:
|
|
596
|
+
*
|
|
597
|
+
* * `resolver.getServers()`
|
|
598
|
+
* * `resolver.resolve()`
|
|
599
|
+
* * `resolver.resolve4()`
|
|
600
|
+
* * `resolver.resolve6()`
|
|
601
|
+
* * `resolver.resolveAny()`
|
|
602
|
+
* * `resolver.resolveCaa()`
|
|
603
|
+
* * `resolver.resolveCname()`
|
|
604
|
+
* * `resolver.resolveMx()`
|
|
605
|
+
* * `resolver.resolveNaptr()`
|
|
606
|
+
* * `resolver.resolveNs()`
|
|
607
|
+
* * `resolver.resolvePtr()`
|
|
608
|
+
* * `resolver.resolveSoa()`
|
|
609
|
+
* * `resolver.resolveSrv()`
|
|
610
|
+
* * `resolver.resolveTxt()`
|
|
611
|
+
* * `resolver.reverse()`
|
|
612
|
+
* * `resolver.setServers()`
|
|
613
|
+
* @since v8.3.0
|
|
614
|
+
*/
|
|
299
615
|
export class Resolver {
|
|
300
616
|
constructor(options?: ResolverOptions);
|
|
301
|
-
|
|
617
|
+
/**
|
|
618
|
+
* Cancel all outstanding DNS queries made by this resolver. The corresponding
|
|
619
|
+
* callbacks will be called with an error with code `ECANCELLED`.
|
|
620
|
+
* @since v8.3.0
|
|
621
|
+
*/
|
|
302
622
|
cancel(): void;
|
|
303
623
|
getServers: typeof getServers;
|
|
304
624
|
resolve: typeof resolve;
|
|
@@ -314,9 +634,26 @@ declare module 'dns' {
|
|
|
314
634
|
resolveSrv: typeof resolveSrv;
|
|
315
635
|
resolveTxt: typeof resolveTxt;
|
|
316
636
|
reverse: typeof reverse;
|
|
637
|
+
/**
|
|
638
|
+
* The resolver instance will send its requests from the specified IP address.
|
|
639
|
+
* This allows programs to specify outbound interfaces when used on multi-homed
|
|
640
|
+
* systems.
|
|
641
|
+
*
|
|
642
|
+
* If a v4 or v6 address is not specified, it is set to the default, and the
|
|
643
|
+
* operating system will choose a local address automatically.
|
|
644
|
+
*
|
|
645
|
+
* The resolver will use the v4 local address when making requests to IPv4 DNS
|
|
646
|
+
* servers, and the v6 local address when making requests to IPv6 DNS servers.
|
|
647
|
+
* The `rrtype` of resolution requests has no impact on the local address used.
|
|
648
|
+
* @since v15.1.0, v14.17.0
|
|
649
|
+
* @param [ipv4='0.0.0.0'] A string representation of an IPv4 address.
|
|
650
|
+
* @param [ipv6='::0'] A string representation of an IPv6 address.
|
|
651
|
+
*/
|
|
317
652
|
setLocalAddress(ipv4?: string, ipv6?: string): void;
|
|
318
653
|
setServers: typeof setServers;
|
|
319
654
|
}
|
|
320
|
-
|
|
321
655
|
export { dnsPromises as promises };
|
|
322
656
|
}
|
|
657
|
+
declare module 'node:dns' {
|
|
658
|
+
export * from 'dns';
|
|
659
|
+
}
|