@decentnetwork/peer 0.1.10 → 0.1.11
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.d.ts +11 -0
- package/dist/peer.js +3 -1
- package/package.json +1 -1
package/dist/peer.d.ts
CHANGED
|
@@ -37,6 +37,17 @@ export declare class Peer {
|
|
|
37
37
|
selfAnnounceStoredOn: number;
|
|
38
38
|
udpLocalPort: number | null;
|
|
39
39
|
tcpRelayConnected: number;
|
|
40
|
+
/** The specific relay endpoints this peer has live connections to.
|
|
41
|
+
* Lets us compare two peers' relay sets — if there's NO overlap,
|
|
42
|
+
* net_crypto handshake packets between them have nowhere to route
|
|
43
|
+
* via the TCP fallback path. This is the most common "session
|
|
44
|
+
* established=False forever on the WAN" failure mode after
|
|
45
|
+
* restart waves: peers picked different relays from the bootstrap
|
|
46
|
+
* pool. Surfacing this lets diag pinpoint it. */
|
|
47
|
+
tcpRelayEndpoints: Array<{
|
|
48
|
+
host: string;
|
|
49
|
+
port: number;
|
|
50
|
+
}>;
|
|
40
51
|
};
|
|
41
52
|
addKnownNodes(nodes: NetworkNode[]): void;
|
|
42
53
|
knownNodes(): NetworkNode[];
|
package/dist/peer.js
CHANGED
|
@@ -452,13 +452,15 @@ export class Peer {
|
|
|
452
452
|
* through even when DHT is dead.
|
|
453
453
|
*/
|
|
454
454
|
dhtHealth() {
|
|
455
|
+
const relays = this.#tcpRelays?.connectedRelays(99) ?? [];
|
|
455
456
|
return {
|
|
456
457
|
bootstrapsConfigured: this.#opts.bootstrapNodes.length,
|
|
457
458
|
knownNodesCount: this.#knownNodes.length,
|
|
458
459
|
lastSelfAnnounceMs: this.#lastSelfAnnounceMs,
|
|
459
460
|
selfAnnounceStoredOn: this.#lastSelfAnnounceStoredCount,
|
|
460
461
|
udpLocalPort: this.#udp?.localPort() ?? null,
|
|
461
|
-
tcpRelayConnected:
|
|
462
|
+
tcpRelayConnected: relays.length,
|
|
463
|
+
tcpRelayEndpoints: relays.map((r) => ({ host: r.host, port: r.port })),
|
|
462
464
|
};
|
|
463
465
|
}
|
|
464
466
|
addKnownNodes(nodes) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@decentnetwork/peer",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.11",
|
|
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",
|