aboutsummaryrefslogtreecommitdiff
path: root/src/netbase.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2014-07-30 15:32:36 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2014-07-30 15:41:17 +0200
commit075cf49e593025030c8b3572e606960f15de424e (patch)
tree307aa1741874c20e3118bcbc5488a89cddc81ec0 /src/netbase.cpp
parentc91a9471be7a96311a7e1452a3624aa557bc185d (diff)
downloadbitcoin-075cf49e593025030c8b3572e606960f15de424e.tar.xz
Add GetNetworkName function
Returns the network name for an Network enum.
Diffstat (limited to 'src/netbase.cpp')
-rw-r--r--src/netbase.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/netbase.cpp b/src/netbase.cpp
index f9f4755f7b..4e109a8bc9 100644
--- a/src/netbase.cpp
+++ b/src/netbase.cpp
@@ -51,6 +51,16 @@ enum Network ParseNetwork(std::string net) {
return NET_UNROUTABLE;
}
+std::string GetNetworkName(enum Network net) {
+ switch(net)
+ {
+ case NET_IPV4: return "ipv4";
+ case NET_IPV6: return "ipv6";
+ case NET_TOR: return "onion";
+ default: return "";
+ }
+}
+
void SplitHostPort(std::string in, int &portOut, std::string &hostOut) {
size_t colon = in.find_last_of(':');
// if a : is found, and it either follows a [...], or no other : is in the string, treat it as port separator