diff options
author | Antoine du Hamel <duhamelantoine1995@gmail.com> | 2022-05-10 12:10:03 +0300 |
---|---|---|
committer | Michael Dawson <mdawson@devrus.com> | 2022-06-16 01:02:01 +0300 |
commit | 70b516e4dbdfdfea2183995ec3b368dacaa38183 (patch) | |
tree | 553bed2d139941de4f8085475a6ab4572030de5a /doc/api/dns.md | |
parent | 74716ada2e670d23fc4824e6483bee733d52c70b (diff) |
dns: accept `'IPv4'` and `'IPv6'` for `family`
Refs: https://github.com/nodejs/node/issues/43014
PR-URL: https://github.com/nodejs/node/pull/43054
Fixes: https://github.com/nodejs/node/issues/43014
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Beth Griggs <bgriggs@redhat.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Diffstat (limited to 'doc/api/dns.md')
-rw-r--r-- | doc/api/dns.md | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/doc/api/dns.md b/doc/api/dns.md index c9e901da677..0d281fdffe0 100644 --- a/doc/api/dns.md +++ b/doc/api/dns.md @@ -179,6 +179,11 @@ section if a custom port is used. <!-- YAML added: v0.1.90 changes: + - version: REPLACEME + pr-url: https://github.com/nodejs/node/pull/43054 + description: For compatibility with `node:net`, when passing an option + object the `family` option can be the string `'IPv4'` or the + string `'IPv6'`. - version: v18.0.0 pr-url: https://github.com/nodejs/node/pull/41678 description: Passing an invalid callback to the `callback` argument @@ -197,9 +202,10 @@ changes: * `hostname` {string} * `options` {integer | Object} - * `family` {integer} The record family. Must be `4`, `6`, or `0`. The value - `0` indicates that IPv4 and IPv6 addresses are both returned. **Default:** - `0`. + * `family` {integer|string} 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 IPv4 and IPv6 addresses + are both returned. **Default:** `0`. * `hints` {number} One or more [supported `getaddrinfo` flags][]. Multiple flags may be passed by bitwise `OR`ing their values. * `all` {boolean} When `true`, the callback returns all resolved addresses in @@ -219,8 +225,8 @@ changes: Resolves a host name (e.g. `'nodejs.org'`) into the first found A (IPv4) or 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 |