From 4a6b678070f5e2ba0f0200a1a4b9a31dd0b60dac Mon Sep 17 00:00:00 2001 From: Mudit Ameta Date: Sun, 16 Jul 2017 11:51:44 -0400 Subject: os: add CIDR support This patch adds support for CIDR notation to the output of the `networkInterfaces()` method PR-URL: https://github.com/nodejs/node/pull/14307 Fixes: https://github.com/nodejs/node/issues/14006 Reviewed-By: Roman Reiss Reviewed-By: James M Snell Reviewed-By: Refael Ackermann Reviewed-By: Timothy Gu --- doc/api/os.md | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'doc/api/os.md') diff --git a/doc/api/os.md b/doc/api/os.md index 3b4b9526cb..9dc0fcf308 100644 --- a/doc/api/os.md +++ b/doc/api/os.md @@ -253,6 +253,9 @@ The properties available on the assigned network address object include: similar interface that is not remotely accessible; otherwise `false` * `scopeid` {number} The numeric IPv6 scope ID (only specified when `family` is `IPv6`) +* `cidr` {string} The assigned IPv4 or IPv6 address with the routing prefix + in CIDR notation. If the `netmask` is invalid, this property is set + to `null` ```js @@ -263,14 +266,16 @@ The properties available on the assigned network address object include: netmask: '255.0.0.0', family: 'IPv4', mac: '00:00:00:00:00:00', - internal: true + internal: true, + cidr: '127.0.0.1/8' }, { address: '::1', netmask: 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff', family: 'IPv6', mac: '00:00:00:00:00:00', - internal: true + internal: true, + cidr: '::1/128' } ], eth0: [ @@ -279,14 +284,16 @@ The properties available on the assigned network address object include: netmask: '255.255.255.0', family: 'IPv4', mac: '01:02:03:0a:0b:0c', - internal: false + internal: false, + cidr: '192.168.1.108/24' }, { address: 'fe80::a00:27ff:fe4e:66a1', netmask: 'ffff:ffff:ffff:ffff::', family: 'IPv6', mac: '01:02:03:0a:0b:0c', - internal: false + internal: false, + cidr: 'fe80::a00:27ff:fe4e:66a1/64' } ] } -- cgit v1.2.3