@@ -184,8 +184,9 @@ changes:
184184 addresses in the order the DNS resolver returned them. When ` false ` ,
185185 IPv4 addresses are placed before IPv6 addresses.
186186 ** Default:** currently ` false ` (addresses are reordered) but this is
187- expected to change in the not too distant future.
188- New code should use ` { verbatim: true } ` .
187+ expected to change in the not too distant future. Default value is
188+ configurable using [ ` dns.setDefaultResultOrder() ` ] [ ] or
189+ [ ` --dns-result-order ` ] [ ] . New code should use ` { verbatim: true } ` .
189190* ` callback ` {Function}
190191 * ` err ` {Error}
191192 * ` address ` {string} A string representation of an IPv4 or IPv6 address.
@@ -627,6 +628,23 @@ array of host names.
627628On error, ` err ` is an [ ` Error ` ] [ ] object, where ` err.code ` is
628629one of the [ DNS error codes] [ ] .
629630
631+ ## ` dns.setDefaultResultOrder(order) `
632+ <!-- YAML
633+ added: REPLACEME
634+ -->
635+
636+ * ` order ` {string} must be ` 'ipv4first' ` or ` 'verbatim' ` .
637+
638+ Set the default value of ` verbatim ` in [ ` dns.lookup() ` ] [ ] and
639+ [ ` dnsPromises.lookup() ` ] [ ] . The value could be:
640+ * ` ipv4first ` : sets default ` verbatim ` ` false ` .
641+ * ` verbatim ` : sets default ` verbatim ` ` true ` .
642+
643+ The default is ` ipv4first ` and [ ` dns.setDefaultResultOrder() ` ] [ ] have higher
644+ priority than [ ` --dns-result-order ` ] [ ] . When using [ worker threads] [ ] ,
645+ [ ` dns.setDefaultResultOrder() ` ] [ ] from the main thread won't affect the default
646+ dns orders in workers.
647+
630648## ` dns.setServers(servers) `
631649<!-- YAML
632650added: v0.11.3
@@ -772,8 +790,9 @@ added: v10.6.0
772790 IPv6 addresses in the order the DNS resolver returned them. When ` false ` ,
773791 IPv4 addresses are placed before IPv6 addresses.
774792 ** Default:** currently ` false ` (addresses are reordered) but this is
775- expected to change in the not too distant future.
776- New code should use ` { verbatim: true } ` .
793+ expected to change in the not too distant future. Default value is
794+ configurable using [ ` dns.setDefaultResultOrder() ` ] [ ] or
795+ [ ` --dns-result-order ` ] [ ] . New code should use ` { verbatim: true } ` .
777796
778797Resolves a host name (e.g. ` 'nodejs.org' ` ) into the first found A (IPv4) or
779798AAAA (IPv6) record. All ` option ` properties are optional. If ` options ` is an
@@ -1127,6 +1146,23 @@ array of host names.
11271146On error, the ` Promise ` is rejected with an [ ` Error ` ] [ ] object, where ` err.code `
11281147is one of the [ DNS error codes] ( #dns_error_codes ) .
11291148
1149+ ### ` dnsPromises.setDefaultResultOrder(order) `
1150+ <!-- YAML
1151+ added: REPLACEME
1152+ -->
1153+
1154+ * ` order ` {string} must be ` 'ipv4first' ` or ` 'verbatim' ` .
1155+
1156+ Set the default value of ` verbatim ` in [ ` dns.lookup() ` ] [ ] and
1157+ [ ` dnsPromises.lookup() ` ] [ ] . The value could be:
1158+ * ` ipv4first ` : sets default ` verbatim ` ` false ` .
1159+ * ` verbatim ` : sets default ` verbatim ` ` true ` .
1160+
1161+ The default is ` ipv4first ` and [ ` dnsPromises.setDefaultResultOrder() ` ] [ ] have
1162+ higher priority than [ ` --dns-result-order ` ] [ ] . When using [ worker threads] [ ] ,
1163+ [ ` dnsPromises.setDefaultResultOrder() ` ] [ ] from the main thread won't affect the
1164+ default dns orders in workers.
1165+
11301166### ` dnsPromises.setServers(servers) `
11311167<!-- YAML
11321168added: v10.6.0
@@ -1236,6 +1272,7 @@ uses. For instance, _they do not use the configuration from `/etc/hosts`_.
12361272[ Implementation considerations section ] : #dns_implementation_considerations
12371273[ RFC 5952 ] : https://tools.ietf.org/html/rfc5952#section-6
12381274[ RFC 8482 ] : https://tools.ietf.org/html/rfc8482
1275+ [ `--dns-result-order` ] : cli.md#cli_dns_result_order_order
12391276[ `Error` ] : errors.md#errors_class_error
12401277[ `UV_THREADPOOL_SIZE` ] : cli.md#cli_uv_threadpool_size_size
12411278[ `dgram.createSocket()` ] : dgram.md#dgram_dgram_createsocket_options_callback
@@ -1255,6 +1292,7 @@ uses. For instance, _they do not use the configuration from `/etc/hosts`_.
12551292[ `dns.resolveSrv()` ] : #dns_dns_resolvesrv_hostname_callback
12561293[ `dns.resolveTxt()` ] : #dns_dns_resolvetxt_hostname_callback
12571294[ `dns.reverse()` ] : #dns_dns_reverse_ip_callback
1295+ [ `dns.setDefaultResultOrder()` ] : #dns_dns_setdefaultresultorder_order
12581296[ `dns.setServers()` ] : #dns_dns_setservers_servers
12591297[ `dnsPromises.getServers()` ] : #dns_dnspromises_getservers
12601298[ `dnsPromises.lookup()` ] : #dns_dnspromises_lookup_hostname_options
@@ -1272,7 +1310,9 @@ uses. For instance, _they do not use the configuration from `/etc/hosts`_.
12721310[ `dnsPromises.resolveSrv()` ] : #dns_dnspromises_resolvesrv_hostname
12731311[ `dnsPromises.resolveTxt()` ] : #dns_dnspromises_resolvetxt_hostname
12741312[ `dnsPromises.reverse()` ] : #dns_dnspromises_reverse_ip
1313+ [ `dnsPromises.setDefaultResultOrder()` ] : #dns_dnspromises_setdefaultresultorder_order
12751314[ `dnsPromises.setServers()` ] : #dns_dnspromises_setservers_servers
12761315[ `socket.connect()` ] : net.md#net_socket_connect_options_connectlistener
12771316[ `util.promisify()` ] : util.md#util_util_promisify_original
12781317[ supported `getaddrinfo` flags ] : #dns_supported_getaddrinfo_flags
1318+ [ worker threads ] : worker_threads.md
0 commit comments