diff --git a/HTTPServer.cpp b/HTTPServer.cpp
index c7b91fd0..98080808 100644
--- a/HTTPServer.cpp
+++ b/HTTPServer.cpp
@@ -230,6 +230,373 @@ namespace http {
{ "stats.i2p", "http://7tbay5p4kzeekxvyvbf6v7eauazemsnnl2aoyqhg5jzpr5eke7tq.b32.i2p/cgi-bin/jump.cgi?a=" },
};
+ void ShowStatus (std::stringstream& s)
+ {
+ s << "Uptime: " << boost::posix_time::to_simple_string (
+ boost::posix_time::time_duration (boost::posix_time::seconds (
+ i2p::context.GetUptime ()))) << "
\r\n";
+ s << "Status: ";
+ switch (i2p::context.GetStatus ())
+ {
+ case eRouterStatusOK: s << "OK"; break;
+ case eRouterStatusTesting: s << "Testing"; break;
+ case eRouterStatusFirewalled: s << "Firewalled"; break;
+ default: s << "Unknown";
+ }
+ s << "
\r\n";
+ s << "Tunnel creation success rate: " << i2p::tunnel::tunnels.GetTunnelCreationSuccessRate () << "%
\r\n";
+ s << "Received: ";
+ s << std::fixed << std::setprecision(2);
+ auto numKBytesReceived = (double) i2p::transport::transports.GetTotalReceivedBytes () / 1024;
+ if (numKBytesReceived < 1024)
+ s << numKBytesReceived << " KiB";
+ else if (numKBytesReceived < 1024 * 1024)
+ s << numKBytesReceived / 1024 << " MiB";
+ else
+ s << numKBytesReceived / 1024 / 1024 << " GiB";
+ s << " (" << (double) i2p::transport::transports.GetInBandwidth () / 1024 << " KiB/s)
\r\n";
+ s << "Sent: ";
+ auto numKBytesSent = (double) i2p::transport::transports.GetTotalSentBytes () / 1024;
+ if (numKBytesSent < 1024)
+ s << numKBytesSent << " KiB";
+ else if (numKBytesSent < 1024 * 1024)
+ s << numKBytesSent / 1024 << " MiB";
+ else
+ s << numKBytesSent / 1024 / 1024 << " GiB";
+ s << " (" << (double) i2p::transport::transports.GetOutBandwidth () / 1024 << " KiB/s)
\r\n";
+ s << "Data path: " << i2p::fs::GetDataDir() << "
\r\n
\r\n";
+ s << "Our external address:" << "
\r\n" ;
+ for (auto address : i2p::context.GetRouterInfo().GetAddresses())
+ {
+ switch (address->transportStyle)
+ {
+ case i2p::data::RouterInfo::eTransportNTCP:
+ if (address->host.is_v6 ())
+ s << "NTCP6 ";
+ else
+ s << "NTCP ";
+ break;
+ case i2p::data::RouterInfo::eTransportSSU:
+ if (address->host.is_v6 ())
+ s << "SSU6 ";
+ else
+ s << "SSU ";
+ break;
+ default:
+ s << "Unknown ";
+ }
+ s << address->host.to_string() << ":" << address->port << "
\r\n";
+ }
+ s << "
\r\nRouters: " << i2p::data::netdb.GetNumRouters () << " ";
+ s << "Floodfills: " << i2p::data::netdb.GetNumFloodfills () << " ";
+ s << "LeaseSets: " << i2p::data::netdb.GetNumLeaseSets () << "
\r\n";
+
+ size_t clientTunnelCount = i2p::tunnel::tunnels.CountOutboundTunnels();
+ clientTunnelCount += i2p::tunnel::tunnels.CountInboundTunnels();
+ size_t transitTunnelCount = i2p::tunnel::tunnels.CountTransitTunnels();
+
+ s << "Client Tunnels: " << std::to_string(clientTunnelCount) << " ";
+ s << "Transit Tunnels: " << std::to_string(transitTunnelCount) << "
\r\n";
+ }
+
+ void ShowJumpServices (std::stringstream& s, const std::string& address)
+ {
+ s << "
| StreamID | "; + s << "Destination | "; + s << "Sent | "; + s << "Received | "; + s << "Out | "; + s << "In | "; + s << "Buf | "; + s << "RTT | "; + s << "Window | "; + s << "Status | "; + s << "
|---|---|---|---|---|---|---|---|---|---|
| " << it->GetSendStreamID () << " | "; + s << "" << i2p::client::context.GetAddressBook ().ToAddress(it->GetRemoteIdentity ()) << " | "; + s << "" << it->GetNumSentBytes () << " | "; + s << "" << it->GetNumReceivedBytes () << " | "; + s << "" << it->GetSendQueueSize () << " | "; + s << "" << it->GetReceiveQueueSize () << " | "; + s << "" << it->GetSendBufferSize () << " | "; + s << "" << it->GetRTT () << " | "; + s << "" << it->GetWindowSize () << " | "; + s << "" << (int)it->GetStatus () << " | "; + s << "
| StreamID | "; - s << "Destination | "; - s << "Sent | "; - s << "Received | "; - s << "Out | "; - s << "In | "; - s << "Buf | "; - s << "RTT | "; - s << "Window | "; - s << "Status | "; - s << "
|---|---|---|---|---|---|---|---|---|---|
| " << it->GetSendStreamID () << " | "; - s << "" << i2p::client::context.GetAddressBook ().ToAddress(it->GetRemoteIdentity ()) << " | "; - s << "" << it->GetNumSentBytes () << " | "; - s << "" << it->GetNumReceivedBytes () << " | "; - s << "" << it->GetSendQueueSize () << " | "; - s << "" << it->GetReceiveQueueSize () << " | "; - s << "" << it->GetSendBufferSize () << " | "; - s << "" << it->GetRTT () << " | "; - s << "" << it->GetWindowSize () << " | "; - s << "" << (int)it->GetStatus () << " | "; - s << "