mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-28 11:47:48 +02:00
handle b33 addresses in I2P tunnels
This commit is contained in:
parent
00b5fdce03
commit
6f4f0f03d2
5 changed files with 59 additions and 39 deletions
|
@ -359,6 +359,24 @@ namespace client
|
|||
return true;
|
||||
}
|
||||
|
||||
std::shared_ptr<const Address> AddressBook::GetAddress (const std::string& address)
|
||||
{
|
||||
auto pos = address.find(".b32.i2p");
|
||||
if (pos != std::string::npos)
|
||||
return std::make_shared<const Address>(address.substr (0, pos));
|
||||
else
|
||||
{
|
||||
pos = address.find (".i2p");
|
||||
if (pos != std::string::npos)
|
||||
return FindAddress (address);
|
||||
}
|
||||
// if not .b32 we assume full base64 address
|
||||
i2p::data::IdentityEx dest;
|
||||
if (!dest.FromBase64 (address))
|
||||
return nullptr;
|
||||
return std::make_shared<const Address>(dest.GetIdentHash ());
|
||||
}
|
||||
|
||||
std::shared_ptr<const Address> AddressBook::FindAddress (const std::string& address)
|
||||
{
|
||||
auto it = m_Addresses.find (address);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue