Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAntoine du Hamel <duhamelantoine1995@gmail.com>2022-01-07 19:24:40 +0300
committerAntoine du Hamel <duhamelantoine1995@gmail.com>2022-04-12 06:50:09 +0300
commit3a26db9697a09915a0d541d97f047fc9c02bb452 (patch)
tree66359e4b009324215ec0915b44948a1501a10172 /lib
parent6706be1cdb676605a25d1a4b8dd0890fab62d73f (diff)
net: make `server.address()` return an integer for `family`
`dns.lookup` options only accepts integer for `family` options, having a string doesn't really make sense here. PR-URL: https://github.com/nodejs/node/pull/41431 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/net.js2
-rw-r--r--lib/os.js4
2 files changed, 3 insertions, 3 deletions
diff --git a/lib/net.js b/lib/net.js
index d05fa64e78a..1c98cf48201 100644
--- a/lib/net.js
+++ b/lib/net.js
@@ -760,7 +760,7 @@ protoGetter('remoteAddress', function remoteAddress() {
});
protoGetter('remoteFamily', function remoteFamily() {
- return this._getpeername().family;
+ return `IPv${this._getpeername().family}`;
});
protoGetter('remotePort', function remotePort() {
diff --git a/lib/os.js b/lib/os.js
index c1c4bfa694a..862d6bb4a2b 100644
--- a/lib/os.js
+++ b/lib/os.js
@@ -216,7 +216,7 @@ function getCIDR(address, netmask, family) {
let groupLength = 8;
let hasZeros = false;
- if (family === 'IPv6') {
+ if (family === 6) {
split = ':';
range = 16;
groupLength = 16;
@@ -248,7 +248,7 @@ function getCIDR(address, netmask, family) {
* @returns {Record<string, Array<{
* address: string
* netmask: string
- * family: 'IPv4' | 'IPv6'
+ * family: 4 | 6
* mac: string
* internal: boolean
* scopeid: number