diff --git a/CHANGELOG.md b/CHANGELOG.md index ee61bd0..c398a20 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,7 @@ For major (breaking) changes - version 3 and 2 see end of page. | Version | Date | Comment | | -------------- | -------------- | -------- | +| 4.24.0 | 2020-05-01 | `networkInterfaces()` added subnet mask ip4 and ip6 | | 4.23.10 | 2020-05-01 | `cpuTemperature()` optimized parsing linux | | 4.23.9 | 2020-04-29 | `currentLoad()` workarround for no os.cpus info | | 4.23.8 | 2020-04-26 | `getMacAddresses()` fix added try catch | diff --git a/README.md b/README.md index b7ad5e5..ae3e3e5 100644 --- a/README.md +++ b/README.md @@ -87,13 +87,13 @@ si.cpu() (last 7 major and minor version releases) +- Version 4.24.0: `networkInterfaces()` added subnet mask ip4 and ip6 - Version 4.23.0: `versions()` added param to specify which program/lib versions to detect - Version 4.22.0: `services()` added pids (windows) - Version 4.21.0: added npx copmpatibility - Version 4.20.0: `battery()` added designcapacity, voltage, unit - Version 4.19.0: `osInfo()` added uefi (OS uses UEFI during startup) - Version 4.18.0: `networkInterfaces()` added dhcp for mac os, added dhcp linux fallback -- Version 4.17.0: `networkInterfaces()` added dhcp, dnsSuffix, ieee8021xAuth, ieee8021xState - ... You can find all changes here: [detailed changelog][changelog-url] @@ -431,7 +431,9 @@ I also created a nice little command line tool called [mmon][mmon-github-url] ( | | [0].iface | X | X | X | X | X | interface | | | [0].ifaceName | X | X | X | X | X | interface name (differs on Windows) | | | [0].ip4 | X | X | X | X | X | ip4 address | +| | [0].ip4subnet | X | X | X | X | X | ip4 subnet mask | | | [0].ip6 | X | X | X | X | X | ip6 address | +| | [0].ip6subnet | X | X | X | X | X | ip6 subnet mask | | | [0].mac | X | X | X | X | X | MAC address | | | [0].internal | X | X | X | X | X | true if internal interface | | | [0].virtual | X | X | X | X | X | true if virtual interface | diff --git a/docs/history.html b/docs/history.html index 698ee92..f8f9e4a 100644 --- a/docs/history.html +++ b/docs/history.html @@ -83,6 +83,11 @@ + + 4.24.0 + 2020-05-01 + networkInterfaces() added netmask ip4 and ip6 + 4.23.10 2020-05-01 diff --git a/docs/index.html b/docs/index.html index 7153e9a..26e3710 100644 --- a/docs/index.html +++ b/docs/index.html @@ -168,7 +168,7 @@
systeminformation
-
Current Version: 4.23.10
+
Current Version: 4.24.0
diff --git a/docs/network.html b/docs/network.html index 8ce2041..4b419d0 100644 --- a/docs/network.html +++ b/docs/network.html @@ -105,6 +105,16 @@ X ip4 address + + + [0].ip4subnet + X + X + X + X + X + ip4 subnet mask + [0].ip6 @@ -115,6 +125,16 @@ X ip6 address + + + [0].ip6subnet + X + X + X + X + X + ip6 subnet mask + [0].mac @@ -257,7 +277,9 @@ si.networkInterfaces().then(data => console.log(data)); result.main) ? maxtmp : result.main; } if (result.main !== -1) { + if (result.max === -1) { + result.max = result.main; + } if (callback) { callback(result); } resolve(result); } diff --git a/lib/index.d.ts b/lib/index.d.ts index 74169d2..e0d0518 100644 --- a/lib/index.d.ts +++ b/lib/index.d.ts @@ -314,7 +314,9 @@ export namespace Systeminformation { iface: string; ifaceName: string; ip4: string; + ip4subnet: string; ip6: string; + ip6subnet: string; mac: string; internal: boolean; virtual: boolean; diff --git a/lib/network.js b/lib/network.js index 404ba7c..342639b 100644 --- a/lib/network.js +++ b/lib/network.js @@ -694,13 +694,27 @@ function networkInterfaces(callback) { if (_darwin || _freebsd || _openbsd || _netbsd) { nics = getDarwinNics(); + nics.forEach(nic => { + if ({}.hasOwnProperty.call(ifaces, nic.iface)) { + ifaces[nic.iface].forEach(function (details) { + if (details.family === 'IPv4') { + nic.ip4subnet = details.netmask; + } + if (details.family === 'IPv6') { + nic.ip6subnet = details.netmask; + } + }); + } + result.push({ iface: nic.iface, ifaceName: nic.iface, ip4: nic.ip4, + ip4subnet: nic.ip4subnet || '', ip6: nic.ip6, + ip6subnet: nic.ip6subnet || '', mac: nic.mac, internal: nic.internal, virtual: nic.internal ? false : testVirtualNic(nic.iface, nic.iface, nic.mac), @@ -737,7 +751,9 @@ function networkInterfaces(callback) { } for (let dev in ifaces) { let ip4 = ''; + let ip4subnet = ''; let ip6 = ''; + let ip6subnet = ''; let mac = ''; let duplex = ''; let mtu = ''; @@ -755,10 +771,12 @@ function networkInterfaces(callback) { ifaces[dev].forEach(function (details) { if (details.family === 'IPv4') { ip4 = details.address; + ip4subnet = details.netmask; } if (details.family === 'IPv6') { if (!ip6 || ip6.match(/^fe80::/i)) { ip6 = details.address; + ip6subnet = details.netmask; } } mac = details.mac; @@ -852,7 +870,9 @@ function networkInterfaces(callback) { iface: dev, ifaceName, ip4, + ip4subnet, ip6, + ip6subnet, mac, internal, virtual, diff --git a/package.json b/package.json index 3d30c27..314c038 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "Simple system and OS information library", "license": "MIT", "author": "Sebastian Hildebrandt (https://plus-innovations.com)", - "homepage": "https://github.com/sebhildebrandt/systeminformation", + "homepage": "https://systeminformation.io", "main": "./lib/index.js", "bin": "./lib/cli.js", "types": "./lib/index.d.ts",