feat: add public I2P network mode to router daemon
check / check (ubuntu-latest) (push) Failing after 26s
check / check (macos-latest) (push) Failing after 28s
check / check (windows-latest) (push) Failing after 29s

- Add `--public`, `--hops`, `--hosts`, and `--debug` router flags; `--public` auto-reseeds from the live network and keeps a status loop running.
- Route NetDB lookups through tunnels with Noise_N garlic wrapping, fan out to two floodfills, and fetch unknown RouterInfos in the background.
- Back off failed NTCP2 peers and fall back to IPv6 addresses when no IPv4 NTCP2 address is available.
- Size session LeaseSet2 expiry from lease end dates and use the destination's X25519 key when present.
- Add canonical Ed25519 Destination KeyCertificate constructors with round-trip tests.
- Fix DatabaseStore gzip handling to honor the length prefix, and send `Wget/1.11.4` as the reseed User-Agent.
This commit is contained in:
nandi committed 2026-11-28 00:11:28 -08:00
1 parent ae72b00323
commit 54cfb2faa9
25 files changed
+2033 -191

No files matched your search

+45 -40
View File
@@ -603,46 +603,51 @@ pub fn extract_ntcp2_peer(
ri : @common.RouterInfo,
host_override~ : String? = None,
) -> Ntcp2PeerInfo raise Ntcp2NetError {
for addr in ri.addresses {
if addr.transport_style != "NTCP2" {
continue
}
let s_b64 = match addr.options.get("s") {
Some(v) => v
None => continue
}
let i_b64 = match addr.options.get("i") {
Some(v) => v
None => continue
}
let port_str = match addr.options.get("port") {
Some(v) => v
None => continue
}
let host = match host_override {
Some(h) => h
None =>
match addr.options.get("host") {
Some(v) => v
None => continue
}
}
let port = match parse_port_str(port_str) {
Some(p) => p
None => continue
}
let static_key = @encoding.base64_decode(s_b64) catch {
_ => raise InvalidPeer("invalid base64 in NTCP2 's' option")
}
let iv = @encoding.base64_decode(i_b64) catch {
_ => raise InvalidPeer("invalid base64 in NTCP2 'i' option")
}
return {
router_hash: ri.identity.hash().as_bytes(),
static_key,
iv,
host,
port,
for pass = 0; pass < 2; pass = pass + 1 {
let allow_ipv6 = pass == 1
for addr in ri.addresses {
if addr.transport_style != "NTCP2" {
continue
}
let s_b64 = match addr.options.get("s") {
Some(v) => v
None => continue
}
let i_b64 = match addr.options.get("i") {
Some(v) => v
None => continue
}
let port_str = match addr.options.get("port") {
Some(v) => v
None => continue
}
let host = match host_override {
Some(h) => h
None =>
match addr.options.get("host") {
Some(v) => v
None => continue
}
}
if !allow_ipv6 && host.contains(":") {
continue
}
let port = match parse_port_str(port_str) {
Some(p) => p
None => continue
}
let static_key = @encoding.base64_decode(s_b64) catch { _ => continue }
let iv = @encoding.base64_decode(i_b64) catch { _ => continue }
if static_key.length() != 32 || iv.length() != 16 {
continue
}
return {
router_hash: ri.identity.hash().as_bytes(),
static_key,
iv,
host,
port,
}
}
}
raise InvalidPeer(