mirror of
https://github.com/eycorsican/leaf.git
synced 2026-12-05 08:01:26 +00:00
d2fcffbd7604ce46d675fc644fb466712661fd80
A client that has finished sending says so by closing its write side and goes on reading, and plenty of protocols end a request that way and no other. Over a websocket transport that signal went nowhere: `poll_shutdown` returned without sending anything, so the far end learned the request had ended only when the connection itself went away -- when the downlink grace expires, ten seconds later, by which time the reply has nowhere to go. The comment above it said as much. A Close frame is the obvious candidate and the wrong one. RFC 6455 makes it the start of closing the whole connection, and tungstenite enforces that at both ends: once a Close has been received the connection will not carry another data frame, so the reply still on its way back is lost. Measured, not assumed -- the server read the origin's answer and then failed to forward it. An empty binary frame says the same thing and costs nothing. It is an ordinary data frame carrying no bytes, so a peer that does not understand it hands nothing to its application and carries on, which is exactly today's behaviour. This transport's read side has always turned a frame with no bytes into an end of stream, so between two leaf nodes it is precisely the missing signal. A write of no bytes now returns early rather than sending one by accident. Still behind WS_HALF_CLOSE, off by default, for the peer that would rather error than ignore it. Booleans now also accept 1/yes/on: an option that is silently ignored, as WS_HALF_CLOSE=1 was, is worse than one that is missing.
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%
