mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-28 11:47:48 +02:00
find NTCP2 address by static key. Don't make router unreachable if can't connect by NTCP2
This commit is contained in:
parent
b1fcd4d27b
commit
1ca0354cf2
3 changed files with 13 additions and 20 deletions
|
@ -962,12 +962,13 @@ namespace data
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
std::shared_ptr<const RouterInfo::Address> RouterInfo::GetNTCP2Address (bool publishedOnly) const
|
||||
std::shared_ptr<const RouterInfo::Address> RouterInfo::GetNTCP2AddressWithStaticKey (const uint8_t * key) const
|
||||
{
|
||||
if (!key) return nullptr;
|
||||
return GetAddress (
|
||||
[publishedOnly](std::shared_ptr<const RouterInfo::Address> address)->bool
|
||||
[key](std::shared_ptr<const RouterInfo::Address> address)->bool
|
||||
{
|
||||
return address->IsNTCP2 () && (!publishedOnly || address->IsPublishedNTCP2 ());
|
||||
return address->IsNTCP2 () && !memcmp (address->ntcp2->staticKey, key, 32);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue