mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-22 04:04:16 +00:00
Use the address book for conversion into .b32.i2p
This commit is contained in:
parent
8812a45607
commit
cb94d43092
@ -240,7 +240,7 @@ namespace client
|
|||||||
m_Storage = CreateStorage ();
|
m_Storage = CreateStorage ();
|
||||||
m_Storage->AddAddress (ident);
|
m_Storage->AddAddress (ident);
|
||||||
m_Addresses[address] = ident.GetIdentHash ();
|
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)
|
void AddressBook::InsertAddress (const i2p::data::IdentityEx& address)
|
||||||
|
@ -54,7 +54,9 @@ namespace client
|
|||||||
void StopSubscriptions ();
|
void StopSubscriptions ();
|
||||||
void LoadHostsFromStream (std::istream& f);
|
void LoadHostsFromStream (std::istream& f);
|
||||||
void DownloadComplete (bool success);
|
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:
|
private:
|
||||||
|
|
||||||
AddressBookStorage * CreateStorage ();
|
AddressBookStorage * CreateStorage ();
|
||||||
|
@ -141,7 +141,7 @@ namespace client
|
|||||||
s.read ((char *)buf, len);
|
s.read ((char *)buf, len);
|
||||||
keys.FromBuffer (buf, len);
|
keys.FromBuffer (buf, len);
|
||||||
delete[] buf;
|
delete[] buf;
|
||||||
LogPrint ("Local address ", keys.GetPublic ().GetIdentHash ().ToBase32 (), ".b32.i2p loaded");
|
LogPrint ("Local address ", m_AddressBook.ToAddress(keys.GetPublic ().GetIdentHash ()), " loaded");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -154,7 +154,7 @@ namespace client
|
|||||||
f.write ((char *)buf, len);
|
f.write ((char *)buf, len);
|
||||||
delete[] buf;
|
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);
|
auto localDestination = new ClientDestination (keys, isPublic);
|
||||||
@ -197,7 +197,7 @@ namespace client
|
|||||||
auto it = m_Destinations.find (keys.GetPublic ().GetIdentHash ());
|
auto it = m_Destinations.find (keys.GetPublic ().GetIdentHash ());
|
||||||
if (it != m_Destinations.end ())
|
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 ())
|
if (!it->second->IsRunning ())
|
||||||
{
|
{
|
||||||
it->second->Start ();
|
it->second->Start ();
|
||||||
|
@ -48,7 +48,7 @@ namespace client
|
|||||||
}
|
}
|
||||||
m_Pool = i2p::tunnel::tunnels.CreateTunnelPool (this, inboundTunnelLen, outboundTunnelLen);
|
m_Pool = i2p::tunnel::tunnels.CreateTunnelPool (this, inboundTunnelLen, outboundTunnelLen);
|
||||||
if (m_IsPublic)
|
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:
|
m_StreamingDestination = new i2p::stream::StreamingDestination (*this); // TODO:
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -245,7 +245,7 @@ namespace client
|
|||||||
delete it1->second;
|
delete it1->second;
|
||||||
m_LeaseSetRequests.erase (it1);
|
m_LeaseSetRequests.erase (it1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientDestination::HandleDatabaseSearchReplyMessage (const uint8_t * buf, size_t len)
|
void ClientDestination::HandleDatabaseSearchReplyMessage (const uint8_t * buf, size_t len)
|
||||||
{
|
{
|
||||||
|
@ -792,7 +792,7 @@ namespace util
|
|||||||
std::string b32 = it.first.ToBase32 ();
|
std::string b32 = it.first.ToBase32 ();
|
||||||
s << "<a href=/?" << HTTP_COMMAND_LOCAL_DESTINATION;
|
s << "<a href=/?" << HTTP_COMMAND_LOCAL_DESTINATION;
|
||||||
s << "&" << HTTP_PARAM_BASE32_ADDRESS << "=" << b32 << ">";
|
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
|
|||||||
s << "<br><b>Streams:</b><br>";
|
s << "<br><b>Streams:</b><br>";
|
||||||
for (auto it: dest->GetStreamingDestination ()->GetStreams ())
|
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 << " [" << it.second->GetNumSentBytes () << ":" << it.second->GetNumReceivedBytes () << "]";
|
||||||
s << " [out:" << it.second->GetSendQueueSize () << "][in:" << it.second->GetReceiveQueueSize () << "]";
|
s << " [out:" << it.second->GetSendQueueSize () << "][in:" << it.second->GetReceiveQueueSize () << "]";
|
||||||
s << "<br>"<< std::endl;
|
s << "<br>"<< std::endl;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user