@decentnetwork/peer 0.1.31 → 0.1.32

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/peer.js CHANGED
@@ -851,7 +851,11 @@ export class Peer {
851
851
  return;
852
852
  }
853
853
  // Offline / fallback path via Carrier express HTTP store-and-forward.
854
- if (this.#express?.hasNodes()) {
854
+ // Skipped entirely in control-plane-only mode (decentlan's data plane):
855
+ // a VPN-style daemon must fail fast when a friend is offline rather than
856
+ // silently queue IP packets into HTTPS storage that never get forwarded
857
+ // in real time. Express there is reserved for friend-request bootstrap.
858
+ if (this.#express?.hasNodes() && !this.#opts.expressControlPlaneOnly) {
855
859
  await this.#express.sendOfflineText(pubkey, packet);
856
860
  this.#debugLog(`sendText: queued via express for ${pubkey}`);
857
861
  return;
@@ -17,6 +17,17 @@ export type PeerOptions = {
17
17
  friendStoreFile?: string;
18
18
  bootstrapNodes: NetworkNode[];
19
19
  expressNodes?: NetworkNode[];
20
+ /**
21
+ * When true, the express relay is used ONLY for friend-request
22
+ * bootstrap (a one-time control-plane handshake) and NEVER as a
23
+ * fallback for runtime `sendText` data. This lets a VPN-style data
24
+ * plane stay fail-fast (an offline friend surfaces as offline, IP
25
+ * packets don't silently pile into HTTPS store-and-forward) while
26
+ * still letting the initial friend-request reach a peer whose onion
27
+ * announce hasn't propagated. decentlan's daemon sets this; chat-style
28
+ * apps that genuinely want offline message delivery leave it false.
29
+ */
30
+ expressControlPlaneOnly?: boolean;
20
31
  compatibilityMode?: CompatibilityMode;
21
32
  debugLabel?: string;
22
33
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decentnetwork/peer",
3
- "version": "0.1.31",
3
+ "version": "0.1.32",
4
4
  "description": "Pure TypeScript port of Elastos Carrier (toxcore-derived) P2P messaging. DHT, onion routing, TCP relay, FlatBuffers app payloads, Express offline relay. Wire-compatible with iOS Beagle and the Carrier C SDK.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",