diff options
| author | Guillaume Le Vaillant <glv@posteo.net> | 2023-04-14 13:34:30 +0200 |
|---|---|---|
| committer | selsta <selsta@sent.at> | 2026-05-16 02:40:03 +0200 |
| commit | 528cbac17a6c372d1698c82e30df0fdfc78a5ccc (patch) | |
| tree | 00b2446c4c0437900d97fdc05e8d696ffecbd9c2 /src/daemon/rpc_command_executor.cpp | |
| parent | 86f0ed6a89e4c9747f035896ffc218dc73672134 (diff) | |
| download | monzero-core-528cbac17a6c372d1698c82e30df0fdfc78a5ccc.tar.gz monzero-core-528cbac17a6c372d1698c82e30df0fdfc78a5ccc.tar.xz monzero-core-528cbac17a6c372d1698c82e30df0fdfc78a5ccc.zip | |
Show IPv6 addresses in connection list
Diffstat (limited to 'src/daemon/rpc_command_executor.cpp')
| -rw-r--r-- | src/daemon/rpc_command_executor.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/daemon/rpc_command_executor.cpp b/src/daemon/rpc_command_executor.cpp index f0407eece..83620f417 100644 --- a/src/daemon/rpc_command_executor.cpp +++ b/src/daemon/rpc_command_executor.cpp @@ -644,7 +644,14 @@ bool t_rpc_command_executor::print_connections() { } } - tools::msg_writer() << std::setw(30) << std::left << "Remote Host" + auto longest_host = *std::max_element(res.connections.begin(), res.connections.end(), + [](const auto &info1, const auto &info2) + { + return info1.address.length() < info2.address.length(); + }); + int host_field_width = std::max(15, 8 + (int) longest_host.address.length()); + + tools::msg_writer() << std::setw(host_field_width) << std::left << "Remote Host" << std::setw(8) << "Type" << std::setw(6) << "SSL" << std::setw(20) << "Peer id" @@ -661,11 +668,11 @@ bool t_rpc_command_executor::print_connections() { for (auto & info : res.connections) { std::string address = info.incoming ? "INC " : "OUT "; - address += info.ip + ":" + info.port; + address += info.address; //std::string in_out = info.incoming ? "INC " : "OUT "; tools::msg_writer() //<< std::setw(30) << std::left << in_out - << std::setw(30) << std::left << address + << std::setw(host_field_width) << std::left << address << std::setw(8) << (get_address_type_name((epee::net_utils::address_type)info.address_type)) << std::setw(6) << (info.ssl ? "yes" : "no") << std::setw(20) << info.peer_id |
