@@ -854,6 +854,9 @@ behavior.
854854<!-- YAML
855855added: v0.1.90
856856changes:
857+ - version: REPLACEME
858+ pr-url: https://github.com/nodejs/node/pull/44731
859+ description: Added the `autoSelectFamily` option.
857860 - version: v17.7.0
858861 pr-url: https://github.com/nodejs/node/pull/41310
859862 description: The `noDelay`, `keepAlive`, and `keepAliveInitialDelay`
@@ -898,6 +901,20 @@ For TCP connections, available `options` are:
898901 ** Default:** ` false ` .
899902* ` keepAliveInitialDelay ` {number} If set to a positive number, it sets the initial delay before
900903 the first keepalive probe is sent on an idle socket.** Default:** ` 0 ` .
904+ * ` autoSelectFamily ` {boolean}: If set to ` true ` , it enables a family autodetection algorithm
905+ that loosely implements section 5 of [ RFC 8305] [ ] .
906+ The ` all ` option passed to lookup is set to ` true ` and the sockets attempts to connect to all
907+ obtained IPv6 and IPv4 addresses, in sequence, until a connection is established.
908+ The first returned AAAA address is tried first, then the first returned A address and so on.
909+ Each connection attempt is given the amount of time specified by the ` autoSelectFamilyAttemptTimeout `
910+ option before timing out and trying the next address.
911+ Ignored if the ` family ` option is not ` 0 ` or if ` localAddress ` is set.
912+ Connection errors are not emitted if at least one connection succeeds.
913+ ** Default:** ` false ` .
914+ * ` autoSelectFamilyAttemptTimeout ` {number}: The amount of time in milliseconds to wait
915+ for a connection attempt to finish before trying the next address when using the ` autoSelectFamily ` option.
916+ If set to a positive integer less than ` 10 ` , then the value ` 10 ` will be used instead.
917+ ** Default:** ` 250 ` .
901918
902919For [ IPC] [ ] connections, available ` options ` are:
903920
@@ -1622,6 +1639,7 @@ net.isIPv6('fhqwhgads'); // returns false
16221639
16231640[ IPC ] : #ipc-support
16241641[ Identifying paths for IPC connections ] : #identifying-paths-for-ipc-connections
1642+ [ RFC 8305 ] : https://www.rfc-editor.org/rfc/rfc8305.txt
16251643[ Readable Stream ] : stream.md#class-streamreadable
16261644[ `'close'` ] : #event-close
16271645[ `'connect'` ] : #event-connect
0 commit comments