ssh-net 26.10.30 → 26.10.31
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 +58 -0
- package/README.md +11 -6
- package/libexec/cli.mjs +2 -3
- package/libexec/commands/install.mjs +10 -31
- package/libexec/commands/{checkin.mjs → register.mjs} +47 -78
- package/libexec/commands/start.mjs +2 -2
- package/libexec/commands/status.mjs +19 -34
- package/libexec/commands/upgrade.mjs +1 -1
- package/libexec/lib/conf.mjs +1 -1
- package/libexec/lib/config.mjs +34 -46
- package/libexec/lib/exec.mjs +2 -8
- package/libexec/lib/identity.mjs +1 -1
- package/libexec/lib/ipv6.mjs +6 -5
- package/libexec/lib/jobctl.mjs +1 -1
- package/libexec/lib/manage.mjs +1 -1
- package/libexec/lib/paths.mjs +2 -2
- package/libexec/lib/probe.mjs +0 -17
- package/libexec/lib/render.mjs +6 -7
- package/libexec/lib/runtime.mjs +19 -3
- package/libexec/lib/state.mjs +7 -8
- package/libexec/sn-ipv6 +6 -6
- package/libexec/sn-route +49 -7
- package/libexec/ssh-net-link-core +2 -2
- package/libexec/ssh-net-uplink-edge +8 -14
- package/package.json +1 -1
- package/libexec/sn-notify +0 -45
- package/libexec/sn-signal +0 -64
package/libexec/sn-signal
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
# sn-signal:core 回拨认证成功后的「通知 + link 重拉」(2026-10-02 改,取代
|
|
3
|
-
# 旧版 USR1/pkill 秒切)。argv 子命令区分这条协议的两个端:
|
|
4
|
-
# send <edge 别名> <edge 用户> <core 别名>:core 侧发送端,被 uplink-edge
|
|
5
|
-
# 回拨 ssh 的 LocalCommand 调起。读 state/edges/<edge 别名> 的 v6,经一条
|
|
6
|
-
# 独立 ssh 调对端的 recv,core 别名透传给通知文案与 link label。信令与隧道
|
|
7
|
-
# 完全解耦:失败静默、退出码恒 0,绝不拖垮回拨连接
|
|
8
|
-
# recv [core 别名]:edge 侧接收端。先发系统通知「与 <core> 的直连已就绪」,
|
|
9
|
-
# 再 launchctl kickstart -k 重拉 link job(装了 link 才成功;未装报错静默)
|
|
10
|
-
# ——显式 kickstart 立即重拉、不受 ThrottleInterval 限制,新 ssh 经
|
|
11
|
-
# sn-route 重新选路 = 秒切。无 core 别名(手工调用)时两件事都不做
|
|
12
|
-
set -u
|
|
13
|
-
LC_ALL=C
|
|
14
|
-
export LC_ALL
|
|
15
|
-
SSH=${SSH:-/usr/bin/ssh}
|
|
16
|
-
LAUNCHCTL=${LAUNCHCTL:-/bin/launchctl}
|
|
17
|
-
ID=${ID:-/usr/bin/id}
|
|
18
|
-
STATE_DIR=${SSH_NET_STATE_DIR:-$HOME/.ssh/ssh-net/state}
|
|
19
|
-
BIN_DIR=${SSH_NET_BIN_DIR:-$HOME/.ssh/ssh-net/bin}
|
|
20
|
-
|
|
21
|
-
case "${1:-}" in
|
|
22
|
-
send)
|
|
23
|
-
[ $# -ge 3 ] || exit 0
|
|
24
|
-
alias_name=$2
|
|
25
|
-
user=$3
|
|
26
|
-
core_alias=${4:-}
|
|
27
|
-
|
|
28
|
-
v6=
|
|
29
|
-
if [ -r "$STATE_DIR/edges/$alias_name" ]; then
|
|
30
|
-
# 纯 bash 内建消空白(launchd 最小环境,不依赖 PATH 里 tr)
|
|
31
|
-
v6=$(<"$STATE_DIR/edges/$alias_name")
|
|
32
|
-
v6=${v6//[[:space:]]/}
|
|
33
|
-
fi
|
|
34
|
-
[ -n "$v6" ] || exit 0
|
|
35
|
-
|
|
36
|
-
# 远程命令:recv + 单引号包裹的 core 别名。别名 charset 由 topology
|
|
37
|
-
# 解析保证(^[A-Za-z0-9][A-Za-z0-9._-]*$),含单引号直接放弃——防御
|
|
38
|
-
# 注入拼进远端 shell
|
|
39
|
-
remote='~/.ssh/ssh-net/bin/sn-signal recv'
|
|
40
|
-
if [ -n "$core_alias" ]; then
|
|
41
|
-
case "$core_alias" in *\'*) exit 0 ;; esac
|
|
42
|
-
remote="$remote '$core_alias'"
|
|
43
|
-
fi
|
|
44
|
-
|
|
45
|
-
# 注意注释只能在整条命令上方,续行中间插注释会拆断命令(实测)
|
|
46
|
-
# shellcheck disable=SC2088 # ~ 由对端 shell 展开,本机展开反而错
|
|
47
|
-
"$SSH" -o BatchMode=yes -o ConnectTimeout=5 -o IdentitiesOnly=yes \
|
|
48
|
-
-o ControlMaster=no -o ControlPath=none \
|
|
49
|
-
-o StrictHostKeyChecking=accept-new \
|
|
50
|
-
-i "$HOME/.ssh/id_ed25519" \
|
|
51
|
-
"$user@$v6" "$remote" >/dev/null 2>&1 || true
|
|
52
|
-
;;
|
|
53
|
-
recv)
|
|
54
|
-
peer=${2:-}
|
|
55
|
-
[ -n "$peer" ] || exit 0
|
|
56
|
-
# 回拨一次通知一次,不去重不节流。恒 0,不拖信令
|
|
57
|
-
"$BIN_DIR/sn-notify" "与 $peer 的直连已就绪"
|
|
58
|
-
# kickstart 未装 link 的 label 会报错,静默无害;非交互 ssh 下 gui 域
|
|
59
|
-
# 操作可用(design §6.6)
|
|
60
|
-
"$LAUNCHCTL" kickstart -k \
|
|
61
|
-
"gui/$("$ID" -u)/local.ssh-net-link-core-$peer" 2>/dev/null || true
|
|
62
|
-
;;
|
|
63
|
-
esac
|
|
64
|
-
exit 0
|