mirror of
https://github.com/eycorsican/leaf.git
synced 2026-12-05 08:01:26 +00:00
docs/configuration.md lists every JSON option, environment variable and command-line flag: what it does, what it accepts, and what happens when it is left out, with the .conf keys mapped onto them. Options that decide whether traffic stays behind the proxy are marked. docs/security.md explains those choices together: names looked up outside the proxy, where unmatched traffic goes, direct fallback, IPv6 under TUN, certificate checks, logs, and how the protocols fare on filtered networks, without presenting any as safe from a censor. It ends with a configuration to start from, which has been run. examples/README.md says what each example is for and what to change before deploying one. The README links all three and no longer names the TUN stacks that were replaced.
48 lines
3.1 KiB
Markdown
48 lines
3.1 KiB
Markdown
# Examples
|
|
|
|
Each directory is a client configuration with a README that says how to build
|
|
and run it. They exist to show how outbounds and plugins fit together and to
|
|
check that a build works. They are not deployment configurations: read
|
|
[What to change before deploying](#what-to-change-before-deploying) first, and
|
|
[docs/security.md](../docs/security.md) for why.
|
|
|
|
| Example | What it shows | Notes |
|
|
|---|---|---|
|
|
| [`tls-cabi/trojan-ws-native-tls.json`](tls-cabi/README.md) | Trojan over WebSocket over leaf's built-in TLS | The reference the plugin variants are compared against |
|
|
| [`tls-cabi/trojan-ws-rust.json`](tls-cabi/README.md) | The same, with TLS from the `tls-cabi-rs` plugin | Bundled public roots |
|
|
| [`tls-cabi/trojan-ws-go.json`](tls-cabi/README.md) | The same, with TLS from the `tls-cabi-go` plugin | The operating system's roots |
|
|
| [`tls-cabi/trojan-ws-go-trojan-go.json`](tls-cabi/README.md) | TLS and Trojan both from Go plugins, TCP and UDP | Two Go runtimes in one process |
|
|
| `tls-cabi/*.windows.json` | The Go variants with Windows library names | |
|
|
| [`shadowsocks-cabi/client.json`](shadowsocks-cabi/README.md) | Shadowsocks from the `shadowsocks-cabi-rs` plugin, TCP and UDP | Shadowsocks is easy to spot on filtered networks |
|
|
| [`anytls-cabi/client.json`](anytls-cabi/README.md) | AnyTLS from the `anytls-cabi-go` plugin | Placeholder server and password |
|
|
| [`shadowtls-cabi/client.json`](shadowtls-cabi/README.md) | Shadowsocks under ShadowTLS v3, built-in and plugin outbounds in one chain | Placeholder server and password |
|
|
|
|
All of them listen for SOCKS5 on `127.0.0.1:1080` and send everything to the
|
|
proxy with a `FINAL` rule, so nothing goes direct when the proxy is down. None
|
|
of them turns off certificate verification.
|
|
|
|
The `tls-cabi` configurations talk to a public demonstration server with a
|
|
published password, and `shadowsocks-cabi` to a public test server. That is
|
|
fine for checking a build and wrong for anything else: anyone can read what
|
|
passes through a server whose password is public.
|
|
|
|
## What to change before deploying
|
|
|
|
- **Log level.** The examples log at `debug` or `trace` so you can watch the
|
|
handshake, and at those levels leaf logs every destination. Use `warn`.
|
|
- **DNS.** None of them has a `dns` section, so leaf's resolver is plain DNS to
|
|
`1.1.1.1`. Set `dns.servers`, preferably to DoH with the resolver's address:
|
|
`"doh:resolver.example@192.0.2.53"`.
|
|
- **The proxy's address.** The `tls-cabi` examples name the proxy by host name,
|
|
which leaf looks up over the local network before it connects, in the clear
|
|
with the default resolver. Give the proxy's IP address as the endpoint's
|
|
`address` or `host`, and keep the name in the TLS `server_name`, so the
|
|
certificate is still checked against it. Or pin the name in `dns.hosts`.
|
|
- **Credentials and servers.** Replace them with your own.
|
|
- **Plugins.** Pin each `path` with `sha256`, and load libraries from a
|
|
directory only the deployer can write. See the
|
|
[README](../README.md#plugins).
|
|
|
|
[docs/security.md](../docs/security.md#a-starting-point) has a configuration
|
|
with all of this done.
|