Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 6dd3476

Browse filesBrowse files
a0viedojasnell
authored andcommitted
doc: add method links in dns.markdown
Added links to referenced methods. PR-URL: #3196 Reviewed-By: Roman Reiss <me@silverwind.io>>
1 parent 333e833 commit 6dd3476
Copy full SHA for 6dd3476

File tree

Expand file treeCollapse file tree

1 file changed

+24
-21
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+24
-21
lines changed
Open diff view settings
Collapse file

‎doc/api/dns.markdown‎

Copy file name to clipboardExpand all lines: doc/api/dns.markdown
+24-21Lines changed: 24 additions & 21 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ This module contains functions that belong to two different categories:
88

99
1) Functions that use the underlying operating system facilities to perform
1010
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
1212
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].__
1414

1515
Here 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

2323
2) Functions that connect to an actual DNS server to perform name resolution,
2424
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.
2727
For instance, _they do not use the configuration from `/etc/hosts`_. These
2828
functions should be used by developers who do not want to use the underlying
2929
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
9898
the hostname does not exist but also when the lookup fails in other ways
9999
such 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.
102102
It's only an operating system facility that can associate name with addresses,
103103
and 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
161161
attribute (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
168168
one record. Depending on the use case, the could be either joined together or
169169
treated 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
175175
of 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`
206206
records). `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
267267
of 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
277277
goal of associating a network name with a network address (or vice versa),
278278
their behavior is quite different. These differences can have subtle but
279279
significant 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
285285
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
287287
in `nsswitch.conf(5)` and/or `resolv.conf(5)`, but be careful that changing
288288
these files will change the behavior of all other programs running on the same
289289
operating 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
306306
not use `getaddrinfo(3)` and they _always_ perform a DNS query on the network.
307307
This network communication is always done asynchronously, and does not use
308308
libuv's threadpool.
309309

310310
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.
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()`
314314
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

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.