Changeset View
Changeset View
Standalone View
Standalone View
src/net_permissions.cpp
Show All 13 Lines | const std::vector<std::string> NET_PERMISSIONS_DOC{ | ||||
"noban (do not ban for misbehavior; implies download)", | "noban (do not ban for misbehavior; implies download)", | ||||
"forcerelay (relay transactions that are already in the mempool; implies " | "forcerelay (relay transactions that are already in the mempool; implies " | ||||
"relay)", | "relay)", | ||||
"relay (relay even in -blocksonly mode, and unlimited transaction " | "relay (relay even in -blocksonly mode, and unlimited transaction " | ||||
"announcements)", | "announcements)", | ||||
"mempool (allow requesting BIP35 mempool contents)", | "mempool (allow requesting BIP35 mempool contents)", | ||||
"download (allow getheaders during IBD, no disconnect after " | "download (allow getheaders during IBD, no disconnect after " | ||||
"maxuploadtarget limit)", | "maxuploadtarget limit)", | ||||
"cmpctproofs (experimental, allow unrequested avaproofs messages)", | |||||
"bypass_proof_request_limits (experimental, bypass the limits on avalanche " | "bypass_proof_request_limits (experimental, bypass the limits on avalanche " | ||||
"proof downloads)", | "proof downloads)", | ||||
"addr (responses to GETADDR avoid hitting the cache and contain random " | "addr (responses to GETADDR avoid hitting the cache and contain random " | ||||
"records with the most up-to-date info)"}; | "records with the most up-to-date info)"}; | ||||
namespace { | namespace { | ||||
// The parse the following format "perm1,perm2@xxxxxx" | // The parse the following format "perm1,perm2@xxxxxx" | ||||
Show All 39 Lines | else { | ||||
} else if (permission == "download") { | } else if (permission == "download") { | ||||
NetPermissions::AddFlag(flags, PF_DOWNLOAD); | NetPermissions::AddFlag(flags, PF_DOWNLOAD); | ||||
} else if (permission == "all") { | } else if (permission == "all") { | ||||
NetPermissions::AddFlag(flags, PF_ALL); | NetPermissions::AddFlag(flags, PF_ALL); | ||||
} else if (permission == "relay") { | } else if (permission == "relay") { | ||||
NetPermissions::AddFlag(flags, PF_RELAY); | NetPermissions::AddFlag(flags, PF_RELAY); | ||||
} else if (permission == "addr") { | } else if (permission == "addr") { | ||||
NetPermissions::AddFlag(flags, PF_ADDR); | NetPermissions::AddFlag(flags, PF_ADDR); | ||||
} else if (permission == "cmpctproofs") { | |||||
NetPermissions::AddFlag(flags, PF_CMPCTPROOFS); | |||||
} else if (permission == "bypass_proof_request_limits") { | } else if (permission == "bypass_proof_request_limits") { | ||||
NetPermissions::AddFlag(flags, PF_BYPASS_PROOF_REQUEST_LIMITS); | NetPermissions::AddFlag(flags, PF_BYPASS_PROOF_REQUEST_LIMITS); | ||||
} else if (permission.length() == 0) { | } else if (permission.length() == 0) { | ||||
// Allow empty entries | // Allow empty entries | ||||
} else { | } else { | ||||
error = | error = | ||||
strprintf(_("Invalid P2P permission: '%s'"), permission); | strprintf(_("Invalid P2P permission: '%s'"), permission); | ||||
return false; | return false; | ||||
Show All 27 Lines | if (NetPermissions::HasFlag(flags, PF_MEMPOOL)) { | ||||
strings.push_back("mempool"); | strings.push_back("mempool"); | ||||
} | } | ||||
if (NetPermissions::HasFlag(flags, PF_DOWNLOAD)) { | if (NetPermissions::HasFlag(flags, PF_DOWNLOAD)) { | ||||
strings.push_back("download"); | strings.push_back("download"); | ||||
} | } | ||||
if (NetPermissions::HasFlag(flags, PF_ADDR)) { | if (NetPermissions::HasFlag(flags, PF_ADDR)) { | ||||
strings.push_back("addr"); | strings.push_back("addr"); | ||||
} | } | ||||
if (NetPermissions::HasFlag(flags, PF_CMPCTPROOFS)) { | |||||
strings.push_back("cmpctproofs"); | |||||
} | |||||
if (NetPermissions::HasFlag(flags, PF_BYPASS_PROOF_REQUEST_LIMITS)) { | if (NetPermissions::HasFlag(flags, PF_BYPASS_PROOF_REQUEST_LIMITS)) { | ||||
strings.push_back("bypass_proof_request_limits"); | strings.push_back("bypass_proof_request_limits"); | ||||
} | } | ||||
return strings; | return strings; | ||||
} | } | ||||
bool NetWhitebindPermissions::TryParse(const std::string str, | bool NetWhitebindPermissions::TryParse(const std::string str, | ||||
NetWhitebindPermissions &output, | NetWhitebindPermissions &output, | ||||
▲ Show 20 Lines • Show All 48 Lines • Show Last 20 Lines |