@decentnetwork/peer 0.1.100 → 0.1.101

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
@@ -430,7 +430,7 @@ export class Peer {
430
430
  });
431
431
  }
432
432
  this.#udp.on("datagram", this.#onDatagram);
433
- await this.#udp.start();
433
+ await this.#udp.start({ port: this.#opts.udpPort });
434
434
  // Spin up the TCP relay pool. We pass the same bootstrap node list
435
435
  // we already have — every Carrier bootstrap is also a TCP relay
436
436
  // server on the same pubkey. The pool opens up to 3 connections in
@@ -25,6 +25,12 @@ export type NetworkNode = {
25
25
  };
26
26
  export type PeerOptions = {
27
27
  keyFile: string;
28
+ /**
29
+ * Stable UDP listen port. Long-lived service peers (Dora registries,
30
+ * relays/exits) should set this so friends' cached DHT endpoints remain
31
+ * usable across process restarts. Omit or set 0 for an ephemeral port.
32
+ */
33
+ udpPort?: number;
28
34
  friendStoreFile?: string;
29
35
  bootstrapNodes: NetworkNode[];
30
36
  expressNodes?: NetworkNode[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decentnetwork/peer",
3
- "version": "0.1.100",
3
+ "version": "0.1.101",
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",