mirror of
https://github.com/PurpleI2P/i2pd
synced 2024-11-10 00:00:29 +03:00
ipv4 only
This commit is contained in:
parent
ddb9a6b477
commit
fcad819074
@ -265,22 +265,28 @@ namespace data
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RouterInfo::IsNTCP () const
|
bool RouterInfo::IsNTCP (bool v4only) const
|
||||||
{
|
{
|
||||||
for (auto& address : m_Addresses)
|
for (auto& address : m_Addresses)
|
||||||
{
|
{
|
||||||
if (address.transportStyle == eTransportNTCP)
|
if (address.transportStyle == eTransportNTCP)
|
||||||
return true;
|
{
|
||||||
|
if (!v4only || address.host.is_v4 ())
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
RouterInfo::Address * RouterInfo::GetNTCPAddress ()
|
RouterInfo::Address * RouterInfo::GetNTCPAddress (bool v4only)
|
||||||
{
|
{
|
||||||
for (auto& address : m_Addresses)
|
for (auto& address : m_Addresses)
|
||||||
{
|
{
|
||||||
if (address.transportStyle == eTransportNTCP)
|
if (address.transportStyle == eTransportNTCP)
|
||||||
return &address;
|
{
|
||||||
|
if (!v4only || address.host.is_v4 ())
|
||||||
|
return &address;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
@ -45,14 +45,14 @@ namespace data
|
|||||||
const char * GetIdentHashAbbreviation () const { return m_IdentHashAbbreviation; };
|
const char * GetIdentHashAbbreviation () const { return m_IdentHashAbbreviation; };
|
||||||
uint64_t GetTimestamp () const { return m_Timestamp; };
|
uint64_t GetTimestamp () const { return m_Timestamp; };
|
||||||
const std::vector<Address>& GetAddresses () const { return m_Addresses; };
|
const std::vector<Address>& GetAddresses () const { return m_Addresses; };
|
||||||
Address * GetNTCPAddress ();
|
Address * GetNTCPAddress (bool v4only = true);
|
||||||
const RoutingKey& GetRoutingKey () const { return m_RoutingKey; };
|
const RoutingKey& GetRoutingKey () const { return m_RoutingKey; };
|
||||||
|
|
||||||
void AddNTCPAddress (const char * host, int port);
|
void AddNTCPAddress (const char * host, int port);
|
||||||
void SetProperty (const char * key, const char * value);
|
void SetProperty (const char * key, const char * value);
|
||||||
const char * GetProperty (const char * key) const;
|
const char * GetProperty (const char * key) const;
|
||||||
bool IsFloodfill () const;
|
bool IsFloodfill () const;
|
||||||
bool IsNTCP () const;
|
bool IsNTCP (bool v4only = true) const;
|
||||||
void SetUnreachable (bool unreachable) { m_IsUnreachable = unreachable; };
|
void SetUnreachable (bool unreachable) { m_IsUnreachable = unreachable; };
|
||||||
bool IsUnreachable () const { return m_IsUnreachable; };
|
bool IsUnreachable () const { return m_IsUnreachable; };
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user