rahad-all-downloader 2.1.16 → 2.1.17
Sign up to get free protection for your applications and to get access to all the features.
- package/.github/workflows/Run.yml +20 -0
- package/README.md +0 -1
- package/index.js +1 -1
- package/package.json +4 -2
- package/.cache/nix/binary-cache-v6.sqlite +0 -0
- package/.cache/nix/binary-cache-v6.sqlite-journal +0 -0
- package/.cache/replit/env/latest +0 -123
- package/.cache/replit/env/latest.json +0 -1
- package/.cache/replit/modules/nix.res +0 -1
- package/.cache/replit/modules/nodejs-20.res +0 -1
- package/.cache/replit/modules/replit.res +0 -1
- package/.cache/replit/modules.stamp +0 -0
- package/.cache/replit/nix/env.json +0 -1
- package/.cache/typescript/5.4/node_modules/.package-lock.json +0 -137
- package/.cache/typescript/5.4/node_modules/@types/caseless/LICENSE +0 -21
- package/.cache/typescript/5.4/node_modules/@types/caseless/README.md +0 -48
- package/.cache/typescript/5.4/node_modules/@types/caseless/index.d.ts +0 -29
- package/.cache/typescript/5.4/node_modules/@types/caseless/package.json +0 -35
- package/.cache/typescript/5.4/node_modules/@types/node/LICENSE +0 -21
- package/.cache/typescript/5.4/node_modules/@types/node/README.md +0 -15
- package/.cache/typescript/5.4/node_modules/@types/node/assert/strict.d.ts +0 -8
- package/.cache/typescript/5.4/node_modules/@types/node/assert.d.ts +0 -1040
- package/.cache/typescript/5.4/node_modules/@types/node/async_hooks.d.ts +0 -541
- package/.cache/typescript/5.4/node_modules/@types/node/buffer.d.ts +0 -2363
- package/.cache/typescript/5.4/node_modules/@types/node/child_process.d.ts +0 -1544
- package/.cache/typescript/5.4/node_modules/@types/node/cluster.d.ts +0 -578
- package/.cache/typescript/5.4/node_modules/@types/node/console.d.ts +0 -452
- package/.cache/typescript/5.4/node_modules/@types/node/constants.d.ts +0 -19
- package/.cache/typescript/5.4/node_modules/@types/node/crypto.d.ts +0 -4523
- package/.cache/typescript/5.4/node_modules/@types/node/dgram.d.ts +0 -596
- package/.cache/typescript/5.4/node_modules/@types/node/diagnostics_channel.d.ts +0 -554
- package/.cache/typescript/5.4/node_modules/@types/node/dns/promises.d.ts +0 -474
- package/.cache/typescript/5.4/node_modules/@types/node/dns.d.ts +0 -864
- package/.cache/typescript/5.4/node_modules/@types/node/dom-events.d.ts +0 -124
- package/.cache/typescript/5.4/node_modules/@types/node/domain.d.ts +0 -170
- package/.cache/typescript/5.4/node_modules/@types/node/events.d.ts +0 -909
- package/.cache/typescript/5.4/node_modules/@types/node/fs/promises.d.ts +0 -1245
- package/.cache/typescript/5.4/node_modules/@types/node/fs.d.ts +0 -4317
- package/.cache/typescript/5.4/node_modules/@types/node/globals.d.ts +0 -411
- package/.cache/typescript/5.4/node_modules/@types/node/globals.global.d.ts +0 -1
- package/.cache/typescript/5.4/node_modules/@types/node/http.d.ts +0 -1908
- package/.cache/typescript/5.4/node_modules/@types/node/http2.d.ts +0 -2418
- package/.cache/typescript/5.4/node_modules/@types/node/https.d.ts +0 -550
- package/.cache/typescript/5.4/node_modules/@types/node/index.d.ts +0 -89
- package/.cache/typescript/5.4/node_modules/@types/node/inspector.d.ts +0 -2746
- package/.cache/typescript/5.4/node_modules/@types/node/module.d.ts +0 -315
- package/.cache/typescript/5.4/node_modules/@types/node/net.d.ts +0 -999
- package/.cache/typescript/5.4/node_modules/@types/node/os.d.ts +0 -495
- package/.cache/typescript/5.4/node_modules/@types/node/package.json +0 -217
- package/.cache/typescript/5.4/node_modules/@types/node/path.d.ts +0 -191
- package/.cache/typescript/5.4/node_modules/@types/node/perf_hooks.d.ts +0 -905
- package/.cache/typescript/5.4/node_modules/@types/node/process.d.ts +0 -1754
- package/.cache/typescript/5.4/node_modules/@types/node/punycode.d.ts +0 -117
- package/.cache/typescript/5.4/node_modules/@types/node/querystring.d.ts +0 -153
- package/.cache/typescript/5.4/node_modules/@types/node/readline/promises.d.ts +0 -150
- package/.cache/typescript/5.4/node_modules/@types/node/readline.d.ts +0 -540
- package/.cache/typescript/5.4/node_modules/@types/node/repl.d.ts +0 -430
- package/.cache/typescript/5.4/node_modules/@types/node/sea.d.ts +0 -153
- package/.cache/typescript/5.4/node_modules/@types/node/stream/consumers.d.ts +0 -12
- package/.cache/typescript/5.4/node_modules/@types/node/stream/promises.d.ts +0 -83
- package/.cache/typescript/5.4/node_modules/@types/node/stream/web.d.ts +0 -367
- package/.cache/typescript/5.4/node_modules/@types/node/stream.d.ts +0 -1707
- package/.cache/typescript/5.4/node_modules/@types/node/string_decoder.d.ts +0 -67
- package/.cache/typescript/5.4/node_modules/@types/node/test.d.ts +0 -1718
- package/.cache/typescript/5.4/node_modules/@types/node/timers/promises.d.ts +0 -97
- package/.cache/typescript/5.4/node_modules/@types/node/timers.d.ts +0 -240
- package/.cache/typescript/5.4/node_modules/@types/node/tls.d.ts +0 -1217
- package/.cache/typescript/5.4/node_modules/@types/node/trace_events.d.ts +0 -197
- package/.cache/typescript/5.4/node_modules/@types/node/tty.d.ts +0 -208
- package/.cache/typescript/5.4/node_modules/@types/node/url.d.ts +0 -952
- package/.cache/typescript/5.4/node_modules/@types/node/util.d.ts +0 -2292
- package/.cache/typescript/5.4/node_modules/@types/node/v8.d.ts +0 -808
- package/.cache/typescript/5.4/node_modules/@types/node/vm.d.ts +0 -924
- package/.cache/typescript/5.4/node_modules/@types/node/wasi.d.ts +0 -181
- package/.cache/typescript/5.4/node_modules/@types/node/worker_threads.d.ts +0 -691
- package/.cache/typescript/5.4/node_modules/@types/node/zlib.d.ts +0 -530
- package/.cache/typescript/5.4/node_modules/@types/node-fetch/LICENSE +0 -21
- package/.cache/typescript/5.4/node_modules/@types/node-fetch/README.md +0 -15
- package/.cache/typescript/5.4/node_modules/@types/node-fetch/externals.d.ts +0 -32
- package/.cache/typescript/5.4/node_modules/@types/node-fetch/index.d.ts +0 -238
- package/.cache/typescript/5.4/node_modules/@types/node-fetch/package.json +0 -83
- package/.cache/typescript/5.4/node_modules/@types/request/LICENSE +0 -21
- package/.cache/typescript/5.4/node_modules/@types/request/README.md +0 -15
- package/.cache/typescript/5.4/node_modules/@types/request/index.d.ts +0 -395
- package/.cache/typescript/5.4/node_modules/@types/request/node_modules/form-data/License +0 -19
- package/.cache/typescript/5.4/node_modules/@types/request/node_modules/form-data/README.md +0 -350
- package/.cache/typescript/5.4/node_modules/@types/request/node_modules/form-data/README.md.bak +0 -350
- package/.cache/typescript/5.4/node_modules/@types/request/node_modules/form-data/index.d.ts +0 -51
- package/.cache/typescript/5.4/node_modules/@types/request/node_modules/form-data/lib/browser.js +0 -2
- package/.cache/typescript/5.4/node_modules/@types/request/node_modules/form-data/lib/form_data.js +0 -483
- package/.cache/typescript/5.4/node_modules/@types/request/node_modules/form-data/lib/populate.js +0 -10
- package/.cache/typescript/5.4/node_modules/@types/request/node_modules/form-data/package.json +0 -68
- package/.cache/typescript/5.4/node_modules/@types/request/package.json +0 -70
- package/.cache/typescript/5.4/node_modules/@types/tough-cookie/LICENSE +0 -21
- package/.cache/typescript/5.4/node_modules/@types/tough-cookie/README.md +0 -15
- package/.cache/typescript/5.4/node_modules/@types/tough-cookie/index.d.ts +0 -321
- package/.cache/typescript/5.4/node_modules/@types/tough-cookie/package.json +0 -35
- package/.cache/typescript/5.4/node_modules/asynckit/LICENSE +0 -21
- package/.cache/typescript/5.4/node_modules/asynckit/README.md +0 -233
- package/.cache/typescript/5.4/node_modules/asynckit/bench.js +0 -76
- package/.cache/typescript/5.4/node_modules/asynckit/index.js +0 -6
- package/.cache/typescript/5.4/node_modules/asynckit/lib/abort.js +0 -29
- package/.cache/typescript/5.4/node_modules/asynckit/lib/async.js +0 -34
- package/.cache/typescript/5.4/node_modules/asynckit/lib/defer.js +0 -26
- package/.cache/typescript/5.4/node_modules/asynckit/lib/iterate.js +0 -75
- package/.cache/typescript/5.4/node_modules/asynckit/lib/readable_asynckit.js +0 -91
- package/.cache/typescript/5.4/node_modules/asynckit/lib/readable_parallel.js +0 -25
- package/.cache/typescript/5.4/node_modules/asynckit/lib/readable_serial.js +0 -25
- package/.cache/typescript/5.4/node_modules/asynckit/lib/readable_serial_ordered.js +0 -29
- package/.cache/typescript/5.4/node_modules/asynckit/lib/state.js +0 -37
- package/.cache/typescript/5.4/node_modules/asynckit/lib/streamify.js +0 -141
- package/.cache/typescript/5.4/node_modules/asynckit/lib/terminator.js +0 -29
- package/.cache/typescript/5.4/node_modules/asynckit/package.json +0 -63
- package/.cache/typescript/5.4/node_modules/asynckit/parallel.js +0 -43
- package/.cache/typescript/5.4/node_modules/asynckit/serial.js +0 -17
- package/.cache/typescript/5.4/node_modules/asynckit/serialOrdered.js +0 -75
- package/.cache/typescript/5.4/node_modules/asynckit/stream.js +0 -21
- package/.cache/typescript/5.4/node_modules/combined-stream/License +0 -19
- package/.cache/typescript/5.4/node_modules/combined-stream/Readme.md +0 -138
- package/.cache/typescript/5.4/node_modules/combined-stream/lib/combined_stream.js +0 -208
- package/.cache/typescript/5.4/node_modules/combined-stream/package.json +0 -25
- package/.cache/typescript/5.4/node_modules/combined-stream/yarn.lock +0 -17
- package/.cache/typescript/5.4/node_modules/delayed-stream/License +0 -19
- package/.cache/typescript/5.4/node_modules/delayed-stream/Makefile +0 -7
- package/.cache/typescript/5.4/node_modules/delayed-stream/Readme.md +0 -141
- package/.cache/typescript/5.4/node_modules/delayed-stream/lib/delayed_stream.js +0 -107
- package/.cache/typescript/5.4/node_modules/delayed-stream/package.json +0 -27
- package/.cache/typescript/5.4/node_modules/form-data/License +0 -19
- package/.cache/typescript/5.4/node_modules/form-data/README.md.bak +0 -358
- package/.cache/typescript/5.4/node_modules/form-data/Readme.md +0 -358
- package/.cache/typescript/5.4/node_modules/form-data/index.d.ts +0 -62
- package/.cache/typescript/5.4/node_modules/form-data/lib/browser.js +0 -2
- package/.cache/typescript/5.4/node_modules/form-data/lib/form_data.js +0 -501
- package/.cache/typescript/5.4/node_modules/form-data/lib/populate.js +0 -10
- package/.cache/typescript/5.4/node_modules/form-data/package.json +0 -68
- package/.cache/typescript/5.4/node_modules/mime-db/HISTORY.md +0 -507
- package/.cache/typescript/5.4/node_modules/mime-db/LICENSE +0 -23
- package/.cache/typescript/5.4/node_modules/mime-db/README.md +0 -100
- package/.cache/typescript/5.4/node_modules/mime-db/db.json +0 -8519
- package/.cache/typescript/5.4/node_modules/mime-db/index.js +0 -12
- package/.cache/typescript/5.4/node_modules/mime-db/package.json +0 -60
- package/.cache/typescript/5.4/node_modules/mime-types/HISTORY.md +0 -397
- package/.cache/typescript/5.4/node_modules/mime-types/LICENSE +0 -23
- package/.cache/typescript/5.4/node_modules/mime-types/README.md +0 -113
- package/.cache/typescript/5.4/node_modules/mime-types/index.js +0 -188
- package/.cache/typescript/5.4/node_modules/mime-types/package.json +0 -44
- package/.cache/typescript/5.4/node_modules/types-registry/README.md +0 -2
- package/.cache/typescript/5.4/node_modules/types-registry/index.json +0 -1
- package/.cache/typescript/5.4/node_modules/types-registry/package.json +0 -20
- package/.cache/typescript/5.4/node_modules/undici-types/README.md +0 -6
- package/.cache/typescript/5.4/node_modules/undici-types/agent.d.ts +0 -31
- package/.cache/typescript/5.4/node_modules/undici-types/api.d.ts +0 -43
- package/.cache/typescript/5.4/node_modules/undici-types/balanced-pool.d.ts +0 -18
- package/.cache/typescript/5.4/node_modules/undici-types/cache.d.ts +0 -36
- package/.cache/typescript/5.4/node_modules/undici-types/client.d.ts +0 -97
- package/.cache/typescript/5.4/node_modules/undici-types/connector.d.ts +0 -34
- package/.cache/typescript/5.4/node_modules/undici-types/content-type.d.ts +0 -21
- package/.cache/typescript/5.4/node_modules/undici-types/cookies.d.ts +0 -28
- package/.cache/typescript/5.4/node_modules/undici-types/diagnostics-channel.d.ts +0 -67
- package/.cache/typescript/5.4/node_modules/undici-types/dispatcher.d.ts +0 -241
- package/.cache/typescript/5.4/node_modules/undici-types/errors.d.ts +0 -128
- package/.cache/typescript/5.4/node_modules/undici-types/fetch.d.ts +0 -209
- package/.cache/typescript/5.4/node_modules/undici-types/file.d.ts +0 -39
- package/.cache/typescript/5.4/node_modules/undici-types/filereader.d.ts +0 -54
- package/.cache/typescript/5.4/node_modules/undici-types/formdata.d.ts +0 -108
- package/.cache/typescript/5.4/node_modules/undici-types/global-dispatcher.d.ts +0 -9
- package/.cache/typescript/5.4/node_modules/undici-types/global-origin.d.ts +0 -7
- package/.cache/typescript/5.4/node_modules/undici-types/handlers.d.ts +0 -9
- package/.cache/typescript/5.4/node_modules/undici-types/header.d.ts +0 -4
- package/.cache/typescript/5.4/node_modules/undici-types/index.d.ts +0 -63
- package/.cache/typescript/5.4/node_modules/undici-types/interceptors.d.ts +0 -5
- package/.cache/typescript/5.4/node_modules/undici-types/mock-agent.d.ts +0 -50
- package/.cache/typescript/5.4/node_modules/undici-types/mock-client.d.ts +0 -25
- package/.cache/typescript/5.4/node_modules/undici-types/mock-errors.d.ts +0 -12
- package/.cache/typescript/5.4/node_modules/undici-types/mock-interceptor.d.ts +0 -93
- package/.cache/typescript/5.4/node_modules/undici-types/mock-pool.d.ts +0 -25
- package/.cache/typescript/5.4/node_modules/undici-types/package.json +0 -55
- package/.cache/typescript/5.4/node_modules/undici-types/patch.d.ts +0 -71
- package/.cache/typescript/5.4/node_modules/undici-types/pool-stats.d.ts +0 -19
- package/.cache/typescript/5.4/node_modules/undici-types/pool.d.ts +0 -28
- package/.cache/typescript/5.4/node_modules/undici-types/proxy-agent.d.ts +0 -30
- package/.cache/typescript/5.4/node_modules/undici-types/readable.d.ts +0 -61
- package/.cache/typescript/5.4/node_modules/undici-types/webidl.d.ts +0 -220
- package/.cache/typescript/5.4/node_modules/undici-types/websocket.d.ts +0 -131
- package/.cache/typescript/5.4/package-lock.json +0 -146
- package/.cache/typescript/5.4/package.json +0 -1
- package/.replit +0 -21
- package/replit.nix +0 -3
@@ -1,864 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* The `node: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('node: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 `node: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('node: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](https://nodejs.org/docs/latest-v20.x/api/dns.html#implementation-considerations) for more information.
|
45
|
-
* @see [source](https://github.com/nodejs/node/blob/v20.13.1/lib/dns.js)
|
46
|
-
*/
|
47
|
-
declare module "dns" {
|
48
|
-
import * as dnsPromises from "node:dns/promises";
|
49
|
-
// Supported getaddrinfo flags.
|
50
|
-
/**
|
51
|
-
* Limits returned address types to the types of non-loopback addresses configured on the system. For example, IPv4 addresses are
|
52
|
-
* only returned if the current system has at least one IPv4 address configured.
|
53
|
-
*/
|
54
|
-
export const ADDRCONFIG: number;
|
55
|
-
/**
|
56
|
-
* If the IPv6 family was specified, but no IPv6 addresses were found, then return IPv4 mapped IPv6 addresses. It is not supported
|
57
|
-
* on some operating systems (e.g. FreeBSD 10.1).
|
58
|
-
*/
|
59
|
-
export const V4MAPPED: number;
|
60
|
-
/**
|
61
|
-
* If `dns.V4MAPPED` is specified, return resolved IPv6 addresses as
|
62
|
-
* well as IPv4 mapped IPv6 addresses.
|
63
|
-
*/
|
64
|
-
export const ALL: number;
|
65
|
-
export interface LookupOptions {
|
66
|
-
/**
|
67
|
-
* The record family. Must be `4`, `6`, or `0`. For backward compatibility reasons, `'IPv4'` and `'IPv6'` are interpreted
|
68
|
-
* as `4` and `6` respectively. The value 0 indicates that either an IPv4 or IPv6 address is returned. If the value `0` is used
|
69
|
-
* with `{ all: true } (see below)`, both IPv4 and IPv6 addresses are returned.
|
70
|
-
* @default 0
|
71
|
-
*/
|
72
|
-
family?: number | "IPv4" | "IPv6" | undefined;
|
73
|
-
/**
|
74
|
-
* One or more [supported `getaddrinfo`](https://nodejs.org/docs/latest-v20.x/api/dns.html#supported-getaddrinfo-flags) flags. Multiple flags may be
|
75
|
-
* passed by bitwise `OR`ing their values.
|
76
|
-
*/
|
77
|
-
hints?: number | undefined;
|
78
|
-
/**
|
79
|
-
* When `true`, the callback returns all resolved addresses in an array. Otherwise, returns a single address.
|
80
|
-
* @default false
|
81
|
-
*/
|
82
|
-
all?: boolean | undefined;
|
83
|
-
/**
|
84
|
-
* When `verbatim`, the resolved addresses are return unsorted. When `ipv4first`, the resolved addresses are sorted
|
85
|
-
* by placing IPv4 addresses before IPv6 addresses. When `ipv6first`, the resolved addresses are sorted by placing IPv6
|
86
|
-
* addresses before IPv4 addresses. Default value is configurable using
|
87
|
-
* {@link setDefaultResultOrder} or [`--dns-result-order`](https://nodejs.org/docs/latest-v20.x/api/cli.html#--dns-result-orderorder).
|
88
|
-
* @default `verbatim` (addresses are not reordered)
|
89
|
-
*/
|
90
|
-
order?: "ipv4first" | "ipv6first" | "verbatim" | undefined;
|
91
|
-
/**
|
92
|
-
* When `true`, the callback receives IPv4 and IPv6 addresses in the order the DNS resolver returned them. When `false`, IPv4
|
93
|
-
* addresses are placed before IPv6 addresses. This option will be deprecated in favor of `order`. When both are specified,
|
94
|
-
* `order` has higher precedence. New code should only use `order`. Default value is configurable using {@link setDefaultResultOrder}
|
95
|
-
* or [`--dns-result-order`](https://nodejs.org/docs/latest-v20.x/api/cli.html#--dns-result-orderorder).
|
96
|
-
* @default true (addresses are not reordered)
|
97
|
-
*/
|
98
|
-
verbatim?: boolean | undefined;
|
99
|
-
}
|
100
|
-
export interface LookupOneOptions extends LookupOptions {
|
101
|
-
all?: false | undefined;
|
102
|
-
}
|
103
|
-
export interface LookupAllOptions extends LookupOptions {
|
104
|
-
all: true;
|
105
|
-
}
|
106
|
-
export interface LookupAddress {
|
107
|
-
/**
|
108
|
-
* A string representation of an IPv4 or IPv6 address.
|
109
|
-
*/
|
110
|
-
address: string;
|
111
|
-
/**
|
112
|
-
* `4` or `6`, denoting the family of `address`, or `0` if the address is not an IPv4 or IPv6 address. `0` is a likely indicator of a
|
113
|
-
* bug in the name resolution service used by the operating system.
|
114
|
-
*/
|
115
|
-
family: number;
|
116
|
-
}
|
117
|
-
/**
|
118
|
-
* Resolves a host name (e.g. `'nodejs.org'`) into the first found A (IPv4) or
|
119
|
-
* AAAA (IPv6) record. All `option` properties are optional. If `options` is an
|
120
|
-
* integer, then it must be `4` or `6` – if `options` is `0` or not provided, then
|
121
|
-
* IPv4 and IPv6 addresses are both returned if found.
|
122
|
-
*
|
123
|
-
* With the `all` option set to `true`, the arguments for `callback` change to `(err, addresses)`, with `addresses` being an array of objects with the
|
124
|
-
* properties `address` and `family`.
|
125
|
-
*
|
126
|
-
* On error, `err` is an `Error` object, where `err.code` is the error code.
|
127
|
-
* Keep in mind that `err.code` will be set to `'ENOTFOUND'` not only when
|
128
|
-
* the host name does not exist but also when the lookup fails in other ways
|
129
|
-
* such as no available file descriptors.
|
130
|
-
*
|
131
|
-
* `dns.lookup()` does not necessarily have anything to do with the DNS protocol.
|
132
|
-
* The implementation uses an operating system facility that can associate names
|
133
|
-
* with addresses and vice versa. This implementation can have subtle but
|
134
|
-
* important consequences on the behavior of any Node.js program. Please take some
|
135
|
-
* time to consult the [Implementation considerations section](https://nodejs.org/docs/latest-v20.x/api/dns.html#implementation-considerations)
|
136
|
-
* before using `dns.lookup()`.
|
137
|
-
*
|
138
|
-
* Example usage:
|
139
|
-
*
|
140
|
-
* ```js
|
141
|
-
* const dns = require('node:dns');
|
142
|
-
* const options = {
|
143
|
-
* family: 6,
|
144
|
-
* hints: dns.ADDRCONFIG | dns.V4MAPPED,
|
145
|
-
* };
|
146
|
-
* dns.lookup('example.com', options, (err, address, family) =>
|
147
|
-
* console.log('address: %j family: IPv%s', address, family));
|
148
|
-
* // address: "2606:2800:220:1:248:1893:25c8:1946" family: IPv6
|
149
|
-
*
|
150
|
-
* // When options.all is true, the result will be an Array.
|
151
|
-
* options.all = true;
|
152
|
-
* dns.lookup('example.com', options, (err, addresses) =>
|
153
|
-
* console.log('addresses: %j', addresses));
|
154
|
-
* // addresses: [{"address":"2606:2800:220:1:248:1893:25c8:1946","family":6}]
|
155
|
-
* ```
|
156
|
-
*
|
157
|
-
* If this method is invoked as its [util.promisify()](https://nodejs.org/docs/latest-v20.x/api/util.html#utilpromisifyoriginal) ed
|
158
|
-
* version, and `all` is not set to `true`, it returns a `Promise` for an `Object` with `address` and `family` properties.
|
159
|
-
* @since v0.1.90
|
160
|
-
*/
|
161
|
-
export function lookup(
|
162
|
-
hostname: string,
|
163
|
-
family: number,
|
164
|
-
callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void,
|
165
|
-
): void;
|
166
|
-
export function lookup(
|
167
|
-
hostname: string,
|
168
|
-
options: LookupOneOptions,
|
169
|
-
callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void,
|
170
|
-
): void;
|
171
|
-
export function lookup(
|
172
|
-
hostname: string,
|
173
|
-
options: LookupAllOptions,
|
174
|
-
callback: (err: NodeJS.ErrnoException | null, addresses: LookupAddress[]) => void,
|
175
|
-
): void;
|
176
|
-
export function lookup(
|
177
|
-
hostname: string,
|
178
|
-
options: LookupOptions,
|
179
|
-
callback: (err: NodeJS.ErrnoException | null, address: string | LookupAddress[], family: number) => void,
|
180
|
-
): void;
|
181
|
-
export function lookup(
|
182
|
-
hostname: string,
|
183
|
-
callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void,
|
184
|
-
): void;
|
185
|
-
export namespace lookup {
|
186
|
-
function __promisify__(hostname: string, options: LookupAllOptions): Promise<LookupAddress[]>;
|
187
|
-
function __promisify__(hostname: string, options?: LookupOneOptions | number): Promise<LookupAddress>;
|
188
|
-
function __promisify__(hostname: string, options: LookupOptions): Promise<LookupAddress | LookupAddress[]>;
|
189
|
-
}
|
190
|
-
/**
|
191
|
-
* Resolves the given `address` and `port` into a host name and service using
|
192
|
-
* the operating system's underlying `getnameinfo` implementation.
|
193
|
-
*
|
194
|
-
* If `address` is not a valid IP address, a `TypeError` will be thrown.
|
195
|
-
* The `port` will be coerced to a number. If it is not a legal port, a `TypeError` will be thrown.
|
196
|
-
*
|
197
|
-
* On an error, `err` is an [`Error`](https://nodejs.org/docs/latest-v20.x/api/errors.html#class-error) object,
|
198
|
-
* where `err.code` is the error code.
|
199
|
-
*
|
200
|
-
* ```js
|
201
|
-
* const dns = require('node:dns');
|
202
|
-
* dns.lookupService('127.0.0.1', 22, (err, hostname, service) => {
|
203
|
-
* console.log(hostname, service);
|
204
|
-
* // Prints: localhost ssh
|
205
|
-
* });
|
206
|
-
* ```
|
207
|
-
*
|
208
|
-
* If this method is invoked as its [util.promisify()](https://nodejs.org/docs/latest-v20.x/api/util.html#utilpromisifyoriginal) ed
|
209
|
-
* version, it returns a `Promise` for an `Object` with `hostname` and `service` properties.
|
210
|
-
* @since v0.11.14
|
211
|
-
*/
|
212
|
-
export function lookupService(
|
213
|
-
address: string,
|
214
|
-
port: number,
|
215
|
-
callback: (err: NodeJS.ErrnoException | null, hostname: string, service: string) => void,
|
216
|
-
): void;
|
217
|
-
export namespace lookupService {
|
218
|
-
function __promisify__(
|
219
|
-
address: string,
|
220
|
-
port: number,
|
221
|
-
): Promise<{
|
222
|
-
hostname: string;
|
223
|
-
service: string;
|
224
|
-
}>;
|
225
|
-
}
|
226
|
-
export interface ResolveOptions {
|
227
|
-
ttl: boolean;
|
228
|
-
}
|
229
|
-
export interface ResolveWithTtlOptions extends ResolveOptions {
|
230
|
-
ttl: true;
|
231
|
-
}
|
232
|
-
export interface RecordWithTtl {
|
233
|
-
address: string;
|
234
|
-
ttl: number;
|
235
|
-
}
|
236
|
-
/** @deprecated Use `AnyARecord` or `AnyAaaaRecord` instead. */
|
237
|
-
export type AnyRecordWithTtl = AnyARecord | AnyAaaaRecord;
|
238
|
-
export interface AnyARecord extends RecordWithTtl {
|
239
|
-
type: "A";
|
240
|
-
}
|
241
|
-
export interface AnyAaaaRecord extends RecordWithTtl {
|
242
|
-
type: "AAAA";
|
243
|
-
}
|
244
|
-
export interface CaaRecord {
|
245
|
-
critical: number;
|
246
|
-
issue?: string | undefined;
|
247
|
-
issuewild?: string | undefined;
|
248
|
-
iodef?: string | undefined;
|
249
|
-
contactemail?: string | undefined;
|
250
|
-
contactphone?: string | undefined;
|
251
|
-
}
|
252
|
-
export interface MxRecord {
|
253
|
-
priority: number;
|
254
|
-
exchange: string;
|
255
|
-
}
|
256
|
-
export interface AnyMxRecord extends MxRecord {
|
257
|
-
type: "MX";
|
258
|
-
}
|
259
|
-
export interface NaptrRecord {
|
260
|
-
flags: string;
|
261
|
-
service: string;
|
262
|
-
regexp: string;
|
263
|
-
replacement: string;
|
264
|
-
order: number;
|
265
|
-
preference: number;
|
266
|
-
}
|
267
|
-
export interface AnyNaptrRecord extends NaptrRecord {
|
268
|
-
type: "NAPTR";
|
269
|
-
}
|
270
|
-
export interface SoaRecord {
|
271
|
-
nsname: string;
|
272
|
-
hostmaster: string;
|
273
|
-
serial: number;
|
274
|
-
refresh: number;
|
275
|
-
retry: number;
|
276
|
-
expire: number;
|
277
|
-
minttl: number;
|
278
|
-
}
|
279
|
-
export interface AnySoaRecord extends SoaRecord {
|
280
|
-
type: "SOA";
|
281
|
-
}
|
282
|
-
export interface SrvRecord {
|
283
|
-
priority: number;
|
284
|
-
weight: number;
|
285
|
-
port: number;
|
286
|
-
name: string;
|
287
|
-
}
|
288
|
-
export interface AnySrvRecord extends SrvRecord {
|
289
|
-
type: "SRV";
|
290
|
-
}
|
291
|
-
export interface AnyTxtRecord {
|
292
|
-
type: "TXT";
|
293
|
-
entries: string[];
|
294
|
-
}
|
295
|
-
export interface AnyNsRecord {
|
296
|
-
type: "NS";
|
297
|
-
value: string;
|
298
|
-
}
|
299
|
-
export interface AnyPtrRecord {
|
300
|
-
type: "PTR";
|
301
|
-
value: string;
|
302
|
-
}
|
303
|
-
export interface AnyCnameRecord {
|
304
|
-
type: "CNAME";
|
305
|
-
value: string;
|
306
|
-
}
|
307
|
-
export type AnyRecord =
|
308
|
-
| AnyARecord
|
309
|
-
| AnyAaaaRecord
|
310
|
-
| AnyCnameRecord
|
311
|
-
| AnyMxRecord
|
312
|
-
| AnyNaptrRecord
|
313
|
-
| AnyNsRecord
|
314
|
-
| AnyPtrRecord
|
315
|
-
| AnySoaRecord
|
316
|
-
| AnySrvRecord
|
317
|
-
| AnyTxtRecord;
|
318
|
-
/**
|
319
|
-
* Uses the DNS protocol to resolve a host name (e.g. `'nodejs.org'`) into an array
|
320
|
-
* of the resource records. The `callback` function has arguments `(err, records)`. When successful, `records` will be an array of resource
|
321
|
-
* records. The type and structure of individual results varies based on `rrtype`:
|
322
|
-
*
|
323
|
-
* <omitted>
|
324
|
-
*
|
325
|
-
* On error, `err` is an [`Error`](https://nodejs.org/docs/latest-v20.x/api/errors.html#class-error) object,
|
326
|
-
* where `err.code` is one of the `DNS error codes`.
|
327
|
-
* @since v0.1.27
|
328
|
-
* @param hostname Host name to resolve.
|
329
|
-
* @param [rrtype='A'] Resource record type.
|
330
|
-
*/
|
331
|
-
export function resolve(
|
332
|
-
hostname: string,
|
333
|
-
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
|
334
|
-
): void;
|
335
|
-
export function resolve(
|
336
|
-
hostname: string,
|
337
|
-
rrtype: "A",
|
338
|
-
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
|
339
|
-
): void;
|
340
|
-
export function resolve(
|
341
|
-
hostname: string,
|
342
|
-
rrtype: "AAAA",
|
343
|
-
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
|
344
|
-
): void;
|
345
|
-
export function resolve(
|
346
|
-
hostname: string,
|
347
|
-
rrtype: "ANY",
|
348
|
-
callback: (err: NodeJS.ErrnoException | null, addresses: AnyRecord[]) => void,
|
349
|
-
): void;
|
350
|
-
export function resolve(
|
351
|
-
hostname: string,
|
352
|
-
rrtype: "CNAME",
|
353
|
-
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
|
354
|
-
): void;
|
355
|
-
export function resolve(
|
356
|
-
hostname: string,
|
357
|
-
rrtype: "MX",
|
358
|
-
callback: (err: NodeJS.ErrnoException | null, addresses: MxRecord[]) => void,
|
359
|
-
): void;
|
360
|
-
export function resolve(
|
361
|
-
hostname: string,
|
362
|
-
rrtype: "NAPTR",
|
363
|
-
callback: (err: NodeJS.ErrnoException | null, addresses: NaptrRecord[]) => void,
|
364
|
-
): void;
|
365
|
-
export function resolve(
|
366
|
-
hostname: string,
|
367
|
-
rrtype: "NS",
|
368
|
-
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
|
369
|
-
): void;
|
370
|
-
export function resolve(
|
371
|
-
hostname: string,
|
372
|
-
rrtype: "PTR",
|
373
|
-
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
|
374
|
-
): void;
|
375
|
-
export function resolve(
|
376
|
-
hostname: string,
|
377
|
-
rrtype: "SOA",
|
378
|
-
callback: (err: NodeJS.ErrnoException | null, addresses: SoaRecord) => void,
|
379
|
-
): void;
|
380
|
-
export function resolve(
|
381
|
-
hostname: string,
|
382
|
-
rrtype: "SRV",
|
383
|
-
callback: (err: NodeJS.ErrnoException | null, addresses: SrvRecord[]) => void,
|
384
|
-
): void;
|
385
|
-
export function resolve(
|
386
|
-
hostname: string,
|
387
|
-
rrtype: "TXT",
|
388
|
-
callback: (err: NodeJS.ErrnoException | null, addresses: string[][]) => void,
|
389
|
-
): void;
|
390
|
-
export function resolve(
|
391
|
-
hostname: string,
|
392
|
-
rrtype: string,
|
393
|
-
callback: (
|
394
|
-
err: NodeJS.ErrnoException | null,
|
395
|
-
addresses: string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][] | AnyRecord[],
|
396
|
-
) => void,
|
397
|
-
): void;
|
398
|
-
export namespace resolve {
|
399
|
-
function __promisify__(hostname: string, rrtype?: "A" | "AAAA" | "CNAME" | "NS" | "PTR"): Promise<string[]>;
|
400
|
-
function __promisify__(hostname: string, rrtype: "ANY"): Promise<AnyRecord[]>;
|
401
|
-
function __promisify__(hostname: string, rrtype: "MX"): Promise<MxRecord[]>;
|
402
|
-
function __promisify__(hostname: string, rrtype: "NAPTR"): Promise<NaptrRecord[]>;
|
403
|
-
function __promisify__(hostname: string, rrtype: "SOA"): Promise<SoaRecord>;
|
404
|
-
function __promisify__(hostname: string, rrtype: "SRV"): Promise<SrvRecord[]>;
|
405
|
-
function __promisify__(hostname: string, rrtype: "TXT"): Promise<string[][]>;
|
406
|
-
function __promisify__(
|
407
|
-
hostname: string,
|
408
|
-
rrtype: string,
|
409
|
-
): Promise<string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][] | AnyRecord[]>;
|
410
|
-
}
|
411
|
-
/**
|
412
|
-
* Uses the DNS protocol to resolve a IPv4 addresses (`A` records) for the `hostname`. The `addresses` argument passed to the `callback` function
|
413
|
-
* will contain an array of IPv4 addresses (e.g.`['74.125.79.104', '74.125.79.105', '74.125.79.106']`).
|
414
|
-
* @since v0.1.16
|
415
|
-
* @param hostname Host name to resolve.
|
416
|
-
*/
|
417
|
-
export function resolve4(
|
418
|
-
hostname: string,
|
419
|
-
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
|
420
|
-
): void;
|
421
|
-
export function resolve4(
|
422
|
-
hostname: string,
|
423
|
-
options: ResolveWithTtlOptions,
|
424
|
-
callback: (err: NodeJS.ErrnoException | null, addresses: RecordWithTtl[]) => void,
|
425
|
-
): void;
|
426
|
-
export function resolve4(
|
427
|
-
hostname: string,
|
428
|
-
options: ResolveOptions,
|
429
|
-
callback: (err: NodeJS.ErrnoException | null, addresses: string[] | RecordWithTtl[]) => void,
|
430
|
-
): void;
|
431
|
-
export namespace resolve4 {
|
432
|
-
function __promisify__(hostname: string): Promise<string[]>;
|
433
|
-
function __promisify__(hostname: string, options: ResolveWithTtlOptions): Promise<RecordWithTtl[]>;
|
434
|
-
function __promisify__(hostname: string, options?: ResolveOptions): Promise<string[] | RecordWithTtl[]>;
|
435
|
-
}
|
436
|
-
/**
|
437
|
-
* Uses the DNS protocol to resolve IPv6 addresses (`AAAA` records) for the `hostname`. The `addresses` argument passed to the `callback` function
|
438
|
-
* will contain an array of IPv6 addresses.
|
439
|
-
* @since v0.1.16
|
440
|
-
* @param hostname Host name to resolve.
|
441
|
-
*/
|
442
|
-
export function resolve6(
|
443
|
-
hostname: string,
|
444
|
-
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
|
445
|
-
): void;
|
446
|
-
export function resolve6(
|
447
|
-
hostname: string,
|
448
|
-
options: ResolveWithTtlOptions,
|
449
|
-
callback: (err: NodeJS.ErrnoException | null, addresses: RecordWithTtl[]) => void,
|
450
|
-
): void;
|
451
|
-
export function resolve6(
|
452
|
-
hostname: string,
|
453
|
-
options: ResolveOptions,
|
454
|
-
callback: (err: NodeJS.ErrnoException | null, addresses: string[] | RecordWithTtl[]) => void,
|
455
|
-
): void;
|
456
|
-
export namespace resolve6 {
|
457
|
-
function __promisify__(hostname: string): Promise<string[]>;
|
458
|
-
function __promisify__(hostname: string, options: ResolveWithTtlOptions): Promise<RecordWithTtl[]>;
|
459
|
-
function __promisify__(hostname: string, options?: ResolveOptions): Promise<string[] | RecordWithTtl[]>;
|
460
|
-
}
|
461
|
-
/**
|
462
|
-
* Uses the DNS protocol to resolve `CNAME` records for the `hostname`. The `addresses` argument passed to the `callback` function
|
463
|
-
* will contain an array of canonical name records available for the `hostname` (e.g. `['bar.example.com']`).
|
464
|
-
* @since v0.3.2
|
465
|
-
*/
|
466
|
-
export function resolveCname(
|
467
|
-
hostname: string,
|
468
|
-
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
|
469
|
-
): void;
|
470
|
-
export namespace resolveCname {
|
471
|
-
function __promisify__(hostname: string): Promise<string[]>;
|
472
|
-
}
|
473
|
-
/**
|
474
|
-
* Uses the DNS protocol to resolve `CAA` records for the `hostname`. The `addresses` argument passed to the `callback` function
|
475
|
-
* will contain an array of certification authority authorization records
|
476
|
-
* available for the `hostname` (e.g. `[{critical: 0, iodef: 'mailto:pki@example.com'}, {critical: 128, issue: 'pki.example.com'}]`).
|
477
|
-
* @since v15.0.0, v14.17.0
|
478
|
-
*/
|
479
|
-
export function resolveCaa(
|
480
|
-
hostname: string,
|
481
|
-
callback: (err: NodeJS.ErrnoException | null, records: CaaRecord[]) => void,
|
482
|
-
): void;
|
483
|
-
export namespace resolveCaa {
|
484
|
-
function __promisify__(hostname: string): Promise<CaaRecord[]>;
|
485
|
-
}
|
486
|
-
/**
|
487
|
-
* Uses the DNS protocol to resolve mail exchange records (`MX` records) for the `hostname`. The `addresses` argument passed to the `callback` function will
|
488
|
-
* contain an array of objects containing both a `priority` and `exchange` property (e.g. `[{priority: 10, exchange: 'mx.example.com'}, ...]`).
|
489
|
-
* @since v0.1.27
|
490
|
-
*/
|
491
|
-
export function resolveMx(
|
492
|
-
hostname: string,
|
493
|
-
callback: (err: NodeJS.ErrnoException | null, addresses: MxRecord[]) => void,
|
494
|
-
): void;
|
495
|
-
export namespace resolveMx {
|
496
|
-
function __promisify__(hostname: string): Promise<MxRecord[]>;
|
497
|
-
}
|
498
|
-
/**
|
499
|
-
* 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
|
500
|
-
* objects with the following properties:
|
501
|
-
*
|
502
|
-
* * `flags`
|
503
|
-
* * `service`
|
504
|
-
* * `regexp`
|
505
|
-
* * `replacement`
|
506
|
-
* * `order`
|
507
|
-
* * `preference`
|
508
|
-
*
|
509
|
-
* ```js
|
510
|
-
* {
|
511
|
-
* flags: 's',
|
512
|
-
* service: 'SIP+D2U',
|
513
|
-
* regexp: '',
|
514
|
-
* replacement: '_sip._udp.example.com',
|
515
|
-
* order: 30,
|
516
|
-
* preference: 100
|
517
|
-
* }
|
518
|
-
* ```
|
519
|
-
* @since v0.9.12
|
520
|
-
*/
|
521
|
-
export function resolveNaptr(
|
522
|
-
hostname: string,
|
523
|
-
callback: (err: NodeJS.ErrnoException | null, addresses: NaptrRecord[]) => void,
|
524
|
-
): void;
|
525
|
-
export namespace resolveNaptr {
|
526
|
-
function __promisify__(hostname: string): Promise<NaptrRecord[]>;
|
527
|
-
}
|
528
|
-
/**
|
529
|
-
* Uses the DNS protocol to resolve name server records (`NS` records) for the `hostname`. The `addresses` argument passed to the `callback` function will
|
530
|
-
* contain an array of name server records available for `hostname` (e.g. `['ns1.example.com', 'ns2.example.com']`).
|
531
|
-
* @since v0.1.90
|
532
|
-
*/
|
533
|
-
export function resolveNs(
|
534
|
-
hostname: string,
|
535
|
-
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
|
536
|
-
): void;
|
537
|
-
export namespace resolveNs {
|
538
|
-
function __promisify__(hostname: string): Promise<string[]>;
|
539
|
-
}
|
540
|
-
/**
|
541
|
-
* Uses the DNS protocol to resolve pointer records (`PTR` records) for the `hostname`. The `addresses` argument passed to the `callback` function will
|
542
|
-
* be an array of strings containing the reply records.
|
543
|
-
* @since v6.0.0
|
544
|
-
*/
|
545
|
-
export function resolvePtr(
|
546
|
-
hostname: string,
|
547
|
-
callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void,
|
548
|
-
): void;
|
549
|
-
export namespace resolvePtr {
|
550
|
-
function __promisify__(hostname: string): Promise<string[]>;
|
551
|
-
}
|
552
|
-
/**
|
553
|
-
* Uses the DNS protocol to resolve a start of authority record (`SOA` record) for
|
554
|
-
* the `hostname`. The `address` argument passed to the `callback` function will
|
555
|
-
* be an object with the following properties:
|
556
|
-
*
|
557
|
-
* * `nsname`
|
558
|
-
* * `hostmaster`
|
559
|
-
* * `serial`
|
560
|
-
* * `refresh`
|
561
|
-
* * `retry`
|
562
|
-
* * `expire`
|
563
|
-
* * `minttl`
|
564
|
-
*
|
565
|
-
* ```js
|
566
|
-
* {
|
567
|
-
* nsname: 'ns.example.com',
|
568
|
-
* hostmaster: 'root.example.com',
|
569
|
-
* serial: 2013101809,
|
570
|
-
* refresh: 10000,
|
571
|
-
* retry: 2400,
|
572
|
-
* expire: 604800,
|
573
|
-
* minttl: 3600
|
574
|
-
* }
|
575
|
-
* ```
|
576
|
-
* @since v0.11.10
|
577
|
-
*/
|
578
|
-
export function resolveSoa(
|
579
|
-
hostname: string,
|
580
|
-
callback: (err: NodeJS.ErrnoException | null, address: SoaRecord) => void,
|
581
|
-
): void;
|
582
|
-
export namespace resolveSoa {
|
583
|
-
function __promisify__(hostname: string): Promise<SoaRecord>;
|
584
|
-
}
|
585
|
-
/**
|
586
|
-
* Uses the DNS protocol to resolve service records (`SRV` records) for the `hostname`. The `addresses` argument passed to the `callback` function will
|
587
|
-
* be an array of objects with the following properties:
|
588
|
-
*
|
589
|
-
* * `priority`
|
590
|
-
* * `weight`
|
591
|
-
* * `port`
|
592
|
-
* * `name`
|
593
|
-
*
|
594
|
-
* ```js
|
595
|
-
* {
|
596
|
-
* priority: 10,
|
597
|
-
* weight: 5,
|
598
|
-
* port: 21223,
|
599
|
-
* name: 'service.example.com'
|
600
|
-
* }
|
601
|
-
* ```
|
602
|
-
* @since v0.1.27
|
603
|
-
*/
|
604
|
-
export function resolveSrv(
|
605
|
-
hostname: string,
|
606
|
-
callback: (err: NodeJS.ErrnoException | null, addresses: SrvRecord[]) => void,
|
607
|
-
): void;
|
608
|
-
export namespace resolveSrv {
|
609
|
-
function __promisify__(hostname: string): Promise<SrvRecord[]>;
|
610
|
-
}
|
611
|
-
/**
|
612
|
-
* Uses the DNS protocol to resolve text queries (`TXT` records) for the `hostname`. The `records` argument passed to the `callback` function is a
|
613
|
-
* 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
|
614
|
-
* one record. Depending on the use case, these could be either joined together or
|
615
|
-
* treated separately.
|
616
|
-
* @since v0.1.27
|
617
|
-
*/
|
618
|
-
export function resolveTxt(
|
619
|
-
hostname: string,
|
620
|
-
callback: (err: NodeJS.ErrnoException | null, addresses: string[][]) => void,
|
621
|
-
): void;
|
622
|
-
export namespace resolveTxt {
|
623
|
-
function __promisify__(hostname: string): Promise<string[][]>;
|
624
|
-
}
|
625
|
-
/**
|
626
|
-
* Uses the DNS protocol to resolve all records (also known as `ANY` or `*` query).
|
627
|
-
* The `ret` argument passed to the `callback` function will be an array containing
|
628
|
-
* various types of records. Each object has a property `type` that indicates the
|
629
|
-
* type of the current record. And depending on the `type`, additional properties
|
630
|
-
* will be present on the object:
|
631
|
-
*
|
632
|
-
* <omitted>
|
633
|
-
*
|
634
|
-
* Here is an example of the `ret` object passed to the callback:
|
635
|
-
*
|
636
|
-
* ```js
|
637
|
-
* [ { type: 'A', address: '127.0.0.1', ttl: 299 },
|
638
|
-
* { type: 'CNAME', value: 'example.com' },
|
639
|
-
* { type: 'MX', exchange: 'alt4.aspmx.l.example.com', priority: 50 },
|
640
|
-
* { type: 'NS', value: 'ns1.example.com' },
|
641
|
-
* { type: 'TXT', entries: [ 'v=spf1 include:_spf.example.com ~all' ] },
|
642
|
-
* { type: 'SOA',
|
643
|
-
* nsname: 'ns1.example.com',
|
644
|
-
* hostmaster: 'admin.example.com',
|
645
|
-
* serial: 156696742,
|
646
|
-
* refresh: 900,
|
647
|
-
* retry: 900,
|
648
|
-
* expire: 1800,
|
649
|
-
* minttl: 60 } ]
|
650
|
-
* ```
|
651
|
-
*
|
652
|
-
* 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
|
653
|
-
* [RFC 8482](https://tools.ietf.org/html/rfc8482).
|
654
|
-
*/
|
655
|
-
export function resolveAny(
|
656
|
-
hostname: string,
|
657
|
-
callback: (err: NodeJS.ErrnoException | null, addresses: AnyRecord[]) => void,
|
658
|
-
): void;
|
659
|
-
export namespace resolveAny {
|
660
|
-
function __promisify__(hostname: string): Promise<AnyRecord[]>;
|
661
|
-
}
|
662
|
-
/**
|
663
|
-
* Performs a reverse DNS query that resolves an IPv4 or IPv6 address to an
|
664
|
-
* array of host names.
|
665
|
-
*
|
666
|
-
* On error, `err` is an [`Error`](https://nodejs.org/docs/latest-v20.x/api/errors.html#class-error) object, where `err.code` is
|
667
|
-
* one of the [DNS error codes](https://nodejs.org/docs/latest-v20.x/api/dns.html#error-codes).
|
668
|
-
* @since v0.1.16
|
669
|
-
*/
|
670
|
-
export function reverse(
|
671
|
-
ip: string,
|
672
|
-
callback: (err: NodeJS.ErrnoException | null, hostnames: string[]) => void,
|
673
|
-
): void;
|
674
|
-
/**
|
675
|
-
* Get the default value for `order` in {@link lookup} and [`dnsPromises.lookup()`](https://nodejs.org/docs/latest-v20.x/api/dns.html#dnspromiseslookuphostname-options).
|
676
|
-
* The value could be:
|
677
|
-
*
|
678
|
-
* * `ipv4first`: for `order` defaulting to `ipv4first`.
|
679
|
-
* * `ipv6first`: for `order` defaulting to `ipv6first`.
|
680
|
-
* * `verbatim`: for `order` defaulting to `verbatim`.
|
681
|
-
* @since v18.17.0
|
682
|
-
*/
|
683
|
-
export function getDefaultResultOrder(): "ipv4first" | "ipv6first" | "verbatim";
|
684
|
-
/**
|
685
|
-
* Sets the IP address and port of servers to be used when performing DNS
|
686
|
-
* resolution. The `servers` argument is an array of [RFC 5952](https://tools.ietf.org/html/rfc5952#section-6) formatted
|
687
|
-
* addresses. If the port is the IANA default DNS port (53) it can be omitted.
|
688
|
-
*
|
689
|
-
* ```js
|
690
|
-
* dns.setServers([
|
691
|
-
* '4.4.4.4',
|
692
|
-
* '[2001:4860:4860::8888]',
|
693
|
-
* '4.4.4.4:1053',
|
694
|
-
* '[2001:4860:4860::8888]:1053',
|
695
|
-
* ]);
|
696
|
-
* ```
|
697
|
-
*
|
698
|
-
* An error will be thrown if an invalid address is provided.
|
699
|
-
*
|
700
|
-
* The `dns.setServers()` method must not be called while a DNS query is in
|
701
|
-
* progress.
|
702
|
-
*
|
703
|
-
* The {@link setServers} method affects only {@link resolve}, `dns.resolve*()` and {@link reverse} (and specifically _not_ {@link lookup}).
|
704
|
-
*
|
705
|
-
* This method works much like [resolve.conf](https://man7.org/linux/man-pages/man5/resolv.conf.5.html).
|
706
|
-
* 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
|
707
|
-
* subsequent servers provided. Fallback DNS servers will only be used if the
|
708
|
-
* earlier ones time out or result in some other error.
|
709
|
-
* @since v0.11.3
|
710
|
-
* @param servers array of [RFC 5952](https://datatracker.ietf.org/doc/html/rfc5952#section-6) formatted addresses
|
711
|
-
*/
|
712
|
-
export function setServers(servers: readonly string[]): void;
|
713
|
-
/**
|
714
|
-
* Returns an array of IP address strings, formatted according to [RFC 5952](https://tools.ietf.org/html/rfc5952#section-6),
|
715
|
-
* that are currently configured for DNS resolution. A string will include a port
|
716
|
-
* section if a custom port is used.
|
717
|
-
*
|
718
|
-
* ```js
|
719
|
-
* [
|
720
|
-
* '4.4.4.4',
|
721
|
-
* '2001:4860:4860::8888',
|
722
|
-
* '4.4.4.4:1053',
|
723
|
-
* '[2001:4860:4860::8888]:1053',
|
724
|
-
* ]
|
725
|
-
* ```
|
726
|
-
* @since v0.11.3
|
727
|
-
*/
|
728
|
-
export function getServers(): string[];
|
729
|
-
/**
|
730
|
-
* Set the default value of `order` in {@link lookup} and [`dnsPromises.lookup()`](https://nodejs.org/docs/latest-v20.x/api/dns.html#dnspromiseslookuphostname-options).
|
731
|
-
* The value could be:
|
732
|
-
*
|
733
|
-
* * `ipv4first`: sets default `order` to `ipv4first`.
|
734
|
-
* * `ipv6first`: sets default `order` to `ipv6first`.
|
735
|
-
* * `verbatim`: sets default `order` to `verbatim`.
|
736
|
-
*
|
737
|
-
* The default is `verbatim` and {@link setDefaultResultOrder} have higher
|
738
|
-
* priority than [`--dns-result-order`](https://nodejs.org/docs/latest-v20.x/api/cli.html#--dns-result-orderorder). When using
|
739
|
-
* [worker threads](https://nodejs.org/docs/latest-v20.x/api/worker_threads.html), {@link setDefaultResultOrder} from the main
|
740
|
-
* thread won't affect the default dns orders in workers.
|
741
|
-
* @since v16.4.0, v14.18.0
|
742
|
-
* @param order must be `'ipv4first'`, `'ipv6first'` or `'verbatim'`.
|
743
|
-
*/
|
744
|
-
export function setDefaultResultOrder(order: "ipv4first" | "ipv6first" | "verbatim"): void;
|
745
|
-
// Error codes
|
746
|
-
export const NODATA: "NODATA";
|
747
|
-
export const FORMERR: "FORMERR";
|
748
|
-
export const SERVFAIL: "SERVFAIL";
|
749
|
-
export const NOTFOUND: "NOTFOUND";
|
750
|
-
export const NOTIMP: "NOTIMP";
|
751
|
-
export const REFUSED: "REFUSED";
|
752
|
-
export const BADQUERY: "BADQUERY";
|
753
|
-
export const BADNAME: "BADNAME";
|
754
|
-
export const BADFAMILY: "BADFAMILY";
|
755
|
-
export const BADRESP: "BADRESP";
|
756
|
-
export const CONNREFUSED: "TIMEOUT";
|
757
|
-
export const TIMEOUT: "TIMEOUT";
|
758
|
-
export const EOF: "EOF";
|
759
|
-
export const FILE: "FILE";
|
760
|
-
export const NOMEM: "NOMEM";
|
761
|
-
export const DESTRUCTION: "DESTRUCTION";
|
762
|
-
export const BADSTR: "BADSTR";
|
763
|
-
export const BADFLAGS: "BADFLAGS";
|
764
|
-
export const NONAME: "NONAME";
|
765
|
-
export const BADHINTS: "BADHINTS";
|
766
|
-
export const NOTINITIALIZED: "NOTINITIALIZED";
|
767
|
-
export const LOADIPHLPAPI: "LOADIPHLPAPI";
|
768
|
-
export const ADDRGETNETWORKPARAMS: "ADDRGETNETWORKPARAMS";
|
769
|
-
export const CANCELLED: "CANCELLED";
|
770
|
-
export interface ResolverOptions {
|
771
|
-
/**
|
772
|
-
* Query timeout in milliseconds, or `-1` to use the default timeout.
|
773
|
-
*/
|
774
|
-
timeout?: number | undefined;
|
775
|
-
/**
|
776
|
-
* The number of tries the resolver will try contacting each name server before giving up.
|
777
|
-
* @default 4
|
778
|
-
*/
|
779
|
-
tries?: number;
|
780
|
-
}
|
781
|
-
/**
|
782
|
-
* An independent resolver for DNS requests.
|
783
|
-
*
|
784
|
-
* Creating a new resolver uses the default server settings. Setting
|
785
|
-
* the servers used for a resolver using [`resolver.setServers()`](https://nodejs.org/docs/latest-v20.x/api/dns.html#dnssetserversservers) does not affect
|
786
|
-
* other resolvers:
|
787
|
-
*
|
788
|
-
* ```js
|
789
|
-
* const { Resolver } = require('node:dns');
|
790
|
-
* const resolver = new Resolver();
|
791
|
-
* resolver.setServers(['4.4.4.4']);
|
792
|
-
*
|
793
|
-
* // This request will use the server at 4.4.4.4, independent of global settings.
|
794
|
-
* resolver.resolve4('example.org', (err, addresses) => {
|
795
|
-
* // ...
|
796
|
-
* });
|
797
|
-
* ```
|
798
|
-
*
|
799
|
-
* The following methods from the `node:dns` module are available:
|
800
|
-
*
|
801
|
-
* * `resolver.getServers()`
|
802
|
-
* * `resolver.resolve()`
|
803
|
-
* * `resolver.resolve4()`
|
804
|
-
* * `resolver.resolve6()`
|
805
|
-
* * `resolver.resolveAny()`
|
806
|
-
* * `resolver.resolveCaa()`
|
807
|
-
* * `resolver.resolveCname()`
|
808
|
-
* * `resolver.resolveMx()`
|
809
|
-
* * `resolver.resolveNaptr()`
|
810
|
-
* * `resolver.resolveNs()`
|
811
|
-
* * `resolver.resolvePtr()`
|
812
|
-
* * `resolver.resolveSoa()`
|
813
|
-
* * `resolver.resolveSrv()`
|
814
|
-
* * `resolver.resolveTxt()`
|
815
|
-
* * `resolver.reverse()`
|
816
|
-
* * `resolver.setServers()`
|
817
|
-
* @since v8.3.0
|
818
|
-
*/
|
819
|
-
export class Resolver {
|
820
|
-
constructor(options?: ResolverOptions);
|
821
|
-
/**
|
822
|
-
* Cancel all outstanding DNS queries made by this resolver. The corresponding
|
823
|
-
* callbacks will be called with an error with code `ECANCELLED`.
|
824
|
-
* @since v8.3.0
|
825
|
-
*/
|
826
|
-
cancel(): void;
|
827
|
-
getServers: typeof getServers;
|
828
|
-
resolve: typeof resolve;
|
829
|
-
resolve4: typeof resolve4;
|
830
|
-
resolve6: typeof resolve6;
|
831
|
-
resolveAny: typeof resolveAny;
|
832
|
-
resolveCaa: typeof resolveCaa;
|
833
|
-
resolveCname: typeof resolveCname;
|
834
|
-
resolveMx: typeof resolveMx;
|
835
|
-
resolveNaptr: typeof resolveNaptr;
|
836
|
-
resolveNs: typeof resolveNs;
|
837
|
-
resolvePtr: typeof resolvePtr;
|
838
|
-
resolveSoa: typeof resolveSoa;
|
839
|
-
resolveSrv: typeof resolveSrv;
|
840
|
-
resolveTxt: typeof resolveTxt;
|
841
|
-
reverse: typeof reverse;
|
842
|
-
/**
|
843
|
-
* The resolver instance will send its requests from the specified IP address.
|
844
|
-
* This allows programs to specify outbound interfaces when used on multi-homed
|
845
|
-
* systems.
|
846
|
-
*
|
847
|
-
* If a v4 or v6 address is not specified, it is set to the default and the
|
848
|
-
* operating system will choose a local address automatically.
|
849
|
-
*
|
850
|
-
* The resolver will use the v4 local address when making requests to IPv4 DNS
|
851
|
-
* servers, and the v6 local address when making requests to IPv6 DNS servers.
|
852
|
-
* The `rrtype` of resolution requests has no impact on the local address used.
|
853
|
-
* @since v15.1.0, v14.17.0
|
854
|
-
* @param [ipv4='0.0.0.0'] A string representation of an IPv4 address.
|
855
|
-
* @param [ipv6='::0'] A string representation of an IPv6 address.
|
856
|
-
*/
|
857
|
-
setLocalAddress(ipv4?: string, ipv6?: string): void;
|
858
|
-
setServers: typeof setServers;
|
859
|
-
}
|
860
|
-
export { dnsPromises as promises };
|
861
|
-
}
|
862
|
-
declare module "node:dns" {
|
863
|
-
export * from "dns";
|
864
|
-
}
|