@dxos/network-manager 0.3.9-main.b7e6a67 → 0.3.9-main.c7cd0ec
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-LA2ACGLR.mjs → chunk-XF474R3E.mjs} +434 -116
- package/dist/lib/browser/chunk-XF474R3E.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-QWUG7JSH.cjs → chunk-Y2B5BDRH.cjs} +426 -104
- 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/connection-log.d.ts.map +1 -1
- package/dist/types/src/swarm/connection.d.ts +4 -1
- package/dist/types/src/swarm/connection.d.ts.map +1 -1
- package/dist/types/src/topology/mmst-topology.d.ts +1 -0
- package/dist/types/src/topology/mmst-topology.d.ts.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 +4 -1
- package/dist/types/src/transport/libdatachannel-transport.d.ts.map +1 -1
- package/dist/types/src/transport/memory-transport.d.ts +3 -1
- package/dist/types/src/transport/memory-transport.d.ts.map +1 -1
- package/dist/types/src/transport/simplepeer-transport-proxy.d.ts +3 -1
- package/dist/types/src/transport/simplepeer-transport-proxy.d.ts.map +1 -1
- package/dist/types/src/transport/simplepeer-transport-service.d.ts +3 -1
- package/dist/types/src/transport/simplepeer-transport-service.d.ts.map +1 -1
- package/dist/types/src/transport/simplepeer-transport.d.ts +7 -1
- package/dist/types/src/transport/simplepeer-transport.d.ts.map +1 -1
- package/dist/types/src/transport/tcp-transport.browser.d.ts +3 -1
- package/dist/types/src/transport/tcp-transport.browser.d.ts.map +1 -1
- package/dist/types/src/transport/tcp-transport.d.ts +3 -1
- package/dist/types/src/transport/tcp-transport.d.ts.map +1 -1
- package/dist/types/src/transport/transport.d.ts +17 -0
- package/dist/types/src/transport/transport.d.ts.map +1 -1
- package/dist/types/src/wire-protocol.d.ts +1 -1
- package/dist/types/src/wire-protocol.d.ts.map +1 -1
- package/package.json +18 -18
- package/src/connection-log.ts +14 -1
- package/src/swarm/connection.ts +40 -6
- package/src/topology/mmst-topology.ts +34 -6
- package/src/transport/index.ts +0 -1
- package/src/transport/libdatachannel-transport.test.ts +0 -4
- package/src/transport/libdatachannel-transport.ts +90 -8
- package/src/transport/memory-transport.ts +14 -1
- package/src/transport/simplepeer-transport-proxy.ts +9 -1
- package/src/transport/simplepeer-transport-service.ts +14 -0
- package/src/transport/simplepeer-transport.ts +70 -4
- package/src/transport/tcp-transport.browser.ts +9 -1
- package/src/transport/tcp-transport.ts +19 -1
- package/src/transport/transport.ts +19 -0
- package/src/wire-protocol.ts +3 -3
- package/dist/lib/browser/chunk-LA2ACGLR.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-QWUG7JSH.cjs.map +0 -7
- package/dist/lib/node/chunk-XE5JOIGD.cjs +0 -462
- package/dist/lib/node/chunk-XE5JOIGD.cjs.map +0 -7
- package/dist/lib/node/datachannel-53JZPGFA.cjs +0 -35
- package/dist/lib/node/datachannel-53JZPGFA.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 -47
- 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 -347
- 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_QWUG7JSH_exports, {
|
|
|
55
55
|
createSimplePeerTransportFactory: () => createSimplePeerTransportFactory,
|
|
56
56
|
createTeleportProtocolFactory: () => createTeleportProtocolFactory
|
|
57
57
|
});
|
|
58
|
-
module.exports = __toCommonJS(
|
|
59
|
-
var import_chunk_XE5JOIGD = require("./chunk-XE5JOIGD.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")
|
|
@@ -166,6 +172,7 @@ function _ts_decorate(decorators, target, key, desc) {
|
|
|
166
172
|
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/swarm/connection.ts";
|
|
167
173
|
var STARTING_SIGNALLING_DELAY = 10;
|
|
168
174
|
var TRANSPORT_CONNECTION_TIMEOUT = 1e4;
|
|
175
|
+
var TRANSPORT_STATS_INTERVAL = 5e3;
|
|
169
176
|
var MAX_SIGNALLING_DELAY = 300;
|
|
170
177
|
var ConnectionState;
|
|
171
178
|
(function(ConnectionState5) {
|
|
@@ -228,6 +235,7 @@ var Connection = class {
|
|
|
228
235
|
this.stateChanged = new import_async.Event();
|
|
229
236
|
this.errors = new import_debug.ErrorStream();
|
|
230
237
|
this._instanceId = import_keys.PublicKey.random().toHex();
|
|
238
|
+
this.transportStats = new import_async.Event();
|
|
231
239
|
this._signalSendTask = new import_async.DeferredTask(this._ctx, async () => {
|
|
232
240
|
await this._flushSignalBuffer();
|
|
233
241
|
});
|
|
@@ -240,11 +248,14 @@ var Connection = class {
|
|
|
240
248
|
initiator: this.initiator
|
|
241
249
|
}, {
|
|
242
250
|
F: __dxlog_file,
|
|
243
|
-
L:
|
|
251
|
+
L: 134,
|
|
244
252
|
S: this,
|
|
245
253
|
C: (f, a) => f(...a)
|
|
246
254
|
});
|
|
247
255
|
}
|
|
256
|
+
get sessionIdString() {
|
|
257
|
+
return this.sessionId.truncate();
|
|
258
|
+
}
|
|
248
259
|
get state() {
|
|
249
260
|
return this._state;
|
|
250
261
|
}
|
|
@@ -260,7 +271,7 @@ var Connection = class {
|
|
|
260
271
|
async openConnection() {
|
|
261
272
|
(0, import_invariant.invariant)(this._state === ConnectionState.INITIAL, "Invalid state.", {
|
|
262
273
|
F: __dxlog_file,
|
|
263
|
-
L:
|
|
274
|
+
L: 164,
|
|
264
275
|
S: this,
|
|
265
276
|
A: [
|
|
266
277
|
"this._state === ConnectionState.INITIAL",
|
|
@@ -271,7 +282,7 @@ var Connection = class {
|
|
|
271
282
|
id: this._instanceId
|
|
272
283
|
}), {
|
|
273
284
|
F: __dxlog_file,
|
|
274
|
-
L:
|
|
285
|
+
L: 165,
|
|
275
286
|
S: this,
|
|
276
287
|
C: (f, a) => f(...a)
|
|
277
288
|
});
|
|
@@ -283,35 +294,35 @@ var Connection = class {
|
|
|
283
294
|
initiator: this.initiator
|
|
284
295
|
}, {
|
|
285
296
|
F: __dxlog_file,
|
|
286
|
-
L:
|
|
297
|
+
L: 166,
|
|
287
298
|
S: this,
|
|
288
299
|
C: (f, a) => f(...a)
|
|
289
300
|
});
|
|
290
301
|
this._changeState(ConnectionState.CONNECTING);
|
|
291
|
-
this._protocol.open().catch((err) => {
|
|
302
|
+
this._protocol.open(this.sessionId).catch((err) => {
|
|
292
303
|
this.errors.raise(err);
|
|
293
304
|
});
|
|
294
305
|
this._protocol.stream.on("close", () => {
|
|
295
306
|
(0, import_log.log)("protocol stream closed", void 0, {
|
|
296
307
|
F: __dxlog_file,
|
|
297
|
-
L:
|
|
308
|
+
L: 183,
|
|
298
309
|
S: this,
|
|
299
310
|
C: (f, a) => f(...a)
|
|
300
311
|
});
|
|
301
312
|
this.close(new import_protocols.ProtocolError("protocol stream closed")).catch((err) => this.errors.raise(err));
|
|
302
313
|
});
|
|
303
314
|
(0, import_async.scheduleTask)(this.connectedTimeoutContext, async () => {
|
|
304
|
-
import_log.log.info(
|
|
315
|
+
import_log.log.info(`timeout waiting ${TRANSPORT_CONNECTION_TIMEOUT / 1e3}s for transport to connect, aborting`, void 0, {
|
|
305
316
|
F: __dxlog_file,
|
|
306
|
-
L:
|
|
317
|
+
L: 190,
|
|
307
318
|
S: this,
|
|
308
319
|
C: (f, a) => f(...a)
|
|
309
320
|
});
|
|
310
|
-
await this.abort().catch((err) => this.errors.raise(err));
|
|
321
|
+
await this.abort(new import_protocols.TimeoutError(`${TRANSPORT_CONNECTION_TIMEOUT / 1e3}s for transport to connect`)).catch((err) => this.errors.raise(err));
|
|
311
322
|
}, TRANSPORT_CONNECTION_TIMEOUT);
|
|
312
323
|
(0, import_invariant.invariant)(!this._transport, void 0, {
|
|
313
324
|
F: __dxlog_file,
|
|
314
|
-
L:
|
|
325
|
+
L: 198,
|
|
315
326
|
S: this,
|
|
316
327
|
A: [
|
|
317
328
|
"!this._transport",
|
|
@@ -321,18 +332,20 @@ var Connection = class {
|
|
|
321
332
|
this._transport = this._transportFactory.createTransport({
|
|
322
333
|
initiator: this.initiator,
|
|
323
334
|
stream: this._protocol.stream,
|
|
324
|
-
sendSignal: async (signal) => this._sendSignal(signal)
|
|
335
|
+
sendSignal: async (signal) => this._sendSignal(signal),
|
|
336
|
+
sessionId: this.sessionId
|
|
325
337
|
});
|
|
326
338
|
this._transport.connected.once(async () => {
|
|
327
339
|
this._changeState(ConnectionState.CONNECTED);
|
|
328
340
|
await this.connectedTimeoutContext.dispose();
|
|
329
341
|
this._callbacks?.onConnected?.();
|
|
342
|
+
(0, import_async.scheduleTaskInterval)(this._ctx, async () => this._emitTransportStats(), TRANSPORT_STATS_INTERVAL);
|
|
330
343
|
});
|
|
331
344
|
this._transport.closed.once(() => {
|
|
332
345
|
this._transport = void 0;
|
|
333
346
|
(0, import_log.log)("abort triggered by transport close", void 0, {
|
|
334
347
|
F: __dxlog_file,
|
|
335
|
-
L:
|
|
348
|
+
L: 216,
|
|
336
349
|
S: this,
|
|
337
350
|
C: (f, a) => f(...a)
|
|
338
351
|
});
|
|
@@ -343,7 +356,7 @@ var Connection = class {
|
|
|
343
356
|
err
|
|
344
357
|
}, {
|
|
345
358
|
F: __dxlog_file,
|
|
346
|
-
L:
|
|
359
|
+
L: 221,
|
|
347
360
|
S: this,
|
|
348
361
|
C: (f, a) => f(...a)
|
|
349
362
|
});
|
|
@@ -353,7 +366,7 @@ var Connection = class {
|
|
|
353
366
|
if (err instanceof import_protocols.ConnectionResetError) {
|
|
354
367
|
import_log.log.info("aborting due to transport ConnectionResetError", void 0, {
|
|
355
368
|
F: __dxlog_file,
|
|
356
|
-
L:
|
|
369
|
+
L: 228,
|
|
357
370
|
S: this,
|
|
358
371
|
C: (f, a) => f(...a)
|
|
359
372
|
});
|
|
@@ -361,7 +374,7 @@ var Connection = class {
|
|
|
361
374
|
} else if (err instanceof import_protocols.ConnectivityError) {
|
|
362
375
|
import_log.log.info("aborting due to transport ConnectivityError", void 0, {
|
|
363
376
|
F: __dxlog_file,
|
|
364
|
-
L:
|
|
377
|
+
L: 231,
|
|
365
378
|
S: this,
|
|
366
379
|
C: (f, a) => f(...a)
|
|
367
380
|
});
|
|
@@ -371,7 +384,7 @@ var Connection = class {
|
|
|
371
384
|
err
|
|
372
385
|
}, {
|
|
373
386
|
F: __dxlog_file,
|
|
374
|
-
L:
|
|
387
|
+
L: 234,
|
|
375
388
|
S: this,
|
|
376
389
|
C: (f, a) => f(...a)
|
|
377
390
|
});
|
|
@@ -389,7 +402,7 @@ var Connection = class {
|
|
|
389
402
|
id: this._instanceId
|
|
390
403
|
}), {
|
|
391
404
|
F: __dxlog_file,
|
|
392
|
-
L:
|
|
405
|
+
L: 250,
|
|
393
406
|
S: this,
|
|
394
407
|
C: (f, a) => f(...a)
|
|
395
408
|
});
|
|
@@ -399,14 +412,14 @@ var Connection = class {
|
|
|
399
412
|
err
|
|
400
413
|
}, {
|
|
401
414
|
F: __dxlog_file,
|
|
402
|
-
L:
|
|
415
|
+
L: 257,
|
|
403
416
|
S: this,
|
|
404
417
|
C: (f, a) => f(...a)
|
|
405
418
|
});
|
|
406
419
|
if (this._state === ConnectionState.CLOSED || this._state === ConnectionState.ABORTED) {
|
|
407
420
|
(0, import_log.log)(`abort ignored: already ${this._state}`, this.closeReason, {
|
|
408
421
|
F: __dxlog_file,
|
|
409
|
-
L:
|
|
422
|
+
L: 259,
|
|
410
423
|
S: this,
|
|
411
424
|
C: (f, a) => f(...a)
|
|
412
425
|
});
|
|
@@ -421,7 +434,7 @@ var Connection = class {
|
|
|
421
434
|
try {
|
|
422
435
|
(0, import_log.log)("aborting protocol... ", void 0, {
|
|
423
436
|
F: __dxlog_file,
|
|
424
|
-
L:
|
|
437
|
+
L: 273,
|
|
425
438
|
S: this,
|
|
426
439
|
C: (f, a) => f(...a)
|
|
427
440
|
});
|
|
@@ -429,7 +442,7 @@ var Connection = class {
|
|
|
429
442
|
} catch (err2) {
|
|
430
443
|
import_log.log.catch(err2, void 0, {
|
|
431
444
|
F: __dxlog_file,
|
|
432
|
-
L:
|
|
445
|
+
L: 276,
|
|
433
446
|
S: this,
|
|
434
447
|
C: (f, a) => f(...a)
|
|
435
448
|
});
|
|
@@ -439,7 +452,7 @@ var Connection = class {
|
|
|
439
452
|
} catch (err2) {
|
|
440
453
|
import_log.log.catch(err2, void 0, {
|
|
441
454
|
F: __dxlog_file,
|
|
442
|
-
L:
|
|
455
|
+
L: 283,
|
|
443
456
|
S: this,
|
|
444
457
|
C: (f, a) => f(...a)
|
|
445
458
|
});
|
|
@@ -449,7 +462,7 @@ var Connection = class {
|
|
|
449
462
|
} catch (err2) {
|
|
450
463
|
import_log.log.catch(err2, void 0, {
|
|
451
464
|
F: __dxlog_file,
|
|
452
|
-
L:
|
|
465
|
+
L: 289,
|
|
453
466
|
S: this,
|
|
454
467
|
C: (f, a) => f(...a)
|
|
455
468
|
});
|
|
@@ -473,7 +486,7 @@ var Connection = class {
|
|
|
473
486
|
peerId: this.ownId
|
|
474
487
|
}, {
|
|
475
488
|
F: __dxlog_file,
|
|
476
|
-
L:
|
|
489
|
+
L: 314,
|
|
477
490
|
S: this,
|
|
478
491
|
C: (f, a) => f(...a)
|
|
479
492
|
});
|
|
@@ -483,7 +496,34 @@ var Connection = class {
|
|
|
483
496
|
} catch (err2) {
|
|
484
497
|
import_log.log.catch(err2, void 0, {
|
|
485
498
|
F: __dxlog_file,
|
|
486
|
-
L:
|
|
499
|
+
L: 321,
|
|
500
|
+
S: this,
|
|
501
|
+
C: (f, a) => f(...a)
|
|
502
|
+
});
|
|
503
|
+
}
|
|
504
|
+
try {
|
|
505
|
+
await this._transport?.destroy();
|
|
506
|
+
} catch (err2) {
|
|
507
|
+
import_log.log.catch(err2, void 0, {
|
|
508
|
+
F: __dxlog_file,
|
|
509
|
+
L: 328,
|
|
510
|
+
S: this,
|
|
511
|
+
C: (f, a) => f(...a)
|
|
512
|
+
});
|
|
513
|
+
}
|
|
514
|
+
} else {
|
|
515
|
+
import_log.log.info(`graceful close requested when we were in ${lastState} state? aborting`, void 0, {
|
|
516
|
+
F: __dxlog_file,
|
|
517
|
+
L: 331,
|
|
518
|
+
S: this,
|
|
519
|
+
C: (f, a) => f(...a)
|
|
520
|
+
});
|
|
521
|
+
try {
|
|
522
|
+
await this._protocol.abort();
|
|
523
|
+
} catch (err2) {
|
|
524
|
+
import_log.log.catch(err2, void 0, {
|
|
525
|
+
F: __dxlog_file,
|
|
526
|
+
L: 335,
|
|
487
527
|
S: this,
|
|
488
528
|
C: (f, a) => f(...a)
|
|
489
529
|
});
|
|
@@ -493,7 +533,7 @@ var Connection = class {
|
|
|
493
533
|
} catch (err2) {
|
|
494
534
|
import_log.log.catch(err2, void 0, {
|
|
495
535
|
F: __dxlog_file,
|
|
496
|
-
L:
|
|
536
|
+
L: 340,
|
|
497
537
|
S: this,
|
|
498
538
|
C: (f, a) => f(...a)
|
|
499
539
|
});
|
|
@@ -503,7 +543,7 @@ var Connection = class {
|
|
|
503
543
|
peerId: this.ownId
|
|
504
544
|
}, {
|
|
505
545
|
F: __dxlog_file,
|
|
506
|
-
L:
|
|
546
|
+
L: 344,
|
|
507
547
|
S: this,
|
|
508
548
|
C: (f, a) => f(...a)
|
|
509
549
|
});
|
|
@@ -546,7 +586,7 @@ var Connection = class {
|
|
|
546
586
|
err
|
|
547
587
|
}, {
|
|
548
588
|
F: __dxlog_file,
|
|
549
|
-
L:
|
|
589
|
+
L: 382,
|
|
550
590
|
S: this,
|
|
551
591
|
C: (f, a) => f(...a)
|
|
552
592
|
});
|
|
@@ -559,7 +599,7 @@ var Connection = class {
|
|
|
559
599
|
async signal(msg) {
|
|
560
600
|
(0, import_invariant.invariant)(msg.sessionId, void 0, {
|
|
561
601
|
F: __dxlog_file,
|
|
562
|
-
L:
|
|
602
|
+
L: 391,
|
|
563
603
|
S: this,
|
|
564
604
|
A: [
|
|
565
605
|
"msg.sessionId",
|
|
@@ -569,7 +609,7 @@ var Connection = class {
|
|
|
569
609
|
if (!msg.sessionId.equals(this.sessionId)) {
|
|
570
610
|
(0, import_log.log)("dropping signal for incorrect session id", void 0, {
|
|
571
611
|
F: __dxlog_file,
|
|
572
|
-
L:
|
|
612
|
+
L: 393,
|
|
573
613
|
S: this,
|
|
574
614
|
C: (f, a) => f(...a)
|
|
575
615
|
});
|
|
@@ -577,7 +617,7 @@ var Connection = class {
|
|
|
577
617
|
}
|
|
578
618
|
(0, import_invariant.invariant)(msg.data.signal || msg.data.signalBatch, void 0, {
|
|
579
619
|
F: __dxlog_file,
|
|
580
|
-
L:
|
|
620
|
+
L: 396,
|
|
581
621
|
S: this,
|
|
582
622
|
A: [
|
|
583
623
|
"msg.data.signal || msg.data.signalBatch",
|
|
@@ -586,7 +626,7 @@ var Connection = class {
|
|
|
586
626
|
});
|
|
587
627
|
(0, import_invariant.invariant)(msg.author?.equals(this.remoteId), void 0, {
|
|
588
628
|
F: __dxlog_file,
|
|
589
|
-
L:
|
|
629
|
+
L: 397,
|
|
590
630
|
S: this,
|
|
591
631
|
A: [
|
|
592
632
|
"msg.author?.equals(this.remoteId)",
|
|
@@ -595,7 +635,7 @@ var Connection = class {
|
|
|
595
635
|
});
|
|
596
636
|
(0, import_invariant.invariant)(msg.recipient?.equals(this.ownId), void 0, {
|
|
597
637
|
F: __dxlog_file,
|
|
598
|
-
L:
|
|
638
|
+
L: 398,
|
|
599
639
|
S: this,
|
|
600
640
|
A: [
|
|
601
641
|
"msg.recipient?.equals(this.ownId)",
|
|
@@ -619,7 +659,7 @@ var Connection = class {
|
|
|
619
659
|
msg: msg.data
|
|
620
660
|
}, {
|
|
621
661
|
F: __dxlog_file,
|
|
622
|
-
L:
|
|
662
|
+
L: 407,
|
|
623
663
|
S: this,
|
|
624
664
|
C: (f, a) => f(...a)
|
|
625
665
|
});
|
|
@@ -627,7 +667,7 @@ var Connection = class {
|
|
|
627
667
|
} else {
|
|
628
668
|
(0, import_invariant.invariant)(this._transport, "Connection not ready to accept signals.", {
|
|
629
669
|
F: __dxlog_file,
|
|
630
|
-
L:
|
|
670
|
+
L: 410,
|
|
631
671
|
S: this,
|
|
632
672
|
A: [
|
|
633
673
|
"this._transport",
|
|
@@ -640,7 +680,7 @@ var Connection = class {
|
|
|
640
680
|
msg: msg.data
|
|
641
681
|
}, {
|
|
642
682
|
F: __dxlog_file,
|
|
643
|
-
L:
|
|
683
|
+
L: 411,
|
|
644
684
|
S: this,
|
|
645
685
|
C: (f, a) => f(...a)
|
|
646
686
|
});
|
|
@@ -658,13 +698,13 @@ var Connection = class {
|
|
|
658
698
|
peerId: this.ownId
|
|
659
699
|
}, {
|
|
660
700
|
F: __dxlog_file,
|
|
661
|
-
L:
|
|
701
|
+
L: 422,
|
|
662
702
|
S: this,
|
|
663
703
|
C: (f, a) => f(...a)
|
|
664
704
|
});
|
|
665
705
|
(0, import_invariant.invariant)(state !== this._state, "Already in this state.", {
|
|
666
706
|
F: __dxlog_file,
|
|
667
|
-
L:
|
|
707
|
+
L: 423,
|
|
668
708
|
S: this,
|
|
669
709
|
A: [
|
|
670
710
|
"state !== this._state",
|
|
@@ -674,7 +714,16 @@ var Connection = class {
|
|
|
674
714
|
this._state = state;
|
|
675
715
|
this.stateChanged.emit(state);
|
|
676
716
|
}
|
|
717
|
+
async _emitTransportStats() {
|
|
718
|
+
const stats = await this.transport?.getStats();
|
|
719
|
+
if (stats) {
|
|
720
|
+
this.transportStats.emit(stats);
|
|
721
|
+
}
|
|
722
|
+
}
|
|
677
723
|
};
|
|
724
|
+
_ts_decorate([
|
|
725
|
+
import_log.logInfo
|
|
726
|
+
], Connection.prototype, "sessionIdString", null);
|
|
678
727
|
_ts_decorate([
|
|
679
728
|
import_async.synchronized
|
|
680
729
|
], Connection.prototype, "abort", null);
|
|
@@ -2063,7 +2112,7 @@ var ConnectionLog = class {
|
|
|
2063
2112
|
};
|
|
2064
2113
|
info.connections.push(connectionInfo);
|
|
2065
2114
|
this.update.emit();
|
|
2066
|
-
connection.stateChanged.on((state) => {
|
|
2115
|
+
connection.stateChanged.on(async (state) => {
|
|
2067
2116
|
connectionInfo.state = state;
|
|
2068
2117
|
connectionInfo.closeReason = connection.closeReason;
|
|
2069
2118
|
connectionInfo.lastUpdate = /* @__PURE__ */ new Date();
|
|
@@ -2071,6 +2120,10 @@ var ConnectionLog = class {
|
|
|
2071
2120
|
type: EventType.CONNECTION_STATE_CHANGED,
|
|
2072
2121
|
newState: state
|
|
2073
2122
|
});
|
|
2123
|
+
if (state === ConnectionState.CONNECTED) {
|
|
2124
|
+
const details = await connection.transport?.getDetails();
|
|
2125
|
+
connectionInfo.transportDetails = details;
|
|
2126
|
+
}
|
|
2074
2127
|
this.update.emit();
|
|
2075
2128
|
});
|
|
2076
2129
|
connection.protocol?.stats?.on((stats) => {
|
|
@@ -2080,6 +2133,12 @@ var ConnectionLog = class {
|
|
|
2080
2133
|
connectionInfo.lastUpdate = /* @__PURE__ */ new Date();
|
|
2081
2134
|
this.update.emit();
|
|
2082
2135
|
});
|
|
2136
|
+
connection.transportStats?.on((stats) => {
|
|
2137
|
+
connectionInfo.transportBytesSent = stats.bytesSent;
|
|
2138
|
+
connectionInfo.transportBytesReceived = stats.bytesReceived;
|
|
2139
|
+
connectionInfo.transportPacketsSent = stats.packetsSent;
|
|
2140
|
+
connectionInfo.transportPacketsReceived = stats.packetsReceived;
|
|
2141
|
+
});
|
|
2083
2142
|
gcSwarm(info);
|
|
2084
2143
|
});
|
|
2085
2144
|
}
|
|
@@ -2362,9 +2421,12 @@ var FullyConnectedTopology = class {
|
|
|
2362
2421
|
}
|
|
2363
2422
|
};
|
|
2364
2423
|
var __dxlog_file9 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/topology/mmst-topology.ts";
|
|
2424
|
+
var MIN_UPDATE_INTERVAL = 1e3 * 10;
|
|
2425
|
+
var MAX_CHANGES_PER_UPDATE = 1;
|
|
2365
2426
|
var MMSTTopology = class {
|
|
2366
2427
|
constructor({ originateConnections = 2, maxPeers = 4, sampleSize = 10 } = {}) {
|
|
2367
2428
|
this._sampleCollected = false;
|
|
2429
|
+
this._lastAction = /* @__PURE__ */ new Date(0);
|
|
2368
2430
|
this._originateConnections = originateConnections;
|
|
2369
2431
|
this._maxPeers = maxPeers;
|
|
2370
2432
|
this._sampleSize = sampleSize;
|
|
@@ -2372,7 +2434,7 @@ var MMSTTopology = class {
|
|
|
2372
2434
|
init(controller) {
|
|
2373
2435
|
(0, import_invariant8.invariant)(!this._controller, "Already initialized", {
|
|
2374
2436
|
F: __dxlog_file9,
|
|
2375
|
-
L:
|
|
2437
|
+
L: 51,
|
|
2376
2438
|
S: this,
|
|
2377
2439
|
A: [
|
|
2378
2440
|
"!this._controller",
|
|
@@ -2384,7 +2446,7 @@ var MMSTTopology = class {
|
|
|
2384
2446
|
update() {
|
|
2385
2447
|
(0, import_invariant8.invariant)(this._controller, "Not initialized", {
|
|
2386
2448
|
F: __dxlog_file9,
|
|
2387
|
-
L:
|
|
2449
|
+
L: 56,
|
|
2388
2450
|
S: this,
|
|
2389
2451
|
A: [
|
|
2390
2452
|
"this._controller",
|
|
@@ -2395,7 +2457,7 @@ var MMSTTopology = class {
|
|
|
2395
2457
|
if (this._sampleCollected || connected.length > this._maxPeers || candidates.length > 0) {
|
|
2396
2458
|
(0, import_log8.log)("Running the algorithm.", void 0, {
|
|
2397
2459
|
F: __dxlog_file9,
|
|
2398
|
-
L:
|
|
2460
|
+
L: 60,
|
|
2399
2461
|
S: this,
|
|
2400
2462
|
C: (f, a) => f(...a)
|
|
2401
2463
|
});
|
|
@@ -2406,7 +2468,7 @@ var MMSTTopology = class {
|
|
|
2406
2468
|
async onOffer(peer) {
|
|
2407
2469
|
(0, import_invariant8.invariant)(this._controller, "Not initialized", {
|
|
2408
2470
|
F: __dxlog_file9,
|
|
2409
|
-
L:
|
|
2471
|
+
L: 67,
|
|
2410
2472
|
S: this,
|
|
2411
2473
|
A: [
|
|
2412
2474
|
"this._controller",
|
|
@@ -2417,7 +2479,7 @@ var MMSTTopology = class {
|
|
|
2417
2479
|
const accept = connected.length < this._maxPeers;
|
|
2418
2480
|
(0, import_log8.log)(`Offer ${peer} accept=${accept}`, void 0, {
|
|
2419
2481
|
F: __dxlog_file9,
|
|
2420
|
-
L:
|
|
2482
|
+
L: 70,
|
|
2421
2483
|
S: this,
|
|
2422
2484
|
C: (f, a) => f(...a)
|
|
2423
2485
|
});
|
|
@@ -2428,7 +2490,7 @@ var MMSTTopology = class {
|
|
|
2428
2490
|
_runAlgorithm() {
|
|
2429
2491
|
(0, import_invariant8.invariant)(this._controller, "Not initialized", {
|
|
2430
2492
|
F: __dxlog_file9,
|
|
2431
|
-
L:
|
|
2493
|
+
L: 79,
|
|
2432
2494
|
S: this,
|
|
2433
2495
|
A: [
|
|
2434
2496
|
"this._controller",
|
|
@@ -2437,27 +2499,84 @@ var MMSTTopology = class {
|
|
|
2437
2499
|
});
|
|
2438
2500
|
const { connected, candidates, ownPeerId } = this._controller.getState();
|
|
2439
2501
|
if (connected.length > this._maxPeers) {
|
|
2502
|
+
(0, import_log8.log)(`disconnect ${connected.length - this._maxPeers} peers.`, void 0, {
|
|
2503
|
+
F: __dxlog_file9,
|
|
2504
|
+
L: 85,
|
|
2505
|
+
S: this,
|
|
2506
|
+
C: (f, a) => f(...a)
|
|
2507
|
+
});
|
|
2440
2508
|
const sorted = sortByXorDistance(connected, ownPeerId).reverse().slice(0, this._maxPeers - connected.length);
|
|
2441
|
-
|
|
2442
|
-
|
|
2509
|
+
(0, import_invariant8.invariant)(sorted.length === 0, void 0, {
|
|
2510
|
+
F: __dxlog_file9,
|
|
2511
|
+
L: 89,
|
|
2512
|
+
S: this,
|
|
2513
|
+
A: [
|
|
2514
|
+
"sorted.length === 0",
|
|
2515
|
+
""
|
|
2516
|
+
]
|
|
2517
|
+
});
|
|
2518
|
+
if (sorted.length > MAX_CHANGES_PER_UPDATE) {
|
|
2519
|
+
(0, import_log8.log)(`want to disconnect ${sorted.length} peers but limited to ${MAX_CHANGES_PER_UPDATE}`, void 0, {
|
|
2520
|
+
F: __dxlog_file9,
|
|
2521
|
+
L: 92,
|
|
2522
|
+
S: this,
|
|
2523
|
+
C: (f, a) => f(...a)
|
|
2524
|
+
});
|
|
2525
|
+
}
|
|
2526
|
+
if (Date.now() - this._lastAction.getTime() > MIN_UPDATE_INTERVAL) {
|
|
2527
|
+
for (const peer of sorted.slice(0, MAX_CHANGES_PER_UPDATE)) {
|
|
2528
|
+
(0, import_log8.log)(`Disconnect ${peer}.`, void 0, {
|
|
2529
|
+
F: __dxlog_file9,
|
|
2530
|
+
L: 97,
|
|
2531
|
+
S: this,
|
|
2532
|
+
C: (f, a) => f(...a)
|
|
2533
|
+
});
|
|
2534
|
+
this._controller.disconnect(peer);
|
|
2535
|
+
}
|
|
2536
|
+
this._lastAction = /* @__PURE__ */ new Date();
|
|
2537
|
+
} else {
|
|
2538
|
+
(0, import_log8.log)("rate limited discconnect", void 0, {
|
|
2443
2539
|
F: __dxlog_file9,
|
|
2444
|
-
L:
|
|
2540
|
+
L: 102,
|
|
2445
2541
|
S: this,
|
|
2446
2542
|
C: (f, a) => f(...a)
|
|
2447
2543
|
});
|
|
2448
|
-
this._controller.disconnect(peer);
|
|
2449
2544
|
}
|
|
2450
2545
|
} else if (connected.length < this._originateConnections) {
|
|
2546
|
+
(0, import_log8.log)(`connect ${this._originateConnections - connected.length} peers.`, void 0, {
|
|
2547
|
+
F: __dxlog_file9,
|
|
2548
|
+
L: 106,
|
|
2549
|
+
S: this,
|
|
2550
|
+
C: (f, a) => f(...a)
|
|
2551
|
+
});
|
|
2451
2552
|
const sample = candidates.sort(() => Math.random() - 0.5).slice(0, this._sampleSize);
|
|
2452
2553
|
const sorted = sortByXorDistance(sample, ownPeerId).slice(0, this._originateConnections - connected.length);
|
|
2453
|
-
|
|
2454
|
-
(0, import_log8.log)(`
|
|
2554
|
+
if (sorted.length > MAX_CHANGES_PER_UPDATE) {
|
|
2555
|
+
(0, import_log8.log)(`want to connect ${sorted.length} peers but limited to ${MAX_CHANGES_PER_UPDATE}`, void 0, {
|
|
2455
2556
|
F: __dxlog_file9,
|
|
2456
|
-
L:
|
|
2557
|
+
L: 111,
|
|
2558
|
+
S: this,
|
|
2559
|
+
C: (f, a) => f(...a)
|
|
2560
|
+
});
|
|
2561
|
+
}
|
|
2562
|
+
if (Date.now() - this._lastAction.getTime() > MIN_UPDATE_INTERVAL) {
|
|
2563
|
+
for (const peer of sorted.slice(0, MAX_CHANGES_PER_UPDATE)) {
|
|
2564
|
+
(0, import_log8.log)(`Connect ${peer}.`, void 0, {
|
|
2565
|
+
F: __dxlog_file9,
|
|
2566
|
+
L: 115,
|
|
2567
|
+
S: this,
|
|
2568
|
+
C: (f, a) => f(...a)
|
|
2569
|
+
});
|
|
2570
|
+
this._controller.connect(peer);
|
|
2571
|
+
}
|
|
2572
|
+
this._lastAction = /* @__PURE__ */ new Date();
|
|
2573
|
+
} else {
|
|
2574
|
+
(0, import_log8.log)("rate limited connect", void 0, {
|
|
2575
|
+
F: __dxlog_file9,
|
|
2576
|
+
L: 120,
|
|
2457
2577
|
S: this,
|
|
2458
2578
|
C: (f, a) => f(...a)
|
|
2459
2579
|
});
|
|
2460
|
-
this._controller.connect(peer);
|
|
2461
2580
|
}
|
|
2462
2581
|
}
|
|
2463
2582
|
}
|
|
@@ -2730,6 +2849,17 @@ var MemoryTransport = class _MemoryTransport {
|
|
|
2730
2849
|
this._remote.wake(remoteId);
|
|
2731
2850
|
}
|
|
2732
2851
|
}
|
|
2852
|
+
async getDetails() {
|
|
2853
|
+
return this._instanceId.toHex();
|
|
2854
|
+
}
|
|
2855
|
+
async getStats() {
|
|
2856
|
+
return {
|
|
2857
|
+
bytesSent: 0,
|
|
2858
|
+
bytesReceived: 0,
|
|
2859
|
+
packetsSent: 0,
|
|
2860
|
+
packetsReceived: 0
|
|
2861
|
+
};
|
|
2862
|
+
}
|
|
2733
2863
|
};
|
|
2734
2864
|
_ts_decorate4([
|
|
2735
2865
|
import_log10.logInfo
|
|
@@ -2747,11 +2877,14 @@ var TransportKind;
|
|
|
2747
2877
|
})(TransportKind || (TransportKind = {}));
|
|
2748
2878
|
var wrtc = null;
|
|
2749
2879
|
try {
|
|
2750
|
-
wrtc =
|
|
2880
|
+
wrtc = __require("@koush/wrtc");
|
|
2751
2881
|
} catch {
|
|
2752
2882
|
}
|
|
2753
2883
|
var __dxlog_file12 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/transport/simplepeer-transport.ts";
|
|
2754
2884
|
var SimplePeerTransport = class {
|
|
2885
|
+
/**
|
|
2886
|
+
* @params opts.config formatted as per https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/RTCPeerConnection
|
|
2887
|
+
*/
|
|
2755
2888
|
constructor(params) {
|
|
2756
2889
|
this.params = params;
|
|
2757
2890
|
this._closed = false;
|
|
@@ -2764,13 +2897,13 @@ var SimplePeerTransport = class {
|
|
|
2764
2897
|
id: this._instanceId
|
|
2765
2898
|
}), {
|
|
2766
2899
|
F: __dxlog_file12,
|
|
2767
|
-
L:
|
|
2900
|
+
L: 44,
|
|
2768
2901
|
S: this,
|
|
2769
2902
|
C: (f, a) => f(...a)
|
|
2770
2903
|
});
|
|
2771
2904
|
(0, import_log11.log)("created connection", params, {
|
|
2772
2905
|
F: __dxlog_file12,
|
|
2773
|
-
L:
|
|
2906
|
+
L: 45,
|
|
2774
2907
|
S: this,
|
|
2775
2908
|
C: (f, a) => f(...a)
|
|
2776
2909
|
});
|
|
@@ -2783,7 +2916,7 @@ var SimplePeerTransport = class {
|
|
|
2783
2916
|
this._peer.on("signal", async (data) => {
|
|
2784
2917
|
(0, import_log11.log)("signal", data, {
|
|
2785
2918
|
F: __dxlog_file12,
|
|
2786
|
-
L:
|
|
2919
|
+
L: 54,
|
|
2787
2920
|
S: this,
|
|
2788
2921
|
C: (f, a) => f(...a)
|
|
2789
2922
|
});
|
|
@@ -2796,7 +2929,7 @@ var SimplePeerTransport = class {
|
|
|
2796
2929
|
this._peer.on("connect", () => {
|
|
2797
2930
|
(0, import_log11.log)("connected", void 0, {
|
|
2798
2931
|
F: __dxlog_file12,
|
|
2799
|
-
L:
|
|
2932
|
+
L: 59,
|
|
2800
2933
|
S: this,
|
|
2801
2934
|
C: (f, a) => f(...a)
|
|
2802
2935
|
});
|
|
@@ -2807,7 +2940,7 @@ var SimplePeerTransport = class {
|
|
|
2807
2940
|
this._peer.on("close", async () => {
|
|
2808
2941
|
(0, import_log11.log)("closed", void 0, {
|
|
2809
2942
|
F: __dxlog_file12,
|
|
2810
|
-
L:
|
|
2943
|
+
L: 66,
|
|
2811
2944
|
S: this,
|
|
2812
2945
|
C: (f, a) => f(...a)
|
|
2813
2946
|
});
|
|
@@ -2818,12 +2951,20 @@ var SimplePeerTransport = class {
|
|
|
2818
2951
|
if (err.errorDetail === "sctp-failure") {
|
|
2819
2952
|
this.errors.raise(new import_protocols7.ConnectionResetError("sctp-failure from RTCError", err));
|
|
2820
2953
|
} else {
|
|
2954
|
+
import_log11.log.info("unknown RTCError", {
|
|
2955
|
+
err
|
|
2956
|
+
}, {
|
|
2957
|
+
F: __dxlog_file12,
|
|
2958
|
+
L: 77,
|
|
2959
|
+
S: this,
|
|
2960
|
+
C: (f, a) => f(...a)
|
|
2961
|
+
});
|
|
2821
2962
|
this.errors.raise(new import_protocols7.UnknownProtocolError("unknown RTCError", err));
|
|
2822
2963
|
}
|
|
2823
2964
|
} else if ("code" in err) {
|
|
2824
2965
|
import_log11.log.info("simple-peer error", err, {
|
|
2825
2966
|
F: __dxlog_file12,
|
|
2826
|
-
L:
|
|
2967
|
+
L: 82,
|
|
2827
2968
|
S: this,
|
|
2828
2969
|
C: (f, a) => f(...a)
|
|
2829
2970
|
});
|
|
@@ -2831,10 +2972,12 @@ var SimplePeerTransport = class {
|
|
|
2831
2972
|
case "ERR_WEBRTC_SUPPORT":
|
|
2832
2973
|
this.errors.raise(new import_protocols7.ProtocolError("WebRTC not supported", err));
|
|
2833
2974
|
break;
|
|
2975
|
+
case "ERR_SIGNALING":
|
|
2976
|
+
this.errors.raise(new import_protocols7.ConnectivityError("signaling failure", err));
|
|
2977
|
+
break;
|
|
2834
2978
|
case "ERR_ICE_CONNECTION_FAILURE":
|
|
2835
2979
|
case "ERR_DATA_CHANNEL":
|
|
2836
2980
|
case "ERR_CONNECTION_FAILURE":
|
|
2837
|
-
case "ERR_SIGNALING":
|
|
2838
2981
|
this.errors.raise(new import_protocols7.ConnectivityError("unknown communication failure", err));
|
|
2839
2982
|
break;
|
|
2840
2983
|
case "ERR_CREATE_OFFER":
|
|
@@ -2851,7 +2994,7 @@ var SimplePeerTransport = class {
|
|
|
2851
2994
|
} else {
|
|
2852
2995
|
import_log11.log.info("unknown peer connection error", err, {
|
|
2853
2996
|
F: __dxlog_file12,
|
|
2854
|
-
L:
|
|
2997
|
+
L: 108,
|
|
2855
2998
|
S: this,
|
|
2856
2999
|
C: (f, a) => f(...a)
|
|
2857
3000
|
});
|
|
@@ -2862,10 +3005,10 @@ var SimplePeerTransport = class {
|
|
|
2862
3005
|
this._peer._pc.getStats().then((stats) => {
|
|
2863
3006
|
import_log11.log.info("report after webrtc error", {
|
|
2864
3007
|
config: this.params.webrtcConfig,
|
|
2865
|
-
stats
|
|
3008
|
+
stats: Object.fromEntries(stats.entries())
|
|
2866
3009
|
}, {
|
|
2867
3010
|
F: __dxlog_file12,
|
|
2868
|
-
L:
|
|
3011
|
+
L: 116,
|
|
2869
3012
|
S: this,
|
|
2870
3013
|
C: (f, a) => f(...a)
|
|
2871
3014
|
});
|
|
@@ -2874,7 +3017,7 @@ var SimplePeerTransport = class {
|
|
|
2874
3017
|
} catch (err2) {
|
|
2875
3018
|
import_log11.log.catch(err2, void 0, {
|
|
2876
3019
|
F: __dxlog_file12,
|
|
2877
|
-
L:
|
|
3020
|
+
L: 123,
|
|
2878
3021
|
S: this,
|
|
2879
3022
|
C: (f, a) => f(...a)
|
|
2880
3023
|
});
|
|
@@ -2885,28 +3028,81 @@ var SimplePeerTransport = class {
|
|
|
2885
3028
|
id: this._instanceId
|
|
2886
3029
|
}), {
|
|
2887
3030
|
F: __dxlog_file12,
|
|
2888
|
-
L:
|
|
3031
|
+
L: 129,
|
|
2889
3032
|
S: this,
|
|
2890
3033
|
C: (f, a) => f(...a)
|
|
2891
3034
|
});
|
|
2892
3035
|
}
|
|
3036
|
+
async getStats() {
|
|
3037
|
+
const stats = await this._getStats();
|
|
3038
|
+
if (!stats) {
|
|
3039
|
+
return {
|
|
3040
|
+
bytesSent: 0,
|
|
3041
|
+
bytesReceived: 0,
|
|
3042
|
+
packetsSent: 0,
|
|
3043
|
+
packetsReceived: 0,
|
|
3044
|
+
rawStats: {}
|
|
3045
|
+
};
|
|
3046
|
+
}
|
|
3047
|
+
return {
|
|
3048
|
+
bytesSent: stats.transport.bytesSent,
|
|
3049
|
+
bytesReceived: stats.transport.bytesReceived,
|
|
3050
|
+
packetsSent: stats.transport.packetsSent,
|
|
3051
|
+
packetsReceived: stats.transport.packetsReceived,
|
|
3052
|
+
rawStats: stats.raw
|
|
3053
|
+
};
|
|
3054
|
+
}
|
|
3055
|
+
async _getStats() {
|
|
3056
|
+
if (typeof this._peer?._pc?.getStats !== "function") {
|
|
3057
|
+
return null;
|
|
3058
|
+
}
|
|
3059
|
+
return await this._peer._pc.getStats().then((stats) => {
|
|
3060
|
+
const statsEntries = Array.from(stats.entries());
|
|
3061
|
+
const transport = statsEntries.filter((s) => s[1].type === "transport")[0][1];
|
|
3062
|
+
const candidatePair = statsEntries.filter((s) => s[0] === transport.selectedCandidatePairId);
|
|
3063
|
+
let selectedCandidatePair;
|
|
3064
|
+
let remoteCandidate;
|
|
3065
|
+
if (candidatePair.length > 0) {
|
|
3066
|
+
selectedCandidatePair = candidatePair[0][1];
|
|
3067
|
+
remoteCandidate = statsEntries.filter((s) => s[0] === selectedCandidatePair.remoteCandidateId)[0][1];
|
|
3068
|
+
}
|
|
3069
|
+
return {
|
|
3070
|
+
datachannel: statsEntries.filter((s) => s[1].type === "data-channel")[0][1],
|
|
3071
|
+
transport,
|
|
3072
|
+
selectedCandidatePair,
|
|
3073
|
+
remoteCandidate,
|
|
3074
|
+
raw: Object.fromEntries(stats.entries())
|
|
3075
|
+
};
|
|
3076
|
+
});
|
|
3077
|
+
}
|
|
3078
|
+
async getDetails() {
|
|
3079
|
+
const stats = await this._getStats();
|
|
3080
|
+
const rc = stats?.remoteCandidate;
|
|
3081
|
+
if (!rc) {
|
|
3082
|
+
return "unavailable";
|
|
3083
|
+
}
|
|
3084
|
+
if (rc.candidateType === "relay") {
|
|
3085
|
+
return `${rc.ip}:${rc.port}/${rc.protocol} relay for ${rc.relatedAddress}:${rc.relatedPort}`;
|
|
3086
|
+
}
|
|
3087
|
+
return `${rc.ip}:${rc.port}/${rc.protocol} ${rc.candidateType}`;
|
|
3088
|
+
}
|
|
2893
3089
|
async destroy() {
|
|
2894
3090
|
(0, import_log11.log)("closing...", void 0, {
|
|
2895
3091
|
F: __dxlog_file12,
|
|
2896
|
-
L:
|
|
3092
|
+
L: 192,
|
|
2897
3093
|
S: this,
|
|
2898
3094
|
C: (f, a) => f(...a)
|
|
2899
3095
|
});
|
|
2900
3096
|
if (this._closed) {
|
|
2901
3097
|
return;
|
|
2902
3098
|
}
|
|
2903
|
-
this._closed = true;
|
|
2904
3099
|
this._disconnectStreams();
|
|
2905
3100
|
this._peer.destroy();
|
|
3101
|
+
this._closed = true;
|
|
2906
3102
|
this.closed.emit();
|
|
2907
3103
|
(0, import_log11.log)("closed", void 0, {
|
|
2908
3104
|
F: __dxlog_file12,
|
|
2909
|
-
L:
|
|
3105
|
+
L: 200,
|
|
2910
3106
|
S: this,
|
|
2911
3107
|
C: (f, a) => f(...a)
|
|
2912
3108
|
});
|
|
@@ -3012,7 +3208,7 @@ var SimplePeerTransportService = class {
|
|
|
3012
3208
|
async sendSignal({ proxyId, signal }) {
|
|
3013
3209
|
(0, import_invariant11.invariant)(this.transports.has(proxyId), void 0, {
|
|
3014
3210
|
F: __dxlog_file13,
|
|
3015
|
-
L:
|
|
3211
|
+
L: 116,
|
|
3016
3212
|
S: this,
|
|
3017
3213
|
A: [
|
|
3018
3214
|
"this.transports.has(proxyId)",
|
|
@@ -3021,18 +3217,46 @@ var SimplePeerTransportService = class {
|
|
|
3021
3217
|
});
|
|
3022
3218
|
await this.transports.get(proxyId).transport.signal(signal);
|
|
3023
3219
|
}
|
|
3220
|
+
async getDetails({ proxyId }) {
|
|
3221
|
+
(0, import_invariant11.invariant)(this.transports.has(proxyId), void 0, {
|
|
3222
|
+
F: __dxlog_file13,
|
|
3223
|
+
L: 121,
|
|
3224
|
+
S: this,
|
|
3225
|
+
A: [
|
|
3226
|
+
"this.transports.has(proxyId)",
|
|
3227
|
+
""
|
|
3228
|
+
]
|
|
3229
|
+
});
|
|
3230
|
+
return {
|
|
3231
|
+
details: await this.transports.get(proxyId).transport.getDetails()
|
|
3232
|
+
};
|
|
3233
|
+
}
|
|
3234
|
+
async getStats({ proxyId }) {
|
|
3235
|
+
(0, import_invariant11.invariant)(this.transports.has(proxyId), void 0, {
|
|
3236
|
+
F: __dxlog_file13,
|
|
3237
|
+
L: 126,
|
|
3238
|
+
S: this,
|
|
3239
|
+
A: [
|
|
3240
|
+
"this.transports.has(proxyId)",
|
|
3241
|
+
""
|
|
3242
|
+
]
|
|
3243
|
+
});
|
|
3244
|
+
return {
|
|
3245
|
+
stats: await this.transports.get(proxyId).transport.getStats()
|
|
3246
|
+
};
|
|
3247
|
+
}
|
|
3024
3248
|
async sendData({ proxyId, payload }) {
|
|
3025
3249
|
if (this.transports.get(proxyId)?.state !== "OPEN") {
|
|
3026
3250
|
import_log12.log.debug("transport is closed", void 0, {
|
|
3027
3251
|
F: __dxlog_file13,
|
|
3028
|
-
L:
|
|
3252
|
+
L: 132,
|
|
3029
3253
|
S: this,
|
|
3030
3254
|
C: (f, a) => f(...a)
|
|
3031
3255
|
});
|
|
3032
3256
|
}
|
|
3033
3257
|
(0, import_invariant11.invariant)(this.transports.has(proxyId), void 0, {
|
|
3034
3258
|
F: __dxlog_file13,
|
|
3035
|
-
L:
|
|
3259
|
+
L: 134,
|
|
3036
3260
|
S: this,
|
|
3037
3261
|
A: [
|
|
3038
3262
|
"this.transports.has(proxyId)",
|
|
@@ -3055,7 +3279,7 @@ var SimplePeerTransportService = class {
|
|
|
3055
3279
|
}
|
|
3056
3280
|
(0, import_log12.log)("Closed.", void 0, {
|
|
3057
3281
|
F: __dxlog_file13,
|
|
3058
|
-
L:
|
|
3282
|
+
L: 150,
|
|
3059
3283
|
S: this,
|
|
3060
3284
|
C: (f, a) => f(...a)
|
|
3061
3285
|
});
|
|
@@ -3182,6 +3406,16 @@ var SimplePeerTransportProxy = class {
|
|
|
3182
3406
|
signal
|
|
3183
3407
|
}).catch((err) => this.errors.raise(decodeError(err)));
|
|
3184
3408
|
}
|
|
3409
|
+
async getDetails() {
|
|
3410
|
+
return (await this._params.bridgeService.getDetails({
|
|
3411
|
+
proxyId: this._proxyId
|
|
3412
|
+
})).details;
|
|
3413
|
+
}
|
|
3414
|
+
async getStats() {
|
|
3415
|
+
return (await this._params.bridgeService.getStats({
|
|
3416
|
+
proxyId: this._proxyId
|
|
3417
|
+
})).stats;
|
|
3418
|
+
}
|
|
3185
3419
|
// TODO(burdon): Move open from constructor.
|
|
3186
3420
|
async destroy() {
|
|
3187
3421
|
await this._ctx.dispose();
|
|
@@ -3196,7 +3430,7 @@ var SimplePeerTransportProxy = class {
|
|
|
3196
3430
|
} catch (err) {
|
|
3197
3431
|
import_log13.log.catch(err, void 0, {
|
|
3198
3432
|
F: __dxlog_file14,
|
|
3199
|
-
L:
|
|
3433
|
+
L: 168,
|
|
3200
3434
|
S: this,
|
|
3201
3435
|
C: (f, a) => f(...a)
|
|
3202
3436
|
});
|
|
@@ -3232,7 +3466,7 @@ var SimplePeerTransportProxyFactory = class {
|
|
|
3232
3466
|
createTransport(options) {
|
|
3233
3467
|
(0, import_invariant12.invariant)(this._bridgeService, "SimplePeerTransportProxyFactory is not ready to open connections", {
|
|
3234
3468
|
F: __dxlog_file14,
|
|
3235
|
-
L:
|
|
3469
|
+
L: 205,
|
|
3236
3470
|
S: this,
|
|
3237
3471
|
A: [
|
|
3238
3472
|
"this._bridgeService",
|
|
@@ -3289,17 +3523,24 @@ var LibDataChannelTransport = class {
|
|
|
3289
3523
|
this._readyForCandidates = new import_async11.Trigger();
|
|
3290
3524
|
this._writeCallback = null;
|
|
3291
3525
|
this._peer = (async () => {
|
|
3292
|
-
const { RTCPeerConnection
|
|
3526
|
+
const { RTCPeerConnection } = (await importESM("node-datachannel/polyfill")).default;
|
|
3293
3527
|
if (this._closed) {
|
|
3294
3528
|
this.errors.raise(new Error("connection already closed"));
|
|
3295
3529
|
}
|
|
3296
|
-
|
|
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);
|
|
3297
3538
|
peer.onicecandidateerror = (event) => {
|
|
3298
3539
|
import_log14.log.error("peer.onicecandidateerror", {
|
|
3299
3540
|
event
|
|
3300
3541
|
}, {
|
|
3301
3542
|
F: __dxlog_file15,
|
|
3302
|
-
L:
|
|
3543
|
+
L: 61,
|
|
3303
3544
|
S: this,
|
|
3304
3545
|
C: (f, a) => f(...a)
|
|
3305
3546
|
});
|
|
@@ -3311,7 +3552,7 @@ var LibDataChannelTransport = class {
|
|
|
3311
3552
|
transportConnectionState: this._connected
|
|
3312
3553
|
}, {
|
|
3313
3554
|
F: __dxlog_file15,
|
|
3314
|
-
L:
|
|
3555
|
+
L: 65,
|
|
3315
3556
|
S: this,
|
|
3316
3557
|
C: (f, a) => f(...a)
|
|
3317
3558
|
});
|
|
@@ -3321,7 +3562,7 @@ var LibDataChannelTransport = class {
|
|
|
3321
3562
|
event
|
|
3322
3563
|
}, {
|
|
3323
3564
|
F: __dxlog_file15,
|
|
3324
|
-
L:
|
|
3565
|
+
L: 74,
|
|
3325
3566
|
S: this,
|
|
3326
3567
|
C: (f, a) => f(...a)
|
|
3327
3568
|
});
|
|
@@ -3345,7 +3586,7 @@ var LibDataChannelTransport = class {
|
|
|
3345
3586
|
err
|
|
3346
3587
|
}, {
|
|
3347
3588
|
F: __dxlog_file15,
|
|
3348
|
-
L:
|
|
3589
|
+
L: 91,
|
|
3349
3590
|
S: this,
|
|
3350
3591
|
C: (f, a) => f(...a)
|
|
3351
3592
|
});
|
|
@@ -3354,12 +3595,15 @@ var LibDataChannelTransport = class {
|
|
|
3354
3595
|
};
|
|
3355
3596
|
if (params.initiator) {
|
|
3356
3597
|
peer.createOffer().then(async (offer) => {
|
|
3598
|
+
if (this._closed) {
|
|
3599
|
+
return;
|
|
3600
|
+
}
|
|
3357
3601
|
if (peer.connectionState !== "connecting") {
|
|
3358
3602
|
import_log14.log.error("i am initiator but peer not in state connecting", {
|
|
3359
3603
|
peer
|
|
3360
3604
|
}, {
|
|
3361
3605
|
F: __dxlog_file15,
|
|
3362
|
-
L:
|
|
3606
|
+
L: 104,
|
|
3363
3607
|
S: this,
|
|
3364
3608
|
C: (f, a) => f(...a)
|
|
3365
3609
|
});
|
|
@@ -3369,7 +3613,7 @@ var LibDataChannelTransport = class {
|
|
|
3369
3613
|
offer
|
|
3370
3614
|
}, {
|
|
3371
3615
|
F: __dxlog_file15,
|
|
3372
|
-
L:
|
|
3616
|
+
L: 107,
|
|
3373
3617
|
S: this,
|
|
3374
3618
|
C: (f, a) => f(...a)
|
|
3375
3619
|
});
|
|
@@ -3389,7 +3633,7 @@ var LibDataChannelTransport = class {
|
|
|
3389
3633
|
this.handleChannel(peer.createDataChannel(DATACHANNEL_LABEL));
|
|
3390
3634
|
import_log14.log.debug("created data channel", void 0, {
|
|
3391
3635
|
F: __dxlog_file15,
|
|
3392
|
-
L:
|
|
3636
|
+
L: 116,
|
|
3393
3637
|
S: this,
|
|
3394
3638
|
C: (f, a) => f(...a)
|
|
3395
3639
|
});
|
|
@@ -3402,7 +3646,7 @@ var LibDataChannelTransport = class {
|
|
|
3402
3646
|
event
|
|
3403
3647
|
}, {
|
|
3404
3648
|
F: __dxlog_file15,
|
|
3405
|
-
L:
|
|
3649
|
+
L: 122,
|
|
3406
3650
|
S: this,
|
|
3407
3651
|
C: (f, a) => f(...a)
|
|
3408
3652
|
});
|
|
@@ -3420,23 +3664,28 @@ var LibDataChannelTransport = class {
|
|
|
3420
3664
|
this._channel.onopen = () => {
|
|
3421
3665
|
import_log14.log.debug("dataChannel.onopen", void 0, {
|
|
3422
3666
|
F: __dxlog_file15,
|
|
3423
|
-
L:
|
|
3667
|
+
L: 138,
|
|
3424
3668
|
S: this,
|
|
3425
3669
|
C: (f, a) => f(...a)
|
|
3426
3670
|
});
|
|
3427
3671
|
const duplex = new import_stream.Duplex({
|
|
3428
3672
|
read: () => {
|
|
3429
3673
|
},
|
|
3430
|
-
write: (chunk, encoding, callback) => {
|
|
3674
|
+
write: async (chunk, encoding, callback) => {
|
|
3431
3675
|
if (chunk.length > MAX_MESSAGE_SIZE) {
|
|
3432
3676
|
this.errors.raise(new Error(`message too large: ${chunk.length} > ${MAX_MESSAGE_SIZE}`));
|
|
3433
3677
|
}
|
|
3434
|
-
|
|
3678
|
+
try {
|
|
3679
|
+
dataChannel.send(chunk);
|
|
3680
|
+
} catch (err) {
|
|
3681
|
+
this.errors.raise(err);
|
|
3682
|
+
await this._close();
|
|
3683
|
+
}
|
|
3435
3684
|
if (this._channel.bufferedAmount > MAX_BUFFERED_AMOUNT) {
|
|
3436
3685
|
if (this._writeCallback !== null) {
|
|
3437
3686
|
import_log14.log.error("consumer trying to write before we're ready for more data", void 0, {
|
|
3438
3687
|
F: __dxlog_file15,
|
|
3439
|
-
L:
|
|
3688
|
+
L: 155,
|
|
3440
3689
|
S: this,
|
|
3441
3690
|
C: (f, a) => f(...a)
|
|
3442
3691
|
});
|
|
@@ -3461,7 +3710,7 @@ var LibDataChannelTransport = class {
|
|
|
3461
3710
|
err
|
|
3462
3711
|
}, {
|
|
3463
3712
|
F: __dxlog_file15,
|
|
3464
|
-
L:
|
|
3713
|
+
L: 175,
|
|
3465
3714
|
S: this,
|
|
3466
3715
|
C: (f, a) => f(...a)
|
|
3467
3716
|
});
|
|
@@ -3485,6 +3734,12 @@ var LibDataChannelTransport = class {
|
|
|
3485
3734
|
return;
|
|
3486
3735
|
}
|
|
3487
3736
|
await this._disconnectStreams();
|
|
3737
|
+
const peer = await this._peer;
|
|
3738
|
+
try {
|
|
3739
|
+
peer.close();
|
|
3740
|
+
} catch (err) {
|
|
3741
|
+
this.errors.raise(err);
|
|
3742
|
+
}
|
|
3488
3743
|
this._closed = true;
|
|
3489
3744
|
this.closed.emit();
|
|
3490
3745
|
}
|
|
@@ -3498,7 +3753,7 @@ var LibDataChannelTransport = class {
|
|
|
3498
3753
|
peer
|
|
3499
3754
|
}, {
|
|
3500
3755
|
F: __dxlog_file15,
|
|
3501
|
-
L:
|
|
3756
|
+
L: 216,
|
|
3502
3757
|
S: this,
|
|
3503
3758
|
C: (f, a) => f(...a)
|
|
3504
3759
|
});
|
|
@@ -3526,7 +3781,7 @@ var LibDataChannelTransport = class {
|
|
|
3526
3781
|
err
|
|
3527
3782
|
}, {
|
|
3528
3783
|
F: __dxlog_file15,
|
|
3529
|
-
L:
|
|
3784
|
+
L: 227,
|
|
3530
3785
|
S: this,
|
|
3531
3786
|
C: (f, a) => f(...a)
|
|
3532
3787
|
});
|
|
@@ -3546,7 +3801,7 @@ var LibDataChannelTransport = class {
|
|
|
3546
3801
|
err
|
|
3547
3802
|
}, {
|
|
3548
3803
|
F: __dxlog_file15,
|
|
3549
|
-
L:
|
|
3804
|
+
L: 238,
|
|
3550
3805
|
S: this,
|
|
3551
3806
|
C: (f, a) => f(...a)
|
|
3552
3807
|
});
|
|
@@ -3565,7 +3820,7 @@ var LibDataChannelTransport = class {
|
|
|
3565
3820
|
signal
|
|
3566
3821
|
}, {
|
|
3567
3822
|
F: __dxlog_file15,
|
|
3568
|
-
L:
|
|
3823
|
+
L: 249,
|
|
3569
3824
|
S: this,
|
|
3570
3825
|
C: (f, a) => f(...a)
|
|
3571
3826
|
});
|
|
@@ -3574,12 +3829,62 @@ var LibDataChannelTransport = class {
|
|
|
3574
3829
|
}).catch((err) => {
|
|
3575
3830
|
import_log14.log.catch(err, void 0, {
|
|
3576
3831
|
F: __dxlog_file15,
|
|
3577
|
-
L:
|
|
3832
|
+
L: 254,
|
|
3578
3833
|
S: this,
|
|
3579
3834
|
C: (f, a) => f(...a)
|
|
3580
3835
|
});
|
|
3581
3836
|
});
|
|
3582
3837
|
}
|
|
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() {
|
|
3850
|
+
return this._peer.then(async (peer) => {
|
|
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];
|
|
3860
|
+
}
|
|
3861
|
+
return {
|
|
3862
|
+
transport,
|
|
3863
|
+
selectedCandidatePair,
|
|
3864
|
+
remoteCandidate,
|
|
3865
|
+
raw: Object.fromEntries(stats)
|
|
3866
|
+
};
|
|
3867
|
+
});
|
|
3868
|
+
}
|
|
3869
|
+
async getStats() {
|
|
3870
|
+
const stats = await this._getStats();
|
|
3871
|
+
if (!stats) {
|
|
3872
|
+
return {
|
|
3873
|
+
bytesSent: 0,
|
|
3874
|
+
bytesReceived: 0,
|
|
3875
|
+
packetsSent: 0,
|
|
3876
|
+
packetsReceived: 0,
|
|
3877
|
+
rawStats: {}
|
|
3878
|
+
};
|
|
3879
|
+
}
|
|
3880
|
+
return {
|
|
3881
|
+
bytesSent: stats.transport.bytesSent,
|
|
3882
|
+
bytesReceived: stats.transport.bytesReceived,
|
|
3883
|
+
packetsSent: 0,
|
|
3884
|
+
packetsReceived: 0,
|
|
3885
|
+
rawStats: stats.raw
|
|
3886
|
+
};
|
|
3887
|
+
}
|
|
3583
3888
|
// TODO(nf): add classmethod to call node-datachannel.cleanup() when all instances have been destroyed?
|
|
3584
3889
|
async destroy() {
|
|
3585
3890
|
await this._close();
|
|
@@ -3597,6 +3902,7 @@ var createLibDataChannelTransportFactory = (webrtcConfig) => ({
|
|
|
3597
3902
|
webrtcConfig
|
|
3598
3903
|
})
|
|
3599
3904
|
});
|
|
3905
|
+
var importESM = Function("path", "return import(path)");
|
|
3600
3906
|
var __dxlog_file16 = "/home/runner/work/dxos/dxos/packages/core/mesh/network-manager/src/transport/tcp-transport.ts";
|
|
3601
3907
|
var TcpTransportFactory = {
|
|
3602
3908
|
createTransport: (params) => new TcpTransport(params)
|
|
@@ -3689,13 +3995,29 @@ var TcpTransport = class {
|
|
|
3689
3995
|
host: "localhost"
|
|
3690
3996
|
});
|
|
3691
3997
|
}
|
|
3998
|
+
async getDetails() {
|
|
3999
|
+
if (this.options.initiator) {
|
|
4000
|
+
const { port: port2, address: address2 } = this._server?.address();
|
|
4001
|
+
return `LISTEN ${address2}:${port2}`;
|
|
4002
|
+
}
|
|
4003
|
+
const { port, address } = this._socket?.address();
|
|
4004
|
+
return `ACCEPT ${address}:${port}`;
|
|
4005
|
+
}
|
|
4006
|
+
async getStats() {
|
|
4007
|
+
return {
|
|
4008
|
+
bytesSent: 0,
|
|
4009
|
+
bytesReceived: 0,
|
|
4010
|
+
packetsSent: 0,
|
|
4011
|
+
packetsReceived: 0
|
|
4012
|
+
};
|
|
4013
|
+
}
|
|
3692
4014
|
_handleSocket(socket) {
|
|
3693
4015
|
(0, import_log15.log)("handling socket", {
|
|
3694
4016
|
remotePort: socket.remotePort,
|
|
3695
4017
|
localPort: socket.localPort
|
|
3696
4018
|
}, {
|
|
3697
4019
|
F: __dxlog_file16,
|
|
3698
|
-
L:
|
|
4020
|
+
L: 109,
|
|
3699
4021
|
S: this,
|
|
3700
4022
|
C: (f, a) => f(...a)
|
|
3701
4023
|
});
|
|
@@ -3707,7 +4029,7 @@ var TcpTransport = class {
|
|
|
3707
4029
|
port: this._socket?.remotePort
|
|
3708
4030
|
}, {
|
|
3709
4031
|
F: __dxlog_file16,
|
|
3710
|
-
L:
|
|
4032
|
+
L: 115,
|
|
3711
4033
|
S: this,
|
|
3712
4034
|
C: (f, a) => f(...a)
|
|
3713
4035
|
});
|
|
@@ -3726,8 +4048,8 @@ var createTeleportProtocolFactory = (onConnection) => {
|
|
|
3726
4048
|
const teleport = new import_teleport.Teleport(params);
|
|
3727
4049
|
return {
|
|
3728
4050
|
stream: teleport.stream,
|
|
3729
|
-
open: async () => {
|
|
3730
|
-
await teleport.open();
|
|
4051
|
+
open: async (sessionId) => {
|
|
4052
|
+
await teleport.open(sessionId);
|
|
3731
4053
|
await onConnection(teleport);
|
|
3732
4054
|
},
|
|
3733
4055
|
close: async () => {
|
|
@@ -3768,4 +4090,4 @@ var createTeleportProtocolFactory = (onConnection) => {
|
|
|
3768
4090
|
createSimplePeerTransportFactory,
|
|
3769
4091
|
createTeleportProtocolFactory
|
|
3770
4092
|
});
|
|
3771
|
-
//# sourceMappingURL=chunk-
|
|
4093
|
+
//# sourceMappingURL=chunk-Y2B5BDRH.cjs.map
|