diff --git a/doc/api/dns.md b/doc/api/dns.md index 4ac7925ca84535..921c097a9a98a8 100644 --- a/doc/api/dns.md +++ b/doc/api/dns.md @@ -82,7 +82,6 @@ resolver.resolve4('example.org', (err, addresses) => { The following methods from the `dns` module are available: * [`resolver.getServers()`][`dns.getServers()`] -* [`resolver.setServers()`][`dns.setServers()`] * [`resolver.resolve()`][`dns.resolve()`] * [`resolver.resolve4()`][`dns.resolve4()`] * [`resolver.resolve6()`][`dns.resolve6()`] @@ -96,6 +95,7 @@ The following methods from the `dns` module are available: * [`resolver.resolveSrv()`][`dns.resolveSrv()`] * [`resolver.resolveTxt()`][`dns.resolveTxt()`] * [`resolver.reverse()`][`dns.reverse()`] +* [`resolver.setServers()`][`dns.setServers()`] ### resolver.cancel() +```js +[ { type: 'A', address: '127.0.0.1', ttl: 299 }, + { type: 'CNAME', value: 'example.com' }, + { type: 'MX', exchange: 'alt4.aspmx.l.example.com', priority: 50 }, + { type: 'NS', value: 'ns1.example.com' }, + { type: 'TXT', entries: [ 'v=spf1 include:_spf.example.com ~all' ] }, + { type: 'SOA', + nsname: 'ns1.example.com', + hostmaster: 'admin.example.com', + serial: 156696742, + refresh: 900, + retry: 900, + expire: 1800, + minttl: 60 } ] +``` + ## dns.resolveCname(hostname, callback) -```js -[ { type: 'A', address: '127.0.0.1', ttl: 299 }, - { type: 'CNAME', value: 'example.com' }, - { type: 'MX', exchange: 'alt4.aspmx.l.example.com', priority: 50 }, - { type: 'NS', value: 'ns1.example.com' }, - { type: 'TXT', entries: [ 'v=spf1 include:_spf.example.com ~all' ] }, - { type: 'SOA', - nsname: 'ns1.example.com', - hostmaster: 'admin.example.com', - serial: 156696742, - refresh: 900, - retry: 900, - expire: 1800, - minttl: 60 } ] -``` - ## dns.reverse(ip, callback) +- `hostname` {string} + +Uses the DNS protocol to resolve all records (also known as `ANY` or `*` query). +On success, the `Promise` is resolved with an array containing various types of +records. Each object has a property `type` that indicates the type of the +current record. And depending on the `type`, additional properties will be +present on the object: + +| Type | Properties | +|------|------------| +| `'A'` | `address`/`ttl` | +| `'AAAA'` | `address`/`ttl` | +| `'CNAME'` | `value` | +| `'MX'` | Refer to [`dnsPromises.resolveMx()`][] | +| `'NAPTR'` | Refer to [`dnsPromises.resolveNaptr()`][] | +| `'NS'` | `value` | +| `'PTR'` | `value` | +| `'SOA'` | Refer to [`dnsPromises.resolveSoa()`][] | +| `'SRV'` | Refer to [`dnsPromises.resolveSrv()`][] | +| `'TXT'` | This type of record contains an array property called `entries` which refers to [`dnsPromises.resolveTxt()`][], e.g. `{ entries: ['...'], type: 'TXT' }` | + +Here is an example of the result object: + + +```js +[ { type: 'A', address: '127.0.0.1', ttl: 299 }, + { type: 'CNAME', value: 'example.com' }, + { type: 'MX', exchange: 'alt4.aspmx.l.example.com', priority: 50 }, + { type: 'NS', value: 'ns1.example.com' }, + { type: 'TXT', entries: [ 'v=spf1 include:_spf.example.com ~all' ] }, + { type: 'SOA', + nsname: 'ns1.example.com', + hostmaster: 'admin.example.com', + serial: 156696742, + refresh: 900, + retry: 900, + expire: 1800, + minttl: 60 } ] +``` + ### dnsPromises.resolveCname(hostname) -- `hostname` {string} - -Uses the DNS protocol to resolve all records (also known as `ANY` or `*` query). -On success, the `Promise` is resolved with an array containing various types of -records. Each object has a property `type` that indicates the type of the -current record. And depending on the `type`, additional properties will be -present on the object: - -| Type | Properties | -|------|------------| -| `'A'` | `address`/`ttl` | -| `'AAAA'` | `address`/`ttl` | -| `'CNAME'` | `value` | -| `'MX'` | Refer to [`dnsPromises.resolveMx()`][] | -| `'NAPTR'` | Refer to [`dnsPromises.resolveNaptr()`][] | -| `'NS'` | `value` | -| `'PTR'` | `value` | -| `'SOA'` | Refer to [`dnsPromises.resolveSoa()`][] | -| `'SRV'` | Refer to [`dnsPromises.resolveSrv()`][] | -| `'TXT'` | This type of record contains an array property called `entries` which refers to [`dnsPromises.resolveTxt()`][], e.g. `{ entries: ['...'], type: 'TXT' }` | - -Here is an example of the result object: - - -```js -[ { type: 'A', address: '127.0.0.1', ttl: 299 }, - { type: 'CNAME', value: 'example.com' }, - { type: 'MX', exchange: 'alt4.aspmx.l.example.com', priority: 50 }, - { type: 'NS', value: 'ns1.example.com' }, - { type: 'TXT', entries: [ 'v=spf1 include:_spf.example.com ~all' ] }, - { type: 'SOA', - nsname: 'ns1.example.com', - hostmaster: 'admin.example.com', - serial: 156696742, - refresh: 900, - retry: 900, - expire: 1800, - minttl: 60 } ] -``` - ### dnsPromises.reverse(ip)