历史文档适用范围
本文保留原版 Clash / Clash Premium 的历史用法,适合核对旧配置。文中的“仅 Premium”“暂不支持”及平台限制不代表当前 Mihomo 的能力;不要据此替换现用客户端的配置或运行权限命令。
使用 Mihomo 时,请对照 Mihomo 当前配置文档;图形界面、安装和授权操作请以 对应客户端的项目说明 为准。
假设您的内核支持 Wireguard 并且您已经启用了它。Table 选项可以阻止 wg-quick 覆写默认路由。
例如 wg0.conf:
ini
[Interface]
PrivateKey = ...
Address = 172.16.0.1/32
MTU = ...
Table = off
PostUp = ip rule add from 172.16.0.1/32 table 6666
[Peer]
AllowedIPs = 0.0.0.0/0
AllowedIPs = ::/0
PublicKey = ...
Endpoint = ...然后在 Clash 中您只需要有一个 DIRECT 策略组,它包含一个指定的出站接口:
yaml
proxy-groups:
- name: Wireguard
type: select
interface-name: wg0
proxies:
- DIRECT
rules:
- DOMAIN,google.com,Wireguard这通常比 Clash 自己实现的用户空间 Wireguard 客户端性能更好。Wireguard 在内核中支持。
