Browse Source

Add tls_connections to getinfo and getnetworkinfo

pull/70/head
Kent Sommer 7 years ago
parent
commit
dda2c8281d
  1. 2
      src/rpcmisc.cpp
  2. 2
      src/rpcnet.cpp

2
src/rpcmisc.cpp

@ -55,6 +55,7 @@ UniValue getinfo(const UniValue& params, bool fHelp)
" \"blocks\": xxxxxx, (numeric) the current number of blocks processed in the server\n"
" \"timeoffset\": xxxxx, (numeric) the time offset\n"
" \"connections\": xxxxx, (numeric) the number of connections\n"
" \"tls_connections\": xxxxx, (numeric) the number of TLS connections\n"
" \"proxy\": \"host:port\", (string, optional) the proxy used by the server\n"
" \"difficulty\": xxxxxx, (numeric) the current difficulty\n"
" \"testnet\": true|false, (boolean) if the server is using testnet or not\n"
@ -91,6 +92,7 @@ UniValue getinfo(const UniValue& params, bool fHelp)
obj.push_back(Pair("blocks", (int)chainActive.Height()));
obj.push_back(Pair("timeoffset", GetTimeOffset()));
obj.push_back(Pair("connections", (int)vNodes.size()));
obj.push_back(Pair("tls_connections", (int)std::count_if(vNodes.begin(), vNodes.end(), [](CNode* n) {return n->ssl != NULL;})));
obj.push_back(Pair("proxy", (proxy.IsValid() ? proxy.proxy.ToStringIPPort() : string())));
obj.push_back(Pair("difficulty", (double)GetDifficulty()));
obj.push_back(Pair("testnet", Params().TestnetToBeDeprecatedFieldRPC()));

2
src/rpcnet.cpp

@ -417,6 +417,7 @@ UniValue getnetworkinfo(const UniValue& params, bool fHelp)
" \"localservices\": \"xxxxxxxxxxxxxxxx\", (string) the services we offer to the network\n"
" \"timeoffset\": xxxxx, (numeric) the time offset\n"
" \"connections\": xxxxx, (numeric) the number of connections\n"
" \"tls_connections\": xxxxx, (numeric) the number of TLS connections\n"
" \"tls_cert_verified\": true|flase, (boolean) true if the certificate of the current node is verified\n"
" \"networks\": [ (array) information per network\n"
" {\n"
@ -453,6 +454,7 @@ UniValue getnetworkinfo(const UniValue& params, bool fHelp)
obj.push_back(Pair("localservices", strprintf("%016x", nLocalServices)));
obj.push_back(Pair("timeoffset", GetTimeOffset()));
obj.push_back(Pair("connections", (int)vNodes.size()));
obj.push_back(Pair("tls_connections", (int)std::count_if(vNodes.begin(), vNodes.end(), [](CNode* n) {return n->ssl != NULL;})));
obj.push_back(Pair("tls_cert_verified", ValidateCertificate(tls_ctx_server)));
obj.push_back(Pair("networks", GetNetworksInfo()));
obj.push_back(Pair("relayfee", ValueFromAmount(::minRelayTxFee.GetFeePerK())));

Loading…
Cancel
Save