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

+13 -2
View File
@@ -123,6 +123,17 @@ pub fn NetDb::leaseset_count(self : NetDb) -> Int32 {
self.leasesets.length()
}
///|
pub fn NetDb::floodfill_count(self : NetDb) -> Int32 {
let mut n = 0
for entry in self.routers {
if is_floodfill(entry.1) {
n += 1
}
}
n
}
///|
/// Stores a `RouterInfo` after verifying its Ed25519 signature.
/// Returns `true` if inserted or updated (newer `published` timestamp), `false` if stale.
@@ -333,12 +344,12 @@ pub fn NetDb::handle_database_store(
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() {
if gz_len <= 0 || 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 {
@encoding.gzip_decompress(data[2:2 + gz_len].to_owned()) catch {
_ => raise InvalidRecord("DatabaseStore RouterInfo gunzip failed")
}
} else {
+1
View File
@@ -34,6 +34,7 @@ pub struct NetDb {
leasesets : Array[(@common.Hash, @common.LeaseSet2)]
}
pub fn NetDb::closest_peers(Self, @common.Hash, String, Int32, floodfills_only? : Bool, excluded? : Array[@common.Hash]) -> Array[@common.RouterInfo]
pub fn NetDb::floodfill_count(Self) -> Int32
pub fn NetDb::get_lease_set2(Self, @common.Hash, UInt32) -> @common.LeaseSet2?
pub fn NetDb::get_lease_set2_by_b32(Self, String, UInt32) -> @common.LeaseSet2?
pub fn NetDb::get_router_info(Self, @common.Hash) -> @common.RouterInfo?