@decentnetwork/lan 0.1.199 → 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.
Binary file
Binary file
Binary file
Binary file
@@ -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
- if (!existsSync(sockPath)) {
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) => {
@@ -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;
@@ -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
+ }
@@ -125,7 +125,7 @@ The native helper is cross-compiled and unit-tested from the main repository.
125
125
 
126
126
  ### Native validation
127
127
 
128
- Release `0.1.199` was validated on real Windows 11 x64 (build 26200) with
128
+ Release `0.1.200` was validated on real Windows 11 x64 (build 26200) with
129
129
  Node.js 24.15.0 on July 15, 2026. The smoke test covered global npm install,
130
130
  Wintun creation, `/32` address and `/16` route, firewall, named-pipe CLI,
131
131
  dora roster, cross-node ICMP and chat, graceful service restart, adapter
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decentnetwork/lan",
3
- "version": "0.1.199",
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",
@@ -61,13 +61,13 @@
61
61
  "scripts": {
62
62
  "build": "tsc -p tsconfig.json && chmod +x dist/cli/index.js && node scripts/build-ui.mjs && node scripts/build-console.mjs",
63
63
  "build:ui": "node scripts/build-ui.mjs",
64
- "build:helper": "cd helper/tun-helper && go build -o ../../bin/tun-helper-$(go env GOOS)-$(go env GOARCH) .",
65
- "build:helper:linux-amd64": "cd helper/tun-helper && GOOS=linux GOARCH=amd64 go build -o ../../bin/tun-helper-linux-amd64 .",
66
- "build:helper:linux-arm64": "cd helper/tun-helper && GOOS=linux GOARCH=arm64 go build -o ../../bin/tun-helper-linux-arm64 .",
67
- "build:helper:darwin-arm64": "cd helper/tun-helper && GOOS=darwin GOARCH=arm64 go build -o ../../bin/tun-helper-darwin-arm64 .",
68
- "build:helper:darwin-amd64": "cd helper/tun-helper && GOOS=darwin GOARCH=amd64 go build -o ../../bin/tun-helper-darwin-amd64 .",
69
- "build:helper:windows-amd64": "mkdir -p bin/windows-amd64 && cd helper/tun-helper && GOOS=windows GOARCH=amd64 go build -o ../../bin/windows-amd64/tun-helper-windows-amd64.exe .",
70
- "build:helper:windows-arm64": "mkdir -p bin/windows-arm64 && cd helper/tun-helper && GOOS=windows GOARCH=arm64 go build -o ../../bin/windows-arm64/tun-helper-windows-arm64.exe .",
64
+ "build:helper": "cd helper/tun-helper && go build -buildvcs=false -o ../../bin/tun-helper-$(go env GOOS)-$(go env GOARCH) .",
65
+ "build:helper:linux-amd64": "cd helper/tun-helper && GOOS=linux GOARCH=amd64 go build -buildvcs=false -o ../../bin/tun-helper-linux-amd64 .",
66
+ "build:helper:linux-arm64": "cd helper/tun-helper && GOOS=linux GOARCH=arm64 go build -buildvcs=false -o ../../bin/tun-helper-linux-arm64 .",
67
+ "build:helper:darwin-arm64": "cd helper/tun-helper && GOOS=darwin GOARCH=arm64 go build -buildvcs=false -o ../../bin/tun-helper-darwin-arm64 .",
68
+ "build:helper:darwin-amd64": "cd helper/tun-helper && GOOS=darwin GOARCH=amd64 go build -buildvcs=false -o ../../bin/tun-helper-darwin-amd64 .",
69
+ "build:helper:windows-amd64": "mkdir -p bin/windows-amd64 && cd helper/tun-helper && GOOS=windows GOARCH=amd64 go build -buildvcs=false -o ../../bin/windows-amd64/tun-helper-windows-amd64.exe .",
70
+ "build:helper:windows-arm64": "mkdir -p bin/windows-arm64 && cd helper/tun-helper && GOOS=windows GOARCH=arm64 go build -buildvcs=false -o ../../bin/windows-arm64/tun-helper-windows-arm64.exe .",
71
71
  "build:helpers:all": "npm run build:helper:linux-amd64 && npm run build:helper:linux-arm64 && npm run build:helper:darwin-arm64 && npm run build:helper:darwin-amd64 && npm run build:helper:windows-amd64 && npm run build:helper:windows-arm64",
72
72
  "fetch:wintun": "node scripts/fetch-wintun.mjs",
73
73
  "verify:wintun": "node scripts/verify-wintun.mjs",