@@ -179,6 +179,9 @@ section if a custom port is used.
179
179
<!-- YAML
180
180
added: v0.1.90
181
181
changes:
182
+ - version: REPLACEME
183
+ pr-url: https://github.com/nodejs/node/pull/52492
184
+ description: The `verbatim` option is now deprecated in favor of the new `order` option.
182
185
- version: v18.4.0
183
186
pr-url: https://github.com/nodejs/node/pull/43054
184
187
description: For compatibility with `node:net`, when passing an option
@@ -211,9 +214,18 @@ changes:
211
214
flags may be passed by bitwise ` OR ` ing their values.
212
215
* ` all ` {boolean} When ` true ` , the callback returns all resolved addresses in
213
216
an array. Otherwise, returns a single address. ** Default:** ` false ` .
217
+ * ` order ` {string} When ` verbatim ` , the resolved addresses are return
218
+ unsorted. When ` ipv4first ` , the resolved addresses are sorted by placing
219
+ IPv4 addresses before IPv6 addresses. When ` ipv6first ` , the resolved
220
+ addresses are sorted by placing IPv6 addresses before IPv4 addresses.
221
+ ** Default:** ` verbatim ` (addresses are not reordered).
222
+ Default value is configurable using [ ` dns.setDefaultResultOrder() ` ] [ ] or
223
+ [ ` --dns-result-order ` ] [ ] .
214
224
* ` verbatim ` {boolean} When ` true ` , the callback receives IPv4 and IPv6
215
225
addresses in the order the DNS resolver returned them. When ` false ` ,
216
226
IPv4 addresses are placed before IPv6 addresses.
227
+ This option will be deprecated in favor of ` order ` . When both are specified,
228
+ ` order ` has higher precedence. New code should only use ` order ` .
217
229
** Default:** ` true ` (addresses are not reordered). Default value is
218
230
configurable using [ ` dns.setDefaultResultOrder() ` ] [ ] or
219
231
[ ` --dns-result-order ` ] [ ] .
@@ -775,18 +787,22 @@ added:
775
787
- v16.4.0
776
788
- v14.18.0
777
789
changes:
790
+ - version: REPLACEME
791
+ pr-url: https://github.com/nodejs/node/pull/52492
792
+ description: The `ipv6first` value is supported now.
778
793
- version: v17.0.0
779
794
pr-url: https://github.com/nodejs/node/pull/39987
780
795
description: Changed default value to `verbatim`.
781
796
-->
782
797
783
- * ` order ` {string} must be ` 'ipv4first' ` or ` 'verbatim' ` .
798
+ * ` order ` {string} must be ` 'ipv4first' ` , ` 'ipv6first' ` or ` 'verbatim' ` .
784
799
785
- Set the default value of ` verbatim ` in [ ` dns.lookup() ` ] [ ] and
800
+ Set the default value of ` order ` in [ ` dns.lookup() ` ] [ ] and
786
801
[ ` dnsPromises.lookup() ` ] [ ] . The value could be:
787
802
788
- * ` ipv4first ` : sets default ` verbatim ` ` false ` .
789
- * ` verbatim ` : sets default ` verbatim ` ` true ` .
803
+ * ` ipv4first ` : sets default ` order ` to ` ipv4first ` .
804
+ * ` ipv6first ` : sets default ` order ` to ` ipv6first ` .
805
+ * ` verbatim ` : sets default ` order ` to ` verbatim ` .
790
806
791
807
The default is ` verbatim ` and [ ` dns.setDefaultResultOrder() ` ] [ ] have higher
792
808
priority than [ ` --dns-result-order ` ] [ ] . When using [ worker threads] [ ] ,
@@ -796,14 +812,21 @@ dns orders in workers.
796
812
## ` dns.getDefaultResultOrder() `
797
813
798
814
<!-- YAML
799
- added: v20.1.0
815
+ added:
816
+ - v20.1.0
817
+ - v18.17.0
818
+ changes:
819
+ - version: REPLACEME
820
+ pr-url: https://github.com/nodejs/node/pull/52492
821
+ description: The `ipv6first` value is supported now.
800
822
-->
801
823
802
- Get the default value for ` verbatim ` in [ ` dns.lookup() ` ] [ ] and
824
+ Get the default value for ` order ` in [ ` dns.lookup() ` ] [ ] and
803
825
[ ` dnsPromises.lookup() ` ] [ ] . The value could be:
804
826
805
- * ` ipv4first ` : for ` verbatim ` defaulting to ` false ` .
806
- * ` verbatim ` : for ` verbatim ` defaulting to ` true ` .
827
+ * ` ipv4first ` : for ` order ` defaulting to ` ipv4first ` .
828
+ * ` ipv6first ` : for ` order ` defaulting to ` ipv6first ` .
829
+ * ` verbatim ` : for ` order ` defaulting to ` verbatim ` .
807
830
808
831
## ` dns.setServers(servers) `
809
832
@@ -947,6 +970,10 @@ section if a custom port is used.
947
970
948
971
<!-- YAML
949
972
added: v10.6.0
973
+ changes:
974
+ - version: REPLACEME
975
+ pr-url: https://github.com/nodejs/node/pull/52492
976
+ description: The `verbatim` option is now deprecated in favor of the new `order` option.
950
977
-->
951
978
952
979
* ` hostname ` {string}
@@ -959,13 +986,22 @@ added: v10.6.0
959
986
flags may be passed by bitwise ` OR ` ing their values.
960
987
* ` all ` {boolean} When ` true ` , the ` Promise ` is resolved with all addresses in
961
988
an array. Otherwise, returns a single address. ** Default:** ` false ` .
989
+ * ` order ` {string} When ` verbatim ` , the ` Promise ` is resolved with IPv4 and
990
+ IPv6 addresses in the order the DNS resolver returned them. When ` ipv4first ` ,
991
+ IPv4 addresses are placed before IPv6 addresses. When ` ipv6first ` ,
992
+ IPv6 addresses are placed before IPv4 addresses.
993
+ ** Default:** ` verbatim ` (addresses are not reordered).
994
+ Default value is configurable using [ ` dns.setDefaultResultOrder() ` ] [ ] or
995
+ [ ` --dns-result-order ` ] [ ] . New code should use ` { order: 'verbatim' } ` .
962
996
* ` verbatim ` {boolean} When ` true ` , the ` Promise ` is resolved with IPv4 and
963
997
IPv6 addresses in the order the DNS resolver returned them. When ` false ` ,
964
998
IPv4 addresses are placed before IPv6 addresses.
999
+ This option will be deprecated in favor of ` order ` . When both are specified,
1000
+ ` order ` has higher precedence. New code should only use ` order ` .
965
1001
** Default:** currently ` false ` (addresses are reordered) but this is
966
1002
expected to change in the not too distant future. Default value is
967
1003
configurable using [ ` dns.setDefaultResultOrder() ` ] [ ] or
968
- [ ` --dns-result-order ` ] [ ] . New code should use ` { verbatim: true } ` .
1004
+ [ ` --dns-result-order ` ] [ ] .
969
1005
970
1006
Resolves a host name (e.g. ` 'nodejs.org' ` ) into the first found A (IPv4) or
971
1007
AAAA (IPv6) record. All ` option ` properties are optional. If ` options ` is an
@@ -1347,18 +1383,22 @@ added:
1347
1383
- v16.4.0
1348
1384
- v14.18.0
1349
1385
changes:
1386
+ - version: REPLACEME
1387
+ pr-url: https://github.com/nodejs/node/pull/52492
1388
+ description: The `ipv6first` value is supported now.
1350
1389
- version: v17.0.0
1351
1390
pr-url: https://github.com/nodejs/node/pull/39987
1352
1391
description: Changed default value to `verbatim`.
1353
1392
-->
1354
1393
1355
- * ` order ` {string} must be ` 'ipv4first' ` or ` 'verbatim' ` .
1394
+ * ` order ` {string} must be ` 'ipv4first' ` , ` 'ipv6first' ` or ` 'verbatim' ` .
1356
1395
1357
- Set the default value of ` verbatim ` in [ ` dns.lookup() ` ] [ ] and
1396
+ Set the default value of ` order ` in [ ` dns.lookup() ` ] [ ] and
1358
1397
[ ` dnsPromises.lookup() ` ] [ ] . The value could be:
1359
1398
1360
- * ` ipv4first ` : sets default ` verbatim ` ` false ` .
1361
- * ` verbatim ` : sets default ` verbatim ` ` true ` .
1399
+ * ` ipv4first ` : sets default ` order ` to ` ipv4first ` .
1400
+ * ` ipv6first ` : sets default ` order ` to ` ipv6first ` .
1401
+ * ` verbatim ` : sets default ` order ` to ` verbatim ` .
1362
1402
1363
1403
The default is ` verbatim ` and [ ` dnsPromises.setDefaultResultOrder() ` ] [ ] have
1364
1404
higher priority than [ ` --dns-result-order ` ] [ ] . When using [ worker threads] [ ] ,
0 commit comments