13 "bloomfilter (allow requesting BIP37 filtered blocks and transactions)",
14 "noban (do not ban for misbehavior; implies download)",
15 "forcerelay (relay transactions that are already in the mempool; implies "
17 "relay (relay even in -blocksonly mode, and unlimited transaction "
19 "mempool (allow requesting BIP35 mempool contents)",
20 "download (allow getheaders during IBD, no disconnect after "
21 "maxuploadtarget limit)",
22 "bypass_proof_request_limits (experimental, bypass the limits on avalanche "
24 "addr (responses to GETADDR avoid hitting the cache and contain random "
25 "records with the most up-to-date info)"};
33 const auto atSeparator = str.find(
'@');
37 if (atSeparator == std::string::npos) {
46 const auto permissions = str.substr(0, atSeparator);
47 while (readen < permissions.length()) {
48 const auto commaSeparator = permissions.find(
',', readen);
49 const auto len = commaSeparator == std::string::npos
50 ? permissions.length() - readen
51 : commaSeparator - readen;
53 const auto permission = permissions.substr(readen, len);
56 if (commaSeparator != std::string::npos) {
61 if (permission ==
"bloomfilter" || permission ==
"bloom") {
63 }
else if (permission ==
"noban") {
65 }
else if (permission ==
"forcerelay") {
67 }
else if (permission ==
"mempool") {
69 }
else if (permission ==
"download") {
71 }
else if (permission ==
"all") {
73 }
else if (permission ==
"relay") {
75 }
else if (permission ==
"addr") {
77 }
else if (permission ==
"bypass_proof_request_limits") {
80 }
else if (permission.length() == 0) {
84 strprintf(
_(
"Invalid P2P permission: '%s'"), permission);
99 std::vector<std::string> strings;
101 strings.push_back(
"bloomfilter");
104 strings.push_back(
"noban");
107 strings.push_back(
"forcerelay");
110 strings.push_back(
"relay");
113 strings.push_back(
"mempool");
116 strings.push_back(
"download");
119 strings.push_back(
"addr");
123 strings.push_back(
"bypass_proof_request_limits");
133 if (!TryParsePermissionFlags(str,
flags, offset,
error)) {
137 const std::string strBind = str.substr(offset);
139 if (!
Lookup(strBind, addrBind, 0,
false)) {
160 if (!TryParsePermissionFlags(str,
flags, offset,
error)) {
164 const std::string net = str.substr(offset);
169 strprintf(
_(
"Invalid netmask specified in -whitelist: '%s'"), net);
A combination of a network address (CNetAddr) and a (TCP) port.
NetPermissionFlags m_flags
static void AddFlag(NetPermissionFlags &flags, NetPermissionFlags f)
static std::vector< std::string > ToStrings(NetPermissionFlags flags)
static bool HasFlag(NetPermissionFlags flags, NetPermissionFlags f)
static bool TryParse(const std::string &str, NetWhitebindPermissions &output, bilingual_str &error)
static bool TryParse(const std::string &str, NetWhitelistPermissions &output, bilingual_str &error)
bilingual_str ResolveErrMsg(const std::string &optname, const std::string &strBind)
const std::vector< std::string > NET_PERMISSIONS_DOC
@ BypassProofRequestLimits
bool LookupSubNet(const std::string &strSubnet, CSubNet &ret, DNSLookupFn dns_lookup_function)
Parse and resolve a specified subnet string into the appropriate internal representation.
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.
bool error(const char *fmt, const Args &...args)
bilingual_str _(const char *psz)
Translation function.
bilingual_str Untranslated(std::string original)
Mark a bilingual_str as untranslated.