mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-29 04:07:49 +02:00
Merge branch 'PurpleI2P:openssl' into ui
This commit is contained in:
commit
98eadf6f78
2 changed files with 45 additions and 2 deletions
|
@ -555,7 +555,10 @@ namespace net
|
||||||
static const std::vector< std::pair<boost::asio::ip::address_v6::bytes_type, boost::asio::ip::address_v6::bytes_type> > reservedIPv6Ranges {
|
static const std::vector< std::pair<boost::asio::ip::address_v6::bytes_type, boost::asio::ip::address_v6::bytes_type> > reservedIPv6Ranges {
|
||||||
address_pair_v6("2001:db8::", "2001:db8:ffff:ffff:ffff:ffff:ffff:ffff"),
|
address_pair_v6("2001:db8::", "2001:db8:ffff:ffff:ffff:ffff:ffff:ffff"),
|
||||||
address_pair_v6("fc00::", "fdff:ffff:ffff:ffff:ffff:ffff:ffff:ffff"),
|
address_pair_v6("fc00::", "fdff:ffff:ffff:ffff:ffff:ffff:ffff:ffff"),
|
||||||
address_pair_v6("fe80::", "febf:ffff:ffff:ffff:ffff:ffff:ffff:ffff")
|
address_pair_v6("fe80::", "febf:ffff:ffff:ffff:ffff:ffff:ffff:ffff"),
|
||||||
|
address_pair_v6("ff00::", "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff"),
|
||||||
|
address_pair_v6("::", "::"),
|
||||||
|
address_pair_v6("::1", "::1")
|
||||||
};
|
};
|
||||||
|
|
||||||
boost::asio::ip::address_v6::bytes_type ipv6_address = host.to_v6 ().to_bytes ();
|
boost::asio::ip::address_v6::bytes_type ipv6_address = host.to_v6 ().to_bytes ();
|
||||||
|
|
|
@ -605,7 +605,47 @@ namespace client
|
||||||
{
|
{
|
||||||
if (!ecode)
|
if (!ecode)
|
||||||
{
|
{
|
||||||
auto addr = (*it).endpoint ().address ();
|
bool found = false;
|
||||||
|
boost::asio::ip::tcp::endpoint ep;
|
||||||
|
if (m_LocalAddress)
|
||||||
|
{
|
||||||
|
boost::asio::ip::tcp::resolver::iterator end;
|
||||||
|
while (it != end)
|
||||||
|
{
|
||||||
|
ep = *it;
|
||||||
|
if (!ep.address ().is_unspecified ())
|
||||||
|
{
|
||||||
|
if (ep.address ().is_v4 ())
|
||||||
|
{
|
||||||
|
if (m_LocalAddress->is_v4 ()) found = true;
|
||||||
|
}
|
||||||
|
else if (ep.address ().is_v6 ())
|
||||||
|
{
|
||||||
|
if (i2p::util::net::IsYggdrasilAddress (ep.address ()))
|
||||||
|
{
|
||||||
|
if (i2p::util::net::IsYggdrasilAddress (*m_LocalAddress))
|
||||||
|
found = true;
|
||||||
|
}
|
||||||
|
else if (m_LocalAddress->is_v6 ())
|
||||||
|
found = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (found) break;
|
||||||
|
it++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
found = true;
|
||||||
|
ep = *it; // first available
|
||||||
|
}
|
||||||
|
if (!found)
|
||||||
|
{
|
||||||
|
LogPrint (eLogError, "I2PTunnel: Unable to resolve to compatible address");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto addr = ep.address ();
|
||||||
LogPrint (eLogInfo, "I2PTunnel: server tunnel ", (*it).host_name (), " has been resolved to ", addr);
|
LogPrint (eLogInfo, "I2PTunnel: server tunnel ", (*it).host_name (), " has been resolved to ", addr);
|
||||||
m_Endpoint.address (addr);
|
m_Endpoint.address (addr);
|
||||||
Accept ();
|
Accept ();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue