mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-12 12:52:35 -03:00
cli: create local addresses, ports, and scores report
This commit is contained in:
parent
d3f77b736e
commit
c227100919
1 changed files with 11 additions and 0 deletions
|
@ -387,6 +387,17 @@ public:
|
|||
result += strprintf("out %5i %5i %5i %5i %5i\n", ipv4_o, ipv6_o, onion_o, total_o, block_relay_o);
|
||||
result += strprintf("total %5i %5i %5i %5i %5i\n", ipv4_i + ipv4_o, ipv6_i + ipv6_o, onion_i + onion_o, total_i + total_o, block_relay_i + block_relay_o);
|
||||
|
||||
// Report local addresses, ports, and scores.
|
||||
result += "\nLocal addresses";
|
||||
const UniValue& local_addrs{networkinfo["localaddresses"]};
|
||||
if (local_addrs.empty()) {
|
||||
result += ": n/a\n";
|
||||
} else {
|
||||
for (const UniValue& addr : local_addrs.getValues()) {
|
||||
result += strprintf("\n%-40i port %5i score %6i", addr["address"].get_str(), addr["port"].get_int(), addr["score"].get_int());
|
||||
}
|
||||
}
|
||||
|
||||
return JSONRPCReplyObj(UniValue{result}, NullUniValue, 1);
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue