From 1c3af37881adbbc37fb9924bcf69c403fcae1ae7 Mon Sep 17 00:00:00 2001 From: Jon Atack Date: Tue, 19 Jan 2021 15:36:39 +0100 Subject: net: create GetNetworkNames() --- src/netbase.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/netbase.cpp') 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 GetNetworkNames(bool append_unroutable) +{ + std::vector names; + for (int n = 0; n < NET_MAX; ++n) { + const enum Network network{static_cast(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& vIP, unsigned int nMaxSolutions, bool fAllowLookup) { vIP.clear(); -- cgit v1.2.3