diff options
author | Josh Dague <jd@josh3736.net> | 2020-08-18 09:23:25 +0300 |
---|---|---|
committer | Antoine du Hamel <duhamelantoine1995@gmail.com> | 2020-10-25 13:18:39 +0300 |
commit | 3e10ce30b471214cc5020a92d628357e9ed4fb91 (patch) | |
tree | 4c9092895509dab0a0092e42cc53da4890643e83 /doc/api/dns.md | |
parent | 70834250e83fa89e92314be37a9592978ee8c6bd (diff) |
dns: add setLocalAddress to Resolver
Fixes: https://github.com/nodejs/node/issues/34818
PR-URL: https://github.com/nodejs/node/pull/34824
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
Diffstat (limited to 'doc/api/dns.md')
-rw-r--r-- | doc/api/dns.md | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/doc/api/dns.md b/doc/api/dns.md index a1f4240981f..638321f222a 100644 --- a/doc/api/dns.md +++ b/doc/api/dns.md @@ -117,6 +117,27 @@ added: v8.3.0 Cancel all outstanding DNS queries made by this resolver. The corresponding callbacks will be called with an error with code `ECANCELLED`. +### `resolver.setLocalAddress([ipv4][, ipv6])` +<!-- YAML +added: REPLACEME +--> + +* `ipv4` {string} A string representation of an IPv4 address. + **Default:** `'0.0.0.0'` +* `ipv6` {string} A string representation of an IPv6 address. + **Default:** `'::0'` + +The resolver instance will send its requests from the specified IP address. +This allows programs to specify outbound interfaces when used on multi-homed +systems. + +If a v4 or v6 address is not specified, it is set to the default, and the +operating system will choose a local address automatically. + +The resolver will use the v4 local address when making requests to IPv4 DNS +servers, and the v6 local address when making requests to IPv6 DNS servers. +The `rrtype` of resolution requests has no impact on the local address used. + ## `dns.getServers()` <!-- YAML added: v0.11.3 |