MCPcopy Create free account
hub / github.com/PurpleI2P/i2pd / ShowStatus

Function ShowStatus

daemon/HTTPServer.cpp:300–437  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

298 }
299
300 void ShowStatus (std::stringstream& s, bool includeHiddenContent, i2p::http::OutputFormatEnum outputFormat)
301 {
302 s << "<b>" << tr("Uptime") << ":</b> ";
303 ShowUptime(s, i2p::context.GetUptime ());
304 s << "<br>\r\n";
305 if (i2p::context.SupportsV4 () || i2p::context.GetStatus () != eRouterStatusUnknown) // don't show Unknown for ipv6-only
306 {
307 s << "<b>" << tr("Network status") << ":</b> ";
308 ShowNetworkStatus (s, i2p::context.GetStatus (), i2p::context.GetTesting(), i2p::context.GetError ());
309 s << "<br>\r\n";
310 }
311 if (i2p::context.SupportsV6 ())
312 {
313 s << "<b>" << tr("Network status v6") << ":</b> ";
314 ShowNetworkStatus (s, i2p::context.GetStatusV6 (), i2p::context.GetTestingV6(), i2p::context.GetErrorV6 ());
315 s << "<br>\r\n";
316 }
317 auto remains = Daemon.GetGracefulShutdownInterval ();
318 if (remains > 0)
319 {
320 s << "<b>" << tr("Stopping in") << ":</b> ";
321 ShowUptime(s, remains);
322 s << "<br>\r\n";
323 }
324 auto family = i2p::context.GetFamily ();
325 if (family.length () > 0)
326 s << "<b>"<< tr("Family") << ":</b> " << family << "<br>\r\n";
327 s << "<b>" << tr("Tunnel creation success rate") << ":</b> " << i2p::tunnel::tunnels.GetTunnelCreationSuccessRate () << "%<br>\r\n";
328 bool isTotalTCSR;
329 i2p::config::GetOption("http.showTotalTCSR", isTotalTCSR);
330 if (isTotalTCSR) {
331 s << "<b>" << tr("Total tunnel creation success rate") << ":</b> " << i2p::tunnel::tunnels.GetTotalTunnelCreationSuccessRate() << "%<br/>\r\n";
332 }
333 s << std::fixed << std::setprecision(2);
334 /* Kibibyte/s */
335 s << "<b>" << tr("Received") << ":</b> ";
336 ShowTraffic (s, i2p::transport::transports.GetTotalReceivedBytes ());
337 s << " (" << ((double) i2p::transport::transports.GetInBandwidth15s () / 1024) << " KiB/s)" << "<br>\r\n";
338 s << "<b>" << tr("Sent") << ":</b> ";
339 ShowTraffic (s, i2p::transport::transports.GetTotalSentBytes ());
340 s << " (" << ((double) i2p::transport::transports.GetOutBandwidth15s () / 1024) << " KiB/s)" << "<br>\r\n";
341 s << "<b>" << tr("Transit") << ":</b> ";
342 ShowTraffic (s, i2p::transport::transports.GetTotalTransitTransmittedBytes ());
343 s << " (" << ((double) i2p::transport::transports.GetTransitBandwidth15s () / 1024) << " KiB/s)" << "<br>\r\n";
344 s << "<b>" << tr("Data path") << ":</b> " << i2p::fs::GetUTF8DataDir() << "<br>\r\n";
345 s << "<div class='slide'>";
346 if ((outputFormat == OutputFormatEnum::forWebConsole) || !includeHiddenContent) {
347 s << "<label for=\"slide-info\">" << tr("Hidden content. Press on text to see.") << "</label>\r\n";
348 s << "<input type=\"checkbox\" id=\"slide-info\" />\r\n";
349 s << "<div class=\"slidecontent\">\r\n";
350 }
351 if (includeHiddenContent)
352 {
353 s << "<b>" << tr("Router Ident") << ":</b> " << i2p::context.GetRouterInfo().GetIdentHashBase64() << "<br>\r\n";
354 if (!i2p::context.GetRouterInfo().GetProperty("family").empty())
355 s << "<b>" << tr("Router Family") << ":</b> " << i2p::context.GetRouterInfo().GetProperty("family") << "<br>\r\n";
356 s << "<b>" << tr("Router Caps") << ":</b> " << i2p::context.GetRouterInfo().GetProperty("caps") << "<br>\r\n";
357 s << "<b>" << tr("Version") << ":</b> " VERSION "<br>\r\n";

Callers 1

HandleRequestMethod · 0.85

Calls 15

trFunction · 0.85
GetOptionFunction · 0.85
ShowTrafficFunction · 0.85
GetUTF8DataDirFunction · 0.85
to_stringFunction · 0.85
GetUptimeMethod · 0.80
SupportsV4Method · 0.80
GetTestingMethod · 0.80
GetErrorMethod · 0.80
SupportsV6Method · 0.80
GetStatusV6Method · 0.80
GetTestingV6Method · 0.80

Tested by

no test coverage detected