@libp2p/floodsub 8.0.18 → 9.0.0
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/README.md +3 -3
- package/dist/index.min.js +10 -10
- package/dist/src/config.d.ts +0 -1
- package/dist/src/config.d.ts.map +1 -1
- package/dist/src/config.js +0 -2
- package/dist/src/config.js.map +1 -1
- package/dist/src/index.d.ts +3 -4
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +7 -8
- package/dist/src/index.js.map +1 -1
- package/dist/typedoc-urls.json +11 -0
- package/package.json +15 -11
- package/src/config.ts +0 -4
- package/src/index.ts +9 -11
package/dist/src/config.d.ts
CHANGED
package/dist/src/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,oBAAoB,CAAA"}
|
package/dist/src/config.js
CHANGED
package/dist/src/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,UAAU,GAAG,iBAAiB,CAAA"}
|
package/dist/src/index.d.ts
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*
|
|
10
10
|
* Instead please use [gossipsub](https://www.npmjs.com/package/@chainsafe/libp2p-gossipsub) - a more complete implementation which is also compatible with floodsub.
|
|
11
11
|
*
|
|
12
|
-
* @example
|
|
12
|
+
* @example Configuring libp2p to use floodsub
|
|
13
13
|
*
|
|
14
14
|
* ```JavaScript
|
|
15
15
|
* import { createLibp2pNode } from 'libp2p'
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
*
|
|
24
24
|
* node.pubsub.subscribe('fruit')
|
|
25
25
|
* node.pubsub.addEventListener('message', (evt) => {
|
|
26
|
-
* console.log(evt)
|
|
26
|
+
* console.this.log(evt)
|
|
27
27
|
* })
|
|
28
28
|
*
|
|
29
29
|
* node.pubsub.publish('fruit', new TextEncoder().encode('banana'))
|
|
@@ -32,8 +32,7 @@
|
|
|
32
32
|
import { PubSubBaseProtocol, type PubSubComponents } from '@libp2p/pubsub';
|
|
33
33
|
import { SimpleTimeCache } from './cache.js';
|
|
34
34
|
import { multicodec } from './config.js';
|
|
35
|
-
import type { PeerId } from '@libp2p/interface
|
|
36
|
-
import type { PubSubInit, Message, PubSubRPC, PubSubRPCMessage, PublishResult, PubSub } from '@libp2p/interface/pubsub';
|
|
35
|
+
import type { PeerId, PubSubInit, Message, PubSubRPC, PubSubRPCMessage, PublishResult, PubSub } from '@libp2p/interface';
|
|
37
36
|
import type { Uint8ArrayList } from 'uint8arraylist';
|
|
38
37
|
export { multicodec };
|
|
39
38
|
export interface FloodSubInit extends PubSubInit {
|
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,OAAO,EAAE,kBAAkB,EAAE,KAAK,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAE1E,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAExC,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AACxH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAEpD,OAAO,EAAE,UAAU,EAAE,CAAA;AAErB,MAAM,WAAW,YAAa,SAAQ,UAAU;IAC9C,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,kBAAmB,SAAQ,gBAAgB;CAE3D;AAED;;;;GAIG;AACH,qBAAa,QAAS,SAAQ,kBAAkB;IACvC,SAAS,EAAE,eAAe,CAAC,OAAO,CAAC,CAAA;gBAE7B,UAAU,EAAE,kBAAkB,EAAE,IAAI,CAAC,EAAE,YAAY;IAmBhE;;OAEG;IACH,SAAS,CAAE,KAAK,EAAE,UAAU,GAAG,cAAc,GAAG,SAAS;IAIzD;;OAEG;IACH,SAAS,CAAE,GAAG,EAAE,SAAS,GAAG,UAAU;IAItC,aAAa,CAAE,KAAK,EAAE,UAAU,GAAG,cAAc,GAAG,gBAAgB;IAIpE,aAAa,CAAE,GAAG,EAAE,gBAAgB,GAAG,UAAU;IAIjD;;;OAGG;IACG,cAAc,CAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAcpE;;OAEG;IACG,cAAc,CAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC;CA4B9E;AAED,wBAAgB,QAAQ,CAAE,IAAI,GAAE,YAAiB,GAAG,CAAC,UAAU,EAAE,kBAAkB,KAAK,MAAM,CAE7F"}
|
package/dist/src/index.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*
|
|
10
10
|
* Instead please use [gossipsub](https://www.npmjs.com/package/@chainsafe/libp2p-gossipsub) - a more complete implementation which is also compatible with floodsub.
|
|
11
11
|
*
|
|
12
|
-
* @example
|
|
12
|
+
* @example Configuring libp2p to use floodsub
|
|
13
13
|
*
|
|
14
14
|
* ```JavaScript
|
|
15
15
|
* import { createLibp2pNode } from 'libp2p'
|
|
@@ -23,19 +23,17 @@
|
|
|
23
23
|
*
|
|
24
24
|
* node.pubsub.subscribe('fruit')
|
|
25
25
|
* node.pubsub.addEventListener('message', (evt) => {
|
|
26
|
-
* console.log(evt)
|
|
26
|
+
* console.this.log(evt)
|
|
27
27
|
* })
|
|
28
28
|
*
|
|
29
29
|
* node.pubsub.publish('fruit', new TextEncoder().encode('banana'))
|
|
30
30
|
* ```
|
|
31
31
|
*/
|
|
32
|
-
import { logger } from '@libp2p/logger';
|
|
33
32
|
import { PubSubBaseProtocol } from '@libp2p/pubsub';
|
|
34
33
|
import { toString } from 'uint8arrays/to-string';
|
|
35
34
|
import { SimpleTimeCache } from './cache.js';
|
|
36
35
|
import { multicodec } from './config.js';
|
|
37
36
|
import { RPC } from './message/rpc.js';
|
|
38
|
-
const log = logger('libp2p:floodsub');
|
|
39
37
|
export { multicodec };
|
|
40
38
|
/**
|
|
41
39
|
* FloodSub (aka dumbsub is an implementation of pubsub focused on
|
|
@@ -50,6 +48,7 @@ export class FloodSub extends PubSubBaseProtocol {
|
|
|
50
48
|
canRelayMessage: true,
|
|
51
49
|
multicodecs: [multicodec]
|
|
52
50
|
});
|
|
51
|
+
this.log = components.logger.forComponent('libp2p:floodsub');
|
|
53
52
|
/**
|
|
54
53
|
* Cache of seen messages
|
|
55
54
|
*
|
|
@@ -98,19 +97,19 @@ export class FloodSub extends PubSubBaseProtocol {
|
|
|
98
97
|
const peers = this.getSubscribers(message.topic);
|
|
99
98
|
const recipients = [];
|
|
100
99
|
if (peers == null || peers.length === 0) {
|
|
101
|
-
log('no peers are subscribed to topic %s', message.topic);
|
|
100
|
+
this.log('no peers are subscribed to topic %s', message.topic);
|
|
102
101
|
return { recipients };
|
|
103
102
|
}
|
|
104
103
|
peers.forEach(id => {
|
|
105
104
|
if (this.components.peerId.equals(id)) {
|
|
106
|
-
log('not sending message on topic %s to myself', message.topic);
|
|
105
|
+
this.log('not sending message on topic %s to myself', message.topic);
|
|
107
106
|
return;
|
|
108
107
|
}
|
|
109
108
|
if (id.equals(from)) {
|
|
110
|
-
log('not sending message on topic %s to sender %p', message.topic, id);
|
|
109
|
+
this.log('not sending message on topic %s to sender %p', message.topic, id);
|
|
111
110
|
return;
|
|
112
111
|
}
|
|
113
|
-
log('publish msgs on topics %s %p', message.topic, id);
|
|
112
|
+
this.log('publish msgs on topics %s %p', message.topic, id);
|
|
114
113
|
recipients.push(id);
|
|
115
114
|
this.send(id, { messages: [message] });
|
|
116
115
|
});
|
package/dist/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,OAAO,EAAE,kBAAkB,EAAyB,MAAM,gBAAgB,CAAA;AAC1E,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAA;AAItC,OAAO,EAAE,UAAU,EAAE,CAAA;AAUrB;;;;GAIG;AACH,MAAM,OAAO,QAAS,SAAQ,kBAAkB;IACvC,SAAS,CAA0B;IAE1C,YAAa,UAA8B,EAAE,IAAmB;QAC9D,KAAK,CAAC,UAAU,EAAE;YAChB,GAAG,IAAI;YACP,eAAe,EAAE,IAAI;YACrB,WAAW,EAAE,CAAC,UAAU,CAAC;SAC1B,CAAC,CAAA;QAEF,IAAI,CAAC,GAAG,GAAG,UAAU,CAAC,MAAM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es/_libp2p_floodsub.FloodSub.html",
|
|
4
|
+
"FloodSubComponents": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_floodsub.FloodSubComponents.html",
|
|
5
|
+
".:FloodSubComponents": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_floodsub.FloodSubComponents.html",
|
|
6
|
+
"FloodSubInit": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_floodsub.FloodSubInit.html",
|
|
7
|
+
".:FloodSubInit": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_floodsub.FloodSubInit.html",
|
|
8
|
+
"multicodec": "https://libp2p.github.io/js-libp2p/variables/_libp2p_floodsub.multicodec.html",
|
|
9
|
+
"floodsub": "https://libp2p.github.io/js-libp2p/functions/_libp2p_floodsub.floodsub-1.html",
|
|
10
|
+
".:floodsub": "https://libp2p.github.io/js-libp2p/functions/_libp2p_floodsub.floodsub-1.html"
|
|
11
|
+
}
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@libp2p/floodsub",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "9.0.0",
|
|
4
4
|
"description": "libp2p-floodsub, also known as pubsub-flood or just dumbsub, this implementation of pubsub focused on delivering an API for Publish/Subscribe, but with no CastTree Forming (it just floods the network).",
|
|
5
5
|
"license": "Apache-2.0 OR MIT",
|
|
6
|
-
"homepage": "https://github.com/libp2p/js-libp2p/tree/
|
|
6
|
+
"homepage": "https://github.com/libp2p/js-libp2p/tree/main/packages/pubsub-floodsub#readme",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
9
|
"url": "git+https://github.com/libp2p/js-libp2p.git"
|
|
@@ -11,6 +11,10 @@
|
|
|
11
11
|
"bugs": {
|
|
12
12
|
"url": "https://github.com/libp2p/js-libp2p/issues"
|
|
13
13
|
},
|
|
14
|
+
"publishConfig": {
|
|
15
|
+
"access": "public",
|
|
16
|
+
"provenance": true
|
|
17
|
+
},
|
|
14
18
|
"keywords": [
|
|
15
19
|
"IPFS",
|
|
16
20
|
"flood",
|
|
@@ -55,23 +59,23 @@
|
|
|
55
59
|
"test:electron-main": "aegir test -t electron-main"
|
|
56
60
|
},
|
|
57
61
|
"dependencies": {
|
|
58
|
-
"@libp2p/interface": "^0.1
|
|
59
|
-
"@libp2p/
|
|
60
|
-
"@libp2p/pubsub": "^8.0.10",
|
|
62
|
+
"@libp2p/interface": "^1.0.1",
|
|
63
|
+
"@libp2p/pubsub": "^9.0.0",
|
|
61
64
|
"protons-runtime": "^5.0.0",
|
|
62
65
|
"uint8arraylist": "^2.4.3",
|
|
63
66
|
"uint8arrays": "^4.0.6"
|
|
64
67
|
},
|
|
65
68
|
"devDependencies": {
|
|
66
|
-
"@libp2p/interface-compliance-tests": "^
|
|
67
|
-
"@libp2p/
|
|
68
|
-
"@libp2p/peer-
|
|
69
|
-
"@
|
|
69
|
+
"@libp2p/interface-compliance-tests": "^5.0.4",
|
|
70
|
+
"@libp2p/logger": "^4.0.1",
|
|
71
|
+
"@libp2p/peer-collections": "^5.0.0",
|
|
72
|
+
"@libp2p/peer-id-factory": "^4.0.0",
|
|
73
|
+
"@multiformats/multiaddr": "^12.1.10",
|
|
70
74
|
"@types/sinon": "^17.0.0",
|
|
71
75
|
"aegir": "^41.0.2",
|
|
72
|
-
"multiformats": "^12.
|
|
76
|
+
"multiformats": "^12.1.3",
|
|
73
77
|
"p-wait-for": "^5.0.2",
|
|
74
|
-
"protons": "^7.0
|
|
78
|
+
"protons": "^7.3.0",
|
|
75
79
|
"sinon": "^17.0.0"
|
|
76
80
|
}
|
|
77
81
|
}
|
package/src/config.ts
CHANGED
package/src/index.ts
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*
|
|
10
10
|
* Instead please use [gossipsub](https://www.npmjs.com/package/@chainsafe/libp2p-gossipsub) - a more complete implementation which is also compatible with floodsub.
|
|
11
11
|
*
|
|
12
|
-
* @example
|
|
12
|
+
* @example Configuring libp2p to use floodsub
|
|
13
13
|
*
|
|
14
14
|
* ```JavaScript
|
|
15
15
|
* import { createLibp2pNode } from 'libp2p'
|
|
@@ -23,25 +23,21 @@
|
|
|
23
23
|
*
|
|
24
24
|
* node.pubsub.subscribe('fruit')
|
|
25
25
|
* node.pubsub.addEventListener('message', (evt) => {
|
|
26
|
-
* console.log(evt)
|
|
26
|
+
* console.this.log(evt)
|
|
27
27
|
* })
|
|
28
28
|
*
|
|
29
29
|
* node.pubsub.publish('fruit', new TextEncoder().encode('banana'))
|
|
30
30
|
* ```
|
|
31
31
|
*/
|
|
32
32
|
|
|
33
|
-
import { logger } from '@libp2p/logger'
|
|
34
33
|
import { PubSubBaseProtocol, type PubSubComponents } from '@libp2p/pubsub'
|
|
35
34
|
import { toString } from 'uint8arrays/to-string'
|
|
36
35
|
import { SimpleTimeCache } from './cache.js'
|
|
37
36
|
import { multicodec } from './config.js'
|
|
38
37
|
import { RPC } from './message/rpc.js'
|
|
39
|
-
import type { PeerId } from '@libp2p/interface
|
|
40
|
-
import type { PubSubInit, Message, PubSubRPC, PubSubRPCMessage, PublishResult, PubSub } from '@libp2p/interface/pubsub'
|
|
38
|
+
import type { PeerId, PubSubInit, Message, PubSubRPC, PubSubRPCMessage, PublishResult, PubSub } from '@libp2p/interface'
|
|
41
39
|
import type { Uint8ArrayList } from 'uint8arraylist'
|
|
42
40
|
|
|
43
|
-
const log = logger('libp2p:floodsub')
|
|
44
|
-
|
|
45
41
|
export { multicodec }
|
|
46
42
|
|
|
47
43
|
export interface FloodSubInit extends PubSubInit {
|
|
@@ -67,6 +63,8 @@ export class FloodSub extends PubSubBaseProtocol {
|
|
|
67
63
|
multicodecs: [multicodec]
|
|
68
64
|
})
|
|
69
65
|
|
|
66
|
+
this.log = components.logger.forComponent('libp2p:floodsub')
|
|
67
|
+
|
|
70
68
|
/**
|
|
71
69
|
* Cache of seen messages
|
|
72
70
|
*
|
|
@@ -125,22 +123,22 @@ export class FloodSub extends PubSubBaseProtocol {
|
|
|
125
123
|
const recipients: PeerId[] = []
|
|
126
124
|
|
|
127
125
|
if (peers == null || peers.length === 0) {
|
|
128
|
-
log('no peers are subscribed to topic %s', message.topic)
|
|
126
|
+
this.log('no peers are subscribed to topic %s', message.topic)
|
|
129
127
|
return { recipients }
|
|
130
128
|
}
|
|
131
129
|
|
|
132
130
|
peers.forEach(id => {
|
|
133
131
|
if (this.components.peerId.equals(id)) {
|
|
134
|
-
log('not sending message on topic %s to myself', message.topic)
|
|
132
|
+
this.log('not sending message on topic %s to myself', message.topic)
|
|
135
133
|
return
|
|
136
134
|
}
|
|
137
135
|
|
|
138
136
|
if (id.equals(from)) {
|
|
139
|
-
log('not sending message on topic %s to sender %p', message.topic, id)
|
|
137
|
+
this.log('not sending message on topic %s to sender %p', message.topic, id)
|
|
140
138
|
return
|
|
141
139
|
}
|
|
142
140
|
|
|
143
|
-
log('publish msgs on topics %s %p', message.topic, id)
|
|
141
|
+
this.log('publish msgs on topics %s %p', message.topic, id)
|
|
144
142
|
|
|
145
143
|
recipients.push(id)
|
|
146
144
|
this.send(id, { messages: [message] })
|