Browse Source

Allow for I2PTunnels without LocalDestination

pull/128/head
Francisco Blas (klondike) Izquierdo Riera 10 years ago
parent
commit
ccb68088a8
  1. 8
      I2PTunnel.cpp
  2. 4
      I2PTunnel.h

8
I2PTunnel.cpp

@ -139,6 +139,11 @@ namespace client
} }
} }
I2PTunnel::I2PTunnel (ClientDestination * localDestination) :
m_LocalDestination (localDestination ? localDestination :
i2p::client::context.CreateNewLocalDestination (false, I2P_TUNNEL_DEFAULT_KEY_TYPE))
{
}
void I2PTunnel::AddConnection (std::shared_ptr<I2PTunnelConnection> conn) void I2PTunnel::AddConnection (std::shared_ptr<I2PTunnelConnection> conn)
{ {
m_Connections.insert (conn); m_Connections.insert (conn);
@ -155,8 +160,7 @@ namespace client
} }
I2PClientTunnel::I2PClientTunnel (const std::string& destination, int port, ClientDestination * localDestination): I2PClientTunnel::I2PClientTunnel (const std::string& destination, int port, ClientDestination * localDestination):
I2PTunnel (localDestination ? localDestination : I2PTunnel (localDestination),
i2p::client::context.CreateNewLocalDestination (false, i2p::data::SIGNING_KEY_TYPE_ECDSA_SHA256_P256)),
m_Acceptor (GetService (), boost::asio::ip::tcp::endpoint (boost::asio::ip::tcp::v4(), port)), m_Acceptor (GetService (), boost::asio::ip::tcp::endpoint (boost::asio::ip::tcp::v4(), port)),
m_Timer (GetService ()), m_Destination (destination), m_DestinationIdentHash (nullptr), m_Timer (GetService ()), m_Destination (destination), m_DestinationIdentHash (nullptr),
m_RemoteLeaseSet (nullptr) m_RemoteLeaseSet (nullptr)

4
I2PTunnel.h

@ -17,6 +17,7 @@ namespace client
const size_t I2P_TUNNEL_CONNECTION_BUFFER_SIZE = 8192; const size_t I2P_TUNNEL_CONNECTION_BUFFER_SIZE = 8192;
const int I2P_TUNNEL_CONNECTION_MAX_IDLE = 3600; // in seconds const int I2P_TUNNEL_CONNECTION_MAX_IDLE = 3600; // in seconds
const int I2P_TUNNEL_DESTINATION_REQUEST_TIMEOUT = 10; // in seconds const int I2P_TUNNEL_DESTINATION_REQUEST_TIMEOUT = 10; // in seconds
const uint16_t I2P_TUNNEL_DEFAULT_KEY_TYPE = i2p::data::SIGNING_KEY_TYPE_ECDSA_SHA256_P256;
class I2PTunnel; class I2PTunnel;
class I2PTunnelConnection: public std::enable_shared_from_this<I2PTunnelConnection> class I2PTunnelConnection: public std::enable_shared_from_this<I2PTunnelConnection>
@ -58,8 +59,7 @@ namespace client
{ {
public: public:
I2PTunnel (ClientDestination * localDestination): I2PTunnel (ClientDestination * localDestination = nullptr);
m_LocalDestination (localDestination) {};
virtual ~I2PTunnel () { ClearConnections (); }; virtual ~I2PTunnel () { ClearConnections (); };
void AddConnection (std::shared_ptr<I2PTunnelConnection> conn); void AddConnection (std::shared_ptr<I2PTunnelConnection> conn);

Loading…
Cancel
Save