mixed-port: 7890
allow-lan: false
mode: rule
log-level: info
ipv6: true
unified-delay: true
tcp-concurrent: true
find-process-mode: strict
global-client-fingerprint: chrome
geodata-mode: true

geox-url:
  geoip: "https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/geoip.dat"
  geosite: "https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/geosite.dat"
  mmdb: "https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/country.mmdb"

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

dns:
  enable: true
  listen: 0.0.0.0:1053
  ipv6: true
  respect-rules: true
  enhanced-mode: fake-ip
  fake-ip-range: 198.18.0.1/16
  fake-ip-filter:
    - "*.lan"
    - "*.local"
    - "*.arpa"
    - "*.cn"
    - "*.qq.com"
    - "*.wechat.com"
    - "localhost.ptlogin2.qq.com"
    - "msftconnecttest.com"
    - "msftncsi.com"
  default-nameserver:
    - 223.5.5.5
    - 119.29.29.29
  nameserver:
    - https://223.5.5.5/dns-query
    - https://120.53.53.53/dns-query
  proxy-server-nameserver:
    - 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
    geosite:
      - gfw

proxies:
  # Source: gist.github.com/jacobwpeng/7df591d2ef4882a68ef7722c7edf3b4c (loon-proxy.list)
  - name: hk-2053
    type: vless
    server: hk.jacobwpeng.com
    port: 2053
    uuid: 3f3b65ff-d1df-4d8b-99e9-fa8bcc733929
    network: tcp
    udp: true
    tls: true
    flow: xtls-rprx-vision
    servername: www.microsoft.com
    client-fingerprint: chrome
    reality-opts:
      public-key: 9VzfPa8wzFy_CbwC7A_j1xVgw2_rypENs_ek0uOPdBM
      short-id: 3d18b0

  - name: hk-2053-gz-relay
    type: vless
    server: 81.71.15.87
    port: 12347
    uuid: 3f3b65ff-d1df-4d8b-99e9-fa8bcc733929
    network: tcp
    udp: true
    tls: true
    flow: xtls-rprx-vision
    servername: www.microsoft.com
    client-fingerprint: chrome
    reality-opts:
      public-key: 9VzfPa8wzFy_CbwC7A_j1xVgw2_rypENs_ek0uOPdBM
      short-id: 3d18b0

  - name: sg
    type: vless
    server: 43.160.196.76
    port: 443
    uuid: 4c1621f3-6c27-4187-98ac-945b4d7acf8e
    network: tcp
    udp: true
    tls: true
    flow: xtls-rprx-vision
    servername: www.microsoft.com
    client-fingerprint: chrome
    reality-opts:
      public-key: OVXXyhdiRGpJVTNd5AfQUnhLwa5bsC6RotsV_niU6H8
      short-id: 68fd62f1afc529

  - name: sg-gz-relay
    type: vless
    server: 81.71.15.87
    port: 12345
    uuid: 4c1621f3-6c27-4187-98ac-945b4d7acf8e
    network: tcp
    udp: true
    tls: true
    flow: xtls-rprx-vision
    servername: www.microsoft.com
    client-fingerprint: chrome
    reality-opts:
      public-key: OVXXyhdiRGpJVTNd5AfQUnhLwa5bsC6RotsV_niU6H8
      short-id: 68fd62f1afc529

  - name: us
    type: vless
    server: 43.162.119.193
    port: 8443
    uuid: c5bd50be-26d7-4ba5-abc7-d2e6b9c654fa
    network: tcp
    udp: true
    tls: true
    flow: xtls-rprx-vision
    servername: www.cloudflare.com
    client-fingerprint: chrome
    reality-opts:
      public-key: Rnx164v19BqwduR-GWck4A4IGBFS6GQ46ga4Cnaq-h8
      short-id: 509f7afd

  - name: us-gz-relay
    type: vless
    server: 81.71.15.87
    port: 12346
    uuid: c5bd50be-26d7-4ba5-abc7-d2e6b9c654fa
    network: tcp
    udp: true
    tls: true
    flow: xtls-rprx-vision
    servername: www.cloudflare.com
    client-fingerprint: chrome
    reality-opts:
      public-key: Rnx164v19BqwduR-GWck4A4IGBFS6GQ46ga4Cnaq-h8
      short-id: 509f7afd

  - name: LocalSocks5
    type: socks5
    server: 192.168.2.99
    port: 1337
    udp: true

proxy-groups:
  # Region groups
  - name: HK
    type: select
    proxies:
      - hk-2053
      - hk-2053-gz-relay

  - name: SG
    type: select
    proxies:
      - sg
      - sg-gz-relay

  - name: US
    type: select
    proxies:
      - us
      - us-gz-relay

  # Main groups
  - name: Proxy
    type: select
    proxies:
      - Auto
      - Fallback
      - HK
      - SG
      - US
      - LocalSocks5
      - DIRECT

  - name: Auto
    type: url-test
    url: https://cp.cloudflare.com/generate_204
    interval: 300
    tolerance: 100
    proxies:
      - HK
      - SG
      - US
      - LocalSocks5

  - name: Fallback
    type: fallback
    url: https://cp.cloudflare.com/generate_204
    interval: 300
    proxies:
      - HK
      - SG
      - US
      - LocalSocks5

  # Service groups
  - name: AI
    type: select
    proxies:
      - Proxy
      - Auto
      - HK
      - SG
      - US
      - DIRECT

  - name: Telegram
    type: select
    proxies:
      - Proxy
      - Auto
      - SG
      - US
      - HK

  - name: Streaming
    type: select
    proxies:
      - Proxy
      - Auto
      - SG
      - US

  - name: Google
    type: select
    proxies:
      - Proxy
      - Auto
      - HK
      - SG
      - US

  - name: GitHub
    type: select
    proxies:
      - Proxy
      - Auto
      - HK
      - SG
      - US
      - DIRECT

  - name: OReilly
    type: select
    proxies:
      - US
      - Proxy
      - Auto
      - HK
      - SG
      - DIRECT

  - name: Microsoft
    type: select
    proxies:
      - DIRECT
      - Proxy
      - Auto
      - HK
      - SG
      - US

  - name: Apple
    type: select
    proxies:
      - DIRECT
      - Proxy
      - Auto
      - HK
      - SG

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

  - name: Final
    type: select
    proxies:
      - Proxy
      - Auto
      - Fallback
      - DIRECT

rule-providers:
  category-ads-all:
    type: http
    behavior: domain
    url: "https://raw.githubusercontent.com/MetaCubeX/meta-rules-dat/meta/geo/geosite/category-ads-all.yaml"
    path: ./ruleset/category-ads-all.yaml
    interval: 86400

  openai:
    type: http
    behavior: domain
    url: "https://raw.githubusercontent.com/MetaCubeX/meta-rules-dat/meta/geo/geosite/openai.yaml"
    path: ./ruleset/openai.yaml
    interval: 86400

  anthropic:
    type: http
    behavior: domain
    url: "https://raw.githubusercontent.com/MetaCubeX/meta-rules-dat/meta/geo/geosite/anthropic.yaml"
    path: ./ruleset/anthropic.yaml
    interval: 86400

  google-gemini:
    type: http
    behavior: domain
    url: "https://raw.githubusercontent.com/MetaCubeX/meta-rules-dat/meta/geo/geosite/google-gemini.yaml"
    path: ./ruleset/google-gemini.yaml
    interval: 86400

  cursor:
    type: http
    behavior: domain
    url: "https://raw.githubusercontent.com/MetaCubeX/meta-rules-dat/meta/geo/geosite/cursor.yaml"
    path: ./ruleset/cursor.yaml
    interval: 86400

  youtube:
    type: http
    behavior: domain
    url: "https://raw.githubusercontent.com/MetaCubeX/meta-rules-dat/meta/geo/geosite/youtube.yaml"
    path: ./ruleset/youtube.yaml
    interval: 86400

  netflix:
    type: http
    behavior: domain
    url: "https://raw.githubusercontent.com/MetaCubeX/meta-rules-dat/meta/geo/geosite/netflix.yaml"
    path: ./ruleset/netflix.yaml
    interval: 86400

  disney:
    type: http
    behavior: domain
    url: "https://raw.githubusercontent.com/MetaCubeX/meta-rules-dat/meta/geo/geosite/disney.yaml"
    path: ./ruleset/disney.yaml
    interval: 86400

  hbo:
    type: http
    behavior: domain
    url: "https://raw.githubusercontent.com/MetaCubeX/meta-rules-dat/meta/geo/geosite/hbo.yaml"
    path: ./ruleset/hbo.yaml
    interval: 86400

  primevideo:
    type: http
    behavior: domain
    url: "https://raw.githubusercontent.com/MetaCubeX/meta-rules-dat/meta/geo/geosite/primevideo.yaml"
    path: ./ruleset/primevideo.yaml
    interval: 86400

  spotify:
    type: http
    behavior: domain
    url: "https://raw.githubusercontent.com/MetaCubeX/meta-rules-dat/meta/geo/geosite/spotify.yaml"
    path: ./ruleset/spotify.yaml
    interval: 86400

  telegram:
    type: http
    behavior: domain
    url: "https://raw.githubusercontent.com/MetaCubeX/meta-rules-dat/meta/geo/geosite/telegram.yaml"
    path: ./ruleset/telegram.yaml
    interval: 86400

  telegramip:
    type: http
    behavior: ipcidr
    url: "https://raw.githubusercontent.com/MetaCubeX/meta-rules-dat/meta/geo/geoip/telegram.yaml"
    path: ./ruleset/telegramip.yaml
    interval: 86400

  twitter:
    type: http
    behavior: domain
    url: "https://raw.githubusercontent.com/MetaCubeX/meta-rules-dat/meta/geo/geosite/twitter.yaml"
    path: ./ruleset/twitter.yaml
    interval: 86400

  discord:
    type: http
    behavior: domain
    url: "https://raw.githubusercontent.com/MetaCubeX/meta-rules-dat/meta/geo/geosite/discord.yaml"
    path: ./ruleset/discord.yaml
    interval: 86400

  google:
    type: http
    behavior: domain
    url: "https://raw.githubusercontent.com/MetaCubeX/meta-rules-dat/meta/geo/geosite/google.yaml"
    path: ./ruleset/google.yaml
    interval: 86400

  github:
    type: http
    behavior: domain
    url: "https://raw.githubusercontent.com/MetaCubeX/meta-rules-dat/meta/geo/geosite/github.yaml"
    path: ./ruleset/github.yaml
    interval: 86400

  microsoft:
    type: http
    behavior: domain
    url: "https://raw.githubusercontent.com/MetaCubeX/meta-rules-dat/meta/geo/geosite/microsoft.yaml"
    path: ./ruleset/microsoft.yaml
    interval: 86400

  apple-cn:
    type: http
    behavior: domain
    url: "https://raw.githubusercontent.com/MetaCubeX/meta-rules-dat/meta/geo/geosite/apple-cn.yaml"
    path: ./ruleset/apple-cn.yaml
    interval: 86400

rules:
  # Local/LAN direct
  - DOMAIN-SUFFIX,local,DIRECT
  - DOMAIN-SUFFIX,lan,DIRECT
  - DOMAIN,localhost,DIRECT
  - IP-CIDR,127.0.0.0/8,DIRECT,no-resolve
  - IP-CIDR,10.0.0.0/8,DIRECT,no-resolve
  - IP-CIDR,172.16.0.0/12,DIRECT,no-resolve
  - IP-CIDR,192.168.0.0/16,DIRECT,no-resolve

  # Ad blocking
  - RULE-SET,category-ads-all,REJECT

  # Apple CN direct
  - RULE-SET,apple-cn,Domestic

  # AI services
  - RULE-SET,google-gemini,AI
  - RULE-SET,openai,AI
  - RULE-SET,anthropic,AI
  - RULE-SET,cursor,AI

  # Streaming
  - RULE-SET,youtube,Streaming
  - RULE-SET,netflix,Streaming
  - RULE-SET,disney,Streaming
  - RULE-SET,hbo,Streaming
  - RULE-SET,primevideo,Streaming
  - RULE-SET,spotify,Streaming

  # Social/messaging
  - RULE-SET,telegram,Telegram
  - RULE-SET,telegramip,Telegram,no-resolve
  - RULE-SET,twitter,Proxy
  - RULE-SET,discord,Proxy

  # OReilly
  - DOMAIN-SUFFIX,oclc.org,OReilly
  - DOMAIN-SUFFIX,bibliocommons.com,OReilly

  # Tech companies
  - RULE-SET,github,GitHub
  - RULE-SET,microsoft,Microsoft
  - RULE-SET,google,Google

  # GEOSITE fallback
  - GEOSITE,private,DIRECT
  - GEOSITE,apple,Apple
  - GEOSITE,cn,Domestic
  - GEOSITE,geolocation-cn,Domestic
  - GEOIP,CN,Domestic,no-resolve
  - GEOSITE,geolocation-!cn,Proxy
  - MATCH,Final
