Hc_sub: &hc_sub
  enable: true
  url: https://cp.cloudflare.com
  interval: 300
  timeout: 1000

ua: &ua
  User-Agent:
    - "clash-verge/v2.2.3"
    - "ClashMetaForAndroid/2.11.2.Meta"
    - "ClashforWindows/0.19.23"
    - "clash.meta"
    - "mihomo"

exf: &exf "套餐|重置|剩余|到期|订阅|群|账户|流量|有效期|时间|官网|失联|余额|分享|免翻|邀请|地址"

provider_base: &provider_base
  type: http
  interval: 3600
  health-check: *hc_sub
  header: *ua
  exclude-filter: *exf

proxy-providers:
  订阅1:
    <<: *provider_base
    url: "https://dash.xn--cp3a08l.com/api/v1/pq/9dbf44deda03f55f7035f8f8a6a493c8"
    path: ./proxy_providers/😘.yaml

  订阅2:
    <<: *provider_base
    url: "https://140705.pages.dev/sub?token=7fb8851c9b041e0911e12201823eac4c"
    path: ./proxy_providers/CF.yaml

mixed-port: 7890
socks-port: 7891
redir-port: 9797
tproxy-port: 9898
mode: Rule
bind-address: '*'
ipv6: true
allow-lan: true
unified-delay: true
tcp-concurrent: true
disable-keep-alive: true
log-level: error
find-process-mode: always
external-controller: 0.0.0.0:9090
external-ui: ./dashboard
external-ui-url: "https://github.com/Zephyruso/zashboard/releases/latest/download/dist.zip"

profile:
  store-selected: true

sniffer:
  enable: true
  override-destination: false
  sniff:
    HTTP:
      ports: [80, 8080-8880]
      override-destination: true
    TLS:
      ports: [443, 8443]
    QUIC:
      ports: [443, 8443]

dns:
  enable: true
  ipv6: true
  listen: 0.0.0.0:53
  enhanced-mode: redir-host
  default-nameserver:
    - 223.5.5.5
    - 1.12.12.12
    - 8.8.8.8
    - 1.0.0.1
  proxy-server-nameserver:
    - 223.5.5.5
  nameserver-policy:
    "rule-set:CN_Domain":
      - 223.5.5.5
  nameserver:
    - 8.8.8.8

proxies:
  - {name: DNS_Hijack, type: dns}

proxy-groups:
  - name: 代理
    type: select
    proxies: [自动优选, 下载, CF节点, 节点选择]
    exclude-type: "dns"
    icon: https://v6.gh-proxy.org/https://raw.githubusercontent.com/Koolson/Qure/refs/heads/master/IconSet/Color/Proxy.png

  - name: AI
    type: select
    include-all: true
    proxies: [自动优选, 节点选择]
    exclude-type: "dns"
    icon: https://v6.gh-proxy.org/https://raw.githubusercontent.com/Koolson/Qure/refs/heads/master/IconSet/Color/AI.png

  # 👇 1. 干净的手动选点组：包含所有单节点，加了“代理”和“DIRECT”做备选
  - name: 电报
    type: select
    include-all: true
    proxies: [代理, DIRECT]
    exclude-type: "dns"
    icon: https://v6.gh-proxy.org/https://raw.githubusercontent.com/Koolson/Qure/refs/heads/master/IconSet/Color/Telegram.png

  - name: 节点选择
    type: select
    include-all: true
    exclude-type: "dns"
    icon: https://v6.gh-proxy.org/https://raw.githubusercontent.com/Koolson/Qure/refs/heads/master/IconSet/Color/Proxy.png

  - name: 下载
    type: select
    exclude-type: "dns"
    proxies: [0.1倍节点, 佑]
    icon: https://v6.gh-proxy.org/https://raw.githubusercontent.com/Koolson/Qure/refs/heads/master/IconSet/Color/Download.png

  - name: 自动优选
    type: url-test
    url: https://www.google.com/generate_204
    interval: 300
    tolerance: 100
    include-all: true
    exclude-type: "dns"
    icon: https://v6.gh-proxy.org/https://raw.githubusercontent.com/Koolson/Qure/refs/heads/master/IconSet/Color/Area.png

  - name: 漏网之鱼
    type: select
    proxies: [代理, DIRECT]
    icon: https://v6.gh-proxy.org/https://raw.githubusercontent.com/Koolson/Qure/refs/heads/master/IconSet/Color/Final.png

  - name: 0.1倍节点
    type: url-test
    exclude-type: "dns"
    hidden: true
    filter: "0.1倍"
    include-all: true
    tolerance: 100
    icon: https://v6.gh-proxy.org/https://raw.githubusercontent.com/Koolson/Qure/refs/heads/master/IconSet/Color/Proxy.png

  - name: 佑
    type: url-test
    exclude-type: "dns"
    hidden: true
    use: [订阅1]
    tolerance: 100
    icon: https://v6.gh-proxy.org/https://raw.githubusercontent.com/Koolson/Qure/refs/heads/master/IconSet/Color/Proxy.png

  - name: CF节点
    type: url-test
    exclude-type: "dns"
    hidden: true
    use: [订阅2]
    tolerance: 100
    icon: https://v6.gh-proxy.org/https://raw.githubusercontent.com/Koolson/Qure/refs/heads/master/IconSet/Color/Proxy.png

rule-anchor:
  Domain: &Domain {type: http, behavior: domain, format: mrs, interval: 86400, proxy: DIRECT}
  IPCIDR: &IPCIDR {type: http, behavior: ipcidr, format: mrs, interval: 86400, proxy: DIRECT}
  local: &local {type: file, behavior: classical, format: text}
  Classical: &Classical {type: http, behavior: classical, format: text, interval: 86400, proxy: DIRECT}

rule-providers:
  Proxy_Domain:
    <<: *Domain
    path: ./rule_providers/Proxy_Domain.mrs
    url: "https://v6.gh-proxy.org/https://github.com/DustinWin/ruleset_geodata/raw/refs/heads/mihomo-ruleset/proxy.mrs"

  CN_IP:
    <<: *IPCIDR
    path: ./rule_providers/CN_IP.mrs
    url: "https://v6.gh-proxy.org/https://github.com/MetaCubeX/meta-rules-dat/raw/refs/heads/meta/geo/geoip/cn.mrs"

  CN_Domain:
    <<: *Domain
    path: ./rule_providers/CN_Domain.mrs
    url: "https://v6.gh-proxy.org/https://github.com/MetaCubeX/meta-rules-dat/raw/refs/heads/meta/geo/geosite/cn.mrs"

  Private_IP:
    <<: *IPCIDR
    path: ./rule_providers/Private_IP.mrs
    url: "https://v6.gh-proxy.org/https://github.com/MetaCubeX/meta-rules-dat/raw/refs/heads/meta/geo/geoip/private.mrs"

  Private_Domain:
    <<: *Domain
    path: ./rule_providers/private_domain.mrs
    url: "https://v6.gh-proxy.org/https://github.com/MetaCubeX/meta-rules-dat/raw/refs/heads/meta/geo/geosite/private.mrs"

  AI_Domain:
    <<: *Domain
    path: ./rule_providers/AI_Domain.mrs
    url: "https://v6.gh-proxy.org/https://raw.githubusercontent.com/QuixoticHeart/rule-set/refs/heads/ruleset/meta/domain/ai.mrs"

  AI_IP:
    <<: *IPCIDR
    path: ./rule_providers/AI_IP.mrs
    url: "https://v6.gh-proxy.org/https://github.com/MetaCubeX/meta-rules-dat/refs/heads/meta/geo/geoip/ai.mrs"

  Telegram_Domain:
    <<: *Domain
    path: ./rule_providers/Telegram_Domainm.mrs
    url: "https://v6.gh-proxy.org/https://github.com/MetaCubeX/meta-rules-dat/raw/refs/heads/meta/geo-lite/geosite/telegram.mrs"

  Telegram_IP:
    <<: *IPCIDR
    path: ./rule_providers/Telegram_IP.mrs
    url: "https://v6.gh-proxy.org/https://github.com/MetaCubeX/meta-rules-dat/raw/refs/heads/meta/geo-lite/geoip/telegram.mrs"

  Discord_Domain:
    <<: *Domain
    path: ./rule_providers/Discord.mrs
    url: "https://v6.gh-proxy.org/https://github.com/peiyingyao/Rule-for-OCD/raw/refs/heads/master/rule/Clash/Discord/Discord_OCD_Domain.mrs"

rules:
  - DST-PORT,53,DNS_Hijack
  # 👇 2. 将分流目标指向这个可以手动控全局的“电报”组
  - OR,((RULE-SET,Telegram_Domain),(RULE-SET,Telegram_IP,no-resolve)),电报
  - RULE-SET,Discord_Domain,代理
  - AND,((IN-PORT,7891),(RULE-SET,CN_Domain)),DIRECT
  - AND,((IN-PORT,7891),(RULE-SET,CN_IP,no-resolve)),DIRECT
  - AND,((IN-PORT,7891),(RULE-SET,Private_Domain)),DIRECT
  - AND,((IN-PORT,7891),(RULE-SET,Private_IP)),DIRECT
  - AND,((IN-PORT,7891),(DOMAIN-KEYWORD,gh-proxy)),DIRECT
  - IN-PORT,7891,下载
  - OR,((RULE-SET,AI_Domain),(RULE-SET,AI_IP,no-resolve)),AI
  - RULE-SET,Proxy_Domain,代理
  - OR,((RULE-SET,CN_IP,no-resolve),(RULE-SET,CN_Domain),(RULE-SET,Private_IP),(RULE-SET,Private_Domain),(DOMAIN-KEYWORD,gh-proxy)),DIRECT
  - MATCH,漏网之鱼
