# Clash Meta 配置
# 基于 Loyalsoldier/clash-rules
#
# 规则仓库：
# https://github.com/Loyalsoldier/clash-rules
#
# 使用 jsDelivr CDN 加速规则下载
# 实际对应：
# https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/

mixed-port: 7890
allow-lan: true
mode: rule
log-level: info

ipv6: true

external-controller: 0.0.0.0:9090
secret: ""

unified-delay: true
tcp-concurrent: true

profile:
  store-selected: true
  store-fake-ip: true

dns:
  enable: true
  ipv6: true
  listen: 0.0.0.0:1053

  enhanced-mode: fake-ip
  fake-ip-range: 198.18.0.1/16

  default-nameserver:
    - 223.5.5.5
    - 119.29.29.29
    - 1.1.1.1
    - 8.8.8.8

  nameserver:
    - https://dns.alidns.com/dns-query
    - https://doh.pub/dns-query
    - https://1.1.1.1/dns-query
    - https://8.8.8.8/dns-query

  fallback:
    - https://1.1.1.1/dns-query
    - https://8.8.8.8/dns-query

  fallback-filter:
    geoip: true
    geoip-code: CN

proxies:
  - name: "搬瓦工VLESS"
    type: vless

    server: 23.106.159.90
    port: 8443
    uuid: a43f9125-a569-4616-89e5-b8ac3e69ff4b

    network: tcp
    udp: true

    tls: true
    servername: www.apple.com

    flow: xtls-rprx-vision

    client-fingerprint: chrome

    reality-opts:
      public-key: G7pnihX4hmLer0lD0r_JJmI7arB1wF5ujX-m64KkNxQ
      short-id: a7c94f2d8b31e6fa

proxy-groups:
  - name: Proxy
    type: select
    proxies:
      - 搬瓦工VLESS
      - DIRECT

  - name: AI
    type: select
    proxies:
      - Proxy
      - 搬瓦工VLESS
      - DIRECT

  - name: OpenAI
    type: select
    proxies:
      - Proxy
      - 搬瓦工VLESS

  - name: Claude
    type: select
    proxies:
      - Proxy
      - 搬瓦工VLESS

  - name: Google
    type: select
    proxies:
      - Proxy
      - 搬瓦工VLESS
      - DIRECT

  - name: Telegram
    type: select
    proxies:
      - Proxy
      - 搬瓦工VLESS

  - name: GitHub
    type: select
    proxies:
      - Proxy
      - 搬瓦工VLESS
      - DIRECT

  - name: YouTube
    type: select
    proxies:
      - Proxy
      - 搬瓦工VLESS

  - name: Netflix
    type: select
    proxies:
      - Proxy
      - 搬瓦工VLESS

  - name: Spotify
    type: select
    proxies:
      - Proxy
      - 搬瓦工VLESS

  - name: Apple
    type: select
    proxies:
      - DIRECT
      - Proxy

  - name: Microsoft
    type: select
    proxies:
      - DIRECT
      - Proxy

  - name: Steam
    type: select
    proxies:
      - DIRECT
      - Proxy

  - name: Domestic
    type: select
    proxies:
      - DIRECT
      - Proxy

  - name: Others
    type: select
    proxies:
      - Proxy
      - DIRECT

rule-providers:

  reject:
    type: http
    behavior: domain
    path: ./ruleset/reject.yaml
    url: https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/reject.txt
    interval: 86400

  icloud:
    type: http
    behavior: domain
    path: ./ruleset/icloud.yaml
    url: https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/icloud.txt
    interval: 86400

  apple:
    type: http
    behavior: domain
    path: ./ruleset/apple.yaml
    url: https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/apple.txt
    interval: 86400

  google:
    type: http
    behavior: domain
    path: ./ruleset/google.yaml
    url: https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/google.txt
    interval: 86400

  proxy:
    type: http
    behavior: domain
    path: ./ruleset/proxy.yaml
    url: https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/proxy.txt
    interval: 86400

  direct:
    type: http
    behavior: domain
    path: ./ruleset/direct.yaml
    url: https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/direct.txt
    interval: 86400

  private:
    type: http
    behavior: domain
    path: ./ruleset/private.yaml
    url: https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/private.txt
    interval: 86400

  gfw:
    type: http
    behavior: domain
    path: ./ruleset/gfw.yaml
    url: https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/gfw.txt
    interval: 86400

  tld-not-cn:
    type: http
    behavior: domain
    path: ./ruleset/tld-not-cn.yaml
    url: https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/tld-not-cn.txt
    interval: 86400

  telegramcidr:
    type: http
    behavior: ipcidr
    path: ./ruleset/telegramcidr.yaml
    url: https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/telegramcidr.txt
    interval: 86400

  cncidr:
    type: http
    behavior: ipcidr
    path: ./ruleset/cncidr.yaml
    url: https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/cncidr.txt
    interval: 86400

  lancidr:
    type: http
    behavior: ipcidr
    path: ./ruleset/lancidr.yaml
    url: https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/lancidr.txt
    interval: 86400

  applications:
    type: http
    behavior: classical
    path: ./ruleset/applications.yaml
    url: https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/applications.txt
    interval: 86400

rules:
  # OpenAI
  - DOMAIN-SUFFIX,openai.com,OpenAI
  - DOMAIN-SUFFIX,chatgpt.com,OpenAI
  - DOMAIN-SUFFIX,oaistatic.com,OpenAI

  # Claude
  - DOMAIN-SUFFIX,anthropic.com,Claude
  - DOMAIN-SUFFIX,claude.ai,Claude

  # GitHub
  - DOMAIN-SUFFIX,github.com,GitHub
  - DOMAIN-SUFFIX,githubusercontent.com,GitHub
  - DOMAIN-SUFFIX,githubassets.com,GitHub

  # YouTube
  - DOMAIN-SUFFIX,youtube.com,YouTube
  - DOMAIN-SUFFIX,youtu.be,YouTube
  - DOMAIN-SUFFIX,googlevideo.com,YouTube

  # Netflix
  - DOMAIN-SUFFIX,netflix.com,Netflix
  - DOMAIN-SUFFIX,nflxvideo.net,Netflix

  # Spotify
  - DOMAIN-SUFFIX,spotify.com,Spotify
  - DOMAIN-SUFFIX,scdn.co,Spotify

  # Telegram
  - DOMAIN-SUFFIX,telegram.org,Telegram

  # Apple
  - RULE-SET,icloud,Apple
  - RULE-SET,apple,Apple

  # Google
  - RULE-SET,google,Google

  # 广告拦截
  - RULE-SET,reject,REJECT

  # 局域网
  - RULE-SET,private,Domestic
  - RULE-SET,lancidr,Domestic

  # Telegram IP
  - RULE-SET,telegramcidr,Telegram

  # 国内直连
  - RULE-SET,direct,Domestic
  - RULE-SET,applications,Domestic
  - RULE-SET,cncidr,Domestic
  - GEOIP,CN,Domestic

  # 国外代理
  - RULE-SET,proxy,Proxy
  - RULE-SET,gfw,Proxy
  - RULE-SET,tld-not-cn,Proxy

  # 最终规则
  - MATCH,Others
