为Clash节点配置负载均衡(适用于Clash、Clash Premium和Clash Meta)

为Clash节点配置负载均衡(适用于Clash、Clash Premium和Clash Meta)

韩小韩
2023-07-01 / 0 评论 / 5,830 阅读 / 正在检测是否收录...
温馨提示:
本文最后更新于2023年07月01日,已超过308天没有更新,若内容或图片失效,请留言反馈。

准备材料

  • Clash 节点配置
  • 基于原版 Clash、Clash Premium 或 Clash Meta 的客户端

部署步骤

CFW Parsers

  • 打开 Clash For Windows,转到“Settings”→“Profiles”。点击“Parsers”右边的“Edit”按钮

ljjolysd.png

  • 在内置编辑器中,粘贴以下内容并保存
parsers:
  - reg: 'slbable$'
    yaml:
      append-proxy-groups:
        - name: ⚖️ 负载均衡-散列
          type: load-balance
          url: 'http://www.google.com/generate_204'
          interval: 300
          strategy: consistent-hashing
        - name: ⚖️ 负载均衡-轮询
          type: load-balance
          url: 'http://www.google.com/generate_204'
          interval: 300
          strategy: round-robin
      commands:
        - proxy-groups.⚖️ 负载均衡-散列.proxies=[]proxyNames
        - proxy-groups.0.proxies.0+⚖️ 负载均衡-散列
        - proxy-groups.⚖️ 负载均衡-轮询.proxies=[]proxyNames
        - proxy-groups.0.proxies.0+⚖️ 负载均衡-轮询

ljjon0li.png

  • 为了防止正常订阅被污染,请自行修改订阅地址,在其后面加上 #slbable 即可使用负载均衡

手动配置

  • 使用VS Code或其他编辑器,打开Clash的节点配置文件。
  • 将以下内容,添加到第一个策略组
- ⚖️ 负载均衡-轮询
- ⚖️ 负载均衡-散列
  • 在现有代理组的后面,添加代理策略组。
- name: ⚖️ 负载均衡-散列
  type: load-balance
  url: http://www.google.com/generate_204
  interval: 300
  strategy: consistent-hashing
  proxies:
    - P1
    - P2
    - P3
- name: ⚖️ 负载均衡-轮询
  type: load-balance
  url: http://www.google.com/generate_204
  interval: 300
  strategy: round-robin
  proxies:
    - P1
    - P2
    - P3

  • 在基于Clash内核的客户端中,导入节点配置文件

转自 https://blog.misaka.rest/2023/04/17/clash-load-balancing/

0

评论 (0)

取消