@leofcoin/peernet 1.2.3 → 1.2.5
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { L as LittlePubSub, d as deflate_1, i as inflate_1, c as createDebugger } from './peernet-
|
|
1
|
+
import { L as LittlePubSub, d as deflate_1, i as inflate_1, c as createDebugger } from './peernet-BNgO-BZL.js';
|
|
2
2
|
import './identity-nIyW_Xm8.js';
|
|
3
3
|
import './value-C3vAp-wb.js';
|
|
4
4
|
|
|
@@ -490,6 +490,63 @@ class Peer extends SimplePeer {
|
|
|
490
490
|
this.send(data, id);
|
|
491
491
|
});
|
|
492
492
|
}
|
|
493
|
+
/**
|
|
494
|
+
* Get comprehensive network statistics from WebRTC
|
|
495
|
+
* @returns NetworkStats object with detailed metrics
|
|
496
|
+
*/
|
|
497
|
+
async getNetworkStats() {
|
|
498
|
+
try {
|
|
499
|
+
const pc = this._pc;
|
|
500
|
+
if (!pc)
|
|
501
|
+
return null;
|
|
502
|
+
const stats = await pc.getStats();
|
|
503
|
+
const result = {
|
|
504
|
+
latency: null,
|
|
505
|
+
jitter: null,
|
|
506
|
+
bytesReceived: 0,
|
|
507
|
+
bytesSent: 0,
|
|
508
|
+
packetsLost: 0,
|
|
509
|
+
fractionLost: null,
|
|
510
|
+
inboundBitrate: null,
|
|
511
|
+
outboundBitrate: null,
|
|
512
|
+
availableOutgoingBitrate: null,
|
|
513
|
+
timestamp: Date.now()
|
|
514
|
+
};
|
|
515
|
+
let prevBytesReceived = 0;
|
|
516
|
+
let prevBytesSent = 0;
|
|
517
|
+
let prevTimestamp = 0;
|
|
518
|
+
stats.forEach((report) => {
|
|
519
|
+
// Latency from candidate pair
|
|
520
|
+
if (report.type === 'candidate-pair' && report.currentRoundTripTime) {
|
|
521
|
+
result.latency = Math.round(report.currentRoundTripTime * 1000);
|
|
522
|
+
}
|
|
523
|
+
// Inbound RTP stats
|
|
524
|
+
if (report.type === 'inbound-rtp') {
|
|
525
|
+
result.bytesReceived += report.bytesReceived || 0;
|
|
526
|
+
result.packetsLost += report.packetsLost || 0;
|
|
527
|
+
if (report.jitter) {
|
|
528
|
+
result.jitter = Math.round(report.jitter * 1000);
|
|
529
|
+
}
|
|
530
|
+
if (report.fractionLost) {
|
|
531
|
+
result.fractionLost = report.fractionLost;
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
// Outbound RTP stats
|
|
535
|
+
if (report.type === 'outbound-rtp') {
|
|
536
|
+
result.bytesSent += report.bytesSent || 0;
|
|
537
|
+
}
|
|
538
|
+
// Available bandwidth
|
|
539
|
+
if (report.type === 'remote-candidate' &&
|
|
540
|
+
report.availableOutgoingBitrate) {
|
|
541
|
+
result.availableOutgoingBitrate = Math.round(report.availableOutgoingBitrate);
|
|
542
|
+
}
|
|
543
|
+
});
|
|
544
|
+
return result;
|
|
545
|
+
}
|
|
546
|
+
catch (e) {
|
|
547
|
+
return null;
|
|
548
|
+
}
|
|
549
|
+
}
|
|
493
550
|
toJSON() {
|
|
494
551
|
return {
|
|
495
552
|
peerId: this.peerId,
|
|
@@ -599,6 +656,8 @@ class Client {
|
|
|
599
656
|
url: 'join',
|
|
600
657
|
params: { version: this.version, peerId: this.peerId }
|
|
601
658
|
});
|
|
659
|
+
globalThis.pubsub.publishVerbose('star:connected', star);
|
|
660
|
+
debug(`setupStar ${star} succeeded`);
|
|
602
661
|
return this.#stars[star];
|
|
603
662
|
}
|
|
604
663
|
catch (e) {
|
|
@@ -8380,7 +8380,7 @@ class Peernet {
|
|
|
8380
8380
|
this.root = options.root;
|
|
8381
8381
|
const { RequestMessage, ResponseMessage, PeerMessage, PeerMessageResponse, PeernetMessage, DHTMessage, DHTMessageResponse, DataMessage, DataMessageResponse, PsMessage, ChatMessage, PeernetFile
|
|
8382
8382
|
// FolderMessageResponse
|
|
8383
|
-
} = await import(/* webpackChunkName: "messages" */ './messages-
|
|
8383
|
+
} = await import(/* webpackChunkName: "messages" */ './messages-hNQTVVEb.js');
|
|
8384
8384
|
/**
|
|
8385
8385
|
* proto Object containing protos
|
|
8386
8386
|
* @type {Object}
|
|
@@ -8474,7 +8474,7 @@ class Peernet {
|
|
|
8474
8474
|
if (this.#starting || this.#started)
|
|
8475
8475
|
return;
|
|
8476
8476
|
this.#starting = true;
|
|
8477
|
-
const importee = await import('./client-
|
|
8477
|
+
const importee = await import('./client-CniXCEmO.js');
|
|
8478
8478
|
/**
|
|
8479
8479
|
* @access public
|
|
8480
8480
|
* @type {PeernetClient}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leofcoin/peernet",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.5",
|
|
4
4
|
"description": "",
|
|
5
5
|
"browser": "./exports/browser/peernet.js",
|
|
6
6
|
"exports": {
|
|
@@ -38,14 +38,14 @@
|
|
|
38
38
|
"@leofcoin/multi-wallet": "^3.1.8",
|
|
39
39
|
"@leofcoin/storage": "^3.5.38",
|
|
40
40
|
"@mapbox/node-pre-gyp": "^2.0.3",
|
|
41
|
-
"@netpeer/swarm": "^0.9.
|
|
41
|
+
"@netpeer/swarm": "^0.9.2",
|
|
42
42
|
"@vandeurenglenn/base58": "^1.1.9",
|
|
43
43
|
"@vandeurenglenn/debug": "^1.4.0",
|
|
44
44
|
"@vandeurenglenn/little-pubsub": "^1.5.2",
|
|
45
|
-
"inquirer": "^13.2.
|
|
45
|
+
"inquirer": "^13.2.2",
|
|
46
46
|
"qr-scanner": "^1.4.2",
|
|
47
47
|
"qrcode": "^1.5.4",
|
|
48
|
-
"tar": "^7.5.
|
|
48
|
+
"tar": "^7.5.7"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@rollup/plugin-commonjs": "^29.0.0",
|
|
@@ -53,8 +53,8 @@
|
|
|
53
53
|
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
54
54
|
"@rollup/plugin-typescript": "^12.3.0",
|
|
55
55
|
"@rollup/plugin-wasm": "^6.2.2",
|
|
56
|
-
"@types/node": "^25.0
|
|
56
|
+
"@types/node": "^25.2.0",
|
|
57
57
|
"@types/qrcode": "^1.5.6",
|
|
58
|
-
"rollup": "^4.
|
|
58
|
+
"rollup": "^4.57.1"
|
|
59
59
|
}
|
|
60
60
|
}
|