mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-03-21 16:49:10 +01:00
http server tunnel added
This commit is contained in:
parent
4f2f67d5b1
commit
019af7bd3a
4 changed files with 16 additions and 2 deletions
|
@ -295,7 +295,7 @@ namespace client
|
||||||
LogPrint (eLogError, "I2P client tunnel with port ", port, " already exists");
|
LogPrint (eLogError, "I2P client tunnel with port ", port, " already exists");
|
||||||
numClientTunnels++;
|
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
|
// mandatory params
|
||||||
std::string host = section.second.get<std::string> (I2P_SERVER_TUNNEL_HOST);
|
std::string host = section.second.get<std::string> (I2P_SERVER_TUNNEL_HOST);
|
||||||
|
@ -306,7 +306,7 @@ namespace client
|
||||||
std::string accessList = section.second.get (I2P_SERVER_TUNNEL_ACCESS_LIST, "");
|
std::string accessList = section.second.get (I2P_SERVER_TUNNEL_ACCESS_LIST, "");
|
||||||
|
|
||||||
auto localDestination = LoadLocalDestination (keys, true);
|
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)
|
if (accessList.length () > 0)
|
||||||
{
|
{
|
||||||
std::set<i2p::data::IdentHash> idents;
|
std::set<i2p::data::IdentHash> idents;
|
||||||
|
|
|
@ -20,6 +20,7 @@ namespace client
|
||||||
const char I2P_TUNNELS_SECTION_TYPE[] = "type";
|
const char I2P_TUNNELS_SECTION_TYPE[] = "type";
|
||||||
const char I2P_TUNNELS_SECTION_TYPE_CLIENT[] = "client";
|
const char I2P_TUNNELS_SECTION_TYPE_CLIENT[] = "client";
|
||||||
const char I2P_TUNNELS_SECTION_TYPE_SERVER[] = "server";
|
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_PORT[] = "port";
|
||||||
const char I2P_CLIENT_TUNNEL_DESTINATION[] = "destination";
|
const char I2P_CLIENT_TUNNEL_DESTINATION[] = "destination";
|
||||||
const char I2P_CLIENT_TUNNEL_KEYS[] = "keys";
|
const char I2P_CLIENT_TUNNEL_KEYS[] = "keys";
|
||||||
|
|
|
@ -309,5 +309,10 @@ namespace client
|
||||||
conn->Connect ();
|
conn->Connect ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
I2PServerTunnelHTTP::I2PServerTunnelHTTP (const std::string& host, int port, std::shared_ptr<ClientDestination> localDestination, int inport):
|
||||||
|
I2PServerTunnel (host, port, localDestination, inport)
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,6 +104,14 @@ namespace client
|
||||||
std::set<i2p::data::IdentHash> m_AccessList;
|
std::set<i2p::data::IdentHash> m_AccessList;
|
||||||
bool m_IsAccessList;
|
bool m_IsAccessList;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class I2PServerTunnelHTTP: public I2PServerTunnel
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
I2PServerTunnelHTTP (const std::string& host, int port,
|
||||||
|
std::shared_ptr<ClientDestination> localDestination, int inport = 0);
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue