executing-plans
executing-plans
Use when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available
surge-configurationUse when editing Surge `.conf` or `.dconf` profiles, troubleshooting policy, rule, or DNS behavior, or optimizing Surge setups. Covers profile structure, policy groups, rules, DNS, MITM, Ponte, Gateway mode, and provider integration.
Independent GitHub snapshot · Automated classification · Original documentation governs
.conf or .dconf profiles, troubleshooting policy, rule, or DNS behavior, or optimizing Surge setups. Covers profile structure, policy groups, rules, DNS, MITM, Ponte, Gateway mode, and provider integration.Use this skill to author or troubleshoot Surge profiles while keeping official documentation as the source of truth for version-sensitive behavior.
.conf / .dconf 配置Proxy Group、Rule 和 DNS 细节When answering Surge questions, always follow this source priority:
https://nssurge.com/mac/latest/appcast-signed-beta.xmlhttps://manual.nssurge.com/ | LLM: https://manual.nssurge.com/llms.txthttps://kb.nssurge.com/surge-knowledge-base/zh | LLM: https://kb.nssurge.com/llms.txtAlways use Context7 MCP tools to fetch latest docs when generating config or setup steps.
Surge config is INI format with [Section] segments:
[General] # Global settings (key = value)
[Ponte] # Surge Ponte private network
[Proxy] # Proxy server definitions
[Proxy Group] # Policy groups (select, smart, fallback, url-test, subnet, load-balance)
[Rule] # Traffic routing rules (ORDER MATTERS)
[Host] # Local DNS mapping
[URL Rewrite] # URL rewrite rules
[Header Rewrite] # Header modification
[Map Local] # Mock local responses
[SSID Setting] # Per-network settings
[MITM] # HTTPS decryption config
[WireGuard xxx] # WireGuard interface definitions
Use #!include to split config into modules:
[Proxy]
#!include config/proxy-cloud.dconf, config/proxy-home.dconf
[Rule]
#!include config/vpn.dconf, surge.conf
#!include cannot be mixed with regular content: If a section uses #!include, it can only contain #!include directives (and comments), and cannot contain regular rule/definition lines at the same time. If additional content needs to be added, it should be placed in the referenced dconf file.[Section] declaration.conf for complete configs, .dconf for partial segmentsProxy = smart, ProxyA, ProxyB, ProxyC, interval=600, timeout=5
policy-priority="Premium:0.9;SG:1.3" (<1 = higher priority)VPN跳板 = subnet, default = Home, "SSID:MyWiFi" = DIRECT, "ROUTER:192.168.2.1" = DIRECT
Auto-switch based on network environment. Match types: SSID:, BSSID:, ROUTER:, TYPE: (CELLULAR/WIFI/WIRED), DEVICE-NAME:.
可用切换 = fallback, ProxyA, ProxyB, interval=600, timeout=5
自动测速 = url-test, ProxyA, ProxyB, interval=600, tolerance=100, timeout=5
tolerance (url-test only, default 100ms): prevents unnecessary switchingevaluate-before-use=true: block requests until first test completesRules are matched top-to-bottom. First match wins.
[Rule]
# Domain rules first (no DNS needed)
DOMAIN-SUFFIX,google.com,Proxy
DOMAIN,specific.example.com,DIRECT
# Then IP rules (trigger DNS resolution)
IP-CIDR,192.168.0.0/16,DIRECT,no-resolve
GEOIP,CN,DIRECT
# Final catch-all
FINAL,Proxy,dns-failed
no-resolve to IP rules when possible to skip DNSdns-failed on FINAL with proxy policy to handle DNS failures gracefullyextended-matching for rules that should also match via SNI/Host sniffing# Only route home network when NOT at home
AND,((NOT,((SUBNET,ROUTER:192.168.2.1))), (IP-CIDR,192.168.2.0/24,no-resolve)),Home
[General]
dns-server = 223.5.5.5, 114.114.114.114 # Traditional DNS
encrypted-dns-server = tls://223.5.5.5 # DoT/DoH
hijack-dns = 8.8.8.8:53, 8.8.4.4:53 # Hijack hardcoded DNS
always-real-ip = *.srv.nintendo.net, *.stun.playstation.net # Preserve NAT type
no-resolve), proxy server hostname, DIRECT policyuse-local-host-item-for-proxy = true: use local Host mapping for proxy connections[SSID Setting]
SSID:HomeWiFi dns-server="192.168.2.1", encrypted-dns-server="off"
198.18.0.2 (IPv4) / fd00:6152::2 (IPv6)IP-CIDR,<PS5-IP>/32,REJECT-DROP,pre-matching,no-resolve[Ponte]
server-proxy-name = ProxyForNAT # or omit for direct NAT traversal
[Ponte]
server-proxy-name = "🏡 Home" # As Ponte server
# OR
client-proxy-name = Home # As Ponte client only
ponte-name.sgponte (e.g., mymacmini.sgponte:8080)DEVICE:PONTE-NAME as proxy to use that device as gatewayIP-CIDR,192.168.30.0/24,DEVICE:MyMacMini| Policy | Behavior |
|---|---|
REJECT | Return error page (HTTP) or close connection |
REJECT-TINYGIF | Return 1px GIF (for web ad blocking) |
REJECT-DROP | Silent drop (prevents retry storms) |
REJECT-NO-DROP | Same as REJECT but never auto-upgrades to DROP |
Auto-upgrade: 10+ REJECTs in 30s → automatically becomes REJECT-DROP.
[MITM]
skip-server-cert-verify = true
tcp-connection = true
h2 = true # Enable HTTP/2 for MITM
hostname = *.example.com # Domains to decrypt
hostname-disabled = ... # Temporarily disabled domains
[Proxy] + [Proxy Group] from managed, edit rest locallyProvider = select, policy-path=https://airport.com/surge.conf, hidden=true
US-Nodes = smart, include-other-group=Provider, policy-regex-filter=US|美国
Awesome = select, policy-path=https://a.com/surge.conf, hidden=true, external-policy-name-prefix=A-
Fantastic = select, policy-path=https://b.com/surge.conf, hidden=true, external-policy-name-prefix=B-
All-US = smart, include-other-group="Awesome,Fantastic", policy-regex-filter=US|美国
Provider = select, policy-path=https://provider.com/surge.conf, external-policy-modifier="underlying-proxy=JumpProxy"
Proxy = snell, server.com, 8443, psk=xxx, version=5, reuse=true, tfo=true, shadow-tls-password=xxx, shadow-tls-sni=www.microsoft.com, shadow-tls-version=3
| Symptom | Check |
|---|---|
| Request not in Dashboard | Takeover issue: check system proxy (scutil --proxy) or enhanced mode (ping apple.com → 198.18.x.x) |
| Request appears but fails | Forwarding issue: check Notes tab for error (Connection refused/timeout/No DNS) |
| Only IPs, no domains | DNS not pointing to 198.18.0.2; or encrypted DNS bypassing Fake IP |
| High battery on iOS | Normal: all network traffic counted under Surge; actual extra <2%/24h |
| QUIC blocked | Expected: TCP proxy + QUIC = double retransmission; use Snell v5 QUIC mode if needed |
| NAT type degraded | Configure always-real-ip for STUN domains |
| "Network quality poor" | Check DNS servers (avoid 8.8.8.8 in mainland China) |
编写前:
完成后:
[Rule] 顺序满足“先域名、后 IP、最后 FINAL”no-resolve#!include 时未与普通内容混写| 错误做法 | 正确做法 |
|---|---|
把 #!include 和普通配置写在同一个 section | 将普通内容移动到被引用的 .dconf 文件中 |
| 先写 IP / GEOIP 规则再写域名规则 | 让非 DNS 规则优先,减少无意义解析 |
| 盲目使用 8.8.8.8 等公共 DNS | 根据网络环境选择可达且稳定的 DNS |
| 不确认接管状态就开始改规则 | 先确认请求是否进入 Surge,再排查命中链路 |
https://manual.nssurge.com/llms.txthttps://kb.nssurge.com/llms.txthttps://nssurge.com/mac/latest/appcast-signed-beta.xml