From d9f3f05cabecfeff7c267b9193f21b71013679b0 Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Fri, 22 Apr 2022 00:31:09 +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 PR-URL: https://github.com/nodejs/node/pull/42789 Reviewed-By: Beth Griggs Reviewed-By: Mestery Reviewed-By: Luigi Pinca Reviewed-By: Paolo Insogna --- 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 f9e9b6b87453dc..185c5f60e9a07d 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 9bf34d55086992..39d7cbdac53a19 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 d0bef604d96053..ad4d082d94dc0f 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 52e0e71f1e03ab..5c91de3fd935d2 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`