diff --git a/HTTPProxy.h b/HTTPProxy.h index 45bbff46..8e348478 100644 --- a/HTTPProxy.h +++ b/HTTPProxy.h @@ -26,7 +26,7 @@ namespace proxy void HandleAccept(const boost::system::error_code& ecode, boost::asio::ip::tcp::socket * socket); public: - HTTPProxyServer(int port) : I2PService(nullptr), + HTTPProxyServer(int port) : I2PService(i2p::data::SIGNING_KEY_TYPE_DSA_SHA1), m_Acceptor (GetService (), boost::asio::ip::tcp::endpoint (boost::asio::ip::tcp::v4(), port)), m_Timer (GetService ()) {}; ~HTTPProxyServer() { Stop(); } diff --git a/I2PService.cpp b/I2PService.cpp index 062713a0..568d03eb 100644 --- a/I2PService.cpp +++ b/I2PService.cpp @@ -16,11 +16,16 @@ namespace client { } - void ClientDestination::CreateStream (StreamRequestComplete streamRequestComplete, const std::string& dest, int port) { + I2PService::I2PService (i2p::data::SigningKeyType kt): + m_LocalDestination (i2p::client::context.CreateNewLocalDestination (false, kt)) + { + } + + void I2PService::CreateStream (StreamRequestComplete streamRequestComplete, const std::string& dest, int port) { assert(streamRequestComplete); i2p::data::IdentHash identHash; if (i2p::client::context.GetAddressBook ().GetIdentHash (dest, identHash)) - localDestination->CreateStream (streamRequestComplete, identHash, port); + m_LocalDestination->CreateStream (streamRequestComplete, identHash, port); else { LogPrint (eLogWarning, "Remote destination ", dest, " not found"); diff --git a/I2PService.h b/I2PService.h index 91835565..5345ab6d 100644 --- a/I2PService.h +++ b/I2PService.h @@ -18,6 +18,7 @@ namespace client { public: I2PService (ClientDestination * localDestination = nullptr); + I2PService (i2p::data::SigningKeyType kt); virtual ~I2PService () { ClearHandlers (); } inline void AddHandler (std::shared_ptr conn) { @@ -53,7 +54,7 @@ namespace client class I2PServiceHandler { public: - I2PServiceHandler(I2PService * parent) : m_Dead(false), m_Service(parent) { } + I2PServiceHandler(I2PService * parent) : m_Service(parent), m_Dead(false) { } virtual ~I2PServiceHandler() { } protected: // Call when terminating or handing over to avoid race conditions diff --git a/SOCKS.cpp b/SOCKS.cpp index 0bc2e051..068b4499 100644 --- a/SOCKS.cpp +++ b/SOCKS.cpp @@ -172,7 +172,7 @@ namespace proxy boost::asio::const_buffers_1 SOCKSHandler::GenerateSOCKS5Response(SOCKSHandler::errTypes error, SOCKSHandler::addrTypes type, const SOCKSHandler::address &addr, uint16_t port) { - size_t size; + size_t size = 6; assert(error <= SOCKS5_ADDR_UNSUP); m_response[0] = '\x05'; //Version m_response[1] = error; //Response code