From 9935c5e000d8f7711a2b04d1ec62681e9170fc2a Mon Sep 17 00:00:00 2001 From: salem <77879189@qq.com> Date: Sun, 30 Aug 2026 18:04:49 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20config/stash/stash-config-?= =?UTF-8?q?wiki.MD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/stash/stash-config-wiki.MD | 87 +++++++++++++++++++++++++++---- 1 file changed, 78 insertions(+), 9 deletions(-) diff --git a/config/stash/stash-config-wiki.MD b/config/stash/stash-config-wiki.MD index 9b17f8d..e6edbc7 100644 --- a/config/stash/stash-config-wiki.MD +++ b/config/stash/stash-config-wiki.MD @@ -17,15 +17,24 @@ # ✅nameserver-policy: ``` - '+.ssr.ee': ['system', '223.5.5.5'] - '+.sswiwi.com': ['system', '223.5.5.5'] - '+.oracle.com': ['system', '223.5.5.5'] - 'geosite:apple@cn': ['system', '223.5.5.5'] - 'geosite:cn': ['system', '223.5.5.5'] - 'geosite:apple': ['1.1.1.1', '8.8.8.8'] - 'geosite:geolocation-!cn': ['1.1.1.1', '8.8.8.8'] - 优先级上至下,geosite单独一行,dns不能加#节点,不支持rule-set - Stash 会**并发请求 policy 里全部 DNS 上游**,1.1.1.1 和 8.8.8.8 同时走代理并发查询,取最快返回结果 +'+.ssr.ee': ['system', '223.5.5.5'] +'+.sswiwi.com': ['system', '223.5.5.5'] +'+.oracle.com': ['system', '223.5.5.5'] +'geosite:apple@cn': ['system', '223.5.5.5'] +'geosite:cn': ['system', '223.5.5.5'] +'geosite:apple': ['1.1.1.1', '8.8.8.8'] +'geosite:geolocation-!cn': ['1.1.1.1', '8.8.8.8'] +优先级上至下,geosite单独一行,dns不能加#节点,不支持rule-set +Stash 会**并发请求 policy 里全部 DNS 上游**,1.1.1.1 和 8.8.8.8 同时走代理并发查询,取最快返回结果 + +字典的 key 没有从上到下的匹配优先级,**不是写在前面就优先**。 +内核内部匹配优先级固定: +`精确域名` > `通配符 +.shturl.` > **geosite 集合(所有 geosite 之间不分先后)** + +### 总结关键点 +1. `nameserver‑policy` 是字典,**geosite 之间调换书写顺序不能控制优先级**。 +2. 想要强制某一类域名优先,用**通配符 `+.shturl.`**,它优先级高于全部 geosite 集合。 +3. `geosite:apple`集合里很多域名同时属于`geolocation‑!cn`,只写 geosite 会出现解析策略不确定。 ``` # ✅nameserver语法写法 @@ -40,3 +49,63 @@ nameserver: ['system','223.5.5.5'] dns模块都支持写system ``` + + +# proxies:语法有效性 + +``` +proxies: + - {name: "🟢 直连", type: direct, udp: true, ip-version: ipv4} +``` + +✅ **YAML 行内对象语法合法,Stash 可以识别加载** + +## 关键点说明 + +1. `type: direct`:Direct 直连节点,流量直接本地出站,不经过任何代理服务器。 +2. `udp: true`:开启 UDP 支持,DNS、QUIC 流量允许走这个直连节点。 +3. `ip‑version: ipv4`:强制只用 IPv4 出站,不使用 IPv6。 + +## 小坑 + +- direct 节点**没有 server、port 字段**,本身就不需要填写,direct 类型特殊。 +- 图标 emoji `🟢` Stash 完全支持显示。 +- 你定义完之后,就可以在 proxy‑groups 里面引用 `🟢 直连` 这个名字。 + +### proxy‑groups 使用示例 + +``` +proxy-groups: + - name: "节点选择" + type: select + proxies: + - "🟢 直连" + - 你的其他节点 +``` + +## 等价展开写法(方便阅读,效果完全一样) + +``` +proxies: + - name: "🟢 直连" + type: direct + udp: true + ip-version: ipv4 +``` + +## ⚠️重要提醒 + +这个自定义`🟢 直连`和内核内置 DIRECT 不是同一个东西: + +- 内置常量 `DIRECT`:rules 里写`- GEOSITE,cn,DIRECT`,调用内核内置直连。 +- 你手动新增的`🟢 直连`是一个**自定义代理项**,只能在 proxy‑groups 里面选择使用;**不能直接写在 rules 里面**,rules 不识别这个自定义名字。 + +> +> rules 分流只能用系统保留字 `DIRECT`,不要写`🟢 直连`,会匹配失败。 +> 如果想让分流使用你这个自定义直连节点,就把它放进 proxy‑groups,rules 指向组名。 + +小结: + +- 在`proxies:`块里定义:✅有效 +- 在 proxy‑groups 选择使用:✅有效 +- 在 rules 直接写`🟢 直连`:❌无效,必须用保留字`DIRECT`。 \ No newline at end of file