Skip to content

Commit b1c84b0

Browse files
committed
v0.2.0 - Per‑destination ephemeral identities
- Cache SAM sessions per .i2p domain (reuse identity for all assets on a site) - 300s idle timeout before session eviction and key wipe - Dramatically reduces tunnel builds compared to per‑request approach - Respects I2P network health while maintaining cross‑site unlinkability - Updated README with new behavior and configuration options
1 parent acd38bf commit b1c84b0

4 files changed

Lines changed: 382 additions & 290 deletions

File tree

Cargo.lock

Lines changed: 88 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
[package]
22
name = "i2p-ephemeral"
3-
version = "0.1.0"
3+
version = "0.2.0"
44
edition = "2021"
55

66
[dependencies]
77
yosemite = "0.6.3"
88
tokio = { version = "1", features = ["full"] }
99
anyhow = "1.0"
10-
rand = "0.8"
10+
rand = "0.8"
11+
dashmap = "5"
12+
tracing = "0.1"
13+
tracing-subscriber = "0.3"

README.md

Lines changed: 52 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,62 +2,86 @@
22

33
An ephemeral I2P proxy daemon written in Rust, designed to run on Android via **Termux**.
44

5-
Each request to an `.i2p` site generates a **fresh EdDSA (Sig=7) identity and keypair** via the I2P SAM bridge. On completion, the session is destroyed and keys are wiped — leaving no persistent identity linkable across requests.
5+
Each unique `.i2p` destination you visit receives a **fresh EdDSA (Sig=7) identity and keypair** via the I2P SAM bridge. The identity is cached and reused for all subsequent requests to that same site during your browsing session. After **300 seconds** of inactivity, the session is destroyed and keys are wiped—ensuring no persistent identity is linkable across different sites.
6+
7+
## Why per‑destination instead of per‑request?
8+
9+
Earlier versions created a new tunnel for every single HTTP request (images, CSS, scripts), which risked flooding the I2P network with excessive tunnel builds. The current **per‑destination caching** approach:
10+
11+
- Builds **one tunnel per website** (e.g., `forum.i2p`), reused for all assets on that page.
12+
- Maintains strong cross‑site unlinkability (different sites see different identities).
13+
- Dramatically reduces network overhead and respects I2P's shared infrastructure.
614

715
## How it works
816

917
```
18+
1019
Browser -> 127.0.0.1:8080 -> i2p-ephemeral -> SAM bridge -> .i2p destination
20+
1121
```
1222

13-
- Opens a SAM session (via yosemite crate) with a newly generated transient identity per request
14-
- Resolves the .i2p destination, connects, and proxies the response
15-
- Destroys the session and wipes keys immediately on completion
16-
- Max 2 concurrent sessions with a 2s throttle between accepts
23+
- **First request** to a `.i2p` domain: generates a new transient EdDSA identity via SAM.
24+
- **Subsequent requests** to the same domain reuse the cached session (no new tunnel build).
25+
- **Idle sessions** are automatically destroyed after **300 seconds** (configurable) and keys are wiped.
26+
- Up to **20 concurrent cached sessions** (LRU eviction) and **10 simultaneous connections**.
27+
- Throttles requests (500ms delay) to prevent accidental bursts.
1728

1829
## Requirements
1930

2031
- Termux on Android
21-
- I2P router running with SAM bridge enabled (default 127.0.0.1:7656)
22-
- Rust toolchain: pkg install rust
32+
- I2P router running with SAM bridge enabled (default `127.0.0.1:7656`)
33+
- Rust toolchain: `pkg install rust`
2334

2435
## Build
2536

2637
```bash
2738
cargo build --release
2839
```
2940

30-
## Run
41+
Run
3142

3243
```bash
3344
./target/release/i2p-ephemeral
3445
```
3546

36-
Set your browser proxy to **127.0.0.1:8080** and browse .i2p sites normally.
47+
Set your browser's HTTP proxy to 127.0.0.1:8080 and browse .i2p sites normally.
48+
49+
Privacy & Network Impact
3750

38-
## Privacy model
51+
Property Status
52+
Fresh identity per destination Yes
53+
No persistent keypair on disk Yes
54+
Keys wiped after idle timeout Yes (300s)
55+
No cross‑site linkability Yes
56+
EdDSA Sig=7 (I2P standard) Yes
57+
Network‑friendly (per‑site tunnels) Yes
3958

40-
| Property | Status |
41-
|---|---|
42-
| Fresh identity per request | Yes |
43-
| No persistent keypair on disk | Yes |
44-
| Keys wiped after session | Yes |
45-
| No cross-request linkability | Yes |
46-
| EdDSA Sig=7 (I2P standard) | Yes |
59+
Configuration
4760

48-
## Dependencies
61+
Adjust the following constants in src/main.rs to suit your needs:
4962

50-
| Crate | Purpose |
51-
|---|---|
52-
| yosemite | I2P SAM bridge client |
53-
| tokio | Async runtime |
54-
| anyhow | Error handling |
55-
| rand | Identity name generation |
63+
Constant Default Description
64+
SESSION_IDLE_TIMEOUT_SECS 300 Seconds before an unused session is evicted
65+
MAX_CACHED_SESSIONS 20 Maximum number of distinct sites cached
66+
MAX_CONCURRENT 10 Maximum simultaneous client connections
67+
REQUEST_THROTTLE_MS 500 Delay between accepting connections
68+
69+
Rebuild after changes:
70+
71+
```bash
72+
cargo build --release
73+
```
5674

57-
## License
75+
Dependencies
5876

59-
MIT
77+
Crate Purpose
78+
yosemite I2P SAM bridge client
79+
tokio Async runtime
80+
anyhow Error handling
81+
rand Identity name generation
82+
dashmap Concurrent session cache
83+
tracing Structured logging
6084

61-
---
85+
License
6286

63-
> Part of a broader personal privacy toolchain. See also: [OTRv4Plus](https://github.com/muc111/OTRv4Plus)
87+
MIT

0 commit comments

Comments
 (0)