diff --git a/daemon/HTTPServer.cpp b/daemon/HTTPServer.cpp
index fbaeb773..aa40e16f 100644
--- a/daemon/HTTPServer.cpp
+++ b/daemon/HTTPServer.cpp
@@ -109,6 +109,18 @@ namespace http {
s << seconds << " seconds";
}
+ static void ShowTraffic (std::stringstream& s, uint64_t bytes)
+ {
+ s << std::fixed << std::setprecision(2);
+ auto numKBytes = (double) bytes / 1024;
+ if (numKBytes < 1024)
+ s << numKBytes << " KiB";
+ else if (numKBytes < 1024 * 1024)
+ s << numKBytes / 1024 << " MiB";
+ else
+ s << numKBytes / 1024 / 1024 << " GiB";
+ }
+
static void ShowTunnelDetails (std::stringstream& s, enum i2p::tunnel::TunnelState eState, int bytes)
{
std::string state;
@@ -212,24 +224,14 @@ namespace http {
s << "Family: " << family << "
\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";
+ ShowTraffic (s, i2p::transport::transports.GetTotalReceivedBytes ());
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";
+ ShowTraffic (s, i2p::transport::transports.GetTotalSentBytes ());
s << " (" << (double) i2p::transport::transports.GetOutBandwidth () / 1024 << " KiB/s)
\r\n";
+ s << "Transit: ";
+ ShowTraffic (s, i2p::tunnel::GetTotalTrasitTransmittedBytes ());
+ s << "
\r\n";
s << "Data path: " << i2p::fs::GetDataDir() << "
\r\n";
s << "