dsh-clash-subscription 0.7.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG-0.9.0.md +122 -0
- package/client.js +22 -9
- package/index.js +493 -198
- package/lib/core.js +39 -0
- package/lib/routes.js +3 -1
- package/lib/skill.js +160 -0
- package/package.json +4 -4
- package/CHANGELOG-0.7.0.md +0 -129
package/lib/core.js
CHANGED
|
@@ -691,6 +691,45 @@ export class Core {
|
|
|
691
691
|
return results
|
|
692
692
|
}
|
|
693
693
|
|
|
694
|
+
/**
|
|
695
|
+
* Measure one probe again through the current probe-group selection, without moving it.
|
|
696
|
+
*
|
|
697
|
+
* Used for latency, which must not be judged on a cold request. Every probe opens its own
|
|
698
|
+
* connection (`Connection: close`), so a core that has just started pays DNS resolution plus
|
|
699
|
+
* TCP and TLS setup on the first request for a host: measured on this machine, the same node
|
|
700
|
+
* answered `gstatic` in **513 ms** on the first request after a fresh core start and in
|
|
701
|
+
* **82 ms** on every request after, because only the first one had to resolve the name. Real
|
|
702
|
+
* traffic reuses both the resolver cache and its connections, so the cold number is not the
|
|
703
|
+
* node's latency — and judging a node on it marked every healthy node too slow.
|
|
704
|
+
*
|
|
705
|
+
* @param spec - the probe to repeat.
|
|
706
|
+
* @param options - `timeoutMs`, `attempts`.
|
|
707
|
+
* @returns the probe result, or undefined when the listener is not up.
|
|
708
|
+
*/
|
|
709
|
+
async remeasure(spec, options = {}) {
|
|
710
|
+
if (this.probePort === undefined || spec === undefined) return undefined
|
|
711
|
+
// The PROBE group must already point at the node under test, and the only caller of
|
|
712
|
+
// `remeasure` is the latency measurement right after `probeNodeReal`. Switching again here
|
|
713
|
+
// would be harmless but would also hide the dependency, so it is asserted instead: a caller
|
|
714
|
+
// that measures latency without first probing that node gets a warning, not a number that
|
|
715
|
+
// silently belongs to a different node.
|
|
716
|
+
if (options.expectNode !== undefined && options.expectNode !== null) {
|
|
717
|
+
try {
|
|
718
|
+
const group = await this.probeGroup()
|
|
719
|
+
if (group.now !== options.expectNode) {
|
|
720
|
+
this.log(
|
|
721
|
+
`remeasure: PROBE group is on ${group.now ?? '(none)'} but the caller expects ${options.expectNode}; re-pointing it`,
|
|
722
|
+
)
|
|
723
|
+
await this.selectProbe(options.expectNode)
|
|
724
|
+
}
|
|
725
|
+
} catch (error) {
|
|
726
|
+
this.log(`remeasure: could not confirm the probe group: ${error?.message ?? error}`)
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
const results = await runProbes(this.probePort, [spec], options)
|
|
730
|
+
return results[spec.id]
|
|
731
|
+
}
|
|
732
|
+
|
|
694
733
|
/**
|
|
695
734
|
* Ask one node the real question, through the dedicated probe listener.
|
|
696
735
|
*
|
package/lib/routes.js
CHANGED
|
@@ -43,9 +43,11 @@ export const EDITABLE_FIELDS = [
|
|
|
43
43
|
'autoReselect',
|
|
44
44
|
'reselectMinutes',
|
|
45
45
|
'autoSwitch',
|
|
46
|
-
'
|
|
46
|
+
'healthRoundSeconds',
|
|
47
47
|
'healthStrikeLimit',
|
|
48
|
+
'healthMaxDelayMs',
|
|
48
49
|
'healthSwitchCandidates',
|
|
50
|
+
'healthSurveyEvery',
|
|
49
51
|
'switchWhileBusy',
|
|
50
52
|
]
|
|
51
53
|
|
package/lib/skill.js
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The skill this plugin ships with itself.
|
|
3
|
+
*
|
|
4
|
+
* A plugin that owns the process-wide outbound policy cannot be usefully documented in a README
|
|
5
|
+
* nobody opens at the moment it matters. The failure this skill prevents is specific: a command
|
|
6
|
+
* fails, the assistant concludes "the network is down", and starts opening a desktop proxy that
|
|
7
|
+
* fights the plugin for the same dispatcher. Neither condition is usually true — the plugin is
|
|
8
|
+
* routing, and the fix is a different exit node.
|
|
9
|
+
*
|
|
10
|
+
* Registered through `ctx.skills.register()` in `apply()`, so it travels with the package and
|
|
11
|
+
* disappears when the plugin is unloaded; no file in a user directory, nothing to keep in sync.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/** Kebab-case name the model and the user both address it by. */
|
|
15
|
+
export const SKILL_NAME = 'clash-proxy-egress'
|
|
16
|
+
|
|
17
|
+
/** One-line routing description shown in the skill catalog. */
|
|
18
|
+
export const SKILL_DESCRIPTION =
|
|
19
|
+
'Route DeepSeek Harness outbound traffic through this plugin\'s private mihomo core: check whether egress is actually healthy, repair it in order (status -> start -> restart -> switch node), and never open a second proxy that fights it.'
|
|
20
|
+
|
|
21
|
+
/** When the catalog should surface this skill. */
|
|
22
|
+
export const SKILL_WHEN_TO_USE =
|
|
23
|
+
'A foreign request fails (git clone/pull, curl, npm/pnpm/pip, web_fetch, a foreign API), or the user asks whether the proxy is up, why a node is slow, which node is selected, or how to get out through a specific region. Not for domestic-only failures and not for DNS problems on a LAN host.'
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* The instruction body.
|
|
27
|
+
*
|
|
28
|
+
* Written as a decision procedure, not a catalogue: every step names the command that answers it
|
|
29
|
+
* and the observation that makes the next step correct. The repair ladder is ordered by blast
|
|
30
|
+
* radius, because each rung costs every in-flight connection something — and the last rung costs
|
|
31
|
+
* the whole process every socket it holds.
|
|
32
|
+
*/
|
|
33
|
+
export const SKILL_CONTENT = `# 走插件出网:判断、修复、换节点
|
|
34
|
+
|
|
35
|
+
Harness 的外网由 \`dsh-clash-subscription\` 插件统一代理。插件起一个私有 mihomo 内核,
|
|
36
|
+
把**本进程和它派生的子进程**的出网指向那个内核:境外走订阅节点,国内直连,loopback 与局域网不走代理。
|
|
37
|
+
|
|
38
|
+
所以第一件事永远是:**先判断现在到底通不通,再决定要不要动它**。
|
|
39
|
+
「命令失败了」既不等于「外网不通」,也不等于「插件挂了」。
|
|
40
|
+
|
|
41
|
+
## 一、先取证,三条命令
|
|
42
|
+
|
|
43
|
+
### 1. 插件状态(唯一权威)
|
|
44
|
+
|
|
45
|
+
\`\`\`bash
|
|
46
|
+
curl -sS -m 8 http://127.0.0.1:<宿主端口>/clash-proxy/status
|
|
47
|
+
\`\`\`
|
|
48
|
+
|
|
49
|
+
宿主端口取当前会话 GUI 的端口(DSH 每次启动可能不同)。返回里只看这几个字段:
|
|
50
|
+
|
|
51
|
+
| 字段 | 含义 | 正常值 |
|
|
52
|
+
|---|---|---|
|
|
53
|
+
| \`running\` | 内核进程在不在 | \`true\` |
|
|
54
|
+
| \`routingVerified\` | 进程出网策略是不是本插件装的 | \`"active"\` |
|
|
55
|
+
| \`routingHealthy\` | 策略 + 内核同时成立 | \`true\` |
|
|
56
|
+
| \`node\` | 当前出口 | 具体节点名,不是 \`DIRECT\` |
|
|
57
|
+
| \`health.lastRound.state\` | 最近一轮真实探测结论 | \`ok\` / \`degraded\` |
|
|
58
|
+
| \`health.lastRound.attempt\` | 本轮第几次尝试通过的 | 1 或 2;3 表示三次都不合格 |
|
|
59
|
+
| \`health.lastRound.attemptLimit\` | 一轮内最多试几次 | 3 |
|
|
60
|
+
|
|
61
|
+
\`routingHealthy: true\` 就**什么都不要做**,直接跑原命令。
|
|
62
|
+
|
|
63
|
+
### 2. 真实出网(区分「插件通」和「节点能出」)
|
|
64
|
+
|
|
65
|
+
\`\`\`bash
|
|
66
|
+
curl -sS -o /dev/null -w '%{http_code}\\n' -m 12 https://api.github.com/rate_limit
|
|
67
|
+
\`\`\`
|
|
68
|
+
|
|
69
|
+
- \`200\` → 通。
|
|
70
|
+
- \`403\` 且响应体含 \`API rate limit exceeded\` → **通了但配额耗尽**,不是墙,也不是插件问题。
|
|
71
|
+
- \`000\` / 超时 → 插件可能在跑但节点出不去,进第二节。
|
|
72
|
+
|
|
73
|
+
### 3. 子进程继承(命令行的常见误判)
|
|
74
|
+
|
|
75
|
+
\`\`\`bash
|
|
76
|
+
env | grep -i proxy
|
|
77
|
+
\`\`\`
|
|
78
|
+
|
|
79
|
+
应当看到 \`HTTP_PROXY\` / \`HTTPS_PROXY\` 指向 \`http://127.0.0.1:<内核端口>\`。
|
|
80
|
+
**没有**就是子进程没拿到策略,这时 \`git\`/\`npm\` 会当作直连失败,而不是代理失败。
|
|
81
|
+
|
|
82
|
+
## 二、修复阶梯(按代价从小到大,不要跳级)
|
|
83
|
+
|
|
84
|
+
| 级别 | 动作 | 代价 | 什么时候用 |
|
|
85
|
+
|---|---|---|---|
|
|
86
|
+
| 0 | 什么都不做 | 0 | \`routingHealthy: true\` |
|
|
87
|
+
| 1 | \`action=start\` | 重装策略,不换节点 | \`running: false\`,或策略丢了(\`routingVerified != active\`) |
|
|
88
|
+
| 2 | \`action=select node=<名>\` | 只换出口,**断掉该节点上的在飞连接** | 策略正常、节点出不去(第 2 条命令 \`000\`) |
|
|
89
|
+
| 3 | \`action=restart\` / 先 \`stop\` 再 \`start\` | 重建内核,全部连接重来 | 内核进程在但控制 API 不应答 |
|
|
90
|
+
| 4 | \`action=refresh\` | 重下订阅,可能换一批节点 | 节点表为空,或订阅过期 |
|
|
91
|
+
|
|
92
|
+
**不要做的事**:
|
|
93
|
+
|
|
94
|
+
- 不要开桌面 Clash Verge 或改系统代理。插件的内核与桌面端会抢同一个 dispatcher 和同一份
|
|
95
|
+
环境变量,表现是「时通时不通」「git 能拉但 npm 装不上」。
|
|
96
|
+
- 不要在没取证的情况下列「网络正常」或「插件坏了」。
|
|
97
|
+
- 不要改 mode / 端口 / 订阅列表来「试一试」。换节点就够了。
|
|
98
|
+
|
|
99
|
+
## 三、换节点:按真实探测结果挑,不要按延迟挑
|
|
100
|
+
|
|
101
|
+
节点列表不是等价的。一个延迟 200 ms 的节点可能:
|
|
102
|
+
|
|
103
|
+
- GitHub 配额已耗尽(\`200\` 但 \`x-ratelimit-remaining: 0\`);
|
|
104
|
+
- git 拉取的第一个请求超时;
|
|
105
|
+
- 只有基础连通能过。
|
|
106
|
+
|
|
107
|
+
\`status\` 里每个节点带 \`usable\` 三态,这就是判据:
|
|
108
|
+
|
|
109
|
+
| \`usable\` | 含义 | 用它吗 |
|
|
110
|
+
|---|---|---|
|
|
111
|
+
| \`ok\` | 所有门槛探针通过 | 优先 |
|
|
112
|
+
| \`limited\` | 线路正常,只是某个服务配额耗尽 | 可以,排在 \`ok\` 之后 |
|
|
113
|
+
| \`blocked\` | 有探针硬失败(超时 / 重置 / 状态码不对) | 不要 |
|
|
114
|
+
|
|
115
|
+
\`limited\` 是可用状态,不是故障。整个订阅的出口地址可能同时耗尽同一个配额,
|
|
116
|
+
这时坚持挑一个「配额干净」的节点只会把连接白断一次。
|
|
117
|
+
|
|
118
|
+
换法:
|
|
119
|
+
|
|
120
|
+
\`\`\`
|
|
121
|
+
clash_proxy action=select node=<精确节点名>
|
|
122
|
+
\`\`\`
|
|
123
|
+
|
|
124
|
+
节点名要逐字复制(含旗帜 emoji 与空格)。
|
|
125
|
+
|
|
126
|
+
## 四、自动切换已经在跑,不要抢它
|
|
127
|
+
|
|
128
|
+
插件自己每 30 秒做一轮。**一轮之内**会连续试当前节点最多 3 次:
|
|
129
|
+
|
|
130
|
+
1. 通过它发真请求(基础连通 204、GitHub API 连配额、git 拉取)+ 测 Google 延迟;
|
|
131
|
+
2. 不合格就**立刻**再试一次,不合格再试第三次——不等下一个 30 秒;
|
|
132
|
+
3. 只要任何一次合格就保持,剩下的次数不浪费;
|
|
133
|
+
4. 三次都不合格,就把**所有未被屏蔽的节点**各测一遍,切到「可用且真实延迟最低」的那个。
|
|
134
|
+
|
|
135
|
+
所以:
|
|
136
|
+
|
|
137
|
+
- 用户问「为什么还没换」,先看 \`health.lastRound.attempt\`:1 或 2 表示已经通过;3 表示三次全败、正在切换。
|
|
138
|
+
- 不合格 = **不可用**(某个门槛探针没通)**或真实延迟过高**(超过 \`health.maxDelayMs\`,默认 400 ms)。
|
|
139
|
+
- 三次重试是**同一轮内连续**的,所以坏节点几秒内就会被处理,不需要手动介入。
|
|
140
|
+
- 手动换节点会打断正在进行的切换搜索,没必要别动它。
|
|
141
|
+
- 要立刻验证,用 \`action=health\` 强制跑一轮并看明细。
|
|
142
|
+
|
|
143
|
+
## 五、按症状查
|
|
144
|
+
|
|
145
|
+
| 症状 | 先查 | 通常是 |
|
|
146
|
+
|---|---|---|
|
|
147
|
+
| \`git clone\` 卡住 / \`ECONNRESET\` | 第 2 条命令 | 节点出不去,或 git 协议被该节点掐断 |
|
|
148
|
+
| GitHub API \`403\` | 响应体有没有 \`rate limit exceeded\` | 配额耗尽,等重置或换地区节点 |
|
|
149
|
+
| \`npm\`/\`pnpm\` 装不上但 \`curl\` 能通 | \`env \\| grep -i proxy\` | 子进程环境缺失 |
|
|
150
|
+
| 国内站点 000 | —— | 国内站自身慢,与插件无关,重试即可 |
|
|
151
|
+
| \`web_fetch\` 全部失败 | \`routingHealthy\` | 内核死了,级别 1 |
|
|
152
|
+
| 只有某个 AI 服务连不上 | 该节点的 \`usable\` 与失败探针 | 该服务的地区/机房限制,换节点 |
|
|
153
|
+
| 面板显示节点「限流」但还能上网 | —— | 正常,配额是单服务限制 |
|
|
154
|
+
|
|
155
|
+
## 六、边界
|
|
156
|
+
|
|
157
|
+
- 只动插件自己的出口与生命周期;不改订阅、不改 mode、不改端口。
|
|
158
|
+
- 换节点会断开该节点上的在飞请求。有下载或流式响应在跑时,等它结束或明确告诉用户会被中断。
|
|
159
|
+
- 插件的内核与桌面 Clash 是两套栈。用户开着桌面端时,不要试图让两者共存。
|
|
160
|
+
`
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-clash-subscription",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Import one or more Clash/mihomo subscriptions and route the Harness outbound traffic through the private core bundled with this plugin
|
|
3
|
+
"version": "0.9.0",
|
|
4
|
+
"description": "Import one or more Clash/mihomo subscriptions and route the Harness outbound traffic through the private core bundled with this plugin. Every 30 seconds the live node gets up to three immediate real-request attempts (base connectivity, GitHub quota, git fetch, Google latency median under a 400 ms ceiling); after three failures every unblocked node is measured and the fastest usable one is selected.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"dsh",
|
|
7
7
|
"dsh-plugin",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"locale/*.json",
|
|
35
35
|
"icon.svg",
|
|
36
36
|
"README.md",
|
|
37
|
-
"CHANGELOG-0.
|
|
37
|
+
"CHANGELOG-0.9.0.md",
|
|
38
38
|
"LICENSE"
|
|
39
39
|
],
|
|
40
40
|
"engines": {
|
|
@@ -69,6 +69,6 @@
|
|
|
69
69
|
"scripts": {
|
|
70
70
|
"test": "node test/regression-070.mjs",
|
|
71
71
|
"test:legacy": "node test/regression-063.mjs",
|
|
72
|
-
"test:e2e": "node test/e2e-
|
|
72
|
+
"test:e2e": "node test/e2e-090.mjs"
|
|
73
73
|
}
|
|
74
74
|
}
|
package/CHANGELOG-0.7.0.md
DELETED
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
# 0.7.0 · 可用性判据换成真实请求,连续失败自动切换
|
|
2
|
-
|
|
3
|
-
> 上一版 `0.6.4` · 本版 `0.7.0`
|
|
4
|
-
|
|
5
|
-
## 0.6.4 漏掉了什么
|
|
6
|
-
|
|
7
|
-
面板把**限流节点显示成「可用」**。根因不在面板,在判据:
|
|
8
|
-
|
|
9
|
-
```js
|
|
10
|
-
// 0.6.4(lib/core.js):只要内核回了 delay 数字就算通过
|
|
11
|
-
const data = await this.api(`${path}?${query}`)
|
|
12
|
-
if (typeof data?.delay === 'number' && data.delay > 0) return data.delay
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
`/proxies/<name>/delay` 和 `/providers/.../healthcheck` 只回答「目标有没有回包」,**不解释回的是什么**:
|
|
16
|
-
|
|
17
|
-
| 实测(本机、真实订阅、2026-11-15) | 内核回报 | 真实情况 |
|
|
18
|
-
|---|---|---|
|
|
19
|
-
| `api.github.com/rate_limit` 返回 `403 rate limit exceeded` | `{"delay":179}` | 配额已耗尽,API 完全不可用 |
|
|
20
|
-
| 路径返回 `404` | `{"delay":301}` | 通,但不是要的结果 |
|
|
21
|
-
| `github.com` git 拉取 15 s 超时 | `{"delay":287}` | 根本拉不下来 |
|
|
22
|
-
| `expected=418` 参数(想让它校验状态码) | `{"delay":187}` | **内核直接忽略这个参数** |
|
|
23
|
-
|
|
24
|
-
`expected` 被忽略这件事决定了整条路走不通:拿它做能力判定从根上不成立。
|
|
25
|
-
|
|
26
|
-
而且默认探针集里**没有 GitHub、没有 git 协议**:
|
|
27
|
-
|
|
28
|
-
```js
|
|
29
|
-
// 0.6.4(lib/select.js)
|
|
30
|
-
export const DEFAULT_PROBES = [
|
|
31
|
-
{ id: 'gstatic', ... }, { id: 'google', ... }, { id: 'openai', ... }, { id: 'anthropic', ... },
|
|
32
|
-
]
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
于是 8 个节点全绿,其中 6 个实际不可用。
|
|
36
|
-
|
|
37
|
-
## 改法
|
|
38
|
-
|
|
39
|
-
### 1. 真实请求,读真状态码与配额(新增 `lib/realprobe.js`)
|
|
40
|
-
|
|
41
|
-
经一个**专用监听端口**发真实请求,判据是状态码 + 响应头 + 响应体前缀:
|
|
42
|
-
|
|
43
|
-
| 探针 | 通过条件 | 为什么 |
|
|
44
|
-
|---|---|---|
|
|
45
|
-
| `gstatic` | 恰好 `204` | 只认这个端点该给的东西 |
|
|
46
|
-
| `github` | `200` **且** `x-ratelimit-remaining ≥ 1` | 限流时状态码仍是 200,只有配额头能说明问题 |
|
|
47
|
-
| `git` | `200` **且**响应体含 `service=git-upload-pack` | 就是 `git clone` 的第一个请求;拦截门户的 200 不算 |
|
|
48
|
-
| `google` / `openai` / `anthropic` | 状态码在各自白名单内 | 参考项,默认不参与门槛 |
|
|
49
|
-
|
|
50
|
-
`github` 与 `git` 参与门槛,`openai` / `anthropic` 默认只作参考——一个不可达的额外服务不该清空候选列表。
|
|
51
|
-
|
|
52
|
-
### 2. 独立探测口,测节点不动机上流量(`lib/core.js`)
|
|
53
|
-
|
|
54
|
-
内核按**连接**选节点,所以「测哪个节点」与「线上走哪个」必须分开:
|
|
55
|
-
|
|
56
|
-
```json
|
|
57
|
-
"listeners": [{ "name": "probe-in", "type": "mixed", "listen": "127.0.0.1", "port": <probePort>, "proxy": "PROBE" }]
|
|
58
|
-
"proxy-groups": [{ "name": "PROXY", ... }, { "name": "PROBE", "type": "select", "use": [...], "proxies": ["DIRECT"] }]
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
实测:`PUT /proxies/PROBE` 之后经探测口发请求,`PROXY` 的选择始终不动。
|
|
62
|
-
|
|
63
|
-
### 3. 连续 3 轮失败才切换(新增 `lib/watch.js`)
|
|
64
|
-
|
|
65
|
-
- 每 `healthRoundMinutes`(默认 2 分钟)跑一轮,只测当前节点;
|
|
66
|
-
- 连续 `healthStrikeLimit`(默认 3)轮**硬失败**才切换,任何一轮通过就把计数清零;
|
|
67
|
-
- 切换时排除刚被放弃的节点,按「无硬失败 → 少失败 → 非降级 → 延迟低」选最优;
|
|
68
|
-
- 线路有在飞连接时推迟到下一轮(`switchWhileBusy` 可关掉这个保护)。
|
|
69
|
-
|
|
70
|
-
`status.health` 里带 streak、限值、上一轮明细与上次切换记录,所以「为什么还没切」是可查的。
|
|
71
|
-
|
|
72
|
-
### 4. 限流是「降级」,不是「不通」
|
|
73
|
-
|
|
74
|
-
这是本轮实测逼出来的修正:某一刻**全网配额同时为 0**,若把限流算失败,则每个节点都被判死、切换永远报 `no-alternative`,插件卡在一个它自己反复宣布坏掉的节点上。
|
|
75
|
-
|
|
76
|
-
现在的三态:
|
|
77
|
-
|
|
78
|
-
| 状态 | 含义 | 可选 |
|
|
79
|
-
|---|---|---|
|
|
80
|
-
| `ok` | 全部门槛探针通过 | ✅ |
|
|
81
|
-
| `limited` | 线路正常,只有配额耗尽 | ✅(排在 `ok` 之后) |
|
|
82
|
-
| `blocked` | 有探针硬失败(超时/重置/状态码不对) | ❌ |
|
|
83
|
-
|
|
84
|
-
限流轮**不计 strike**:切到另一个配额同样耗尽的节点只会丢掉连接。
|
|
85
|
-
|
|
86
|
-
## 顺带修掉的三个真问题
|
|
87
|
-
|
|
88
|
-
| 问题 | 症状 | 修法 |
|
|
89
|
-
|---|---|---|
|
|
90
|
-
| `http.request({method:'CONNECT'})` 的 socket 交给 `tls.connect` | 每个 HTTPS 探针都报 `Client network socket disconnected before secure TLS connection was established`,而同一端口 `curl` 是 200 | 改成裸 socket:自己读 `200 Connection established`,再把 socket 交给 TLS |
|
|
91
|
-
| 等响应体读完才判定 | `git/info/refs` 一次回 266–357 KB,耗时 6–18 s,把好节点判成 `timeout` | 收满响应头 + 1 KB 前缀就判定 |
|
|
92
|
-
| 探针并发跑 | 同一节点实测:串行 4 轮 0 失败,并发 2 有 1 次隧道被掐断 | 默认串行(`concurrency: 1`);传输层失败重试一次,HTTP 状态不重试 |
|
|
93
|
-
|
|
94
|
-
## 配置新增
|
|
95
|
-
|
|
96
|
-
| 字段 | 默认 | 说明 |
|
|
97
|
-
|---|---|---|
|
|
98
|
-
| `autoSwitch` | `true` | 用真实请求监视当前节点 |
|
|
99
|
-
| `healthRoundMinutes` | `2` | 轮询间隔;0 = 关闭 |
|
|
100
|
-
| `healthStrikeLimit` | `3` | 连续几轮失败才切换 |
|
|
101
|
-
| `healthSwitchCandidates` | `12` | 一次切换试几个候选(按延迟从低到高) |
|
|
102
|
-
| `switchWhileBusy` | `false` | 有连接在进行时也切换 |
|
|
103
|
-
|
|
104
|
-
`probes` 字段仍可自定义,且**不能靠重写配置绕过门槛**:写 `github=<url>` 会保留内置的配额判据,要改必须显式写 `;expect=` / `;gating=0`。
|
|
105
|
-
|
|
106
|
-
## 验收
|
|
107
|
-
|
|
108
|
-
```
|
|
109
|
-
node test/regression-070.mjs → 67 passed, 0 failed
|
|
110
|
-
node test/regression-063.mjs → 31 passed, 0 failed(旧版断言未回归)
|
|
111
|
-
node test/e2e-070.mjs → 14 passed, 0 failed(真内核 + 真订阅 + 真请求)
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
e2e 的真实输出(本机、2026-11-15):
|
|
115
|
-
|
|
116
|
-
```
|
|
117
|
-
节点 verdict 硬失败 硬失败探针 github(剩余) git
|
|
118
|
-
邮箱客服…@gmail.com blocked 3 3 blocked(-) blocked empty
|
|
119
|
-
最新官网 ok.riolu.work blocked 3 3 blocked(-) blocked empty
|
|
120
|
-
支持AI:新加坡/马来/美国/台湾 blocked 3 3 blocked(-) blocked empty
|
|
121
|
-
🇭🇰 香港01 limited 0 1 → 0 limited(0) ok
|
|
122
|
-
🇭🇰 香港02 / 🇯🇵 日本01-03 limited 0 0 limited(0) ok
|
|
123
|
-
|
|
124
|
-
把线上节点强制设成那个 blocked 的:
|
|
125
|
-
rounds: bad/1 → bad/2 → switched/3
|
|
126
|
-
lastSwitch: from 邮箱客服… → to 🇯🇵 日本01 (degraded=false)
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
旧判据下这 8 个节点全部显示「可用」,新版把 3 个判死、5 个判限流,并给出原因。
|