Browse Source

Use the address book for conversion into .b32.i2p

pull/136/head
Francisco Blas (klondike) Izquierdo Riera 10 years ago
parent
commit
cb94d43092
  1. 2
      AddressBook.cpp
  2. 4
      AddressBook.h
  3. 6
      ClientContext.cpp
  4. 4
      Destination.cpp
  5. 4
      HTTPServer.cpp

2
AddressBook.cpp

@ -240,7 +240,7 @@ namespace client @@ -240,7 +240,7 @@ namespace client
m_Storage = CreateStorage ();
m_Storage->AddAddress (ident);
m_Addresses[address] = ident.GetIdentHash ();
LogPrint (address,"->",ident.GetIdentHash ().ToBase32 (), ".b32.i2p added");
LogPrint (address,"->", ToAddress(ident.GetIdentHash ()), " added");
}
void AddressBook::InsertAddress (const i2p::data::IdentityEx& address)

4
AddressBook.h

@ -54,7 +54,9 @@ namespace client @@ -54,7 +54,9 @@ namespace client
void StopSubscriptions ();
void LoadHostsFromStream (std::istream& f);
void DownloadComplete (bool success);
//This method returns the ".b32.i2p" address
std::string ToAddress(const i2p::data::IdentHash& ident) { return ident.ToBase32().append(".b32.i2p"); }
std::string ToAddress(const i2p::data::IdentityEx& ident) { return ToAddress(ident.GetIdentHash ()); }
private:
AddressBookStorage * CreateStorage ();

6
ClientContext.cpp

@ -141,7 +141,7 @@ namespace client @@ -141,7 +141,7 @@ namespace client
s.read ((char *)buf, len);
keys.FromBuffer (buf, len);
delete[] buf;
LogPrint ("Local address ", keys.GetPublic ().GetIdentHash ().ToBase32 (), ".b32.i2p loaded");
LogPrint ("Local address ", m_AddressBook.ToAddress(keys.GetPublic ().GetIdentHash ()), " loaded");
}
else
{
@ -154,7 +154,7 @@ namespace client @@ -154,7 +154,7 @@ namespace client
f.write ((char *)buf, len);
delete[] buf;
LogPrint ("New private keys file ", fullPath, " for ", keys.GetPublic ().GetIdentHash ().ToBase32 (), ".b32.i2p created");
LogPrint ("New private keys file ", fullPath, " for ", m_AddressBook.ToAddress(keys.GetPublic ().GetIdentHash ()), " created");
}
auto localDestination = new ClientDestination (keys, isPublic);
@ -197,7 +197,7 @@ namespace client @@ -197,7 +197,7 @@ namespace client
auto it = m_Destinations.find (keys.GetPublic ().GetIdentHash ());
if (it != m_Destinations.end ())
{
LogPrint ("Local destination ", keys.GetPublic ().GetIdentHash ().ToBase32 (), ".b32.i2p exists");
LogPrint ("Local destination ", m_AddressBook.ToAddress(keys.GetPublic ().GetIdentHash ()), " exists");
if (!it->second->IsRunning ())
{
it->second->Start ();

4
Destination.cpp

@ -48,7 +48,7 @@ namespace client @@ -48,7 +48,7 @@ namespace client
}
m_Pool = i2p::tunnel::tunnels.CreateTunnelPool (this, inboundTunnelLen, outboundTunnelLen);
if (m_IsPublic)
LogPrint (eLogInfo, "Local address ", GetIdentHash ().ToBase32 (), ".b32.i2p created");
LogPrint (eLogInfo, "Local address ", i2p::client::context.GetAddressBook ().ToAddress(GetIdentHash()), " created");
m_StreamingDestination = new i2p::stream::StreamingDestination (*this); // TODO:
}
@ -245,7 +245,7 @@ namespace client @@ -245,7 +245,7 @@ namespace client
delete it1->second;
m_LeaseSetRequests.erase (it1);
}
}
}
void ClientDestination::HandleDatabaseSearchReplyMessage (const uint8_t * buf, size_t len)
{

4
HTTPServer.cpp

@ -792,7 +792,7 @@ namespace util @@ -792,7 +792,7 @@ namespace util
std::string b32 = it.first.ToBase32 ();
s << "<a href=/?" << HTTP_COMMAND_LOCAL_DESTINATION;
s << "&" << HTTP_PARAM_BASE32_ADDRESS << "=" << b32 << ">";
s << b32 << ".b32.i2p</a><br>" << std::endl;
s << i2p::client::context.GetAddressBook ().ToAddress(it.second->GetIdentHash()) << "</a><br>" << std::endl;
}
}
@ -832,7 +832,7 @@ namespace util @@ -832,7 +832,7 @@ namespace util
s << "<br><b>Streams:</b><br>";
for (auto it: dest->GetStreamingDestination ()->GetStreams ())
{
s << it.first << "->" << it.second->GetRemoteIdentity ().GetIdentHash ().ToBase32 () << ".b32.i2p ";
s << it.first << "->" << i2p::client::context.GetAddressBook ().ToAddress(it.second->GetRemoteIdentity ()) << " ";
s << " [" << it.second->GetNumSentBytes () << ":" << it.second->GetNumReceivedBytes () << "]";
s << " [out:" << it.second->GetSendQueueSize () << "][in:" << it.second->GetReceiveQueueSize () << "]";
s << "<br>"<< std::endl;

Loading…
Cancel
Save