MCPcopy Create free account
hub / github.com/PurpleI2P/i2pd / InsertAddress

Method InsertAddress

libi2pd_client/AddressBook.cpp:497–518  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

495 }
496
497 void AddressBook::InsertAddress (const std::string& address, const std::string& jump)
498 {
499 auto pos = jump.find(".b32.i2p");
500 if (pos != std::string::npos)
501 {
502 m_Addresses[address] = std::make_shared<Address>(jump.substr (0, pos));
503 LogPrint (eLogInfo, "Addressbook: Added ", address," -> ", jump);
504 }
505 else
506 {
507 // assume base64
508 auto ident = std::make_shared<i2p::data::IdentityEx>();
509 if (ident->FromBase64 (jump))
510 {
511 if (m_Storage) m_Storage->AddAddress (ident);
512 m_Addresses[address] = std::make_shared<Address>(ident->GetIdentHash ());
513 LogPrint (eLogInfo, "Addressbook: Added ", address," -> ", ToAddress(ident->GetIdentHash ()));
514 }
515 else
516 LogPrint (eLogError, "Addressbook: Malformed address ", jump);
517 }
518 }
519
520 void AddressBook::InsertFullAddress (std::shared_ptr<const i2p::data::IdentityEx> address)
521 {

Callers 1

HandleRequestMethod · 0.80

Calls 3

LogPrintFunction · 0.85
FromBase64Method · 0.80
AddAddressMethod · 0.80

Tested by

no test coverage detected