@dxos/network-manager 0.1.58-main.4cbb52d → 0.1.58-main.4e2a73a
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-CNQ55TFQ.mjs → chunk-HKHUCTRB.mjs} +40 -34
- package/dist/lib/browser/chunk-HKHUCTRB.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +1 -1
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +109 -109
- package/dist/lib/browser/testing/index.mjs.map +4 -4
- package/dist/lib/node/index.cjs +321 -315
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/testing/index.cjs +836 -829
- package/dist/lib/node/testing/index.cjs.map +4 -4
- package/dist/types/src/swarm/peer.d.ts +2 -2
- package/dist/types/src/swarm/peer.d.ts.map +1 -1
- package/dist/types/src/swarm/swarm-mapper.d.ts.map +1 -1
- package/dist/types/src/swarm/swarm.d.ts +2 -2
- package/dist/types/src/swarm/swarm.d.ts.map +1 -1
- package/dist/types/src/testing/test-builder.d.ts +1 -1
- package/dist/types/src/testing/test-builder.d.ts.map +1 -1
- package/dist/types/src/tests/basic-test-suite.d.ts.map +1 -1
- package/dist/types/src/topology/star-topology.d.ts.map +1 -1
- package/dist/types/src/transport/simplepeer-transport-proxy.d.ts.map +1 -1
- package/dist/types/src/transport/simplepeer-transport-service.d.ts.map +1 -1
- package/dist/types/src/transport/simplepeer-transport.d.ts.map +1 -1
- package/package.json +17 -17
- package/src/swarm/connection.test.ts +1 -1
- package/src/swarm/peer.ts +2 -2
- package/src/swarm/swarm-mapper.ts +4 -7
- package/src/swarm/swarm.test.ts +3 -3
- package/src/swarm/swarm.ts +3 -3
- package/src/testing/test-builder.ts +1 -1
- package/src/tests/basic-test-suite.ts +1 -1
- package/src/tests/memory-transport.test.ts +2 -2
- package/src/tests/tcp-transport.test.ts +2 -2
- package/src/tests/webrtc-transport.test.ts +1 -1
- package/src/topology/star-topology.ts +1 -4
- package/src/transport/simplepeer-transport-proxy.ts +25 -24
- package/src/transport/simplepeer-transport-service.ts +1 -4
- package/src/transport/simplepeer-transport.ts +3 -5
- package/dist/lib/browser/chunk-CNQ55TFQ.mjs.map +0 -7
|
@@ -2,11 +2,11 @@ import { Event } from '@dxos/async';
|
|
|
2
2
|
import { PublicKey } from '@dxos/keys';
|
|
3
3
|
import { SystemError } from '@dxos/protocols';
|
|
4
4
|
import { Answer } from '@dxos/protocols/proto/dxos/mesh/swarm';
|
|
5
|
+
import { Connection } from './connection';
|
|
6
|
+
import { ConnectionLimiter } from './connection-limiter';
|
|
5
7
|
import { OfferMessage, SignalMessage, SignalMessenger } from '../signal';
|
|
6
8
|
import { TransportFactory } from '../transport';
|
|
7
9
|
import { WireProtocolProvider } from '../wire-protocol';
|
|
8
|
-
import { Connection } from './connection';
|
|
9
|
-
import { ConnectionLimiter } from './connection-limiter';
|
|
10
10
|
export declare class ConnectionDisplacedError extends SystemError {
|
|
11
11
|
constructor();
|
|
12
12
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"peer.d.ts","sourceRoot":"","sources":["../../../../src/swarm/peer.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,EAA8B,MAAM,aAAa,CAAC;AAGhE,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,EAAkB,WAAW,EAAgB,MAAM,iBAAiB,CAAC;AAC5E,OAAO,EAAE,MAAM,EAAE,MAAM,uCAAuC,CAAC;AAE/D,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"peer.d.ts","sourceRoot":"","sources":["../../../../src/swarm/peer.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,EAA8B,MAAM,aAAa,CAAC;AAGhE,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,EAAkB,WAAW,EAAgB,MAAM,iBAAiB,CA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arm-mapper.d.ts","sourceRoot":"","sources":["../../../../src/swarm/swarm-mapper.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,EAAsB,MAAM,aAAa,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAIvC,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,eAAe,GAAG,sBAAsB,GAAG,IAAI,CAAC;AAExE;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,SAAS,CAAC;IACd,KAAK,EAAE,SAAS,CAAC;IACjB,WAAW,EAAE,SAAS,EAAE,CAAC;CAC1B;AAID,qBAAa,WAAW;IAWV,OAAO,CAAC,QAAQ,CAAC,MAAM;IAVnC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAA4B;IAC3D,OAAO,CAAC,QAAQ,CAAC,wBAAwB,CAA0D;IACnG,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAuD;IAE9E,QAAQ,CAAC,UAAU,oBAA2B;IAE9C,IAAI,KAAK,IAAI,QAAQ,EAAE,CAEtB;gBAE4B,MAAM,EAAE,KAAK;IA+B1C,OAAO,CAAC,OAAO;IAmDf,OAAO;CAIR"}
|
|
@@ -3,13 +3,13 @@ import { PublicKey } from '@dxos/keys';
|
|
|
3
3
|
import { Messenger } from '@dxos/messaging';
|
|
4
4
|
import { SwarmEvent } from '@dxos/protocols/proto/dxos/mesh/signal';
|
|
5
5
|
import { Answer } from '@dxos/protocols/proto/dxos/mesh/swarm';
|
|
6
|
+
import { Connection } from './connection';
|
|
7
|
+
import { ConnectionLimiter } from './connection-limiter';
|
|
6
8
|
import { OfferMessage, SignalMessage } from '../signal';
|
|
7
9
|
import { Topology } from '../topology';
|
|
8
10
|
import { TransportFactory } from '../transport';
|
|
9
11
|
import { Topic } from '../types';
|
|
10
12
|
import { WireProtocolProvider } from '../wire-protocol';
|
|
11
|
-
import { Connection } from './connection';
|
|
12
|
-
import { ConnectionLimiter } from './connection-limiter';
|
|
13
13
|
/**
|
|
14
14
|
* A single peer's view of the swarm.
|
|
15
15
|
* Manages a set of connections implemented by simple-peer instances.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"swarm.d.ts","sourceRoot":"","sources":["../../../../src/swarm/swarm.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,EAAmB,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE7D,OAAO,EAAE,UAAU,EAAE,MAAM,wCAAwC,CAAC;AACpE,OAAO,EAAE,MAAM,EAAE,MAAM,uCAAuC,CAAC;AAG/D,OAAO,
|
|
1
|
+
{"version":3,"file":"swarm.d.ts","sourceRoot":"","sources":["../../../../src/swarm/swarm.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,EAAmB,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE7D,OAAO,EAAE,UAAU,EAAE,MAAM,wCAAwC,CAAC;AACpE,OAAO,EAAE,MAAM,EAAE,MAAM,uCAAuC,CAAC;AAG/D,OAAO,EAAE,UAAU,EAAmB,MAAM,cAAc,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,EAAkB,YAAY,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AACxE,OAAO,EAAmB,QAAQ,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,oBAAoB,EAA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/C,SAAS;IAOT,QAAQ;IAId,OAAO,CAAC,gBAAgB;YAkDV,YAAY;IAM1B,OAAO,CAAC,mBAAmB;IAuC3B;;OAEG;YACW,mBAAmB;YA0BnB,gBAAgB;CAQ/B"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { PublicKey } from '@dxos/keys';
|
|
2
2
|
import { MemorySignalManager, WebsocketSignalManager } from '@dxos/messaging';
|
|
3
3
|
import { Runtime } from '@dxos/protocols/proto/dxos/config';
|
|
4
|
+
import { TestWireProtocol, type TestTeleportExtensionFactory } from './test-wire-protocol';
|
|
4
5
|
import { NetworkManager } from '../network-manager';
|
|
5
6
|
import { FullyConnectedTopology } from '../topology';
|
|
6
7
|
import { TransportKind } from '../transport';
|
|
7
|
-
import { TestWireProtocol, type TestTeleportExtensionFactory } from './test-wire-protocol';
|
|
8
8
|
export declare const TEST_SIGNAL_HOSTS: Runtime.Services.Signal[];
|
|
9
9
|
export type TestBuilderOptions = {
|
|
10
10
|
signalHosts?: Runtime.Services.Signal[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test-builder.d.ts","sourceRoot":"","sources":["../../../../src/testing/test-builder.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,EACL,mBAAmB,EAGnB,sBAAsB,EACvB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAAE,OAAO,EAAE,MAAM,mCAAmC,CAAC;AAI5D,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"test-builder.d.ts","sourceRoot":"","sources":["../../../../src/testing/test-builder.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,EACL,mBAAmB,EAGnB,sBAAsB,EACvB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAAE,OAAO,EAAE,MAAM,mCAAmC,CAAC;AAI5D,OAAO,EAAE,gBAAgB,EAAE,KAAK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Q;IACvB,QAAQ,CAAC,KAAK,EAAE,SAAS;IACzB,QAAQ,CAAC,gBAAgB,EAAE,4BAA4B;IALzD,QAAQ,EAAE,gBAAgB,CAAC;gBAGhB,IAAI,EAAE,QAAQ,EACd,KAAK,EAAE,SAAS,EAChB,gBAAgB,EAAE,4BAA4B;IASnD,IAAI,CAAC,QAAQ,yBAA+B;IAW5C,KAAK;CAIZ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"basic-test-suite.d.ts","sourceRoot":"","sources":["../../../../src/tests/basic-test-suite.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"basic-test-suite.d.ts","sourceRoot":"","sources":["../../../../src/tests/basic-test-suite.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAKzC;;GAEG;AACH,eAAO,MAAM,cAAc,gBAAiB,WAAW,6BA2LtD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"star-topology.d.ts","sourceRoot":"","sources":["../../../../src/topology/star-topology.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAGvC,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEvD,qBAAa,YAAa,YAAW,QAAQ;
|
|
1
|
+
{"version":3,"file":"star-topology.d.ts","sourceRoot":"","sources":["../../../../src/topology/star-topology.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAGvC,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEvD,qBAAa,YAAa,YAAW,QAAQ;IAG/B,OAAO,CAAC,QAAQ,CAAC,YAAY;IAFzC,OAAO,CAAC,WAAW,CAAC,CAAkB;gBAET,YAAY,EAAE,SAAS;IAEpD,QAAQ;IAIR,IAAI,CAAC,UAAU,EAAE,eAAe,GAAG,IAAI;IAKvC,MAAM,IAAI,IAAI;IAwBR,OAAO,CAAC,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC,OAAO,CAAC;IAW1C,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAG/B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simplepeer-transport-proxy.d.ts","sourceRoot":"","sources":["../../../../src/transport/simplepeer-transport-proxy.ts"],"names":[],"mappings":";AAMA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAGpC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAW1C,OAAO,EAAgC,aAAa,EAAE,MAAM,wCAAwC,CAAC;AACrG,OAAO,EAAE,MAAM,EAAE,MAAM,uCAAuC,CAAC;AAG/D,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE5E,MAAM,MAAM,8BAA8B,GAAG;IAC3C,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC,eAAe,CAAC;IAC/B,aAAa,EAAE,aAAa,CAAC;IAE7B,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC/C,CAAC;AAEF,qBAAa,wBAAyB,YAAW,SAAS;
|
|
1
|
+
{"version":3,"file":"simplepeer-transport-proxy.d.ts","sourceRoot":"","sources":["../../../../src/transport/simplepeer-transport-proxy.ts"],"names":[],"mappings":";AAMA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAGpC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAW1C,OAAO,EAAgC,aAAa,EAAE,MAAM,wCAAwC,CAAC;AACrG,OAAO,EAAE,MAAM,EAAE,MAAM,uCAAuC,CAAC;AAG/D,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE5E,MAAM,MAAM,8BAA8B,GAA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AAM,wCAAwC,CAAC;AAWhD,qBAAa,0BAA2B,YAAW,aAAa;
|
|
1
|
+
{"version":3,"file":"simplepeer-transport-service.d.ts","sourceRoot":"","sources":["../../../../src/transport/simplepeer-transport-service.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAI9C,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,aAAa,EACb,WAAW,EACX,WAAW,EAEX,YAAY,EACb,MAAM,wCAAwC,CAAC;AAWhD,qBAAa,0BAA2B,YAAW,aAAa;IAGlD,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC;IAF3C,OAAO,CAAC,QAAQ,CAAC,UAAU,CAA6D;gBAE3D,aAAa,CAAC,KAAK;IAEhD,IAAI,CAAC,OAAO,EAAE,iBAAiB,GAAG,MAAM,CAAC,WAAW,CAAC;IA0E/C,UAAU,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IAK7D,QAAQ,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAW1D,KAAK,CAAC,EAAE,OAAO,EAAE,EAAE,YAAY;CAMtC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simplepeer-transport.d.ts","sourceRoot":"","sources":["../../../../src/transport/simplepeer-transport.ts"],"names":[],"mappings":";AAQA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,WAAW,EAAS,MAAM,aAAa,CAAC;AAIjD,OAAO,EAAE,MAAM,EAAE,MAAM,uCAAuC,CAAC;AAE/D,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAG1D,MAAM,MAAM,yBAAyB,GAAG;IACtC,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC,eAAe,CAAC;IAC/B,YAAY,CA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cAAqB;IAEpC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAA8B;gBAE7B,MAAM,EAAE,yBAAyB;IAgFxD,OAAO;IASb,MAAM,CAAC,MAAM,EAAE,MAAM;YASP,kBAAkB;CAIjC;AAED,eAAO,MAAM,gCAAgC,kBAAmB,GAAG,KAAG,gBAMpE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/network-manager",
|
|
3
|
-
"version": "0.1.58-main.
|
|
3
|
+
"version": "0.1.58-main.4e2a73a",
|
|
4
4
|
"description": "Network Manager",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -30,21 +30,21 @@
|
|
|
30
30
|
"tiny-invariant": "^1.3.1",
|
|
31
31
|
"ws": "^7.4.4",
|
|
32
32
|
"xor-distance": "^2.0.0",
|
|
33
|
-
"@dxos/async": "0.1.58-main.
|
|
34
|
-
"@dxos/codec-protobuf": "0.1.58-main.
|
|
35
|
-
"@dxos/context": "0.1.58-main.
|
|
36
|
-
"@dxos/credentials": "0.1.58-main.
|
|
37
|
-
"@dxos/crypto": "0.1.58-main.
|
|
38
|
-
"@dxos/debug": "0.1.58-main.
|
|
39
|
-
"@dxos/invariant": "0.1.58-main.
|
|
40
|
-
"@dxos/keys": "0.1.58-main.
|
|
41
|
-
"@dxos/log": "0.1.58-main.
|
|
42
|
-
"@dxos/messaging": "0.1.58-main.
|
|
43
|
-
"@dxos/node-std": "0.1.58-main.
|
|
44
|
-
"@dxos/protocols": "0.1.58-main.
|
|
45
|
-
"@dxos/rpc": "0.1.58-main.
|
|
46
|
-
"@dxos/teleport": "0.1.58-main.
|
|
47
|
-
"@dxos/util": "0.1.58-main.
|
|
33
|
+
"@dxos/async": "0.1.58-main.4e2a73a",
|
|
34
|
+
"@dxos/codec-protobuf": "0.1.58-main.4e2a73a",
|
|
35
|
+
"@dxos/context": "0.1.58-main.4e2a73a",
|
|
36
|
+
"@dxos/credentials": "0.1.58-main.4e2a73a",
|
|
37
|
+
"@dxos/crypto": "0.1.58-main.4e2a73a",
|
|
38
|
+
"@dxos/debug": "0.1.58-main.4e2a73a",
|
|
39
|
+
"@dxos/invariant": "0.1.58-main.4e2a73a",
|
|
40
|
+
"@dxos/keys": "0.1.58-main.4e2a73a",
|
|
41
|
+
"@dxos/log": "0.1.58-main.4e2a73a",
|
|
42
|
+
"@dxos/messaging": "0.1.58-main.4e2a73a",
|
|
43
|
+
"@dxos/node-std": "0.1.58-main.4e2a73a",
|
|
44
|
+
"@dxos/protocols": "0.1.58-main.4e2a73a",
|
|
45
|
+
"@dxos/rpc": "0.1.58-main.4e2a73a",
|
|
46
|
+
"@dxos/teleport": "0.1.58-main.4e2a73a",
|
|
47
|
+
"@dxos/util": "0.1.58-main.4e2a73a"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@swc-node/register": "1.5.4",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"earljs": "~0.1.10",
|
|
55
55
|
"fast-check": "~3.3.0",
|
|
56
56
|
"typescript": "^5.2.2",
|
|
57
|
-
"@dxos/signal": "0.1.58-main.
|
|
57
|
+
"@dxos/signal": "0.1.58-main.4e2a73a"
|
|
58
58
|
},
|
|
59
59
|
"publishConfig": {
|
|
60
60
|
"access": "public"
|
|
@@ -7,9 +7,9 @@ import { PublicKey } from '@dxos/keys';
|
|
|
7
7
|
import { log } from '@dxos/log';
|
|
8
8
|
import { describe, test } from '@dxos/test';
|
|
9
9
|
|
|
10
|
+
import { Connection } from './connection';
|
|
10
11
|
import { TestWireProtocol } from '../testing/test-wire-protocol';
|
|
11
12
|
import { createSimplePeerTransportFactory } from '../transport';
|
|
12
|
-
import { Connection } from './connection';
|
|
13
13
|
|
|
14
14
|
describe('Connection', () => {
|
|
15
15
|
test('initiator opens after responder', async () => {
|
package/src/swarm/peer.ts
CHANGED
|
@@ -10,11 +10,11 @@ import { log } from '@dxos/log';
|
|
|
10
10
|
import { CancelledError, SystemError, TimeoutError } from '@dxos/protocols';
|
|
11
11
|
import { Answer } from '@dxos/protocols/proto/dxos/mesh/swarm';
|
|
12
12
|
|
|
13
|
+
import { Connection, ConnectionState } from './connection';
|
|
14
|
+
import { ConnectionLimiter } from './connection-limiter';
|
|
13
15
|
import { OfferMessage, SignalMessage, SignalMessenger } from '../signal';
|
|
14
16
|
import { TransportFactory } from '../transport';
|
|
15
17
|
import { WireProtocolProvider } from '../wire-protocol';
|
|
16
|
-
import { Connection, ConnectionState } from './connection';
|
|
17
|
-
import { ConnectionLimiter } from './connection-limiter';
|
|
18
18
|
|
|
19
19
|
export class ConnectionDisplacedError extends SystemError {
|
|
20
20
|
constructor() {
|
|
@@ -37,10 +37,7 @@ export class SwarmMapper {
|
|
|
37
37
|
return Array.from(this._peers.values());
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
constructor(
|
|
42
|
-
private readonly _swarm: Swarm
|
|
43
|
-
) {
|
|
40
|
+
constructor(private readonly _swarm: Swarm) {
|
|
44
41
|
this._subscriptions.add(
|
|
45
42
|
_swarm.connectionAdded.on((connection) => {
|
|
46
43
|
this._update();
|
|
@@ -48,9 +45,9 @@ export class SwarmMapper {
|
|
|
48
45
|
connection.remoteId,
|
|
49
46
|
connection.stateChanged.on(() => {
|
|
50
47
|
this._update();
|
|
51
|
-
})
|
|
48
|
+
}),
|
|
52
49
|
);
|
|
53
|
-
})
|
|
50
|
+
}),
|
|
54
51
|
);
|
|
55
52
|
|
|
56
53
|
this._subscriptions.add(
|
|
@@ -58,7 +55,7 @@ export class SwarmMapper {
|
|
|
58
55
|
this._connectionSubscriptions.get(peerId)?.();
|
|
59
56
|
this._connectionSubscriptions.delete(peerId);
|
|
60
57
|
this._update();
|
|
61
|
-
})
|
|
58
|
+
}),
|
|
62
59
|
);
|
|
63
60
|
|
|
64
61
|
// if (_presence) {
|
package/src/swarm/swarm.test.ts
CHANGED
|
@@ -10,12 +10,12 @@ import { MemorySignalManager, MemorySignalManagerContext, Messenger, SignalManag
|
|
|
10
10
|
import { afterTest, describe, test } from '@dxos/test';
|
|
11
11
|
import { ComplexSet } from '@dxos/util';
|
|
12
12
|
|
|
13
|
-
import { TestWireProtocol } from '../testing/test-wire-protocol';
|
|
14
|
-
import { FullyConnectedTopology } from '../topology';
|
|
15
|
-
import { createSimplePeerTransportFactory } from '../transport';
|
|
16
13
|
import { ConnectionState } from './connection';
|
|
17
14
|
import { ConnectionLimiter } from './connection-limiter';
|
|
18
15
|
import { Swarm } from './swarm';
|
|
16
|
+
import { TestWireProtocol } from '../testing/test-wire-protocol';
|
|
17
|
+
import { FullyConnectedTopology } from '../topology';
|
|
18
|
+
import { createSimplePeerTransportFactory } from '../transport';
|
|
19
19
|
|
|
20
20
|
type TestPeer = {
|
|
21
21
|
swarm: Swarm;
|
package/src/swarm/swarm.ts
CHANGED
|
@@ -14,14 +14,14 @@ import { SwarmEvent } from '@dxos/protocols/proto/dxos/mesh/signal';
|
|
|
14
14
|
import { Answer } from '@dxos/protocols/proto/dxos/mesh/swarm';
|
|
15
15
|
import { ComplexMap, isNotNullOrUndefined } from '@dxos/util';
|
|
16
16
|
|
|
17
|
+
import { Connection, ConnectionState } from './connection';
|
|
18
|
+
import { ConnectionLimiter } from './connection-limiter';
|
|
19
|
+
import { Peer } from './peer';
|
|
17
20
|
import { SwarmMessenger, OfferMessage, SignalMessage } from '../signal';
|
|
18
21
|
import { SwarmController, Topology } from '../topology';
|
|
19
22
|
import { TransportFactory } from '../transport';
|
|
20
23
|
import { Topic } from '../types';
|
|
21
24
|
import { WireProtocolProvider } from '../wire-protocol';
|
|
22
|
-
import { Connection, ConnectionState } from './connection';
|
|
23
|
-
import { ConnectionLimiter } from './connection-limiter';
|
|
24
|
-
import { Peer } from './peer';
|
|
25
25
|
|
|
26
26
|
const INITIATION_DELAY = 100;
|
|
27
27
|
|
|
@@ -16,6 +16,7 @@ import { Runtime } from '@dxos/protocols/proto/dxos/config';
|
|
|
16
16
|
import { createLinkedPorts, createProtoRpcPeer, ProtoRpcPeer } from '@dxos/rpc';
|
|
17
17
|
import { ComplexMap } from '@dxos/util';
|
|
18
18
|
|
|
19
|
+
import { TestWireProtocol, type TestTeleportExtensionFactory } from './test-wire-protocol';
|
|
19
20
|
import { NetworkManager } from '../network-manager';
|
|
20
21
|
import { FullyConnectedTopology } from '../topology';
|
|
21
22
|
import {
|
|
@@ -28,7 +29,6 @@ import {
|
|
|
28
29
|
TransportKind,
|
|
29
30
|
} from '../transport';
|
|
30
31
|
import { TcpTransportFactory } from '../transport/tcp-transport';
|
|
31
|
-
import { TestWireProtocol, type TestTeleportExtensionFactory } from './test-wire-protocol';
|
|
32
32
|
|
|
33
33
|
// Signal server will be started by the setup script.
|
|
34
34
|
const port = process.env.SIGNAL_PORT ?? 4000;
|
|
@@ -11,9 +11,9 @@ import { log } from '@dxos/log';
|
|
|
11
11
|
import { afterTest, test } from '@dxos/test';
|
|
12
12
|
import { range } from '@dxos/util';
|
|
13
13
|
|
|
14
|
+
import { exchangeMessages, joinSwarm, leaveSwarm, openAndCloseAfterTest } from './utils';
|
|
14
15
|
import { TestBuilder } from '../testing';
|
|
15
16
|
import { FullyConnectedTopology, StarTopology } from '../topology';
|
|
16
|
-
import { exchangeMessages, joinSwarm, leaveSwarm, openAndCloseAfterTest } from './utils';
|
|
17
17
|
|
|
18
18
|
// TODO(burdon): Use PublicKey throughout (remove conversion to strings, from buffers, etc.)
|
|
19
19
|
|
|
@@ -8,10 +8,10 @@ import { PublicKey } from '@dxos/keys';
|
|
|
8
8
|
import { test } from '@dxos/test';
|
|
9
9
|
import { range } from '@dxos/util';
|
|
10
10
|
|
|
11
|
-
import { TestBuilder } from '../testing';
|
|
12
|
-
import { FullyConnectedTopology } from '../topology';
|
|
13
11
|
import { basicTestSuite } from './basic-test-suite';
|
|
14
12
|
import { exchangeMessages, joinSwarm, leaveSwarm, openAndCloseAfterTest } from './utils';
|
|
13
|
+
import { TestBuilder } from '../testing';
|
|
14
|
+
import { FullyConnectedTopology } from '../topology';
|
|
15
15
|
|
|
16
16
|
describe('Memory transport', () => {
|
|
17
17
|
const testBuilder = new TestBuilder();
|
|
@@ -8,11 +8,11 @@ import { PublicKey } from '@dxos/keys';
|
|
|
8
8
|
import { test } from '@dxos/test';
|
|
9
9
|
import { range } from '@dxos/util';
|
|
10
10
|
|
|
11
|
+
import { basicTestSuite } from './basic-test-suite';
|
|
12
|
+
import { exchangeMessages, joinSwarm, leaveSwarm, openAndCloseAfterTest } from './utils';
|
|
11
13
|
import { TestBuilder } from '../testing';
|
|
12
14
|
import { FullyConnectedTopology } from '../topology';
|
|
13
15
|
import { TransportKind } from '../transport';
|
|
14
|
-
import { basicTestSuite } from './basic-test-suite';
|
|
15
|
-
import { exchangeMessages, joinSwarm, leaveSwarm, openAndCloseAfterTest } from './utils';
|
|
16
16
|
|
|
17
17
|
describe('Tcp transport', () => {
|
|
18
18
|
const testBuilder = new TestBuilder({
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
import { describe } from '@dxos/test';
|
|
6
6
|
|
|
7
|
-
import { TEST_SIGNAL_HOSTS, TestBuilder } from '../testing';
|
|
8
7
|
import { basicTestSuite } from './basic-test-suite';
|
|
8
|
+
import { TEST_SIGNAL_HOSTS, TestBuilder } from '../testing';
|
|
9
9
|
|
|
10
10
|
describe('WebRTC transport', () => {
|
|
11
11
|
const testBuilder = new TestBuilder();
|
|
@@ -11,10 +11,7 @@ import { SwarmController, Topology } from './topology';
|
|
|
11
11
|
export class StarTopology implements Topology {
|
|
12
12
|
private _controller?: SwarmController;
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
constructor(
|
|
16
|
-
private readonly _centralPeer: PublicKey
|
|
17
|
-
) {}
|
|
14
|
+
constructor(private readonly _centralPeer: PublicKey) {}
|
|
18
15
|
|
|
19
16
|
toString() {
|
|
20
17
|
return `StarTopology(${this._centralPeer.truncate()})`;
|
|
@@ -43,13 +43,10 @@ export class SimplePeerTransportProxy implements Transport {
|
|
|
43
43
|
private _closed = false;
|
|
44
44
|
private _serviceStream!: Stream<BridgeEvent>;
|
|
45
45
|
|
|
46
|
-
|
|
47
|
-
constructor(
|
|
48
|
-
private readonly _params: SimplePeerTransportProxyParams
|
|
49
|
-
) {
|
|
46
|
+
constructor(private readonly _params: SimplePeerTransportProxyParams) {
|
|
50
47
|
this._serviceStream = this._params.bridgeService.open({
|
|
51
48
|
proxyId: this._proxyId,
|
|
52
|
-
initiator: this._params.initiator
|
|
49
|
+
initiator: this._params.initiator,
|
|
53
50
|
});
|
|
54
51
|
|
|
55
52
|
this._serviceStream.waitUntilReady().then(
|
|
@@ -65,21 +62,25 @@ export class SimplePeerTransportProxy implements Transport {
|
|
|
65
62
|
}
|
|
66
63
|
});
|
|
67
64
|
|
|
68
|
-
this._params.stream.pipe(
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
65
|
+
this._params.stream.pipe(
|
|
66
|
+
new Writable({
|
|
67
|
+
write: (chunk, _, callback) => {
|
|
68
|
+
this._params.bridgeService
|
|
69
|
+
.sendData({
|
|
70
|
+
proxyId: this._proxyId,
|
|
71
|
+
payload: chunk,
|
|
72
|
+
})
|
|
73
|
+
.then(
|
|
74
|
+
() => callback(),
|
|
75
|
+
(err: any) => {
|
|
76
|
+
log.catch(err);
|
|
77
|
+
},
|
|
78
|
+
);
|
|
79
|
+
},
|
|
80
|
+
}),
|
|
81
|
+
);
|
|
81
82
|
},
|
|
82
|
-
(error) => log.catch(error)
|
|
83
|
+
(error) => log.catch(error),
|
|
83
84
|
);
|
|
84
85
|
}
|
|
85
86
|
|
|
@@ -185,15 +186,15 @@ export class SimplePeerTransportProxyFactory implements TransportFactory {
|
|
|
185
186
|
const decodeError = (err: Error | string) => {
|
|
186
187
|
const message = typeof err === 'string' ? err : err.message;
|
|
187
188
|
|
|
188
|
-
if (message.includes('
|
|
189
|
+
if (message.includes('CONNECTION_RESET')) {
|
|
189
190
|
return new ConnectionResetError(message);
|
|
190
|
-
} else if (message.includes('
|
|
191
|
+
} else if (message.includes('TIMEOUT')) {
|
|
191
192
|
return new TimeoutError(message);
|
|
192
|
-
} else if (message.includes('
|
|
193
|
+
} else if (message.includes('PROTOCOL_ERROR')) {
|
|
193
194
|
return new ProtocolError(message);
|
|
194
|
-
} else if (message.includes('
|
|
195
|
+
} else if (message.includes('CONNECTIVITY_ERROR')) {
|
|
195
196
|
return new ConnectivityError(message);
|
|
196
|
-
} else if (message.includes('
|
|
197
|
+
} else if (message.includes('UNKNOWN_PROTOCOL_ERROR')) {
|
|
197
198
|
return new UnknownProtocolError(message);
|
|
198
199
|
} else {
|
|
199
200
|
return typeof err === 'string' ? new Error(err) : err;
|
|
@@ -30,10 +30,7 @@ type TransportState = {
|
|
|
30
30
|
export class SimplePeerTransportService implements BridgeService {
|
|
31
31
|
private readonly transports = new ComplexMap<PublicKey, TransportState>(PublicKey.hash);
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
constructor(
|
|
35
|
-
private readonly _webrtcConfig?: any
|
|
36
|
-
) { }
|
|
33
|
+
constructor(private readonly _webrtcConfig?: any) {}
|
|
37
34
|
|
|
38
35
|
open(request: ConnectionRequest): Stream<BridgeEvent> {
|
|
39
36
|
const rpcStream: Stream<BridgeEvent> = new Stream(({ ready, next, close }) => {
|
|
@@ -72,12 +72,9 @@ export class SimplePeerTransport implements Transport {
|
|
|
72
72
|
} else {
|
|
73
73
|
this.errors.raise(new UnknownProtocolError('unknown RTCError', err));
|
|
74
74
|
}
|
|
75
|
-
|
|
76
|
-
// Safari specific? are all errors of code: "DATA_CHANNEL_ERROR" connection aborts?
|
|
77
|
-
} else if (err.name === 'InvalidStateError') {
|
|
78
|
-
this.errors.raise(new ConnectionResetError('safari WebRTC error', err));
|
|
79
75
|
// catch more generic simple-peer errors: https://github.com/feross/simple-peer/blob/master/README.md#error-codes
|
|
80
76
|
} else if ('code' in err) {
|
|
77
|
+
log.info('simple-peer error', err);
|
|
81
78
|
switch (err.code) {
|
|
82
79
|
case 'ERR_WEBRTC_SUPPORT':
|
|
83
80
|
this.errors.raise(new ProtocolError('WebRTC not supported', err));
|
|
@@ -96,12 +93,13 @@ export class SimplePeerTransport implements Transport {
|
|
|
96
93
|
this.errors.raise(new Error('unknown simple-peer error'));
|
|
97
94
|
}
|
|
98
95
|
} else {
|
|
96
|
+
log.info('unknown peer connection error', err);
|
|
99
97
|
this.errors.raise(err);
|
|
100
98
|
}
|
|
101
99
|
|
|
102
100
|
// Try to gather additional information about the connection.
|
|
103
101
|
try {
|
|
104
|
-
if (typeof (this._peer as any)?._pc
|
|
102
|
+
if (typeof (this._peer as any)?._pc?.getStats === 'function') {
|
|
105
103
|
(this._peer as any)._pc.getStats().then((stats: any) => {
|
|
106
104
|
log.warn('report after webrtc error', {
|
|
107
105
|
config: this.params.webrtcConfig,
|