mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 14:38:29 +01:00
Merge pull request #4605
aa82795Add detailed network info to getnetworkinfo RPC (Wladimir J. van der Laan)075cf49Add GetNetworkName function (Wladimir J. van der Laan)c91a947Add IsReachable(net) function (Wladimir J. van der Laan)60dc8e4Allow -onlynet=onion to be used (Wladimir J. van der Laan)
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user