ssh-net 26.10.61 → 26.10.63
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.md +16 -0
- package/libexec/lib/jobctl.mjs +5 -5
- package/libexec/lib/render.mjs +9 -14
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,22 @@
|
|
|
4
4
|
跨月从 1 开始;历史跳号不补、不另维护累计发包数。发布 = 改版本号 +
|
|
5
5
|
CHANGELOG + 发 GitHub Release,Actions 跑测试后 npm publish。
|
|
6
6
|
|
|
7
|
+
## [26.10.63] - 2026-10-29
|
|
8
|
+
|
|
9
|
+
### 修复
|
|
10
|
+
|
|
11
|
+
- edge 的 link 任务已注册但进程已退出时,stop 不再误发 launchctl kill;查询后
|
|
12
|
+
进程自然退出导致的 No process to signal 也按已停止处理,重复 stop 与
|
|
13
|
+
at byted 可正常收尾
|
|
14
|
+
|
|
15
|
+
## [26.10.62] - 2026-10-25
|
|
16
|
+
|
|
17
|
+
### 修复
|
|
18
|
+
|
|
19
|
+
- Match exec 不再内嵌 OpenSSH 9.x 无法解析的转义双引号:路径改用 `~` 展开,
|
|
20
|
+
VS Code 判空改用 shell `case`,修复 26.10.61 在 node 安装后导致 ssh 报
|
|
21
|
+
Bad Match condition;HOME 含空白的行为保留,routes 语义测试覆盖 Darwin/Linux
|
|
22
|
+
|
|
7
23
|
## [26.10.61] - 2026-10-25
|
|
8
24
|
|
|
9
25
|
### 修复
|
package/libexec/lib/jobctl.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
// edge link job
|
|
1
|
+
// edge link job 的进程收束:在册且有进程才 launchctl kill TERM,轮询确认纯 ssh job
|
|
2
2
|
// 真退出(link-core 是 exec ssh,信号直达,正常亚秒级)。不碰开关——删哪些
|
|
3
|
-
// 开关是 stop 的命令语义。未装 link
|
|
3
|
+
// 开关是 stop 的命令语义。未装 link 或进程已退出直接 gone。超时报错给手工
|
|
4
4
|
// 排障命令,绝不自动 KILL。同步 CLI 用 Atomics.wait 节流。
|
|
5
5
|
import * as launchd from './launchd.mjs';
|
|
6
6
|
|
|
@@ -24,12 +24,12 @@ function isGone(ctx, label) {
|
|
|
24
24
|
* @returns {{gone:boolean, label:string}}
|
|
25
25
|
*/
|
|
26
26
|
export function reapEdgeLink(ctx, label) {
|
|
27
|
-
if (
|
|
28
|
-
return { gone: true, label };
|
|
27
|
+
if (isGone(ctx, label)) return { gone: true, label };
|
|
29
28
|
|
|
30
29
|
const killed = launchd.killJob(ctx.runner, ctx.uid, label, 'TERM');
|
|
30
|
+
// 查询后进程可能自然退出:服务消失或没有进程都已是目标态,其他错误仍抛出
|
|
31
31
|
if (killed.code !== 0 && killed.code !== 113
|
|
32
|
-
&& !/Could not find service/.test(killed.stderr ?? ''))
|
|
32
|
+
&& !/Could not find service|No process to signal/.test(killed.stderr ?? ''))
|
|
33
33
|
throw new Error(`launchctl kill 失败(${label}):${killed.stderr.trim() || `exit ${killed.code}`}`);
|
|
34
34
|
const end = Date.now() + WAIT_MS;
|
|
35
35
|
while (Date.now() < end) {
|
package/libexec/lib/render.mjs
CHANGED
|
@@ -91,14 +91,9 @@ const ROUTES_HEADER = `# 本文件由 \`ssh-net install\` 从 ~/.ssh/ssh-net/top
|
|
|
91
91
|
# 入站,只有 relay 兜底。User 不写——由主 config 的 Host 块补。
|
|
92
92
|
`;
|
|
93
93
|
|
|
94
|
-
// Match exec
|
|
95
|
-
//
|
|
96
|
-
//
|
|
97
|
-
/** @param {string|number} value */
|
|
98
|
-
function shellWord(value) {
|
|
99
|
-
return `"${String(value).replaceAll('\\', '\\\\').replaceAll('"', '\\"')}"`;
|
|
100
|
-
}
|
|
101
|
-
|
|
94
|
+
// Match exec 只保留 ssh_config 的外层双引号:OpenSSH 9.x 不能解析内嵌
|
|
95
|
+
// 转义双引号。路径用 ~ 让 shell 展开(结果不受 HOME 空白分词影响),topology
|
|
96
|
+
// 已拒绝 argv 的空白与 shell 元字符;VS Code 判空用 case,不在此层做 shell 引号
|
|
102
97
|
/** @param {string} pattern @param {string} command */
|
|
103
98
|
function matchExec(pattern, command) {
|
|
104
99
|
const escaped = command.replaceAll('\\', '\\\\').replaceAll('"', '\\"');
|
|
@@ -128,16 +123,16 @@ export function snRouteArgv(topo, selfAlias) {
|
|
|
128
123
|
* @returns {string}
|
|
129
124
|
*/
|
|
130
125
|
export function renderRoutes(topo, selfAlias) {
|
|
131
|
-
const state =
|
|
132
|
-
const snRoute =
|
|
126
|
+
const state = `~/${SSH_NET_DIR_REL}/state`;
|
|
127
|
+
const snRoute = `~/${SSH_NET_DIR_REL}/bin/sn-route`;
|
|
133
128
|
/** @type {string[]} */
|
|
134
129
|
const blocks = [];
|
|
135
130
|
|
|
136
131
|
// sn-route argv 直接渲染进 Match(无配置文件中转)。进度只进 stderr 且
|
|
137
132
|
// 仅终端显示(VS Code/Remote-SSH、scp、脚本下自动静默)
|
|
138
|
-
const routeCommand = [snRoute, ...snRouteArgv(topo, selfAlias)].
|
|
133
|
+
const routeCommand = [snRoute, ...snRouteArgv(topo, selfAlias)].join(' ');
|
|
139
134
|
const match = (alias, cond = '') =>
|
|
140
|
-
matchExec(alias, `test -e ${
|
|
135
|
+
matchExec(alias, `test -e ${state}/RELAY_ON${cond}`);
|
|
141
136
|
// core 判决块与兜底块共用一个发射器:first-wins 逐 keyword 取首值,
|
|
142
137
|
// 「块命中」不是整体替换——判决块必须占住兜底块设的每一个 keyword
|
|
143
138
|
// (ProxyJump none 不是装饰,漏了后块的 ProxyJump 就漏进直连路径,
|
|
@@ -187,7 +182,7 @@ export function renderRoutes(topo, selfAlias) {
|
|
|
187
182
|
const peers = peerList.join(',');
|
|
188
183
|
const nonPeers = `*,${peerList.map((a) => `!${a}`).join(',')}`;
|
|
189
184
|
const vscode = (pattern) =>
|
|
190
|
-
matchExec(pattern,
|
|
185
|
+
matchExec(pattern, 'case ${VSCODE_IPC_HOOK:-} in ?*) true;; *) false;; esac');
|
|
191
186
|
blocks.push([
|
|
192
187
|
'# 连接打标:对端 ~/.ssh/rc 读 LC_VSCODE_SSH 维护 dot.via、把本机别名交给 sn-register-lan 登记内网地址',
|
|
193
188
|
vscode(peers),
|
|
@@ -221,7 +216,7 @@ export function renderEdgeHost({ alias, aliases, user }) {
|
|
|
221
216
|
const addr = edgeAddrFileRel(alias);
|
|
222
217
|
const freshnessGate = matchExec(
|
|
223
218
|
aliases.join(','),
|
|
224
|
-
`find
|
|
219
|
+
`find ~/${addr} -mmin -${EDGE_ADDR_TTL_MIN} 2>/dev/null | read -r _`,
|
|
225
220
|
);
|
|
226
221
|
// 门控管道用内建 read 收尾而不是 grep -q:Match exec 每条连接都跑,少 fork
|
|
227
222
|
// 一个外部进程(find 有输出 read 退出 0、EOF 退出 1,三态与 grep -q 等价)
|