Browse Source

understandable construction for client tunnels

pull/1928/head
weko 2 years ago
parent
commit
c86a1f63a2
  1. 12
      daemon/HTTPServer.cpp
  2. 2
      libi2pd_client/HTTPProxy.h
  3. 3
      libi2pd_client/I2PService.h
  4. 2
      libi2pd_client/I2PTunnel.h
  5. 2
      libi2pd_client/SOCKS.h
  6. 2
      libi2pd_client/UDPTunnel.h

12
daemon/HTTPServer.cpp

@ -978,9 +978,11 @@ namespace http { @@ -978,9 +978,11 @@ namespace http {
auto& ident = it.second->GetLocalDestination ()->GetIdentHash();
s << "<div class=\"listitem\"><a href=\"" << webroot << "?page=" << HTTP_PAGE_LOCAL_DESTINATION << "&b32=" << ident.ToBase32 () << "\">";
s << it.second->GetName () << "</a> ";
s << i2p::client::context.GetAddressBook ().ToAddress(ident) << "; ";
s << it.first.address() << ":" << it.first.port();
s << " &#8658; ";
s << i2p::client::context.GetAddressBook ().ToAddress(ident);
if (it.second->GetRemoteDestination() != "") // no remote destination for proxy
s << it.second->GetRemoteDestination() << ":" << it.second->GetRemoteDestinationPort();
s << "</div>\r\n"<< std::endl;
}
auto httpProxy = i2p::client::context.GetHttpProxy ();
@ -989,9 +991,9 @@ namespace http { @@ -989,9 +991,9 @@ namespace http {
auto& ident = httpProxy->GetLocalDestination ()->GetIdentHash();
s << "<div class=\"listitem\"><a href=\"" << webroot << "?page=" << HTTP_PAGE_LOCAL_DESTINATION << "&b32=" << ident.ToBase32 () << "\">";
s << "HTTP " << tr("Proxy") << "</a> ";
s << i2p::client::context.GetAddressBook ().ToAddress(ident) << "; ";
s << httpProxy->GetLocalEndpoint().address() << ":" << httpProxy->GetLocalEndpoint().port();
s << " &#8658; ";
s << i2p::client::context.GetAddressBook ().ToAddress(ident);
s << "</div>\r\n"<< std::endl;
}
auto socksProxy = i2p::client::context.GetSocksProxy ();
@ -1000,9 +1002,9 @@ namespace http { @@ -1000,9 +1002,9 @@ namespace http {
auto& ident = socksProxy->GetLocalDestination ()->GetIdentHash();
s << "<div class=\"listitem\"><a href=\"" << webroot << "?page=" << HTTP_PAGE_LOCAL_DESTINATION << "&b32=" << ident.ToBase32 () << "\">";
s << "SOCKS " << tr("Proxy") << "</a> ";
s << i2p::client::context.GetAddressBook ().ToAddress(ident) << "; ";
s << httpProxy->GetLocalEndpoint().address() << ":" << httpProxy->GetLocalEndpoint().port();
s << " &#8658; ";
s << i2p::client::context.GetAddressBook ().ToAddress(ident);
s << "</div>\r\n"<< std::endl;
}
s << "</div>\r\n";
@ -1033,9 +1035,11 @@ namespace http { @@ -1033,9 +1035,11 @@ namespace http {
auto& ident = it.second->GetLocalDestination ()->GetIdentHash();
s << "<div class=\"listitem\"><a href=\"" << webroot << "?page=" << HTTP_PAGE_LOCAL_DESTINATION << "&b32=" << ident.ToBase32 () << "\">";
s << it.second->GetName () << "</a> ";
s << i2p::client::context.GetAddressBook ().ToAddress(ident) << "; ";
s << it.first.address() << ":" << it.first.port();
s << " &#8658; ";
s << i2p::client::context.GetAddressBook ().ToAddress(ident);
if (it.second->GetRemoteDestination() != "") // no remote destination for proxy
s << it.second->GetRemoteDestination() << ":" << it.second->GetRemoteDestinationPort();
s << "</div>\r\n"<< std::endl;
}
s << "</div>\r\n";

2
libi2pd_client/HTTPProxy.h

@ -28,6 +28,8 @@ namespace proxy { @@ -28,6 +28,8 @@ namespace proxy {
// Implements TCPIPAcceptor
std::shared_ptr<i2p::client::I2PServiceHandler> CreateHandler(std::shared_ptr<boost::asio::ip::tcp::socket> socket);
const char* GetName() { return m_Name.c_str (); }
const std::string GetRemoteDestination() { return ""; }
int GetRemoteDestinationPort() { return 0; }
private:

3
libi2pd_client/I2PService.h

@ -67,6 +67,9 @@ namespace client @@ -67,6 +67,9 @@ namespace client
virtual void Stop () = 0;
virtual const char* GetName() { return "Generic I2P Service"; }
virtual const std::string GetRemoteDestination() { return ""; }
virtual int GetRemoteDestinationPort() { return -1; }
private:

2
libi2pd_client/I2PTunnel.h

@ -161,6 +161,8 @@ namespace client @@ -161,6 +161,8 @@ namespace client
void Stop ();
const char* GetName() { return m_Name.c_str (); }
const std::string GetRemoteDestination() { return m_Destination; }
int GetRemoteDestinationPort() { return m_DestinationPort; }
void SetKeepAliveInterval (uint32_t keepAliveInterval);
private:

2
libi2pd_client/SOCKS.h

@ -34,6 +34,8 @@ namespace proxy @@ -34,6 +34,8 @@ namespace proxy
// Implements TCPIPAcceptor
std::shared_ptr<i2p::client::I2PServiceHandler> CreateHandler(std::shared_ptr<boost::asio::ip::tcp::socket> socket);
const char* GetName() { return m_Name.c_str (); }
const std::string GetRemoteDestination() { return ""; }
int GetRemoteDestinationPort() { return 0; }
private:

2
libi2pd_client/UDPTunnel.h

@ -135,6 +135,8 @@ namespace client @@ -135,6 +135,8 @@ namespace client
void Start ();
void Stop ();
const char * GetName () const { return m_Name.c_str(); }
const std::string GetRemoteDestination() { return m_RemoteDest; }
uint16_t GetRemoteDestinationPort() { return RemotePort; }
std::vector<std::shared_ptr<DatagramSessionInfo> > GetSessions ();
bool IsLocalDestination (const i2p::data::IdentHash & destination) const { return destination == m_LocalDest->GetIdentHash(); }

Loading…
Cancel
Save