@@ -300,8 +300,9 @@ class NetinfoRequestHandler : public BaseRequestHandler
300
300
{
301
301
private:
302
302
static constexpr int8_t UNKNOWN_NETWORK{-1 };
303
- static constexpr uint8_t m_networks_size{3 };
304
- const std::array<std::string, m_networks_size> m_networks{{" ipv4" , " ipv6" , " onion" }};
303
+ static constexpr int8_t NET_I2P{3 }; // pos of "i2p" in m_networks
304
+ static constexpr uint8_t m_networks_size{4 };
305
+ const std::array<std::string, m_networks_size> m_networks{{" ipv4" , " ipv6" , " onion" , " i2p" }};
305
306
std::array<std::array<uint16_t , m_networks_size + 2 >, 3 > m_counts{{{}}}; // !< Peer counts by (in/out/total, networks/total/block-relay)
306
307
uint8_t m_manual_peers_count{0 };
307
308
int8_t NetworkStringToId (const std::string& str) const
@@ -317,6 +318,7 @@ class NetinfoRequestHandler : public BaseRequestHandler
317
318
bool IsAddressSelected () const { return m_details_level == 2 || m_details_level == 4 ; }
318
319
bool IsVersionSelected () const { return m_details_level == 3 || m_details_level == 4 ; }
319
320
bool m_is_asmap_on{false };
321
+ bool m_is_i2p_on{false };
320
322
size_t m_max_addr_length{0 };
321
323
size_t m_max_age_length{3 };
322
324
size_t m_max_id_length{2 };
@@ -468,6 +470,7 @@ class NetinfoRequestHandler : public BaseRequestHandler
468
470
const std::string network{peer[" network" ].get_str ()};
469
471
const int8_t network_id{NetworkStringToId (network)};
470
472
if (network_id == UNKNOWN_NETWORK) continue ;
473
+ m_is_i2p_on |= (network_id == NET_I2P);
471
474
const bool is_outbound{!peer[" inbound" ].get_bool ()};
472
475
const bool is_block_relay{!peer[" relaytxes" ].get_bool ()};
473
476
const std::string conn_type{peer[" connection_type" ].get_str ()};
@@ -542,11 +545,15 @@ class NetinfoRequestHandler : public BaseRequestHandler
542
545
}
543
546
544
547
// Report peer connection totals by type.
545
- result += " ipv4 ipv6 onion total block" ;
548
+ result += " ipv4 ipv6 onion" ;
549
+ if (m_is_i2p_on) result += " i2p" ;
550
+ result += " total block" ;
546
551
if (m_manual_peers_count) result += " manual" ;
547
552
const std::array<std::string, 3 > rows{{" in" , " out" , " total" }};
548
- for (uint8_t i = 0 ; i < m_networks_size; ++i) {
549
- result += strprintf (" \n %-5s %5i %5i %5i %5i %5i" , rows.at (i), m_counts.at (i).at (0 ), m_counts.at (i).at (1 ), m_counts.at (i).at (2 ), m_counts.at (i).at (m_networks_size), m_counts.at (i).at (m_networks_size + 1 ));
553
+ for (uint8_t i = 0 ; i < 3 ; ++i) {
554
+ result += strprintf (" \n %-5s %5i %5i %5i" , rows.at (i), m_counts.at (i).at (0 ), m_counts.at (i).at (1 ), m_counts.at (i).at (2 )); // ipv4/ipv6/onion peers counts
555
+ if (m_is_i2p_on) result += strprintf (" %5i" , m_counts.at (i).at (3 )); // i2p peers count
556
+ result += strprintf (" %5i %5i" , m_counts.at (i).at (m_networks_size), m_counts.at (i).at (m_networks_size + 1 ));
550
557
if (i == 1 && m_manual_peers_count) result += strprintf (" %5i" , m_manual_peers_count);
551
558
}
552
559
0 commit comments