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

+35
View File
@@ -9,6 +9,33 @@ pub struct KeysAndCert {
certificate : Certificate
}
///|
/// Constructs a modern Ed25519 `Destination` `KeysAndCert` (CryptoType=0 ElGamal, SigType=7 Ed25519).
/// Per I2P Proposal 123/144, Destinations always use ElGamal (0) in their KeyCertificate while
/// placing active X25519 encryption keys in `LeaseSet2.encryption_keys`:
/// `padding` (352 bytes, or zero-filled if omitted) occupies bytes 0..352,
/// and the Ed25519 signing public key (32 bytes) is right-aligned at bytes 352..384.
pub fn KeysAndCert::new_destination_ed25519(
signing_pub : Bytes,
padding~ : Bytes = b"",
) -> KeysAndCert raise CommonError {
if signing_pub.length() != 32 {
raise InvalidLength(
"Ed25519 public key must be 32 bytes, got \{signing_pub.length()}",
)
}
let buf = FixedArray::make(384, b'\x00')
let pad_len = if padding.length() < 352 { padding.length() } else { 352 }
for i = 0; i < pad_len; i = i + 1 {
buf[i] = padding[i]
}
for i = 0; i < 32; i = i + 1 {
buf[352 + i] = signing_pub[i]
}
let cert = Certificate::Key(KeyCertificate::new(EdDsaSha512Ed25519, ElGamal))
{ key_data: Bytes::from_array(buf), certificate: cert, }
}
///|
/// Constructs a modern X25519 + Ed25519 `KeysAndCert` (CryptoType=4, SigType=7).
/// Per I2P spec: X25519 public key (32 bytes) is placed at bytes 0..32,
@@ -138,6 +165,14 @@ pub fn Destination::new(inner : KeysAndCert) -> Destination {
{ inner, }
}
///|
pub fn Destination::new_ed25519(
signing_pub : Bytes,
padding~ : Bytes = b"",
) -> Destination raise CommonError {
{ inner: KeysAndCert::new_destination_ed25519(signing_pub, padding~), }
}
///|
pub fn Destination::new_x25519_ed25519(
crypto_pub : Bytes,