# HTTP 和 SOCKS5 代理端口
port: 7890
socks-port: 7891
# 允许局域网连接（如需手机连接改为 true）
allow-lan: false
# 运行模式：Rule(规则)、Global(全局)、Direct(直连)
mode: Rule
log-level: info
# Clash 的 API 外部控制器（可选）
external-controller: 127.0.0.1:9090

# ----- 节点信息（VLESS + WS + TLS）-----
proxies:
  - name: "🇨🇳 5ibtc 节点"        # 自定义节点名称
    type: vless
    server: px2.5ibtc.cn
    port: 443
    uuid: 326227e2-f2d1-4f43-8715-9da854f5f4c0
    tls: true
    skip-cert-verify: false        # 保持 false，除非遇到证书错误
    servername: px2.5ibtc.cn       # TLS SNI
    network: ws
    ws-opts:
      path: "/326227e2-f2d1-4f43-8715-9da854f5f4c0"
      headers:
        Host: px2.5ibtc.cn

# ----- 代理组配置（用于策略选择）-----
proxy-groups:
  - name: "🚀 节点选择"
    type: select
    proxies:
      - "🇨🇳 5ibtc 节点"
      - "DIRECT"
      - "♻️ 自动选择"           # 可添加自动测速组
  - name: "♻️ 自动选择"
    type: url-test                # 自动选择延迟最低的节点
    proxies:
      - "🇨🇳 5ibtc 节点"
    url: "http://www.gstatic.com/generate_204"
    interval: 300

# ----- 规则提供者（ruleset，需 Clash.Meta 支持）-----
rule-providers:
  reject:
    type: http
    behavior: domain
    url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/reject.txt"
    path: ./ruleset/reject.yaml
    interval: 86400
  icloud:
    type: http
    behavior: domain
    url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/icloud.txt"
    path: ./ruleset/icloud.yaml
    interval: 86400
  apple:
    type: http
    behavior: domain
    url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/apple.txt"
    path: ./ruleset/apple.yaml
    interval: 86400
  google:
    type: http
    behavior: domain
    url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/google.txt"
    path: ./ruleset/google.yaml
    interval: 86400
  proxy:
    type: http
    behavior: domain
    url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/proxy.txt"
    path: ./ruleset/proxy.yaml
    interval: 86400
  direct:
    type: http
    behavior: domain
    url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/direct.txt"
    path: ./ruleset/direct.yaml
    interval: 86400
  private:
    type: http
    behavior: domain
    url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/private.txt"
    path: ./ruleset/private.yaml
    interval: 86400
  gfw:
    type: http
    behavior: domain
    url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/gfw.txt"
    path: ./ruleset/gfw.yaml
    interval: 86400
  tld-not-cn:
    type: http
    behavior: domain
    url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/tld-not-cn.txt"
    path: ./ruleset/tld-not-cn.yaml
    interval: 86400
  telegramcidr:
    type: http
    behavior: ipcidr
    url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/telegramcidr.txt"
    path: ./ruleset/telegramcidr.yaml
    interval: 86400
  cncidr:
    type: http
    behavior: ipcidr
    url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/cncidr.txt"
    path: ./ruleset/cncidr.yaml
    interval: 86400
  lancidr:
    type: http
    behavior: ipcidr
    url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/lancidr.txt"
    path: ./ruleset/lancidr.yaml
    interval: 86400

# ----- 规则列表（优先级从上到下）-----
rules:
  # 避免代理回环：您自己的服务器域名直连
  - DOMAIN,px2.5ibtc.cn,DIRECT
  # 广告/恶意域名拦截
  - RULE-SET,reject,REJECT
  # 私有地址/局域网直连
  - RULE-SET,private,DIRECT
  - RULE-SET,lancidr,DIRECT
  # 国内 IP 直连
  - RULE-SET,cncidr,DIRECT
  # Telegram 建议走代理（如果您的节点能访问）
  - RULE-SET,telegramcidr,🚀 节点选择
  # Apple 服务（通常直连更快，但可根据需要调整）
  - RULE-SET,icloud,DIRECT
  - RULE-SET,apple,DIRECT
  # Google 走代理
  - RULE-SET,google,🚀 节点选择
  # 常见需要代理的网站
  - RULE-SET,proxy,🚀 节点选择
  # 明确直连的网站
  - RULE-SET,direct,DIRECT
  # GFWList 域名走代理
  - RULE-SET,gfw,🚀 节点选择
  # 非中国顶级域名（如 .us .jp 等）走代理
  - RULE-SET,tld-not-cn,🚀 节点选择
  # 国内 IP 剩余部分直连
  - GEOIP,CN,DIRECT
  # 默认规则：所有未匹配流量走代理节点选择
  - MATCH,🚀 节点选择