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