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

+68 -3
View File
@@ -166,7 +166,9 @@ pub(all) enum I2npPayload {
from~ : @common.Hash,
flags~ : Byte,
reply_tunnel_id~ : UInt32?,
excluded_peers~ : Array[@common.Hash]
excluded_peers~ : Array[@common.Hash],
reply_key~ : Bytes?,
reply_tags~ : Array[Bytes]
)
/// Type 3: DatabaseSearchReply (floodfill returns closest router hashes).
DatabaseSearchReply(
@@ -236,7 +238,15 @@ pub fn I2npPayload::encode_body(self : I2npPayload) -> Bytes raise I2npError {
}
w.write_bytes(data)
}
DatabaseLookup(key~, from~, flags~, reply_tunnel_id~, excluded_peers~) => {
DatabaseLookup(
key~,
from~,
flags~,
reply_tunnel_id~,
excluded_peers~,
reply_key~,
reply_tags~
) => {
key.encode(w)
from.encode(w)
w.write_u8(flags)
@@ -253,6 +263,39 @@ pub fn I2npPayload::encode_body(self : I2npPayload) -> Bytes raise I2npError {
for peer in excluded_peers {
peer.encode(w)
}
let enc_aes = (flags.to_int() & 0x02) != 0
let enc_ecies = (flags.to_int() & 0x10) != 0
if enc_aes || enc_ecies {
match reply_key {
Some(rk) => {
if rk.length() != 32 {
raise InvalidLength(
"DatabaseLookup reply_key must be 32 bytes, got \{rk.length()}",
)
}
w.write_bytes(rk)
}
None =>
raise InvalidLength(
"DatabaseLookup encryption flag requires reply_key",
)
}
let expected_tag_len = if enc_ecies { 8 } else { 32 }
if reply_tags.length() == 0 || reply_tags.length() > 255 {
raise InvalidLength(
"DatabaseLookup encrypted reply requires 1..255 reply_tags",
)
}
w.write_u8(reply_tags.length().to_byte())
for tag in reply_tags {
if tag.length() != expected_tag_len {
raise InvalidLength(
"DatabaseLookup reply_tag must be \{expected_tag_len} bytes, got \{tag.length()}",
)
}
w.write_bytes(tag)
}
}
}
DatabaseSearchReply(key~, peer_hashes~, from~) => {
key.encode(w)
@@ -353,7 +396,29 @@ pub fn I2npPayload::decode_body(
},
)
}
DatabaseLookup(key~, from~, flags~, reply_tunnel_id~, excluded_peers~)
let enc_aes = (flags.to_int() & 0x02) != 0
let enc_ecies = (flags.to_int() & 0x10) != 0
let (reply_key, reply_tags) = if enc_aes || enc_ecies {
let rk = r.read_bytes(32) catch { e => raise Encoding(e) }
let tag_count = (r.read_u8() catch { e => raise Encoding(e) }).to_int()
let tag_len = if enc_ecies { 8 } else { 32 }
let tags : Array[Bytes] = Array(capacity=tag_count)
for _i = 0; _i < tag_count; _i = _i + 1 {
tags.push(r.read_bytes(tag_len) catch { e => raise Encoding(e) })
}
(Some(rk), tags)
} else {
(None, [])
}
DatabaseLookup(
key~,
from~,
flags~,
reply_tunnel_id~,
excluded_peers~,
reply_key~,
reply_tags~,
)
}
DatabaseSearchReply => {
let key = @common.Hash::decode(r) catch { e => raise Common(e) }