@libp2p/interop 6.0.0 → 6.0.1
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/index.min.js +5 -5
- package/dist/src/pubsub/floodsub.d.ts.map +1 -1
- package/dist/src/pubsub/floodsub.js +7 -2
- package/dist/src/pubsub/floodsub.js.map +1 -1
- package/dist/src/pubsub/gossipsub.d.ts.map +1 -1
- package/dist/src/pubsub/gossipsub.js +7 -2
- package/dist/src/pubsub/gossipsub.js.map +1 -1
- package/dist/src/pubsub/hybrid.d.ts.map +1 -1
- package/dist/src/pubsub/hybrid.js +7 -2
- package/dist/src/pubsub/hybrid.js.map +1 -1
- package/package.json +3 -2
- package/src/pubsub/floodsub.ts +9 -2
- package/src/pubsub/gossipsub.ts +9 -2
- package/src/pubsub/hybrid.ts +8 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"floodsub.d.ts","sourceRoot":"","sources":["../../../src/pubsub/floodsub.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAU,aAAa,EAA0B,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"floodsub.d.ts","sourceRoot":"","sources":["../../../src/pubsub/floodsub.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAU,aAAa,EAA0B,MAAM,aAAa,CAAA;AAMhF,wBAAgB,aAAa,CAAE,OAAO,EAAE,aAAa,GAAG,IAAI,CAY3D"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { expect } from 'aegir/chai';
|
|
3
3
|
import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string';
|
|
4
4
|
import first from 'it-first';
|
|
5
|
+
import pWaitFor from 'p-wait-for';
|
|
5
6
|
export function floodsubTests(factory) {
|
|
6
7
|
const nodeTypes = ['js', 'go'];
|
|
7
8
|
for (const typeA of nodeTypes) {
|
|
@@ -13,6 +14,7 @@ export function floodsubTests(factory) {
|
|
|
13
14
|
function runFloodsubTests(factory, optionsA, optionsB) {
|
|
14
15
|
describe('pubsub.floodSub', () => {
|
|
15
16
|
let daemons;
|
|
17
|
+
let identifyB;
|
|
16
18
|
// Start Daemons
|
|
17
19
|
before(async function () {
|
|
18
20
|
this.timeout(20 * 1000);
|
|
@@ -21,7 +23,7 @@ function runFloodsubTests(factory, optionsA, optionsB) {
|
|
|
21
23
|
factory.spawn(optionsB)
|
|
22
24
|
]);
|
|
23
25
|
const [peerA, peerB] = daemons;
|
|
24
|
-
|
|
26
|
+
identifyB = await peerB.client.identify();
|
|
25
27
|
await peerA.client.connect(identifyB.peerId, identifyB.addrs);
|
|
26
28
|
});
|
|
27
29
|
// Stop daemons
|
|
@@ -42,7 +44,10 @@ function runFloodsubTests(factory, optionsA, optionsB) {
|
|
|
42
44
|
};
|
|
43
45
|
const publisher = async () => {
|
|
44
46
|
// wait for subscription stream
|
|
45
|
-
await
|
|
47
|
+
await pWaitFor(async () => {
|
|
48
|
+
const peers = await daemons[0].client.pubsub.getSubscribers(topic);
|
|
49
|
+
return peers.map(p => p.toString()).includes(identifyB.peerId.toString());
|
|
50
|
+
});
|
|
46
51
|
await peerA.client.pubsub.publish(topic, data);
|
|
47
52
|
};
|
|
48
53
|
return await Promise.all([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"floodsub.js","sourceRoot":"","sources":["../../../src/pubsub/floodsub.ts"],"names":[],"mappings":"AAAA,sBAAsB;AAEtB,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAEnC,OAAO,EAAE,UAAU,IAAI,oBAAoB,EAAE,MAAM,yBAAyB,CAAA;AAC5E,OAAO,KAAK,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"floodsub.js","sourceRoot":"","sources":["../../../src/pubsub/floodsub.ts"],"names":[],"mappings":"AAAA,sBAAsB;AAEtB,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAEnC,OAAO,EAAE,UAAU,IAAI,oBAAoB,EAAE,M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Q,EAAE,CAAC,CAAA;gBAC3E,CAAC,CAAC,CAAA;gBAEF,MAAM,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA;YAChD,CAAC,CAAA;YAED,OAAO,MAAM,OAAO,CAAC,GAAG,CAAC;gBACvB,UAAU,EAAE;gBACZ,SAAS,EAAE;aACZ,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gossipsub.d.ts","sourceRoot":"","sources":["../../../src/pubsub/gossipsub.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAU,aAAa,EAA0B,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"gossipsub.d.ts","sourceRoot":"","sources":["../../../src/pubsub/gossipsub.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAU,aAAa,EAA0B,MAAM,aAAa,CAAA;AAMhF,wBAAgB,cAAc,CAAE,OAAO,EAAE,aAAa,GAAG,IAAI,CAY5D"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { expect } from 'aegir/chai';
|
|
3
3
|
import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string';
|
|
4
4
|
import first from 'it-first';
|
|
5
|
+
import pWaitFor from 'p-wait-for';
|
|
5
6
|
export function gossipsubTests(factory) {
|
|
6
7
|
const nodeTypes = ['js', 'go'];
|
|
7
8
|
for (const typeA of nodeTypes) {
|
|
@@ -13,6 +14,7 @@ export function gossipsubTests(factory) {
|
|
|
13
14
|
function runGossipsubTests(factory, optionsA, optionsB) {
|
|
14
15
|
describe('pubsub.gossipsub', () => {
|
|
15
16
|
let daemons;
|
|
17
|
+
let identify1;
|
|
16
18
|
// Start Daemons
|
|
17
19
|
before(async function () {
|
|
18
20
|
this.timeout(20 * 1000);
|
|
@@ -20,7 +22,7 @@ function runGossipsubTests(factory, optionsA, optionsB) {
|
|
|
20
22
|
factory.spawn(optionsA),
|
|
21
23
|
factory.spawn(optionsB)
|
|
22
24
|
]);
|
|
23
|
-
|
|
25
|
+
identify1 = await daemons[1].client.identify();
|
|
24
26
|
await daemons[0].client.connect(identify1.peerId, identify1.addrs);
|
|
25
27
|
});
|
|
26
28
|
// Stop daemons
|
|
@@ -40,7 +42,10 @@ function runGossipsubTests(factory, optionsA, optionsB) {
|
|
|
40
42
|
};
|
|
41
43
|
const publisher = async () => {
|
|
42
44
|
// wait for subscription stream
|
|
43
|
-
await
|
|
45
|
+
await pWaitFor(async () => {
|
|
46
|
+
const peers = await daemons[0].client.pubsub.getSubscribers(topic);
|
|
47
|
+
return peers.map(p => p.toString()).includes(identify1.peerId.toString());
|
|
48
|
+
});
|
|
44
49
|
await daemons[0].client.pubsub.publish(topic, data);
|
|
45
50
|
};
|
|
46
51
|
return await Promise.all([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gossipsub.js","sourceRoot":"","sources":["../../../src/pubsub/gossipsub.ts"],"names":[],"mappings":"AAAA,sBAAsB;AAEtB,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAEnC,OAAO,EAAE,UAAU,IAAI,oBAAoB,EAAE,MAAM,yBAAyB,CAAA;AAC5E,OAAO,KAAK,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"gossipsub.js","sourceRoot":"","sources":["../../../src/pubsub/gossipsub.ts"],"names":[],"mappings":"AAAA,sBAAsB;AAEtB,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAEnC,OAAO,EAAE,UAAU,IAAI,oBAAoB,EAAE,MAAM,yBAAyB,CAAA;AAC5E,OAAO,KAAK,MAAM,UAAU,CAAA;AAC5B,OAAO,QAAQ,MAAM,YAAY,CAAA;AAGjC,MAAM,UAAU,cAAc,CAAE,OAAsB;IACpD,MAAM,SAAS,GAAe,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;IAE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AA;QACJ,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hybrid.d.ts","sourceRoot":"","sources":["../../../src/pubsub/hybrid.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAU,aAAa,EAA0B,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"hybrid.d.ts","sourceRoot":"","sources":["../../../src/pubsub/hybrid.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAU,aAAa,EAA0B,MAAM,aAAa,CAAA;AAMhF,wBAAgB,WAAW,CAAE,OAAO,EAAE,aAAa,GAAG,IAAI,CAYzD"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { expect } from 'aegir/chai';
|
|
3
3
|
import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string';
|
|
4
4
|
import first from 'it-first';
|
|
5
|
+
import pWaitFor from 'p-wait-for';
|
|
5
6
|
export function hybridTests(factory) {
|
|
6
7
|
const nodeTypes = ['js', 'go'];
|
|
7
8
|
for (const typeA of nodeTypes) {
|
|
@@ -13,6 +14,7 @@ export function hybridTests(factory) {
|
|
|
13
14
|
function runHybridTests(factory, optionsA, optionsB) {
|
|
14
15
|
describe('pubsub.hybrid', () => {
|
|
15
16
|
let daemons;
|
|
17
|
+
let identify1;
|
|
16
18
|
// Start Daemons
|
|
17
19
|
before(async function () {
|
|
18
20
|
this.timeout(20 * 1000);
|
|
@@ -20,7 +22,7 @@ function runHybridTests(factory, optionsA, optionsB) {
|
|
|
20
22
|
factory.spawn(optionsA),
|
|
21
23
|
factory.spawn(optionsB)
|
|
22
24
|
]);
|
|
23
|
-
|
|
25
|
+
identify1 = await daemons[1].client.identify();
|
|
24
26
|
await daemons[0].client.connect(identify1.peerId, identify1.addrs);
|
|
25
27
|
});
|
|
26
28
|
// Stop daemons
|
|
@@ -40,7 +42,10 @@ function runHybridTests(factory, optionsA, optionsB) {
|
|
|
40
42
|
};
|
|
41
43
|
const publisher = async () => {
|
|
42
44
|
// wait for subscription stream
|
|
43
|
-
await
|
|
45
|
+
await pWaitFor(async () => {
|
|
46
|
+
const peers = await daemons[0].client.pubsub.getSubscribers(topic);
|
|
47
|
+
return peers.map(p => p.toString()).includes(identify1.peerId.toString());
|
|
48
|
+
});
|
|
44
49
|
await daemons[0].client.pubsub.publish(topic, data);
|
|
45
50
|
};
|
|
46
51
|
return await Promise.all([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hybrid.js","sourceRoot":"","sources":["../../../src/pubsub/hybrid.ts"],"names":[],"mappings":"AAAA,sBAAsB;AAEtB,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAEnC,OAAO,EAAE,UAAU,IAAI,oBAAoB,EAAE,MAAM,yBAAyB,CAAA;AAC5E,OAAO,KAAK,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"hybrid.js","sourceRoot":"","sources":["../../../src/pubsub/hybrid.ts"],"names":[],"mappings":"AAAA,sBAAsB;AAEtB,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAEnC,OAAO,EAAE,UAAU,IAAI,oBAAoB,EAAE,MAAM,yBAAyB,CAAA;AAC5E,OAAO,KAAK,MAAM,UAAU,CAAA;AAC5B,OAAO,QAAQ,MAAM,YAAY,CAAA;AAGjC,MAAM,UAAU,WAAW,CAAE,OAAsB;IACjD,MAAM,SAAS,GAAe,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;IAE1C,KAAK,MAAM,KAAK,IAAI,SAAS,EAAE;QAC7B,KAAK,MAAM,KAAK,IAAI,SAAS,EAAE;YAC7B,cAAc,CACZ,OAAO,EACP,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,UAAU,EAAE,EACvD,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,WAAW,EAAE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
"homepage": "https://github.com/libp2p/interop#readme",
|
|
@@ -133,7 +133,7 @@
|
|
|
133
133
|
"release": "aegir release"
|
|
134
134
|
},
|
|
135
135
|
"dependencies": {
|
|
136
|
-
"@libp2p/daemon-client": "^4.
|
|
136
|
+
"@libp2p/daemon-client": "^4.1.0",
|
|
137
137
|
"@libp2p/interface-peer-id": "^2.0.1",
|
|
138
138
|
"@libp2p/interface-peer-info": "^1.0.7",
|
|
139
139
|
"@multiformats/multiaddr": "^11.4.0",
|
|
@@ -147,6 +147,7 @@
|
|
|
147
147
|
"multiformats": "^11.0.0",
|
|
148
148
|
"p-defer": "^4.0.0",
|
|
149
149
|
"p-retry": "^5.1.0",
|
|
150
|
+
"p-wait-for": "^5.0.0",
|
|
150
151
|
"protons-runtime": "^4.0.2",
|
|
151
152
|
"uint8arraylist": "^2.4.3",
|
|
152
153
|
"uint8arrays": "^4.0.2"
|
package/src/pubsub/floodsub.ts
CHANGED
|
@@ -4,6 +4,8 @@ import { expect } from 'aegir/chai'
|
|
|
4
4
|
import type { Daemon, DaemonFactory, NodeType, SpawnOptions } from '../index.js'
|
|
5
5
|
import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'
|
|
6
6
|
import first from 'it-first'
|
|
7
|
+
import pWaitFor from 'p-wait-for'
|
|
8
|
+
import type { IdentifyResult } from '@libp2p/daemon-client'
|
|
7
9
|
|
|
8
10
|
export function floodsubTests (factory: DaemonFactory): void {
|
|
9
11
|
const nodeTypes: NodeType[] = ['js', 'go']
|
|
@@ -22,6 +24,7 @@ export function floodsubTests (factory: DaemonFactory): void {
|
|
|
22
24
|
function runFloodsubTests (factory: DaemonFactory, optionsA: SpawnOptions, optionsB: SpawnOptions): void {
|
|
23
25
|
describe('pubsub.floodSub', () => {
|
|
24
26
|
let daemons: Daemon[]
|
|
27
|
+
let identifyB: IdentifyResult
|
|
25
28
|
|
|
26
29
|
// Start Daemons
|
|
27
30
|
before(async function () {
|
|
@@ -33,7 +36,7 @@ function runFloodsubTests (factory: DaemonFactory, optionsA: SpawnOptions, optio
|
|
|
33
36
|
])
|
|
34
37
|
|
|
35
38
|
const [peerA, peerB] = daemons
|
|
36
|
-
|
|
39
|
+
identifyB = await peerB.client.identify()
|
|
37
40
|
await peerA.client.connect(identifyB.peerId, identifyB.addrs)
|
|
38
41
|
})
|
|
39
42
|
|
|
@@ -61,7 +64,11 @@ function runFloodsubTests (factory: DaemonFactory, optionsA: SpawnOptions, optio
|
|
|
61
64
|
|
|
62
65
|
const publisher = async (): Promise<void> => {
|
|
63
66
|
// wait for subscription stream
|
|
64
|
-
await
|
|
67
|
+
await pWaitFor(async () => {
|
|
68
|
+
const peers = await daemons[0].client.pubsub.getSubscribers(topic)
|
|
69
|
+
return peers.map(p => p.toString()).includes(identifyB.peerId.toString())
|
|
70
|
+
})
|
|
71
|
+
|
|
65
72
|
await peerA.client.pubsub.publish(topic, data)
|
|
66
73
|
}
|
|
67
74
|
|
package/src/pubsub/gossipsub.ts
CHANGED
|
@@ -4,6 +4,8 @@ import { expect } from 'aegir/chai'
|
|
|
4
4
|
import type { Daemon, DaemonFactory, NodeType, SpawnOptions } from '../index.js'
|
|
5
5
|
import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'
|
|
6
6
|
import first from 'it-first'
|
|
7
|
+
import pWaitFor from 'p-wait-for'
|
|
8
|
+
import type { IdentifyResult } from '@libp2p/daemon-client'
|
|
7
9
|
|
|
8
10
|
export function gossipsubTests (factory: DaemonFactory): void {
|
|
9
11
|
const nodeTypes: NodeType[] = ['js', 'go']
|
|
@@ -22,6 +24,7 @@ export function gossipsubTests (factory: DaemonFactory): void {
|
|
|
22
24
|
function runGossipsubTests (factory: DaemonFactory, optionsA: SpawnOptions, optionsB: SpawnOptions): void {
|
|
23
25
|
describe('pubsub.gossipsub', () => {
|
|
24
26
|
let daemons: Daemon[]
|
|
27
|
+
let identify1: IdentifyResult
|
|
25
28
|
|
|
26
29
|
// Start Daemons
|
|
27
30
|
before(async function () {
|
|
@@ -32,7 +35,7 @@ function runGossipsubTests (factory: DaemonFactory, optionsA: SpawnOptions, opti
|
|
|
32
35
|
factory.spawn(optionsB)
|
|
33
36
|
])
|
|
34
37
|
|
|
35
|
-
|
|
38
|
+
identify1 = await daemons[1].client.identify()
|
|
36
39
|
await daemons[0].client.connect(identify1.peerId, identify1.addrs)
|
|
37
40
|
})
|
|
38
41
|
|
|
@@ -59,7 +62,11 @@ function runGossipsubTests (factory: DaemonFactory, optionsA: SpawnOptions, opti
|
|
|
59
62
|
|
|
60
63
|
const publisher = async (): Promise<void> => {
|
|
61
64
|
// wait for subscription stream
|
|
62
|
-
await
|
|
65
|
+
await pWaitFor(async () => {
|
|
66
|
+
const peers = await daemons[0].client.pubsub.getSubscribers(topic)
|
|
67
|
+
return peers.map(p => p.toString()).includes(identify1.peerId.toString())
|
|
68
|
+
})
|
|
69
|
+
|
|
63
70
|
await daemons[0].client.pubsub.publish(topic, data)
|
|
64
71
|
}
|
|
65
72
|
|
package/src/pubsub/hybrid.ts
CHANGED
|
@@ -4,6 +4,8 @@ import { expect } from 'aegir/chai'
|
|
|
4
4
|
import type { Daemon, DaemonFactory, NodeType, SpawnOptions } from '../index.js'
|
|
5
5
|
import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'
|
|
6
6
|
import first from 'it-first'
|
|
7
|
+
import pWaitFor from 'p-wait-for'
|
|
8
|
+
import type { IdentifyResult } from '@libp2p/daemon-client'
|
|
7
9
|
|
|
8
10
|
export function hybridTests (factory: DaemonFactory): void {
|
|
9
11
|
const nodeTypes: NodeType[] = ['js', 'go']
|
|
@@ -22,6 +24,7 @@ export function hybridTests (factory: DaemonFactory): void {
|
|
|
22
24
|
function runHybridTests (factory: DaemonFactory, optionsA: SpawnOptions, optionsB: SpawnOptions): void {
|
|
23
25
|
describe('pubsub.hybrid', () => {
|
|
24
26
|
let daemons: Daemon[]
|
|
27
|
+
let identify1: IdentifyResult
|
|
25
28
|
|
|
26
29
|
// Start Daemons
|
|
27
30
|
before(async function () {
|
|
@@ -32,7 +35,7 @@ function runHybridTests (factory: DaemonFactory, optionsA: SpawnOptions, options
|
|
|
32
35
|
factory.spawn(optionsB)
|
|
33
36
|
])
|
|
34
37
|
|
|
35
|
-
|
|
38
|
+
identify1 = await daemons[1].client.identify()
|
|
36
39
|
await daemons[0].client.connect(identify1.peerId, identify1.addrs)
|
|
37
40
|
})
|
|
38
41
|
|
|
@@ -59,7 +62,10 @@ function runHybridTests (factory: DaemonFactory, optionsA: SpawnOptions, options
|
|
|
59
62
|
|
|
60
63
|
const publisher = async (): Promise<void> => {
|
|
61
64
|
// wait for subscription stream
|
|
62
|
-
await
|
|
65
|
+
await pWaitFor(async () => {
|
|
66
|
+
const peers = await daemons[0].client.pubsub.getSubscribers(topic)
|
|
67
|
+
return peers.map(p => p.toString()).includes(identify1.peerId.toString())
|
|
68
|
+
})
|
|
63
69
|
await daemons[0].client.pubsub.publish(topic, data)
|
|
64
70
|
}
|
|
65
71
|
|