@@ -169,31 +169,32 @@ dns.lookupService('127.0.0.1', 22, (err, hostname, service) => {
169
169
added: v0.1.27
170
170
-->
171
171
172
- Uses the DNS protocol to resolve a hostname (e.g. ` 'nodejs.org' ` ) into an
173
- array of the record types specified by ` rrtype ` .
174
-
175
- Valid values for ` rrtype ` are:
176
-
177
- * ` 'A' ` - IPV4 addresses, default
178
- * ` 'AAAA' ` - IPV6 addresses
179
- * ` 'MX' ` - mail exchange records
180
- * ` 'TXT' ` - text records
181
- * ` 'SRV' ` - SRV records
182
- * ` 'PTR' ` - PTR records
183
- * ` 'NS' ` - name server records
184
- * ` 'CNAME' ` - canonical name records
185
- * ` 'SOA' ` - start of authority record
186
- * ` 'NAPTR' ` - name authority pointer record
187
-
188
- The ` callback ` function has arguments ` (err, addresses) ` . When successful,
189
- ` addresses ` will be an array, except when resolving an SOA record which returns
190
- an object structured in the same manner as one returned by the
191
- [ ` dns.resolveSoa() ` ] [ ] method. The type of each item in ` addresses ` is
192
- determined by the record type, and described in the documentation for the
193
- corresponding lookup methods.
194
-
195
- On error, ` err ` is an [ ` Error ` ] [ ] object, where ` err.code ` is
196
- one of the error codes listed [ here] ( #dns_error_codes ) .
172
+ - ` hostname ` {string} Hostname to resolve.
173
+ - ` rrtype ` {string} Resource record type. Default: ` 'A' ` .
174
+ - ` callback ` {Function}
175
+ - ` err ` {Error}
176
+ - ` records ` {string[ ] | Object[ ] | string[ ] [ ] | Object}
177
+
178
+ Uses the DNS protocol to resolve a hostname (e.g. ` 'nodejs.org' ` ) into an array
179
+ of the resource records. The ` callback ` function has arguments
180
+ ` (err, records) ` . When successful, ` records ` will be an array of resource
181
+ records. The type and structure of individual results varies based on ` rrtype ` :
182
+
183
+ | ` rrtype ` | ` records ` contains | Result type | Shorthand method |
184
+ | -----------| --------------------------------| -------------| --------------------------|
185
+ | ` 'A' ` | IPv4 addresses (default) | {string} | [ ` dns.resolve4() ` ] [ ] |
186
+ | ` 'AAAA' ` | IPv6 addresses | {string} | [ ` dns.resolve6() ` ] [ ] |
187
+ | ` 'CNAME' ` | canonical name records | {string} | [ ` dns.resolveCname() ` ] [ ] |
188
+ | ` 'MX' ` | mail exchange records | {Object} | [ ` dns.resolveMx() ` ] [ ] |
189
+ | ` 'NAPTR' ` | name authority pointer records | {Object} | [ ` dns.resolveNaptr() ` ] [ ] |
190
+ | ` 'NS' ` | name server records | {string} | [ ` dns.resolveNs() ` ] [ ] |
191
+ | ` 'PTR' ` | pointer records | {string} | [ ` dns.resolvePtr() ` ] [ ] |
192
+ | ` 'SOA' ` | start of authority records | {Object} | [ ` dns.resolveSoa() ` ] [ ] |
193
+ | ` 'SRV' ` | service records | {Object} | [ ` dns.resolveSrv() ` ] [ ] |
194
+ | ` 'TXT' ` | text records | {string} | [ ` dns.resolveTxt() ` ] [ ] |
195
+
196
+ On error, ` err ` is an [ ` Error ` ] [ ] object, where ` err.code ` is one of the
197
+ [ DNS error codes] ( #dns_error_codes ) .
197
198
198
199
## dns.resolve4(hostname[ , options] , callback)
199
200
<!-- YAML
@@ -463,7 +464,16 @@ uses. For instance, _they do not use the configuration from `/etc/hosts`_.
463
464
464
465
[ DNS error codes ] : #dns_error_codes
465
466
[ `dns.lookup()` ] : #dns_dns_lookup_hostname_options_callback
467
+ [ `dns.resolve4()` ] : #dns_dns_resolve4_hostname_options_callback
468
+ [ `dns.resolve6()` ] : #dns_dns_resolve6_hostname_options_callback
469
+ [ `dns.resolveCname()` ] : #dns_dns_resolvecname_hostname_callback
470
+ [ `dns.resolveMx()` ] : #dns_dns_resolvemx_hostname_callback
471
+ [ `dns.resolveNaptr()` ] : #dns_dns_resolvenaptr_hostname_callback
472
+ [ `dns.resolveNs()` ] : #dns_dns_resolvens_hostname_callback
473
+ [ `dns.resolvePtr()` ] : #dns_dns_resolveptr_hostname_callback
466
474
[ `dns.resolveSoa()` ] : #dns_dns_resolvesoa_hostname_callback
475
+ [ `dns.resolveSrv()` ] : #dns_dns_resolvesrv_hostname_callback
476
+ [ `dns.resolveTxt()` ] : #dns_dns_resolvetxt_hostname_callback
467
477
[ `Error` ] : errors.html#errors_class_error
468
478
[ Implementation considerations section ] : #dns_implementation_considerations
469
479
[ supported `getaddrinfo` flags ] : #dns_supported_getaddrinfo_flags
0 commit comments