mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-09 11:27:53 +00:00
try to connect to introducer through any available address
This commit is contained in:
parent
6caec6b551
commit
457b64f92d
@ -1022,9 +1022,14 @@ namespace data
|
|||||||
bool RouterInfo::IsPublished (bool v4) const
|
bool RouterInfo::IsPublished (bool v4) const
|
||||||
{
|
{
|
||||||
if (m_Caps & (eUnreachable | eHidden)) return false; // if router sets U or H we assume that all addresses are not published
|
if (m_Caps & (eUnreachable | eHidden)) return false; // if router sets U or H we assume that all addresses are not published
|
||||||
return m_PublishedTransports & (v4 ? (eNTCP2V4 | eSSU2V4) : (eNTCP2V6 | eSSU2V6));
|
return IsPublishedOn (v4 ? (eNTCP2V4 | eSSU2V4) : (eNTCP2V6 | eSSU2V6));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool RouterInfo::IsPublishedOn (CompatibleTransports transports) const
|
||||||
|
{
|
||||||
|
return m_PublishedTransports & transports;
|
||||||
|
}
|
||||||
|
|
||||||
bool RouterInfo::IsNAT2NATOnly (const RouterInfo& other) const
|
bool RouterInfo::IsNAT2NATOnly (const RouterInfo& other) const
|
||||||
{
|
{
|
||||||
return !(m_PublishedTransports & other.m_SupportedTransports) &&
|
return !(m_PublishedTransports & other.m_SupportedTransports) &&
|
||||||
|
@ -264,6 +264,7 @@ namespace data
|
|||||||
bool IsEligibleFloodfill () const;
|
bool IsEligibleFloodfill () const;
|
||||||
bool IsDeclaredFloodfill () const { return m_Caps & RouterInfo::eFloodfill; };
|
bool IsDeclaredFloodfill () const { return m_Caps & RouterInfo::eFloodfill; };
|
||||||
bool IsPublished (bool v4) const;
|
bool IsPublished (bool v4) const;
|
||||||
|
bool IsPublishedOn (CompatibleTransports transports) const;
|
||||||
bool IsNAT2NATOnly (const RouterInfo& other) const; // only NAT-to-NAT connection is possible
|
bool IsNAT2NATOnly (const RouterInfo& other) const; // only NAT-to-NAT connection is possible
|
||||||
bool IsSSU2PeerTesting (bool v4) const;
|
bool IsSSU2PeerTesting (bool v4) const;
|
||||||
bool IsSSU2Introducer (bool v4) const;
|
bool IsSSU2Introducer (bool v4) const;
|
||||||
|
@ -810,7 +810,8 @@ namespace transport
|
|||||||
r = i2p::data::netdb.FindRouter (introducer.iH);
|
r = i2p::data::netdb.FindRouter (introducer.iH);
|
||||||
if (r)
|
if (r)
|
||||||
{
|
{
|
||||||
if (r->IsReachableFrom (i2p::context.GetRouterInfo ()))
|
if (r->IsPublishedOn (i2p::context.GetRouterInfo ().GetCompatibleTransports (false) & // outgoing
|
||||||
|
(i2p::data::RouterInfo::eSSU2V4 | i2p::data::RouterInfo::eSSU2V6)))
|
||||||
{
|
{
|
||||||
relayTag = introducer.iTag;
|
relayTag = introducer.iTag;
|
||||||
addr = address->IsV6 () ? r->GetSSU2V6Address () : r->GetSSU2V4Address ();
|
addr = address->IsV6 () ? r->GetSSU2V6Address () : r->GetSSU2V4Address ();
|
||||||
@ -819,9 +820,26 @@ namespace transport
|
|||||||
break;
|
break;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// address is invalid, try next introducer
|
// address is invalid try another SSU2 address if exists
|
||||||
relayTag = 0;
|
if (address->IsV4 ())
|
||||||
addr = nullptr;
|
{
|
||||||
|
if (i2p::context.SupportsV6 ())
|
||||||
|
addr = r->GetSSU2V6Address ();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (i2p::context.SupportsV4 ())
|
||||||
|
addr = r->GetSSU2V4Address ();
|
||||||
|
}
|
||||||
|
if (addr && !addr->host.is_unspecified () && addr->port &&
|
||||||
|
!i2p::transport::transports.IsInReservedRange(addr->host))
|
||||||
|
break;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// all addresses are invalid, try next introducer
|
||||||
|
relayTag = 0;
|
||||||
|
addr = nullptr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user