mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-22 21:37:17 +01:00
commit
f5d511ae0f
|
@ -309,7 +309,7 @@ namespace transport
|
|||
|
||||
KDF3Bob ();
|
||||
if (i2p::crypto::AEADChaCha20Poly1305 (m_SessionConfirmedBuffer + 48, m3p2Len - 16, GetH (), 32, GetK (), nonce, m3p2Buf, m3p2Len - 16, false)) // decrypt
|
||||
// caclulate new h again for KDF data
|
||||
// calculate new h again for KDF data
|
||||
MixHash (m_SessionConfirmedBuffer + 48, m3p2Len); // h = SHA256(h || ciphertext)
|
||||
else
|
||||
{
|
||||
|
|
|
@ -408,7 +408,7 @@ namespace transport
|
|||
return it->second;
|
||||
it++;
|
||||
}
|
||||
// not found, try from begining
|
||||
// not found, try from beginning
|
||||
it = m_Sessions.begin ();
|
||||
while (it != m_Sessions.end () && ind)
|
||||
{
|
||||
|
@ -654,14 +654,14 @@ namespace transport
|
|||
uint32_t relayTag = 0;
|
||||
if (!address->ssu->introducers.empty ())
|
||||
{
|
||||
std::vector<int> indicies;
|
||||
for (int i = 0; i < (int)address->ssu->introducers.size (); i++) indicies.push_back(i);
|
||||
if (indicies.size () > 1)
|
||||
std::shuffle (indicies.begin(), indicies.end(), std::mt19937(std::random_device()()));
|
||||
std::vector<int> indices;
|
||||
for (int i = 0; i < (int)address->ssu->introducers.size (); i++) indices.push_back(i);
|
||||
if (indices.size () > 1)
|
||||
std::shuffle (indices.begin(), indices.end(), std::mt19937(std::random_device()()));
|
||||
|
||||
for (auto i: indicies)
|
||||
for (auto i: indices)
|
||||
{
|
||||
const auto& introducer = address->ssu->introducers[indicies[i]];
|
||||
const auto& introducer = address->ssu->introducers[indices[i]];
|
||||
if (introducer.iTag && ts < introducer.iExp)
|
||||
{
|
||||
r = i2p::data::netdb.FindRouter (introducer.iH);
|
||||
|
|
|
@ -103,7 +103,7 @@ namespace transport
|
|||
{
|
||||
// we are Alice
|
||||
if (!session || !relayTag) return false;
|
||||
// find local adddress to introduce
|
||||
// find local address to introduce
|
||||
auto localAddress = session->FindLocalAddress ();
|
||||
if (!localAddress) return false;
|
||||
// create nonce
|
||||
|
|
|
@ -35,7 +35,7 @@ namespace transport
|
|||
const int SSU2_PEER_TEST_EXPIRATION_TIMEOUT = 60; // 60 seconds
|
||||
const size_t SSU2_MAX_PACKET_SIZE = 1500;
|
||||
const size_t SSU2_MIN_PACKET_SIZE = 1280;
|
||||
const int SSU2_HANDSHAKE_RESEND_INTERVAL = 1000; // in millseconds
|
||||
const int SSU2_HANDSHAKE_RESEND_INTERVAL = 1000; // in milliseconds
|
||||
const int SSU2_RESEND_INTERVAL = 300; // in milliseconds
|
||||
const int SSU2_MAX_NUM_RESENDS = 5;
|
||||
const int SSU2_INCOMPLETE_MESSAGES_CLEANUP_TIMEOUT = 30; // in seconds
|
||||
|
|
|
@ -25,7 +25,7 @@ namespace util
|
|||
uint32_t GetHoursSinceEpoch ();
|
||||
|
||||
void GetCurrentDate (char * date); // returns date as YYYYMMDD string, 9 bytes
|
||||
void GetDateString (uint64_t timestamp, char * date); // timestap is seconds since epoch, returns date as YYYYMMDD string, 9 bytes
|
||||
void GetDateString (uint64_t timestamp, char * date); // timestamp is seconds since epoch, returns date as YYYYMMDD string, 9 bytes
|
||||
void AdjustTimeOffset (int64_t offset); // in seconds from current
|
||||
|
||||
class NTPTimeSync
|
||||
|
|
|
@ -76,12 +76,12 @@ namespace tunnel
|
|||
if (m_NumInboundHops > size)
|
||||
{
|
||||
m_NumInboundHops = size;
|
||||
LogPrint (eLogInfo, "Tunnels: Inbound tunnel length has beed adjusted to ", size, " for explicit peers");
|
||||
LogPrint (eLogInfo, "Tunnels: Inbound tunnel length has been adjusted to ", size, " for explicit peers");
|
||||
}
|
||||
if (m_NumOutboundHops > size)
|
||||
{
|
||||
m_NumOutboundHops = size;
|
||||
LogPrint (eLogInfo, "Tunnels: Outbound tunnel length has beed adjusted to ", size, " for explicit peers");
|
||||
LogPrint (eLogInfo, "Tunnels: Outbound tunnel length has been adjusted to ", size, " for explicit peers");
|
||||
}
|
||||
m_NumInboundTunnels = 1;
|
||||
m_NumOutboundTunnels = 1;
|
||||
|
|
|
@ -84,7 +84,7 @@ const char *inet_ntop_xp(int af, const void *src, char *dst, socklen_t size)
|
|||
default:
|
||||
return NULL;
|
||||
}
|
||||
/* cannot direclty use &size because of strict aliasing rules */
|
||||
/* cannot directly use &size because of strict aliasing rules */
|
||||
return (WSAAddressToString((struct sockaddr *)&ss, sizeof(ss), NULL, dst, &s) == 0)? dst : NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -259,7 +259,7 @@ namespace client
|
|||
void I2PUDPClientTunnel::HandleRecvFromLocal (const boost::system::error_code & ec, std::size_t transferred)
|
||||
{
|
||||
if (m_cancel_resolve) {
|
||||
LogPrint (eLogDebug, "UDP Client: Ignoring incomming data: stopping");
|
||||
LogPrint (eLogDebug, "UDP Client: Ignoring incoming data: stopping");
|
||||
return;
|
||||
}
|
||||
if (ec) {
|
||||
|
|
Loading…
Reference in a new issue