Socket
Socket
Sign inDemoInstall

@types/node

Package Overview
Dependencies
0
Maintainers
1
Versions
1817
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 16.18.89 to 16.18.90

198

node v16.18/dns.d.ts
/**
* 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/v16.9.0/lib/dns.js)
* See the [Implementation considerations section](https://nodejs.org/docs/latest-v16.x/api/dns.html#implementation-considerations) for more information.
* @see [source](https://github.com/nodejs/node/blob/v16.20.2/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,5 +71,25 @@ /**

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-v16.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;
/**
* 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-v16.x/api/cli.html#--dns-result-orderorder).
* @default true (addresses are not reordered)
*/
verbatim?: boolean | undefined;

@@ -76,3 +104,10 @@ }

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;

@@ -83,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`.

@@ -97,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-v16.x/api/dns.html#implementation-considerations)
* before using `dns.lookup()`.
*

@@ -105,3 +141,3 @@ * Example usage:

* ```js
* const dns = require('dns');
* const dns = require('node:dns');
* const options = {

@@ -122,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-v16.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

@@ -160,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-v16.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) => {

@@ -173,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-v16.x/api/util.html#utilpromisifyoriginal) ed
* version, it returns a `Promise` for an `Object` with `hostname` and `service` properties.
* @since v0.11.14

@@ -285,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`:

@@ -291,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-v16.x/api/errors.html#class-error) object,
* where `err.code` is one of the `DNS error codes`.
* @since v0.1.27

@@ -378,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']`).

@@ -404,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.

@@ -430,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

@@ -443,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

@@ -457,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

@@ -470,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:

@@ -501,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

@@ -514,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.

@@ -560,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:

@@ -587,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

@@ -628,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).
*/

@@ -643,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-v16.x/api/errors.html#class-error) object, where `err.code` is
* one of the [DNS error codes](https://nodejs.org/docs/latest-v16.x/api/dns.html#error-codes).
* @since v0.1.16

@@ -671,10 +711,10 @@ */

*
* 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
*/

@@ -699,40 +739,48 @@ export function setServers(servers: readonly string[]): void;

/**
* Set the default value of `verbatim` in {@link lookup}. The value could be:
* - `ipv4first`: sets default `verbatim` `false`.
* - `verbatim`: sets default `verbatim` `true`.
* Set the default value of `verbatim` in {@link lookup} and [`dnsPromises.lookup()`](https://nodejs.org/docs/latest-v16.x/api/dns.html#dnspromiseslookuphostname-options).
* The value could be:
*
* 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.
* @since v14.18.0
* @param order must be 'ipv4first' or 'verbatim'.
* * `ipv4first`: sets default `verbatim` `false`.
* * `verbatim`: sets default `verbatim` `true`.
*
* The default is `verbatim` and {@link setDefaultResultOrder} have higher
* priority than [`--dns-result-order`](https://nodejs.org/docs/latest-v16.x/api/cli.html#--dns-result-orderorder). When using
* [worker threads](https://nodejs.org/docs/latest-v16.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
* @param order must be `'ipv4first'` or `'verbatim'`.
*/
export function setDefaultResultOrder(order: "ipv4first" | "verbatim"): void;
// 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

@@ -746,7 +794,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-v16.x/api/dns.html#dnssetserversservers) does not affect
* other resolvers:
*
* ```js
* const { Resolver } = require('dns');
* const { Resolver } = require('node:dns');
* const resolver = new Resolver();

@@ -761,3 +809,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:
*

@@ -810,3 +858,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.

@@ -813,0 +861,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-v16.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-v16.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-v16.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-v16.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-v16.x/api/errors.html#class-error) object, where `err.code`
* is one of the [DNS error codes](https://nodejs.org/docs/latest-v16.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

@@ -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-v16.x/api/errors.html#class-error) object, where `err.code`
* is one of the [DNS error codes](https://nodejs.org/docs/latest-v16.x/api/dns.html#error-codes).
* @since v10.6.0

@@ -353,14 +355,89 @@ */

/**
* Set the default value of `verbatim` in {@link lookup}. The value could be:
* - `ipv4first`: sets default `verbatim` `false`.
* - `verbatim`: sets default `verbatim` `true`.
* Set the default value of `verbatim` in `dns.lookup()` and `dnsPromises.lookup()`. The value could be:
*
* 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.
* @since v14.18.0
* @param order must be 'ipv4first' or 'verbatim'.
* * `ipv4first`: sets default `verbatim` `false`.
* * `verbatim`: sets default `verbatim` `true`.
*
* The default is `verbatim` and [dnsPromises.setDefaultResultOrder()](https://nodejs.org/docs/latest-v16.x/api/dns.html#dnspromisessetdefaultresultorderorder)
* have higher priority than [`--dns-result-order`](https://nodejs.org/docs/latest-v16.x/api/cli.html#--dns-result-orderorder).
* When using [worker threads](https://nodejs.org/docs/latest-v16.x/api/worker_threads.html), [`dnsPromises.setDefaultResultOrder()`](https://nodejs.org/docs/latest-v16.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
* @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-v16.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;

@@ -382,2 +459,17 @@ getServers: typeof getServers;

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
* @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;

@@ -384,0 +476,0 @@ setServers: typeof setServers;

{
"name": "@types/node",
"version": "16.18.89",
"version": "16.18.90",
"description": "TypeScript definitions for node",

@@ -213,4 +213,4 @@ "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",

"dependencies": {},
"typesPublisherContentHash": "b9feb2250f80f35402b0f50b0e112bb9e16c161075b5f85fd5834206d1ff9ada",
"typesPublisherContentHash": "aa9c14fcc25efc459c4ff74300efccbebda4f58f09560cf5e9afd66f72e92ddf",
"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: none

@@ -14,0 +14,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc