Skip to content

Commit

Permalink
fixup! fixup! net: make server.address() return a string for family
Browse files Browse the repository at this point in the history
  • Loading branch information
aduh95 committed Jun 5, 2022
1 parent 5e12824 commit 070ff18
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
10 changes: 5 additions & 5 deletions doc/api/dns.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ changes:
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'`, in which case its value will be ignored.
string `'IPv6'`.
- version: v18.0.0
pr-url: https://github.com/nodejs/node/pull/41678
description: Passing an invalid callback to the `callback` argument
Expand All @@ -202,10 +202,10 @@ changes:

* `hostname` {string}
* `options` {integer | Object}
* `family` {integer} The record family. Must be `4`, `6`, or `0`. For backward
compatibility reasons,`'IPv4'` and `'IPv6'` are interpreted as `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
Expand Down
4 changes: 3 additions & 1 deletion lib/dns.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,10 @@ function lookup(hostname, options, callback) {
if (options?.family != null) {
switch (options.family) {
case 'IPv4':
family = 4;
break;
case 'IPv6':
family = 0;
family = 6;
break;
default:
validateOneOf(options.family, 'options.family', validFamilies, true);
Expand Down

0 comments on commit 070ff18

Please sign in to comment.