From 1a930c96824a1096aa9d799002071befc99fb655 Mon Sep 17 00:00:00 2001 From: Sebastian Hildebrandt Date: Fri, 22 Apr 2022 07:14:54 +0200 Subject: [PATCH] netforkInterfaces() node 18 compatibility --- CHANGELOG.md | 3 ++- docs/history.html | 5 +++++ docs/index.html | 2 +- lib/network.js | 12 ++++++------ 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b69b14..886112c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -80,7 +80,8 @@ For major (breaking) changes - **version 4, 3 and 2** - see end of page. | Version | Date | Comment | | -------------- | -------------- | -------- | -| 5.11.13 | 2022-04-21 | `etworkStats()` improved scanning (mac OS) | +| 5.11.14 | 2022-04-22 | `netforkInterfaces()` node 18 compatibility | +| 5.11.13 | 2022-04-21 | `networkStats()` improved scanning (mac OS) | | 5.11.12 | 2022-04-19 | `battery()` improved M1 support (mac OS) | | 5.11.11 | 2022-04-19 | `networkInterfaces()` improved parsing (windows) | | 5.11.10 | 2022-04-18 | updated docs | diff --git a/docs/history.html b/docs/history.html index 9d17be3..2fc59e9 100644 --- a/docs/history.html +++ b/docs/history.html @@ -57,6 +57,11 @@ + + 5.11.14 + 2022-04-22 + networkInterfaces() node 18 compatibility + 5.11.13 2022-04-21 diff --git a/docs/index.html b/docs/index.html index 388d857..f896172 100644 --- a/docs/index.html +++ b/docs/index.html @@ -170,7 +170,7 @@
systeminformation
 
-
New Version: 5.11.13
+
New Version: 5.11.14
diff --git a/lib/network.js b/lib/network.js index d67bc51..ae224bc 100644 --- a/lib/network.js +++ b/lib/network.js @@ -743,10 +743,10 @@ function networkInterfaces(callback, rescan, defaultString) { if ({}.hasOwnProperty.call(ifaces, nic.iface)) { ifaces[nic.iface].forEach(function (details) { - if (details.family === 'IPv4') { + if (details.family === 'IPv4' || details.family === 4) { nic.ip4subnet = details.netmask; } - if (details.family === 'IPv6') { + if (details.family === 'IPv6' || details.family === 6) { nic.ip6subnet = details.netmask; } }); @@ -818,11 +818,11 @@ function networkInterfaces(callback, rescan, defaultString) { if ({}.hasOwnProperty.call(ifaces, dev)) { let ifaceName = dev; ifaces[dev].forEach(function (details) { - if (details.family === 'IPv4') { + if (details.family === 'IPv4' || details.family === 4) { ip4 = details.address; ip4subnet = details.netmask; } - if (details.family === 'IPv6') { + if (details.family === 'IPv6' || details.family === 6) { if (!ip6 || ip6.match(/^fe80::/i)) { ip6 = details.address; ip6subnet = details.netmask; @@ -984,11 +984,11 @@ function networkInterfaces(callback, rescan, defaultString) { if ({}.hasOwnProperty.call(ifaces, dev)) { let ifaceName = dev; ifaces[dev].forEach(function (details) { - if (details.family === 'IPv4') { + if (details.family === 'IPv4' || details.family === 4) { ip4 = details.address; ip4subnet = details.netmask; } - if (details.family === 'IPv6') { + if (details.family === 'IPv6' || details.family === 6) { if (!ip6 || ip6.match(/^fe80::/i)) { ip6 = details.address; ip6subnet = details.netmask;