@decentnetwork/lan 0.1.187 → 0.1.189
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.
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/cli/commands.js
CHANGED
|
@@ -169,6 +169,8 @@ export async function cmdInit(args) {
|
|
|
169
169
|
}
|
|
170
170
|
}
|
|
171
171
|
console.log(`\nNext: sudo agentnet service install # or 'agentnet up --real-tun' to run in foreground`);
|
|
172
|
+
console.log(`Optional — watch China video (CCTV etc.) through a China exit:`);
|
|
173
|
+
console.log(` agentnet proxy trust-ca && agentnet proxy router --hls-accel # see docs/CCTV-VIEWING.md`);
|
|
172
174
|
}
|
|
173
175
|
/**
|
|
174
176
|
* Show identity information.
|
|
@@ -2166,6 +2168,7 @@ WantedBy=multi-user.target
|
|
|
2166
2168
|
execSync("systemctl enable --now agentnet");
|
|
2167
2169
|
console.log(`Installed ${unitPath} and started agentnet.service.`);
|
|
2168
2170
|
console.log(`Logs: journalctl -u agentnet -f`);
|
|
2171
|
+
console.log(`Optional — watch China video (CCTV etc.): agentnet proxy trust-ca && agentnet proxy router --hls-accel (docs/CCTV-VIEWING.md)`);
|
|
2169
2172
|
return;
|
|
2170
2173
|
}
|
|
2171
2174
|
if (process.platform === "darwin") {
|
|
@@ -2225,6 +2228,7 @@ WantedBy=multi-user.target
|
|
|
2225
2228
|
}
|
|
2226
2229
|
execSync(`launchctl load ${plistPath}`);
|
|
2227
2230
|
console.log(`Installed ${plistPath} and started com.decentlan.agentnet.`);
|
|
2231
|
+
console.log(`Optional — watch China video (CCTV etc.): agentnet proxy trust-ca && agentnet proxy router --hls-accel (docs/CCTV-VIEWING.md)`);
|
|
2228
2232
|
console.log(`Logs: tail -f /var/log/agentnet.log`);
|
|
2229
2233
|
return;
|
|
2230
2234
|
}
|
package/dist/daemon/server.js
CHANGED
|
@@ -664,43 +664,51 @@ export class DaemonServer {
|
|
|
664
664
|
selfRestart: async () => {
|
|
665
665
|
// Detach a child process that waits briefly and then re-execs
|
|
666
666
|
// the same argv we were started with. Inherits privileges
|
|
667
|
-
// (root daemon → root child, no sudo prompt).
|
|
668
|
-
//
|
|
669
|
-
//
|
|
670
|
-
//
|
|
671
|
-
//
|
|
672
|
-
//
|
|
667
|
+
// (root daemon → root child, no sudo prompt).
|
|
668
|
+
//
|
|
669
|
+
// IMPORTANT: run the normal graceful shutdown before spawning
|
|
670
|
+
// the replacement. Peer.stop() notifies established friends that
|
|
671
|
+
// this net_crypto session is going away; skipping it strands the
|
|
672
|
+
// remote side on our old ephemeral session key. Presence then
|
|
673
|
+
// remains online while chat/TUN packets from the restarted process
|
|
674
|
+
// are rejected until the remote daemon is restarted too.
|
|
673
675
|
const { spawn } = await import("child_process");
|
|
674
676
|
const argv = process.argv.slice();
|
|
675
677
|
const node = argv.shift();
|
|
676
678
|
this.logger.info(`Self-restart requested via IPC — relaunching ${node} ${argv.join(" ")}`);
|
|
677
679
|
// Schedule shutdown for after the IPC response goes out. The
|
|
678
|
-
// 50ms timeout
|
|
679
|
-
// child's own 1s sleep below is the real arbiter.
|
|
680
|
+
// 50ms timeout lets the response leave before cleanup closes IPC.
|
|
680
681
|
setTimeout(() => {
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
682
|
+
void (async () => {
|
|
683
|
+
try {
|
|
684
|
+
await this.stop();
|
|
685
|
+
}
|
|
686
|
+
catch (err) {
|
|
687
|
+
// cleanup() is already best-effort component by component,
|
|
688
|
+
// but do not make an upgrade impossible if an unexpected
|
|
689
|
+
// shutdown error escapes it.
|
|
690
|
+
this.logger.error(`Self-restart cleanup failed: ${err instanceof Error ? err.message : err}`);
|
|
691
|
+
}
|
|
692
|
+
try {
|
|
693
|
+
// sh -c so we can shell-quote argv safely and use sleep.
|
|
694
|
+
// Node's detached flag reparents the relauncher to PID 1.
|
|
695
|
+
// At this point stop() has released IPC, TUN and the pidfile;
|
|
696
|
+
// the extra delay also lets relay writes flush remotely.
|
|
697
|
+
const cmd = `sleep 1 && exec ${shellQuote([node, ...argv])}`;
|
|
698
|
+
const child = spawn("sh", ["-c", cmd], {
|
|
699
|
+
detached: true,
|
|
700
|
+
stdio: "ignore",
|
|
701
|
+
env: process.env,
|
|
702
|
+
});
|
|
703
|
+
child.unref();
|
|
704
|
+
}
|
|
705
|
+
catch (err) {
|
|
706
|
+
this.logger.error(`Self-restart spawn failed: ${err instanceof Error ? err.message : err}`);
|
|
707
|
+
}
|
|
708
|
+
setTimeout(() => process.exit(0), 200);
|
|
709
|
+
})();
|
|
702
710
|
}, 50);
|
|
703
|
-
return { scheduledMs:
|
|
711
|
+
return { scheduledMs: 1500, argv: [node, ...argv] };
|
|
704
712
|
},
|
|
705
713
|
diag: async () => {
|
|
706
714
|
// Snapshot of everything an operator needs to debug why
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@decentnetwork/lan",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.189",
|
|
4
4
|
"description": "Private virtual LAN for self-hosted services and AI agents, built on Elastos Carrier. NAT-traversal, name service, ACL, all over a peer-to-peer mesh — no public IP required.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
},
|
|
80
80
|
"dependencies": {
|
|
81
81
|
"@decentnetwork/dora": "^0.1.13",
|
|
82
|
-
"@decentnetwork/peer": "^0.1.
|
|
82
|
+
"@decentnetwork/peer": "^0.1.93",
|
|
83
83
|
"@decentnetwork/peer-webrtc": "^0.2.10",
|
|
84
84
|
"ink": "^5.2.1",
|
|
85
85
|
"js-yaml": "^4.1.0",
|