@@ -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: |
| 461 | + |
| 462 | +<!-- eslint-disable --> |
| 463 | +```js |
| 464 | +[ { type: 'A', address: '127.0.0.1', ttl: 299 }, |
| 465 | + { type: 'CNAME', value: 'example.com' }, |
| 466 | + { type: 'MX', exchange: 'alt4.aspmx.l.example.com', priority: 50 }, |
| 467 | + { type: 'NS', value: 'ns1.example.com', type: 'NS' }, |
| 468 | + { type: 'TXT', entries: [ 'v=spf1 include:_spf.example.com ~all' ] }, |
| 469 | + { type: 'SOA', |
| 470 | + nsname: 'ns1.example.com', |
| 471 | + hostmaster: 'admin.example.com', |
| 472 | + serial: 156696742, |
| 473 | + refresh: 900, |
| 474 | + retry: 900, |
| 475 | + expire: 1800, |
| 476 | + minttl: 60 } ] |
| 477 | +``` |
| 478 | + |
433 | 479 | ## dns.reverse(ip, callback) |
434 | 480 | <!-- YAML |
435 | 481 | added: v0.1.16 |
@@ -554,6 +600,7 @@ uses. For instance, _they do not use the configuration from `/etc/hosts`_. |
554 | 600 | [`dns.resolveSoa()`]: #dns_dns_resolvesoa_hostname_callback |
555 | 601 | [`dns.resolveSrv()`]: #dns_dns_resolvesrv_hostname_callback |
556 | 602 | [`dns.resolveTxt()`]: #dns_dns_resolvetxt_hostname_callback |
| 603 | +[`dns.resolveAny()`]: #dns_dns_resolveany_hostname_callback |
557 | 604 | [DNS error codes]: #dns_error_codes |
558 | 605 | [Implementation considerations section]: #dns_implementation_considerations |
559 | 606 | [supported `getaddrinfo` flags]: #dns_supported_getaddrinfo_flags |
|