mirror of
https://github.com/PurpleI2P/i2pd
synced 2024-11-10 00:00:29 +03:00
find SSU2 address by address type
This commit is contained in:
parent
990906c57f
commit
30b83414ef
@ -896,13 +896,13 @@ namespace data
|
||||
});
|
||||
}
|
||||
|
||||
std::shared_ptr<const RouterInfo::Address> RouterInfo::GetSSU2AddressWithStaticKey (const uint8_t * key) const
|
||||
std::shared_ptr<const RouterInfo::Address> RouterInfo::GetSSU2AddressWithStaticKey (const uint8_t * key, bool isV6) const
|
||||
{
|
||||
if (!key) return nullptr;
|
||||
return GetAddress (
|
||||
[key](std::shared_ptr<const RouterInfo::Address> address)->bool
|
||||
[key, isV6](std::shared_ptr<const RouterInfo::Address> address)->bool
|
||||
{
|
||||
return address->IsSSU2 () && !memcmp (address->s, key, 32);
|
||||
return address->IsSSU2 () && !memcmp (address->s, key, 32) && address->IsV6 () == isV6;
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -184,7 +184,7 @@ namespace data
|
||||
virtual void ClearProperties () {};
|
||||
Addresses& GetAddresses () { return *m_Addresses; }; // should be called for local RI only, otherwise must return shared_ptr
|
||||
std::shared_ptr<const Address> GetNTCP2AddressWithStaticKey (const uint8_t * key) const;
|
||||
std::shared_ptr<const Address> GetSSU2AddressWithStaticKey (const uint8_t * key) const;
|
||||
std::shared_ptr<const Address> GetSSU2AddressWithStaticKey (const uint8_t * key, bool isV6) const;
|
||||
std::shared_ptr<const Address> GetPublishedNTCP2V4Address () const;
|
||||
std::shared_ptr<const Address> GetPublishedNTCP2V6Address () const;
|
||||
std::shared_ptr<const Address> GetSSUAddress (bool v4only = true) const;
|
||||
|
@ -384,7 +384,7 @@ namespace transport
|
||||
return false;
|
||||
}
|
||||
SetRemoteIdentity (ri->GetRouterIdentity ());
|
||||
m_Address = ri->GetSSU2AddressWithStaticKey (S);
|
||||
m_Address = ri->GetSSU2AddressWithStaticKey (S, m_RemoteEndpoint.address ().is_v6 ());
|
||||
if (!m_Address)
|
||||
{
|
||||
LogPrint (eLogError, "SSU2: No SSU2 address with static key found in SessionConfirmed");
|
||||
|
Loading…
Reference in New Issue
Block a user