diff options
author | Ouyang Yadong <oyydoibh@gmail.com> | 2021-04-06 11:09:11 +0300 |
---|---|---|
committer | Antoine du Hamel <duhamelantoine1995@gmail.com> | 2021-06-02 20:28:05 +0300 |
commit | d8797f5994d86c25b97f1c2b71e7f56eba302e65 (patch) | |
tree | 92037914e171934595ab1c79a4e0558d3151dc13 /src | |
parent | a172397237af2dbc0c28af45f9edf067c9df544f (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 b8809df58f0..bf18d77d7d1 100644 --- a/src/node_options.cc +++ b/src/node_options.cc @@ -298,6 +298,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", "Source Map V3 support for stack traces", &EnvironmentOptions::enable_source_maps, diff --git a/src/node_options.h b/src/node_options.h index f20234daf7e..a91dbd25978 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_json_modules = false; bool experimental_modules = false; |