@dxos/network-manager 0.3.9-main.4e30508 → 0.3.9-main.4e39f3a
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-J7KS7JMZ.mjs → chunk-6B4JGIV2.mjs} +101 -63
- package/dist/lib/browser/chunk-6B4JGIV2.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 +3 -3
- package/dist/lib/node/{chunk-55WTPQV5.cjs → chunk-Y2B5BDRH.cjs} +97 -65
- 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/dist/types/src/transport/simplepeer-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 +4 -5
- package/dist/lib/browser/chunk-J7KS7JMZ.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-55WTPQV5.cjs.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/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
|
@@ -1,7 +1,18 @@
|
|
|
1
1
|
import "@dxos/node-std/globals";
|
|
2
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
3
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
4
|
+
}) : x)(function(x) {
|
|
5
|
+
if (typeof require !== "undefined")
|
|
6
|
+
return require.apply(this, arguments);
|
|
7
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
// inject-globals:@inject-globals
|
|
2
11
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
12
|
+
global,
|
|
13
|
+
Buffer as Buffer2,
|
|
14
|
+
process
|
|
15
|
+
} from "@dxos/node-std/inject-globals";
|
|
5
16
|
|
|
6
17
|
// packages/core/mesh/network-manager/src/swarm/connection.ts
|
|
7
18
|
import { DeferredTask, Event, sleep, scheduleTask, scheduleTaskInterval, synchronized } from "@dxos/async";
|
|
@@ -2383,7 +2394,7 @@ var MMSTTopology = class {
|
|
|
2383
2394
|
});
|
|
2384
2395
|
const { connected, candidates } = this._controller.getState();
|
|
2385
2396
|
if (this._sampleCollected || connected.length > this._maxPeers || candidates.length > 0) {
|
|
2386
|
-
log8
|
|
2397
|
+
log8("Running the algorithm.", void 0, {
|
|
2387
2398
|
F: __dxlog_file9,
|
|
2388
2399
|
L: 60,
|
|
2389
2400
|
S: this,
|
|
@@ -2427,7 +2438,7 @@ var MMSTTopology = class {
|
|
|
2427
2438
|
});
|
|
2428
2439
|
const { connected, candidates, ownPeerId } = this._controller.getState();
|
|
2429
2440
|
if (connected.length > this._maxPeers) {
|
|
2430
|
-
log8
|
|
2441
|
+
log8(`disconnect ${connected.length - this._maxPeers} peers.`, void 0, {
|
|
2431
2442
|
F: __dxlog_file9,
|
|
2432
2443
|
L: 85,
|
|
2433
2444
|
S: this,
|
|
@@ -2453,7 +2464,7 @@ var MMSTTopology = class {
|
|
|
2453
2464
|
}
|
|
2454
2465
|
if (Date.now() - this._lastAction.getTime() > MIN_UPDATE_INTERVAL) {
|
|
2455
2466
|
for (const peer of sorted.slice(0, MAX_CHANGES_PER_UPDATE)) {
|
|
2456
|
-
log8
|
|
2467
|
+
log8(`Disconnect ${peer}.`, void 0, {
|
|
2457
2468
|
F: __dxlog_file9,
|
|
2458
2469
|
L: 97,
|
|
2459
2470
|
S: this,
|
|
@@ -2463,7 +2474,7 @@ var MMSTTopology = class {
|
|
|
2463
2474
|
}
|
|
2464
2475
|
this._lastAction = /* @__PURE__ */ new Date();
|
|
2465
2476
|
} else {
|
|
2466
|
-
log8
|
|
2477
|
+
log8("rate limited discconnect", void 0, {
|
|
2467
2478
|
F: __dxlog_file9,
|
|
2468
2479
|
L: 102,
|
|
2469
2480
|
S: this,
|
|
@@ -2471,7 +2482,7 @@ var MMSTTopology = class {
|
|
|
2471
2482
|
});
|
|
2472
2483
|
}
|
|
2473
2484
|
} else if (connected.length < this._originateConnections) {
|
|
2474
|
-
log8
|
|
2485
|
+
log8(`connect ${this._originateConnections - connected.length} peers.`, void 0, {
|
|
2475
2486
|
F: __dxlog_file9,
|
|
2476
2487
|
L: 106,
|
|
2477
2488
|
S: this,
|
|
@@ -2489,7 +2500,7 @@ var MMSTTopology = class {
|
|
|
2489
2500
|
}
|
|
2490
2501
|
if (Date.now() - this._lastAction.getTime() > MIN_UPDATE_INTERVAL) {
|
|
2491
2502
|
for (const peer of sorted.slice(0, MAX_CHANGES_PER_UPDATE)) {
|
|
2492
|
-
log8
|
|
2503
|
+
log8(`Connect ${peer}.`, void 0, {
|
|
2493
2504
|
F: __dxlog_file9,
|
|
2494
2505
|
L: 115,
|
|
2495
2506
|
S: this,
|
|
@@ -2499,7 +2510,7 @@ var MMSTTopology = class {
|
|
|
2499
2510
|
}
|
|
2500
2511
|
this._lastAction = /* @__PURE__ */ new Date();
|
|
2501
2512
|
} else {
|
|
2502
|
-
log8
|
|
2513
|
+
log8("rate limited connect", void 0, {
|
|
2503
2514
|
F: __dxlog_file9,
|
|
2504
2515
|
L: 120,
|
|
2505
2516
|
S: this,
|
|
@@ -3004,8 +3015,8 @@ var SimplePeerTransport = class {
|
|
|
3004
3015
|
return {
|
|
3005
3016
|
bytesSent: stats.transport.bytesSent,
|
|
3006
3017
|
bytesReceived: stats.transport.bytesReceived,
|
|
3007
|
-
packetsSent: stats.transport.
|
|
3008
|
-
packetsReceived: stats.transport.
|
|
3018
|
+
packetsSent: stats.transport.packetsSent,
|
|
3019
|
+
packetsReceived: stats.transport.packetsReceived,
|
|
3009
3020
|
rawStats: stats.raw
|
|
3010
3021
|
};
|
|
3011
3022
|
}
|
|
@@ -3038,8 +3049,8 @@ var SimplePeerTransport = class {
|
|
|
3038
3049
|
if (!rc) {
|
|
3039
3050
|
return "unavailable";
|
|
3040
3051
|
}
|
|
3041
|
-
if (rc.relay) {
|
|
3042
|
-
return `${rc.ip}:${rc.port}/${rc.protocol} relay for
|
|
3052
|
+
if (rc.candidateType === "relay") {
|
|
3053
|
+
return `${rc.ip}:${rc.port}/${rc.protocol} relay for ${rc.relatedAddress}:${rc.relatedPort}`;
|
|
3043
3054
|
}
|
|
3044
3055
|
return `${rc.ip}:${rc.port}/${rc.protocol} ${rc.candidateType}`;
|
|
3045
3056
|
}
|
|
@@ -3053,14 +3064,13 @@ var SimplePeerTransport = class {
|
|
|
3053
3064
|
if (this._closed) {
|
|
3054
3065
|
return;
|
|
3055
3066
|
}
|
|
3056
|
-
this._closed = true;
|
|
3057
3067
|
this._disconnectStreams();
|
|
3058
3068
|
this._peer.destroy();
|
|
3059
3069
|
this._closed = true;
|
|
3060
3070
|
this.closed.emit();
|
|
3061
3071
|
log11("closed", void 0, {
|
|
3062
3072
|
F: __dxlog_file12,
|
|
3063
|
-
L:
|
|
3073
|
+
L: 200,
|
|
3064
3074
|
S: this,
|
|
3065
3075
|
C: (f, a) => f(...a)
|
|
3066
3076
|
});
|
|
@@ -3508,17 +3518,24 @@ var LibDataChannelTransport = class {
|
|
|
3508
3518
|
this._readyForCandidates = new Trigger2();
|
|
3509
3519
|
this._writeCallback = null;
|
|
3510
3520
|
this._peer = (async () => {
|
|
3511
|
-
const { RTCPeerConnection
|
|
3521
|
+
const { RTCPeerConnection } = (await importESM("node-datachannel/polyfill")).default;
|
|
3512
3522
|
if (this._closed) {
|
|
3513
3523
|
this.errors.raise(new Error("connection already closed"));
|
|
3514
3524
|
}
|
|
3515
|
-
|
|
3525
|
+
if (params.webrtcConfig) {
|
|
3526
|
+
params.webrtcConfig.iceServers = params.webrtcConfig.iceServers ?? [];
|
|
3527
|
+
} else {
|
|
3528
|
+
params.webrtcConfig = {
|
|
3529
|
+
iceServers: []
|
|
3530
|
+
};
|
|
3531
|
+
}
|
|
3532
|
+
const peer = new RTCPeerConnection(params.webrtcConfig);
|
|
3516
3533
|
peer.onicecandidateerror = (event) => {
|
|
3517
3534
|
log14.error("peer.onicecandidateerror", {
|
|
3518
3535
|
event
|
|
3519
3536
|
}, {
|
|
3520
3537
|
F: __dxlog_file15,
|
|
3521
|
-
L:
|
|
3538
|
+
L: 61,
|
|
3522
3539
|
S: this,
|
|
3523
3540
|
C: (f, a) => f(...a)
|
|
3524
3541
|
});
|
|
@@ -3530,7 +3547,7 @@ var LibDataChannelTransport = class {
|
|
|
3530
3547
|
transportConnectionState: this._connected
|
|
3531
3548
|
}, {
|
|
3532
3549
|
F: __dxlog_file15,
|
|
3533
|
-
L:
|
|
3550
|
+
L: 65,
|
|
3534
3551
|
S: this,
|
|
3535
3552
|
C: (f, a) => f(...a)
|
|
3536
3553
|
});
|
|
@@ -3540,7 +3557,7 @@ var LibDataChannelTransport = class {
|
|
|
3540
3557
|
event
|
|
3541
3558
|
}, {
|
|
3542
3559
|
F: __dxlog_file15,
|
|
3543
|
-
L:
|
|
3560
|
+
L: 74,
|
|
3544
3561
|
S: this,
|
|
3545
3562
|
C: (f, a) => f(...a)
|
|
3546
3563
|
});
|
|
@@ -3564,7 +3581,7 @@ var LibDataChannelTransport = class {
|
|
|
3564
3581
|
err
|
|
3565
3582
|
}, {
|
|
3566
3583
|
F: __dxlog_file15,
|
|
3567
|
-
L:
|
|
3584
|
+
L: 91,
|
|
3568
3585
|
S: this,
|
|
3569
3586
|
C: (f, a) => f(...a)
|
|
3570
3587
|
});
|
|
@@ -3573,12 +3590,15 @@ var LibDataChannelTransport = class {
|
|
|
3573
3590
|
};
|
|
3574
3591
|
if (params.initiator) {
|
|
3575
3592
|
peer.createOffer().then(async (offer) => {
|
|
3593
|
+
if (this._closed) {
|
|
3594
|
+
return;
|
|
3595
|
+
}
|
|
3576
3596
|
if (peer.connectionState !== "connecting") {
|
|
3577
3597
|
log14.error("i am initiator but peer not in state connecting", {
|
|
3578
3598
|
peer
|
|
3579
3599
|
}, {
|
|
3580
3600
|
F: __dxlog_file15,
|
|
3581
|
-
L:
|
|
3601
|
+
L: 104,
|
|
3582
3602
|
S: this,
|
|
3583
3603
|
C: (f, a) => f(...a)
|
|
3584
3604
|
});
|
|
@@ -3588,7 +3608,7 @@ var LibDataChannelTransport = class {
|
|
|
3588
3608
|
offer
|
|
3589
3609
|
}, {
|
|
3590
3610
|
F: __dxlog_file15,
|
|
3591
|
-
L:
|
|
3611
|
+
L: 107,
|
|
3592
3612
|
S: this,
|
|
3593
3613
|
C: (f, a) => f(...a)
|
|
3594
3614
|
});
|
|
@@ -3608,7 +3628,7 @@ var LibDataChannelTransport = class {
|
|
|
3608
3628
|
this.handleChannel(peer.createDataChannel(DATACHANNEL_LABEL));
|
|
3609
3629
|
log14.debug("created data channel", void 0, {
|
|
3610
3630
|
F: __dxlog_file15,
|
|
3611
|
-
L:
|
|
3631
|
+
L: 116,
|
|
3612
3632
|
S: this,
|
|
3613
3633
|
C: (f, a) => f(...a)
|
|
3614
3634
|
});
|
|
@@ -3621,7 +3641,7 @@ var LibDataChannelTransport = class {
|
|
|
3621
3641
|
event
|
|
3622
3642
|
}, {
|
|
3623
3643
|
F: __dxlog_file15,
|
|
3624
|
-
L:
|
|
3644
|
+
L: 122,
|
|
3625
3645
|
S: this,
|
|
3626
3646
|
C: (f, a) => f(...a)
|
|
3627
3647
|
});
|
|
@@ -3639,7 +3659,7 @@ var LibDataChannelTransport = class {
|
|
|
3639
3659
|
this._channel.onopen = () => {
|
|
3640
3660
|
log14.debug("dataChannel.onopen", void 0, {
|
|
3641
3661
|
F: __dxlog_file15,
|
|
3642
|
-
L:
|
|
3662
|
+
L: 138,
|
|
3643
3663
|
S: this,
|
|
3644
3664
|
C: (f, a) => f(...a)
|
|
3645
3665
|
});
|
|
@@ -3660,7 +3680,7 @@ var LibDataChannelTransport = class {
|
|
|
3660
3680
|
if (this._writeCallback !== null) {
|
|
3661
3681
|
log14.error("consumer trying to write before we're ready for more data", void 0, {
|
|
3662
3682
|
F: __dxlog_file15,
|
|
3663
|
-
L:
|
|
3683
|
+
L: 155,
|
|
3664
3684
|
S: this,
|
|
3665
3685
|
C: (f, a) => f(...a)
|
|
3666
3686
|
});
|
|
@@ -3685,7 +3705,7 @@ var LibDataChannelTransport = class {
|
|
|
3685
3705
|
err
|
|
3686
3706
|
}, {
|
|
3687
3707
|
F: __dxlog_file15,
|
|
3688
|
-
L:
|
|
3708
|
+
L: 175,
|
|
3689
3709
|
S: this,
|
|
3690
3710
|
C: (f, a) => f(...a)
|
|
3691
3711
|
});
|
|
@@ -3694,7 +3714,7 @@ var LibDataChannelTransport = class {
|
|
|
3694
3714
|
this._channel.onmessage = (event) => {
|
|
3695
3715
|
let data = event.data;
|
|
3696
3716
|
if (data instanceof ArrayBuffer) {
|
|
3697
|
-
data =
|
|
3717
|
+
data = Buffer2.from(data);
|
|
3698
3718
|
}
|
|
3699
3719
|
this._stream.push(data);
|
|
3700
3720
|
};
|
|
@@ -3709,6 +3729,12 @@ var LibDataChannelTransport = class {
|
|
|
3709
3729
|
return;
|
|
3710
3730
|
}
|
|
3711
3731
|
await this._disconnectStreams();
|
|
3732
|
+
const peer = await this._peer;
|
|
3733
|
+
try {
|
|
3734
|
+
peer.close();
|
|
3735
|
+
} catch (err) {
|
|
3736
|
+
this.errors.raise(err);
|
|
3737
|
+
}
|
|
3712
3738
|
this._closed = true;
|
|
3713
3739
|
this.closed.emit();
|
|
3714
3740
|
}
|
|
@@ -3722,7 +3748,7 @@ var LibDataChannelTransport = class {
|
|
|
3722
3748
|
peer
|
|
3723
3749
|
}, {
|
|
3724
3750
|
F: __dxlog_file15,
|
|
3725
|
-
L:
|
|
3751
|
+
L: 216,
|
|
3726
3752
|
S: this,
|
|
3727
3753
|
C: (f, a) => f(...a)
|
|
3728
3754
|
});
|
|
@@ -3750,7 +3776,7 @@ var LibDataChannelTransport = class {
|
|
|
3750
3776
|
err
|
|
3751
3777
|
}, {
|
|
3752
3778
|
F: __dxlog_file15,
|
|
3753
|
-
L:
|
|
3779
|
+
L: 227,
|
|
3754
3780
|
S: this,
|
|
3755
3781
|
C: (f, a) => f(...a)
|
|
3756
3782
|
});
|
|
@@ -3770,7 +3796,7 @@ var LibDataChannelTransport = class {
|
|
|
3770
3796
|
err
|
|
3771
3797
|
}, {
|
|
3772
3798
|
F: __dxlog_file15,
|
|
3773
|
-
L:
|
|
3799
|
+
L: 238,
|
|
3774
3800
|
S: this,
|
|
3775
3801
|
C: (f, a) => f(...a)
|
|
3776
3802
|
});
|
|
@@ -3789,7 +3815,7 @@ var LibDataChannelTransport = class {
|
|
|
3789
3815
|
signal
|
|
3790
3816
|
}, {
|
|
3791
3817
|
F: __dxlog_file15,
|
|
3792
|
-
L:
|
|
3818
|
+
L: 249,
|
|
3793
3819
|
S: this,
|
|
3794
3820
|
C: (f, a) => f(...a)
|
|
3795
3821
|
});
|
|
@@ -3798,51 +3824,61 @@ var LibDataChannelTransport = class {
|
|
|
3798
3824
|
}).catch((err) => {
|
|
3799
3825
|
log14.catch(err, void 0, {
|
|
3800
3826
|
F: __dxlog_file15,
|
|
3801
|
-
L:
|
|
3827
|
+
L: 254,
|
|
3802
3828
|
S: this,
|
|
3803
3829
|
C: (f, a) => f(...a)
|
|
3804
3830
|
});
|
|
3805
3831
|
});
|
|
3806
3832
|
}
|
|
3807
3833
|
async getDetails() {
|
|
3834
|
+
const stats = await this._getStats();
|
|
3835
|
+
const rc = stats?.remoteCandidate;
|
|
3836
|
+
if (!rc) {
|
|
3837
|
+
return "unavailable";
|
|
3838
|
+
}
|
|
3839
|
+
if (rc.candidateType === "relay") {
|
|
3840
|
+
return `${rc.ip}:${rc.port} relay for ${rc.relatedAddress}:${rc.relatedPort}`;
|
|
3841
|
+
}
|
|
3842
|
+
return `${rc.ip}:${rc.port} ${rc.candidateType}`;
|
|
3843
|
+
}
|
|
3844
|
+
async _getStats() {
|
|
3808
3845
|
return this._peer.then(async (peer) => {
|
|
3809
|
-
const
|
|
3810
|
-
|
|
3811
|
-
|
|
3846
|
+
const stats = await peer.getStats();
|
|
3847
|
+
const statsEntries = Array.from(stats.entries());
|
|
3848
|
+
const transport = statsEntries.filter((s) => s[1].type === "transport")[0][1];
|
|
3849
|
+
const candidatePair = statsEntries.filter((s) => s[0] === transport.selectedCandidatePairId);
|
|
3850
|
+
let selectedCandidatePair;
|
|
3851
|
+
let remoteCandidate;
|
|
3852
|
+
if (candidatePair.length > 0) {
|
|
3853
|
+
selectedCandidatePair = candidatePair[0][1];
|
|
3854
|
+
remoteCandidate = statsEntries.filter((s) => s[0] === selectedCandidatePair.remoteCandidateId)[0][1];
|
|
3812
3855
|
}
|
|
3813
|
-
return
|
|
3814
|
-
|
|
3815
|
-
|
|
3816
|
-
|
|
3817
|
-
|
|
3818
|
-
|
|
3819
|
-
C: (f, a) => f(...a)
|
|
3820
|
-
});
|
|
3821
|
-
return "unavailable";
|
|
3856
|
+
return {
|
|
3857
|
+
transport,
|
|
3858
|
+
selectedCandidatePair,
|
|
3859
|
+
remoteCandidate,
|
|
3860
|
+
raw: Object.fromEntries(stats)
|
|
3861
|
+
};
|
|
3822
3862
|
});
|
|
3823
3863
|
}
|
|
3824
3864
|
async getStats() {
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
bytesSent: peer.bytesSent(),
|
|
3828
|
-
bytesReceived: peer.bytesReceived(),
|
|
3829
|
-
packetsSent: 0,
|
|
3830
|
-
packetsReceived: 0
|
|
3831
|
-
};
|
|
3832
|
-
}).catch((err) => {
|
|
3833
|
-
log14.catch(err, void 0, {
|
|
3834
|
-
F: __dxlog_file15,
|
|
3835
|
-
L: 266,
|
|
3836
|
-
S: this,
|
|
3837
|
-
C: (f, a) => f(...a)
|
|
3838
|
-
});
|
|
3865
|
+
const stats = await this._getStats();
|
|
3866
|
+
if (!stats) {
|
|
3839
3867
|
return {
|
|
3840
3868
|
bytesSent: 0,
|
|
3841
3869
|
bytesReceived: 0,
|
|
3842
3870
|
packetsSent: 0,
|
|
3843
|
-
packetsReceived: 0
|
|
3871
|
+
packetsReceived: 0,
|
|
3872
|
+
rawStats: {}
|
|
3844
3873
|
};
|
|
3845
|
-
}
|
|
3874
|
+
}
|
|
3875
|
+
return {
|
|
3876
|
+
bytesSent: stats.transport.bytesSent,
|
|
3877
|
+
bytesReceived: stats.transport.bytesReceived,
|
|
3878
|
+
packetsSent: 0,
|
|
3879
|
+
packetsReceived: 0,
|
|
3880
|
+
rawStats: stats.raw
|
|
3881
|
+
};
|
|
3846
3882
|
}
|
|
3847
3883
|
// TODO(nf): add classmethod to call node-datachannel.cleanup() when all instances have been destroyed?
|
|
3848
3884
|
async destroy() {
|
|
@@ -3861,6 +3897,7 @@ var createLibDataChannelTransportFactory = (webrtcConfig) => ({
|
|
|
3861
3897
|
webrtcConfig
|
|
3862
3898
|
})
|
|
3863
3899
|
});
|
|
3900
|
+
var importESM = Function("path", "return import(path)");
|
|
3864
3901
|
|
|
3865
3902
|
// packages/core/mesh/network-manager/src/transport/tcp-transport.browser.ts
|
|
3866
3903
|
import { Event as Event11 } from "@dxos/async";
|
|
@@ -3910,6 +3947,7 @@ var createTeleportProtocolFactory = (onConnection) => {
|
|
|
3910
3947
|
};
|
|
3911
3948
|
|
|
3912
3949
|
export {
|
|
3950
|
+
process,
|
|
3913
3951
|
ConnectionState,
|
|
3914
3952
|
Connection,
|
|
3915
3953
|
SwarmMessenger,
|
|
@@ -3937,4 +3975,4 @@ export {
|
|
|
3937
3975
|
TcpTransport,
|
|
3938
3976
|
createTeleportProtocolFactory
|
|
3939
3977
|
};
|
|
3940
|
-
//# sourceMappingURL=chunk-
|
|
3978
|
+
//# sourceMappingURL=chunk-6B4JGIV2.mjs.map
|