From 008fb561b8d8230deeb80998c8ddd8fdf8a825f0 Mon Sep 17 00:00:00 2001 From: weko Date: Mon, 8 May 2023 17:00:50 +0000 Subject: [PATCH] add local address and port to webconsole (issue #1877) --- daemon/HTTPServer.cpp | 24 ++++++++++++++++++------ libi2pd_client/UDPTunnel.h | 1 + 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/daemon/HTTPServer.cpp b/daemon/HTTPServer.cpp index f9b034ae..2a11a1dc 100644 --- a/daemon/HTTPServer.cpp +++ b/daemon/HTTPServer.cpp @@ -977,7 +977,9 @@ namespace http { { auto& ident = it.second->GetLocalDestination ()->GetIdentHash(); s << "
"; - s << it.second->GetName () << " ⇐ "; + s << it.second->GetName () << " "; + s << it.first.address() << ":" << it.first.port(); + s << " ⇒ "; s << i2p::client::context.GetAddressBook ().ToAddress(ident); s << "
\r\n"<< std::endl; } @@ -986,7 +988,9 @@ namespace http { { auto& ident = httpProxy->GetLocalDestination ()->GetIdentHash(); s << "
"; - s << "HTTP " << tr("Proxy") << " ⇐ "; + s << "HTTP " << tr("Proxy") << " "; + s << httpProxy->GetLocalEndpoint().address() << ":" << httpProxy->GetLocalEndpoint().port(); + s << " ⇒ "; s << i2p::client::context.GetAddressBook ().ToAddress(ident); s << "
\r\n"<< std::endl; } @@ -995,7 +999,9 @@ namespace http { { auto& ident = socksProxy->GetLocalDestination ()->GetIdentHash(); s << "
"; - s << "SOCKS " << tr("Proxy") << " ⇐ "; + s << "SOCKS " << tr("Proxy") << " "; + s << httpProxy->GetLocalEndpoint().address() << ":" << httpProxy->GetLocalEndpoint().port(); + s << " ⇒ "; s << i2p::client::context.GetAddressBook ().ToAddress(ident); s << "
\r\n"<< std::endl; } @@ -1008,7 +1014,9 @@ namespace http { { auto& ident = it.second->GetLocalDestination ()->GetIdentHash(); s << "
"; - s << it.second->GetName () << " ⇒ "; + s << it.second->GetName () << " "; + s << it.second->GetEndpoint().address() << ":" << it.second->GetEndpoint().port(); + s << " ⇐ "; s << i2p::client::context.GetAddressBook ().ToAddress(ident); s << ":" << it.second->GetLocalPort (); s << "
\r\n"<< std::endl; @@ -1024,7 +1032,9 @@ namespace http { { auto& ident = it.second->GetLocalDestination ()->GetIdentHash(); s << "
"; - s << it.second->GetName () << " ⇐ "; + s << it.second->GetName () << " "; + s << it.first.address() << ":" << it.first.port(); + s << " ⇒ "; s << i2p::client::context.GetAddressBook ().ToAddress(ident); s << "
\r\n"<< std::endl; } @@ -1038,7 +1048,9 @@ namespace http { { auto& ident = it.second->GetLocalDestination ()->GetIdentHash(); s << "
"; - s << it.second->GetName () << " ⇐ "; + s << it.second->GetName () << " "; + s << it.second->GetEndpoint().address() << ":" << it.second->GetEndpoint().port(); + s << " ⇐ "; s << i2p::client::context.GetAddressBook ().ToAddress(ident); s << "
\r\n"<< std::endl; } diff --git a/libi2pd_client/UDPTunnel.h b/libi2pd_client/UDPTunnel.h index 862ce216..814884ec 100644 --- a/libi2pd_client/UDPTunnel.h +++ b/libi2pd_client/UDPTunnel.h @@ -96,6 +96,7 @@ namespace client const char * GetName () const { return m_Name.c_str(); } std::vector > GetSessions (); std::shared_ptr GetLocalDestination () const { return m_LocalDest; } + const boost::asio::ip::udp::endpoint& GetEndpoint () const { return m_RemoteEndpoint; } void SetUniqueLocal (bool isUniqueLocal = true) { m_IsUniqueLocal = isUniqueLocal; }