mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-22 08:14:15 +00:00
support b32 and b33 addresses in STREAM CONNECT
This commit is contained in:
parent
df858d9143
commit
83fc1b0b8e
@ -495,20 +495,39 @@ namespace client
|
|||||||
else
|
else
|
||||||
m_BufferOffset = 0;
|
m_BufferOffset = 0;
|
||||||
|
|
||||||
auto dest = std::make_shared<i2p::data::IdentityEx> ();
|
std::shared_ptr<Address> addr;
|
||||||
size_t l = dest->FromBase64(destination);
|
auto pos = destination.find(".b32.i2p");
|
||||||
if (l > 0)
|
if (pos != std::string::npos)
|
||||||
|
addr = std::make_shared<Address>(destination.substr (0, pos));
|
||||||
|
else
|
||||||
{
|
{
|
||||||
context.GetAddressBook().InsertFullAddress(dest);
|
auto dest = std::make_shared<i2p::data::IdentityEx> ();
|
||||||
auto leaseSet = session->localDestination->FindLeaseSet(dest->GetIdentHash());
|
size_t l = dest->FromBase64(destination);
|
||||||
if (leaseSet)
|
if (l > 0)
|
||||||
Connect(leaseSet, session);
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
session->localDestination->RequestDestination(dest->GetIdentHash(),
|
context.GetAddressBook().InsertFullAddress(dest);
|
||||||
|
addr = std::make_shared<Address>(dest->GetIdentHash ());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (addr && addr->IsValid ())
|
||||||
|
{
|
||||||
|
if (addr->IsIdentHash ())
|
||||||
|
{
|
||||||
|
auto leaseSet = session->localDestination->FindLeaseSet(addr->identHash);
|
||||||
|
if (leaseSet)
|
||||||
|
Connect(leaseSet, session);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
session->localDestination->RequestDestination(addr->identHash,
|
||||||
|
std::bind(&SAMSocket::HandleConnectLeaseSetRequestComplete,
|
||||||
|
shared_from_this(), std::placeholders::_1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else // B33
|
||||||
|
session->localDestination->RequestDestinationWithEncryptedLeaseSet (addr->blindedPublicKey,
|
||||||
std::bind(&SAMSocket::HandleConnectLeaseSetRequestComplete,
|
std::bind(&SAMSocket::HandleConnectLeaseSetRequestComplete,
|
||||||
shared_from_this(), std::placeholders::_1));
|
shared_from_this(), std::placeholders::_1));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
SendMessageReply (SAM_STREAM_STATUS_INVALID_KEY, strlen(SAM_STREAM_STATUS_INVALID_KEY), true);
|
SendMessageReply (SAM_STREAM_STATUS_INVALID_KEY, strlen(SAM_STREAM_STATUS_INVALID_KEY), true);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user