feat: add I2P BitTorrent engine, DHT, and Firefox torrent extension
- Add pure-MoonBit bittorrent package: bencode codec, metainfo/magnet parsing with path traversal checks, peer wire protocol (BEP 10/9), and I2P Kademlia DHT with KRPC and 54-byte compact nodes - Add SHA-1 primitive in crypto for torrent info hashes - Add router torrent API and engine, enabled with --torrent-api (default 127.0.0.1:4445) and --download-dir - Add Firefox WebExtension torrent manager with native messaging host and packed .xpi - Add scripts to build a standalone Firefox + router AppImage and install the native host - Add just targets (proxy, appimage, extension), README docs, and ignore .cache/ and dist/
This commit is contained in:
1 parent
14eae00f5c
commit
fbe6818c4e
37 files changed
+8543
-9
No files matched your search
@@ -657,6 +657,10 @@ pub struct StreamManager {
|
||||
streams : Array[StreamConnection]
|
||||
pending_accept : Array[StreamConnection]
|
||||
incoming_datagrams : Array[RepliableDatagram]
|
||||
incoming_repliable_dgrams : Array[
|
||||
(@encoding.I2cpGzipHeader, RepliableDatagram),
|
||||
]
|
||||
incoming_raw_dgrams : Array[(@encoding.I2cpGzipHeader, Bytes)]
|
||||
}
|
||||
|
||||
///|
|
||||
@@ -672,6 +676,8 @@ pub fn StreamManager::new(
|
||||
streams: [],
|
||||
pending_accept: [],
|
||||
incoming_datagrams: [],
|
||||
incoming_repliable_dgrams: [],
|
||||
incoming_raw_dgrams: [],
|
||||
}
|
||||
}
|
||||
|
||||
@@ -736,9 +742,14 @@ pub fn StreamManager::handle_incoming_i2cp(
|
||||
let dg = RepliableDatagram::decode(raw)
|
||||
if dg.verify() {
|
||||
self.incoming_datagrams.push(dg)
|
||||
self.incoming_repliable_dgrams.push((hdr, dg))
|
||||
}
|
||||
return None
|
||||
}
|
||||
if hdr.protocol == b'\x12' {
|
||||
self.incoming_raw_dgrams.push((hdr, raw))
|
||||
return None
|
||||
}
|
||||
if hdr.protocol != b'\x06' {
|
||||
return None
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user