mode: rule
mixed-port: 7890
allow-lan: false
bind-address: "*"
log-level: info
ipv6: false

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

# 建議打開，才能在 TUN/VPN 模式下更穩定抓到 YouTube 的域名（SNI/QUIC）
sniffer:
  enable: true
  override-destination: true
  sniff:
    HTTP:
      ports: [80, 8080-8880]
    TLS:
      ports: [443, 8443]
    QUIC:
      ports: [443, 8443]

dns:
  enable: true
  ipv6: false
  enhanced-mode: fake-ip
  fake-ip-range: 198.18.0.1/16
  nameserver:
    - https://1.1.1.1/dns-query
    - https://8.8.8.8/dns-query
  fallback:
    - https://dns.google/dns-query
    - https://cloudflare-dns.com/dns-query
  fallback-filter:
    geoip: true
    geoip-code: CN

proxies:
  - name: NAS-WAN
    type: http
    server: leo97033nas.synology.me
    port: 18443
    username: NQU
    password: "E218science"
    tls: true
    # 你用的是 Synology 憑證；如果客戶端驗證常出問題可先 true
    # 若你確認憑證對外網域/鏈完整，建議改回 false
    skip-cert-verify: true

proxy-groups:
  - name: PROXY
    type: select
    proxies:
      - NAS-WAN
      - DIRECT

  # YouTube 流量桶：預設走 PROXY（NAS）
  - name: YOUTUBE
    type: select
    proxies:
      - PROXY
      - DIRECT

  # VRChat 流量桶：預設 DIRECT（給 UU）
  - name: VRCHAT
    type: select
    proxies:
      - DIRECT
      - PROXY

  # 中國站流量桶：預設 DIRECT
  - name: CN
    type: select
    proxies:
      - DIRECT
      - PROXY

rules:
  # ========= 1) VRChat 內 YouTube：強制走 NAS（放最前面） =========
  - DOMAIN-SUFFIX,youtube.com,YOUTUBE
  - DOMAIN-SUFFIX,youtu.be,YOUTUBE
  - DOMAIN-SUFFIX,googlevideo.com,YOUTUBE
  - DOMAIN-SUFFIX,ytimg.com,YOUTUBE
  - DOMAIN-SUFFIX,googleapis.com,YOUTUBE
  - DOMAIN-SUFFIX,gvt1.com,YOUTUBE
  - DOMAIN-SUFFIX,gvt2.com,YOUTUBE

  # （可選）如果你發現 VRChat 內播放器常用這些
  - DOMAIN-SUFFIX,ggpht.com,YOUTUBE
  - DOMAIN-SUFFIX,googleusercontent.com,YOUTUBE

  # ========= 2) VRChat 本體：走 DIRECT（讓 UU 接手） =========
  - PROCESS-NAME,VRChat.exe,VRCHAT
  - PROCESS-NAME,VRChat,VRCHAT

  # ========= 3) 中國常見網站/服務：直連 =========
  - GEOIP,CN,CN

  # 你之前那串中國大廠 DOMAIN-SUFFIX 規則也可以留著（會更精準）
  # 這裡示意放幾個，你可把你那份完整清單貼回來一起用
  - DOMAIN-SUFFIX,bilibili.com,CN
  - DOMAIN-SUFFIX,hdslb.com,CN
  - DOMAIN-SUFFIX,baidu.com,CN
  - DOMAIN-SUFFIX,qq.com,CN
  - DOMAIN-SUFFIX,wechat.com,CN
  - DOMAIN-SUFFIX,taobao.com,CN
  - DOMAIN-SUFFIX,tmall.com,CN
  - DOMAIN-SUFFIX,aliyun.com,CN
  - DOMAIN-SUFFIX,myqcloud.com,CN

  # ========= 4) 區網/私有網段直連（避免 NAS/路由器管理頁被走代理） =========
  - 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
  - IP-CIDR,127.0.0.0/8,DIRECT,no-resolve

  # ========= 5) 其他全部：走 NAS =========
  - MATCH,PROXY
