Skip to content

Commit fa2c2b5

Browse files
author
MarcoFalke
committed
doc: Extract net permissions doc
1 parent 399a0d9 commit fa2c2b5

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed

src/init.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
#include <ui_interface.h>
5252
#include <util/asmap.h>
5353
#include <util/moneystr.h>
54+
#include <util/string.h>
5455
#include <util/system.h>
5556
#include <util/threadnames.h>
5657
#include <util/translation.h>
@@ -465,11 +466,7 @@ void SetupServerArgs(NodeContext& node)
465466
hidden_args.emplace_back("-upnp");
466467
#endif
467468
gArgs.AddArg("-whitebind=<[permissions@]addr>", "Bind to given address and whitelist peers connecting to it. "
468-
"Use [host]:port notation for IPv6. Allowed permissions are bloomfilter (allow requesting BIP37 filtered blocks and transactions), "
469-
"noban (do not ban for misbehavior), "
470-
"forcerelay (relay transactions that are already in the mempool; implies relay), "
471-
"relay (relay even in -blocksonly mode), "
472-
"and mempool (allow requesting BIP35 mempool contents). "
469+
"Use [host]:port notation for IPv6. Allowed permissions: " + Join(NET_PERMISSIONS_DOC, ", ") + ". "
473470
"Specify multiple permissions separated by commas (default: noban,mempool,relay). Can be specified multiple times.", ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION);
474471

475472
gArgs.AddArg("-whitelist=<[permissions@]IP address or network>", "Whitelist peers connecting from the given IP address (e.g. 1.2.3.4) or "

src/net_permissions.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@
88
#include <util/system.h>
99
#include <util/translation.h>
1010

11+
const std::vector<std::string> NET_PERMISSIONS_DOC{
12+
"bloomfilter (allow requesting BIP37 filtered blocks and transactions)",
13+
"noban (do not ban for misbehavior)",
14+
"forcerelay (relay transactions that are already in the mempool; implies relay)",
15+
"relay (relay even in -blocksonly mode)",
16+
"mempool (allow requesting BIP35 mempool contents)",
17+
};
18+
1119
// The parse the following format "perm1,perm2@xxxxxx"
1220
bool TryParsePermissionFlags(const std::string str, NetPermissionFlags& output, size_t& readen, std::string& error)
1321
{

src/net_permissions.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,16 @@
22
// Distributed under the MIT software license, see the accompanying
33
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
44

5+
#include <netaddress.h>
6+
57
#include <string>
68
#include <vector>
7-
#include <netaddress.h>
89

910
#ifndef BITCOIN_NET_PERMISSIONS_H
1011
#define BITCOIN_NET_PERMISSIONS_H
12+
13+
extern const std::vector<std::string> NET_PERMISSIONS_DOC;
14+
1115
enum NetPermissionFlags
1216
{
1317
PF_NONE = 0,
@@ -27,6 +31,7 @@ enum NetPermissionFlags
2731
PF_ISIMPLICIT = (1U << 31),
2832
PF_ALL = PF_BLOOMFILTER | PF_FORCERELAY | PF_RELAY | PF_NOBAN | PF_MEMPOOL,
2933
};
34+
3035
class NetPermissions
3136
{
3237
public:
@@ -45,6 +50,7 @@ class NetPermissions
4550
flags = static_cast<NetPermissionFlags>(flags & ~f);
4651
}
4752
};
53+
4854
class NetWhitebindPermissions : public NetPermissions
4955
{
5056
public:

0 commit comments

Comments
 (0)