aboutsummaryrefslogtreecommitdiff
path: root/src/netbase.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2014-08-18 13:37:25 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2014-08-18 13:37:54 +0200
commit04d6c7d10cf66e134ed7e112127c060f78ea620a (patch)
tree732eb790194e7585177d3581630734c67359cdbe /src/netbase.cpp
parentbd45b1abd31ff75461407c7fe904b9e924dc576a (diff)
parentaa8279513b5d206c172d3da3d5e3034c61d47b39 (diff)
Merge pull request #4605
aa82795 Add detailed network info to getnetworkinfo RPC (Wladimir J. van der Laan) 075cf49 Add GetNetworkName function (Wladimir J. van der Laan) c91a947 Add IsReachable(net) function (Wladimir J. van der Laan) 60dc8e4 Allow -onlynet=onion to be used (Wladimir J. van der Laan)
Diffstat (limited to 'src/netbase.cpp')
-rw-r--r--src/netbase.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/netbase.cpp b/src/netbase.cpp
index 1031e7e38a..e1637cd404 100644
--- a/src/netbase.cpp
+++ b/src/netbase.cpp
@@ -47,10 +47,20 @@ enum Network ParseNetwork(std::string net) {
boost::to_lower(net);
if (net == "ipv4") return NET_IPV4;
if (net == "ipv6") return NET_IPV6;
- if (net == "tor") return NET_TOR;
+ if (net == "tor" || net == "onion") return NET_TOR;
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