From 303855f59a2b8ccbecf00a60a19354157e5af8e3 Mon Sep 17 00:00:00 2001 From: orignal Date: Mon, 24 Feb 2014 22:28:28 -0500 Subject: [PATCH] show SSU sessions --- HTTPServer.cpp | 11 +++++++++++ SSU.h | 6 +++++- Transports.h | 1 + 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/HTTPServer.cpp b/HTTPServer.cpp index 833dca51..a27992ba 100644 --- a/HTTPServer.cpp +++ b/HTTPServer.cpp @@ -144,6 +144,7 @@ namespace util } s << "

Transports

"; + s << "NTCP
"; for (auto it: i2p::transports.GetNTCPSessions ()) { // RouterInfo of incoming connection doesn't have address @@ -157,6 +158,16 @@ namespace util s << "
"; } } + auto ssuServer = i2p::transports.GetSSUServer (); + if (ssuServer) + { + s << "
SSU
"; + for (auto it: ssuServer->GetSessions ()) + { + auto endpoint = it.second->GetRemoteEndpoint (); + s << endpoint.address ().to_string () << ":" << endpoint.port () << "
"; + } + } s << "

Flibusta

"; } diff --git a/SSU.h b/SSU.h index f5efc862..ff08f1f1 100644 --- a/SSU.h +++ b/SSU.h @@ -74,7 +74,7 @@ namespace ssu void Close (); boost::asio::ip::udp::endpoint& GetRemoteEndpoint () { return m_RemoteEndpoint; }; void SendI2NPMessage (I2NPMessage * msg); - + private: void CreateAESandMacKey (uint8_t * pubKey, uint8_t * aesKey, uint8_t * macKey); @@ -141,6 +141,10 @@ namespace ssu boost::asio::ip::udp::endpoint m_SenderEndpoint; uint8_t m_ReceiveBuffer[2*SSU_MTU]; std::map m_Sessions; + + public: + // for HTTP only + const decltype(m_Sessions)& GetSessions () const { return m_Sessions; }; }; } } diff --git a/Transports.h b/Transports.h index 12bd8f21..aedd51b2 100644 --- a/Transports.h +++ b/Transports.h @@ -58,6 +58,7 @@ namespace i2p // for HTTP only const decltype(m_NTCPSessions)& GetNTCPSessions () const { return m_NTCPSessions; }; + const i2p::ssu::SSUServer * GetSSUServer () const { return m_SSUServer; }; }; extern Transports transports;