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

View File

@@ -79,6 +79,20 @@ function _tryPingInternet() {
return false;
}
/**
* 仅经有线口 ping 公网(不依赖默认路由)。
* AP 开启时 hasInternet() 易误判;维持 WS / 网络监视时用此兜底。
*/
function hasWiredInternetProbe() {
const wired = getWiredIfaceWithCarrier();
if (!wired) return false;
try {
run(`ping -c 1 -W 3 -I ${wired} 8.8.8.8`);
return true;
} catch (_) {}
return false;
}
/**
* 检测是否有互联网连接nmcli 连通性 + ping 兜底)
*/
@@ -298,6 +312,7 @@ function getLocalIps() {
module.exports = {
hasInternet,
hasWiredCarrier,
hasWiredInternetProbe,
getWiredIfaceWithCarrier,
hasSavedWifiConnection,
isWifiStaConnected,