mode: rule
log-level: info
ipv6: false
geodata-mode: true
tcp-concurrent: true

#自定义 geodata url
geox-url:
  geoip: "https://fastly.jsdelivr.net/gh/MetaCubeX/meta-rules-dat@release/geoip.dat"
  geosite: "https://fastly.jsdelivr.net/gh/MetaCubeX/meta-rules-dat@release/geosite.dat"
  mmdb: "https://fastly.jsdelivr.net/gh/MetaCubeX/meta-rules-dat@release/geoip.metadb"

geo-auto-update: true # 是否自动更新 geodata
geo-update-interval: 24 # 更新间隔，单位：小时

dns:
  enable: true
  listen: 0.0.0.0:53
  ipv6: false

  default-nameserver:
    - 223.5.5.5
    - 1.0.0.1
  enhanced-mode: fake-ip
  fake-ip-range: 198.10.0.1/16
  fake-ip-filter:
    - stun.*.*.*
    - stun.*.*
    - time.windows.com
    - time.nist.gov
    - time.apple.com
    - time.asia.apple.com
  use-hosts: true
  nameserver:
    - 1.1.1.1
    - 8.8.8.8

sniffer:
  enable: true
  force-dns-mapping: true
  parse-pure-ip: true
  override-destination: false
  sniff:
    HTTP:
      ports: [ 80, 8080-8880 ]
      override-destination: true
    TLS:
      ports: [ 443, 8443 ]
    QUIC:
      ports: [ 443, 8443 ]
  # force-domain:
  skip-domain:
    - Mijia Cloud

  hosts:
    mtalk.google.com 108.177.97.188
    alt1-mtalk.google.com 142.250.141.188
    alt2-mtalk.google.com 142.250.115.188
    alt3-mtalk.google.com 64.233.171.188
    alt4-mtalk.google.com 142.250.152.188
    alt5-mtalk.google.com 173.194.77.188
    alt6-mtalk.google.com 173.194.219.188
    alt7-mtalk.google.com 142.250.112.188
    alt8-mtalk.google.com 172.217.197.188

proxy-providers:
  self-proxies:
    type: http
    url: http://192.168.51.11:3000/oruke/resources/raw/branch/main/clash/oruke-self-proxies.yaml
    path: ./oruke-self-proxies.yaml
    health-check:
      enable: true
      interval: 600
      lazy: true
      url: http://www.gstatic.com/generate_204
  liangyuandian:
    type: http
    url: https://www.fightingly.vip/api/v1/client/subscribe?token=7f9f9961ecbd6a17d856887fff9cd87d
    interval: 172800
    path: ./oruke-liangyuandian.yaml
    timeout: 100000
    health-check:
      enable: true
      interval: 600
      lazy: true
      url: http://www.gstatic.com/generate_204
  byWave:
    type: http
    url: https://sub.bwbwbw.cc/subscribe/74851/8pPTLIl5ZdDg
    interval: 172800
    path: ./oruke-byWave.yaml
    timeout: 100000
    health-check:
      enable: true
      interval: 600
      lazy: true
      url: http://www.gstatic.com/generate_204

proxy-groups:
  - name: "PROXY"
    type: select
    use:
      - self-proxies
      - byWave
      - liangyuandian
  - name: "大流量"
    type: select
    use:
      - self-proxies
      - liangyuandian
  - name: "Telegram"
    type: select
    use:
      - self-proxies
      - byWave
      - liangyuandian
    proxies:
      - 大流量
      - PROXY
  - name: "DLsite"
    type: select
    use:
      - self-proxies
      - byWave
      - liangyuandian
    proxies:
      - 大流量
      - PROXY
  - name: "Exhentai"
    type: select
    use:
      - self-proxies
      - byWave
      - liangyuandian
    proxies:
      - 大流量
      - PROXY
  - name: "PT"
    type: select
    use:
      - self-proxies
      - byWave
      - liangyuandian
    proxies:
      - 大流量
      - DIRECT
      - PROXY
  - name: "Microsoft"
    type: select
    use:
      - self-proxies
      - byWave
    proxies:
      - DIRECT
      - PROXY
  - name: "YouTube"
    type: select
    use:
      - self-proxies
      - byWave
      - liangyuandian
    proxies:
      - 大流量
      - PROXY
  - name: "Google"
    type: select
    use:
      - self-proxies
      - byWave
    proxies:
      - PROXY
      - 大流量
  - name: "Steam"
    type: select
    use:
      - self-proxies
      - byWave
      - liangyuandian
    proxies:
      - 大流量
      - PROXY
  - name: "Others"
    type: select
    use:
      - self-proxies
    proxies:
      - DIRECT
      - PROXY
  - name: "AI"
    type: select
    use:
      - self-proxies
      - byWave
    proxies:
      - PROXY

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
    timeout: 50000

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

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

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

  microsoft:
    type: http
    behavior: classical
    url: "https://cdn.jsdelivr.net/gh/blackmatrix7/ios_rule_script@master/rule/Clash/Microsoft/Microsoft.yaml"
    path: ./ruleset/microsoft.yaml
    interval: 86400
    timeout: 50000

  bing:
    type: http
    behavior: classical
    url: "https://cdn.jsdelivr.net/gh/blackmatrix7/ios_rule_script@master/rule/Clash/Bing/Bing.yaml"
    path: ./ruleset/bing.yaml
    interval: 86400
    timeout: 50000

  copilot:
    type: http
    behavior: classical
    url: "https://cdn.jsdelivr.net/gh/blackmatrix7/ios_rule_script@master/rule/Clash/Copilot/Copilot.yaml"
    path: ./ruleset/copilot.yaml
    interval: 86400
    timeout: 50000

  openai:
    type: http
    behavior: classical
    url: "https://cdn.jsdelivr.net/gh/blackmatrix7/ios_rule_script@master/rule/Clash/OpenAI/OpenAI.yaml"
    path: ./ruleset/openai.yaml
    interval: 86400
    timeout: 50000

  youtube:
    type: http
    behavior: classical
    url: "https://cdn.jsdelivr.net/gh/blackmatrix7/ios_rule_script@master/rule/Clash/YouTube/YouTube.yaml"
    path: ./ruleset/youtube.yaml
    interval: 86400
    timeout: 50000

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

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

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

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

  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
    timeout: 50000

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

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

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

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

  ai-services:
    type: http
    behavior: classical
    url: http://192.168.51.11:3000/oruke/resources/raw/branch/main/clash/ruleset/ai-services.yaml
    path: ./ruleset/ai-services.yaml

  huggingface:
    type: http
    behavior: classical
    url: http://192.168.51.11:3000/oruke/resources/raw/branch/main/clash/ruleset/huggingface.yaml
    path: ./ruleset/huggingface.yaml

  high-traffic:
    type: http
    behavior: classical
    url: http://192.168.51.11:3000/oruke/resources/raw/branch/main/clash/ruleset/high-traffic.yaml
    path: ./ruleset/high-traffic.yaml

  exhentai-custom:
    type: http
    behavior: classical
    url: http://192.168.51.11:3000/oruke/resources/raw/branch/main/clash/ruleset/exhentai.yaml
    path: ./ruleset/exhentai.yaml

  dlsite-custom:
    type: http
    behavior: classical
    url: http://192.168.51.11:3000/oruke/resources/raw/branch/main/clash/ruleset/dlsite.yaml
    path: ./ruleset/dlsite.yaml

  pt-custom:
    type: http
    behavior: classical
    url: http://192.168.51.11:3000/oruke/resources/raw/branch/main/clash/ruleset/pt.yaml
    path: ./ruleset/pt.yaml

  steam-custom:
    type: http
    behavior: classical
    url: http://192.168.51.11:3000/oruke/resources/raw/branch/main/clash/ruleset/steam.yaml
    path: ./ruleset/steam.yaml

  microsoft-custom:
    type: http
    behavior: classical
    url: http://192.168.51.11:3000/oruke/resources/raw/branch/main/clash/ruleset/microsoft.yaml
    path: ./ruleset/microsoft.yaml

  google-custom:
    type: http
    behavior: classical
    url: http://192.168.51.11:3000/oruke/resources/raw/branch/main/clash/ruleset/google.yaml
    path: ./ruleset/google.yaml

  direct-custom:
    type: http
    behavior: classical
    url: http://192.168.51.11:3000/oruke/resources/raw/branch/main/clash/ruleset/direct.yaml
    path: ./ruleset/direct.yaml

  proxy-custom:
    type: http
    behavior: classical
    url: http://192.168.51.11:3000/oruke/resources/raw/branch/main/clash/ruleset/proxy.yaml
    path: ./ruleset/proxy.yaml

rules:

  # DIRECT
#  - RULE-SET,direct,DIRECT
  - RULE-SET,lancidr,DIRECT
  - RULE-SET,cncidr,DIRECT
  - RULE-SET,applications,DIRECT
  - RULE-SET,icloud,DIRECT
  - RULE-SET,apple,DIRECT
  - RULE-SET,direct-custom,DIRECT

  # Gemini: keep Google session IP consistent to reduce verification
  - DOMAIN-SUFFIX,gemini.google.com,Google
  - DOMAIN-SUFFIX,bard.google.com,Google
  - DOMAIN,ai.google.dev,Google
  - DOMAIN-SUFFIX,google.dev,Google
  - DOMAIN-SUFFIX,makersuite.google.com,Google
  - DOMAIN-SUFFIX,generativelanguage.googleapis.com,Google
  - DOMAIN-SUFFIX,aistudio.google.com,Google
  - DOMAIN-SUFFIX,notebooklm.google.com,Google
  - DOMAIN,notebooklm.google,Google

  # AI服务 (统一) - 最高优先级
  - RULE-SET,ai-services,AI

  # 高优先级
  - RULE-SET,youtube,YouTube
  - RULE-SET,dlsite-custom,DLsite
  - RULE-SET,exhentai-custom,Exhentai

  # 大流量服务
  - RULE-SET,high-traffic,大流量
  - RULE-SET,huggingface,大流量

  # 其他服务
  - RULE-SET,pt-custom,PT
  - RULE-SET,steam-custom,Steam
  - RULE-SET,microsoft-custom,Microsoft
  - RULE-SET,google,Google
  - RULE-SET,google-custom,Google
  - RULE-SET,proxy-custom,PROXY
  - RULE-SET,telegramcidr,Telegram
  - RULE-SET,tld-not-cn,PROXY
  - RULE-SET,proxy,PROXY
  - RULE-SET,reject,REJECT
  - RULE-SET,gfw,PROXY


  - MATCH,Others
