@@ -197,6 +197,7 @@ records. The type and structure of individual results varies based on `rrtype`:
197
197
| ` 'SOA' ` | start of authority records | {Object} | [ ` dns.resolveSoa() ` ] [ ] |
198
198
| ` 'SRV' ` | service records | {Object} | [ ` dns.resolveSrv() ` ] [ ] |
199
199
| ` 'TXT' ` | text records | {string} | [ ` dns.resolveTxt() ` ] [ ] |
200
+ | ` 'ANY' ` | any records | {Object} | [ ` dns.resolveAny() ` ] [ ] |
200
201
201
202
On error, ` err ` is an [ ` Error ` ] [ ] object, where ` err.code ` is one of the
202
203
[ DNS error codes] ( #dns_error_codes ) .
@@ -417,6 +418,51 @@ is a two-dimensional array of the text records available for `hostname` (e.g.,
417
418
one record. Depending on the use case, these could be either joined together or
418
419
treated separately.
419
420
421
+ ## dns.resolveAny(hostname, callback)
422
+
423
+ - ` hostname ` {string}
424
+ - ` callback ` {Function}
425
+ - ` err ` {Error}
426
+ - ` ret ` {Object[ ] [ ] }
427
+
428
+ Uses the DNS protocol to resolve any queries (` ANY ` records) for the ` hostname ` .
429
+ The ` ret ` argument passed to the ` callback ` function will be an array of objects
430
+ with uncertain type of records. Each object has a property ` type ` that indicates
431
+ the type of current record. And for each type of record, the object structure
432
+ will be like:
433
+
434
+ | Type | Properties |
435
+ | ------| ------------|
436
+ | ` "A" ` | ` address ` / ` ttl ` |
437
+ | ` "AAAA" ` | ` address ` / ` ttl ` |
438
+ | ` "CNAME" ` | ` value ` |
439
+ | ` "MX" ` | Refer to [ ` dns.resolveMx() ` ] [ ] |
440
+ | ` "NAPTR" ` | Refer to [ ` dns.resolveNaptr() ` ] [ ] |
441
+ | ` "NS" ` | ` value ` |
442
+ | ` "PTR" ` | ` value ` |
443
+ | ` "SOA" ` | Refer to [ ` dns.resolveSoa() ` ] [ ] |
444
+ | ` "SRV" ` | Refer to [ ` dns.resolveSrv() ` ] [ ] |
445
+ | ` "TXT" ` | This is an array-liked object with ` length ` and ` indexes ` , eg. ` {'0':'sth','length':1} ` |
446
+
447
+ Following is a example of the ` ret ` object passed to the callback:
448
+
449
+ <!-- eslint-disable -->
450
+ ``` js
451
+ [ { address: ' 127.0.0.1' , ttl: 299 , type: ' A' },
452
+ { value: ' example.com' , type: ' CNAME' }, // in fact, CNAME can't stay with A
453
+ { exchange: ' alt4.aspmx.l.example.com' , priority: 50 , type: ' MX' },
454
+ { value: ' ns1.example.com' , type: ' NS' },
455
+ { ' 0' : ' v=spf1 include:_spf.example.com ~all' , type: ' TXT' , length: 1 },
456
+ { nsname: ' ns1.example.com' ,
457
+ hostmaster: ' admin.example.com' ,
458
+ serial: 156696742 ,
459
+ refresh: 900 ,
460
+ retry: 900 ,
461
+ expire: 1800 ,
462
+ minttl: 60 ,
463
+ type: ' SOA' } ]
464
+ ```
465
+
420
466
## dns.reverse(ip, callback)
421
467
<!-- YAML
422
468
added: v0.1.16
@@ -531,6 +577,7 @@ uses. For instance, _they do not use the configuration from `/etc/hosts`_.
531
577
[ `dns.resolveSoa()` ] : #dns_dns_resolvesoa_hostname_callback
532
578
[ `dns.resolveSrv()` ] : #dns_dns_resolvesrv_hostname_callback
533
579
[ `dns.resolveTxt()` ] : #dns_dns_resolvetxt_hostname_callback
580
+ [ `dns.resolveAny()` ] : #dns_dns_resolveany_hostname_callback
534
581
[ DNS error codes ] : #dns_error_codes
535
582
[ Implementation considerations section ] : #dns_implementation_considerations
536
583
[ supported `getaddrinfo` flags ] : #dns_supported_getaddrinfo_flags
0 commit comments