mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-18 04:19:58 +00:00
check for published ipv4 addresses for floodfills and IBGW
This commit is contained in:
parent
d580c0155a
commit
caff003a85
@ -366,7 +366,7 @@ namespace data
|
|||||||
{
|
{
|
||||||
if (isStaticKey)
|
if (isStaticKey)
|
||||||
{
|
{
|
||||||
if (isHost)
|
if (isHost && address->port)
|
||||||
{
|
{
|
||||||
if (address->host.is_v6 ())
|
if (address->host.is_v6 ())
|
||||||
supportedTransports |= (i2p::util::net::IsYggdrasilAddress (address->host) ? eNTCP2V6Mesh : eNTCP2V6);
|
supportedTransports |= (i2p::util::net::IsYggdrasilAddress (address->host) ? eNTCP2V6Mesh : eNTCP2V6);
|
||||||
@ -374,8 +374,9 @@ namespace data
|
|||||||
supportedTransports |= eNTCP2V4;
|
supportedTransports |= eNTCP2V4;
|
||||||
m_ReachableTransports |= supportedTransports;
|
m_ReachableTransports |= supportedTransports;
|
||||||
}
|
}
|
||||||
else if (!address->published)
|
else
|
||||||
{
|
{
|
||||||
|
address->published = false;
|
||||||
if (address->caps)
|
if (address->caps)
|
||||||
{
|
{
|
||||||
if (address->caps & AddressCaps::eV4) supportedTransports |= eNTCP2V4;
|
if (address->caps & AddressCaps::eV4) supportedTransports |= eNTCP2V4;
|
||||||
@ -982,11 +983,22 @@ namespace data
|
|||||||
|
|
||||||
bool RouterInfo::IsEligibleFloodfill () const
|
bool RouterInfo::IsEligibleFloodfill () const
|
||||||
{
|
{
|
||||||
// floodfill must be reachable by ipv4, >= 0.9.38 and not DSA
|
// floodfill must have published ipv4, >= 0.9.38 and not DSA
|
||||||
return IsReachableBy (eNTCP2V4 | eSSU2V4) && m_Version >= NETDB_MIN_FLOODFILL_VERSION &&
|
return m_Version >= NETDB_MIN_FLOODFILL_VERSION && IsPublished (true) &&
|
||||||
GetIdentity ()->GetSigningKeyType () != SIGNING_KEY_TYPE_DSA_SHA1;
|
GetIdentity ()->GetSigningKeyType () != SIGNING_KEY_TYPE_DSA_SHA1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool RouterInfo::IsPublished (bool v4) const
|
||||||
|
{
|
||||||
|
auto addr = GetAddresses ();
|
||||||
|
if (v4)
|
||||||
|
return ((*addr)[eNTCP2V4] && ((*addr)[eNTCP2V4])->published) ||
|
||||||
|
((*addr)[eSSU2V4] && ((*addr)[eSSU2V4])->published);
|
||||||
|
else
|
||||||
|
return ((*addr)[eNTCP2V6] && ((*addr)[eNTCP2V6])->published) ||
|
||||||
|
((*addr)[eSSU2V6] && ((*addr)[eSSU2V6])->published);
|
||||||
|
}
|
||||||
|
|
||||||
bool RouterInfo::IsSSU2PeerTesting (bool v4) const
|
bool RouterInfo::IsSSU2PeerTesting (bool v4) const
|
||||||
{
|
{
|
||||||
if (!(m_SupportedTransports & (v4 ? eSSU2V4 : eSSU2V6))) return false;
|
if (!(m_SupportedTransports & (v4 ? eSSU2V4 : eSSU2V6))) return false;
|
||||||
|
@ -247,6 +247,7 @@ namespace data
|
|||||||
bool IsHighBandwidth () const { return m_Caps & RouterInfo::eHighBandwidth; };
|
bool IsHighBandwidth () const { return m_Caps & RouterInfo::eHighBandwidth; };
|
||||||
bool IsExtraBandwidth () const { return m_Caps & RouterInfo::eExtraBandwidth; };
|
bool IsExtraBandwidth () const { return m_Caps & RouterInfo::eExtraBandwidth; };
|
||||||
bool IsEligibleFloodfill () const;
|
bool IsEligibleFloodfill () const;
|
||||||
|
bool IsPublished (bool v4) const;
|
||||||
bool IsSSU2PeerTesting (bool v4) const;
|
bool IsSSU2PeerTesting (bool v4) const;
|
||||||
bool IsSSU2Introducer (bool v4) const;
|
bool IsSSU2Introducer (bool v4) const;
|
||||||
bool IsHighCongestion () const;
|
bool IsHighCongestion () const;
|
||||||
|
@ -498,8 +498,7 @@ namespace tunnel
|
|||||||
{
|
{
|
||||||
auto r = i2p::transport::transports.GetRandomPeer (!IsExploratory ());
|
auto r = i2p::transport::transports.GetRandomPeer (!IsExploratory ());
|
||||||
if (r && r->IsECIES () && !r->GetProfile ()->IsBad () &&
|
if (r && r->IsECIES () && !r->GetProfile ()->IsBad () &&
|
||||||
(numHops > 1 || (r->IsV4 () && (!inbound ||
|
(numHops > 1 || (r->IsV4 () && (!inbound || r->IsPublished (true))))) // first inbound must be published ipv4
|
||||||
r->IsReachableBy (i2p::data::RouterInfo::eNTCP2V4 | i2p::data::RouterInfo::eSSU2V4))))) // first inbound must be reachable
|
|
||||||
{
|
{
|
||||||
prevHop = r;
|
prevHop = r;
|
||||||
path.Add (r);
|
path.Add (r);
|
||||||
@ -521,8 +520,7 @@ namespace tunnel
|
|||||||
LogPrint (eLogError, "Tunnels: Can't select next hop for ", prevHop->GetIdentHashBase64 ());
|
LogPrint (eLogError, "Tunnels: Can't select next hop for ", prevHop->GetIdentHashBase64 ());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if ((i == numHops - 1) && (!hop->IsV4 () || (inbound && // doesn't support ipv4
|
if ((i == numHops - 1) && (!hop->IsV4 () || (inbound && !hop->IsPublished (true)))) // IBGW is not published ipv4
|
||||||
!hop->IsReachableBy (i2p::data::RouterInfo::eNTCP2V4 | i2p::data::RouterInfo::eSSU2V4)))) // IBGW is not reachable
|
|
||||||
{
|
{
|
||||||
auto hop1 = nextHop (prevHop, true);
|
auto hop1 = nextHop (prevHop, true);
|
||||||
if (hop1) hop = hop1;
|
if (hop1) hop = hop1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user