@@ -8,9 +8,9 @@ This module contains functions that belong to two different categories:
8
8
9
9
1 ) Functions that use the underlying operating system facilities to perform
10
10
name 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
12
12
to 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 ] .__
14
14
15
15
Here is an example that does a lookup of ` www.google.com ` .
16
16
@@ -22,8 +22,8 @@ Here is an example that does a lookup of `www.google.com`.
22
22
23
23
2 ) Functions that connect to an actual DNS server to perform name resolution,
24
24
and 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.
27
27
For instance, _ they do not use the configuration from ` /etc/hosts ` _ . These
28
28
functions should be used by developers who do not want to use the underlying
29
29
operating 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
98
98
the hostname does not exist but also when the lookup fails in other ways
99
99
such as no available file descriptors.
100
100
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.
102
102
It's only an operating system facility that can associate name with addresses,
103
103
and vice versa.
104
104
@@ -144,40 +144,40 @@ one of the error codes listed below.
144
144
145
145
## dns.resolve4(hostname, callback)
146
146
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).
148
148
` addresses ` is an array of IPv4 addresses (e.g.
149
149
` ['74.125.79.104', '74.125.79.105', '74.125.79.106'] ` ).
150
150
151
151
## dns.resolve6(hostname, callback)
152
152
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).
154
154
155
155
156
156
## dns.resolveMx(hostname, callback)
157
157
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).
159
159
160
160
` addresses ` is an array of MX records, each with a priority and an exchange
161
161
attribute (e.g. ` [{'priority': 10, 'exchange': 'mx.example.com'},...] ` ).
162
162
163
163
## dns.resolveTxt(hostname, callback)
164
164
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).
166
166
` addresses ` is a 2-d array of the text records available for ` hostname ` (e.g.,
167
167
` [ ['v=spf1 ip4:0.0.0.0 ', '~all' ] ] ` ). Each sub-array contains TXT chunks of
168
168
one record. Depending on the use case, the could be either joined together or
169
169
treated separately.
170
170
171
171
## dns.resolveSrv(hostname, callback)
172
172
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).
174
174
` addresses ` is an array of the SRV records available for ` hostname ` . Properties
175
175
of SRV records are priority, weight, port, and name (e.g.,
176
176
` [{'priority': 10, 'weight': 5, 'port': 21223, 'name': 'service.example.com'}, ...] ` ).
177
177
178
178
## dns.resolveSoa(hostname, callback)
179
179
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
181
181
(` SOA ` record).
182
182
183
183
` 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
196
196
197
197
## dns.resolveNs(hostname, callback)
198
198
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).
200
200
` addresses ` is an array of the name server records available for ` hostname `
201
201
(e.g., ` ['ns1.example.com', 'ns2.example.com'] ` ).
202
202
203
203
## dns.resolveCname(hostname, callback)
204
204
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 `
206
206
records). ` addresses ` is an array of the canonical name records available for
207
207
` hostname ` (e.g., ` ['bar.example.com'] ` ).
208
208
@@ -261,7 +261,7 @@ Each DNS query can return one of the following error codes:
261
261
262
262
## Supported getaddrinfo flags
263
263
264
- The following flags can be passed as hints to ` dns.lookup ` .
264
+ The following flags can be passed as hints to ` dns.lookup() ` .
265
265
266
266
- ` dns.ADDRCONFIG ` : Returned address types are determined by the types
267
267
of addresses supported by the current system. For example, IPv4 addresses
@@ -273,17 +273,17 @@ on some operating systems (e.g FreeBSD 10.1).
273
273
274
274
## Implementation considerations
275
275
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
277
277
goal of associating a network name with a network address (or vice versa),
278
278
their behavior is quite different. These differences can have subtle but
279
279
significant consequences on the behavior of Node.js programs.
280
280
281
281
### dns.lookup
282
282
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
285
285
name 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
287
287
in ` nsswitch.conf(5) ` and/or ` resolv.conf(5) ` , but be careful that changing
288
288
these files will change the behavior of all other programs running on the same
289
289
operating system.
@@ -302,13 +302,16 @@ documentation](http://docs.libuv.org/en/latest/threadpool.html).
302
302
303
303
### dns.resolve, functions starting with dns.resolve and dns.reverse
304
304
305
- These functions are implemented quite differently than ` dns.lookup ` . They do
305
+ These functions are implemented quite differently than ` dns.lookup() ` . They do
306
306
not use ` getaddrinfo(3) ` and they _ always_ perform a DNS query on the network.
307
307
This network communication is always done asynchronously, and does not use
308
308
libuv's threadpool.
309
309
310
310
As 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.
312
312
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() `
314
314
uses. 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