@@ -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.
@@ -629,6 +630,23 @@ array of host names.
629630On error, ` err ` is an [ ` Error ` ] [ ] object, where ` err.code ` is
630631one of the [ DNS error codes] [ ] .
631632
633+ ## ` dns.setDefaultResultOrder(order) `
634+ <!-- YAML
635+ added: REPLACEME
636+ -->
637+
638+ * ` order ` {string} must be ` 'ipv4first' ` or ` 'verbatim' ` .
639+
640+ Set the default value of ` verbatim ` in [ ` dns.lookup() ` ] [ ] and
641+ [ ` dnsPromises.lookup() ` ] [ ] . The value could be:
642+ * ` ipv4first ` : sets default ` verbatim ` ` false ` .
643+ * ` verbatim ` : sets default ` verbatim ` ` true ` .
644+
645+ The default is ` ipv4first ` and [ ` dns.setDefaultResultOrder() ` ] [ ] have higher
646+ priority than [ ` --dns-result-order ` ] [ ] . When using [ worker threads] [ ] ,
647+ [ ` dns.setDefaultResultOrder() ` ] [ ] from the main thread won't affect the default
648+ dns orders in workers.
649+
632650## ` dns.setServers(servers) `
633651<!-- YAML
634652added: v0.11.3
@@ -777,8 +795,9 @@ added: v10.6.0
777795 IPv6 addresses in the order the DNS resolver returned them. When ` false ` ,
778796 IPv4 addresses are placed before IPv6 addresses.
779797 ** Default:** currently ` false ` (addresses are reordered) but this is
780- expected to change in the not too distant future.
781- New code should use ` { verbatim: true } ` .
798+ expected to change in the not too distant future. Default value is
799+ configurable using [ ` dns.setDefaultResultOrder() ` ] [ ] or
800+ [ ` --dns-result-order ` ] [ ] . New code should use ` { verbatim: true } ` .
782801
783802Resolves a host name (e.g. ` 'nodejs.org' ` ) into the first found A (IPv4) or
784803AAAA (IPv6) record. All ` option ` properties are optional. If ` options ` is an
@@ -1132,6 +1151,23 @@ array of host names.
11321151On error, the ` Promise ` is rejected with an [ ` Error ` ] [ ] object, where ` err.code `
11331152is one of the [ DNS error codes] ( #dns_error_codes ) .
11341153
1154+ ### ` dnsPromises.setDefaultResultOrder(order) `
1155+ <!-- YAML
1156+ added: REPLACEME
1157+ -->
1158+
1159+ * ` order ` {string} must be ` 'ipv4first' ` or ` 'verbatim' ` .
1160+
1161+ Set the default value of ` verbatim ` in [ ` dns.lookup() ` ] [ ] and
1162+ [ ` dnsPromises.lookup() ` ] [ ] . The value could be:
1163+ * ` ipv4first ` : sets default ` verbatim ` ` false ` .
1164+ * ` verbatim ` : sets default ` verbatim ` ` true ` .
1165+
1166+ The default is ` ipv4first ` and [ ` dnsPromises.setDefaultResultOrder() ` ] [ ] have
1167+ higher priority than [ ` --dns-result-order ` ] [ ] . When using [ worker threads] [ ] ,
1168+ [ ` dnsPromises.setDefaultResultOrder() ` ] [ ] from the main thread won't affect the
1169+ default dns orders in workers.
1170+
11351171### ` dnsPromises.setServers(servers) `
11361172<!-- YAML
11371173added: v10.6.0
@@ -1241,6 +1277,7 @@ uses. For instance, _they do not use the configuration from `/etc/hosts`_.
12411277[ Implementation considerations section ] : #dns_implementation_considerations
12421278[ RFC 5952 ] : https://tools.ietf.org/html/rfc5952#section-6
12431279[ RFC 8482 ] : https://tools.ietf.org/html/rfc8482
1280+ [ `--dns-result-order` ] : cli.md#cli_dns_result_order_order
12441281[ `Error` ] : errors.md#errors_class_error
12451282[ `UV_THREADPOOL_SIZE` ] : cli.md#cli_uv_threadpool_size_size
12461283[ `dgram.createSocket()` ] : dgram.md#dgram_dgram_createsocket_options_callback
@@ -1260,6 +1297,7 @@ uses. For instance, _they do not use the configuration from `/etc/hosts`_.
12601297[ `dns.resolveSrv()` ] : #dns_dns_resolvesrv_hostname_callback
12611298[ `dns.resolveTxt()` ] : #dns_dns_resolvetxt_hostname_callback
12621299[ `dns.reverse()` ] : #dns_dns_reverse_ip_callback
1300+ [ `dns.setDefaultResultOrder()` ] : #dns_dns_setdefaultresultorder_order
12631301[ `dns.setServers()` ] : #dns_dns_setservers_servers
12641302[ `dnsPromises.getServers()` ] : #dns_dnspromises_getservers
12651303[ `dnsPromises.lookup()` ] : #dns_dnspromises_lookup_hostname_options
@@ -1277,7 +1315,9 @@ uses. For instance, _they do not use the configuration from `/etc/hosts`_.
12771315[ `dnsPromises.resolveSrv()` ] : #dns_dnspromises_resolvesrv_hostname
12781316[ `dnsPromises.resolveTxt()` ] : #dns_dnspromises_resolvetxt_hostname
12791317[ `dnsPromises.reverse()` ] : #dns_dnspromises_reverse_ip
1318+ [ `dnsPromises.setDefaultResultOrder()` ] : #dns_dnspromises_setdefaultresultorder_order
12801319[ `dnsPromises.setServers()` ] : #dns_dnspromises_setservers_servers
12811320[ `socket.connect()` ] : net.md#net_socket_connect_options_connectlistener
12821321[ `util.promisify()` ] : util.md#util_util_promisify_original
12831322[ supported `getaddrinfo` flags ] : #dns_supported_getaddrinfo_flags
1323+ [ worker threads ] : worker_threads.md
0 commit comments