@decentnetwork/lan 0.1.197 → 0.1.199

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.
@@ -0,0 +1,137 @@
1
+ # Install AgentNet natively on Windows
2
+
3
+ AgentNet runs directly in 64-bit Windows. WSL is not required. The npm package
4
+ contains a Windows helper and WireGuard's signed `wintun.dll`; AgentNet chooses
5
+ the x64 or ARM64 files automatically.
6
+
7
+ Supported targets:
8
+
9
+ - Windows 10 or 11, x64 or ARM64
10
+ - Windows Server 2016 or newer, x64 or ARM64
11
+ - Node.js 20 or newer
12
+
13
+ The TUN adapter and routes require Administrator rights. Carrier, the AgentNet
14
+ protocol, ACLs, chat, the built-in CONNECT exit proxy, and the local router are
15
+ the same as on Linux and macOS.
16
+
17
+ ## Install
18
+
19
+ 1. Install the current LTS release of [Node.js](https://nodejs.org/).
20
+ 2. Open **PowerShell as Administrator**.
21
+ 3. Run:
22
+
23
+ ```powershell
24
+ npm install -g @decentnetwork/lan
25
+ agentnet init --name my-windows-pc
26
+ agentnet service install
27
+ ```
28
+
29
+ `service install` creates the `agentnet0` Wintun adapter, registers the
30
+ `10.86.0.0/16` route, and installs an elevated `Decent AgentNet` startup task.
31
+ The launcher restarts the daemon after a failure and starts it again at boot.
32
+
33
+ No separate Wintun installer is needed. Do not download a driver DLL from a
34
+ third-party site.
35
+
36
+ ## Verify
37
+
38
+ In the same Administrator PowerShell:
39
+
40
+ ```powershell
41
+ agentnet service status
42
+ agentnet diag
43
+ Get-NetAdapter -Name agentnet0
44
+ Get-NetRoute -DestinationPrefix 10.86.0.0/16
45
+ ping 10.86.156.164
46
+ ```
47
+
48
+ Replace the final address with a live AgentNet peer. The first dora roster and
49
+ Carrier sessions can take 60–90 seconds after a new installation.
50
+
51
+ Follow the service log with:
52
+
53
+ ```powershell
54
+ Get-Content -Wait "$env:USERPROFILE\.agentnet\agentnet-service.log"
55
+ ```
56
+
57
+ Useful lifecycle commands:
58
+
59
+ ```powershell
60
+ agentnet service restart
61
+ agentnet service status
62
+ agentnet service install --uninstall
63
+ ```
64
+
65
+ Run these commands from an Administrator PowerShell. `agentnet restart` is a
66
+ different command: it asks an already-running daemon to re-exec over local IPC;
67
+ `agentnet service restart` works even when that daemon is stuck.
68
+
69
+ ## Make the Windows machine an exit node
70
+
71
+ An exit node does not need WSL, Windows NAT, or the client-side HLS accelerator.
72
+ Enable AgentNet's application-level CONNECT proxy and restart the service:
73
+
74
+ ```powershell
75
+ agentnet proxy enable
76
+ agentnet service restart
77
+ ```
78
+
79
+ The proxy listens on the node's AgentNet virtual IP at port `8888` by default.
80
+ AgentNet friend/ACL policy remains the authorization boundary. On the machine
81
+ watching CCTV, run the multi-exit router with HLS acceleration:
82
+
83
+ ```powershell
84
+ agentnet proxy router --listen 0.0.0.0 --hls-accel
85
+ ```
86
+
87
+ Then point Chrome at `http://127.0.0.1:8889`. `--hls-accel` belongs on the
88
+ watching/client router, not on each exit node.
89
+
90
+ ## Foreground debugging
91
+
92
+ Stop the startup task first so two daemons do not share one identity:
93
+
94
+ ```powershell
95
+ schtasks.exe /End /TN "Decent AgentNet"
96
+ $env:DECENT_DEBUG = "1"
97
+ $env:DECENT_DEBUG_VERBOSE = "1"
98
+ agentnet up --real-tun
99
+ ```
100
+
101
+ Press `Ctrl+C` when finished, then restore the task with
102
+ `agentnet service restart`.
103
+
104
+ ## Troubleshooting
105
+
106
+ | symptom | fix |
107
+ |---|---|
108
+ | `Access is denied`, route creation fails, or Wintun cannot create an adapter | Close the terminal and reopen PowerShell with **Run as administrator**. |
109
+ | `Missing TUN helper` or `wintun.dll` is missing | Reinstall the current npm package. Antivirus quarantine is also worth checking. The helper and DLL must remain together in their `bin/windows-*` directory. |
110
+ | Service is installed but `agentnet diag` cannot connect | Run commands from Administrator PowerShell and inspect `agentnet-service.log`; then use `agentnet service restart`. |
111
+ | Only this Windows host cannot reach peers | Check `Get-NetRoute -DestinationPrefix 10.86.0.0/16` and ensure another VPN has not installed a more specific `10.86.*` route. |
112
+ | Carrier shows a peer online but ping/messages stop after a restart | Upgrade both ends to the current AgentNet version; session rekey convergence requires compatible daemon versions. |
113
+ | Native mode is blocked by enterprise policy | Use the previous WSL2 deployment as a fallback; do not run native and WSL daemons with the same identity at the same time. |
114
+
115
+ ## Implementation and trust
116
+
117
+ - The helper is written in Go and uses the official
118
+ [`golang.zx2c4.com/wintun`](https://git.zx2c4.com/wintun-go/) binding.
119
+ - Release packaging accepts only the official Wintun 0.14.1 archive with
120
+ SHA-256 `07c256185d6ee3652e09fa55c0b673e2624b565e02c4b9091c79ca7d2f24ef51`.
121
+ - The release package includes Wintun's license and an asset manifest; npm
122
+ publishing fails if either architecture's DLL is missing or changed.
123
+
124
+ The native helper is cross-compiled and unit-tested from the main repository.
125
+
126
+ ### Native validation
127
+
128
+ Release `0.1.199` was validated on real Windows 11 x64 (build 26200) with
129
+ Node.js 24.15.0 on July 15, 2026. The smoke test covered global npm install,
130
+ Wintun creation, `/32` address and `/16` route, firewall, named-pipe CLI,
131
+ dora roster, cross-node ICMP and chat, graceful service restart, adapter
132
+ recreation, and HTTPS CONNECT egress. After restart, allow roughly 30–90
133
+ seconds for dora roster/session convergence before treating an early
134
+ `no-ipam-record` ping as a failure.
135
+
136
+ Windows ARM64 is cross-compiled and packaged but has not yet had equivalent
137
+ real-hardware validation.
package/docs/INSTALL.md CHANGED
@@ -13,27 +13,18 @@ transparently between any two daemons that are Carrier friends.
13
13
  | | minimum |
14
14
  |---|---|
15
15
  | Node.js | **20+** |
16
- | OS | Linux (`x86_64`, `aarch64`), macOS (`aarch64`, `x86_64`), or **Windows 10 / 11 via WSL2** ([Windows guide](INSTALL-WINDOWS.md)) |
17
- | Root / sudo | Yes — needed to create the TUN device. The daemon drops back to user-mode for everything else. |
16
+ | OS | Linux (`x86_64`, `aarch64`), macOS (`aarch64`, `x86_64`), or native 64-bit Windows 10/11/Server (`x64`, `ARM64`) ([Windows guide](INSTALL-WINDOWS.md)) |
17
+ | Privilege | Root/sudo on Unix or Administrator on Windows — needed to create and configure the TUN device. |
18
18
  | Outbound network | TCP and UDP to public Carrier bootstrap nodes (ports 33445 + 443). No inbound port needed; no public IP needed. |
19
19
 
20
20
  ### Windows
21
21
 
22
- Windows **is** supported but the daemon runs inside **WSL2** (Windows
23
- Subsystem for Linux), a real Linux environment Windows installs for you, not
24
- on Windows directly. Requirements:
22
+ Windows runs AgentNet natively using the signed Wintun driver bundled with the
23
+ npm package. Node selects the correct x64 or ARM64 helper automatically; WSL
24
+ is no longer required. Installation and service commands must run from an
25
+ Administrator PowerShell.
25
26
 
26
- - **Windows 11**, or **Windows 10 version 2004 or later** (build 19041+)
27
- this is what the one-command `wsl --install` needs.
28
- - **Fast (direct UDP) path needs Windows 11, version 22H2 or later.** There you
29
- turn on WSL **mirrored networking mode**, which lets the direct UDP
30
- hole-punch succeed (~200 ms — smooth for live video). On **Windows 10**
31
- mirrored mode doesn't exist, so WSL's NAT blocks inbound UDP and the SDK
32
- falls back to the TCP relay: it still works, just slower (fine for SSH, chat,
33
- and most browsing; live sports may stutter).
34
-
35
- 👉 **Non-technical step-by-step for Windows users: [INSTALL-WINDOWS.md](INSTALL-WINDOWS.md)**
36
- (install WSL → install Node.js → install decentlan, three steps).
27
+ 👉 **Native Windows step-by-step: [INSTALL-WINDOWS.md](INSTALL-WINDOWS.md)**
37
28
 
38
29
  ## Install
39
30
 
@@ -42,8 +33,8 @@ npm install -g @decentnetwork/lan
42
33
  ```
43
34
 
44
35
  This installs the `agentnet` CLI on `$PATH` along with platform-
45
- specific TUN helper binaries (we ship `linux-amd64`, `linux-arm64`,
46
- `darwin-amd64`, and `darwin-arm64`). Confirm:
36
+ specific TUN helper binaries (Linux/macOS x64 + ARM64 and Windows x64 + ARM64).
37
+ The Windows directories also contain the matching signed `wintun.dll`. Confirm:
47
38
 
48
39
  ```bash
49
40
  agentnet --help
@@ -59,8 +50,8 @@ sudo agentnet service install --config-dir $HOME/.agentnet
59
50
 
60
51
  That's it. `agentnet init` already points at the public dora and sends
61
52
  the one-time friend-request; `service install` writes a systemd unit
62
- (Linux) or LaunchDaemon (macOS) that runs the daemon as root with
63
- auto-restart and logs to `/var/log/agentnet.log`.
53
+ (Linux), LaunchDaemon (macOS), or elevated startup task (Windows) with
54
+ automatic restart.
64
55
 
65
56
  Wait ~60–90s, then verify:
66
57
 
@@ -105,7 +96,7 @@ The daemon will:
105
96
  1. Open a Carrier connection
106
97
  2. Register with dora and get a virtual IP (e.g. `10.86.1.12`)
107
98
  3. Pull the network roster and auto-friend every other peer in it
108
- 4. Bring up `agentnet0` on Linux (or `utun*` on macOS) at that IP
99
+ 4. Bring up `agentnet0` on Linux/Windows (or `utun*` on macOS) at that IP
109
100
  5. Start a local DNS server for `*.decent` (default) so you can
110
101
  `ping my-laptop.decent`, `ssh peer-name.decent`, etc.
111
102
 
@@ -237,7 +228,8 @@ to stop. Drop the `.plist` file to disable persistence.
237
228
 
238
229
  ## Running CLI commands once the daemon is up
239
230
 
240
- The CLI talks to the daemon over a Unix socket in the config-dir.
231
+ The CLI talks to the daemon over a Unix socket in the config-dir, or a named
232
+ pipe derived from that directory on Windows.
241
233
  Most commands (`diag`, `ipam list`, `friends list`, `friends pending`,
242
234
  `resolve`, `dora autofriend`) just read or write config files — they
243
235
  **don't need sudo**:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decentnetwork/lan",
3
- "version": "0.1.197",
3
+ "version": "0.1.199",
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",
@@ -24,6 +24,7 @@
24
24
  "README.md",
25
25
  "LICENSE",
26
26
  "docs/INSTALL.md",
27
+ "docs/INSTALL-WINDOWS.md",
27
28
  "docs/CONFIGURATION.md"
28
29
  ],
29
30
  "sideEffects": false,
@@ -65,7 +66,11 @@
65
66
  "build:helper:linux-arm64": "cd helper/tun-helper && GOOS=linux GOARCH=arm64 go build -o ../../bin/tun-helper-linux-arm64 .",
66
67
  "build:helper:darwin-arm64": "cd helper/tun-helper && GOOS=darwin GOARCH=arm64 go build -o ../../bin/tun-helper-darwin-arm64 .",
67
68
  "build:helper:darwin-amd64": "cd helper/tun-helper && GOOS=darwin GOARCH=amd64 go build -o ../../bin/tun-helper-darwin-amd64 .",
68
- "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",
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 .",
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
+ "fetch:wintun": "node scripts/fetch-wintun.mjs",
73
+ "verify:wintun": "node scripts/verify-wintun.mjs",
69
74
  "build:all": "npm run build && npm run build:helper",
70
75
  "clean": "rm -rf dist bin",
71
76
  "dev": "node --loader ts-node/esm src/index.ts",
@@ -74,7 +79,7 @@
74
79
  "test:coverage": "vitest --coverage",
75
80
  "typecheck": "tsc --noEmit",
76
81
  "lint": "eslint src --ext .ts",
77
- "prepublishOnly": "rm -rf dist && npm run build && npm run typecheck && npm run build:helpers:all",
82
+ "prepublishOnly": "rm -rf dist && npm run build && npm run typecheck && npm run build:helpers:all && npm run verify:wintun",
78
83
  "build:console": "node scripts/build-console.mjs"
79
84
  },
80
85
  "dependencies": {