diff --git a/HTTPServer.cpp b/HTTPServer.cpp index 1bb558e3..2e9a02ca 100644 --- a/HTTPServer.cpp +++ b/HTTPServer.cpp @@ -565,6 +565,32 @@ namespace http { s << ":" << it.second->GetLocalPort (); s << "
\r\n"<< std::endl; } + auto& clientForwards = i2p::client::context.GetClientForwards (); + if (!clientForwards.empty ()) + { + s << "
\r\nClient Forwards:
\r\n
\r\n"; + for (auto& it: clientForwards) + { + auto& ident = it.second->GetLocalDestination ()->GetIdentHash(); + s << ""; + s << it.second->GetName () << " ⇐ "; + s << i2p::client::context.GetAddressBook ().ToAddress(ident); + s << "
\r\n"<< std::endl; + } + } + auto& serverForwards = i2p::client::context.GetServerForwards (); + if (!serverForwards.empty ()) + { + s << "
\r\nServer Forwards:
\r\n
\r\n"; + for (auto& it: serverForwards) + { + auto& ident = it.second->GetLocalDestination ()->GetIdentHash(); + s << ""; + s << it.second->GetName () << " ⇐ "; + s << i2p::client::context.GetAddressBook ().ToAddress(ident); + s << "
\r\n"<< std::endl; + } + } } HTTPConnection::HTTPConnection (std::shared_ptr socket): diff --git a/I2PTunnel.h b/I2PTunnel.h index 2418da30..dce9f812 100644 --- a/I2PTunnel.h +++ b/I2PTunnel.h @@ -197,9 +197,13 @@ namespace client void Start(); const char * GetName() const { return m_Name.c_str(); } std::vector > GetSessions(); + std::shared_ptr GetLocalDestination () const { return m_LocalDest; } + private: + void HandleRecvFromI2P(const i2p::data::IdentityEx& from, uint16_t fromPort, uint16_t toPort, const uint8_t * buf, size_t len); UDPSession * ObtainUDPSession(const i2p::data::IdentityEx& from, uint16_t localPort, uint16_t remotePort); + private: const std::string m_Name; const uint16_t LocalPort; @@ -220,7 +224,11 @@ namespace client void Start(); const char * GetName() const { return m_Name.c_str(); } std::vector > GetSessions(); + bool IsLocalDestination(const i2p::data::IdentHash & destination) const { return destination == m_LocalDest->GetIdentHash(); } + + std::shared_ptr GetLocalDestination () const { return m_LocalDest; } + private: void HandleRecvFromI2P(const i2p::data::IdentityEx& from, uint16_t fromPort, uint16_t toPort, const uint8_t * buf, size_t len); void TryResolving();