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);
92 if (!
Lookup(strBind, addrBind, 0,
false)) {
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)
bool LookupSubNet(const std::string &strSubnet, CSubNet &ret, DNSLookupFn dns_lookup_function)
Parse and resolve a specified subnet string into the appropriate internal representation.
bilingual_str Untranslated(std::string original)
Mark a bilingual_str as untranslated.
bool Lookup(const std::string &name, std::vector< CService > &vAddr, uint16_t portDefault, bool fAllowLookup, unsigned int nMaxSolutions, DNSLookupFn dns_lookup_function)
Resolve a service string to its corresponding service.
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.
A combination of a network address (CNetAddr) and a (TCP) port.
NetPermissionFlags m_flags
static bool TryParse(const std::string &str, NetWhitebindPermissions &output, bilingual_str &error)
bool error(const char *fmt, const Args &... args)
static std::vector< std::string > ToStrings(NetPermissionFlags flags)