|
|
@ -30,6 +30,12 @@ namespace client |
|
|
|
{ |
|
|
|
{ |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void I2CPDestination::Stop () |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
LeaseSetDestination::Stop (); |
|
|
|
|
|
|
|
m_Owner = nullptr; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void I2CPDestination::SetEncryptionPrivateKey (const uint8_t * key) |
|
|
|
void I2CPDestination::SetEncryptionPrivateKey (const uint8_t * key) |
|
|
|
{ |
|
|
|
{ |
|
|
|
m_Decryptor = i2p::data::PrivateKeys::CreateDecryptor (m_Identity->GetCryptoKeyType (), key); |
|
|
|
m_Decryptor = i2p::data::PrivateKeys::CreateDecryptor (m_Identity->GetCryptoKeyType (), key); |
|
|
@ -72,6 +78,7 @@ namespace client |
|
|
|
{ |
|
|
|
{ |
|
|
|
uint32_t length = bufbe32toh (buf); |
|
|
|
uint32_t length = bufbe32toh (buf); |
|
|
|
if (length > len - 4) length = len - 4; |
|
|
|
if (length > len - 4) length = len - 4; |
|
|
|
|
|
|
|
if (m_Owner) |
|
|
|
m_Owner->SendMessagePayloadMessage (buf + 4, length); |
|
|
|
m_Owner->SendMessagePayloadMessage (buf + 4, length); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -84,6 +91,7 @@ namespace client |
|
|
|
leases[-1] = tunnels.size (); |
|
|
|
leases[-1] = tunnels.size (); |
|
|
|
htobe16buf (leases - 3, m_Owner->GetSessionID ()); |
|
|
|
htobe16buf (leases - 3, m_Owner->GetSessionID ()); |
|
|
|
size_t l = 2/*sessionID*/ + 1/*num leases*/ + i2p::data::LEASE_SIZE*tunnels.size (); |
|
|
|
size_t l = 2/*sessionID*/ + 1/*num leases*/ + i2p::data::LEASE_SIZE*tunnels.size (); |
|
|
|
|
|
|
|
if (m_Owner) |
|
|
|
m_Owner->SendI2CPMessage (I2CP_REQUEST_VARIABLE_LEASESET_MESSAGE, leases - 3, l); |
|
|
|
m_Owner->SendI2CPMessage (I2CP_REQUEST_VARIABLE_LEASESET_MESSAGE, leases - 3, l); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -119,6 +127,7 @@ namespace client |
|
|
|
[s, msg, remote, nonce]() |
|
|
|
[s, msg, remote, nonce]() |
|
|
|
{ |
|
|
|
{ |
|
|
|
bool sent = s->SendMsg (msg, remote); |
|
|
|
bool sent = s->SendMsg (msg, remote); |
|
|
|
|
|
|
|
if (s->m_Owner) |
|
|
|
s->m_Owner->SendMessageStatusMessage (nonce, sent ? eI2CPMessageStatusGuaranteedSuccess : eI2CPMessageStatusGuaranteedFailure); |
|
|
|
s->m_Owner->SendMessageStatusMessage (nonce, sent ? eI2CPMessageStatusGuaranteedSuccess : eI2CPMessageStatusGuaranteedFailure); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
@ -130,9 +139,10 @@ namespace client |
|
|
|
if (ls) |
|
|
|
if (ls) |
|
|
|
{ |
|
|
|
{ |
|
|
|
bool sent = s->SendMsg (msg, ls); |
|
|
|
bool sent = s->SendMsg (msg, ls); |
|
|
|
|
|
|
|
if (s->m_Owner) |
|
|
|
s->m_Owner->SendMessageStatusMessage (nonce, sent ? eI2CPMessageStatusGuaranteedSuccess : eI2CPMessageStatusGuaranteedFailure); |
|
|
|
s->m_Owner->SendMessageStatusMessage (nonce, sent ? eI2CPMessageStatusGuaranteedSuccess : eI2CPMessageStatusGuaranteedFailure); |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else if (s->m_Owner) |
|
|
|
s->m_Owner->SendMessageStatusMessage (nonce, eI2CPMessageStatusNoLeaseSet); |
|
|
|
s->m_Owner->SendMessageStatusMessage (nonce, eI2CPMessageStatusNoLeaseSet); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|