diff options
author | Ouyang Yadong <oyydoibh@gmail.com> | 2021-04-06 11:09:11 +0300 |
---|---|---|
committer | Michaƫl Zasso <targos@protonmail.com> | 2021-09-04 10:33:17 +0300 |
commit | 15ba19b02013bbb7618a540da7a374cadcb1fd2a (patch) | |
tree | 2d452418bcb3582cba3c6ea6e18e4383e880a659 /src | |
parent | 587deacad92624d3e4a48c81a85551d03f626c36 (diff) |
dns: allow `--dns-result-order` to change default dns verbatim
Allow the `--dns-result-order` option to change the default value
of verbatim in `dns.lookup()`. This is useful when running
Node.js in ipv6-only environments to avoid possible ENETUNREACH
errors.
PR-URL: https://github.com/nodejs/node/pull/38099
Refs: https://github.com/nodejs/node/issues/31566
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Diffstat (limited to 'src')
-rw-r--r-- | src/node_options.cc | 7 | ||||
-rw-r--r-- | src/node_options.h | 1 |
2 files changed, 8 insertions, 0 deletions
diff --git a/src/node_options.cc b/src/node_options.cc index d1d52f65064..3db24e3494c 100644 --- a/src/node_options.cc +++ b/src/node_options.cc @@ -282,6 +282,13 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() { " (default: current working directory)", &EnvironmentOptions::diagnostic_dir, kAllowedInEnvironment); + AddOption("--dns-result-order", + "set default value of verbatim in dns.lookup. Options are " + "'ipv4first' (IPv4 addresses are placed before IPv6 addresses) " + "'verbatim' (addresses are in the order the DNS resolver " + "returned)", + &EnvironmentOptions::dns_result_order, + kAllowedInEnvironment); AddOption("--enable-source-maps", "experimental Source Map V3 support", &EnvironmentOptions::enable_source_maps, diff --git a/src/node_options.h b/src/node_options.h index 57b1bb5e278..b8bd44dfefc 100644 --- a/src/node_options.h +++ b/src/node_options.h @@ -101,6 +101,7 @@ class EnvironmentOptions : public Options { public: bool abort_on_uncaught_exception = false; std::vector<std::string> conditions; + std::string dns_result_order; bool enable_source_maps = false; bool experimental_abortcontroller = false; bool experimental_json_modules = false; |