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

+35 -6
View File
@@ -124,6 +124,15 @@ pub fn SamConfig::with_address(
{ ..self, host, port, }
}
///|
/// Sets the SAM `DESTINATION` parameter (`"TRANSIENT"` or Base64 private keys).
pub fn SamConfig::with_destination(
self : SamConfig,
destination : String,
) -> SamConfig {
{ ..self, destination, }
}
///|
fn parse_port(s : String) -> Int32 raise SamClientError {
if s.length() == 0 {
@@ -194,6 +203,26 @@ fn ensure_ok(reply : @sam.SamMessage) -> Unit raise SamClientError {
}
}
///|
fn read_sam_reply_handling_ping(
conn : TcpConn,
) -> @sam.SamMessage raise SamClientError {
while true {
let reply = parse_sam_reply(conn.read_line())
if reply.verb == "PING" {
let pong = @sam.SamMessage::new(
"PONG",
subcommand=reply.subcommand,
params=reply.params,
)
conn.write_string(pong.serialize())
continue
}
return reply
}
raise Closed
}
///|
fn perform_hello(
conn : TcpConn,
@@ -201,7 +230,7 @@ fn perform_hello(
) -> String raise SamClientError {
let cmd = @sam.hello_version(min=config.min_version, max=config.max_version)
conn.write_string(cmd.serialize())
let reply = parse_sam_reply(conn.read_line())
let reply = read_sam_reply_handling_ping(conn)
if reply.verb != "HELLO" || reply.subcommand != Some("REPLY") {
raise ProtocolError("expected HELLO REPLY, got '\{reply.verb}'")
}
@@ -264,7 +293,7 @@ pub fn SamClient::dest_generate(
}
let cmd = @sam.dest_generate(signature_type=sig.to_string())
self.conn.write_string(cmd.serialize())
let reply = parse_sam_reply(self.conn.read_line())
let reply = read_sam_reply_handling_ping(self.conn)
if reply.verb != "DEST" || reply.subcommand != Some("REPLY") {
raise ProtocolError("expected DEST REPLY, got '\{reply.verb}'")
}
@@ -300,7 +329,7 @@ fn naming_lookup_on_conn(
) -> SamDestination raise SamClientError {
let cmd = @sam.naming_lookup(name)
conn.write_string(cmd.serialize())
let reply = parse_sam_reply(conn.read_line())
let reply = read_sam_reply_handling_ping(conn)
if reply.verb != "NAMING" || reply.subcommand != Some("REPLY") {
raise ProtocolError("expected NAMING REPLY, got '\{reply.verb}'")
}
@@ -344,7 +373,7 @@ pub fn SamClient::session_create(
options=opts,
)
self.conn.write_string(cmd.serialize())
let reply = parse_sam_reply(self.conn.read_line())
let reply = read_sam_reply_handling_ping(self.conn)
if reply.verb != "SESSION" || reply.subcommand != Some("STATUS") {
raise ProtocolError("expected SESSION STATUS, got '\{reply.verb}'")
}
@@ -431,7 +460,7 @@ pub fn SamSession::stream_connect(
let _ = perform_hello(data_conn, self.config)
let cmd = @sam.stream_connect(self.id, dest_b64, silent=false)
data_conn.write_string(cmd.serialize())
let reply = parse_sam_reply(data_conn.read_line())
let reply = read_sam_reply_handling_ping(data_conn)
if reply.verb != "STREAM" || reply.subcommand != Some("STATUS") {
raise ProtocolError("expected STREAM STATUS, got '\{reply.verb}'")
}
@@ -454,7 +483,7 @@ pub fn SamSession::stream_accept(
let _ = perform_hello(data_conn, self.config)
let cmd = @sam.stream_accept(self.id, silent=false)
data_conn.write_string(cmd.serialize())
let reply = parse_sam_reply(data_conn.read_line())
let reply = read_sam_reply_handling_ping(data_conn)
if reply.verb != "STREAM" || reply.subcommand != Some("STATUS") {
raise ProtocolError("expected STREAM STATUS, got '\{reply.verb}'")
}