diff -U2 -r /var/lib/copr-rpmbuild/results/i2pd-git/upstream-unpacked/Source0/i2pd-openssl/libi2pd/NTCP2.cpp /var/lib/copr-rpmbuild/results/i2pd-git/srpm-unpacked/i2pd-openssl.tar.gz-extract/i2pd-openssl/libi2pd/NTCP2.cpp --- /var/lib/copr-rpmbuild/results/i2pd-git/upstream-unpacked/Source0/i2pd-openssl/libi2pd/NTCP2.cpp 2026-02-06 17:58:16.000000000 +0000 +++ /var/lib/copr-rpmbuild/results/i2pd-git/srpm-unpacked/i2pd-openssl.tar.gz-extract/i2pd-openssl/libi2pd/NTCP2.cpp 2026-02-06 17:50:57.000000000 +0000 @@ -1048,7 +1048,7 @@ auto addr = m_RemoteEndpoint.address ().is_v4 () ? ri1->GetNTCP2V4Address () : (i2p::util::net::IsYggdrasilAddress (m_RemoteEndpoint.address ()) ? ri1->GetYggdrasilAddress () : ri1->GetNTCP2V6Address ()); - if (!addr) + if (!addr || memcmp (m_Establisher->m_RemoteStaticKey, addr->s, 32)) { - LogPrint (eLogError, "NTCP2: Address not found in SessionConfirmed"); + LogPrint (eLogError, "NTCP2: Wrong static key in SessionConfirmed"); Terminate (); return; @@ -1070,12 +1070,4 @@ return; } - if (memcmp (m_Establisher->m_RemoteStaticKey, addr->s, 32)) - { - LogPrint (eLogError, "NTCP2: Wrong static key in SessionConfirmed"); - if (addr->IsPublishedNTCP2 ()) - i2p::transport::transports.AddBan (m_RemoteEndpoint.address ()); - Terminate (); - return; - } // TODO: process options block @@ -1945,5 +1937,5 @@ { LogPrint (eLogDebug, "NTCP2: Connected from ", ep); - if (!i2p::transport::transports.IsInReservedRange(ep.address ()) && !i2p::transport::transports.IsBanned(ep.address ())) + if (!i2p::transport::transports.IsInReservedRange(ep.address ())) { if (m_PendingIncomingSessions.emplace (ep.address (), conn).second) @@ -1957,5 +1949,5 @@ } else - LogPrint (eLogError, "NTCP2: Incoming connection from invalid or banned IP ", ep.address ()); + LogPrint (eLogError, "NTCP2: Incoming connection from invalid IP ", ep.address ()); } else @@ -1992,7 +1984,6 @@ { LogPrint (eLogDebug, "NTCP2: Connected from ", ep); - if ((!i2p::transport::transports.IsInReservedRange(ep.address ()) || - i2p::util::net::IsYggdrasilAddress (ep.address ())) && - !i2p::transport::transports.IsBanned(ep.address ())) + if (!i2p::transport::transports.IsInReservedRange(ep.address ()) || + i2p::util::net::IsYggdrasilAddress (ep.address ())) { if (m_PendingIncomingSessions.emplace (ep.address (), conn).second) @@ -2006,5 +1997,5 @@ } else - LogPrint (eLogError, "NTCP2: Incoming connection from invalid or banned IP ", ep.address ()); + LogPrint (eLogError, "NTCP2: Incoming connection from invalid IP ", ep.address ()); } else diff -U2 -r /var/lib/copr-rpmbuild/results/i2pd-git/upstream-unpacked/Source0/i2pd-openssl/libi2pd/SSU2.cpp /var/lib/copr-rpmbuild/results/i2pd-git/srpm-unpacked/i2pd-openssl.tar.gz-extract/i2pd-openssl/libi2pd/SSU2.cpp --- /var/lib/copr-rpmbuild/results/i2pd-git/upstream-unpacked/Source0/i2pd-openssl/libi2pd/SSU2.cpp 2026-02-06 17:58:16.000000000 +0000 +++ /var/lib/copr-rpmbuild/results/i2pd-git/srpm-unpacked/i2pd-openssl.tar.gz-extract/i2pd-openssl/libi2pd/SSU2.cpp 2026-02-06 17:50:57.000000000 +0000 @@ -226,16 +226,16 @@ auto it = m_ConnectedRecently.find (ep); if (it != m_ConnectedRecently.end ()) - { + { if (i2p::util::GetSecondsSinceEpoch () <= it->second + (max ? SSU2_MAX_HOLE_PUNCH_EXPIRATION : SSU2_MIN_HOLE_PUNCH_EXPIRATION)) return true; else if (max) m_ConnectedRecently.erase (it); - } + } return false; - } + } void SSU2Server::AddConnectedRecently (const boost::asio::ip::udp::endpoint& ep, uint64_t ts) { - if (!ep.port () || ep.address ().is_unspecified () || + if (!ep.port () || ep.address ().is_unspecified () || i2p::util::GetSecondsSinceEpoch () > ts + SSU2_MAX_HOLE_PUNCH_EXPIRATION) return; std::lock_guard l(m_ConnectedRecentlyMutex); @@ -243,21 +243,21 @@ if (!added && ts > it->second) it->second = ts; // renew timestamp of existing endpoint - } - + } + void SSU2Server::AdjustTimeOffset (int64_t offset, std::shared_ptr from) { if (offset) - { + { if (m_PendingTimeOffset) // one more - { - if (m_PendingTimeOffsetFrom && from && + { + if (m_PendingTimeOffsetFrom && from && m_PendingTimeOffsetFrom->GetIdentHash ().GetLL()[0] != from->GetIdentHash ().GetLL()[0]) // from different routers - { + { if (std::abs (m_PendingTimeOffset - offset) < SSU2_CLOCK_SKEW) - { + { offset = (m_PendingTimeOffset + offset)/2; // average LogPrint (eLogWarning, "SSU2: Clock adjusted by ", offset, " seconds"); i2p::util::AdjustTimeOffset (offset); - } + } else LogPrint (eLogWarning, "SSU2: Time offsets are too different. Clock not adjusted"); @@ -269,16 +269,16 @@ } else - { - m_PendingTimeOffset = offset; // first + { + m_PendingTimeOffset = offset; // first m_PendingTimeOffsetFrom = from; - } - } + } + } else - { + { m_PendingTimeOffset = 0; // reset m_PendingTimeOffsetFrom = nullptr; - } - } - + } + } + boost::asio::ip::udp::socket& SSU2Server::OpenSocket (const boost::asio::ip::udp::endpoint& localEndpoint) { @@ -290,5 +290,5 @@ socket.open (localEndpoint.protocol ()); if (localEndpoint.address ().is_v6 ()) -#if !defined(__HAIKU__) +#if !defined(__HAIKU__) socket.set_option (boost::asio::ip::v6_only (true)); #else @@ -296,6 +296,6 @@ LogPrint (eLogWarning, "SSU2: Socket option IPV6_V6ONLY is not supported"); m_IsForcedFirewalled6 = true; // IPV6_V6ONLY is not supported, always Firewalled for ipv6 - } -#endif + } +#endif uint64_t bufferSize = i2p::context.GetBandwidthLimit() * 1024 / 5; // max lag = 200ms @@ -378,7 +378,7 @@ Receive (socket); return; - } + } packet->len = bytes_transferred; - + boost::system::error_code ec; size_t moreBytes = socket.available (ec); @@ -388,5 +388,5 @@ packets.push_back (packet); while (moreBytes && packets.size () < SSU2_MAX_NUM_PACKETS_PER_BATCH) - { + { packet = m_PacketsPool.AcquireMt (); packet->len = socket.receive_from (boost::asio::buffer (packet->buf, SSU2_MAX_PACKET_SIZE), packet->from, 0, ec); @@ -411,5 +411,5 @@ } else - InsertToReceivedPacketsQueue (packet); + InsertToReceivedPacketsQueue (packet); Receive (socket); } @@ -463,5 +463,5 @@ if (empty) boost::asio::post (GetService (), [this]() { HandleReceivedPacketsQueue (); }); - } + } void SSU2Server::InsertToReceivedPacketsQueue (std::list& packets) @@ -479,10 +479,10 @@ m_PacketsPool.ReleaseMt (packets); queueSize = 0; // invoke processing just in case - } + } } if (!queueSize) boost::asio::post (GetService (), [this]() { HandleReceivedPacketsQueue (); }); - } - + } + void SSU2Server::HandleReceivedPacketsQueue () { @@ -493,6 +493,6 @@ } HandleReceivedPackets (std::move (receivedPackets)); - } - + } + bool SSU2Server::AddSession (std::shared_ptr session) { @@ -500,9 +500,9 @@ { if (m_Sessions.emplace (session->GetConnID (), session).second) - { + { if (session->GetState () != eSSU2SessionStatePeerTest) AddSessionByRouterHash (session); return true; - } + } } return false; @@ -515,5 +515,5 @@ { if (it->second->GetState () != eSSU2SessionStatePeerTest) - { + { auto ident = it->second->GetRemoteIdentity (); if (ident) @@ -523,5 +523,5 @@ if (it1 != m_SessionsByRouterHash.end () && it->second == it1->second.lock ()) m_SessionsByRouterHash.erase (it1); - } + } } if (m_LastSession == it->second) @@ -534,6 +534,6 @@ { boost::asio::post (GetService (), [connID, this]() { RemoveSession (connID); }); - } - + } + void SSU2Server::AddSessionByRouterHash (std::shared_ptr session) { @@ -552,8 +552,8 @@ // update session ret.first->second = session; - } - } + } + } if (oldSession && oldSession != session) - { + { // session already exists LogPrint (eLogWarning, "SSU2: Session to ", ident->GetIdentHash ().ToBase64 (), " already exists"); @@ -562,5 +562,5 @@ // terminate existing boost::asio::post (GetService (), std::bind (&SSU2Session::RequestTermination, oldSession, eSSU2TerminationReasonReplacedByNewSession)); - } + } } } @@ -579,5 +579,5 @@ auto it = m_SessionsByRouterHash.find (ident); if (it != m_SessionsByRouterHash.end ()) - { + { if (!it->second.expired ()) { @@ -587,5 +587,5 @@ } m_SessionsByRouterHash.erase (it); - } + } return nullptr; } @@ -648,9 +648,9 @@ { if (!it->second.expired ()) - { + { auto s = it->second.lock (); if (s && s->IsEstablished ()) return s; - } + } m_Relays.erase (it); } @@ -661,5 +661,5 @@ { return m_PeerTests.emplace (nonce, std::pair{ aliceSession, ts }).second; - } + } std::shared_ptr SSU2Server::GetPeerTest (uint32_t nonce) @@ -673,11 +673,11 @@ } return nullptr; - } - + } + bool SSU2Server::AddRequestedPeerTest (uint32_t nonce, std::shared_ptr session, uint64_t ts) { return m_RequestedPeerTests.emplace (nonce, std::pair{ session, ts }).second; } - + std::shared_ptr SSU2Server::GetRequestedPeerTest (uint32_t nonce) { @@ -690,6 +690,6 @@ } return nullptr; - } - + } + void SSU2Server::ProcessNextPacket (uint8_t * buf, size_t len, const boost::asio::ip::udp::endpoint& senderEndpoint) { @@ -741,5 +741,5 @@ case eSSU2SessionStateHolePunch: m_LastSession->ProcessFirstIncomingMessage (connID, buf, len); // SessionRequest - break; + break; case eSSU2SessionStateClosing: m_LastSession->ProcessData (buf, len, senderEndpoint); // we might receive termintaion block @@ -770,6 +770,5 @@ it1->second->ProcessRetry (buf, len); } - else if (!i2p::transport::transports.IsInReservedRange(senderEndpoint.address ()) && senderEndpoint.port () && - !i2p::transport::transports.IsBanned (senderEndpoint.address ())) + else if (!i2p::transport::transports.IsInReservedRange(senderEndpoint.address ()) && senderEndpoint.port ()) { // assume new incoming session @@ -779,5 +778,5 @@ } else - LogPrint (eLogError, "SSU2: Incoming packet received from invalid or banned endpoint ", senderEndpoint); + LogPrint (eLogError, "SSU2: Incoming packet received from invalid endpoint ", senderEndpoint); } } @@ -877,6 +876,6 @@ } return false; - } - + } + bool SSU2Server::CreateSession (std::shared_ptr router, std::shared_ptr address, bool peerTest) @@ -911,6 +910,6 @@ session->SetRemoteEndpoint (ep); isValidEndpoint = true; - } - } + } + } if (peerTest) session->SetOnEstablished ([session]() {session->SendPeerTest (); }); @@ -946,5 +945,5 @@ auto addr = s->GetAddress (); if (addr && addr->IsIntroducer ()) - { + { s->Introduce (session, it.iTag); return; @@ -953,5 +952,5 @@ else indices.push_back(i); - } + } i++; } @@ -972,7 +971,7 @@ r = i2p::data::netdb.FindRouter (introducer.iH); if (r) - { + { if (r->IsPublishedOn (i2p::context.GetRouterInfo ().GetCompatibleTransports (false) & // outgoing - (i2p::data::RouterInfo::eSSU2V4 | i2p::data::RouterInfo::eSSU2V6))) + (i2p::data::RouterInfo::eSSU2V4 | i2p::data::RouterInfo::eSSU2V6))) { relayTag = introducer.iTag; @@ -988,25 +987,25 @@ if (i2p::context.SupportsV6 ()) addr = r->GetSSU2V6Address (); - } + } else { if (i2p::context.SupportsV4 ()) addr = r->GetSSU2V4Address (); - } + } if (addr && addr->IsIntroducer () && !addr->host.is_unspecified () && addr->port && !i2p::transport::transports.IsInReservedRange(addr->host)) break; else - { + { // all addresses are invalid, try next introducer relayTag = 0; addr = nullptr; r = nullptr; - } - } + } + } } else r = nullptr; - } + } else if (!i2p::data::IsRouterBanned (introducer.iH)) newRouters.push_back (introducer.iH); @@ -1060,5 +1059,5 @@ auto remoteAddr = session->GetAddress (); if (!remoteAddr || !remoteAddr->IsPeerTesting () || - (v4 && !remoteAddr->IsV4 ()) || (!v4 && !remoteAddr->IsV6 ())) return false; + (v4 && !remoteAddr->IsV4 ()) || (!v4 && !remoteAddr->IsV6 ())) return false; if (session->IsEstablished ()) boost::asio::post (GetService (), [session]() { session->SendPeerTest (); }); @@ -1098,5 +1097,5 @@ it++; } - } + } for (auto it: m_Sessions) @@ -1150,5 +1149,5 @@ it++; } - + for (auto it = m_IncomingTokens.begin (); it != m_IncomingTokens.end (); ) { @@ -1173,5 +1172,5 @@ else it++; - } + } for (auto it = m_RequestedPeerTests.begin (); it != m_RequestedPeerTests.end ();) @@ -1192,6 +1191,6 @@ it++; } - } - + } + m_PacketsPool.CleanUpMt (); m_SentPacketsPool.CleanUp (); @@ -1204,5 +1203,5 @@ void SSU2Server::ScheduleResend (bool more) { - m_ResendTimer.expires_from_now (boost::posix_time::milliseconds (more ? + m_ResendTimer.expires_from_now (boost::posix_time::milliseconds (more ? (SSU2_RESEND_CHECK_MORE_TIMEOUT + m_Rng () % SSU2_RESEND_CHECK_MORE_TIMEOUT_VARIANCE): (SSU2_RESEND_CHECK_TIMEOUT + m_Rng () % SSU2_RESEND_CHECK_TIMEOUT_VARIANCE))); @@ -1285,5 +1284,5 @@ std::vector > ret; if (maxNumIntroducers <= 0 || m_Sessions.empty ()) return ret; - + std::vector > eligible; eligible.reserve (m_Sessions.size ()/2); @@ -1301,5 +1300,5 @@ if (eligible.size () <= (size_t)maxNumIntroducers) return eligible; - else + else std::sample (eligible.begin(), eligible.end(), std::back_inserter(ret), maxNumIntroducers, m_Rng); return ret; @@ -1318,11 +1317,11 @@ excluded.insert (ident); if (session) - { + { if (session->IsEstablished () && session->GetRelayTag () && session->IsOutgoing () && // still session with introducer? ts < session->GetCreationTime () + SSU2_TO_INTRODUCER_SESSION_EXPIRATION) - { + { session->SendKeepAlive (); - if (ts < session->GetCreationTime () + SSU2_TO_INTRODUCER_SESSION_DURATION) - { + if (ts < session->GetCreationTime () + SSU2_TO_INTRODUCER_SESSION_DURATION) + { newList.push_back ({ident, session->GetRelayTag ()}); if (tag != session->GetRelayTag ()) @@ -1331,16 +1330,16 @@ i2p::context.UpdateSSU2Introducer (ident, v4, session->GetRelayTag (), session->GetCreationTime () + SSU2_TO_INTRODUCER_SESSION_EXPIRATION); - } + } } - else - { + else + { impliedList.push_back ({ident, session->GetRelayTag ()}); // keep in introducers list, but not publish - session = nullptr; + session = nullptr; } - } + } else session = nullptr; - } - + } + if (!session) i2p::context.RemoveSSU2Introducer (ident, v4); @@ -1358,10 +1357,10 @@ if (session) { - if (std::find_if (newList.begin (), newList.end (), + if (std::find_if (newList.begin (), newList.end (), [&ident = it.first](const auto& s){ return ident == s.first; }) == newList.end ()) - { + { sessions.push_back (session); numOldSessions++; - } + } } } @@ -1371,7 +1370,7 @@ for (const auto& it : sessions) { - uint32_t tag = it->GetRelayTag (); + uint32_t tag = it->GetRelayTag (); uint32_t exp = it->GetCreationTime () + SSU2_TO_INTRODUCER_SESSION_EXPIRATION; - if (!tag && ts >= exp) + if (!tag && ts >= exp) continue; // don't publish expired introducer i2p::data::RouterInfo::Introducer introducer; @@ -1395,5 +1394,5 @@ { // we need to create more sessions with relay tag - + // exclude all existing sessions excluded.clear (); @@ -1402,5 +1401,5 @@ for (const auto& [ident, s] : m_SessionsByRouterHash) excluded.insert (ident); - } + } // session about to expire are not counted @@ -1546,6 +1545,6 @@ { m_ChaCha20 (msg, msgLen, key, nonce, out); - } - + } + void SSU2Server::SendThroughProxy (const uint8_t * header, size_t headerLen, const uint8_t * headerX, size_t headerXLen, const uint8_t * payload, size_t payloadLen, const boost::asio::ip::udp::endpoint& to) diff -U2 -r /var/lib/copr-rpmbuild/results/i2pd-git/upstream-unpacked/Source0/i2pd-openssl/libi2pd/SSU2Session.cpp /var/lib/copr-rpmbuild/results/i2pd-git/srpm-unpacked/i2pd-openssl.tar.gz-extract/i2pd-openssl/libi2pd/SSU2Session.cpp --- /var/lib/copr-rpmbuild/results/i2pd-git/upstream-unpacked/Source0/i2pd-openssl/libi2pd/SSU2Session.cpp 2026-02-06 17:58:16.000000000 +0000 +++ /var/lib/copr-rpmbuild/results/i2pd-git/srpm-unpacked/i2pd-openssl.tar.gz-extract/i2pd-openssl/libi2pd/SSU2Session.cpp 2026-02-06 17:50:57.000000000 +0000 @@ -1201,7 +1201,7 @@ m_Address = m_RemoteEndpoint.address ().is_v6 () ? ri->GetSSU2V6Address () : ri->GetSSU2V4Address (); - if (!m_Address) + if (!m_Address || memcmp (S, m_Address->s, 32)) { - LogPrint (eLogError, "SSU2: Address not found in SessionConfirmed from ", i2p::data::GetIdentHashAbbreviation (ri->GetIdentHash ())); + LogPrint (eLogError, "SSU2: Wrong static key in SessionConfirmed from ", i2p::data::GetIdentHashAbbreviation (ri->GetIdentHash ())); return false; } @@ -1221,11 +1221,4 @@ return false; } - if (memcmp (S, m_Address->s, 32)) - { - LogPrint (eLogError, "SSU2: Wrong static key in SessionConfirmed from ", i2p::data::GetIdentHashAbbreviation (ri->GetIdentHash ())); - if (m_Address->published) - i2p::transport::transports.AddBan (m_RemoteEndpoint.address ()); - return false; - } if (!m_Address->published) { diff -U2 -r /var/lib/copr-rpmbuild/results/i2pd-git/upstream-unpacked/Source0/i2pd-openssl/libi2pd/Transports.cpp /var/lib/copr-rpmbuild/results/i2pd-git/srpm-unpacked/i2pd-openssl.tar.gz-extract/i2pd-openssl/libi2pd/Transports.cpp --- /var/lib/copr-rpmbuild/results/i2pd-git/upstream-unpacked/Source0/i2pd-openssl/libi2pd/Transports.cpp 2026-02-06 17:58:16.000000000 +0000 +++ /var/lib/copr-rpmbuild/results/i2pd-git/srpm-unpacked/i2pd-openssl.tar.gz-extract/i2pd-openssl/libi2pd/Transports.cpp 2026-02-06 17:50:57.000000000 +0000 @@ -188,5 +188,4 @@ m_PeerTestTimer = new boost::asio::deadline_timer (*m_Service); m_UpdateBandwidthTimer = new boost::asio::deadline_timer (*m_Service); - m_BanListCleanupTimer = std::make_unique(*m_Service); } @@ -349,6 +348,4 @@ m_PeerTestTimer->async_wait (std::bind (&Transports::HandlePeerTestTimer, this, std::placeholders::_1)); } - m_BanListCleanupTimer->expires_after (std::chrono::seconds(BAN_LIST_CLEANUP_INTERVAL + m_Rng () % BAN_LIST_CLEANUP_INTERVAL_VARIANCE)); - m_BanListCleanupTimer->async_wait (std::bind (&Transports::HandleBanListCleanupTimer, this, std::placeholders::_1)); } @@ -357,5 +354,4 @@ if (m_PeerCleanupTimer) m_PeerCleanupTimer->cancel (); if (m_PeerTestTimer) m_PeerTestTimer->cancel (); - if (m_BanListCleanupTimer) m_BanListCleanupTimer->cancel (); if (m_SSU2Server) @@ -1081,27 +1077,4 @@ } - void Transports::HandleBanListCleanupTimer (const boost::system::error_code& ecode) - { - if (ecode != boost::asio::error::operation_aborted) - { - if (!m_BanList.empty ()) - { - auto ts = i2p::util::GetMonotonicSeconds (); - { - std::lock_guard l(m_BanListMutex); - for (auto it = m_BanList.begin (); it != m_BanList.end (); ) - { - if (ts < it->second) - it++; - else - it = m_BanList.erase (it); - } - } - } - m_BanListCleanupTimer->expires_after (std::chrono::seconds(BAN_LIST_CLEANUP_INTERVAL + m_Rng () % BAN_LIST_CLEANUP_INTERVAL_VARIANCE)); - m_BanListCleanupTimer->async_wait (std::bind (&Transports::HandleBanListCleanupTimer, this, std::placeholders::_1)); - } - } - template std::shared_ptr Transports::GetRandomPeer (Filter filter) const @@ -1327,25 +1300,4 @@ } - bool Transports::IsBanned (const boost::asio::ip::address& addr) - { - std::lock_guard l(m_BanListMutex); - auto it = m_BanList.find (addr); - if (it != m_BanList.end ()) - { - if (it->second < i2p::util::GetMonotonicSeconds ()) - return true; - else - m_BanList.erase (it); - } - return false; - } - - bool Transports::AddBan (const boost::asio::ip::address& addr) - { - auto ts = i2p::util::GetMonotonicSeconds () + IP_BAN_TIME + m_Rng () % IP_BAN_TIME_VARIANCE; - std::lock_guard l(m_BanListMutex); - return m_BanList.emplace (addr, ts).second; - } - void InitAddressFromIface () { diff -U2 -r /var/lib/copr-rpmbuild/results/i2pd-git/upstream-unpacked/Source0/i2pd-openssl/libi2pd/Transports.h /var/lib/copr-rpmbuild/results/i2pd-git/srpm-unpacked/i2pd-openssl.tar.gz-extract/i2pd-openssl/libi2pd/Transports.h --- /var/lib/copr-rpmbuild/results/i2pd-git/upstream-unpacked/Source0/i2pd-openssl/libi2pd/Transports.h 2026-02-06 17:58:16.000000000 +0000 +++ /var/lib/copr-rpmbuild/results/i2pd-git/srpm-unpacked/i2pd-openssl.tar.gz-extract/i2pd-openssl/libi2pd/Transports.h 2026-02-06 17:50:57.000000000 +0000 @@ -117,10 +117,6 @@ const int NUM_X25519_PRE_GENERATED_KEYS = 25; // pre-generated x25519 keys pairs - const int IP_BAN_TIME = 1800; // in seconds - const int IP_BAN_TIME_VARIANCE = 540; // in seconds - const int BAN_LIST_CLEANUP_INTERVAL = 66; // in seconds - const int BAN_LIST_CLEANUP_INTERVAL_VARIANCE = 20; // in seconds - const int TRAFFIC_SAMPLE_COUNT = 301; // seconds + struct TrafficSample { @@ -195,7 +191,4 @@ bool IsInReservedRange (const boost::asio::ip::address& host) const; - bool IsBanned (const boost::asio::ip::address& addr); - bool AddBan (const boost::asio::ip::address& addr); - private: @@ -209,5 +202,4 @@ void HandlePeerTestTimer (const boost::system::error_code& ecode); void HandleUpdateBandwidthTimer (const boost::system::error_code& ecode); - void HandleBanListCleanupTimer (const boost::system::error_code& ecode); void UpdateBandwidthValues (int interval, uint32_t& in, uint32_t& out, uint32_t& transit); @@ -256,9 +248,4 @@ std::mt19937 m_Rng; - std::map m_BanList; // ip->expiration time in seconds - mutable std::mutex m_BanListMutex; - std::unique_ptr m_BanListCleanupTimer; - - public: