#!MANAGED-CONFIG $subs_link interval=43200 strict=false # Xboard Surge 订阅模板(后台 → 订阅模板 → surge) # 由 surge/surge.conf 改写:节点由 Xboard 注入 [Proxy],策略组用 include-all-proxies 引入全部节点 # Xboard 对全文做字符串替换,注释里也会被替换:除下面用到的地方外,不要在任何位置写带美元符号的占位符 # 未包含 [MITM]:CA 证书属于每台设备,需要时在 Surge 里自行生成 [General] # > 日志级别 loglevel = notify # > DNS 劫持 # 强制接管指定 DNS 的 53 端口请求 hijack-dns = 8.8.8.8:53, 8.8.4.4:53 # > DNS 服务器(配置了加密 DNS 后,传统 DNS 只用于连通性测试和解析加密 DNS 地址中的域名,不做回落) dns-server = 223.5.5.5, 119.29.29.29 # > 加密 DNS(DoH / DoQ 合并到 encrypted-dns-server 一个参数中) # Surge 中 doh-server 已更名为 encrypted-dns-server,并同时支持 https:// (DoH)、h3:// (DoH3)、quic:// (DoQ) # 使用 IP 形式的地址,免去先用明文 DNS 解析 DoH 域名这一步 encrypted-dns-server = https://223.5.5.5/dns-query, https://1.12.12.12/dns-query # > 加密 DNS 连接遵循出站模式和规则(默认始终 DIRECT 且绕过规则) # 规则模式下这两个地址会命中 ChinaMax 直连;全局代理模式下会随之走代理 encrypted-dns-follow-outbound-mode = true # > 网络模式(仅 IPv4,关闭 IPv6 防止泄漏) # ipv6-vif 取值为 disabled / auto / always ipv6 = false ipv6-vif = disabled # > 跳过代理(强制直连,由 Surge VIF 处理) skip-proxy = 127.0.0.0/8, 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12, 100.64.0.0/10, 162.14.0.0/16, 211.99.96.0/19, 162.159.192.0/24, 162.159.193.0/24, 162.159.195.0/24, fc00::/7, fe80::/10, localhost, *.local, captive.apple.com, passenger.t3go.cn, *.ccb.com, wxh.wo.cn, *.abcchina.com, *.abcchina.com.cn # > 允许 Wi-Fi 访问 allow-wifi-access = false # > 测试超时(秒) test-timeout = 2 # > Internet 测试 URL(同时用作 DIRECT 策略的测试地址,选直连可达的 204 地址) internet-test-url = http://wifi.vivo.com.cn/generate_204 # > 代理测速 URL(1.1.1.1/generate_204 实际返回 301,换成真正的 204 地址) proxy-test-url = http://cp.cloudflare.com/generate_204 # > Always Real IP(命中域名时返回真实 IP 而非 Fake IP) always-real-ip = *.msftncsi.com, *.msftconnecttest.com, *.srv.nintendo.net, *.stun.playstation.net, xbox.*.microsoft.com, *.xboxlive.com, *.battlenet.com.cn, *.battlenet.com, *.blzstatic.cn, *.battle.net, *.turn.twilio.com, *.stun.twilio.com, stun.syncthing.net, stun.*, 127.*.*.*.sslip.io, 127-*-*-*.sslip.io, *.127.*.*.*.sslip.io, *-127-*-*-*.sslip.io, 127.*.*.*.nip.io, 127-*-*-*.nip.io, *.127.*.*.*.nip.io, *-127-*-*-*.nip.io # > UDP退回行为(当节点不支持 UDP 时直接拒绝,防止数据泄露) udp-policy-not-supported-behaviour = reject # > GeoIP数据库 geoip-maxmind-url = https://github.com/Hackl0us/GeoIP2-CN/raw/release/Country.mmdb disable-geoip-db-auto-update = true [Panel] SubscribeInfo = $subscribe_info, style=info [Proxy] $proxies [Proxy Group] 节点选择 = select, 自动选择, DIRECT, include-all-proxies=true, icon-url=https://gitea.bcde.io/wangdefa/subs/raw/branch/main/logo-144/airport.png 自动选择 = url-test, include-all-proxies=true, interval=600, tolerance=50, icon-url=https://gitea.bcde.io/wangdefa/subs/raw/branch/main/logo-144/xboard.png Anthropic = select, 节点选择, include-all-proxies=true, icon-url=https://gitea.bcde.io/wangdefa/subs/raw/branch/main/logo-144/claude.png OpenAI = select, 节点选择, include-all-proxies=true, icon-url=https://gitea.bcde.io/wangdefa/subs/raw/branch/main/logo-144/openai.png AI = select, 节点选择, include-all-proxies=true, icon-url=https://gitea.bcde.io/wangdefa/subs/raw/branch/main/logo-144/anthropic.png Google = select, 节点选择, include-all-proxies=true, icon-url=https://gitea.bcde.io/wangdefa/subs/raw/branch/main/logo-144/google.png Microsoft = select, DIRECT, 节点选择, include-all-proxies=true, icon-url=https://gitea.bcde.io/wangdefa/subs/raw/branch/main/logo-144/microsoft.png Apple = select, DIRECT, 节点选择, include-all-proxies=true, icon-url=https://gitea.bcde.io/wangdefa/subs/raw/branch/main/logo-144/apple.png Oracle = select, 节点选择, DIRECT, include-all-proxies=true, icon-url=https://gitea.bcde.io/wangdefa/subs/raw/branch/main/logo-144/oracle.png Telegram = select, 节点选择, include-all-proxies=true, icon-url=https://gitea.bcde.io/wangdefa/subs/raw/branch/main/logo-144/telegram.png YouTube = select, 节点选择, include-all-proxies=true, icon-url=https://gitea.bcde.io/wangdefa/subs/raw/branch/main/logo-144/youtube.png Emby = select, DIRECT, include-all-proxies=true, icon-url=https://gitea.bcde.io/wangdefa/subs/raw/branch/main/logo-144/emby.png Game = select, DIRECT, 节点选择, include-all-proxies=true, icon-url=https://gitea.bcde.io/wangdefa/subs/raw/branch/main/logo-144/steam.png Crypto = select, 节点选择, DIRECT, include-all-proxies=true, icon-url=https://gitea.bcde.io/wangdefa/subs/raw/branch/main/logo-144/binance.png Kraken = select, 节点选择, DIRECT, include-all-proxies=true, icon-url=https://gitea.bcde.io/wangdefa/subs/raw/branch/main/logo-144/kraken.png 英国专用 = select, DIRECT, include-all-proxies=true, policy-regex-filter=(🇬🇧)|(GB), icon-url=https://gitea.bcde.io/wangdefa/subs/raw/branch/main/logo-144/lloydsbank.png 荷兰专用 = select, DIRECT, include-all-proxies=true, policy-regex-filter=(🇳🇱)|(NL), icon-url=https://gitea.bcde.io/wangdefa/subs/raw/branch/main/logo-144/n26.png 欧洲专用 = select, DIRECT, include-all-proxies=true, policy-regex-filter=(🇬🇧)|(🇩🇪)|(🇳🇱)|(GB)|(DE)|(NL), icon-url=https://gitea.bcde.io/wangdefa/subs/raw/branch/main/logo-144/lemfi.png 国外网站 = select, 节点选择, include-all-proxies=true, icon-url=https://gitea.bcde.io/wangdefa/subs/raw/branch/main/logo-144/global.png Mail = select, DIRECT, include-all-proxies=true, policy-regex-filter=(AWS)|(Netcup)|(OCI)|(BWH)|(NUBE), icon-url=https://gitea.bcde.io/wangdefa/subs/raw/branch/main/logo-144/gmail.png 远程桌面 = select, DIRECT, include-all-proxies=true, icon-url=https://gitea.bcde.io/wangdefa/subs/raw/branch/main/logo-144/remote-desktop.png 漏网之鱼 = select, 节点选择, DIRECT, icon-url=https://gitea.bcde.io/wangdefa/subs/raw/branch/main/logo-144/final.png [Rule] # > 订阅域名直连(由 Xboard 替换为当前订阅域名,保证更新订阅不依赖节点) DOMAIN,$subs_domain,DIRECT # > 阻断 QUIC(含 Google DoH over HTTP/3)防止应用自行走 h3 DNS PROTOCOL,QUIC,REJECT # > Emby 服务器(直连) RULE-SET,https://gitea.bcde.io/wangdefa/subs/raw/branch/main/rule/Media/Emby/Lily-CN.list,DIRECT,update-interval=86400 RULE-SET,https://gitea.bcde.io/wangdefa/subs/raw/branch/main/rule/Media/Emby/Iris-CN.list,DIRECT,update-interval=86400 # > Emby 服务器(代理) RULE-SET,https://gitea.bcde.io/wangdefa/subs/raw/branch/main/rule/Media/Emby/Lily.list,Emby,update-interval=86400 RULE-SET,https://gitea.bcde.io/wangdefa/subs/raw/branch/main/rule/Media/Emby/UHD.list,Emby,update-interval=86400 RULE-SET,https://gitea.bcde.io/wangdefa/subs/raw/branch/main/rule/Media/Emby/Iris.list,Emby,update-interval=86400 # > 邮件服务 RULE-SET,https://gitea.bcde.io/wangdefa/subs/raw/branch/main/rule/Misc/Mail.list,Mail,update-interval=86400 # > AI服务 RULE-SET,https://gitea.bcde.io/wangdefa/subs/raw/branch/main/rule/AI/Claude.list,Anthropic,update-interval=86400 RULE-SET,https://gitea.bcde.io/wangdefa/subs/raw/branch/main/rule/AI/OpenAI.list,OpenAI,update-interval=86400 RULE-SET,https://gitea.bcde.io/wangdefa/subs/raw/branch/main/rule/AI/Bedrock.list,AI,update-interval=86400 RULE-SET,https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/refs/heads/master/rule/Surge/Gemini/Gemini.list,AI,update-interval=86400 RULE-SET,https://gitea.bcde.io/wangdefa/subs/raw/branch/main/rule/AI/Grok.list,AI,update-interval=86400 RULE-SET,https://gitea.bcde.io/wangdefa/subs/raw/branch/main/rule/AI/Cursor.list,AI,update-interval=86400 RULE-SET,https://gitea.bcde.io/wangdefa/subs/raw/branch/main/rule/AI/Muse.list,AI,update-interval=86400 # > Oracle 云服务 RULE-SET,https://gitea.bcde.io/wangdefa/subs/raw/branch/main/rule/Cloud/Oracle.list,Oracle,update-interval=86400 # > 欧洲金融服务 RULE-SET,https://gitea.bcde.io/wangdefa/subs/raw/branch/main/rule/Finance/N26.list,荷兰专用,update-interval=86400 RULE-SET,https://gitea.bcde.io/wangdefa/subs/raw/branch/main/rule/Finance/Trading-212.list,荷兰专用,update-interval=86400 RULE-SET,https://gitea.bcde.io/wangdefa/subs/raw/branch/main/rule/Finance/LloydsBank.list,英国专用,update-interval=86400 RULE-SET,https://gitea.bcde.io/wangdefa/subs/raw/branch/main/rule/Finance/Monzo.list,英国专用,update-interval=86400 RULE-SET,https://gitea.bcde.io/wangdefa/subs/raw/branch/main/rule/Finance/LemFi.list,欧洲专用,update-interval=86400 # > 加密货币 RULE-SET,https://gitea.bcde.io/wangdefa/subs/raw/branch/main/rule/Crypto/Binance.list,Crypto,update-interval=86400 RULE-SET,https://gitea.bcde.io/wangdefa/subs/raw/branch/main/rule/Crypto/OKX.list,Crypto,update-interval=86400 RULE-SET,https://gitea.bcde.io/wangdefa/subs/raw/branch/main/rule/Crypto/Kraken.list,Kraken,update-interval=86400 RULE-SET,https://gitea.bcde.io/wangdefa/subs/raw/branch/main/rule/Crypto/Gate.list,Crypto,update-interval=86400 RULE-SET,https://gitea.bcde.io/wangdefa/subs/raw/branch/main/rule/Crypto/MEXC.list,Crypto,update-interval=86400 RULE-SET,https://gitea.bcde.io/wangdefa/subs/raw/branch/main/rule/Crypto/Hyperliquid.list,Crypto,update-interval=86400 RULE-SET,https://gitea.bcde.io/wangdefa/subs/raw/branch/main/rule/Crypto/DeFi.list,Crypto,update-interval=86400 # > 社交平台 RULE-SET,https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/Telegram/Telegram.list,Telegram,update-interval=86400 # > 国外媒体 RULE-SET,https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/YouTube/YouTube.list,YouTube,update-interval=86400 # > 游戏平台 RULE-SET,https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/Epic/Epic.list,Game,update-interval=86400 RULE-SET,https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/Steam/Steam.list,Game,update-interval=86400 # > 谷歌服务 RULE-SET,https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/Google/Google.list,Google,no-resolve,update-interval=86400 # > 微软服务 RULE-SET,https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/Microsoft/Microsoft.list,Microsoft,update-interval=86400 # > 苹果服务 RULE-SET,https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/Apple/Apple_All_No_Resolve.list,Apple,update-interval=86400 # > 国外网站 RULE-SET,https://gitea.bcde.io/wangdefa/subs/raw/branch/main/rule/Crypto/Mining-Pool.list,国外网站,update-interval=86400 RULE-SET,https://gitea.bcde.io/wangdefa/subs/raw/branch/main/rule/Cloud/IDC.list,国外网站,update-interval=86400 RULE-SET,https://gitea.bcde.io/wangdefa/subs/raw/branch/main/rule/Misc/Other.list,国外网站,update-interval=86400 RULE-SET,https://gitea.bcde.io/wangdefa/subs/raw/branch/main/rule/Misc/PikPak.list,国外网站,update-interval=86400 # > 直连 # ChinaMax_All 内含 1.2 万条未带 no-resolve 的 IP-CIDR,必须在行尾加 no-resolve # 否则所有未命中域名规则的请求都会在这里被国内 DNS 解析,造成 DNS 泄露 RULE-SET,https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Surge/ChinaMax/ChinaMax_All.list,DIRECT,extended-matching,no-resolve,update-interval=86400 # > 最终规则 # Surge 按顺序匹配,遇到第一条需要 IP 的规则时就做本地 DNS 解析,所以 LAN 和 GEOIP 都要加 no-resolve # 代价:解析到内网 IP 的自定义域名(如 nas.example.com)不再自动直连,需要单独写 DOMAIN 规则 RULE-SET,LAN,DIRECT,no-resolve GEOIP,CN,DIRECT,no-resolve FINAL,漏网之鱼,dns-failed