doc: clarify dns.lookup vs dns.resolve

Clarify and emphasize the differences between dns.lookup and the rest of
the functions in the dns module.

PR-URL: https://github.com/joyent/node/pull/8726
Reviewed-by: Chris Dickinson <christopher.s.dickinson@gmail.com>

Cherry-picked-from: 5ff59453a4
pull/281/merge
Julien Gilli 2014-11-14 10:58:54 -08:00 committed by Bert Belder
parent b91c535d86
commit bfe04ed286
1 changed files with 7 additions and 4 deletions

View File

@ -2,10 +2,13 @@
Stability: 3 - Stable Stability: 3 - Stable
Use `require('dns')` to access this module. All methods in the dns module Use `require('dns')` to access this module. All methods in the dns module use
use C-Ares except for `dns.lookup` which uses `getaddrinfo(3)` in a thread C-Ares except for `dns.lookup` which uses `getaddrinfo(3)` in a thread pool.
pool. C-Ares is much faster than `getaddrinfo` but the system resolver is C-Ares is much faster than `getaddrinfo(3)` but, due to the way it is
more consistent with how other programs operate. When a user does configured by node, it doesn't use the same set of system configuration files.
For instance, _C- Ares will not use the configuration from `/etc/hosts`_. As a
result, __only `dns.lookup` should be expected to behave like other programs
running on the same system regarding name resolution.__ When a user does
`net.connect(80, 'google.com')` or `http.get({ host: 'google.com' })` the `net.connect(80, 'google.com')` or `http.get({ host: 'google.com' })` the
`dns.lookup` method is used. Users who need to do a large number of lookups `dns.lookup` method is used. Users who need to do a large number of lookups
quickly should use the methods that go through C-Ares. quickly should use the methods that go through C-Ares.