mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-15 12:51:00 +02: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:
commit
04d6c7d10c
6 changed files with 51 additions and 10 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue