mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-05-15 11:51:48 +02:00
parse address in AddressBook
This commit is contained in:
parent
ec3462fabe
commit
07654212f8
6 changed files with 37 additions and 50 deletions
|
@ -18,6 +18,29 @@ namespace data
|
|||
{
|
||||
}
|
||||
|
||||
bool AddressBook::GetIdentHash (const std::string& address, IdentHash& ident)
|
||||
{
|
||||
auto pos = address.find(".b32.i2p");
|
||||
if (pos != std::string::npos)
|
||||
{
|
||||
Base32ToByteStream (address.c_str(), pos, ident, 32);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
pos = address.find (".i2p");
|
||||
if (pos != std::string::npos)
|
||||
{
|
||||
auto identHash = FindAddress (address);
|
||||
if (identHash)
|
||||
{
|
||||
ident = *identHash;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
const IdentHash * AddressBook::FindAddress (const std::string& address)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue