Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Schonning <nschonni@gmail.com>2019-09-01 01:42:48 +0300
committerDaniel Bevenius <daniel.bevenius@gmail.com>2019-09-06 07:10:18 +0300
commit754d5a9375beecd95ab7f26de769259ee090e5f6 (patch)
tree52fe8eafbfee9b58b6970f38f8856add48c77395 /doc/api/dns.md
parent02f3dd24f38983b3211bcec7e96cb005c3babef8 (diff)
doc: indent ordered list child content
Markdownlint flags this with MD029 rule. Markdown renders will usually use list continuation number if it can. Explicitly adding it to the list item child scope makes it clearer. PR-URL: https://github.com/nodejs/node/pull/29332 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Diffstat (limited to 'doc/api/dns.md')
-rw-r--r--doc/api/dns.md86
1 files changed, 44 insertions, 42 deletions
diff --git a/doc/api/dns.md b/doc/api/dns.md
index a22af1280ac..43f78af7c7e 100644
--- a/doc/api/dns.md
+++ b/doc/api/dns.md
@@ -6,52 +6,54 @@
The `dns` module contains functions belonging to two different categories:
-1) Functions that use the underlying operating system facilities to perform
-name resolution, and that do not necessarily perform any network communication.
-This category contains only one function: [`dns.lookup()`][]. **Developers
-looking to perform name resolution in the same way that other applications on
-the same operating system behave should use [`dns.lookup()`][].**
+1. Functions that use the underlying operating system facilities to perform
+ name resolution, and that do not necessarily perform any network
+ communication.
+ This category contains only one function: [`dns.lookup()`][]. **Developers
+ looking to perform name resolution in the same way that other applications
+ on the same operating system behave should use [`dns.lookup()`][].**
-For example, looking up `iana.org`.
+ For example, looking up `iana.org`.
-```js
-const dns = require('dns');
-
-dns.lookup('iana.org', (err, address, family) => {
- console.log('address: %j family: IPv%s', address, family);
-});
-// address: "192.0.43.8" family: IPv4
-```
-
-2) Functions that connect to an actual DNS server to perform name resolution,
-and that _always_ use the network to perform DNS queries. This category
-contains all functions in the `dns` module _except_ [`dns.lookup()`][]. These
-functions do not use the same set of configuration files used by
-[`dns.lookup()`][] (e.g. `/etc/hosts`). These functions should be used by
-developers who do not want to use the underlying operating system's facilities
-for name resolution, and instead want to _always_ perform DNS queries.
+ ```js
+ const dns = require('dns');
-Below is an example that resolves `'archive.org'` then reverse resolves the IP
-addresses that are returned.
-
-```js
-const dns = require('dns');
-
-dns.resolve4('archive.org', (err, addresses) => {
- if (err) throw err;
-
- console.log(`addresses: ${JSON.stringify(addresses)}`);
-
- addresses.forEach((a) => {
- dns.reverse(a, (err, hostnames) => {
- if (err) {
- throw err;
- }
- console.log(`reverse for ${a}: ${JSON.stringify(hostnames)}`);
+ dns.lookup('iana.org', (err, address, family) => {
+ console.log('address: %j family: IPv%s', address, family);
});
- });
-});
-```
+ // address: "192.0.43.8" family: IPv4
+ ```
+
+2. Functions that connect to an actual DNS server to perform name resolution,
+ and that _always_ use the network to perform DNS queries. This category
+ contains all functions in the `dns` module _except_ [`dns.lookup()`][].
+ These functions do not use the same set of configuration files used by
+ [`dns.lookup()`][] (e.g. `/etc/hosts`). These functions should be used by
+ developers who do not want to use the underlying operating system's
+ facilities for name resolution, and instead want to _always_ perform DNS
+ queries.
+
+ Below is an example that resolves `'archive.org'` then reverse resolves the
+ IP addresses that are returned.
+
+ ```js
+ const dns = require('dns');
+
+ dns.resolve4('archive.org', (err, addresses) => {
+ if (err) throw err;
+
+ console.log(`addresses: ${JSON.stringify(addresses)}`);
+
+ addresses.forEach((a) => {
+ dns.reverse(a, (err, hostnames) => {
+ if (err) {
+ throw err;
+ }
+ console.log(`reverse for ${a}: ${JSON.stringify(hostnames)}`);
+ });
+ });
+ });
+ ```
There are subtle consequences in choosing one over the other, please consult
the [Implementation considerations section][] for more information.