feat: add HTTP-over-I2P proxy to router daemon
- Add --http-proxy/--proxy [host:port] (default 127.0.0.1:4444) to route .i2p and .b32.i2p HTTP requests over I2P streams - Block clearnet hosts with 403 and reject CONNECT and https:// with 501 - Support ?i2paddresshelper= jump links that register host aliases - Add `just proxy` target and -h/--help usage output - Expire idle ratchet sessions after 300s and add RatchetSessionManager::drop_session for fresh NewSession handshakes - Add NetDb::remove_lease_set2 and bound the outbound pending queue to 64 entries
This commit is contained in:
1 parent
54cfb2faa9
commit
14eae00f5c
15 files changed
+1941
-41
No files matched your search
@@ -19,9 +19,9 @@ moon-i2p/
|
||||
├── 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
|
||||
├── router/ # Native MoonBit I2P Router Core with NTCP2 peer pool, floodfill NetDB crawl, Proposal 157 transit tunnels, Garlic/Streaming, HTTP proxy & SAMv3 bridge
|
||||
├── cmd/main/ # Pure protocol demo CLI entrypoint
|
||||
├── cmd/router/ # Native MoonBit I2P router daemon (`--public`, `--hops`, `--hosts`, `--debug`, `--sam`, `--ntcp2-port`, `--peer`, `--peer-dir`, `--su3`, `--reseed`, `--floodfill`)
|
||||
├── cmd/router/ # Native MoonBit I2P router daemon (`--public`, `--http-proxy`, `--hops`, `--hosts`, `--debug`, `--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`)
|
||||
```
|
||||
@@ -51,14 +51,29 @@ moon build --target native cmd/router
|
||||
moon build --target native cmd/client
|
||||
|
||||
# Join the live public I2P network behind NAT (auto-reseeds, connects NTCP2 peers, builds tunnels)
|
||||
./_build/native/debug/build/cmd/router/router.exe --public --hops 1 --debug
|
||||
# Add --http-proxy 127.0.0.1:4444 to also run the native I2P browser HTTP proxy on port 4444:
|
||||
./_build/native/debug/build/cmd/router/router.exe --public --hops 1 --http-proxy 127.0.0.1:4444
|
||||
|
||||
# Or via just:
|
||||
just proxy
|
||||
|
||||
# Optional flags:
|
||||
# --hops <1..4> Tunnel length (e.g. --hops 2 for 2-hop Inbound & Outbound tunnels)
|
||||
# --hosts <hosts.txt> Load hostname=base64dest entries from a local I2P hosts.txt file
|
||||
# --debug Log peer dials, tunnel builds, NetDB lookups, and Garlic/Streaming state
|
||||
# --http-proxy [host:port] Enable HTTP-over-I2P proxy (default: 127.0.0.1:4444)
|
||||
# --hops <1..4> Tunnel length (e.g. --hops 2 for 2-hop Inbound & Outbound tunnels)
|
||||
# --hosts <hosts.txt> Load hostname=base64dest (or .b32.i2p) entries from a local I2P hosts.txt
|
||||
# --debug Log peer dials, tunnel builds, NetDB lookups, and Garlic/Streaming state
|
||||
|
||||
# Once tunnels are up (`tunnels=in:2/out:2`), resolve and fetch live public eepsites:
|
||||
# Once tunnels are up (`tunnels=in:2/out:2`), browse .i2p / .b32.i2p eepsites via the HTTP proxy:
|
||||
# Point your browser's HTTP Proxy to 127.0.0.1:4444 (or test with curl):
|
||||
curl -x http://127.0.0.1:4444 http://stats.i2p/
|
||||
curl -x http://127.0.0.1:4444 http://zzz.i2p/
|
||||
# Note: Non-.i2p clearnet requests are blocked (403 Forbidden), CONNECT/https:// are rejected (501),
|
||||
# User-Agent is normalized to MYOB/6.66 (AN/ON) for anti-fingerprinting compatibility,
|
||||
# built-in aliases cover well-known public eepsites (stats.i2p, zzz.i2p, tracker2.postman.i2p,
|
||||
# notbob.i2p, insulaocculta.i2p, tracker.insulaocculta.i2p, tracker.queke.i2p, opentracker.dg2.i2p),
|
||||
# and ?i2paddresshelper=<dest> jump links register aliases on the fly.
|
||||
|
||||
# Or resolve and fetch directly via SAMv3 with cmd/client:
|
||||
./_build/native/debug/build/cmd/client/client.exe lookup kqypgjpjwrphnzebod5ev3ts2vtii6e5tntrg4rnfijqc7rypldq.b32.i2p
|
||||
./_build/native/debug/build/cmd/client/client.exe http-get kqypgjpjwrphnzebod5ev3ts2vtii6e5tntrg4rnfijqc7rypldq.b32.i2p /
|
||||
```
|
||||
|
||||
Reference in new issue
Block a user