12 "bloomfilter (allow requesting BIP37 filtered blocks and transactions)",
13 "noban (do not ban for misbehavior; implies download)",
14 "forcerelay (relay transactions that are already in the mempool; implies relay)",
15 "relay (relay even in -blocksonly mode, and unlimited transaction announcements)",
16 "mempool (allow requesting BIP35 mempool contents)",
17 "download (allow getheaders during IBD, no disconnect after maxuploadtarget limit)",
18 "addr (responses to GETADDR avoid hitting the cache and contain random records with the most up-to-date info)" 27 const auto atSeparator = str.find(
'@');
30 if (atSeparator == std::string::npos) {
38 const auto permissions = str.substr(0, atSeparator);
39 while (readen < permissions.length()) {
40 const auto commaSeparator = permissions.find(
',', readen);
41 const auto len = commaSeparator == std::string::npos ? permissions.length() - readen : commaSeparator - readen;
43 const auto permission = permissions.substr(readen, len);
45 if (commaSeparator != std::string::npos) readen++;
55 else if (permission.length() == 0);
73 std::vector<std::string> strings;
88 if (!TryParsePermissionFlags(str,
flags, offset,
error))
return false;
90 const std::string strBind = str.substr(offset);
91 const std::optional<CService> addrBind{
Lookup(strBind, 0,
false)};
92 if (!addrBind.has_value()) {
96 if (addrBind.value().GetPort() == 0) {
97 error =
strprintf(
_(
"Need to specify a port with -whitebind: '%s'"), strBind);
111 if (!TryParsePermissionFlags(str,
flags, offset,
error))
return false;
113 const std::string net = str.substr(offset);
117 error =
strprintf(
_(
"Invalid netmask specified in -whitelist: '%s'"), net);
bilingual_str ResolveErrMsg(const std::string &optname, const std::string &strBind)
const std::vector< std::string > NET_PERMISSIONS_DOC
static void AddFlag(NetPermissionFlags &flags, NetPermissionFlags f)
bilingual_str Untranslated(std::string original)
Mark a bilingual_str as untranslated.
static bool HasFlag(NetPermissionFlags flags, NetPermissionFlags f)
static bool TryParse(const std::string &str, NetWhitelistPermissions &output, bilingual_str &error)
bilingual_str _(const char *psz)
Translation function.
NetPermissionFlags m_flags
std::vector< CService > Lookup(const std::string &name, uint16_t portDefault, bool fAllowLookup, unsigned int nMaxSolutions, DNSLookupFn dns_lookup_function)
Resolve a service string to its corresponding service.
bool error(const char *fmt, const Args &... args)
bool LookupSubNet(const std::string &subnet_str, CSubNet &subnet_out)
Parse and resolve a specified subnet string into the appropriate internal representation.
static bool TryParse(const std::string &str, NetWhitebindPermissions &output, bilingual_str &error)
static std::vector< std::string > ToStrings(NetPermissionFlags flags)