Browse Source

show SSU2 transports in web console

pull/1752/head
orignal 3 years ago
parent
commit
4c323a666a
  1. 11
      daemon/HTTPServer.cpp
  2. 5
      libi2pd/SSU2.h
  3. 1
      libi2pd/Transports.h

11
daemon/HTTPServer.cpp

@ -732,7 +732,7 @@ namespace http {
} }
template<typename Sessions> template<typename Sessions>
static void ShowNTCPTransports (std::stringstream& s, const Sessions& sessions, const std::string name) static void ShowTransportSessions (std::stringstream& s, const Sessions& sessions, const std::string name)
{ {
std::stringstream tmp_s, tmp_s6; uint16_t cnt = 0, cnt6 = 0; std::stringstream tmp_s, tmp_s6; uint16_t cnt = 0, cnt6 = 0;
for (const auto& it: sessions ) for (const auto& it: sessions )
@ -782,7 +782,7 @@ namespace http {
{ {
auto sessions = ntcp2Server->GetNTCP2Sessions (); auto sessions = ntcp2Server->GetNTCP2Sessions ();
if (!sessions.empty ()) if (!sessions.empty ())
ShowNTCPTransports (s, sessions, "NTCP2"); ShowTransportSessions (s, sessions, "NTCP2");
} }
auto ssuServer = i2p::transport::transports.GetSSUServer (); auto ssuServer = i2p::transport::transports.GetSSUServer ();
if (ssuServer) if (ssuServer)
@ -824,6 +824,13 @@ namespace http {
s << "</div>\r\n</div>\r\n"; s << "</div>\r\n</div>\r\n";
} }
} }
auto ssu2Server = i2p::transport::transports.GetSSU2Server ();
if (ssu2Server)
{
auto sessions = ssu2Server->GetSSU2Sessions ();
if (!sessions.empty ())
ShowTransportSessions (s, sessions, "SSU2");
}
} }
void ShowSAMSessions (std::stringstream& s) void ShowSAMSessions (std::stringstream& s)

5
libi2pd/SSU2.h

@ -210,6 +210,11 @@ namespace transport
std::map<boost::asio::ip::udp::endpoint, std::pair<uint64_t, uint32_t> > m_IncomingTokens, m_OutgoingTokens; // remote endpoint -> (token, expires in seconds) std::map<boost::asio::ip::udp::endpoint, std::pair<uint64_t, uint32_t> > m_IncomingTokens, m_OutgoingTokens; // remote endpoint -> (token, expires in seconds)
i2p::util::MemoryPoolMt<Packet> m_PacketsPool; i2p::util::MemoryPoolMt<Packet> m_PacketsPool;
boost::asio::deadline_timer m_TerminationTimer; boost::asio::deadline_timer m_TerminationTimer;
public:
// for HTTP/I2PControl
const decltype(m_Sessions)& GetSSU2Sessions () const { return m_Sessions; };
}; };
} }
} }

1
libi2pd/Transports.h

@ -187,6 +187,7 @@ namespace transport
// for HTTP only // for HTTP only
const SSUServer * GetSSUServer () const { return m_SSUServer; }; const SSUServer * GetSSUServer () const { return m_SSUServer; };
const NTCP2Server * GetNTCP2Server () const { return m_NTCP2Server; }; const NTCP2Server * GetNTCP2Server () const { return m_NTCP2Server; };
const SSU2Server * GetSSU2Server () const { return m_SSU2Server; };
const decltype(m_Peers)& GetPeers () const { return m_Peers; }; const decltype(m_Peers)& GetPeers () const { return m_Peers; };
}; };

Loading…
Cancel
Save