Capture traffic that ignores the system proxy with a virtual network adapter
Kernel-level
TUN mode creates a virtual network adapter in the system and captures traffic that does not follow the system proxy settings — game clients, terminal tools, container environments and similar cases. Once enabled, the kernel handles layer-3 traffic directly, and auto-route together with auto-detect-interface points the routing table at the virtual adapter automatically, so there is no need to edit the gateway by hand. Compared with changing only the system proxy, TUN covers more ground, at the cost of requiring administrator or root privileges and, on Windows, the Wintun driver.
tun:
enable: true
stack: system
auto-route: true
auto-detect-interface: true
The rules section matches top-down and stops at the first hit
Routing core
The rules section decides whether each connection goes direct or through a proxy, matching strictly from top to bottom and stopping at the first hit. Putting DOMAIN-SUFFIX first lets you classify a whole domain suffix in one line; IP-CIDR handles bare IP requests, GEOIP catches mainland China address ranges, and MATCH closes the list. Get the order wrong and traffic that should go direct takes a detour through the proxy, or internal addresses get forwarded by mistake. After editing rules, set the log level to debug and watch which rule fires — far faster than trial and error.
rules:
- DOMAIN-SUFFIX,github.com,PROXY
- IP-CIDR,10.0.0.0/8,DIRECT,no-resolve
- GEOIP,CN,DIRECT
- MATCH,PROXY
Defer real resolution until the connection is established
DNS
Fake-IP mode hands a domain a placeholder address from the 198.18.0.0/16 range and defers real resolution until the moment the connection is established, when the kernel decides by rule which DNS server to query. That removes a full DNS round trip, noticeably shortening the wait on first visits, and sidesteps resolution failures caused by a poisoned local DNS. The trade-off is that some programs needing the real IP get nothing useful, which is what fake-ip-filter is for — exclude LAN domains, NTP, STUN and similar entries.
dns:
enable: true
enhanced-mode: fake-ip
fake-ip-range: 198.18.0.1/16
nameserver: 223.5.5.5
Decouple node lists from rule configuration
Configuration
Subscription links are pulled in through proxy-providers, and the kernel refreshes the node list automatically at the interval you set — no manual re-import. Compared with writing nodes straight into config.yaml, the provider approach decouples node updates from rule configuration: the rule file stays put while the node list follows the subscription. Multiple subscriptions can coexist; reference them as needed with the use field in proxy-groups, or narrow things down with filter to keep only nodes matching a keyword. If a fetch fails, the last working list is kept, so live connections are unaffected.
proxy-providers:
main:
type: http
interval: 3600
url: "https://example.com/sub?token=xxxx"
One port serving both HTTP and SOCKS5
Inbound
mixed-port lets HTTP and SOCKS5 share a single port, so browsers, terminal tools and editor plugins all point at 7890 instead of remembering two port numbers. By default it listens on 127.0.0.1 only; to let other devices on your LAN use it, turn on allow-lan, set bind-address to a specific interface address, and add a username and password under authentication so the port is not left open to everyone on the subnet. If the port is already taken, the log reports a listen error — just switch to a free port.
mixed-port: 7890
allow-lan: false
bind-address: 127.0.0.1
authentication:
- "user:pass"
Organize nodes into groups with meaning
Policy
proxy-groups turn a set of nodes into groups that carry meaning: url-test picks the fastest node by latency, fallback steps down the list when the primary is unavailable, select leaves the choice to you, and load-balance spreads requests across several exits. Group names are referenced directly by the rules section, so keep them stable — renaming a group is renaming a route. The interval and tolerance settings under health-check control how often latency is tested and how eagerly the group switches, which keeps it from flapping when the network is jittery.
proxy-groups:
- name: Auto Select
type: url-test
interval: 300
url: http://www.gstatic.com/generate_204