aboutsummaryrefslogtreecommitdiff
path: root/src/netbase.cpp
diff options
context:
space:
mode:
authorJon Atack <jon@atack.com>2021-01-19 15:36:39 +0100
committerJon Atack <jon@atack.com>2021-02-02 00:01:36 +0100
commit1c3af37881adbbc37fb9924bcf69c403fcae1ae7 (patch)
tree41b30429d6ec8767afab80187673d5ae7474871a /src/netbase.cpp
parentb45eae4d5332f1da71ba9ec983fe7818fa4d32e9 (diff)
downloadbitcoin-1c3af37881adbbc37fb9924bcf69c403fcae1ae7.tar.xz
net: create GetNetworkNames()
Diffstat (limited to 'src/netbase.cpp')
-rw-r--r--src/netbase.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/netbase.cpp b/src/netbase.cpp
index 15abcbd98c..93b4c9d659 100644
--- a/src/netbase.cpp
+++ b/src/netbase.cpp
@@ -68,6 +68,20 @@ std::string GetNetworkName(enum Network net)
assert(false);
}
+std::vector<std::string> GetNetworkNames(bool append_unroutable)
+{
+ std::vector<std::string> names;
+ for (int n = 0; n < NET_MAX; ++n) {
+ const enum Network network{static_cast<Network>(n)};
+ if (network == NET_UNROUTABLE || network == NET_I2P || network == NET_CJDNS || network == NET_INTERNAL) continue;
+ names.emplace_back(GetNetworkName(network));
+ }
+ if (append_unroutable) {
+ names.emplace_back(GetNetworkName(NET_UNROUTABLE));
+ }
+ return names;
+}
+
bool static LookupIntern(const std::string& name, std::vector<CNetAddr>& vIP, unsigned int nMaxSolutions, bool fAllowLookup)
{
vIP.clear();