MPTP (Multipath Transport Protocol) combines multiple outbound paths into one logical transport channel. In Leaf, the common deployment is:
- Client side: local
socksinbound +mptpoutbound - Server side:
mptpinbound +directoutbound
Client example (client.json):
{
"inbounds": [
{
"protocol": "socks",
"address": "127.0.0.1",
"port": 1086
}
],
"outbounds": [
{
"protocol": "mptp",
"settings": {
"actors": [
"direct1",
"direct2"
],
"address": "127.0.0.1",
"port": 3001
}
},
{
"protocol": "direct",
"tag": "direct1"
},
{
"protocol": "direct",
"tag": "direct2"
}
]
}Server example (server.json):
{
"inbounds": [
{
"protocol": "mptp",
"address": "0.0.0.0",
"port": 3001
}
],
"outbounds": [
{
"protocol": "direct"
}
]
}Key fields:
outbounds[].protocol = "mptp": enables MPTP client outboundsettings.actors: list of outbound tags used as sub-connectionssettings.address,settings.port: MPTP server address and portinbounds[].protocol = "mptp": enables MPTP server inbound listener
MPTP outbound can also be configured in [Proxy Group]:
[Proxy Group]
MptpOutTag = mptp, actor1, actor2, actor3, address=1.2.3.4, port=10000
Build:
cargo build -p leaf-cli --releaseRun server:
./target/release/leaf -c server.jsonRun client:
./target/release/leaf -c client.json- Configure your app to use local SOCKS5 proxy
127.0.0.1:1086. - Start with simple connectivity checks:
curl --socks5 127.0.0.1:1086 https://example.com- Verify configuration syntax before production startup:
./target/release/leaf -c client.json -T
./target/release/leaf -c server.json -Tactorsshould include at least two outbounds to achieve multipath aggregation.- Ensure each actor tag exists in
outbounds. - Open server listening port (for example
3001) in firewall/security group.