Browse Source

show proxy tunnel name

pull/1009/head
orignal 7 years ago
parent
commit
7de21c1f93
  1. 9
      libi2pd_client/ClientContext.cpp
  2. 4
      libi2pd_client/HTTPProxy.cpp
  3. 9
      libi2pd_client/HTTPProxy.h
  4. 5
      libi2pd_client/SOCKS.cpp
  5. 6
      libi2pd_client/SOCKS.h

9
libi2pd_client/ClientContext.cpp

@ -71,7 +71,7 @@ namespace client @@ -71,7 +71,7 @@ namespace client
}
try
{
m_HttpProxy = new i2p::proxy::HTTPProxy(httpProxyAddr, httpProxyPort, httpOutProxyURL, localDestination);
m_HttpProxy = new i2p::proxy::HTTPProxy("HTTP Proxy",httpProxyAddr, httpProxyPort, httpOutProxyURL, localDestination);
m_HttpProxy->Start();
}
catch (std::exception& e)
@ -107,7 +107,8 @@ namespace client @@ -107,7 +107,8 @@ namespace client
}
try
{
m_SocksProxy = new i2p::proxy::SOCKSProxy(socksProxyAddr, socksProxyPort, socksOutProxy, socksOutProxyAddr, socksOutProxyPort, localDestination);
m_SocksProxy = new i2p::proxy::SOCKSProxy( "SOCKS", socksProxyAddr, socksProxyPort,
socksOutProxy, socksOutProxyAddr, socksOutProxyPort, localDestination);
m_SocksProxy->Start();
}
catch (std::exception& e)
@ -533,14 +534,14 @@ namespace client @@ -533,14 +534,14 @@ namespace client
if (type == I2P_TUNNELS_SECTION_TYPE_SOCKS)
{
// socks proxy
clientTunnel = new i2p::proxy::SOCKSProxy(address, port, false, "", destinationPort, localDestination);
clientTunnel = new i2p::proxy::SOCKSProxy(name, address, port, false, "", destinationPort, localDestination);
clientEndpoint = ((i2p::proxy::SOCKSProxy*)clientTunnel)->GetLocalEndpoint ();
}
else if (type == I2P_TUNNELS_SECTION_TYPE_HTTPPROXY)
{
// http proxy
std::string outproxy = section.second.get("outproxy", "");
clientTunnel = new i2p::proxy::HTTPProxy(address, port, outproxy, localDestination);
clientTunnel = new i2p::proxy::HTTPProxy(name, address, port, outproxy, localDestination);
clientEndpoint = ((i2p::proxy::HTTPProxy*)clientTunnel)->GetLocalEndpoint ();
}
else if (type == I2P_TUNNELS_SECTION_TYPE_WEBSOCKS)

4
libi2pd_client/HTTPProxy.cpp

@ -582,9 +582,9 @@ namespace proxy { @@ -582,9 +582,9 @@ namespace proxy {
Done (shared_from_this());
}
HTTPProxy::HTTPProxy(const std::string& address, int port, const std::string & outproxy, std::shared_ptr<i2p::client::ClientDestination> localDestination):
HTTPProxy::HTTPProxy(const std::string& name, const std::string& address, int port, const std::string & outproxy, std::shared_ptr<i2p::client::ClientDestination> localDestination):
TCPIPAcceptor(address, port, localDestination ? localDestination : i2p::client::context.GetSharedLocalDestination ()),
m_OutproxyUrl(outproxy)
m_Name (name), m_OutproxyUrl(outproxy)
{
}

9
libi2pd_client/HTTPProxy.h

@ -6,9 +6,9 @@ namespace proxy { @@ -6,9 +6,9 @@ namespace proxy {
class HTTPProxy: public i2p::client::TCPIPAcceptor
{
public:
HTTPProxy(const std::string& address, int port, const std::string & outproxy, std::shared_ptr<i2p::client::ClientDestination> localDestination);
HTTPProxy(const std::string& address, int port, std::shared_ptr<i2p::client::ClientDestination> localDestination = nullptr) :
HTTPProxy(address, port, "", localDestination) {} ;
HTTPProxy(const std::string& name, const std::string& address, int port, const std::string & outproxy, std::shared_ptr<i2p::client::ClientDestination> localDestination);
HTTPProxy(const std::string& name, const std::string& address, int port, std::shared_ptr<i2p::client::ClientDestination> localDestination = nullptr) :
HTTPProxy(name, address, port, "", localDestination) {} ;
~HTTPProxy() {};
std::string GetOutproxyURL() const { return m_OutproxyUrl; }
@ -16,9 +16,10 @@ namespace proxy { @@ -16,9 +16,10 @@ namespace proxy {
protected:
// Implements TCPIPAcceptor
std::shared_ptr<i2p::client::I2PServiceHandler> CreateHandler(std::shared_ptr<boost::asio::ip::tcp::socket> socket);
const char* GetName() { return "HTTP Proxy"; }
const char* GetName() { return m_Name.c_str (); }
private:
std::string m_Name;
std::string m_OutproxyUrl;
};
} // http

5
libi2pd_client/SOCKS.cpp

@ -768,9 +768,10 @@ namespace proxy @@ -768,9 +768,10 @@ namespace proxy
shared_from_this(), std::placeholders::_1, std::placeholders::_2));
}
SOCKSServer::SOCKSServer(const std::string& address, int port, bool outEnable, const std::string& outAddress, uint16_t outPort,
SOCKSServer::SOCKSServer(const std::string& name, const std::string& address, int port,
bool outEnable, const std::string& outAddress, uint16_t outPort,
std::shared_ptr<i2p::client::ClientDestination> localDestination) :
TCPIPAcceptor (address, port, localDestination ? localDestination : i2p::client::context.GetSharedLocalDestination ())
TCPIPAcceptor (address, port, localDestination ? localDestination : i2p::client::context.GetSharedLocalDestination ()), m_Name (name)
{
m_UseUpstreamProxy = false;
if (outAddress.length() > 0 && outEnable)

6
libi2pd_client/SOCKS.h

@ -14,7 +14,7 @@ namespace proxy @@ -14,7 +14,7 @@ namespace proxy
class SOCKSServer: public i2p::client::TCPIPAcceptor
{
public:
SOCKSServer(const std::string& address, int port, bool outEnable, const std::string& outAddress, uint16_t outPort,
SOCKSServer(const std::string& name, const std::string& address, int port, bool outEnable, const std::string& outAddress, uint16_t outPort,
std::shared_ptr<i2p::client::ClientDestination> localDestination = nullptr);
~SOCKSServer() {};
@ -23,9 +23,11 @@ namespace proxy @@ -23,9 +23,11 @@ namespace proxy
protected:
// Implements TCPIPAcceptor
std::shared_ptr<i2p::client::I2PServiceHandler> CreateHandler(std::shared_ptr<boost::asio::ip::tcp::socket> socket);
const char* GetName() { return "SOCKS"; }
const char* GetName() { return m_Name.c_str (); }
private:
std::string m_Name;
std::string m_UpstreamProxyAddress;
uint16_t m_UpstreamProxyPort;
bool m_UseUpstreamProxy;

Loading…
Cancel
Save