@dxos/network-manager 0.3.9-main.c2ac8a5 → 0.3.9-main.cdfefb1
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/lib/browser/{chunk-Q5B7EFTV.mjs → chunk-7JESB3AJ.mjs} +90 -59
- package/dist/lib/browser/chunk-7JESB3AJ.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +1 -11
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +1 -2
- package/dist/lib/browser/testing/index.mjs.map +1 -1
- package/dist/lib/node/{chunk-YLQJ2ALQ.cjs → chunk-Y2B5BDRH.cjs} +94 -61
- package/dist/lib/node/chunk-Y2B5BDRH.cjs.map +7 -0
- package/dist/lib/node/index.cjs +27 -36
- package/dist/lib/node/index.cjs.map +2 -2
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/testing/index.cjs +18 -19
- package/dist/lib/node/testing/index.cjs.map +1 -1
- package/dist/types/src/transport/index.d.ts +0 -1
- package/dist/types/src/transport/index.d.ts.map +1 -1
- package/dist/types/src/transport/libdatachannel-transport.d.ts +1 -0
- package/dist/types/src/transport/libdatachannel-transport.d.ts.map +1 -1
- package/package.json +18 -18
- package/src/topology/mmst-topology.ts +7 -7
- package/src/transport/index.ts +0 -1
- package/src/transport/libdatachannel-transport.ts +76 -34
- package/src/transport/simplepeer-transport.ts +2 -2
- package/dist/lib/browser/chunk-Q5B7EFTV.mjs.map +0 -7
- package/dist/lib/browser/chunk-YERMWDRB.mjs +0 -24
- package/dist/lib/browser/chunk-YERMWDRB.mjs.map +0 -7
- package/dist/lib/browser/index.browser-O53CPVK3.mjs +0 -14
- package/dist/lib/browser/index.browser-O53CPVK3.mjs.map +0 -7
- package/dist/lib/node/chunk-JDKM4UPJ.cjs +0 -470
- package/dist/lib/node/chunk-JDKM4UPJ.cjs.map +0 -7
- package/dist/lib/node/chunk-YLQJ2ALQ.cjs.map +0 -7
- package/dist/lib/node/datachannel-3VTTIMR5.cjs +0 -35
- package/dist/lib/node/datachannel-3VTTIMR5.cjs.map +0 -7
- package/dist/types/src/transport/datachannel/index.browser.d.ts +0 -15
- package/dist/types/src/transport/datachannel/index.browser.d.ts.map +0 -1
- package/dist/types/src/transport/datachannel/index.d.ts +0 -8
- package/dist/types/src/transport/datachannel/index.d.ts.map +0 -1
- package/dist/types/src/transport/datachannel/rtc-data-channel.d.ts +0 -29
- package/dist/types/src/transport/datachannel/rtc-data-channel.d.ts.map +0 -1
- package/dist/types/src/transport/datachannel/rtc-events.d.ts +0 -9
- package/dist/types/src/transport/datachannel/rtc-events.d.ts.map +0 -1
- package/dist/types/src/transport/datachannel/rtc-ice-candidate.d.ts +0 -22
- package/dist/types/src/transport/datachannel/rtc-ice-candidate.d.ts.map +0 -1
- package/dist/types/src/transport/datachannel/rtc-peer-connection.d.ts +0 -54
- package/dist/types/src/transport/datachannel/rtc-peer-connection.d.ts.map +0 -1
- package/dist/types/src/transport/datachannel/rtc-peer-connection.test.d.ts +0 -2
- package/dist/types/src/transport/datachannel/rtc-peer-connection.test.d.ts.map +0 -1
- package/dist/types/src/transport/datachannel/rtc-session-description.d.ts +0 -10
- package/dist/types/src/transport/datachannel/rtc-session-description.d.ts.map +0 -1
- package/src/transport/datachannel/README.md +0 -2
- package/src/transport/datachannel/index.browser.ts +0 -8
- package/src/transport/datachannel/index.ts +0 -17
- package/src/transport/datachannel/rtc-data-channel.ts +0 -148
- package/src/transport/datachannel/rtc-events.ts +0 -23
- package/src/transport/datachannel/rtc-ice-candidate.ts +0 -54
- package/src/transport/datachannel/rtc-peer-connection.test.ts +0 -112
- package/src/transport/datachannel/rtc-peer-connection.ts +0 -355
- package/src/transport/datachannel/rtc-session-description.ts +0 -23
|
@@ -26,8 +26,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var
|
|
30
|
-
__export(
|
|
29
|
+
var chunk_Y2B5BDRH_exports = {};
|
|
30
|
+
__export(chunk_Y2B5BDRH_exports, {
|
|
31
31
|
Connection: () => Connection,
|
|
32
32
|
ConnectionLimiter: () => ConnectionLimiter,
|
|
33
33
|
ConnectionLog: () => ConnectionLog,
|
|
@@ -55,8 +55,7 @@ __export(chunk_YLQJ2ALQ_exports, {
|
|
|
55
55
|
createSimplePeerTransportFactory: () => createSimplePeerTransportFactory,
|
|
56
56
|
createTeleportProtocolFactory: () => createTeleportProtocolFactory
|
|
57
57
|
});
|
|
58
|
-
module.exports = __toCommonJS(
|
|
59
|
-
var import_chunk_JDKM4UPJ = require("./chunk-JDKM4UPJ.cjs");
|
|
58
|
+
module.exports = __toCommonJS(chunk_Y2B5BDRH_exports);
|
|
60
59
|
var import_async = require("@dxos/async");
|
|
61
60
|
var import_context = require("@dxos/context");
|
|
62
61
|
var import_debug = require("@dxos/debug");
|
|
@@ -153,6 +152,13 @@ var import_async12 = require("@dxos/async");
|
|
|
153
152
|
var import_debug8 = require("@dxos/debug");
|
|
154
153
|
var import_log15 = require("@dxos/log");
|
|
155
154
|
var import_teleport = require("@dxos/teleport");
|
|
155
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
156
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
157
|
+
}) : x)(function(x) {
|
|
158
|
+
if (typeof require !== "undefined")
|
|
159
|
+
return require.apply(this, arguments);
|
|
160
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
161
|
+
});
|
|
156
162
|
function _ts_decorate(decorators, target, key, desc) {
|
|
157
163
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
158
164
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
@@ -2449,7 +2455,7 @@ var MMSTTopology = class {
|
|
|
2449
2455
|
});
|
|
2450
2456
|
const { connected, candidates } = this._controller.getState();
|
|
2451
2457
|
if (this._sampleCollected || connected.length > this._maxPeers || candidates.length > 0) {
|
|
2452
|
-
import_log8.log
|
|
2458
|
+
(0, import_log8.log)("Running the algorithm.", void 0, {
|
|
2453
2459
|
F: __dxlog_file9,
|
|
2454
2460
|
L: 60,
|
|
2455
2461
|
S: this,
|
|
@@ -2493,7 +2499,7 @@ var MMSTTopology = class {
|
|
|
2493
2499
|
});
|
|
2494
2500
|
const { connected, candidates, ownPeerId } = this._controller.getState();
|
|
2495
2501
|
if (connected.length > this._maxPeers) {
|
|
2496
|
-
import_log8.log
|
|
2502
|
+
(0, import_log8.log)(`disconnect ${connected.length - this._maxPeers} peers.`, void 0, {
|
|
2497
2503
|
F: __dxlog_file9,
|
|
2498
2504
|
L: 85,
|
|
2499
2505
|
S: this,
|
|
@@ -2519,7 +2525,7 @@ var MMSTTopology = class {
|
|
|
2519
2525
|
}
|
|
2520
2526
|
if (Date.now() - this._lastAction.getTime() > MIN_UPDATE_INTERVAL) {
|
|
2521
2527
|
for (const peer of sorted.slice(0, MAX_CHANGES_PER_UPDATE)) {
|
|
2522
|
-
import_log8.log
|
|
2528
|
+
(0, import_log8.log)(`Disconnect ${peer}.`, void 0, {
|
|
2523
2529
|
F: __dxlog_file9,
|
|
2524
2530
|
L: 97,
|
|
2525
2531
|
S: this,
|
|
@@ -2529,7 +2535,7 @@ var MMSTTopology = class {
|
|
|
2529
2535
|
}
|
|
2530
2536
|
this._lastAction = /* @__PURE__ */ new Date();
|
|
2531
2537
|
} else {
|
|
2532
|
-
import_log8.log
|
|
2538
|
+
(0, import_log8.log)("rate limited discconnect", void 0, {
|
|
2533
2539
|
F: __dxlog_file9,
|
|
2534
2540
|
L: 102,
|
|
2535
2541
|
S: this,
|
|
@@ -2537,7 +2543,7 @@ var MMSTTopology = class {
|
|
|
2537
2543
|
});
|
|
2538
2544
|
}
|
|
2539
2545
|
} else if (connected.length < this._originateConnections) {
|
|
2540
|
-
import_log8.log
|
|
2546
|
+
(0, import_log8.log)(`connect ${this._originateConnections - connected.length} peers.`, void 0, {
|
|
2541
2547
|
F: __dxlog_file9,
|
|
2542
2548
|
L: 106,
|
|
2543
2549
|
S: this,
|
|
@@ -2555,7 +2561,7 @@ var MMSTTopology = class {
|
|
|
2555
2561
|
}
|
|
2556
2562
|
if (Date.now() - this._lastAction.getTime() > MIN_UPDATE_INTERVAL) {
|
|
2557
2563
|
for (const peer of sorted.slice(0, MAX_CHANGES_PER_UPDATE)) {
|
|
2558
|
-
import_log8.log
|
|
2564
|
+
(0, import_log8.log)(`Connect ${peer}.`, void 0, {
|
|
2559
2565
|
F: __dxlog_file9,
|
|
2560
2566
|
L: 115,
|
|
2561
2567
|
S: this,
|
|
@@ -2565,7 +2571,7 @@ var MMSTTopology = class {
|
|
|
2565
2571
|
}
|
|
2566
2572
|
this._lastAction = /* @__PURE__ */ new Date();
|
|
2567
2573
|
} else {
|
|
2568
|
-
import_log8.log
|
|
2574
|
+
(0, import_log8.log)("rate limited connect", void 0, {
|
|
2569
2575
|
F: __dxlog_file9,
|
|
2570
2576
|
L: 120,
|
|
2571
2577
|
S: this,
|
|
@@ -2871,7 +2877,7 @@ var TransportKind;
|
|
|
2871
2877
|
})(TransportKind || (TransportKind = {}));
|
|
2872
2878
|
var wrtc = null;
|
|
2873
2879
|
try {
|
|
2874
|
-
wrtc =
|
|
2880
|
+
wrtc = __require("@koush/wrtc");
|
|
2875
2881
|
} catch {
|
|
2876
2882
|
}
|
|
2877
2883
|
var __dxlog_file12 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/transport/simplepeer-transport.ts";
|
|
@@ -3041,8 +3047,8 @@ var SimplePeerTransport = class {
|
|
|
3041
3047
|
return {
|
|
3042
3048
|
bytesSent: stats.transport.bytesSent,
|
|
3043
3049
|
bytesReceived: stats.transport.bytesReceived,
|
|
3044
|
-
packetsSent: stats.transport.
|
|
3045
|
-
packetsReceived: stats.transport.
|
|
3050
|
+
packetsSent: stats.transport.packetsSent,
|
|
3051
|
+
packetsReceived: stats.transport.packetsReceived,
|
|
3046
3052
|
rawStats: stats.raw
|
|
3047
3053
|
};
|
|
3048
3054
|
}
|
|
@@ -3517,17 +3523,24 @@ var LibDataChannelTransport = class {
|
|
|
3517
3523
|
this._readyForCandidates = new import_async11.Trigger();
|
|
3518
3524
|
this._writeCallback = null;
|
|
3519
3525
|
this._peer = (async () => {
|
|
3520
|
-
const { RTCPeerConnection
|
|
3526
|
+
const { RTCPeerConnection } = (await importESM("node-datachannel/polyfill")).default;
|
|
3521
3527
|
if (this._closed) {
|
|
3522
3528
|
this.errors.raise(new Error("connection already closed"));
|
|
3523
3529
|
}
|
|
3524
|
-
|
|
3530
|
+
if (params.webrtcConfig) {
|
|
3531
|
+
params.webrtcConfig.iceServers = params.webrtcConfig.iceServers ?? [];
|
|
3532
|
+
} else {
|
|
3533
|
+
params.webrtcConfig = {
|
|
3534
|
+
iceServers: []
|
|
3535
|
+
};
|
|
3536
|
+
}
|
|
3537
|
+
const peer = new RTCPeerConnection(params.webrtcConfig);
|
|
3525
3538
|
peer.onicecandidateerror = (event) => {
|
|
3526
3539
|
import_log14.log.error("peer.onicecandidateerror", {
|
|
3527
3540
|
event
|
|
3528
3541
|
}, {
|
|
3529
3542
|
F: __dxlog_file15,
|
|
3530
|
-
L:
|
|
3543
|
+
L: 61,
|
|
3531
3544
|
S: this,
|
|
3532
3545
|
C: (f, a) => f(...a)
|
|
3533
3546
|
});
|
|
@@ -3539,7 +3552,7 @@ var LibDataChannelTransport = class {
|
|
|
3539
3552
|
transportConnectionState: this._connected
|
|
3540
3553
|
}, {
|
|
3541
3554
|
F: __dxlog_file15,
|
|
3542
|
-
L:
|
|
3555
|
+
L: 65,
|
|
3543
3556
|
S: this,
|
|
3544
3557
|
C: (f, a) => f(...a)
|
|
3545
3558
|
});
|
|
@@ -3549,7 +3562,7 @@ var LibDataChannelTransport = class {
|
|
|
3549
3562
|
event
|
|
3550
3563
|
}, {
|
|
3551
3564
|
F: __dxlog_file15,
|
|
3552
|
-
L:
|
|
3565
|
+
L: 74,
|
|
3553
3566
|
S: this,
|
|
3554
3567
|
C: (f, a) => f(...a)
|
|
3555
3568
|
});
|
|
@@ -3573,7 +3586,7 @@ var LibDataChannelTransport = class {
|
|
|
3573
3586
|
err
|
|
3574
3587
|
}, {
|
|
3575
3588
|
F: __dxlog_file15,
|
|
3576
|
-
L:
|
|
3589
|
+
L: 91,
|
|
3577
3590
|
S: this,
|
|
3578
3591
|
C: (f, a) => f(...a)
|
|
3579
3592
|
});
|
|
@@ -3582,12 +3595,15 @@ var LibDataChannelTransport = class {
|
|
|
3582
3595
|
};
|
|
3583
3596
|
if (params.initiator) {
|
|
3584
3597
|
peer.createOffer().then(async (offer) => {
|
|
3598
|
+
if (this._closed) {
|
|
3599
|
+
return;
|
|
3600
|
+
}
|
|
3585
3601
|
if (peer.connectionState !== "connecting") {
|
|
3586
3602
|
import_log14.log.error("i am initiator but peer not in state connecting", {
|
|
3587
3603
|
peer
|
|
3588
3604
|
}, {
|
|
3589
3605
|
F: __dxlog_file15,
|
|
3590
|
-
L:
|
|
3606
|
+
L: 104,
|
|
3591
3607
|
S: this,
|
|
3592
3608
|
C: (f, a) => f(...a)
|
|
3593
3609
|
});
|
|
@@ -3597,7 +3613,7 @@ var LibDataChannelTransport = class {
|
|
|
3597
3613
|
offer
|
|
3598
3614
|
}, {
|
|
3599
3615
|
F: __dxlog_file15,
|
|
3600
|
-
L:
|
|
3616
|
+
L: 107,
|
|
3601
3617
|
S: this,
|
|
3602
3618
|
C: (f, a) => f(...a)
|
|
3603
3619
|
});
|
|
@@ -3617,7 +3633,7 @@ var LibDataChannelTransport = class {
|
|
|
3617
3633
|
this.handleChannel(peer.createDataChannel(DATACHANNEL_LABEL));
|
|
3618
3634
|
import_log14.log.debug("created data channel", void 0, {
|
|
3619
3635
|
F: __dxlog_file15,
|
|
3620
|
-
L:
|
|
3636
|
+
L: 116,
|
|
3621
3637
|
S: this,
|
|
3622
3638
|
C: (f, a) => f(...a)
|
|
3623
3639
|
});
|
|
@@ -3630,7 +3646,7 @@ var LibDataChannelTransport = class {
|
|
|
3630
3646
|
event
|
|
3631
3647
|
}, {
|
|
3632
3648
|
F: __dxlog_file15,
|
|
3633
|
-
L:
|
|
3649
|
+
L: 122,
|
|
3634
3650
|
S: this,
|
|
3635
3651
|
C: (f, a) => f(...a)
|
|
3636
3652
|
});
|
|
@@ -3648,7 +3664,7 @@ var LibDataChannelTransport = class {
|
|
|
3648
3664
|
this._channel.onopen = () => {
|
|
3649
3665
|
import_log14.log.debug("dataChannel.onopen", void 0, {
|
|
3650
3666
|
F: __dxlog_file15,
|
|
3651
|
-
L:
|
|
3667
|
+
L: 138,
|
|
3652
3668
|
S: this,
|
|
3653
3669
|
C: (f, a) => f(...a)
|
|
3654
3670
|
});
|
|
@@ -3669,7 +3685,7 @@ var LibDataChannelTransport = class {
|
|
|
3669
3685
|
if (this._writeCallback !== null) {
|
|
3670
3686
|
import_log14.log.error("consumer trying to write before we're ready for more data", void 0, {
|
|
3671
3687
|
F: __dxlog_file15,
|
|
3672
|
-
L:
|
|
3688
|
+
L: 155,
|
|
3673
3689
|
S: this,
|
|
3674
3690
|
C: (f, a) => f(...a)
|
|
3675
3691
|
});
|
|
@@ -3694,7 +3710,7 @@ var LibDataChannelTransport = class {
|
|
|
3694
3710
|
err
|
|
3695
3711
|
}, {
|
|
3696
3712
|
F: __dxlog_file15,
|
|
3697
|
-
L:
|
|
3713
|
+
L: 175,
|
|
3698
3714
|
S: this,
|
|
3699
3715
|
C: (f, a) => f(...a)
|
|
3700
3716
|
});
|
|
@@ -3718,6 +3734,12 @@ var LibDataChannelTransport = class {
|
|
|
3718
3734
|
return;
|
|
3719
3735
|
}
|
|
3720
3736
|
await this._disconnectStreams();
|
|
3737
|
+
const peer = await this._peer;
|
|
3738
|
+
try {
|
|
3739
|
+
peer.close();
|
|
3740
|
+
} catch (err) {
|
|
3741
|
+
this.errors.raise(err);
|
|
3742
|
+
}
|
|
3721
3743
|
this._closed = true;
|
|
3722
3744
|
this.closed.emit();
|
|
3723
3745
|
}
|
|
@@ -3731,7 +3753,7 @@ var LibDataChannelTransport = class {
|
|
|
3731
3753
|
peer
|
|
3732
3754
|
}, {
|
|
3733
3755
|
F: __dxlog_file15,
|
|
3734
|
-
L:
|
|
3756
|
+
L: 216,
|
|
3735
3757
|
S: this,
|
|
3736
3758
|
C: (f, a) => f(...a)
|
|
3737
3759
|
});
|
|
@@ -3759,7 +3781,7 @@ var LibDataChannelTransport = class {
|
|
|
3759
3781
|
err
|
|
3760
3782
|
}, {
|
|
3761
3783
|
F: __dxlog_file15,
|
|
3762
|
-
L:
|
|
3784
|
+
L: 227,
|
|
3763
3785
|
S: this,
|
|
3764
3786
|
C: (f, a) => f(...a)
|
|
3765
3787
|
});
|
|
@@ -3779,7 +3801,7 @@ var LibDataChannelTransport = class {
|
|
|
3779
3801
|
err
|
|
3780
3802
|
}, {
|
|
3781
3803
|
F: __dxlog_file15,
|
|
3782
|
-
L:
|
|
3804
|
+
L: 238,
|
|
3783
3805
|
S: this,
|
|
3784
3806
|
C: (f, a) => f(...a)
|
|
3785
3807
|
});
|
|
@@ -3798,7 +3820,7 @@ var LibDataChannelTransport = class {
|
|
|
3798
3820
|
signal
|
|
3799
3821
|
}, {
|
|
3800
3822
|
F: __dxlog_file15,
|
|
3801
|
-
L:
|
|
3823
|
+
L: 249,
|
|
3802
3824
|
S: this,
|
|
3803
3825
|
C: (f, a) => f(...a)
|
|
3804
3826
|
});
|
|
@@ -3807,51 +3829,61 @@ var LibDataChannelTransport = class {
|
|
|
3807
3829
|
}).catch((err) => {
|
|
3808
3830
|
import_log14.log.catch(err, void 0, {
|
|
3809
3831
|
F: __dxlog_file15,
|
|
3810
|
-
L:
|
|
3832
|
+
L: 254,
|
|
3811
3833
|
S: this,
|
|
3812
3834
|
C: (f, a) => f(...a)
|
|
3813
3835
|
});
|
|
3814
3836
|
});
|
|
3815
3837
|
}
|
|
3816
3838
|
async getDetails() {
|
|
3839
|
+
const stats = await this._getStats();
|
|
3840
|
+
const rc = stats?.remoteCandidate;
|
|
3841
|
+
if (!rc) {
|
|
3842
|
+
return "unavailable";
|
|
3843
|
+
}
|
|
3844
|
+
if (rc.candidateType === "relay") {
|
|
3845
|
+
return `${rc.ip}:${rc.port} relay for ${rc.relatedAddress}:${rc.relatedPort}`;
|
|
3846
|
+
}
|
|
3847
|
+
return `${rc.ip}:${rc.port} ${rc.candidateType}`;
|
|
3848
|
+
}
|
|
3849
|
+
async _getStats() {
|
|
3817
3850
|
return this._peer.then(async (peer) => {
|
|
3818
|
-
const
|
|
3819
|
-
|
|
3820
|
-
|
|
3851
|
+
const stats = await peer.getStats();
|
|
3852
|
+
const statsEntries = Array.from(stats.entries());
|
|
3853
|
+
const transport = statsEntries.filter((s) => s[1].type === "transport")[0][1];
|
|
3854
|
+
const candidatePair = statsEntries.filter((s) => s[0] === transport.selectedCandidatePairId);
|
|
3855
|
+
let selectedCandidatePair;
|
|
3856
|
+
let remoteCandidate;
|
|
3857
|
+
if (candidatePair.length > 0) {
|
|
3858
|
+
selectedCandidatePair = candidatePair[0][1];
|
|
3859
|
+
remoteCandidate = statsEntries.filter((s) => s[0] === selectedCandidatePair.remoteCandidateId)[0][1];
|
|
3821
3860
|
}
|
|
3822
|
-
return
|
|
3823
|
-
|
|
3824
|
-
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
|
|
3828
|
-
C: (f, a) => f(...a)
|
|
3829
|
-
});
|
|
3830
|
-
return "unavailable";
|
|
3861
|
+
return {
|
|
3862
|
+
transport,
|
|
3863
|
+
selectedCandidatePair,
|
|
3864
|
+
remoteCandidate,
|
|
3865
|
+
raw: Object.fromEntries(stats)
|
|
3866
|
+
};
|
|
3831
3867
|
});
|
|
3832
3868
|
}
|
|
3833
3869
|
async getStats() {
|
|
3834
|
-
|
|
3835
|
-
|
|
3836
|
-
bytesSent: peer.bytesSent(),
|
|
3837
|
-
bytesReceived: peer.bytesReceived(),
|
|
3838
|
-
packetsSent: 0,
|
|
3839
|
-
packetsReceived: 0
|
|
3840
|
-
};
|
|
3841
|
-
}).catch((err) => {
|
|
3842
|
-
import_log14.log.catch(err, void 0, {
|
|
3843
|
-
F: __dxlog_file15,
|
|
3844
|
-
L: 266,
|
|
3845
|
-
S: this,
|
|
3846
|
-
C: (f, a) => f(...a)
|
|
3847
|
-
});
|
|
3870
|
+
const stats = await this._getStats();
|
|
3871
|
+
if (!stats) {
|
|
3848
3872
|
return {
|
|
3849
3873
|
bytesSent: 0,
|
|
3850
3874
|
bytesReceived: 0,
|
|
3851
3875
|
packetsSent: 0,
|
|
3852
|
-
packetsReceived: 0
|
|
3876
|
+
packetsReceived: 0,
|
|
3877
|
+
rawStats: {}
|
|
3853
3878
|
};
|
|
3854
|
-
}
|
|
3879
|
+
}
|
|
3880
|
+
return {
|
|
3881
|
+
bytesSent: stats.transport.bytesSent,
|
|
3882
|
+
bytesReceived: stats.transport.bytesReceived,
|
|
3883
|
+
packetsSent: 0,
|
|
3884
|
+
packetsReceived: 0,
|
|
3885
|
+
rawStats: stats.raw
|
|
3886
|
+
};
|
|
3855
3887
|
}
|
|
3856
3888
|
// TODO(nf): add classmethod to call node-datachannel.cleanup() when all instances have been destroyed?
|
|
3857
3889
|
async destroy() {
|
|
@@ -3870,6 +3902,7 @@ var createLibDataChannelTransportFactory = (webrtcConfig) => ({
|
|
|
3870
3902
|
webrtcConfig
|
|
3871
3903
|
})
|
|
3872
3904
|
});
|
|
3905
|
+
var importESM = Function("path", "return import(path)");
|
|
3873
3906
|
var __dxlog_file16 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/transport/tcp-transport.ts";
|
|
3874
3907
|
var TcpTransportFactory = {
|
|
3875
3908
|
createTransport: (params) => new TcpTransport(params)
|
|
@@ -4057,4 +4090,4 @@ var createTeleportProtocolFactory = (onConnection) => {
|
|
|
4057
4090
|
createSimplePeerTransportFactory,
|
|
4058
4091
|
createTeleportProtocolFactory
|
|
4059
4092
|
});
|
|
4060
|
-
//# sourceMappingURL=chunk-
|
|
4093
|
+
//# sourceMappingURL=chunk-Y2B5BDRH.cjs.map
|