@@ -8,9 +8,9 @@ This module contains functions that belong to two different categories:
88
991 ) Functions that use the underlying operating system facilities to perform
1010name resolution, and that do not necessarily do any network communication.
11- This category contains only one function: ` dns.lookup ` . __ Developers looking
11+ This category contains only one function: ` dns.lookup() ` . __ Developers looking
1212to perform name resolution in the same way that other applications on the same
13- operating system behave should use ` dns.lookup ` .__
13+ operating system behave should use [ ` dns.lookup() ` ] [ dns.lookup ] .__
1414
1515Here is an example that does a lookup of ` www.google.com ` .
1616
@@ -22,8 +22,8 @@ Here is an example that does a lookup of `www.google.com`.
2222
23232 ) Functions that connect to an actual DNS server to perform name resolution,
2424and that _ always_ use the network to perform DNS queries. This category
25- contains all functions in the ` dns ` module but ` dns.lookup ` . These functions
26- do not use the same set of configuration files than what ` dns.lookup ` uses.
25+ contains all functions in the ` dns ` module but [ ` dns.lookup() ` ] [ dns.lookup ] . These functions
26+ do not use the same set of configuration files than what [ ` dns.lookup() ` ] [ dns.lookup ] uses.
2727For instance, _ they do not use the configuration from ` /etc/hosts ` _ . These
2828functions should be used by developers who do not want to use the underlying
2929operating system's facilities for name resolution, and instead want to
@@ -98,7 +98,7 @@ Keep in mind that `err.code` will be set to `'ENOENT'` not only when
9898the hostname does not exist but also when the lookup fails in other ways
9999such as no available file descriptors.
100100
101- ` dns.lookup ` doesn't necessarily have anything to do with the DNS protocol.
101+ ` dns.lookup() ` doesn't necessarily have anything to do with the DNS protocol.
102102It's only an operating system facility that can associate name with addresses,
103103and vice versa.
104104
@@ -144,40 +144,40 @@ one of the error codes listed below.
144144
145145## dns.resolve4(hostname, callback)
146146
147- The same as ` dns.resolve() ` , but only for IPv4 queries (` A ` records).
147+ The same as [ ` dns.resolve() ` ] ( #dns_dns_resolve_hostname_rrtype_callback ) , but only for IPv4 queries (` A ` records).
148148` addresses ` is an array of IPv4 addresses (e.g.
149149` ['74.125.79.104', '74.125.79.105', '74.125.79.106'] ` ).
150150
151151## dns.resolve6(hostname, callback)
152152
153- The same as ` dns.resolve4() ` except for IPv6 queries (an ` AAAA ` query).
153+ The same as [ ` dns.resolve4() ` ] ( #dns_dns_resolve4_hostname_callback ) except for IPv6 queries (an ` AAAA ` query).
154154
155155
156156## dns.resolveMx(hostname, callback)
157157
158- The same as ` dns.resolve() ` , but only for mail exchange queries (` MX ` records).
158+ The same as [ ` dns.resolve() ` ] ( #dns_dns_resolve_hostname_rrtype_callback ) , but only for mail exchange queries (` MX ` records).
159159
160160` addresses ` is an array of MX records, each with a priority and an exchange
161161attribute (e.g. ` [{'priority': 10, 'exchange': 'mx.example.com'},...] ` ).
162162
163163## dns.resolveTxt(hostname, callback)
164164
165- The same as ` dns.resolve() ` , but only for text queries (` TXT ` records).
165+ The same as [ ` dns.resolve() ` ] ( #dns_dns_resolve_hostname_rrtype_callback ) , but only for text queries (` TXT ` records).
166166` addresses ` is a 2-d array of the text records available for ` hostname ` (e.g.,
167167` [ ['v=spf1 ip4:0.0.0.0 ', '~all' ] ] ` ). Each sub-array contains TXT chunks of
168168one record. Depending on the use case, the could be either joined together or
169169treated separately.
170170
171171## dns.resolveSrv(hostname, callback)
172172
173- The same as ` dns.resolve() ` , but only for service records (` SRV ` records).
173+ The same as [ ` dns.resolve() ` ] ( #dns_dns_resolve_hostname_rrtype_callback ) , but only for service records (` SRV ` records).
174174` addresses ` is an array of the SRV records available for ` hostname ` . Properties
175175of SRV records are priority, weight, port, and name (e.g.,
176176` [{'priority': 10, 'weight': 5, 'port': 21223, 'name': 'service.example.com'}, ...] ` ).
177177
178178## dns.resolveSoa(hostname, callback)
179179
180- The same as ` dns.resolve() ` , but only for start of authority record queries
180+ The same as [ ` dns.resolve() ` ] ( #dns_dns_resolve_hostname_rrtype_callback ) , but only for start of authority record queries
181181(` SOA ` record).
182182
183183` addresses ` is an object with the following structure:
@@ -196,13 +196,13 @@ The same as `dns.resolve()`, but only for start of authority record queries
196196
197197## dns.resolveNs(hostname, callback)
198198
199- The same as ` dns.resolve() ` , but only for name server records (` NS ` records).
199+ The same as [ ` dns.resolve() ` ] ( #dns_dns_resolve_hostname_rrtype_callback ) , but only for name server records (` NS ` records).
200200` addresses ` is an array of the name server records available for ` hostname `
201201(e.g., ` ['ns1.example.com', 'ns2.example.com'] ` ).
202202
203203## dns.resolveCname(hostname, callback)
204204
205- The same as ` dns.resolve() ` , but only for canonical name records (` CNAME `
205+ The same as [ ` dns.resolve() ` ] ( #dns_dns_resolve_hostname_rrtype_callback ) , but only for canonical name records (` CNAME `
206206records). ` addresses ` is an array of the canonical name records available for
207207` hostname ` (e.g., ` ['bar.example.com'] ` ).
208208
@@ -261,7 +261,7 @@ Each DNS query can return one of the following error codes:
261261
262262## Supported getaddrinfo flags
263263
264- The following flags can be passed as hints to ` dns.lookup ` .
264+ The following flags can be passed as hints to ` dns.lookup() ` .
265265
266266- ` dns.ADDRCONFIG ` : Returned address types are determined by the types
267267of addresses supported by the current system. For example, IPv4 addresses
@@ -273,17 +273,17 @@ on some operating systems (e.g FreeBSD 10.1).
273273
274274## Implementation considerations
275275
276- Although ` dns.lookup ` and ` dns.resolve*/dns.reverse ` functions have the same
276+ Although ` dns.lookup() ` and ` dns.resolve*() /dns.reverse() ` functions have the same
277277goal of associating a network name with a network address (or vice versa),
278278their behavior is quite different. These differences can have subtle but
279279significant consequences on the behavior of Node.js programs.
280280
281281### dns.lookup
282282
283- Under the hood, ` dns.lookup ` uses the same operating system facilities as most
284- other programs. For instance, ` dns.lookup ` will almost always resolve a given
283+ Under the hood, ` dns.lookup() ` uses the same operating system facilities as most
284+ other programs. For instance, ` dns.lookup() ` will almost always resolve a given
285285name the same way as the ` ping ` command. On most POSIX-like operating systems,
286- the behavior of the ` dns.lookup ` function can be tweaked by changing settings
286+ the behavior of the ` dns.lookup() ` function can be tweaked by changing settings
287287in ` nsswitch.conf(5) ` and/or ` resolv.conf(5) ` , but be careful that changing
288288these files will change the behavior of all other programs running on the same
289289operating system.
@@ -302,13 +302,16 @@ documentation](http://docs.libuv.org/en/latest/threadpool.html).
302302
303303### dns.resolve, functions starting with dns.resolve and dns.reverse
304304
305- These functions are implemented quite differently than ` dns.lookup ` . They do
305+ These functions are implemented quite differently than ` dns.lookup() ` . They do
306306not use ` getaddrinfo(3) ` and they _ always_ perform a DNS query on the network.
307307This network communication is always done asynchronously, and does not use
308308libuv's threadpool.
309309
310310As a result, these functions cannot have the same negative impact on other
311- processing that happens on libuv's threadpool that ` dns.lookup ` can have.
311+ processing that happens on libuv's threadpool that ` dns.lookup() ` can have.
312312
313- They do not use the same set of configuration files than what ` dns.lookup `
313+ They do not use the same set of configuration files than what ` dns.lookup() `
314314uses. For instance, _ they do not use the configuration from ` /etc/hosts ` _ .
315+
316+
317+ [ dns.lookup ] : #dns_dns_lookup_hostname_options_callback
0 commit comments