You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`dns.resolveAny` and `dns.resolve` with `"ANY"` has the similar behavior
like `$ dig <domain> any` and returns an array with several types of
records.
`dns.resolveAny` parses the result packet by several rules in turn.
Supported types:
* A
* AAAA
* CNAME
* MX
* NAPTR
* NS
* PTR
* SOA
* SRV
* TXT
Fixes: #2848
PR-URL: #13137
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Roman Reiss <[email protected]>
Copy file name to clipboardexpand all lines: doc/api/dns.md
+47
Original file line number
Diff line number
Diff line change
@@ -210,6 +210,7 @@ records. The type and structure of individual results varies based on `rrtype`:
210
210
|`'SOA'`| start of authority records | {Object} |[`dns.resolveSoa()`][]|
211
211
|`'SRV'`| service records | {Object} |[`dns.resolveSrv()`][]|
212
212
|`'TXT'`| text records | {string} |[`dns.resolveTxt()`][]|
213
+
|`'ANY'`| any records | {Object} |[`dns.resolveAny()`][]|
213
214
214
215
On error, `err` is an [`Error`][] object, where `err.code` is one of the
215
216
[DNS error codes](#dns_error_codes).
@@ -430,6 +431,51 @@ is a two-dimensional array of the text records available for `hostname` (e.g.,
430
431
one record. Depending on the use case, these could be either joined together or
431
432
treated separately.
432
433
434
+
## dns.resolveAny(hostname, callback)
435
+
436
+
-`hostname` {string}
437
+
-`callback` {Function}
438
+
-`err` {Error}
439
+
-`ret` {Object[][]}
440
+
441
+
Uses the DNS protocol to resolve all records (also known as `ANY` or `*` query).
442
+
The `ret` argument passed to the `callback` function will be an array containing
443
+
various types of records. Each object has a property `type` that indicates the
444
+
type of the current record. And depending on the `type`, additional properties
445
+
will be present on the object:
446
+
447
+
| Type | Properties |
448
+
|------|------------|
449
+
|`"A"`|`address` / `ttl`|
450
+
|`"AAAA"`|`address` / `ttl`|
451
+
|`"CNAME"`|`value`|
452
+
|`"MX"`| Refer to [`dns.resolveMx()`][]|
453
+
|`"NAPTR"`| Refer to [`dns.resolveNaptr()`][]|
454
+
|`"NS"`|`value`|
455
+
|`"PTR"`|`value`|
456
+
|`"SOA"`| Refer to [`dns.resolveSoa()`][]|
457
+
|`"SRV"`| Refer to [`dns.resolveSrv()`][]|
458
+
|`"TXT"`| This type of record contains an array property called `entries` which refers to [`dns.resolveTxt()`][], eg. `{ entries: ['...'], type: 'TXT' }`|
459
+
460
+
Here is a example of the `ret` object passed to the callback:
0 commit comments