fix: harden ratchet sessions and throttle BitTorrent DHT traffic
- Ratchet: cap outbound NSR pending entries per peer and globally, age them out after 180s, and prune expired or excess sessions. - Ratchet: keep NSR pending entries across multi-NSR replies, skip failed decrypts instead of aborting, and bound inbound pending entries. - Ratchet: expire sessions with stale receive state or high message counts; only mark sessions confirmed when no reply has been received. - Torrent DHT: add per-node cooldowns for get_peers and announce, limit fanout and pending transactions, and skip nodes already in the routing table. - Torrent DHT: use slower maintenance and query intervals in public mode. - Torrent peers: mark ratchet sessions stale after stalled SYN, connect timeout, handshake timeout, or idle timeout so they re-key. - Torrent peers: raise the per-torrent peer limit to 16 and log I2CP decode errors in debug mode.
This commit is contained in:
1 parent
4bb81f1b80
commit
5d97ad8b28
4 files changed
+474
-71
No files matched your search
@@ -480,6 +480,21 @@ pub fn I2pDht::prune_expired_txs(self : I2pDht, now_ms : UInt64) -> Unit {
|
||||
}
|
||||
}
|
||||
|
||||
///|
|
||||
/// Returns `true` if `(dest_hash, port)` is already present in the DHT routing table.
|
||||
pub fn I2pDht::has_node(
|
||||
self : I2pDht,
|
||||
dest_hash : @common.Hash,
|
||||
port : UInt32,
|
||||
) -> Bool {
|
||||
for n in self.nodes {
|
||||
if n.dest_hash == dest_hash && n.port == port {
|
||||
return true
|
||||
}
|
||||
}
|
||||
false
|
||||
}
|
||||
|
||||
///|
|
||||
/// Inserts or refreshes a remote DHT node, enforcing Secure I2P Node ID verification by default.
|
||||
pub fn I2pDht::upsert_node(
|
||||
|
||||
Reference in new issue
Block a user