mirror of
https://github.com/PurpleI2P/i2pd
synced 2024-11-10 00:00:29 +03:00
use addresses in server tunnel configuration
This commit is contained in:
parent
8a3c276e66
commit
68834df271
@ -272,9 +272,21 @@ namespace client
|
|||||||
|
|
||||||
void I2PServerTunnel::Start ()
|
void I2PServerTunnel::Start ()
|
||||||
{
|
{
|
||||||
m_Endpoint.address (boost::asio::ip::address::from_string (m_Address));
|
m_Endpoint.port (m_Port);
|
||||||
m_Endpoint.port (m_Port);
|
boost::system::error_code ec;
|
||||||
Accept ();
|
auto addr = boost::asio::ip::address::from_string (m_Address, ec);
|
||||||
|
if (!ec)
|
||||||
|
{
|
||||||
|
m_Endpoint.address (addr);
|
||||||
|
Accept ();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
auto resolver = std::make_shared<boost::asio::ip::tcp::resolver>(GetService ());
|
||||||
|
resolver->async_resolve (boost::asio::ip::tcp::resolver::query (m_Address, ""),
|
||||||
|
std::bind (&I2PServerTunnel::HandleResolve, this,
|
||||||
|
std::placeholders::_1, std::placeholders::_2, resolver));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void I2PServerTunnel::Stop ()
|
void I2PServerTunnel::Stop ()
|
||||||
@ -282,6 +294,20 @@ namespace client
|
|||||||
ClearHandlers ();
|
ClearHandlers ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void I2PServerTunnel::HandleResolve (const boost::system::error_code& ecode, boost::asio::ip::tcp::resolver::iterator it,
|
||||||
|
std::shared_ptr<boost::asio::ip::tcp::resolver> resolver)
|
||||||
|
{
|
||||||
|
if (!ecode)
|
||||||
|
{
|
||||||
|
auto addr = (*it).endpoint ().address ();
|
||||||
|
LogPrint (eLogInfo, "server tunnel ", (*it).host_name (), " has been resolved to ", addr);
|
||||||
|
m_Endpoint.address (addr);
|
||||||
|
Accept ();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
LogPrint (eLogError, "Unable to resolve server tunnel address: ", ecode.message ());
|
||||||
|
}
|
||||||
|
|
||||||
void I2PServerTunnel::SetAccessList (const std::set<i2p::data::IdentHash>& accessList)
|
void I2PServerTunnel::SetAccessList (const std::set<i2p::data::IdentHash>& accessList)
|
||||||
{
|
{
|
||||||
m_AccessList = accessList;
|
m_AccessList = accessList;
|
||||||
|
@ -108,6 +108,9 @@ namespace client
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
void HandleResolve (const boost::system::error_code& ecode, boost::asio::ip::tcp::resolver::iterator it,
|
||||||
|
std::shared_ptr<boost::asio::ip::tcp::resolver> resolver);
|
||||||
|
|
||||||
void Accept ();
|
void Accept ();
|
||||||
void HandleAccept (std::shared_ptr<i2p::stream::Stream> stream);
|
void HandleAccept (std::shared_ptr<i2p::stream::Stream> stream);
|
||||||
virtual void CreateI2PConnection (std::shared_ptr<i2p::stream::Stream> stream);
|
virtual void CreateI2PConnection (std::shared_ptr<i2p::stream::Stream> stream);
|
||||||
|
Loading…
Reference in New Issue
Block a user