mirror of
https://github.com/eycorsican/leaf.git
synced 2026-12-05 16:02:32 +00:00
64d92432eddbc66002e9ccd07911d4ff20b70f28
Every accepted inbound socket was given SO_LINGER = 0, so closing it sent a reset. That discards whatever is still queued for the peer: a response whose end is marked by the close itself -- HTTP/1.0, a body with no length, anything read to EOF -- can be truncated, and a peer that has received every byte but not yet read them can still see the transfer fail with a reset. What it bought was the socket back at once, with no TIME_WAIT. But TIME_WAIT falls on whoever closes first, and on the common paths that is the client: leaf is the passive closer and has no TIME_WAIT to avoid. The reclaim is only ever paid for on the paths where leaf closes first -- the idle timeouts and the error teardowns -- and those are the paths where a reset is the right answer anyway. So it is now off by default and available as TCP_INBOUND_ABORT_ON_CLOSE, for devices that cannot afford the sockets. Sessions are still bounded by the existing uplink and downlink idle timeouts.
Leaf
A versatile and efficient proxy framework.
Supported Protocols
Proxy Protocols
| Protocol | Inbound | Outbound |
|---|---|---|
| HTTP | ✅ | ❌ |
| SOCKS5 | ✅ | ✅ |
| Shadowsocks | ✅ | ✅ |
| Trojan | ✅ | ✅ |
| VMess | ❌ | ✅ |
| Vless | ❌ | ✅ |
Transports & Security
| Transport | Inbound | Outbound | Notes |
|---|---|---|---|
| WebSocket | ✅ | ✅ | |
| TLS | ✅ | ✅ | |
| QUIC | ✅ | ✅ | |
| AMux | ✅ | ✅ | Leaf specific multiplexing |
| Obfs | ❌ | ✅ | Simple obfuscation |
| Reality | ❌ | ✅ | Xray Reality |
| MPTP | ✅ | ✅ | Multi-path Transport Protocol (Aggregation) (Architecture, Usage) |
Traffic Control
| Feature | Inbound | Outbound | Notes |
|---|---|---|---|
| Chain | ✅ | ✅ | Proxy chaining |
| Failover | ❌ | ✅ | Failover with health check |
Transparent Proxying
| Mechanism | Inbound | Outbound | Notes |
|---|---|---|---|
| TUN | ✅ | ❌ | Linux, macOS, Windows, iOS, Android; lwip, smoltcp |
| NF | ✅ | ❌ | Windows, NetFilter SDK |
| TPROXY | ❌ | ❌ | Linux; Coming soon |
Building
cargo build -p leaf-cli --release
./target/debug/leaf --help
License
This project is licensed under the Apache License 2.0.
Description
A versatile and efficient proxy framework.
4.5 MiB
0 Stars
1 Watchers
0 Forks
Languages
Rust
99.5%
Shell
0.5%
