From 019af7bd3a2ac84f688edfef35a402f8a159ed78 Mon Sep 17 00:00:00 2001 From: orignal Date: Wed, 20 May 2015 16:00:09 -0400 Subject: [PATCH] http server tunnel added --- ClientContext.cpp | 4 ++-- ClientContext.h | 1 + I2PTunnel.cpp | 5 +++++ I2PTunnel.h | 8 ++++++++ 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/ClientContext.cpp b/ClientContext.cpp index 4df5fe40..9f14da90 100644 --- a/ClientContext.cpp +++ b/ClientContext.cpp @@ -295,7 +295,7 @@ namespace client LogPrint (eLogError, "I2P client tunnel with port ", port, " already exists"); numClientTunnels++; } - else if (type == I2P_TUNNELS_SECTION_TYPE_SERVER) + else if (type == I2P_TUNNELS_SECTION_TYPE_SERVER || type == I2P_TUNNELS_SECTION_TYPE_HTTP) { // mandatory params std::string host = section.second.get (I2P_SERVER_TUNNEL_HOST); @@ -306,7 +306,7 @@ namespace client std::string accessList = section.second.get (I2P_SERVER_TUNNEL_ACCESS_LIST, ""); auto localDestination = LoadLocalDestination (keys, true); - auto serverTunnel = new I2PServerTunnel (host, port, localDestination, inPort); + I2PServerTunnel * serverTunnel = (type == I2P_TUNNELS_SECTION_TYPE_HTTP) ? new I2PServerTunnelHTTP (host, port, localDestination, inPort) : new I2PServerTunnel (host, port, localDestination, inPort); if (accessList.length () > 0) { std::set idents; diff --git a/ClientContext.h b/ClientContext.h index a034e541..0fe89fb8 100644 --- a/ClientContext.h +++ b/ClientContext.h @@ -20,6 +20,7 @@ namespace client const char I2P_TUNNELS_SECTION_TYPE[] = "type"; const char I2P_TUNNELS_SECTION_TYPE_CLIENT[] = "client"; const char I2P_TUNNELS_SECTION_TYPE_SERVER[] = "server"; + const char I2P_TUNNELS_SECTION_TYPE_HTTP[] = "http"; const char I2P_CLIENT_TUNNEL_PORT[] = "port"; const char I2P_CLIENT_TUNNEL_DESTINATION[] = "destination"; const char I2P_CLIENT_TUNNEL_KEYS[] = "keys"; diff --git a/I2PTunnel.cpp b/I2PTunnel.cpp index 4be5517b..4784f73b 100644 --- a/I2PTunnel.cpp +++ b/I2PTunnel.cpp @@ -309,5 +309,10 @@ namespace client conn->Connect (); } } + + I2PServerTunnelHTTP::I2PServerTunnelHTTP (const std::string& host, int port, std::shared_ptr localDestination, int inport): + I2PServerTunnel (host, port, localDestination, inport) + { + } } } diff --git a/I2PTunnel.h b/I2PTunnel.h index e512a319..e89b9088 100644 --- a/I2PTunnel.h +++ b/I2PTunnel.h @@ -104,6 +104,14 @@ namespace client std::set m_AccessList; bool m_IsAccessList; }; + + class I2PServerTunnelHTTP: public I2PServerTunnel + { + public: + + I2PServerTunnelHTTP (const std::string& host, int port, + std::shared_ptr localDestination, int inport = 0); + }; } }