fix(network): wired ping probe, AP/WS and systemd notify hardening

- Add hasWiredInternetProbe and export; AP mode uses it with hasInternet
- systemd-env: strip NOTIFY_SOCKET from env early; client uses unix_dgram
- Strip NOTIFY_SOCKET from frpc/ttyd spawn env in watchdog and frpc
- WS: pong miss debounce; AP net monitor consecutive-fail debounce

Made-with: Cursor
This commit is contained in:
stswangzhiping
2026-03-28 14:37:56 +08:00
parent 402440aadc
commit 04dd1017bb
6 changed files with 116 additions and 24 deletions

17
lib/systemd-env.js Normal file
View File

@@ -0,0 +1,17 @@
'use strict';
/**
* 在任意子进程nmcli、pkill、frpc、依赖库启动前从 process.env 摘掉 NOTIFY_SOCKET。
* 否则子进程继承后可能向 systemd 发 sd_notify触发「仅主 PID 可收」的 journal 刷屏。
* 主进程通过 getNotifySocket() 取回路径,自行 unix_dgram 发送。
*/
const _notifySocket = process.env.NOTIFY_SOCKET;
if (_notifySocket) {
delete process.env.NOTIFY_SOCKET;
}
function getNotifySocket() {
return _notifySocket;
}
module.exports = { getNotifySocket };