Skip to content

Commit

Permalink
doc: fix outdated documentation for family property
Browse files Browse the repository at this point in the history
Refs: #41431
Fixes: #42787

PR-URL: #42789
Reviewed-By: Beth Griggs <[email protected]>
Reviewed-By: Mestery <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Paolo Insogna <[email protected]>
  • Loading branch information
aduh95 authored and targos committed Apr 28, 2022
1 parent 6fa080c commit d9f3f05
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 11 deletions.
6 changes: 5 additions & 1 deletion doc/api/dgram.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@ exist and calls such as `socket.address()` and `socket.setTTL()` will fail.

<!-- YAML
added: v0.1.99
changes:
- version: v18.0.0
pr-url: https://github.com/nodejs/node/pull/41431
description: The `family` property now returns a number instead of a string.
-->

The `'message'` event is emitted when a new datagram is available on a socket.
Expand All @@ -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.

Expand Down
14 changes: 11 additions & 3 deletions doc/api/net.md
Original file line number Diff line number Diff line change
Expand Up @@ -285,14 +285,18 @@ Emitted when the server has been bound after calling [`server.listen()`][].

<!-- YAML
added: v0.1.90
changes:
- version: v18.0.0
pr-url: https://github.com/nodejs/node/pull/41431
description: The `family` property now returns a number instead of a string.
-->

* Returns: {Object|string|null}

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.
Expand Down Expand Up @@ -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'`
Expand Down Expand Up @@ -738,13 +742,17 @@ See also: [`socket.setTimeout()`][].

<!-- YAML
added: v0.1.90
changes:
- version: v18.0.0
pr-url: https://github.com/nodejs/node/pull/41431
description: The `family` property now returns a number instead of a string.
-->

* 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`

Expand Down
16 changes: 10 additions & 6 deletions doc/api/os.md
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,10 @@ always `[0, 0, 0]`.

<!-- YAML
added: v0.6.0
changes:
- version: v18.0.0
pr-url: https://github.com/nodejs/node/pull/41431
description: The `family` property now returns a number instead of a string.
-->

* Returns: {Object}
Expand All @@ -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`.
Expand All @@ -256,15 +260,15 @@ 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'
},
{
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,
Expand All @@ -275,15 +279,15 @@ 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'
},
{
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,
Expand Down
6 changes: 5 additions & 1 deletion doc/api/tls.md
Original file line number Diff line number Diff line change
Expand Up @@ -955,13 +955,17 @@ tlsSocket.once('session', (session) => {

<!-- YAML
added: v0.11.4
changes:
- version: v18.0.0
pr-url: https://github.com/nodejs/node/pull/41431
description: The `family` property now returns a number instead of a string.
-->

* 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`

Expand Down

0 comments on commit d9f3f05

Please sign in to comment.