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

+46
View File
@@ -192,3 +192,49 @@ test "NTCP2 full XKaesobfse handshake + Data Phase SipHash framing round-trip" {
_ => fail("expected I2np block from Bob")
}
}
///|
test "NTCP2 replay cache, clock skew validation, and network_id check" {
let rc = @ntcp2.EphemeralReplayCache::new(max_entries=4)
let x1 = Bytes::make(32, b'\x01')
let x2 = Bytes::make(32, b'\x02')
assert_eq(rc.check_and_insert(x1, 1000U), true)
assert_eq(rc.check_and_insert(x1, 1010U), false) // replay within window
assert_eq(rc.check_and_insert(x2, 1010U), true)
assert_eq(rc.check_and_insert(x1, 1200U), true) // expired after 120s window
@ntcp2.validate_clock_skew(1000U, 1059U)
let mut skewed = false
@ntcp2.validate_clock_skew(1000U, 1061U) catch {
ClockSkew(_, _) => skewed = true
_ => ()
}
assert_eq(skewed, true)
let alice_s = @noise.KeyPair::from_private(Bytes::make(32, b'\x33'))
let alice_e = @noise.KeyPair::from_private(Bytes::make(32, b'\x44'))
let bob_s = @noise.KeyPair::from_private(Bytes::make(32, b'\x55'))
let bob_hash = @crypto.sha256(b"bob-netid")
let bob_iv = Bytes::make(16, b'\x66')
let alice = @ntcp2.Ntcp2Handshake::new_initiator(
alice_s,
bob_s.public_key,
bob_hash,
bob_iv,
)
alice.set_ephemeral(alice_e)
let bad_msg1 = alice.write_session_request(
64,
1700000000U,
network_id=b'\x09',
)
let bob = @ntcp2.Ntcp2Handshake::new_responder(bob_s, bob_hash, bob_iv)
let mut bad_net = false
try {
let _ = bob.read_session_request(bad_msg1)
} catch {
InvalidNetworkId(b'\x09') => bad_net = true
_ => ()
}
assert_eq(bad_net, true)
}