From 7968279bc2499401ee7acd87e6dfeca2948a8741 Mon Sep 17 00:00:00 2001 From: orignal Date: Mon, 11 Jan 2016 13:48:18 -0500 Subject: [PATCH] send X-I2P-DestHash --- I2PTunnel.cpp | 8 +++++++- I2PTunnel.h | 6 +++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/I2PTunnel.cpp b/I2PTunnel.cpp index db98c7e4..f6f5806f 100644 --- a/I2PTunnel.cpp +++ b/I2PTunnel.cpp @@ -165,7 +165,7 @@ namespace client I2PTunnelConnectionHTTP::I2PTunnelConnectionHTTP (I2PService * owner, std::shared_ptr stream, std::shared_ptr socket, const boost::asio::ip::tcp::endpoint& target, const std::string& host): - I2PTunnelConnection (owner, stream, socket, target), m_Host (host), m_HeaderSent (false) + I2PTunnelConnection (owner, stream, socket, target), m_Host (host), m_HeaderSent (false), m_From (stream->GetRemoteIdentity ()) { } @@ -193,6 +193,12 @@ namespace client else break; } + // add X-I2P fields + if (m_From) + { + m_OutHeader << X_I2P_DEST_HASH << ": " << m_From->GetIdentHash ().ToBase64 () << "\r\n"; + // m_OutHeader << X_I2P_DEST_B64 << ": " << m_From->ToBase64 () << "\r\n"; + } if (endOfHeader) { diff --git a/I2PTunnel.h b/I2PTunnel.h index 0ca3d674..a0716897 100644 --- a/I2PTunnel.h +++ b/I2PTunnel.h @@ -19,7 +19,10 @@ namespace client const size_t I2P_TUNNEL_CONNECTION_BUFFER_SIZE = 8192; const int I2P_TUNNEL_CONNECTION_MAX_IDLE = 3600; // in seconds const int I2P_TUNNEL_DESTINATION_REQUEST_TIMEOUT = 10; // in seconds - + // for HTTP tunnels + const char X_I2P_DEST_HASH[] = "X-I2P-DestHash"; // hash in base64 + //const char X_I2P_DEST_B64[] = "X-I2P-DestB64"; // full address in base64 + //const char X_I2P_DEST_B32[] = "X-I2P-DestB32"; // full address in base32 class I2PTunnelConnection: public I2PServiceHandler, public std::enable_shared_from_this { @@ -74,6 +77,7 @@ namespace client std::string m_Host; std::stringstream m_InHeader, m_OutHeader; bool m_HeaderSent; + std::shared_ptr m_From; }; class I2PClientTunnel: public TCPIPAcceptor