@decentnetwork/peer 0.1.119 → 0.1.120

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.
Files changed (2) hide show
  1. package/dist/peer.js +11 -2
  2. package/package.json +1 -1
package/dist/peer.js CHANGED
@@ -2566,7 +2566,13 @@ export class Peer {
2566
2566
  dataSecretKey: this.#announceDataKey.secretKey
2567
2567
  });
2568
2568
  if (!routed) {
2569
- this.#debugLog("onion data response decrypt failed");
2569
+ // Log enough to distinguish "sender used a stale data pk from an old
2570
+ // announce entry" from "packet framing we mis-parse" — the temp pk
2571
+ // the sender encrypted to sits at bytes [25..57) in toxcore layout.
2572
+ const pkPreview = Buffer.from(packet.slice(25, 57)).toString("hex").slice(0, 16);
2573
+ this.#debugLog(`onion data response decrypt failed from=${remote.address}:${remote.port} ` +
2574
+ `len=${packet.length} ourDataPk=${Buffer.from(this.#announceDataKey.publicKey).toString("hex").slice(0, 16)} ` +
2575
+ `pkAt25=${pkPreview}`);
2570
2576
  return;
2571
2577
  }
2572
2578
  const onionData = openOnionDataPacket(routed.payload, {
@@ -3173,8 +3179,11 @@ export class Peer {
3173
3179
  // fleet, so an announce stored there is universally findable.
3174
3180
  const wave = [];
3175
3181
  if (waves === 1) {
3182
+ // ALL bootstraps, not a distance-picked subset: only a minority of
3183
+ // the fleet still answers UDP DHT (observed: 1 of 9), and a subset
3184
+ // pick chose 4 dead ones while skipping the live one.
3176
3185
  const bootstrapIdSet = new Set(this.#opts.bootstrapNodes.map((n) => `${n.host}:${n.port}`));
3177
- for (let qi = 0; qi < queue.length && wave.length < 4;) {
3186
+ for (let qi = 0; qi < queue.length && wave.length < bootstrapIdSet.size;) {
3178
3187
  const c = queue[qi];
3179
3188
  const id = `${c.node.host}:${c.node.port}`;
3180
3189
  if (bootstrapIdSet.has(id) && !visited.has(id)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decentnetwork/peer",
3
- "version": "0.1.119",
3
+ "version": "0.1.120",
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",