@decentnetwork/lan 0.1.68 → 0.1.70

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
@@ -11,6 +11,8 @@ export interface PeerManagerOptions {
11
11
  keyFile: string;
12
12
  bootstrapNodes: BootstrapNode[];
13
13
  expressNodes?: BootstrapNode[];
14
+ /** Use express only for friend-request bootstrap, never for data-plane sendText. */
15
+ expressControlPlaneOnly?: boolean;
14
16
  }
15
17
  export declare class PeerManager extends EventEmitter {
16
18
  private peer;
@@ -30,6 +30,7 @@ export class PeerManager extends EventEmitter {
30
30
  compatibilityMode: "legacy",
31
31
  bootstrapNodes: opts.bootstrapNodes,
32
32
  expressNodes: opts.expressNodes,
33
+ expressControlPlaneOnly: opts.expressControlPlaneOnly,
33
34
  });
34
35
  this.setupEventHandlers();
35
36
  this.logger.info("Peer instance created (not yet started)");
@@ -108,26 +108,30 @@ export class DaemonServer {
108
108
  // optional dora registration can decide our IP.
109
109
  const keyFile = resolve(this.config.carrier.dataDir, "keypair.json");
110
110
  this.peerManager = new PeerManager();
111
- // Daemon does NOT use express nodes. decentlan is a virtual
112
- // LAN peers must be ONLINE for IP packets to flow. Express
113
- // is an offline-message store-and-forward relay for chat-style
114
- // apps; if we enable it, sendText silently falls back to a
115
- // queue when a friend is offline. That creates the illusion of
116
- // connectivity ("the daemon says X is reachable") while
117
- // packets actually pile up in HTTPS storage and never get
118
- // forwarded in real time. For a VPN-like data plane, that's
119
- // wrong — better to fail fast and let the operator see the
120
- // peer as offline.
111
+ // The daemon enables express in CONTROL-PLANE-ONLY mode. Two
112
+ // distinct concerns were previously conflated:
121
113
  //
122
- // Friend-request bootstrap is the only thing that benefits
123
- // from express; for that case use the standalone CLI
124
- // `agentnet friend-request` (which DOES use express via its
125
- // own short-lived Peer instance) and accept the request on
126
- // both ends before bringing the daemon up.
114
+ // - DATA plane (sendText / IP packets): express must NEVER be a
115
+ // fallback. decentlan is a virtual LAN if `sendText` silently
116
+ // queued to HTTPS store-and-forward when a friend is offline, the
117
+ // daemon would report "reachable" while packets piled up undelivered.
118
+ // A VPN-like data plane must fail fast and surface the peer as
119
+ // offline. `expressControlPlaneOnly: true` enforces exactly that.
120
+ //
121
+ // - CONTROL plane (friend-request bootstrap): express IS needed. The
122
+ // dora-registration friend-request (and the 30s re-send loop in
123
+ // dora-integration) runs INSIDE this daemon. With express disabled
124
+ // here, a node whose onion announce hasn't propagated — e.g. callpass
125
+ // behind a strict NAT — could NEVER deliver its friend-request to the
126
+ // dora, so it never registered and never got a virtual IP. Routing
127
+ // operators through the standalone `agentnet friend-request` CLI was a
128
+ // manual workaround, not a fix. Giving the daemon express for the
129
+ // one-time handshake closes that gap without touching the data plane.
127
130
  await this.peerManager.create({
128
131
  keyFile,
129
132
  bootstrapNodes: this.config.carrier.bootstrapNodes,
130
- expressNodes: [],
133
+ expressNodes: this.config.carrier.expressNodes ?? [],
134
+ expressControlPlaneOnly: true,
131
135
  });
132
136
  await this.peerManager.start();
133
137
  this.logger.info(`Identity: ${this.peerManager.getAddress()}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decentnetwork/lan",
3
- "version": "0.1.68",
3
+ "version": "0.1.70",
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",
@@ -75,7 +75,7 @@
75
75
  },
76
76
  "dependencies": {
77
77
  "@decentnetwork/dora": "^0.1.6",
78
- "@decentnetwork/peer": "^0.1.30",
78
+ "@decentnetwork/peer": "^0.1.32",
79
79
  "js-yaml": "^4.1.0",
80
80
  "yargs": "^17.7.2"
81
81
  },