|
|
|
@ -20,6 +20,7 @@
|
|
|
|
|
#include <util/translation.h>
|
|
|
|
|
#include <util/url.h>
|
|
|
|
|
|
|
|
|
|
#include <algorithm>
|
|
|
|
|
#include <functional>
|
|
|
|
|
#include <memory>
|
|
|
|
|
#include <stdio.h>
|
|
|
|
@ -455,12 +456,16 @@ public:
|
|
|
|
|
|
|
|
|
|
// Report local addresses, ports, and scores.
|
|
|
|
|
result += "\nLocal addresses";
|
|
|
|
|
const UniValue& local_addrs{networkinfo["localaddresses"]};
|
|
|
|
|
const std::vector<UniValue>& local_addrs{networkinfo["localaddresses"].getValues()};
|
|
|
|
|
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());
|
|
|
|
|
size_t max_addr_size{0};
|
|
|
|
|
for (const UniValue& addr : local_addrs) {
|
|
|
|
|
max_addr_size = std::max(addr["address"].get_str().length() + 1, max_addr_size);
|
|
|
|
|
}
|
|
|
|
|
for (const UniValue& addr : local_addrs) {
|
|
|
|
|
result += strprintf("\n%-*s port %6i score %6i", max_addr_size, addr["address"].get_str(), addr["port"].get_int(), addr["score"].get_int());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|