mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-28 11:47:48 +02:00
complete Bob side of NTCP2
This commit is contained in:
parent
07e7c2d852
commit
0ff9c9da27
5 changed files with 109 additions and 59 deletions
|
@ -873,6 +873,7 @@ namespace data
|
|||
|
||||
std::shared_ptr<const RouterInfo::Address> RouterInfo::GetAddress (TransportStyle s, bool v4only, bool v6only) const
|
||||
{
|
||||
// TODO: make it more gereric using comparator
|
||||
#if (BOOST_VERSION >= 105300)
|
||||
auto addresses = boost::atomic_load (&m_Addresses);
|
||||
#else
|
||||
|
@ -889,6 +890,25 @@ namespace data
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
std::shared_ptr<const RouterInfo::Address> RouterInfo::GetNTCP2Address (bool v4only) const
|
||||
{
|
||||
// TODO: implement through GetAddress
|
||||
#if (BOOST_VERSION >= 105300)
|
||||
auto addresses = boost::atomic_load (&m_Addresses);
|
||||
#else
|
||||
auto addresses = m_Addresses;
|
||||
#endif
|
||||
for (const auto& address : *addresses)
|
||||
{
|
||||
if (address->IsPublishedNTCP2 ())
|
||||
{
|
||||
if (!v4only || address->host.is_v4 ())
|
||||
return address;
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::shared_ptr<RouterProfile> RouterInfo::GetProfile () const
|
||||
{
|
||||
if (!m_Profile)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue