MCPcopy Index your code
hub / github.com/eycorsican/leaf

github.com/eycorsican/leaf @v0.14.2

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.14.2 ↗ · + Follow
1,322 symbols 3,342 edges 201 files 51 documented · 4%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

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)

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.

Extension points exported contracts — how you extend this code

OutboundDatagram (Interface)
An unreliable transport for outbound handlers. [15 implementers]
leaf/src/proxy/mod.rs
InboundDatagram (Interface)
An unreliable transport for inbound handlers. [7 implementers]
leaf/src/proxy/mod.rs
OutboundStreamHandler (Interface)
(no doc) [22 implementers]
leaf/src/proxy/mod.rs
OutboundDatagramRecvHalf (Interface)
(no doc) [15 implementers]
leaf/src/proxy/mod.rs
OutboundDatagramSendHalf (Interface)
(no doc) [15 implementers]
leaf/src/proxy/mod.rs

Core symbols most depended-on inside this repo

new
called by 1347
leaf/src/proxy/tun/inbound.rs
clone
called by 640
leaf/src/session.rs
is_empty
called by 275
leaf/src/app/router.rs
read
called by 49
leaf/src/proxy/reality/stream.rs
ip
called by 42
leaf/src/session.rs
port
called by 40
leaf/src/session.rs
tag
called by 37
leaf/src/proxy/inbound.rs
stream
called by 35
leaf/src/proxy/inbound.rs

Shape

Method 599
Class 362
Function 286
Enum 45
Interface 30

Languages

Rust100%

Modules by API surface

leaf/src/config/internal/config.rs59 symbols
leaf/src/proxy/nf/inbound/mod.rs55 symbols
leaf/src/proxy/mod.rs43 symbols
leaf/src/config/common.rs43 symbols
leaf/src/proxy/amux/mod.rs33 symbols
leaf/src/session.rs32 symbols
leaf/src/app/stat_manager.rs31 symbols
leaf/src/app/router.rs28 symbols
leaf/src/config/geosite.rs27 symbols
leaf/src/lib.rs26 symbols
leaf/src/config/conf/config.rs26 symbols
leaf/src/proxy/reality/stream.rs24 symbols

For agents

$ claude mcp add leaf \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact