| 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 << "⇒ "; |
| 784 | ShowHop(s, *hopIdent); |
| 785 | s << " "; |
| 786 | } |
| 787 | ); |
| 788 | } |
| 789 | s << "⇒ " << 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 ⇒"; |
| 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 << " ⇒"; |
| 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 | { |
no test coverage detected