diff options
author | XadillaX <admin@xcoder.in> | 2017-06-16 13:27:21 -0400 |
---|---|---|
committer | Refael Ackermann <refack@gmail.com> | 2017-06-20 18:42:25 -0400 |
commit | 330349f706a1f21234eee9b9d75d7c1e953ad1f0 (patch) | |
tree | 90206709c3203c7a28a033cd4a32ade61ce7dddb /doc/api/dns.md | |
parent | 1fcb76e8f2f05fc084337da097a17b06cc7d0c68 (diff) | |
download | android-node-v8-330349f706a1f21234eee9b9d75d7c1e953ad1f0.tar.gz android-node-v8-330349f706a1f21234eee9b9d75d7c1e953ad1f0.tar.bz2 android-node-v8-330349f706a1f21234eee9b9d75d7c1e953ad1f0.zip |
dns: make `dns.setServers` support customized port
allow `dns.setServers` parameter to contain port
e.g.
```
dns.setServers([ '103.238.225.181:666' ]);
```
And `dns.getServers` will return IP with port if not the default port.
PR-URL: https://github.com/nodejs/node/pull/13723
Refs: https://github.com/nodejs/node/issues/7903
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Diffstat (limited to 'doc/api/dns.md')
-rw-r--r-- | doc/api/dns.md | 36 |
1 files changed, 30 insertions, 6 deletions
diff --git a/doc/api/dns.md b/doc/api/dns.md index 94e64864b6..3813712305 100644 --- a/doc/api/dns.md +++ b/doc/api/dns.md @@ -59,8 +59,21 @@ the [Implementation considerations section][] for more information. added: v0.11.3 --> -Returns an array of IP address strings that are being used for name -resolution. +Returns an array of IP address strings, formatted according to [rfc5952][], +that are currently configured for DNS resolution. A string will include a port +section if a custom port is used. + +For example: + +<!-- eslint-disable --> +```js +[ + '4.4.4.4', + '2001:4860:4860::8888', + '4.4.4.4:1053', + '[2001:4860:4860::8888]:1053' +] +``` ## dns.lookup(hostname[, options], callback) <!-- YAML @@ -482,12 +495,22 @@ one of the [DNS error codes][]. <!-- YAML added: v0.11.3 --> -- `servers` {string[]} +- `servers` {string[]} array of [rfc5952][] formatted addresses + +Sets the IP address and port of servers to be used when performing DNS +resolution. The `servers` argument is an array of [rfc5952][] formatted +addresses. If the port is the IANA default DNS port (53) it can be omitted. -Sets the IP addresses of the servers to be used when resolving. The `servers` -argument is an array of IPv4 or IPv6 addresses. +For example: -If a port is specified on the address, it will be removed. +```js +dns.setServers([ + '4.4.4.4', + '[2001:4860:4860::8888]', + '4.4.4.4:1053', + '[2001:4860:4860::8888]:1053' +]); +``` An error will be thrown if an invalid address is provided. @@ -583,3 +606,4 @@ uses. For instance, _they do not use the configuration from `/etc/hosts`_. [supported `getaddrinfo` flags]: #dns_supported_getaddrinfo_flags [the official libuv documentation]: http://docs.libuv.org/en/latest/threadpool.html [`util.promisify()`]: util.html#util_util_promisify_original +[rfc5952]: https://tools.ietf.org/html/rfc5952#section-6 |