mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-28 11:47:48 +02:00
use local destination function through ClientContext
This commit is contained in:
parent
4379f8e5ee
commit
14f4bb8656
8 changed files with 44 additions and 79 deletions
20
I2PTunnel.h
20
I2PTunnel.h
|
@ -10,7 +10,7 @@
|
|||
|
||||
namespace i2p
|
||||
{
|
||||
namespace stream
|
||||
namespace client
|
||||
{
|
||||
const size_t I2P_TUNNEL_CONNECTION_BUFFER_SIZE = 8192;
|
||||
const int I2P_TUNNEL_CONNECTION_MAX_IDLE = 3600; // in seconds
|
||||
|
@ -23,7 +23,7 @@ namespace stream
|
|||
|
||||
I2PTunnelConnection (I2PTunnel * owner, boost::asio::ip::tcp::socket * socket,
|
||||
const i2p::data::LeaseSet * leaseSet);
|
||||
I2PTunnelConnection (I2PTunnel * owner, Stream * stream, boost::asio::ip::tcp::socket * socket,
|
||||
I2PTunnelConnection (I2PTunnel * owner, i2p::stream::Stream * stream, boost::asio::ip::tcp::socket * socket,
|
||||
const boost::asio::ip::tcp::endpoint& target);
|
||||
~I2PTunnelConnection ();
|
||||
|
||||
|
@ -43,7 +43,7 @@ namespace stream
|
|||
|
||||
uint8_t m_Buffer[I2P_TUNNEL_CONNECTION_BUFFER_SIZE], m_StreamBuffer[I2P_TUNNEL_CONNECTION_BUFFER_SIZE];
|
||||
boost::asio::ip::tcp::socket * m_Socket;
|
||||
Stream * m_Stream;
|
||||
i2p::stream::Stream * m_Stream;
|
||||
I2PTunnel * m_Owner;
|
||||
};
|
||||
|
||||
|
@ -51,22 +51,22 @@ namespace stream
|
|||
{
|
||||
public:
|
||||
|
||||
I2PTunnel (boost::asio::io_service& service, StreamingDestination * localDestination):
|
||||
I2PTunnel (boost::asio::io_service& service, i2p::stream::StreamingDestination * localDestination):
|
||||
m_Service (service), m_LocalDestination (localDestination) {};
|
||||
virtual ~I2PTunnel () { ClearConnections (); };
|
||||
|
||||
void AddConnection (I2PTunnelConnection * conn);
|
||||
void RemoveConnection (I2PTunnelConnection * conn);
|
||||
void ClearConnections ();
|
||||
StreamingDestination * GetLocalDestination () { return m_LocalDestination; };
|
||||
void SetLocalDestination (StreamingDestination * dest) { m_LocalDestination = dest; };
|
||||
i2p::stream::StreamingDestination * GetLocalDestination () { return m_LocalDestination; };
|
||||
void SetLocalDestination (i2p::stream::StreamingDestination * dest) { m_LocalDestination = dest; };
|
||||
|
||||
boost::asio::io_service& GetService () { return m_Service; };
|
||||
|
||||
private:
|
||||
|
||||
boost::asio::io_service& m_Service;
|
||||
StreamingDestination * m_LocalDestination;
|
||||
i2p::stream::StreamingDestination * m_LocalDestination;
|
||||
std::set<I2PTunnelConnection *> m_Connections;
|
||||
};
|
||||
|
||||
|
@ -75,7 +75,7 @@ namespace stream
|
|||
public:
|
||||
|
||||
I2PClientTunnel (boost::asio::io_service& service, const std::string& destination, int port,
|
||||
StreamingDestination * localDestination = nullptr);
|
||||
i2p::stream::StreamingDestination * localDestination = nullptr);
|
||||
~I2PClientTunnel ();
|
||||
|
||||
void Start ();
|
||||
|
@ -102,7 +102,7 @@ namespace stream
|
|||
public:
|
||||
|
||||
I2PServerTunnel (boost::asio::io_service& service, const std::string& address, int port,
|
||||
StreamingDestination * localDestination);
|
||||
i2p::stream::StreamingDestination * localDestination);
|
||||
|
||||
void Start ();
|
||||
void Stop ();
|
||||
|
@ -110,7 +110,7 @@ namespace stream
|
|||
private:
|
||||
|
||||
void Accept ();
|
||||
void HandleAccept (Stream * stream);
|
||||
void HandleAccept (i2p::stream::Stream * stream);
|
||||
|
||||
private:
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue