Files
leaf/examples/tls-cabi/trojan-ws-rust.json
eric 32944836ce docs: describe the plugin system, and add the example chains
The README gains a Plugins section: what a plugin is, the six that ship with
the tree, how one is configured as an outbound, why `path` must have a
directory part, why nothing is ever scanned for, why leaf refuses a library
anyone can rewrite, and why the optional `sha256` is worth setting. It says
plainly what none of that buys -- a plugin runs with leaf's privileges, so the
checks establish which file was loaded, not that it is friendly -- and how to
vet one with `--verify-plugin` first. It also covers building a leaf that can
load plugins at all, which neither the releases nor CI produce: the Linux
releases are static against musl and have no dynamic loader to call.

examples/ carries configs that run. The shadowsocks one connects through the
Rust plugin; the TLS ones chain a transport plugin under Trojan across the
Rust and Go implementations, with Windows variants where the paths differ,
and both READMEs give the server side needed to try them.
2026-12-03 19:31:53 +08:00

64 lines
1.1 KiB
JSON

{
"log": {
"level": "debug",
"output": "console"
},
"inbounds": [
{
"tag": "socks-in",
"address": "127.0.0.1",
"port": 1080,
"protocol": "socks",
"settings": {}
}
],
"outbounds": [
{
"tag": "trojan-over-tls-cabi-rs",
"protocol": "chain",
"settings": {
"actors": [
"tls-cabi-rs",
"ws",
"trojan"
]
}
},
{
"tag": "tls-cabi-rs",
"protocol": "plugin",
"settings": {
"path": "./target/debug/libtls_cabi_rs.dylib",
"args": "{\"server_name\":\"www.shocktraffic.org\",\"alpn\":[\"http/1.1\"]}"
}
},
{
"tag": "ws",
"protocol": "ws",
"settings": {
"path": "/assignment",
"headers": {
"Host": "www.shocktraffic.org"
}
}
},
{
"tag": "trojan",
"protocol": "trojan",
"settings": {
"address": "www.shocktraffic.org",
"port": 443,
"password": "humanity"
}
}
],
"router": {
"rules": [
{
"type": "FINAL",
"target": "trojan-over-tls-cabi-rs"
}
]
}
}