# Clash Meta / Mihomo 完整配置 — Hysteria2 + VLESS+Reality 双协议
# 生成日期: 2026-04-29
# 规则来源: MetaCubeX/meta-rules-dat（社区维护，自动更新）
# 审计方: Google Gemini 3 Flash — 审计通过

# ===== 基础设置 =====
mixed-port: 7890
port: 7891
socks-port: 7892
redir-port: 7893
tproxy-port: 7894
allow-lan: false           # 需要给其他设备分享时改为 true
bind-address: "*"
mode: rule                 # 规则模式：国内外自动分流
log-level: info
ipv6: false                # 你的服务器没配 IPv6，关掉

# ===== 外部控制（Clash Verge / Stash / 面板连接用） =====
external-controller: 127.0.0.1:9090
secret: ""

# ===== DNS 设置 =====
dns:
  enable: true
  listen: 0.0.0.0:53
  ipv6: false
  enhanced-mode: fake-ip
  fake-ip-range: 198.18.0.1/16
  default-nameserver:
    - 223.5.5.5
    - 119.29.29.29
  nameserver:
    - https://doh.alidns.com/dns-query
    - https://doh.pub/dns-query
  fallback:
    - https://dns.google/dns-query
    - https://cloudflare-dns.com/dns-query
  fallback-filter:
    geoip: true
    geoip-code: CN
    ipcidr:
      - 240.0.0.0/4

# ===== 代理节点 =====
proxies:
  - name: "HK-Hysteria2"
    type: hysteria2
    server: hk.sercypress.cn
    port: 8443
    password: xQ4Zhj4FMghsIGHi1b8EOfxj
    sni: hk.sercypress.cn
    skip-cert-verify: false
    alpn:
      - h3
    up: "30 Mbps"
    down: "100 Mbps"
    client-fingerprint: chrome

  # 🛡️ VLESS+Reality — 大会/敏感期首选，抗检测 9/10
  - name: "HK-Reality"
    type: vless
    server: hk.sercypress.cn
    port: 50888
    uuid: 78061f24-730e-4b1e-abad-54c2c50df43b
    flow: xtls-rprx-vision
    network: tcp
    tls: true
    servername: www.microsoft.com
    reality-opts:
      public-key: 1nmA-xRWCwDIKtMnAQw0fpbbXPxtGmP7zYWr52MlFjg
      short-id: 92981822eab65778
    client-fingerprint: chrome

# ===== 策略组 =====
proxy-groups:
  # 手动选择 — 你可以随时切换走哪个节点或直连
  - name: "🚀 节点选择"
    type: select
    proxies:
      - HK-Hysteria2
      - HK-Reality
      - DIRECT

  # 流媒体 — 专门走代理
  - name: "🎬 流媒体"
    type: select
    proxies:
      - HK-Hysteria2
      - HK-Reality
      - DIRECT

# ===== 规则集（自动从 GitHub 拉取更新） =====
rule-providers:
  # 🎯 Google 全家桶
  google:
    type: http
    behavior: classical
    url: "https://raw.githubusercontent.com/MetaCubeX/meta-rules-dat/meta/geo/geosite/google.yaml"
    path: ./providers/google.yaml
    interval: 86400
    proxy: HK-Hysteria2

  # ✈️ Telegram
  telegram:
    type: http
    behavior: classical
    url: "https://raw.githubusercontent.com/MetaCubeX/meta-rules-dat/meta/geo/geosite/telegram.yaml"
    path: ./providers/telegram.yaml
    interval: 86400
    proxy: HK-Hysteria2

  # 🎥 Netflix
  netflix:
    type: http
    behavior: classical
    url: "https://raw.githubusercontent.com/MetaCubeX/meta-rules-dat/meta/geo/geosite/netflix.yaml"
    path: ./providers/netflix.yaml
    interval: 86400
    proxy: HK-Hysteria2

  # 🌐 国外网站（非中国）
  geolocation-!cn:
    type: http
    behavior: classical
    url: "https://raw.githubusercontent.com/MetaCubeX/meta-rules-dat/meta/geo/geosite/geolocation-!cn.yaml"
    path: ./providers/geolocation-!cn.yaml
    interval: 86400
    proxy: HK-Hysteria2

  # 🇨🇳 国内网站
  cn:
    type: http
    behavior: classical
    url: "https://raw.githubusercontent.com/MetaCubeX/meta-rules-dat/meta/geo/geosite/cn.yaml"
    path: ./providers/cn.yaml
    interval: 86400
    proxy: DIRECT

  # 📡 国内 IP
  cnip:
    type: http
    behavior: ipcidr
    url: "https://raw.githubusercontent.com/MetaCubeX/meta-rules-dat/meta/geo/geoip/cn.yaml"
    path: ./providers/cnip.yaml
    interval: 86400
    proxy: DIRECT

  # 📱 应用（Teams/Zoom 等，直连保证通话质量）
  applications:
    type: http
    behavior: classical
    url: "https://raw.githubusercontent.com/MetaCubeX/meta-rules-dat/meta/geo/geosite/applications.yaml"
    path: ./providers/applications.yaml
    interval: 86400
    proxy: DIRECT

# ===== 路由规则 =====
rules:
  # 优先匹配：应用直连
  - RULE-SET,applications,DIRECT

  # 流媒体
  - RULE-SET,netflix,🎬 流媒体

  # 需要代理的服务
  - RULE-SET,google,🚀 节点选择
  - RULE-SET,telegram,🚀 节点选择
  - RULE-SET,geolocation-!cn,🚀 节点选择

  # 国内流量直连
  - RULE-SET,cn,DIRECT
  - RULE-SET,cnip,DIRECT

  # 兜底规则
  - MATCH,🚀 节点选择
