From ac2b488bad1d489522ac344772c70f5a6327a519 Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Wed, 20 Apr 2022 00:18:05 +0200 Subject: [PATCH] doc: fix outdated documentation for `family` property Refs: https://github.com/nodejs/node/pull/41431 Fixes: https://github.com/nodejs/node/issues/42787 --- doc/api/dgram.md | 6 +++++- doc/api/net.md | 14 +++++++++++--- doc/api/os.md | 16 ++++++++++------ doc/api/tls.md | 6 +++++- 4 files changed, 31 insertions(+), 11 deletions(-) diff --git a/doc/api/dgram.md b/doc/api/dgram.md index a67ee8e2f412a2..3926a24e4284c3 100644 --- a/doc/api/dgram.md +++ b/doc/api/dgram.md @@ -113,6 +113,10 @@ exist and calls such as `socket.address()` and `socket.setTTL()` will fail. The `'message'` event is emitted when a new datagram is available on a socket. @@ -121,7 +125,7 @@ The event handler function is passed two arguments: `msg` and `rinfo`. * `msg` {Buffer} The message. * `rinfo` {Object} Remote address information. * `address` {string} The sender address. - * `family` {string} The address family (`'IPv4'` or `'IPv6'`). + * `family` {number} The address family (`4` for IPv4 or `6` for IPv6). * `port` {number} The sender port. * `size` {number} The message size. diff --git a/doc/api/net.md b/doc/api/net.md index 0489c13a7a5288..62363040e11098 100644 --- a/doc/api/net.md +++ b/doc/api/net.md @@ -285,6 +285,10 @@ Emitted when the server has been bound after calling [`server.listen()`][]. * Returns: {Object|string|null} @@ -292,7 +296,7 @@ added: v0.1.90 Returns the bound `address`, the address `family` name, and `port` of the server as reported by the operating system if listening on an IP socket (useful to find which port was assigned when getting an OS-assigned address): -`{ port: 12346, family: 'IPv4', address: '127.0.0.1' }`. +`{ port: 12346, family: 4, address: '127.0.0.1' }`. For a server listening on a pipe or Unix domain socket, the name is returned as a string. @@ -710,7 +714,7 @@ Not applicable to Unix sockets. * `err` {Error|null} The error object. See [`dns.lookup()`][]. * `address` {string} The IP address. -* `family` {string|null} The address type. See [`dns.lookup()`][]. +* `family` {number|null} The address type. See [`dns.lookup()`][]. * `host` {string} The host name. ### Event: `'ready'` @@ -738,13 +742,17 @@ See also: [`socket.setTimeout()`][]. * Returns: {Object} Returns the bound `address`, the address `family` name and `port` of the socket as reported by the operating system: -`{ port: 12346, family: 'IPv4', address: '127.0.0.1' }` +`{ port: 12346, family: 4, address: '127.0.0.1' }` ### `socket.bufferSize` diff --git a/doc/api/os.md b/doc/api/os.md index 30a3faf6eb5947..981947767cbb48 100644 --- a/doc/api/os.md +++ b/doc/api/os.md @@ -224,6 +224,10 @@ always `[0, 0, 0]`. * Returns: {Object} @@ -238,12 +242,12 @@ The properties available on the assigned network address object include: * `address` {string} The assigned IPv4 or IPv6 address * `netmask` {string} The IPv4 or IPv6 network mask -* `family` {string} Either `IPv4` or `IPv6` +* `family` {number} Either `4` (for IPv4) or `6` (for IPv6) * `mac` {string} The MAC address of the network interface * `internal` {boolean} `true` if the network interface is a loopback or similar interface that is not remotely accessible; otherwise `false` * `scopeid` {number} The numeric IPv6 scope ID (only specified when `family` - is `IPv6`) + is `6`) * `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`. @@ -256,7 +260,7 @@ The properties available on the assigned network address object include: { address: '127.0.0.1', netmask: '255.0.0.0', - family: 'IPv4', + family: 4, mac: '00:00:00:00:00:00', internal: true, cidr: '127.0.0.1/8' @@ -264,7 +268,7 @@ The properties available on the assigned network address object include: { address: '::1', netmask: 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff', - family: 'IPv6', + family: 6, mac: '00:00:00:00:00:00', scopeid: 0, internal: true, @@ -275,7 +279,7 @@ The properties available on the assigned network address object include: { address: '192.168.1.108', netmask: '255.255.255.0', - family: 'IPv4', + family: 4, mac: '01:02:03:0a:0b:0c', internal: false, cidr: '192.168.1.108/24' @@ -283,7 +287,7 @@ The properties available on the assigned network address object include: { address: 'fe80::a00:27ff:fe4e:66a1', netmask: 'ffff:ffff:ffff:ffff::', - family: 'IPv6', + family: 6, mac: '01:02:03:0a:0b:0c', scopeid: 1, internal: false, diff --git a/doc/api/tls.md b/doc/api/tls.md index df77ff80892475..24e0fb86f912a6 100644 --- a/doc/api/tls.md +++ b/doc/api/tls.md @@ -955,13 +955,17 @@ tlsSocket.once('session', (session) => { * Returns: {Object} Returns the bound `address`, the address `family` name, and `port` of the underlying socket as reported by the operating system: -`{ port: 12346, family: 'IPv4', address: '127.0.0.1' }`. +`{ port: 12346, family: 4, address: '127.0.0.1' }`. ### `tlsSocket.authorizationError`