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

Function ShowTunnels

daemon/HTTPServer.cpp:767–818  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

765 }
766
767 void ShowTunnels (std::stringstream& s)
768 {
769 s << "<b>" << tr("Tunnels") << ":</b><br>\r\n";
770 s << "<b>" << tr("Queue size") << ":</b> " << i2p::tunnel::tunnels.GetQueueSize () << "<br>\r\n<br>\r\n";
771 s << "<b>" << tr("TBM Queue size") << ":</b> " << i2p::tunnel::tunnels.GetTBMQueueSize () << "<br>\r\n<br>\r\n";
772
773 auto ExplPool = i2p::tunnel::tunnels.GetExploratoryPool ();
774
775 s << "<b>" << tr("Inbound tunnels") << ":</b><br>\r\n<div class=\"list\">\r\n";
776 for (auto & it : i2p::tunnel::tunnels.GetInboundTunnels ()) {
777 s << "<div class=\"listitem\">";
778 if (it->GetNumHops ())
779 {
780 it->VisitTunnelHops(
781 [&s](std::shared_ptr<const i2p::data::IdentityEx> hopIdent)
782 {
783 s << "&#8658; ";
784 ShowHop(s, *hopIdent);
785 s << " ";
786 }
787 );
788 }
789 s << "&#8658; " << it->GetTunnelID () << ":me";
790 if (it->LatencyIsKnown())
791 s << " ( " << tr("%dms", it->GetMeanLatency()) << " )";
792 ShowTunnelDetails(s, it->GetState (), (it->GetTunnelPool () == ExplPool), it->GetNumReceivedBytes ());
793 s << "</div>\r\n";
794 }
795 s << "</div>\r\n<br>\r\n";
796 s << "<b>" << tr("Outbound tunnels") << ":</b><br>\r\n<div class=\"list\">\r\n";
797 for (auto & it : i2p::tunnel::tunnels.GetOutboundTunnels ()) {
798 s << "<div class=\"listitem\">";
799 s << it->GetTunnelID () << ":me &#8658;";
800 // for each tunnel hop if not zero-hop
801 if (it->GetNumHops ())
802 {
803 it->VisitTunnelHops(
804 [&s](std::shared_ptr<const i2p::data::IdentityEx> hopIdent)
805 {
806 s << " ";
807 ShowHop(s, *hopIdent);
808 s << " &#8658;";
809 }
810 );
811 }
812 if (it->LatencyIsKnown())
813 s << " ( " << tr("%dms", it->GetMeanLatency()) << " )";
814 ShowTunnelDetails(s, it->GetState (), (it->GetTunnelPool () == ExplPool), it->GetNumSentBytes ());
815 s << "</div>\r\n";
816 }
817 s << "</div>\r\n<br>\r\n";
818 }
819
820 static void ShowCommands (std::stringstream& s, uint32_t token)
821 {

Callers 1

HandlePageMethod · 0.85

Calls 15

trFunction · 0.85
ShowHopFunction · 0.85
ShowTunnelDetailsFunction · 0.85
GetQueueSizeMethod · 0.80
GetTBMQueueSizeMethod · 0.80
GetExploratoryPoolMethod · 0.80
GetInboundTunnelsMethod · 0.80
VisitTunnelHopsMethod · 0.80
LatencyIsKnownMethod · 0.80
GetMeanLatencyMethod · 0.80
GetNumHopsMethod · 0.45
GetTunnelIDMethod · 0.45

Tested by

no test coverage detected