mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-15 12:51:00 +02:00
Merge d7e2401c62 into merged_master (Bitcoin PR #18077)
This commit is contained in:
commit
c5a022192f
33 changed files with 547 additions and 173 deletions
20
src/init.cpp
20
src/init.cpp
|
|
@ -27,6 +27,7 @@
|
|||
#include <interfaces/node.h>
|
||||
#include <key.h>
|
||||
#include <mainchainrpc.h>
|
||||
#include <mapport.h>
|
||||
#include <miner.h>
|
||||
#include <net.h>
|
||||
#include <net_permissions.h>
|
||||
|
|
@ -479,6 +480,11 @@ void SetupServerArgs(NodeContext& node)
|
|||
#else
|
||||
hidden_args.emplace_back("-upnp");
|
||||
#endif
|
||||
#ifdef USE_NATPMP
|
||||
argsman.AddArg("-natpmp", strprintf("Use NAT-PMP to map the listening port (default: %s)", DEFAULT_NATPMP ? "1 when listening and no -proxy" : "0"), ArgsManager::ALLOW_BOOL, OptionsCategory::CONNECTION);
|
||||
#else
|
||||
hidden_args.emplace_back("-natpmp");
|
||||
#endif // USE_NATPMP
|
||||
argsman.AddArg("-whitebind=<[permissions@]addr>", "Bind to the given address and add permission flags to the peers connecting to it. "
|
||||
"Use [host]:port notation for IPv6. Allowed permissions: " + Join(NET_PERMISSIONS_DOC, ", ") + ". "
|
||||
"Specify multiple permissions separated by commas (default: download,noban,mempool,relay). Can be specified multiple times.", ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION);
|
||||
|
|
@ -865,10 +871,13 @@ void InitParameterInteraction(ArgsManager& args)
|
|||
// to protect privacy, do not listen by default if a default proxy server is specified
|
||||
if (args.SoftSetBoolArg("-listen", false))
|
||||
LogPrintf("%s: parameter interaction: -proxy set -> setting -listen=0\n", __func__);
|
||||
// to protect privacy, do not use UPNP when a proxy is set. The user may still specify -listen=1
|
||||
// to protect privacy, do not map ports when a proxy is set. The user may still specify -listen=1
|
||||
// to listen locally, so don't rely on this happening through -listen below.
|
||||
if (args.SoftSetBoolArg("-upnp", false))
|
||||
LogPrintf("%s: parameter interaction: -proxy set -> setting -upnp=0\n", __func__);
|
||||
if (args.SoftSetBoolArg("-natpmp", false)) {
|
||||
LogPrintf("%s: parameter interaction: -proxy set -> setting -natpmp=0\n", __func__);
|
||||
}
|
||||
// to protect privacy, do not discover addresses by default
|
||||
if (args.SoftSetBoolArg("-discover", false))
|
||||
LogPrintf("%s: parameter interaction: -proxy set -> setting -discover=0\n", __func__);
|
||||
|
|
@ -878,6 +887,9 @@ void InitParameterInteraction(ArgsManager& args)
|
|||
// do not map ports or try to retrieve public IP when not listening (pointless)
|
||||
if (args.SoftSetBoolArg("-upnp", false))
|
||||
LogPrintf("%s: parameter interaction: -listen=0 -> setting -upnp=0\n", __func__);
|
||||
if (args.SoftSetBoolArg("-natpmp", false)) {
|
||||
LogPrintf("%s: parameter interaction: -listen=0 -> setting -natpmp=0\n", __func__);
|
||||
}
|
||||
if (args.SoftSetBoolArg("-discover", false))
|
||||
LogPrintf("%s: parameter interaction: -listen=0 -> setting -discover=0\n", __func__);
|
||||
if (args.SoftSetBoolArg("-listenonion", false))
|
||||
|
|
@ -1957,10 +1969,8 @@ bool AppInitMain(const util::Ref& context, NodeContext& node, interfaces::BlockA
|
|||
|
||||
Discover();
|
||||
|
||||
// Map ports with UPnP
|
||||
if (args.GetBoolArg("-upnp", DEFAULT_UPNP)) {
|
||||
StartMapPort();
|
||||
}
|
||||
// Map ports with UPnP or NAT-PMP.
|
||||
StartMapPort(args.GetBoolArg("-upnp", DEFAULT_UPNP), gArgs.GetBoolArg("-natpmp", DEFAULT_NATPMP));
|
||||
|
||||
CConnman::Options connOptions;
|
||||
connOptions.nLocalServices = nLocalServices;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue