Browse Source

ipv4 only

pull/14/head
orignal 11 years ago
parent
commit
fcad819074
  1. 10
      RouterInfo.cpp
  2. 4
      RouterInfo.h

10
RouterInfo.cpp

@ -265,23 +265,29 @@ namespace data @@ -265,23 +265,29 @@ namespace data
return false;
}
bool RouterInfo::IsNTCP () const
bool RouterInfo::IsNTCP (bool v4only) const
{
for (auto& address : m_Addresses)
{
if (address.transportStyle == eTransportNTCP)
{
if (!v4only || address.host.is_v4 ())
return true;
}
}
return false;
}
RouterInfo::Address * RouterInfo::GetNTCPAddress ()
RouterInfo::Address * RouterInfo::GetNTCPAddress (bool v4only)
{
for (auto& address : m_Addresses)
{
if (address.transportStyle == eTransportNTCP)
{
if (!v4only || address.host.is_v4 ())
return &address;
}
}
return nullptr;
}
}

4
RouterInfo.h

@ -45,14 +45,14 @@ namespace data @@ -45,14 +45,14 @@ namespace data
const char * GetIdentHashAbbreviation () const { return m_IdentHashAbbreviation; };
uint64_t GetTimestamp () const { return m_Timestamp; };
const std::vector<Address>& GetAddresses () const { return m_Addresses; };
Address * GetNTCPAddress ();
Address * GetNTCPAddress (bool v4only = true);
const RoutingKey& GetRoutingKey () const { return m_RoutingKey; };
void AddNTCPAddress (const char * host, int port);
void SetProperty (const char * key, const char * value);
const char * GetProperty (const char * key) const;
bool IsFloodfill () const;
bool IsNTCP () const;
bool IsNTCP (bool v4only = true) const;
void SetUnreachable (bool unreachable) { m_IsUnreachable = unreachable; };
bool IsUnreachable () const { return m_IsUnreachable; };

Loading…
Cancel
Save