@decentnetwork/peer 0.1.15 → 0.1.17
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 +21 -15
- package/package.json +1 -1
package/dist/peer.js
CHANGED
|
@@ -889,12 +889,16 @@ export class Peer {
|
|
|
889
889
|
return;
|
|
890
890
|
}
|
|
891
891
|
this.#tracePacket("rx", packet, { host: remote.address, port: remote.port });
|
|
892
|
-
//
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
892
|
+
// Debug: log every inbound UDP datagram (gated on DECENT_ANNOUNCE_DEBUG)
|
|
893
|
+
// so we can see what bootstraps reply with. Off by default.
|
|
894
|
+
if (process.env.DECENT_ANNOUNCE_DEBUG === "1") {
|
|
895
|
+
import("fs").then((fs) => {
|
|
896
|
+
try {
|
|
897
|
+
fs.appendFileSync("/tmp/decent-udp-rx.log", `${new Date().toISOString()} from=${remote.address}:${remote.port} firstByte=0x${packet[0]?.toString(16) ?? "??"} len=${packet.length}\n`);
|
|
898
|
+
}
|
|
899
|
+
catch { /* best-effort */ }
|
|
900
|
+
}).catch(() => { });
|
|
896
901
|
}
|
|
897
|
-
catch { /* best-effort */ }
|
|
898
902
|
if (packet[0] === NET_PACKET_CRYPTO) {
|
|
899
903
|
const opened = openToxDhtCryptoRequest(packet, this.#keyPair);
|
|
900
904
|
if (!opened) {
|
|
@@ -1985,11 +1989,12 @@ export class Peer {
|
|
|
1985
1989
|
catch { /* best-effort */ }
|
|
1986
1990
|
continue;
|
|
1987
1991
|
}
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1992
|
+
if (process.env.DECENT_ANNOUNCE_DEBUG === "1")
|
|
1993
|
+
try {
|
|
1994
|
+
const fs = await import("fs");
|
|
1995
|
+
fs.appendFileSync("/tmp/decent-announce.log", `${new Date().toISOString()} step1 from=${c.node.host}:${c.node.port} isStored=${resp1.isStored}\n`);
|
|
1996
|
+
}
|
|
1997
|
+
catch { /* best-effort */ }
|
|
1993
1998
|
step1Hits.push({ c, resp1 });
|
|
1994
1999
|
}
|
|
1995
2000
|
const step2Settled = await Promise.allSettled(step1Hits.map(({ c, resp1 }) => this.#sendAnnounceAndWait({
|
|
@@ -2009,11 +2014,12 @@ export class Peer {
|
|
|
2009
2014
|
const r2 = step2Settled[j];
|
|
2010
2015
|
const resp2 = r2.status === "fulfilled" ? r2.value : undefined;
|
|
2011
2016
|
const final = resp2 ?? resp1;
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
+
if (process.env.DECENT_ANNOUNCE_DEBUG === "1")
|
|
2018
|
+
try {
|
|
2019
|
+
const fs = await import("fs");
|
|
2020
|
+
fs.appendFileSync("/tmp/decent-announce.log", `${new Date().toISOString()} step2 from=${c.node.host}:${c.node.port} ${resp2 ? "isStored=" + resp2.isStored : "NO_RESPONSE"}\n`);
|
|
2021
|
+
}
|
|
2022
|
+
catch { /* best-effort */ }
|
|
2017
2023
|
if (final.isStored === 2) {
|
|
2018
2024
|
storedNodes.push(c.node);
|
|
2019
2025
|
// Keep dhtHealth.selfAnnounceStoredOn live within the loop,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@decentnetwork/peer",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.17",
|
|
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",
|