feat: add ratchet, streaming, SU3 reseed, and router floodfill
check / check (windows-latest) (push) Failing after 27s
check / check (ubuntu-latest) (push) Failing after 29s
check / check (macos-latest) (push) Failing after 27s

- Add ratchet/ with ECIES-X25519-AEAD-Ratchet (Proposal 144), Garlic cloves, and ECIES DatabaseLookup replies
- Add streaming/ with Ed25519-signed I2P Streaming (SYN/ACK/NACK/CLOSE/RESET, retransmit, window) and Repliable/Raw Datagrams
- Add common/su3.mbt to parse and verify reseed .su3 bundles
- Add Elligator2 encoding in crypto/ and OfflineSignature support in LeaseSet2 (flags bit 0)
- Router: NTCP2 peer pool, floodfill NetDB crawl, transit tunnel relay, and Garlic/Streaming bridge
- cmd/router: add --peer-dir, --su3, --reseed, --floodfill, --no-clock-skew
- cmd/client: add --dest for persistent destination keys
- Mark Phase 6 complete in README and document the transport scope (NTCP2 only, no SSU2)
This commit is contained in:
nandi committed 2026-11-27 22:23:46 -08:00
1 parent 8eafa11b22
commit ae72b00323
54 files changed
+9607 -704

No files matched your search

+36 -5
View File
@@ -301,8 +301,25 @@ pub fn NetDb::closest_peers(
}
///|
/// Processes an incoming I2NP `DatabaseStore` payload (type 0 = uncompressed RouterInfo,
/// type 3 = LeaseSet2). Returns `true` if stored/updated.
/// Encodes a `RouterInfo` in canonical I2P `DatabaseStore` type 0 wire format:
/// `2-byte BE gzip length || gzip(RouterInfo)`.
pub fn encode_router_info_store_data(
ri : @common.RouterInfo,
) -> Bytes raise NetDbError {
let raw = ri.to_bytes() catch { e => raise Common(e) }
let gz = @encoding.gzip_compress(raw)
if gz.length() > 65535 {
raise InvalidRecord("compressed RouterInfo exceeds 65535 bytes")
}
let w = @encoding.Writer::new(capacity=2 + gz.length())
w.write_u16_be(gz.length().reinterpret_as_uint())
w.write_bytes(gz)
w.to_bytes()
}
///|
/// Processes an incoming I2NP `DatabaseStore` payload (type 0 = gzip-prefixed or
/// raw uncompressed RouterInfo, type 3 = LeaseSet2). Returns `true` if stored/updated.
pub fn NetDb::handle_database_store(
self : NetDb,
store_type : Byte,
@@ -312,8 +329,22 @@ pub fn NetDb::handle_database_store(
) -> Bool raise NetDbError {
match store_type.to_int() & 0x0F {
0 => {
// Uncompressed RouterInfo (if gzipped with 2-byte len prefix, caller decompresses first)
let ri = @common.RouterInfo::decode(@encoding.Reader::new(data)) catch {
let raw = if data.length() >= 4 &&
data[2] == b'\x1f' &&
data[3] == b'\x8b' {
let gz_len = (data[0].to_int() << 8) | data[1].to_int()
if gz_len + 2 != data.length() {
raise InvalidRecord(
"DatabaseStore gzip length prefix \{gz_len} does not match payload \{data.length() - 2}",
)
}
@encoding.gzip_decompress(data[2:].to_owned()) catch {
_ => raise InvalidRecord("DatabaseStore RouterInfo gunzip failed")
}
} else {
data
}
let ri = @common.RouterInfo::decode(@encoding.Reader::new(raw)) catch {
e => raise Common(e)
}
if ri.identity.hash() != key {
@@ -370,7 +401,7 @@ pub fn NetDb::handle_database_lookup(
if lookup_type == 0 || lookup_type == 2 {
match self.get_router_info(key) {
Some(ri) => {
let raw = ri.to_bytes() catch { e => raise Common(e) }
let raw = encode_router_info_store_data(ri)
return DatabaseStore(
key~,
store_type=b'\x00',