@decentnetwork/lan 0.1.200 → 0.1.201
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/dist/cli/commands.js +4 -2
- package/dist/daemon/ipc.d.ts +9 -0
- package/dist/daemon/ipc.js +11 -0
- package/package.json +1 -1
package/dist/cli/commands.js
CHANGED
|
@@ -7,7 +7,7 @@ import { createConnection } from "net";
|
|
|
7
7
|
import { createRequire } from "module";
|
|
8
8
|
import { fileURLToPath } from "url";
|
|
9
9
|
import { ConfigLoader, DEFAULT_DORAS, DEFAULT_EXITS } from "../config/loader.js";
|
|
10
|
-
import { ipcSocketPath } from "../daemon/ipc.js";
|
|
10
|
+
import { ipcSocketPath, ipcSocketSupportsFsExistenceCheck, } from "../daemon/ipc.js";
|
|
11
11
|
import { DaemonServer } from "../daemon/server.js";
|
|
12
12
|
import { Ipam } from "../ipam/ipam.js";
|
|
13
13
|
import { Policy } from "../acl/policy.js";
|
|
@@ -75,7 +75,9 @@ function assertDaemonNotRunning(config, commandName) {
|
|
|
75
75
|
*/
|
|
76
76
|
async function ipcCall(config, req, timeoutMs = 30_000) {
|
|
77
77
|
const sockPath = ipcSocketPath(config.carrier.dataDir);
|
|
78
|
-
|
|
78
|
+
// fs.existsSync works for Unix-domain sockets, but always reports false for
|
|
79
|
+
// Windows named pipes. On Windows, connect directly and trust net's error.
|
|
80
|
+
if (ipcSocketSupportsFsExistenceCheck() && !existsSync(sockPath)) {
|
|
79
81
|
throw new Error(`Daemon socket not found at ${sockPath} — is the daemon running?`);
|
|
80
82
|
}
|
|
81
83
|
return new Promise((resolve, reject) => {
|
package/dist/daemon/ipc.d.ts
CHANGED
|
@@ -154,3 +154,12 @@ export declare class IpcServer {
|
|
|
154
154
|
/** Derive the socket path that pairs with a given carrier data dir.
|
|
155
155
|
* Kept as a one-liner helper so daemon and client agree. */
|
|
156
156
|
export declare function ipcSocketPath(dataDir: string, platform?: NodeJS.Platform): string;
|
|
157
|
+
/** Whether the IPC endpoint can be probed with fs.existsSync().
|
|
158
|
+
*
|
|
159
|
+
* Unix-domain sockets have filesystem entries. Windows named pipes live in
|
|
160
|
+
* the pipe namespace instead: Node can connect to them with net.connect(),
|
|
161
|
+
* but fs.existsSync("\\\\.\\pipe\\...") reports false even while the server is
|
|
162
|
+
* listening. Clients must therefore skip the filesystem preflight on Windows
|
|
163
|
+
* and let net.connect() report a real connection error instead.
|
|
164
|
+
*/
|
|
165
|
+
export declare function ipcSocketSupportsFsExistenceCheck(platform?: NodeJS.Platform): boolean;
|
package/dist/daemon/ipc.js
CHANGED
|
@@ -285,3 +285,14 @@ export function ipcSocketPath(dataDir, platform = process.platform) {
|
|
|
285
285
|
// on macOS; <dataDir>/daemon.sock fits comfortably for sane homedirs.
|
|
286
286
|
return `${dataDir.replace(/\/+$/, "")}/daemon.sock`;
|
|
287
287
|
}
|
|
288
|
+
/** Whether the IPC endpoint can be probed with fs.existsSync().
|
|
289
|
+
*
|
|
290
|
+
* Unix-domain sockets have filesystem entries. Windows named pipes live in
|
|
291
|
+
* the pipe namespace instead: Node can connect to them with net.connect(),
|
|
292
|
+
* but fs.existsSync("\\\\.\\pipe\\...") reports false even while the server is
|
|
293
|
+
* listening. Clients must therefore skip the filesystem preflight on Windows
|
|
294
|
+
* and let net.connect() report a real connection error instead.
|
|
295
|
+
*/
|
|
296
|
+
export function ipcSocketSupportsFsExistenceCheck(platform = process.platform) {
|
|
297
|
+
return platform !== "win32";
|
|
298
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@decentnetwork/lan",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.201",
|
|
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",
|