feat: add ratchet, streaming, SU3 reseed, and router floodfill
- 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:
1 parent
8eafa11b22
commit
ae72b00323
54 files changed
+9607
-704
No files matched your search
@@ -6,22 +6,24 @@ A clean, zero-dependency, pure-[MoonBit](https://www.moonbitlang.com/) implement
|
||||
|
||||
```
|
||||
moon-i2p/
|
||||
├── encoding/ # I2P Base64 (-/~), Base32 (.b32.i2p), big-endian Reader/Writer, UTF-8, Hex
|
||||
├── crypto/ # Pure-MoonBit SHA-256, SHA-512, HMAC/HKDF-SHA256, ChaCha20-Poly1305, AES-256-CBC, X25519, Ed25519, SipHash-2-4
|
||||
├── common/ # Hash, KeyTypes, Certificate/KeyCertificate, Mapping, Destination, RouterIdentity, signed RouterInfo & LeaseSet2
|
||||
├── i2np/ # 16-byte standard & 9-byte NTCP2 short headers, SHA-256 checksums, core I2NP messages
|
||||
├── encoding/ # I2P Base64 (-/~), Base32 (.b32.i2p), DEFLATE/gzip/I2CP-gzip/ZIP, big-endian Reader/Writer, UTF-8, Hex
|
||||
├── crypto/ # Pure-MoonBit SHA-256, SHA-512, HMAC/HKDF-SHA256, ChaCha20-Poly1305, AES-256-CBC, X25519, Elligator2, Ed25519, SipHash-2-4
|
||||
├── common/ # Hash, KeyTypes, Certificate/KeyCertificate, Mapping, Destination, RouterIdentity, OfflineSignature, .su3 reseed, signed RouterInfo & LeaseSet2
|
||||
├── i2np/ # 16-byte standard & 9-byte NTCP2 short headers, SHA-256 checksums, encrypted DatabaseLookup & core I2NP messages
|
||||
├── noise/ # Noise_XK_25519_ChaChaPoly_SHA256 handshake/transport + NTCP2 SipHash-2-4 length masking
|
||||
├── ntcp2/ # Pure-MoonBit NTCP2 (Noise_XKaesobfse+hs2+hs3, AES-256-CBC obfuscation, SipHash KDF, data-phase blocks)
|
||||
├── ntcp2_net/ # Native POSIX TCP transport, OS CSPRNG/clock, and NTCP2 dial/accept session manager
|
||||
├── netdb/ # Pure-MoonBit NetDB & Floodfill Kademlia DHT (XOR distance, daily routing keys, Ed25519-verified store)
|
||||
├── tunnel/ # Pure-MoonBit Proposal 157 ShortTunnelBuild (218B records), 1024B TunnelData AES-256-CBC layer crypto, fragmentation & relay
|
||||
├── sam/ # SAMv3 text protocol parser, serializer, and command builders
|
||||
├── sam_client/ # Native POSIX TCP SAMv3 client with sane modern I2P defaults
|
||||
├── router/ # Native MoonBit I2P Router Core with transient identity, NetDB, TunnelManager, NTCP2 listener & embedded SAMv3 bridge
|
||||
├── ntcp2/ # Pure-MoonBit NTCP2 (Noise_XKaesobfse+hs2+hs3, AES-256-CBC obfuscation, SipHash KDF, replay/clock checks, data-phase blocks)
|
||||
├── ntcp2_net/ # Native POSIX non-blocking TCP dial/accept/frame transport, OS CSPRNG/clock, reseed HTTP/dir helpers
|
||||
├── netdb/ # Pure-MoonBit NetDB & Floodfill Kademlia DHT (XOR distance, daily routing keys, gunzip type 0 RI, Ed25519-verified store)
|
||||
├── tunnel/ # Pure-MoonBit Proposal 157 ShortTunnelBuild (218B records), 1024B TunnelData AES-256-CBC layer crypto, fragmentation & out-of-order relay
|
||||
├── ratchet/ # Pure-MoonBit Proposal 144 ECIES-X25519-AEAD-Ratchet (Noise_IKelg2+hs2, NS/NSR/ES, DH ratchet, Garlic cloves, ECIES DSM replies)
|
||||
├── streaming/ # Pure-MoonBit Ed25519-signed I2P Streaming (SYN/ACK/NACK/CLOSE/RESET, RTO retransmit, sliding window) & Repliable/Raw Datagrams
|
||||
├── sam/ # SAMv3 text protocol parser, serializer, PING/PONG, and command builders
|
||||
├── sam_client/ # Native POSIX TCP SAMv3 client with PING/PONG, --dest support, and modern I2P defaults
|
||||
├── router/ # Native MoonBit I2P Router Core with NTCP2 peer pool, floodfill NetDB crawl, Proposal 157 transit tunnels, Garlic/Streaming & SAMv3 bridge
|
||||
├── cmd/main/ # Pure protocol demo CLI entrypoint
|
||||
├── cmd/router/ # Native MoonBit I2P router daemon (`--sam`, `--ntcp2-port`, `--peer`)
|
||||
├── cmd/client/ # Native SAMv3 CLI (`keygen`, `lookup`, `http-get`, `dial`, `listen`)
|
||||
└── scripts/ # Loopback SAMv3 bridge (`mock_sam.py`) and end-to-end test (`e2e_test.py`)
|
||||
├── cmd/router/ # Native MoonBit I2P router daemon (`--sam`, `--ntcp2-port`, `--peer`, `--peer-dir`, `--su3`, `--reseed`, `--floodfill`)
|
||||
├── cmd/client/ # Native SAMv3 CLI (`keygen`, `lookup`, `http-get`, `dial`, `listen`, `--sam`, `--dest`)
|
||||
└── scripts/ # Loopback SAMv3 bridge (`mock_sam.py`), multi-router `demo.py`, and end-to-end test (`e2e_test.py`)
|
||||
```
|
||||
|
||||
### Verified Test Vectors & Interop
|
||||
@@ -75,7 +77,9 @@ python3 scripts/e2e_test.py
|
||||
- [x] **Phase 3 (Signatures & Block Crypto):** Pure-MoonBit **SHA-512**, **Ed25519** (RFC 8032), **AES-256-CBC** (FIPS-197 / SP 800-38A), and Ed25519-signed `RouterInfo` & `LeaseSet2` (Proposal 123).
|
||||
- [x] **Phase 4 (Direct Transport):** Full **NTCP2** protocol (`ntcp2/`) + native POSIX TCP transport (`ntcp2_net/`), verified live against public I2P floodfill routers.
|
||||
- [x] **Phase 5 (Router Core):** Pure-MoonBit **NetDB** & Floodfill Kademlia DHT (`netdb/`), Proposal 157 **ShortTunnelBuild** & 1024-byte `TunnelData` layer crypto/relay (`tunnel/`), and native **Router Core** + embedded SAMv3 bridge (`router/`, `cmd/router/`).
|
||||
- [ ] **Phase 6 (Full End-to-End I2P Network Tunneling):**
|
||||
- **ECIES-X25519-AEAD-Ratchet** (Proposal 144) for Garlic encryption & end-to-end remote peer sessions.
|
||||
- Active remote floodfill NetDB lookup/publish over NTCP2 + gzip decompression for `DatabaseStore` type 0.
|
||||
- **I2P Streaming** (SYN/ACK/windowing) & **Repliable Datagrams** over multi-hop remote tunnels.
|
||||
- [x] **Phase 6 (Full End-to-End I2P Network Tunneling):**
|
||||
- **ECIES-X25519-AEAD-Ratchet** (Proposal 144) with Elligator2, Bound/Unbound NS/NSR/ES, DH `NextKey` ratchet, Garlic cloves, and Proposal 154 ECIES `DatabaseLookup` replies (`ratchet/`).
|
||||
- Active floodfill NetDB lookup/publish over NTCP2, `DatabaseSearchReply` iterative crawl, `.su3` reseed ZIP extraction, and gzip decompression for `DatabaseStore` type 0 (`netdb/`, `common/su3.mbt`, `router/`).
|
||||
- Ed25519-signed **I2P Streaming** (SYN/ACK/NACK/CLOSE/RESET, sliding window & retransmit), **Repliable/Raw Datagrams** (`streaming/`), and multi-hop Proposal 157 **ShortTunnelBuild** + fragmented `TunnelData` transit relay (`tunnel/`, `router/`).
|
||||
|
||||
> **Note / Current Scope:** Transport is NTCP2 over TCP (`ntcp2/` / `ntcp2_net/`); SSU2 UDP transport and RSA-4096 certificate signature verification of `.su3` signer certificates are currently out of scope (all contained `RouterInfo` Ed25519 signatures inside `.su3` ZIP archives are verified before NetDB import).
|
||||
Reference in new issue
Block a user