From 0c9ce6258c1ed9a42190dd98372d30614d44eef4 Mon Sep 17 00:00:00 2001 From: orignal Date: Sun, 24 Jan 2016 09:59:02 -0500 Subject: [PATCH] sockoutproxy params added --- ClientContext.cpp | 4 +++- HTTPProxy.cpp | 5 +++-- SOCKS.cpp | 3 ++- SOCKS.h | 3 ++- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/ClientContext.cpp b/ClientContext.cpp index ef0d58c5..00c98451 100644 --- a/ClientContext.cpp +++ b/ClientContext.cpp @@ -53,8 +53,10 @@ namespace client std::string socksProxyAddr = i2p::util::config::GetArg("-socksproxyaddress", "127.0.0.1"); uint16_t socksProxyPort = i2p::util::config::GetArg("-socksproxyport", 4447); + std::string socksOutProxyAddr = i2p::util::config::GetArg("-socksoutproxyaddress", ""); + uint16_t socksOutProxyPort = i2p::util::config::GetArg("-socksoutproxyport", 0); LogPrint(eLogInfo, "Clients: starting SOCKS Proxy at ", socksProxyAddr, ":", socksProxyPort); - m_SocksProxy = new i2p::proxy::SOCKSProxy(socksProxyAddr, socksProxyPort, localDestination); + m_SocksProxy = new i2p::proxy::SOCKSProxy(socksProxyAddr, socksProxyPort, socksOutProxyAddr, socksOutProxyPort, localDestination); m_SocksProxy->Start(); // I2P tunnels diff --git a/HTTPProxy.cpp b/HTTPProxy.cpp index fcb8674a..b4010a37 100644 --- a/HTTPProxy.cpp +++ b/HTTPProxy.cpp @@ -182,7 +182,8 @@ namespace proxy bool HTTPProxyHandler::HandleData(uint8_t *http_buff, std::size_t len) { - assert(len); // This should always be called with a least a byte left to parse + // TODO: we should srtrip 'Referer' better, because it might be inside message body + /*assert(len); // This should always be called with a least a byte left to parse // remove "Referer" from http requst http_buff[len] = 0; @@ -195,7 +196,7 @@ namespace proxy strncpy(start, end, (char *)(http_buff + len) - end); len -= (end - start); } - } + }*/ while (len > 0) { diff --git a/SOCKS.cpp b/SOCKS.cpp index 3a971a60..27b23df1 100644 --- a/SOCKS.cpp +++ b/SOCKS.cpp @@ -557,7 +557,8 @@ namespace proxy } } - SOCKSServer::SOCKSServer(const std::string& address, int port, std::shared_ptr localDestination) : + SOCKSServer::SOCKSServer(const std::string& address, int port, const std::string& outAddress, int outPort, + std::shared_ptr localDestination) : TCPIPAcceptor (address, port, localDestination ? localDestination : i2p::client::context.GetSharedLocalDestination ()) { } diff --git a/SOCKS.h b/SOCKS.h index cc2cfa24..82f068fb 100644 --- a/SOCKS.h +++ b/SOCKS.h @@ -15,7 +15,8 @@ namespace proxy { public: - SOCKSServer(const std::string& address, int port, std::shared_ptr localDestination = nullptr); + SOCKSServer(const std::string& address, int port, const std::string& outAddress, int outPort, + std::shared_ptr localDestination = nullptr); ~SOCKSServer() {}; protected: