|
|
@ -103,18 +103,18 @@ namespace http { |
|
|
|
int num; |
|
|
|
int num; |
|
|
|
|
|
|
|
|
|
|
|
if ((num = seconds / 86400) > 0) { |
|
|
|
if ((num = seconds / 86400) > 0) { |
|
|
|
s << num << " " << tr("day", "days", num) << ", "; |
|
|
|
s << ntr("%d day", "%d days", num, num) << ", "; |
|
|
|
seconds -= num * 86400; |
|
|
|
seconds -= num * 86400; |
|
|
|
} |
|
|
|
} |
|
|
|
if ((num = seconds / 3600) > 0) { |
|
|
|
if ((num = seconds / 3600) > 0) { |
|
|
|
s << num << " " << tr("hour", "hours", num) << ", "; |
|
|
|
s << ntr("%d hour", "%d hours", num, num) << ", "; |
|
|
|
seconds -= num * 3600; |
|
|
|
seconds -= num * 3600; |
|
|
|
} |
|
|
|
} |
|
|
|
if ((num = seconds / 60) > 0) { |
|
|
|
if ((num = seconds / 60) > 0) { |
|
|
|
s << num << " " << tr("minute", "minutes", num) << ", "; |
|
|
|
s << ntr("%d minute", "%d minutes", num, num) << ", "; |
|
|
|
seconds -= num * 60; |
|
|
|
seconds -= num * 60; |
|
|
|
} |
|
|
|
} |
|
|
|
s << seconds << " " << tr("second", "seconds", seconds); |
|
|
|
s << ntr("%d second", "%d seconds", seconds, seconds); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static void ShowTraffic (std::stringstream& s, uint64_t bytes) |
|
|
|
static void ShowTraffic (std::stringstream& s, uint64_t bytes) |
|
|
@ -122,11 +122,11 @@ namespace http { |
|
|
|
s << std::fixed << std::setprecision(2); |
|
|
|
s << std::fixed << std::setprecision(2); |
|
|
|
auto numKBytes = (double) bytes / 1024; |
|
|
|
auto numKBytes = (double) bytes / 1024; |
|
|
|
if (numKBytes < 1024) |
|
|
|
if (numKBytes < 1024) |
|
|
|
s << numKBytes << " " << tr(/* tr: Kibibit */ "KiB"); |
|
|
|
s << tr(/* tr: Kibibyte */ "%.2f KiB", numKBytes); |
|
|
|
else if (numKBytes < 1024 * 1024) |
|
|
|
else if (numKBytes < 1024 * 1024) |
|
|
|
s << numKBytes / 1024 << " " << tr(/* tr: Mebibit */ "MiB"); |
|
|
|
s << tr(/* tr: Mebibyte */ "%.2f MiB", numKBytes / 1024); |
|
|
|
else |
|
|
|
else |
|
|
|
s << numKBytes / 1024 / 1024 << " " << tr(/* tr: Gibibit */ "GiB"); |
|
|
|
s << tr(/* tr: Gibibyte */ "%.2f GiB", numKBytes / 1024 / 1024); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static void ShowTunnelDetails (std::stringstream& s, enum i2p::tunnel::TunnelState eState, bool explr, int bytes) |
|
|
|
static void ShowTunnelDetails (std::stringstream& s, enum i2p::tunnel::TunnelState eState, bool explr, int bytes) |
|
|
@ -150,7 +150,7 @@ namespace http { |
|
|
|
else stateText = tr("unknown"); |
|
|
|
else stateText = tr("unknown"); |
|
|
|
|
|
|
|
|
|
|
|
s << "<span class=\"tunnel " << state << "\"> " << stateText << ((explr) ? " (" + tr("exploratory") + ")" : "") << "</span>, "; |
|
|
|
s << "<span class=\"tunnel " << state << "\"> " << stateText << ((explr) ? " (" + tr("exploratory") + ")" : "") << "</span>, "; |
|
|
|
s << " " << (int) (bytes / 1024) << " " << tr(/* tr: Kibibit */ "KiB") << "\r\n"; |
|
|
|
s << " " << tr(/* tr: Kibibit */ "%.2f KiB", (double) bytes / 1024) << "\r\n"; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static void SetLogLevel (const std::string& level) |
|
|
|
static void SetLogLevel (const std::string& level) |
|
|
@ -290,13 +290,13 @@ namespace http { |
|
|
|
s << "<b>" << tr("Tunnel creation success rate") << ":</b> " << i2p::tunnel::tunnels.GetTunnelCreationSuccessRate () << "%<br>\r\n"; |
|
|
|
s << "<b>" << tr("Tunnel creation success rate") << ":</b> " << i2p::tunnel::tunnels.GetTunnelCreationSuccessRate () << "%<br>\r\n"; |
|
|
|
s << "<b>" << tr("Received") << ":</b> "; |
|
|
|
s << "<b>" << tr("Received") << ":</b> "; |
|
|
|
ShowTraffic (s, i2p::transport::transports.GetTotalReceivedBytes ()); |
|
|
|
ShowTraffic (s, i2p::transport::transports.GetTotalReceivedBytes ()); |
|
|
|
s << " (" << (double) i2p::transport::transports.GetInBandwidth15s () / 1024 << " " << tr(/* tr: Kibibit/s */ "KiB/s") << ")<br>\r\n"; |
|
|
|
s << " (" << tr(/* tr: Kibibit/s */ "%.2f KiB/s", (double) i2p::transport::transports.GetInBandwidth15s () / 1024) << ")<br>\r\n"; |
|
|
|
s << "<b>" << tr("Sent") << ":</b> "; |
|
|
|
s << "<b>" << tr("Sent") << ":</b> "; |
|
|
|
ShowTraffic (s, i2p::transport::transports.GetTotalSentBytes ()); |
|
|
|
ShowTraffic (s, i2p::transport::transports.GetTotalSentBytes ()); |
|
|
|
s << " (" << (double) i2p::transport::transports.GetOutBandwidth15s () / 1024 << " " << tr(/* tr: Kibibit/s */ "KiB/s") << ")<br>\r\n"; |
|
|
|
s << " (" << tr(/* tr: Kibibit/s */ "%.2f KiB/s", (double) i2p::transport::transports.GetOutBandwidth15s () / 1024) << ")<br>\r\n"; |
|
|
|
s << "<b>" << tr("Transit") << ":</b> "; |
|
|
|
s << "<b>" << tr("Transit") << ":</b> "; |
|
|
|
ShowTraffic (s, i2p::transport::transports.GetTotalTransitTransmittedBytes ()); |
|
|
|
ShowTraffic (s, i2p::transport::transports.GetTotalTransitTransmittedBytes ()); |
|
|
|
s << " (" << (double) i2p::transport::transports.GetTransitBandwidth15s () / 1024 << " " << tr(/* tr: Kibibit/s */ "KiB/s") << ")<br>\r\n"; |
|
|
|
s << " (" << tr(/* tr: Kibibit/s */ "%.2f KiB/s", (double) i2p::transport::transports.GetTransitBandwidth15s () / 1024) << ")<br>\r\n"; |
|
|
|
s << "<b>" << tr("Data path") << ":</b> " << i2p::fs::GetUTF8DataDir() << "<br>\r\n"; |
|
|
|
s << "<b>" << tr("Data path") << ":</b> " << i2p::fs::GetUTF8DataDir() << "<br>\r\n"; |
|
|
|
s << "<div class='slide'>"; |
|
|
|
s << "<div class='slide'>"; |
|
|
|
if ((outputFormat == OutputFormatEnum::forWebConsole) || !includeHiddenContent) { |
|
|
|
if ((outputFormat == OutputFormatEnum::forWebConsole) || !includeHiddenContent) { |
|
|
@ -338,7 +338,7 @@ namespace http { |
|
|
|
s << "<td>" << address->host.to_string() << ":" << address->port << "</td>\r\n"; |
|
|
|
s << "<td>" << address->host.to_string() << ":" << address->port << "</td>\r\n"; |
|
|
|
else |
|
|
|
else |
|
|
|
{ |
|
|
|
{ |
|
|
|
s << "<td>" << tr("supported"); |
|
|
|
s << "<td>" << tr(/* tr: Shown when router doesn't publish itself and have "Firewalled" state */ "supported"); |
|
|
|
if (address->port) |
|
|
|
if (address->port) |
|
|
|
s << " :" << address->port; |
|
|
|
s << " :" << address->port; |
|
|
|
s << "</td>\r\n"; |
|
|
|
s << "</td>\r\n"; |
|
|
@ -466,7 +466,7 @@ namespace http { |
|
|
|
} |
|
|
|
} |
|
|
|
s << "⇒ " << it->GetTunnelID () << ":me"; |
|
|
|
s << "⇒ " << it->GetTunnelID () << ":me"; |
|
|
|
if (it->LatencyIsKnown()) |
|
|
|
if (it->LatencyIsKnown()) |
|
|
|
s << " ( " << it->GetMeanLatency() << tr(/* tr: Milliseconds */ "ms") << " )"; |
|
|
|
s << " ( " << tr(/* tr: Milliseconds */ "%dms", it->GetMeanLatency()) << " )"; |
|
|
|
ShowTunnelDetails(s, it->GetState (), false, it->GetNumReceivedBytes ()); |
|
|
|
ShowTunnelDetails(s, it->GetState (), false, it->GetNumReceivedBytes ()); |
|
|
|
s << "</div>\r\n"; |
|
|
|
s << "</div>\r\n"; |
|
|
|
} |
|
|
|
} |
|
|
@ -486,22 +486,26 @@ namespace http { |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
if (it->LatencyIsKnown()) |
|
|
|
if (it->LatencyIsKnown()) |
|
|
|
s << " ( " << it->GetMeanLatency() << tr("ms") << " )"; |
|
|
|
s << " ( " << tr("%dms", it->GetMeanLatency()) << " )"; |
|
|
|
ShowTunnelDetails(s, it->GetState (), false, it->GetNumSentBytes ()); |
|
|
|
ShowTunnelDetails(s, it->GetState (), false, it->GetNumSentBytes ()); |
|
|
|
s << "</div>\r\n"; |
|
|
|
s << "</div>\r\n"; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
s << "<br>\r\n"; |
|
|
|
s << "<br>\r\n"; |
|
|
|
|
|
|
|
|
|
|
|
s << "<b>" << tr("Tags") << "</b><br>\r\n" << tr("Incoming") << ": <i>" << dest->GetNumIncomingTags () << "</i><br>\r\n"; |
|
|
|
s << "<b>" << tr("Tags") << "</b><br>\r\n" |
|
|
|
|
|
|
|
<< tr("Incoming") << ": <i>" << dest->GetNumIncomingTags () << "</i><br>\r\n"; |
|
|
|
if (!dest->GetSessions ().empty ()) { |
|
|
|
if (!dest->GetSessions ().empty ()) { |
|
|
|
std::stringstream tmp_s; uint32_t out_tags = 0; |
|
|
|
std::stringstream tmp_s; uint32_t out_tags = 0; |
|
|
|
for (const auto& it: dest->GetSessions ()) { |
|
|
|
for (const auto& it: dest->GetSessions ()) { |
|
|
|
tmp_s << "<tr><td>" << i2p::client::context.GetAddressBook ().ToAddress(it.first) << "</td><td>" << it.second->GetNumOutgoingTags () << "</td></tr>\r\n"; |
|
|
|
tmp_s << "<tr><td>" << i2p::client::context.GetAddressBook ().ToAddress(it.first) << "</td><td>" << it.second->GetNumOutgoingTags () << "</td></tr>\r\n"; |
|
|
|
out_tags += it.second->GetNumOutgoingTags (); |
|
|
|
out_tags += it.second->GetNumOutgoingTags (); |
|
|
|
} |
|
|
|
} |
|
|
|
s << "<div class='slide'><label for='slide-tags'>" << tr("Outgoing") << ": <i>" << out_tags << "</i></label>\r\n<input type=\"checkbox\" id=\"slide-tags\" />\r\n" |
|
|
|
s << "<div class='slide'><label for='slide-tags'>" << tr("Outgoing") << ": <i>" << out_tags << "</i></label>\r\n" |
|
|
|
<< "<div class=\"slidecontent\">\r\n<table>\r\n<thead><th>" << tr("Destination") << "</th><th>" << tr("Amount") << "</th></thead>\r\n<tbody class=\"tableitem\">\r\n" << tmp_s.str () << "</tbody></table>\r\n</div>\r\n</div>\r\n"; |
|
|
|
<< "<input type=\"checkbox\" id=\"slide-tags\" />\r\n" |
|
|
|
|
|
|
|
<< "<div class=\"slidecontent\">\r\n" |
|
|
|
|
|
|
|
<< "<table>\r\n<thead><th>" << tr("Destination") << "</th><th>" << tr("Amount") << "</th></thead>\r\n" |
|
|
|
|
|
|
|
<< "<tbody class=\"tableitem\">\r\n" << tmp_s.str () << "</tbody></table>\r\n</div>\r\n</div>\r\n"; |
|
|
|
} else |
|
|
|
} else |
|
|
|
s << tr("Outgoing") << ": <i>0</i><br>\r\n"; |
|
|
|
s << tr("Outgoing") << ": <i>0</i><br>\r\n"; |
|
|
|
s << "<br>\r\n"; |
|
|
|
s << "<br>\r\n"; |
|
|
@ -516,8 +520,11 @@ namespace http { |
|
|
|
tmp_s << "<tr><td>" << i2p::client::context.GetAddressBook ().ToAddress(it.second->GetDestination ()) << "</td><td>" << it.second->GetState () << "</td></tr>\r\n"; |
|
|
|
tmp_s << "<tr><td>" << i2p::client::context.GetAddressBook ().ToAddress(it.second->GetDestination ()) << "</td><td>" << it.second->GetState () << "</td></tr>\r\n"; |
|
|
|
ecies_sessions++; |
|
|
|
ecies_sessions++; |
|
|
|
} |
|
|
|
} |
|
|
|
s << "<div class='slide'><label for='slide-ecies-sessions'>" << tr("Tags sessions") << ": <i>" << ecies_sessions << "</i></label>\r\n<input type=\"checkbox\" id=\"slide-ecies-sessions\" />\r\n" |
|
|
|
s << "<div class='slide'><label for='slide-ecies-sessions'>" << tr("Tags sessions") << ": <i>" << ecies_sessions << "</i></label>\r\n" |
|
|
|
<< "<div class=\"slidecontent\">\r\n<table>\r\n<thead><th>" << tr("Destination") << "</th><th>" << tr("Status") << "</th></thead>\r\n<tbody class=\"tableitem\">\r\n" << tmp_s.str () << "</tbody></table>\r\n</div>\r\n</div>\r\n"; |
|
|
|
<< "<input type=\"checkbox\" id=\"slide-ecies-sessions\" />\r\n" |
|
|
|
|
|
|
|
<< "<div class=\"slidecontent\">\r\n<table>\r\n" |
|
|
|
|
|
|
|
<< "<thead><th>" << tr("Destination") << "</th><th>" << tr("Status") << "</th></thead>\r\n" |
|
|
|
|
|
|
|
<< "<tbody class=\"tableitem\">\r\n" << tmp_s.str () << "</tbody></table>\r\n</div>\r\n</div>\r\n"; |
|
|
|
} else |
|
|
|
} else |
|
|
|
s << tr("Tags sessions") << ": <i>0</i><br>\r\n"; |
|
|
|
s << tr("Tags sessions") << ": <i>0</i><br>\r\n"; |
|
|
|
s << "<br>\r\n"; |
|
|
|
s << "<br>\r\n"; |
|
|
@ -671,7 +678,7 @@ namespace http { |
|
|
|
} |
|
|
|
} |
|
|
|
s << "⇒ " << it->GetTunnelID () << ":me"; |
|
|
|
s << "⇒ " << it->GetTunnelID () << ":me"; |
|
|
|
if (it->LatencyIsKnown()) |
|
|
|
if (it->LatencyIsKnown()) |
|
|
|
s << " ( " << it->GetMeanLatency() << tr("ms") << " )"; |
|
|
|
s << " ( " << tr("%dms", it->GetMeanLatency()) << " )"; |
|
|
|
ShowTunnelDetails(s, it->GetState (), (it->GetTunnelPool () == ExplPool), it->GetNumReceivedBytes ()); |
|
|
|
ShowTunnelDetails(s, it->GetState (), (it->GetTunnelPool () == ExplPool), it->GetNumReceivedBytes ()); |
|
|
|
s << "</div>\r\n"; |
|
|
|
s << "</div>\r\n"; |
|
|
|
} |
|
|
|
} |
|
|
@ -691,7 +698,7 @@ namespace http { |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
if (it->LatencyIsKnown()) |
|
|
|
if (it->LatencyIsKnown()) |
|
|
|
s << " ( " << it->GetMeanLatency() << tr("ms") << " )"; |
|
|
|
s << " ( " << tr("%dms", it->GetMeanLatency()) << " )"; |
|
|
|
ShowTunnelDetails(s, it->GetState (), (it->GetTunnelPool () == ExplPool), it->GetNumSentBytes ()); |
|
|
|
ShowTunnelDetails(s, it->GetState (), (it->GetTunnelPool () == ExplPool), it->GetNumSentBytes ()); |
|
|
|
s << "</div>\r\n"; |
|
|
|
s << "</div>\r\n"; |
|
|
|
} |
|
|
|
} |
|
|
|