Merge pull request 'clearnet=0' (#457) from clearnet into dev

Reviewed-on: https://git.hush.is/hush/hush3/pulls/457
This commit is contained in:
duke
2025-03-02 13:13:08 -06:00
2 changed files with 15 additions and 0 deletions

View File

@@ -432,6 +432,8 @@ std::string HelpMessage(HelpMessageMode mode)
strUsage += HelpMessageOpt("-disableipv4", _("Disable Ipv4 network connections") + " " + strprintf(_("(default: %u)"), DEFAULT_DISABLE_IPV4));
strUsage += HelpMessageOpt("-disableipv6", _("Disable Ipv6 network connections") + " " + strprintf(_("(default: %u)"), DEFAULT_DISABLE_IPV6));
strUsage += HelpMessageOpt("-clearnet", _("Enable clearnet connections. Setting to 0 will disable clearnet and use sane defaults for Tor/i2p") + " " + strprintf(_("(default: %u)"), DEFAULT_CLEARNET));
strUsage += HelpMessageOpt("-permitbaremultisig", strprintf(_("Relay non-P2SH multisig (default: %u)"), 1));
strUsage += HelpMessageOpt("-peerbloomfilters", strprintf(_("Support filtering of blocks and transaction with Bloom filters (default: %u)"), 1));
if (showDebug)
@@ -1643,6 +1645,16 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
}
//fprintf(stderr,"%s tik18\n", __FUNCTION__);
// Disable clearnet peers if -clearnet=0
if (!GetBoolArg("-clearnet", DEFAULT_CLEARNET)) {
SoftSetBoolArg("-disableipv4", true);
SoftSetBoolArg("-disableipv6", true);
SoftSetArg("-onlynet", "onion");
SoftSetArg("-onlynet", "i2p");
SoftSetArg("-onion", "127.0.0.1:9050");
SoftSetArg("-i2psam", "127.0.0.1:7656");
}
if (mapArgs.count("-onlynet")) {
std::set<enum Network> nets;
BOOST_FOREACH(const std::string& snet, mapMultiArgs["-onlynet"]) {

View File

@@ -86,6 +86,9 @@ static const unsigned int MAX_SUBVERSION_LENGTH = 256;
/** -listen default */
static const bool DEFAULT_LISTEN = true;
/** -clearnet default */
static const bool DEFAULT_CLEARNET = true;
/** -disableipv4 default */
static const bool DEFAULT_DISABLE_IPV4 = false;
/** -disableipv6 default */