mirror of
https://github.com/eycorsican/leaf.git
synced 2026-12-05 08:01:26 +00:00
v0.1.1
Leaf
Leaf 是一个轻量且快速的代理工具。
配置文件
{
"log": {
"level": "info"
},
"dns": [
"1.1.1.1",
"8.8.8.8"
],
"inbounds": [
{
"listen": "127.0.0.1",
"port": 1087,
"protocol": "http"
},
{
"listen": "127.0.0.1",
"port": 1086,
"protocol": "socks",
"settings": {
"bind": "127.0.0.1"
}
}
],
"outbounds": [
{
"protocol": "failover",
"settings": {
"actors": [
"vmess_out",
"trojan_out"
],
"checkInterval": 300,
"failTimeout": 4,
"healthCheck": true
},
"tag": "failover_out"
},
{
"protocol": "tryall",
"settings": {
"actors": [
"trojan_out",
"vmess_out"
],
"delayBase": 0
},
"tag": "tryall_out"
},
{
"protocol": "random",
"settings": {
"actors": [
"trojan_out",
"vmess_out"
]
},
"tag": "random"
},
{
"protocol": "vmess",
"settings": {
"url": "wss://my.domain.com/v2",
"uuid": "6541dbe7-6877-4ce0-80a5-291d3db87650"
},
"tag": "vmess_out"
},
{
"protocol": "trojan",
"settings": {
"address": "x.x.x.x",
"domain": "my.domain.com",
"password": "112358",
"port": 443
},
"tag": "trojan_out"
},
{
"protocol": "shadowsocks",
"settings": {
"address": "x.x.x.x",
"method": "chacha20-ietf-poly1305",
"password": "123456",
"port": 8389
},
"tag": "shadowsocks_out"
},
{
"protocol": "socks",
"settings": {
"address": "x.x.x.x",
"port": 1080
},
"tag": "socks_out"
},
{
"protocol": "direct",
"tag": "direct"
},
{
"protocol": "drop",
"tag": "drop"
}
],
"rules": [
{
"ip": [
"8.8.8.8",
"8.8.4.4"
],
"target": "failover_out"
},
{
"domain": [
"www.google.com"
],
"target": "failover_out"
},
{
"domainSuffix": [
"google.com"
],
"target": "failover_out"
},
{
"domainKeyword": [
"google"
],
"target": "failover_out"
},
{
"external": [
"site:geosite.dat:cn"
],
"target": "direct"
},
{
"external": [
"mmdb:geo.mmdb:cn"
],
"target": "direct"
}
]
}
Outbound 类型
支持常见的代理协议比如 Shadowsocks、VMess+WSS、Trojan,另外有三个组合类型的 Outbound:
failover
{
"protocol": "failover",
"settings": {
"actors": [
"vmess_out",
"trojan_out"
],
"failTimeout": 4,
"healthCheck": true,
"checkInterval": 300
},
"tag": "failover_out"
}
向列表中的 Outbound 逐个发送请求,直到找到一个可用的 Outbound,可选参数有
failTimeout握手超时,包括 TCP 握手及相应代理协议握手的时间healthCheck如果为true,则对列表中的 Outbound 定时做健康检查,并按延迟重新排序checkInterval健康检查间隔
tryall
{
"protocol": "tryall",
"settings": {
"actors": [
"trojan_out",
"vmess_out"
],
"delayBase": 0
},
"tag": "tryall_out"
}
向列表中的所有 Outbound 同时发起代理请求,选取握手成功最快的 Outbound,可选参数有
delayBase延时基数,如果大于 0,则代理请求会延迟 delayBase * index 毫秒,index 从 0 起,每个 Outbound 递增 1
random
{
"protocol": "random",
"settings": {
"actors": [
"trojan_out",
"vmess_out"
]
},
"tag": "random"
}
从列表中随机选一个 Outbound 发送请求。
规则
规则方面跟 V2Ray 差不多,只是把域名规则展开成 domain, domainSuffix, domainKeyword。
external 规则可以从外部文件加载规则,支持两种格式
mmdbMaxMind 的 mmdb 格式siteV2Ray 的dat文件格式
Description
A versatile and efficient proxy framework.
4.5 MiB
0 Stars
1 Watchers
0 Forks
Languages
Rust
99.5%
Shell
0.5%