github.com/igoogolx/clash@v1.19.8/docs/zh_CN/advanced-usages/wireguard.md (about)

     1  ---
     2  sidebarTitle: 基于规则的 Wireguard
     3  sidebarOrder: 1
     4  ---
     5  
     6  # 基于规则的 Wireguard
     7  
     8  假设您的内核支持 Wireguard 并且您已经启用了它. `Table` 选项可以阻止 _wg-quick_ 覆写默认路由.
     9  
    10  例如 `wg0.conf`:
    11  
    12  ```ini
    13  [Interface]
    14  PrivateKey = ...
    15  Address = 172.16.0.1/32
    16  MTU = ...
    17  Table = off
    18  PostUp = ip rule add from 172.16.0.1/32 table 6666
    19  
    20  [Peer]
    21  AllowedIPs = 0.0.0.0/0
    22  AllowedIPs = ::/0
    23  PublicKey = ...
    24  Endpoint = ...
    25  ```
    26  
    27  然后在 Clash 中您只需要有一个 DIRECT 策略组, 它包含一个指定的出站接口:
    28  
    29  ```yaml
    30  proxy-groups:
    31    - name: Wireguard
    32      type: select
    33      interface-name: wg0
    34      proxies:
    35        - DIRECT
    36  rules:
    37    - DOMAIN,google.com,Wireguard
    38  ```
    39  
    40  这通常比 Clash 自己实现的用户空间 Wireguard 客户端性能更好. Wireguard 在内核中支持.