@types/node
Advanced tools
Comparing version 18.19.24 to 18.19.25
/** | ||
* The `dns` module enables name resolution. For example, use it to look up IP | ||
* The `node:dns` module enables name resolution. For example, use it to look up IP | ||
* addresses of host names. | ||
@@ -12,3 +12,3 @@ * | ||
* ```js | ||
* const dns = require('dns'); | ||
* const dns = require('node:dns'); | ||
* | ||
@@ -21,3 +21,3 @@ * dns.lookup('example.org', (err, address, family) => { | ||
* | ||
* All other functions in the `dns` module connect to an actual DNS server to | ||
* All other functions in the `node:dns` module connect to an actual DNS server to | ||
* perform name resolution. They will always use the network to perform DNS | ||
@@ -28,3 +28,3 @@ * 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 | ||
* ```js | ||
* const dns = require('dns'); | ||
* const dns = require('node:dns'); | ||
* | ||
@@ -47,4 +47,4 @@ * dns.resolve4('archive.org', (err, addresses) => { | ||
* | ||
* See the `Implementation considerations section` for more information. | ||
* @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/dns.js) | ||
* See the [Implementation considerations section](https://nodejs.org/docs/latest-v18.x/api/dns.html#implementation-considerations) for more information. | ||
* @see [source](https://github.com/nodejs/node/blob/v18.19.1/lib/dns.js) | ||
*/ | ||
@@ -54,3 +54,11 @@ declare module "dns" { | ||
// Supported getaddrinfo flags. | ||
/** | ||
* Limits returned address types to the types of non-loopback addresses configured on the system. For example, IPv4 addresses are | ||
* only returned if the current system has at least one IPv4 address configured. | ||
*/ | ||
export const ADDRCONFIG: number; | ||
/** | ||
* If the IPv6 family was specified, but no IPv6 addresses were found, then return IPv4 mapped IPv6 addresses. It is not supported | ||
* on some operating systems (e.g. FreeBSD 10.1). | ||
*/ | ||
export const V4MAPPED: number; | ||
@@ -63,7 +71,24 @@ /** | ||
export interface LookupOptions { | ||
family?: number | undefined; | ||
/** | ||
* The record family. Must be `4`, `6`, or `0`. For backward compatibility reasons,`'IPv4'` and `'IPv6'` are interpreted | ||
* as `4` and `6` respectively. The value 0 indicates that either an IPv4 or IPv6 address is returned. If the value `0` is used | ||
* with `{ all: true } (see below)`, both IPv4 and IPv6 addresses are returned. | ||
* @default 0 | ||
*/ | ||
family?: number | "IPv4" | "IPv6" | undefined; | ||
/** | ||
* One or more [supported `getaddrinfo`](https://nodejs.org/docs/latest-v18.x/api/dns.html#supported-getaddrinfo-flags) flags. Multiple flags may be | ||
* passed by bitwise `OR`ing their values. | ||
*/ | ||
hints?: number | undefined; | ||
/** | ||
* When `true`, the callback returns all resolved addresses in an array. Otherwise, returns a single address. | ||
* @default false | ||
*/ | ||
all?: boolean | undefined; | ||
/** | ||
* @default true | ||
* When `true`, the callback receives IPv4 and IPv6 addresses in the order the DNS resolver returned them. When `false`, IPv4 | ||
* addresses are placed before IPv6 addresses. Default value is configurable using {@link setDefaultResultOrder()} | ||
* or [`--dns-result-order`](https://nodejs.org/docs/latest-v18.x/api/cli.html#--dns-result-orderorder). | ||
* @default true (addresses are not reordered) | ||
*/ | ||
@@ -79,3 +104,10 @@ verbatim?: boolean | undefined; | ||
export interface LookupAddress { | ||
/** | ||
* A string representation of an IPv4 or IPv6 address. | ||
*/ | ||
address: string; | ||
/** | ||
* `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 | ||
* bug in the name resolution service used by the operating system. | ||
*/ | ||
family: number; | ||
@@ -86,6 +118,6 @@ } | ||
* AAAA (IPv6) record. All `option` properties are optional. If `options` is an | ||
* integer, then it must be `4` or `6` – if `options` is not provided, then IPv4 | ||
* and IPv6 addresses are both returned if found. | ||
* integer, then it must be `4` or `6` – if `options` is `0` or not provided, then | ||
* IPv4 and IPv6 addresses are both returned if found. | ||
* | ||
* With the `all` option set to `true`, the arguments for `callback` change to`(err, addresses)`, with `addresses` being an array of objects with the | ||
* With the `all` option set to `true`, the arguments for `callback` change to `(err, addresses)`, with `addresses` being an array of objects with the | ||
* properties `address` and `family`. | ||
@@ -100,5 +132,6 @@ * | ||
* The implementation uses an operating system facility that can associate names | ||
* with addresses, and vice versa. This implementation can have subtle but | ||
* with addresses and vice versa. This implementation can have subtle but | ||
* important consequences on the behavior of any Node.js program. Please take some | ||
* time to consult the `Implementation considerations section` before using`dns.lookup()`. | ||
* time to consult the [Implementation considerations section](https://nodejs.org/docs/latest-v18.x/api/dns.html#implementation-considerations) | ||
* before using `dns.lookup()`. | ||
* | ||
@@ -108,3 +141,3 @@ * Example usage: | ||
* ```js | ||
* const dns = require('dns'); | ||
* const dns = require('node:dns'); | ||
* const options = { | ||
@@ -125,3 +158,4 @@ * family: 6, | ||
* | ||
* 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. | ||
* If this method is invoked as its [util.promisify()](https://nodejs.org/docs/latest-v18.x/api/util.html#utilpromisifyoriginal) ed | ||
* version, and `all` is not set to `true`, it returns a `Promise` for an `Object` with `address` and `family` properties. | ||
* @since v0.1.90 | ||
@@ -163,8 +197,9 @@ */ | ||
* If `address` is not a valid IP address, a `TypeError` will be thrown. | ||
* The `port` will be coerced to a number. If it is not a legal port, a `TypeError`will be thrown. | ||
* The `port` will be coerced to a number. If it is not a legal port, a `TypeError` will be thrown. | ||
* | ||
* On an error, `err` is an `Error` object, where `err.code` is the error code. | ||
* On an error, `err` is an [`Error`](https://nodejs.org/docs/latest-v18.x/api/errors.html#class-error) object, | ||
* where `err.code` is the error code. | ||
* | ||
* ```js | ||
* const dns = require('dns'); | ||
* const dns = require('node:dns'); | ||
* dns.lookupService('127.0.0.1', 22, (err, hostname, service) => { | ||
@@ -176,3 +211,4 @@ * console.log(hostname, service); | ||
* | ||
* If this method is invoked as its `util.promisify()` ed version, it returns a`Promise` for an `Object` with `hostname` and `service` properties. | ||
* If this method is invoked as its [util.promisify()](https://nodejs.org/docs/latest-v18.x/api/util.html#utilpromisifyoriginal) ed | ||
* version, it returns a `Promise` for an `Object` with `hostname` and `service` properties. | ||
* @since v0.11.14 | ||
@@ -288,3 +324,3 @@ */ | ||
* Uses the DNS protocol to resolve a host name (e.g. `'nodejs.org'`) into an array | ||
* of the resource records. The `callback` function has arguments`(err, records)`. When successful, `records` will be an array of resource | ||
* of the resource records. The `callback` function has arguments `(err, records)`. When successful, `records` will be an array of resource | ||
* records. The type and structure of individual results varies based on `rrtype`: | ||
@@ -294,3 +330,4 @@ * | ||
* | ||
* On error, `err` is an `Error` object, where `err.code` is one of the `DNS error codes`. | ||
* On error, `err` is an [`Error`](https://nodejs.org/docs/latest-v18.x/api/errors.html#class-error) object, | ||
* where `err.code` is one of the `DNS error codes`. | ||
* @since v0.1.27 | ||
@@ -381,3 +418,3 @@ * @param hostname Host name to resolve. | ||
/** | ||
* Uses the DNS protocol to resolve a IPv4 addresses (`A` records) for the`hostname`. The `addresses` argument passed to the `callback` function | ||
* Uses the DNS protocol to resolve a IPv4 addresses (`A` records) for the `hostname`. The `addresses` argument passed to the `callback` function | ||
* will contain an array of IPv4 addresses (e.g.`['74.125.79.104', '74.125.79.105', '74.125.79.106']`). | ||
@@ -407,3 +444,3 @@ * @since v0.1.16 | ||
/** | ||
* Uses the DNS protocol to resolve a IPv6 addresses (`AAAA` records) for the`hostname`. The `addresses` argument passed to the `callback` function | ||
* Uses the DNS protocol to resolve IPv6 addresses (`AAAA` records) for the `hostname`. The `addresses` argument passed to the `callback` function | ||
* will contain an array of IPv6 addresses. | ||
@@ -433,4 +470,4 @@ * @since v0.1.16 | ||
/** | ||
* Uses the DNS protocol to resolve `CNAME` records for the `hostname`. The`addresses` argument passed to the `callback` function | ||
* will contain an array of canonical name records available for the `hostname`(e.g. `['bar.example.com']`). | ||
* Uses the DNS protocol to resolve `CNAME` records for the `hostname`. The `addresses` argument passed to the `callback` function | ||
* will contain an array of canonical name records available for the `hostname` (e.g. `['bar.example.com']`). | ||
* @since v0.3.2 | ||
@@ -446,3 +483,3 @@ */ | ||
/** | ||
* Uses the DNS protocol to resolve `CAA` records for the `hostname`. The`addresses` argument passed to the `callback` function | ||
* Uses the DNS protocol to resolve `CAA` records for the `hostname`. The `addresses` argument passed to the `callback` function | ||
* will contain an array of certification authority authorization records | ||
@@ -460,4 +497,4 @@ * available for the `hostname` (e.g. `[{critical: 0, iodef: 'mailto:pki@example.com'}, {critical: 128, issue: 'pki.example.com'}]`). | ||
/** | ||
* Uses the DNS protocol to resolve mail exchange records (`MX` records) for the`hostname`. The `addresses` argument passed to the `callback` function will | ||
* contain an array of objects containing both a `priority` and `exchange`property (e.g. `[{priority: 10, exchange: 'mx.example.com'}, ...]`). | ||
* Uses the DNS protocol to resolve mail exchange records (`MX` records) for the `hostname`. The `addresses` argument passed to the `callback` function will | ||
* contain an array of objects containing both a `priority` and `exchange` property (e.g. `[{priority: 10, exchange: 'mx.example.com'}, ...]`). | ||
* @since v0.1.27 | ||
@@ -473,3 +510,3 @@ */ | ||
/** | ||
* 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 | ||
* 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 | ||
* objects with the following properties: | ||
@@ -504,4 +541,4 @@ * | ||
/** | ||
* Uses the DNS protocol to resolve name server records (`NS` records) for the`hostname`. The `addresses` argument passed to the `callback` function will | ||
* contain an array of name server records available for `hostname`(e.g. `['ns1.example.com', 'ns2.example.com']`). | ||
* Uses the DNS protocol to resolve name server records (`NS` records) for the `hostname`. The `addresses` argument passed to the `callback` function will | ||
* contain an array of name server records available for `hostname` (e.g. `['ns1.example.com', 'ns2.example.com']`). | ||
* @since v0.1.90 | ||
@@ -517,3 +554,3 @@ */ | ||
/** | ||
* Uses the DNS protocol to resolve pointer records (`PTR` records) for the`hostname`. The `addresses` argument passed to the `callback` function will | ||
* Uses the DNS protocol to resolve pointer records (`PTR` records) for the `hostname`. The `addresses` argument passed to the `callback` function will | ||
* be an array of strings containing the reply records. | ||
@@ -563,3 +600,3 @@ * @since v6.0.0 | ||
/** | ||
* Uses the DNS protocol to resolve service records (`SRV` records) for the`hostname`. The `addresses` argument passed to the `callback` function will | ||
* Uses the DNS protocol to resolve service records (`SRV` records) for the `hostname`. The `addresses` argument passed to the `callback` function will | ||
* be an array of objects with the following properties: | ||
@@ -590,3 +627,3 @@ * | ||
/** | ||
* Uses the DNS protocol to resolve text queries (`TXT` records) for the`hostname`. The `records` argument passed to the `callback` function is a | ||
* Uses the DNS protocol to resolve text queries (`TXT` records) for the `hostname`. The `records` argument passed to the `callback` function is a | ||
* 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 | ||
@@ -631,4 +668,4 @@ * one record. Depending on the use case, these could be either joined together or | ||
* | ||
* 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 | ||
* 8482](https://tools.ietf.org/html/rfc8482). | ||
* 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 8482](https://tools.ietf.org/html/rfc8482). | ||
*/ | ||
@@ -646,4 +683,4 @@ export function resolveAny( | ||
* | ||
* On error, `err` is an `Error` object, where `err.code` is | ||
* one of the `DNS error codes`. | ||
* On error, `err` is an [`Error`](https://nodejs.org/docs/latest-v18.x/api/errors.html#class-error) object, where `err.code` is | ||
* one of the [DNS error codes](https://nodejs.org/docs/latest-v18.x/api/dns.html#error-codes). | ||
* @since v0.1.16 | ||
@@ -656,3 +693,4 @@ */ | ||
/** | ||
* Get the default value for `verbatim` in {@link lookup} and `dnsPromises.lookup()`. The value could be: | ||
* Get the default value for `verbatim` in {@link lookup} and [`dnsPromises.lookup()`](https://nodejs.org/docs/latest-v18.x/api/dns.html#dnspromiseslookuphostname-options). | ||
* The value could be: | ||
* | ||
@@ -683,10 +721,10 @@ * * `ipv4first`: for `verbatim` defaulting to `false`. | ||
* | ||
* The {@link setServers} method affects only {@link resolve},`dns.resolve*()` and {@link reverse} (and specifically _not_ {@link lookup}). | ||
* The {@link setServers} method affects only {@link resolve}, `dns.resolve*()` and {@link reverse} (and specifically _not_ {@link lookup}). | ||
* | ||
* This method works much like [resolve.conf](https://man7.org/linux/man-pages/man5/resolv.conf.5.html). | ||
* 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 | ||
* 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 | ||
* subsequent servers provided. Fallback DNS servers will only be used if the | ||
* earlier ones time out or result in some other error. | ||
* @since v0.11.3 | ||
* @param servers array of `RFC 5952` formatted addresses | ||
* @param servers array of [RFC 5952](https://datatracker.ietf.org/doc/html/rfc5952#section-6) formatted addresses | ||
*/ | ||
@@ -711,3 +749,4 @@ export function setServers(servers: readonly string[]): void; | ||
/** | ||
* Set the default value of `verbatim` in {@link lookup} and `dnsPromises.lookup()`. The value could be: | ||
* Set the default value of `verbatim` in {@link lookup} and [`dnsPromises.lookup()`](https://nodejs.org/docs/latest-v18.x/api/dns.html#dnspromiseslookuphostname-options). | ||
* The value could be: | ||
* | ||
@@ -717,5 +756,6 @@ * * `ipv4first`: sets default `verbatim` `false`. | ||
* | ||
* The default is `ipv4first` and {@link setDefaultResultOrder} have higher | ||
* priority than `--dns-result-order`. When using `worker threads`,{@link setDefaultResultOrder} from the main thread won't affect the default | ||
* dns orders in workers. | ||
* The default is `verbatim` and {@link setDefaultResultOrder} have higher | ||
* priority than [`--dns-result-order`](https://nodejs.org/docs/latest-v18.x/api/cli.html#--dns-result-orderorder). When using | ||
* [worker threads](https://nodejs.org/docs/latest-v18.x/api/worker_threads.html), {@link setDefaultResultOrder} from the main | ||
* thread won't affect the default dns orders in workers. | ||
* @since v16.4.0, v14.18.0 | ||
@@ -726,29 +766,33 @@ * @param order must be `'ipv4first'` or `'verbatim'`. | ||
// Error codes | ||
export const NODATA: string; | ||
export const FORMERR: string; | ||
export const SERVFAIL: string; | ||
export const NOTFOUND: string; | ||
export const NOTIMP: string; | ||
export const REFUSED: string; | ||
export const BADQUERY: string; | ||
export const BADNAME: string; | ||
export const BADFAMILY: string; | ||
export const BADRESP: string; | ||
export const CONNREFUSED: string; | ||
export const TIMEOUT: string; | ||
export const EOF: string; | ||
export const FILE: string; | ||
export const NOMEM: string; | ||
export const DESTRUCTION: string; | ||
export const BADSTR: string; | ||
export const BADFLAGS: string; | ||
export const NONAME: string; | ||
export const BADHINTS: string; | ||
export const NOTINITIALIZED: string; | ||
export const LOADIPHLPAPI: string; | ||
export const ADDRGETNETWORKPARAMS: string; | ||
export const CANCELLED: string; | ||
export const NODATA: "NODATA"; | ||
export const FORMERR: "FORMERR"; | ||
export const SERVFAIL: "SERVFAIL"; | ||
export const NOTFOUND: "NOTFOUND"; | ||
export const NOTIMP: "NOTIMP"; | ||
export const REFUSED: "REFUSED"; | ||
export const BADQUERY: "BADQUERY"; | ||
export const BADNAME: "BADNAME"; | ||
export const BADFAMILY: "BADFAMILY"; | ||
export const BADRESP: "BADRESP"; | ||
export const CONNREFUSED: "TIMEOUT"; | ||
export const TIMEOUT: "TIMEOUT"; | ||
export const EOF: "EOF"; | ||
export const FILE: "FILE"; | ||
export const NOMEM: "NOMEM"; | ||
export const DESTRUCTION: "DESTRUCTION"; | ||
export const BADSTR: "BADSTR"; | ||
export const BADFLAGS: "BADFLAGS"; | ||
export const NONAME: "NONAME"; | ||
export const BADHINTS: "BADHINTS"; | ||
export const NOTINITIALIZED: "NOTINITIALIZED"; | ||
export const LOADIPHLPAPI: "LOADIPHLPAPI"; | ||
export const ADDRGETNETWORKPARAMS: "ADDRGETNETWORKPARAMS"; | ||
export const CANCELLED: "CANCELLED"; | ||
export interface ResolverOptions { | ||
/** | ||
* Query timeout in milliseconds, or `-1` to use the default timeout. | ||
*/ | ||
timeout?: number | undefined; | ||
/** | ||
* The number of tries the resolver will try contacting each name server before giving up. | ||
* @default 4 | ||
@@ -762,7 +806,7 @@ */ | ||
* Creating a new resolver uses the default server settings. Setting | ||
* the servers used for a resolver using `resolver.setServers()` does not affect | ||
* the servers used for a resolver using [`resolver.setServers()`](https://nodejs.org/docs/latest-v18.x/api/dns.html#dnssetserversservers) does not affect | ||
* other resolvers: | ||
* | ||
* ```js | ||
* const { Resolver } = require('dns'); | ||
* const { Resolver } = require('node:dns'); | ||
* const resolver = new Resolver(); | ||
@@ -777,3 +821,3 @@ * resolver.setServers(['4.4.4.4']); | ||
* | ||
* The following methods from the `dns` module are available: | ||
* The following methods from the `node:dns` module are available: | ||
* | ||
@@ -826,3 +870,3 @@ * * `resolver.getServers()` | ||
* | ||
* If a v4 or v6 address is not specified, it is set to the default, and the | ||
* If a v4 or v6 address is not specified, it is set to the default and the | ||
* operating system will choose a local address automatically. | ||
@@ -829,0 +873,0 @@ * |
/** | ||
* The `dns.promises` API provides an alternative set of asynchronous DNS methods | ||
* that return `Promise` objects rather than using callbacks. The API is accessible | ||
* via `require('dns').promises` or `require('dns/promises')`. | ||
* via `require('node:dns').promises` or `require('node:dns/promises')`. | ||
* @since v10.6.0 | ||
@@ -46,5 +46,5 @@ */ | ||
* | ||
* With the `all` option set to `true`, the `Promise` is resolved with `addresses`being an array of objects with the properties `address` and `family`. | ||
* With the `all` option set to `true`, the `Promise` is resolved with `addresses` being an array of objects with the properties `address` and `family`. | ||
* | ||
* On error, the `Promise` is rejected with an `Error` object, where `err.code`is the error code. | ||
* On error, the `Promise` is rejected with an [`Error`](https://nodejs.org/docs/latest-v18.x/api/errors.html#class-error) object, where `err.code` is the error code. | ||
* Keep in mind that `err.code` will be set to `'ENOTFOUND'` not only when | ||
@@ -54,7 +54,7 @@ * the host name does not exist but also when the lookup fails in other ways | ||
* | ||
* `dnsPromises.lookup()` does not necessarily have anything to do with the DNS | ||
* [`dnsPromises.lookup()`](https://nodejs.org/docs/latest-v18.x/api/dns.html#dnspromiseslookuphostname-options) does not necessarily have anything to do with the DNS | ||
* protocol. The implementation uses an operating system facility that can | ||
* associate names with addresses, and vice versa. This implementation can have | ||
* associate names with addresses and vice versa. This implementation can have | ||
* subtle but important consequences on the behavior of any Node.js program. Please | ||
* take some time to consult the `Implementation considerations section` before | ||
* take some time to consult the [Implementation considerations section](https://nodejs.org/docs/latest-v18.x/api/dns.html#implementation-considerations) before | ||
* using `dnsPromises.lookup()`. | ||
@@ -65,3 +65,3 @@ * | ||
* ```js | ||
* const dns = require('dns'); | ||
* const dns = require('node:dns'); | ||
* const dnsPromises = dns.promises; | ||
@@ -97,8 +97,8 @@ * const options = { | ||
* If `address` is not a valid IP address, a `TypeError` will be thrown. | ||
* The `port` will be coerced to a number. If it is not a legal port, a `TypeError`will be thrown. | ||
* The `port` will be coerced to a number. If it is not a legal port, a `TypeError` will be thrown. | ||
* | ||
* On error, the `Promise` is rejected with an `Error` object, where `err.code`is the error code. | ||
* On error, the `Promise` is rejected with an [`Error`](https://nodejs.org/docs/latest-v18.x/api/errors.html#class-error) object, where `err.code` is the error code. | ||
* | ||
* ```js | ||
* const dnsPromises = require('dns').promises; | ||
* const dnsPromises = require('node:dns').promises; | ||
* dnsPromises.lookupService('127.0.0.1', 22).then((result) => { | ||
@@ -126,3 +126,4 @@ * console.log(result.hostname, result.service); | ||
* | ||
* On error, the `Promise` is rejected with an `Error` object, where `err.code`is one of the `DNS error codes`. | ||
* On error, the `Promise` is rejected with an [`Error`](https://nodejs.org/docs/latest-v18.x/api/errors.html#class-error) object, where `err.code` | ||
* is one of the [DNS error codes](https://nodejs.org/docs/latest-v18.x/api/dns.html#error-codes). | ||
* @since v10.6.0 | ||
@@ -150,3 +151,3 @@ * @param hostname Host name to resolve. | ||
/** | ||
* Uses the DNS protocol to resolve IPv4 addresses (`A` records) for the`hostname`. On success, the `Promise` is resolved with an array of IPv4 | ||
* Uses the DNS protocol to resolve IPv4 addresses (`A` records) for the `hostname`. On success, the `Promise` is resolved with an array of IPv4 | ||
* addresses (e.g. `['74.125.79.104', '74.125.79.105', '74.125.79.106']`). | ||
@@ -160,3 +161,3 @@ * @since v10.6.0 | ||
/** | ||
* Uses the DNS protocol to resolve IPv6 addresses (`AAAA` records) for the`hostname`. On success, the `Promise` is resolved with an array of IPv6 | ||
* Uses the DNS protocol to resolve IPv6 addresses (`AAAA` records) for the `hostname`. On success, the `Promise` is resolved with an array of IPv6 | ||
* addresses. | ||
@@ -201,3 +202,3 @@ * @since v10.6.0 | ||
* the `Promise` is resolved with an array of objects containing available | ||
* certification authority authorization records available for the `hostname`(e.g. `[{critical: 0, iodef: 'mailto:pki@example.com'},{critical: 128, issue: 'pki.example.com'}]`). | ||
* certification authority authorization records available for the `hostname` (e.g. `[{critical: 0, iodef: 'mailto:pki@example.com'},{critical: 128, issue: 'pki.example.com'}]`). | ||
* @since v15.0.0, v14.17.0 | ||
@@ -214,3 +215,3 @@ */ | ||
/** | ||
* Uses the DNS protocol to resolve mail exchange records (`MX` records) for the`hostname`. On success, the `Promise` is resolved with an array of objects | ||
* Uses the DNS protocol to resolve mail exchange records (`MX` records) for the `hostname`. On success, the `Promise` is resolved with an array of objects | ||
* containing both a `priority` and `exchange` property (e.g.`[{priority: 10, exchange: 'mx.example.com'}, ...]`). | ||
@@ -221,3 +222,3 @@ * @since v10.6.0 | ||
/** | ||
* Uses the DNS protocol to resolve regular expression based records (`NAPTR`records) for the `hostname`. On success, the `Promise` is resolved with an array | ||
* Uses the DNS protocol to resolve regular expression-based records (`NAPTR` records) for the `hostname`. On success, the `Promise` is resolved with an array | ||
* of objects with the following properties: | ||
@@ -246,3 +247,3 @@ * | ||
/** | ||
* Uses the DNS protocol to resolve name server records (`NS` records) for the`hostname`. On success, the `Promise` is resolved with an array of name server | ||
* Uses the DNS protocol to resolve name server records (`NS` records) for the `hostname`. On success, the `Promise` is resolved with an array of name server | ||
* records available for `hostname` (e.g.`['ns1.example.com', 'ns2.example.com']`). | ||
@@ -253,3 +254,3 @@ * @since v10.6.0 | ||
/** | ||
* Uses the DNS protocol to resolve pointer records (`PTR` records) for the`hostname`. On success, the `Promise` is resolved with an array of strings | ||
* Uses the DNS protocol to resolve pointer records (`PTR` records) for the `hostname`. On success, the `Promise` is resolved with an array of strings | ||
* containing the reply records. | ||
@@ -287,3 +288,3 @@ * @since v10.6.0 | ||
/** | ||
* Uses the DNS protocol to resolve service records (`SRV` records) for the`hostname`. On success, the `Promise` is resolved with an array of objects with | ||
* Uses the DNS protocol to resolve service records (`SRV` records) for the `hostname`. On success, the `Promise` is resolved with an array of objects with | ||
* the following properties: | ||
@@ -308,3 +309,3 @@ * | ||
/** | ||
* Uses the DNS protocol to resolve text queries (`TXT` records) for the`hostname`. On success, the `Promise` is resolved with a two-dimensional array | ||
* Uses the DNS protocol to resolve text queries (`TXT` records) for the `hostname`. On success, the `Promise` is resolved with a 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 | ||
@@ -320,3 +321,4 @@ * one record. Depending on the use case, these could be either joined together or | ||
* | ||
* On error, the `Promise` is rejected with an `Error` object, where `err.code`is one of the `DNS error codes`. | ||
* On error, the `Promise` is rejected with an [`Error`](https://nodejs.org/docs/latest-v18.x/api/errors.html#class-error) object, where `err.code` | ||
* is one of the [DNS error codes](https://nodejs.org/docs/latest-v18.x/api/dns.html#error-codes). | ||
* @since v10.6.0 | ||
@@ -326,3 +328,4 @@ */ | ||
/** | ||
* Get the default value for `verbatim` in {@link lookup} and `dnsPromises.lookup()`. The value could be: | ||
* Get the default value for `verbatim` in {@link lookup} and [dnsPromises.lookup()](https://nodejs.org/docs/latest-v18.x/api/dns.html#dnspromiseslookuphostname-options). | ||
* The value could be: | ||
* | ||
@@ -367,5 +370,6 @@ * * `ipv4first`: for `verbatim` defaulting to `false`. | ||
* | ||
* The default is `ipv4first` and `dnsPromises.setDefaultResultOrder()` have | ||
* higher priority than `--dns-result-order`. When using `worker threads`,`dnsPromises.setDefaultResultOrder()` from the main thread won't affect the | ||
* default dns orders in workers. | ||
* The default is `verbatim` and [dnsPromises.setDefaultResultOrder()](https://nodejs.org/docs/latest-v18.x/api/dns.html#dnspromisessetdefaultresultorderorder) | ||
* have higher priority than [`--dns-result-order`](https://nodejs.org/docs/latest-v18.x/api/cli.html#--dns-result-orderorder). | ||
* When using [worker threads](https://nodejs.org/docs/latest-v18.x/api/worker_threads.html), [`dnsPromises.setDefaultResultOrder()`](https://nodejs.org/docs/latest-v18.x/api/dns.html#dnspromisessetdefaultresultorderorder) | ||
* from the main thread won't affect the default dns orders in workers. | ||
* @since v16.4.0, v14.18.0 | ||
@@ -375,4 +379,76 @@ * @param order must be `'ipv4first'` or `'verbatim'`. | ||
function setDefaultResultOrder(order: "ipv4first" | "verbatim"): void; | ||
const NODATA: "NODATA"; | ||
const FORMERR: "FORMERR"; | ||
const SERVFAIL: "SERVFAIL"; | ||
const NOTFOUND: "NOTFOUND"; | ||
const NOTIMP: "NOTIMP"; | ||
const REFUSED: "REFUSED"; | ||
const BADQUERY: "BADQUERY"; | ||
const BADNAME: "BADNAME"; | ||
const BADFAMILY: "BADFAMILY"; | ||
const BADRESP: "BADRESP"; | ||
const CONNREFUSED: "TIMEOUT"; | ||
const TIMEOUT: "TIMEOUT"; | ||
const EOF: "EOF"; | ||
const FILE: "FILE"; | ||
const NOMEM: "NOMEM"; | ||
const DESTRUCTION: "DESTRUCTION"; | ||
const BADSTR: "BADSTR"; | ||
const BADFLAGS: "BADFLAGS"; | ||
const NONAME: "NONAME"; | ||
const BADHINTS: "BADHINTS"; | ||
const NOTINITIALIZED: "NOTINITIALIZED"; | ||
const LOADIPHLPAPI: "LOADIPHLPAPI"; | ||
const ADDRGETNETWORKPARAMS: "ADDRGETNETWORKPARAMS"; | ||
const CANCELLED: "CANCELLED"; | ||
/** | ||
* An independent resolver for DNS requests. | ||
* | ||
* Creating a new resolver uses the default server settings. Setting | ||
* the servers used for a resolver using [`resolver.setServers()`](https://nodejs.org/docs/latest-v18.x/api/dns.html#dnspromisessetserversservers) does not affect | ||
* other resolvers: | ||
* | ||
* ```js | ||
* const { Resolver } = require('node:dns').promises; | ||
* const resolver = new Resolver(); | ||
* resolver.setServers(['4.4.4.4']); | ||
* | ||
* // This request will use the server at 4.4.4.4, independent of global settings. | ||
* resolver.resolve4('example.org').then((addresses) => { | ||
* // ... | ||
* }); | ||
* | ||
* // Alternatively, the same code can be written using async-await style. | ||
* (async function() { | ||
* const addresses = await resolver.resolve4('example.org'); | ||
* })(); | ||
* ``` | ||
* | ||
* The following methods from the `dnsPromises` API are available: | ||
* | ||
* * `resolver.getServers()` | ||
* * `resolver.resolve()` | ||
* * `resolver.resolve4()` | ||
* * `resolver.resolve6()` | ||
* * `resolver.resolveAny()` | ||
* * `resolver.resolveCaa()` | ||
* * `resolver.resolveCname()` | ||
* * `resolver.resolveMx()` | ||
* * `resolver.resolveNaptr()` | ||
* * `resolver.resolveNs()` | ||
* * `resolver.resolvePtr()` | ||
* * `resolver.resolveSoa()` | ||
* * `resolver.resolveSrv()` | ||
* * `resolver.resolveTxt()` | ||
* * `resolver.reverse()` | ||
* * `resolver.setServers()` | ||
* @since v10.6.0 | ||
*/ | ||
class Resolver { | ||
constructor(options?: ResolverOptions); | ||
/** | ||
* Cancel all outstanding DNS queries made by this resolver. The corresponding | ||
* callbacks will be called with an error with code `ECANCELLED`. | ||
* @since v8.3.0 | ||
*/ | ||
cancel(): void; | ||
@@ -384,2 +460,3 @@ getServers: typeof getServers; | ||
resolveAny: typeof resolveAny; | ||
resolveCaa: typeof resolveCaa; | ||
resolveCname: typeof resolveCname; | ||
@@ -394,2 +471,17 @@ resolveMx: typeof resolveMx; | ||
reverse: typeof reverse; | ||
/** | ||
* The resolver instance will send its requests from the specified IP address. | ||
* This allows programs to specify outbound interfaces when used on multi-homed | ||
* systems. | ||
* | ||
* If a v4 or v6 address is not specified, it is set to the default and the | ||
* operating system will choose a local address automatically. | ||
* | ||
* The resolver will use the v4 local address when making requests to IPv4 DNS | ||
* servers, and the v6 local address when making requests to IPv6 DNS servers. | ||
* The `rrtype` of resolution requests has no impact on the local address used. | ||
* @since v15.1.0, v14.17.0 | ||
* @param [ipv4='0.0.0.0'] A string representation of an IPv4 address. | ||
* @param [ipv6='::0'] A string representation of an IPv6 address. | ||
*/ | ||
setLocalAddress(ipv4?: string, ipv6?: string): void; | ||
@@ -396,0 +488,0 @@ setServers: typeof setServers; |
{ | ||
"name": "@types/node", | ||
"version": "18.19.24", | ||
"version": "18.19.25", | ||
"description": "TypeScript definitions for node", | ||
@@ -220,4 +220,4 @@ "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node", | ||
}, | ||
"typesPublisherContentHash": "a6179139e6c44858b9d83ff163d3ec41686c3726baade237a55e3aa5398742e7", | ||
"typesPublisherContentHash": "d8e1b681bf4c7b28e70179727f6248e1a63660e126e5c4743f8f44b29df3f323", | ||
"typeScriptVersion": "4.7" | ||
} |
@@ -11,3 +11,3 @@ # Installation | ||
### Additional Details | ||
* Last updated: Wed, 13 Mar 2024 13:35:54 GMT | ||
* Last updated: Mon, 18 Mar 2024 19:35:28 GMT | ||
* Dependencies: [undici-types](https://npmjs.com/package/undici-types) | ||
@@ -14,0 +14,0 @@ |
1957444
44024
38
291