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);
57 error =
strprintf(
_(
"Invalid P2P permission: '%s'"), permission);
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)
bilingual_str Untranslated(std::string original)
Mark a bilingual_str as untranslated.
bool LookupSubNet(const std::string &strSubnet, CSubNet &ret)
Parse and resolve a specified subnet string into the appropriate internal representation.
bool Lookup(const std::string &name, std::vector< CService > &vAddr, int portDefault, bool fAllowLookup, unsigned int nMaxSolutions)
Resolve a service string to its corresponding service.
bilingual_str _(const char *psz)
Translation function.
A combination of a network address (CNetAddr) and a (TCP) port.
static bool HasFlag(const NetPermissionFlags &flags, NetPermissionFlags f)
NetPermissionFlags m_flags
static bool TryParse(const std::string str, NetWhitebindPermissions &output, bilingual_str &error)
bool error(const char *fmt, const Args &... args)
static bool TryParse(const std::string str, NetWhitelistPermissions &output, bilingual_str &error)
static std::vector< std::string > ToStrings(NetPermissionFlags flags)