# ============================================================ # Xboard Clash Meta (mihomo) 订阅模板(后台 → 订阅模板 → clashmeta) # 由 mihomo/mihomo.yaml 改写,Xboard 生成订阅时会: # 1. 把节点追加到 proxies # 2. 策略组里没有正则条目的,追加全部节点;有 '/正则/u' 条目的,替换为名称匹配的节点 # 3. 删除最终为空的策略组(所以按正则筛节点的组都带 DIRECT 或 节点选择 兜底) # 4. 在 rules 最前面插入 DOMAIN,<订阅域名>,DIRECT # 注意:Xboard 会重新序列化 YAML,本文件中的注释不会出现在用户拿到的配置里 # ============================================================ # > sniffer 模块:基于流量特征动态识别域名,提升 DNS 分流准确性。 sniffer: enable: true force-dns-mapping: true # 用嗅探到的 SNI 覆盖过时的 redir-host 映射 parse-pure-ip: true # 对完全没有 DNS 映射的连接也尝试嗅探 override-destination: true sniff: TLS: ports: [443, 8443] HTTP: ports: [80, 8080-8880] QUIC: ports: [443, 8443] # > DNS 模块:Clash 内置 DNS 服务器,提供基于域名的智能分流和污染防御。 dns: enable: true # 模板面向各类桌面 / 移动客户端,不占用 53 端口;TUN 模式由 dns-hijack 接管 DNS listen: '127.0.0.1:1053' # fake-ip:立即返回假 IP 以提升速度。 # Clash 拦截连接并按域名路由;真正的解析在后台或通过代理进行。 enhanced-mode: fake-ip fake-ip-range: '198.18.0.1/16' # 黑名单模式:所有域名返回假 IP,以下列表的除外。 fake-ip-filter-mode: blacklist fake-ip-filter: - '*.lan' # 局域网主机名——路由器、NAS、打印机 - '*.local' # mDNS / 本地服务 - '*.arpa' # 反向 DNS——本质上是基于 IP 的 - 'time.*.com' # NTP 时间服务器 - 'ntp.*.com' # NTP 时间服务器 - '+.market.xiaomi.com' # 小米应用商店 CDN - 'localhost.ptlogin2.qq.com' # QQ 本地认证 - '*.msftncsi.com' # Windows 网络连通性检查 - 'www.msftconnecttest.com' # Windows 网络连通性检查 # 引导 DNS:在流水线就绪前解析 DoH 服务器主机名。 # 必须填纯 IP——此阶段没有主机名解析能力。 default-nameserver: - '223.5.5.5' - '119.29.29.29' # 独立于主流水线,专门解析代理节点主机名。 # 打破循环依赖:代理需要 DNS,DNS 需要代理。 proxy-server-nameserver: - '223.5.5.5' - '119.29.29.29' # 最高优先级层:在解析发生前按域名路由查询。 # 国内和私有域名 → 国内 DNS,不触碰境外 DNS 服务器。 nameserver-policy: 'geosite:cn,private': - '223.5.5.5' # 阿里 DNS——快,国内 - '119.29.29.29' # DNSPod——快,国内 - 'https://doh.pub/dns-query' # DNSPod DoH——加密备份 - 'https://dns.alidns.com/dns-query' # 阿里 DoH——加密备份 # 默认层:处理所有未被 nameserver-policy 命中的域名。 # 到这里的几乎全是国外域名。 # #RULES 让查询通过代理隧道出境——干净,无污染。 nameserver: - 'https://8.8.8.8/dns-query#国外网站' - 'https://1.1.1.1/dns-query#国外网站' # 为直连连接重新解析域名——假 IP 无法建立真实连接, # 此阶段必须拿到真实 IP。 direct-nameserver: - '223.5.5.5' - '119.29.29.29' # 重新解析时同样遵守 nameserver-policy,保持端到端行为一致。 # 防御性选项;实际上 DIRECT 流量几乎都是国内域名。 direct-nameserver-follow-policy: true # 禁用 fallback——nameserver-policy 已在前端干净地完成了分流。 # fallback: [] 加上 geoip: false,使 GUI 强制写入的 filter 字段完全失效。 fallback: [] fallback-filter: geoip: false prefer-h3: false respect-rules: false use-hosts: false use-system-hosts: false ipv6: false # > 基础设置 mixed-port: 7890 allow-lan: false mode: rule log-level: warning ipv6: false # 控制接口(external-controller / secret)交给客户端设置:模板被所有订阅用户共用,写死密码没有意义 # > 进阶设置 unified-delay: true tcp-concurrent: true keep-alive-interval: 30 find-process-mode: strict # v1.19.27 起已移除,新内核只会报错并忽略,指纹需在节点上用 client-fingerprint 设置 # 保留是为了兼容旧内核,确认内核 ≥ v1.19.27 后可删除 global-client-fingerprint: chrome # > 缓存设置 profile: store-selected: true store-fake-ip: true hosts: epdg.epc.mnc002.mcc262.pub.3gppnetwork.org: 139.7.117.170 # ============================================================ # 节点(由 Xboard 注入,模板里留空;必须保留这个键) # ============================================================ proxies: [] # ============================================================ # 代理组 # ============================================================ proxy-groups: # > 节点选择 - name: "节点选择" type: select proxies: - "自动选择" - DIRECT icon: https://gitea.bcde.io/wangdefa/subs/raw/branch/main/logo-144/xboard.png # > 自动选择(proxies 留空,Xboard 会填入全部节点) - name: "自动选择" type: url-test proxies: [] url: http://cp.cloudflare.com/generate_204 interval: 600 tolerance: 50 icon: https://gitea.bcde.io/wangdefa/subs/raw/branch/main/logo-144/airport.png # > Anthropic - name: "Anthropic" type: select proxies: - "节点选择" icon: https://gitea.bcde.io/wangdefa/subs/raw/branch/main/logo-144/claude.png # > OpenAI - name: "OpenAI" type: select proxies: - "节点选择" icon: https://gitea.bcde.io/wangdefa/subs/raw/branch/main/logo-144/openai.png # > AI - name: "AI" type: select proxies: - "节点选择" icon: https://gitea.bcde.io/wangdefa/subs/raw/branch/main/logo-144/anthropic.png # > Google - name: "Google" type: select proxies: - "节点选择" icon: https://gitea.bcde.io/wangdefa/subs/raw/branch/main/logo-144/google.png # > Microsoft - name: "Microsoft" type: select proxies: - DIRECT - "节点选择" icon: https://gitea.bcde.io/wangdefa/subs/raw/branch/main/logo-144/microsoft.png # > Apple - name: "Apple" type: select proxies: - DIRECT - "节点选择" icon: https://gitea.bcde.io/wangdefa/subs/raw/branch/main/logo-144/apple.png # > Oracle - name: "Oracle" type: select proxies: - "节点选择" - DIRECT icon: https://gitea.bcde.io/wangdefa/subs/raw/branch/main/logo-144/oracle.png # > Telegram - name: "Telegram" type: select proxies: - "节点选择" icon: https://gitea.bcde.io/wangdefa/subs/raw/branch/main/logo-144/telegram.png # > YouTube - name: "YouTube" type: select proxies: - "节点选择" icon: https://gitea.bcde.io/wangdefa/subs/raw/branch/main/logo-144/youtube.png # > Emby - name: "Emby" type: select proxies: - DIRECT icon: https://gitea.bcde.io/wangdefa/subs/raw/branch/main/logo-144/emby.png # > Game - name: "Game" type: select proxies: - DIRECT - "节点选择" icon: https://gitea.bcde.io/wangdefa/subs/raw/branch/main/logo-144/steam.png # > Crypto - name: "Crypto" type: select proxies: - "节点选择" - DIRECT icon: https://gitea.bcde.io/wangdefa/subs/raw/branch/main/logo-144/binance.png # > Kraken - name: "Kraken" type: select proxies: - "节点选择" - DIRECT icon: https://gitea.bcde.io/wangdefa/subs/raw/branch/main/logo-144/kraken.png # > N26/212 - name: "N26/212" type: select proxies: - DIRECT - '/🇩🇪|🇳🇱|DE|NL/u' # Xboard 替换为名称匹配的节点 icon: https://gitea.bcde.io/wangdefa/subs/raw/branch/main/logo-144/n26.png # > 国外网站 - name: "国外网站" type: select proxies: - "节点选择" icon: https://gitea.bcde.io/wangdefa/subs/raw/branch/main/logo-144/global.png # > Mail - name: "Mail" type: select proxies: - DIRECT - '/AWS|GCP|OCI|BWH/u' # Xboard 替换为名称匹配的节点 icon: https://gitea.bcde.io/wangdefa/subs/raw/branch/main/logo-144/gmail.png # > IWLAN-HK - name: "IWLAN-HK" type: select proxies: - "节点选择" - '/🇭🇰|HK/u' # Xboard 替换为名称匹配的节点 icon: https://gitea.bcde.io/wangdefa/subs/raw/branch/main/logo-144/wificalling-hk.png # > IWLAN-UK - name: "IWLAN-UK" type: select proxies: - "节点选择" - '/🇬🇧|UK/u' # Xboard 替换为名称匹配的节点 icon: https://gitea.bcde.io/wangdefa/subs/raw/branch/main/logo-144/wificalling-uk.png # > IWLAN-DE - name: "IWLAN-DE" type: select proxies: - "节点选择" - '/🇩🇪|DE/u' # Xboard 替换为名称匹配的节点 icon: https://gitea.bcde.io/wangdefa/subs/raw/branch/main/logo-144/wificalling-de.png # > IWLAN-NL - name: "IWLAN-NL" type: select proxies: - "节点选择" - '/🇳🇱|NL/u' # Xboard 替换为名称匹配的节点 icon: https://gitea.bcde.io/wangdefa/subs/raw/branch/main/logo-144/wificalling-nl.png # > 漏网之鱼 - name: "漏网之鱼" type: select proxies: - "节点选择" - DIRECT icon: https://gitea.bcde.io/wangdefa/subs/raw/branch/main/logo-144/final.png # ============================================================ # 规则提供者 # ============================================================ rule-providers: # Emby Lily-Emby-CN: type: http behavior: classical format: yaml url: "https://gitea.bcde.io/wangdefa/subs/raw/branch/main/rule/Media/Emby/Lily-CN.yaml" path: ./ruleset/Lily-Emby-CN.yaml interval: 86400 Iris-CN: type: http behavior: classical format: yaml url: "https://gitea.bcde.io/wangdefa/subs/raw/branch/main/rule/Media/Emby/Iris-CN.yaml" path: ./ruleset/Iris-CN.yaml interval: 86400 Lily-Emby: type: http behavior: classical format: yaml url: "https://gitea.bcde.io/wangdefa/subs/raw/branch/main/rule/Media/Emby/Lily.yaml" path: ./ruleset/Lily-Emby.yaml interval: 86400 Iris: type: http behavior: classical format: yaml url: "https://gitea.bcde.io/wangdefa/subs/raw/branch/main/rule/Media/Emby/Iris.yaml" path: ./ruleset/Iris.yaml interval: 86400 UHD: type: http behavior: classical format: yaml url: "https://gitea.bcde.io/wangdefa/subs/raw/branch/main/rule/Media/Emby/UHD.yaml" path: ./ruleset/UHD.yaml interval: 86400 # Mail Mail: type: http behavior: classical format: yaml url: "https://gitea.bcde.io/wangdefa/subs/raw/branch/main/rule/Misc/Mail.yaml" path: ./ruleset/Mail.yaml interval: 86400 # AI Claude: type: http behavior: classical format: yaml url: "https://gitea.bcde.io/wangdefa/subs/raw/branch/main/rule/AI/Claude.yaml" path: ./ruleset/Claude.yaml interval: 86400 OpenAI: type: http behavior: classical format: yaml url: "https://gitea.bcde.io/wangdefa/subs/raw/branch/main/rule/AI/OpenAI.yaml" path: ./ruleset/OpenAI.yaml interval: 86400 Bedrock: type: http behavior: classical format: yaml url: "https://gitea.bcde.io/wangdefa/subs/raw/branch/main/rule/AI/Bedrock.yaml" path: ./ruleset/Bedrock.yaml interval: 86400 Gemini: type: http behavior: classical format: yaml url: "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/refs/heads/master/rule/Clash/Gemini/Gemini.yaml" path: ./ruleset/Gemini.yaml interval: 86400 Grok: type: http behavior: classical format: yaml url: "https://gitea.bcde.io/wangdefa/subs/raw/branch/main/rule/AI/Grok.yaml" path: ./ruleset/Grok.yaml interval: 86400 Cursor: type: http behavior: classical format: yaml url: "https://gitea.bcde.io/wangdefa/subs/raw/branch/main/rule/AI/Cursor.yaml" path: ./ruleset/Cursor.yaml interval: 86400 Muse: type: http behavior: classical format: yaml url: "https://gitea.bcde.io/wangdefa/subs/raw/branch/main/rule/AI/Muse.yaml" path: ./ruleset/Muse.yaml interval: 86400 # Oracle Oracle: type: http behavior: classical format: yaml url: "https://gitea.bcde.io/wangdefa/subs/raw/branch/main/rule/Cloud/Oracle.yaml" path: ./ruleset/Oracle.yaml interval: 86400 # N26/212 N26: type: http behavior: classical format: yaml url: "https://gitea.bcde.io/wangdefa/subs/raw/branch/main/rule/Finance/N26.yaml" path: ./ruleset/N26.yaml interval: 86400 Trading-212: type: http behavior: classical format: yaml url: "https://gitea.bcde.io/wangdefa/subs/raw/branch/main/rule/Finance/Trading-212.yaml" path: ./ruleset/Trading-212.yaml interval: 86400 # Crypto(每个交易所一个规则集) Binance: type: http behavior: classical format: yaml url: "https://gitea.bcde.io/wangdefa/subs/raw/branch/main/rule/Crypto/Binance.yaml" path: ./ruleset/Binance.yaml interval: 86400 OKX: type: http behavior: classical format: yaml url: "https://gitea.bcde.io/wangdefa/subs/raw/branch/main/rule/Crypto/OKX.yaml" path: ./ruleset/OKX.yaml interval: 86400 Kraken: type: http behavior: classical format: yaml url: "https://gitea.bcde.io/wangdefa/subs/raw/branch/main/rule/Crypto/Kraken.yaml" path: ./ruleset/Kraken.yaml interval: 86400 Gate: type: http behavior: classical format: yaml url: "https://gitea.bcde.io/wangdefa/subs/raw/branch/main/rule/Crypto/Gate.yaml" path: ./ruleset/Gate.yaml interval: 86400 MEXC: type: http behavior: classical format: yaml url: "https://gitea.bcde.io/wangdefa/subs/raw/branch/main/rule/Crypto/MEXC.yaml" path: ./ruleset/MEXC.yaml interval: 86400 Hyperliquid: type: http behavior: classical format: yaml url: "https://gitea.bcde.io/wangdefa/subs/raw/branch/main/rule/Crypto/Hyperliquid.yaml" path: ./ruleset/Hyperliquid.yaml interval: 86400 DeFi: type: http behavior: classical format: yaml url: "https://gitea.bcde.io/wangdefa/subs/raw/branch/main/rule/Crypto/DeFi.yaml" path: ./ruleset/DeFi.yaml interval: 86400 # Telegram Telegram: type: http behavior: classical format: yaml url: "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Telegram/Telegram.yaml" path: ./ruleset/Telegram.yaml interval: 86400 # YouTube YouTube: type: http behavior: classical format: yaml url: "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/YouTube/YouTube.yaml" path: ./ruleset/YouTube.yaml interval: 86400 # Game Epic: type: http behavior: classical format: yaml url: "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Epic/Epic.yaml" path: ./ruleset/Epic.yaml interval: 86400 Steam: type: http behavior: classical format: yaml url: "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Steam/Steam.yaml" path: ./ruleset/Steam.yaml interval: 86400 # Google Google: type: http behavior: classical format: yaml url: "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Google/Google.yaml" path: ./ruleset/Google.yaml interval: 86400 # Microsoft Microsoft: type: http behavior: classical format: yaml url: "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Microsoft/Microsoft.yaml" path: ./ruleset/Microsoft.yaml interval: 86400 # Apple Apple: type: http behavior: classical format: yaml url: "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Apple/Apple.yaml" path: ./ruleset/Apple.yaml interval: 86400 # 国外网站 Mining-Pool: type: http behavior: classical format: yaml url: "https://gitea.bcde.io/wangdefa/subs/raw/branch/main/rule/Crypto/Mining-Pool.yaml" path: ./ruleset/Mining-Pool.yaml interval: 86400 IDC: type: http behavior: classical format: yaml url: "https://gitea.bcde.io/wangdefa/subs/raw/branch/main/rule/Cloud/IDC.yaml" path: ./ruleset/IDC.yaml interval: 86400 Other: type: http behavior: classical format: yaml url: "https://gitea.bcde.io/wangdefa/subs/raw/branch/main/rule/Misc/Other.yaml" path: ./ruleset/Other.yaml interval: 86400 PikPak: type: http behavior: classical format: yaml url: "https://gitea.bcde.io/wangdefa/subs/raw/branch/main/rule/Misc/PikPak.yaml" path: ./ruleset/PikPak.yaml interval: 86400 # WiFi Calling(香港) WiFiCalling-HK: type: http behavior: classical format: yaml url: "https://gitea.bcde.io/wangdefa/subs/raw/branch/main/rule/WiFiCalling/HK.yaml" path: ./ruleset/WiFiCalling-HK.yaml interval: 86400 # WiFi Calling(英国) WiFiCalling-UK: type: http behavior: classical format: yaml url: "https://gitea.bcde.io/wangdefa/subs/raw/branch/main/rule/WiFiCalling/UK.yaml" path: ./ruleset/WiFiCalling-UK.yaml interval: 86400 # WiFi Calling(德国) WiFiCalling-DE: type: http behavior: classical format: yaml url: "https://gitea.bcde.io/wangdefa/subs/raw/branch/main/rule/WiFiCalling/DE.yaml" path: ./ruleset/WiFiCalling-DE.yaml interval: 86400 # WiFi Calling(荷兰) WiFiCalling-NL: type: http behavior: classical format: yaml url: "https://gitea.bcde.io/wangdefa/subs/raw/branch/main/rule/WiFiCalling/NL.yaml" path: ./ruleset/WiFiCalling-NL.yaml interval: 86400 # 直连 # classical 规则集是逐条线性匹配,ChinaMax 有 12 万多条,每个未命中前面规则的连接都要遍历一遍 # 拆成 domain(域名树)+ ipcidr(IP 索引)两个规则集,匹配开销与条数无关 # 代价:丢掉原集合里 13 条 DOMAIN-KEYWORD 和 14 条 PROCESS-NAME,基本由后面的 GEOSITE,CN 兜住 ChinaMax-Domain: type: http behavior: domain format: text url: "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/ChinaMax/ChinaMax_Domain_For_Clash.txt" path: ./ruleset/ChinaMax_Domain.txt interval: 86400 ChinaMax-IP: type: http behavior: ipcidr format: text url: "https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/ChinaMax/ChinaMax_IP_No_IPv6.txt" path: ./ruleset/ChinaMax_IP.txt interval: 86400 # ============================================================ # 规则 # ============================================================ rules: # > 局域网直连 - GEOSITE,private,DIRECT - GEOIP,private,DIRECT,no-resolve # > Emby 服务器(直连) - RULE-SET,Lily-Emby-CN,DIRECT - RULE-SET,Iris-CN,DIRECT # > Emby 服务器(代理) - RULE-SET,Lily-Emby,Emby - RULE-SET,Iris,Emby - RULE-SET,UHD,Emby # > 邮件服务 - RULE-SET,Mail,Mail # > WiFi Calling - RULE-SET,WiFiCalling-HK,IWLAN-HK - RULE-SET,WiFiCalling-UK,IWLAN-UK - RULE-SET,WiFiCalling-DE,IWLAN-DE - RULE-SET,WiFiCalling-NL,IWLAN-NL # > AI 服务 # 规则集行尾的 no-resolve:集合里的 IP 规则只匹配纯 IP 请求,不为域名请求触发 DNS 解析 # (blackmatrix7 的 Clash 规则里 IP-CIDR 都没带 no-resolve) - RULE-SET,Claude,Anthropic - RULE-SET,OpenAI,OpenAI,no-resolve - RULE-SET,Bedrock,AI - RULE-SET,Gemini,AI - RULE-SET,Grok,AI - RULE-SET,Cursor,AI - RULE-SET,Muse,AI # > Oracle 云服务 - RULE-SET,Oracle,Oracle # > N26/212 - RULE-SET,N26,N26/212 - RULE-SET,Trading-212,N26/212 # > 加密货币 - RULE-SET,Binance,Crypto - RULE-SET,OKX,Crypto - RULE-SET,Kraken,Kraken - RULE-SET,Gate,Crypto - RULE-SET,MEXC,Crypto - RULE-SET,Hyperliquid,Crypto - RULE-SET,DeFi,Crypto # > 社交平台 - RULE-SET,Telegram,Telegram,no-resolve # > 国外媒体 - RULE-SET,YouTube,YouTube,no-resolve # > 游戏平台 - RULE-SET,Epic,Game - RULE-SET,Steam,Game,no-resolve # > 谷歌服务 - RULE-SET,Google,Google,no-resolve # > 微软服务 - RULE-SET,Microsoft,Microsoft # > 苹果服务 - RULE-SET,Apple,Apple,no-resolve # > 国外网站 - RULE-SET,Mining-Pool,国外网站 - RULE-SET,IDC,国外网站 - RULE-SET,Other,国外网站 - RULE-SET,PikPak,国外网站 # > 直连 - RULE-SET,ChinaMax-Domain,DIRECT - RULE-SET,ChinaMax-IP,DIRECT,no-resolve # > 最终规则 # GEOIP,CN 故意不加 no-resolve:未命中任何域名规则的域名在这里解析一次, # 国外域名走 nameserver(8.8.8.8 DoH 经 国外网站 代理),不会泄露到国内 DNS, # 同时让未收录的国内站点仍能按 IP 归属地直连 - GEOSITE,CN,DIRECT - GEOIP,CN,DIRECT - MATCH,漏网之鱼