|
|
|
@ -107,6 +107,18 @@ namespace client
@@ -107,6 +107,18 @@ namespace client
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void I2PTunnelConnection::Connect (const boost::asio::ip::address& localAddress) |
|
|
|
|
{ |
|
|
|
|
if (m_Socket) |
|
|
|
|
{ |
|
|
|
|
boost::system::error_code ec; |
|
|
|
|
m_Socket->bind (boost::asio::ip::tcp::endpoint (localAddress, 0), ec); |
|
|
|
|
if (ec) |
|
|
|
|
LogPrint (eLogError, "I2PTunnel: can't bind to ", localAddress.to_string (), ": ", ec.message ()); |
|
|
|
|
} |
|
|
|
|
Connect (false); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void I2PTunnelConnection::Terminate () |
|
|
|
|
{ |
|
|
|
|
if (Kill()) return; |
|
|
|
@ -600,6 +612,16 @@ namespace client
@@ -600,6 +612,16 @@ namespace client
|
|
|
|
|
m_IsAccessList = true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void I2PServerTunnel::SetLocalAddress (const std::string& localAddress) |
|
|
|
|
{ |
|
|
|
|
boost::system::error_code ec; |
|
|
|
|
auto addr = boost::asio::ip::address::from_string(localAddress, ec); |
|
|
|
|
if (!ec) |
|
|
|
|
m_LocalAddress.reset (new boost::asio::ip::address (addr)); |
|
|
|
|
else |
|
|
|
|
LogPrint (eLogError, "I2PTunnel: can't set local address ", localAddress); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void I2PServerTunnel::Accept () |
|
|
|
|
{ |
|
|
|
|
if (m_PortDestination) |
|
|
|
@ -631,6 +653,9 @@ namespace client
@@ -631,6 +653,9 @@ namespace client
|
|
|
|
|
// new connection
|
|
|
|
|
auto conn = CreateI2PConnection (stream); |
|
|
|
|
AddHandler (conn); |
|
|
|
|
if (m_LocalAddress) |
|
|
|
|
conn->Connect (*m_LocalAddress); |
|
|
|
|
else |
|
|
|
|
conn->Connect (m_IsUniqueLocal); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|