@libp2p/floodsub 10.1.46-6059227cb → 10.1.46-87bc8d4fb

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.
@@ -0,0 +1,2 @@
1
+ export declare const multicodec = "/floodsub/1.0.0";
2
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,oBAAoB,CAAA"}
@@ -0,0 +1,2 @@
1
+ export const multicodec = '/floodsub/1.0.0';
2
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,UAAU,GAAG,iBAAiB,CAAA"}
@@ -31,227 +31,14 @@
31
31
  * node.services.pubsub.publish('fruit', new TextEncoder().encode('banana'))
32
32
  * ```
33
33
  */
34
- import { pubSubSymbol } from './constants.ts';
35
- import type { ComponentLogger, PeerId, PrivateKey, PublicKey, TypedEventTarget } from '@libp2p/interface';
36
- import type { Registrar } from '@libp2p/interface-internal';
37
- export declare const protocol = "/floodsub/1.0.0";
38
- /**
39
- * On the producing side:
40
- * - Build messages with the signature, key (from may be enough for certain inlineable public key types), from and seqno fields.
41
- *
42
- * On the consuming side:
43
- * - Enforce the fields to be present, reject otherwise.
44
- * - Propagate only if the fields are valid and signature can be verified, reject otherwise.
45
- */
46
- export declare const StrictSign = "StrictSign";
47
- /**
48
- * On the producing side:
49
- * - Build messages without the signature, key, from and seqno fields.
50
- * - The corresponding protobuf key-value pairs are absent from the marshaled message, not just empty.
51
- *
52
- * On the consuming side:
53
- * - Enforce the fields to be absent, reject otherwise.
54
- * - Propagate only if the fields are absent, reject otherwise.
55
- * - A message_id function will not be able to use the above fields, and should instead rely on the data field. A commonplace strategy is to calculate a hash.
56
- */
57
- export declare const StrictNoSign = "StrictNoSign";
58
- export type SignaturePolicy = typeof StrictSign | typeof StrictNoSign;
59
- export interface SignedMessage {
60
- type: 'signed';
61
- from: PeerId;
62
- topic: string;
63
- data: Uint8Array;
64
- sequenceNumber: bigint;
65
- signature: Uint8Array;
66
- key: PublicKey;
67
- }
68
- export interface UnsignedMessage {
69
- type: 'unsigned';
70
- topic: string;
71
- data: Uint8Array;
72
- }
73
- export type Message = SignedMessage | UnsignedMessage;
74
- export interface Subscription {
75
- topic: string;
76
- subscribe: boolean;
77
- }
78
- export interface SubscriptionChangeData {
79
- peerId: PeerId;
80
- subscriptions: Subscription[];
81
- }
82
- export interface FloodSubEvents {
83
- 'subscription-change': CustomEvent<SubscriptionChangeData>;
84
- message: CustomEvent<Message>;
85
- }
86
- export interface PublishResult {
87
- recipients: PeerId[];
88
- }
89
- export declare enum TopicValidatorResult {
90
- /**
91
- * The message is considered valid, and it should be delivered and forwarded to the network
92
- */
93
- Accept = "accept",
94
- /**
95
- * The message is neither delivered nor forwarded to the network
96
- */
97
- Ignore = "ignore",
98
- /**
99
- * The message is considered invalid, and it should be rejected
100
- */
101
- Reject = "reject"
102
- }
103
- export interface TopicValidatorFn {
104
- (peer: PeerId, message: Message): TopicValidatorResult | Promise<TopicValidatorResult>;
105
- }
106
- export interface PeerStreamEvents {
107
- 'stream:inbound': CustomEvent<never>;
108
- 'stream:outbound': CustomEvent<never>;
109
- close: CustomEvent<never>;
110
- }
111
- export { pubSubSymbol };
112
- /**
113
- * Returns true if the passed argument is a PubSub implementation
114
- */
115
- export declare function isPubSub(obj?: any): obj is FloodSub;
116
- export interface FloodSub extends TypedEventTarget<FloodSubEvents> {
117
- /**
118
- * The global signature policy controls whether or not we sill send and receive
119
- * signed or unsigned messages.
120
- *
121
- * Signed messages prevent spoofing message senders and should be preferred to
122
- * using unsigned messages.
123
- */
124
- globalSignaturePolicy: typeof StrictSign | typeof StrictNoSign;
125
- /**
126
- * A list of multicodecs that contain the pubsub protocol name.
127
- */
128
- protocols: string[];
129
- /**
130
- * Pubsub routers support message validators per topic, which will validate the message
131
- * before its propagations. They are stored in a map where keys are the topic name and
132
- * values are the validators.
133
- *
134
- * @example
135
- *
136
- * ```TypeScript
137
- * const topic = 'topic'
138
- * const validateMessage = (msgTopic, msg) => {
139
- * const input = uint8ArrayToString(msg.data)
140
- * const validInputs = ['a', 'b', 'c']
141
- *
142
- * if (!validInputs.includes(input)) {
143
- * throw new Error('no valid input received')
144
- * }
145
- * }
146
- * libp2p.pubsub.topicValidators.set(topic, validateMessage)
147
- * ```
148
- */
149
- topicValidators: Map<string, TopicValidatorFn>;
150
- getPeers(): PeerId[];
151
- /**
152
- * Gets a list of topics the node is subscribed to.
153
- *
154
- * ```TypeScript
155
- * const topics = libp2p.pubsub.getTopics()
156
- * ```
157
- */
158
- getTopics(): string[];
159
- /**
160
- * Subscribes to a pubsub topic.
161
- *
162
- * @example
163
- *
164
- * ```TypeScript
165
- * const topic = 'topic'
166
- * const handler = (msg) => {
167
- * if (msg.topic === topic) {
168
- * // msg.data - pubsub data received
169
- * }
170
- * }
171
- *
172
- * libp2p.pubsub.addEventListener('message', handler)
173
- * libp2p.pubsub.subscribe(topic)
174
- * ```
175
- */
176
- subscribe(topic: string): void;
177
- /**
178
- * Unsubscribes from a pubsub topic.
179
- *
180
- * @example
181
- *
182
- * ```TypeScript
183
- * const topic = 'topic'
184
- * const handler = (msg) => {
185
- * // msg.data - pubsub data received
186
- * }
187
- *
188
- * libp2p.pubsub.removeEventListener(topic handler)
189
- * libp2p.pubsub.unsubscribe(topic)
190
- * ```
191
- */
192
- unsubscribe(topic: string): void;
193
- /**
194
- * Gets a list of the PeerIds that are subscribed to one topic.
195
- *
196
- * @example
197
- *
198
- * ```TypeScript
199
- * const peerIds = libp2p.pubsub.getSubscribers(topic)
200
- * ```
201
- */
202
- getSubscribers(topic: string): PeerId[];
203
- /**
204
- * Publishes messages to the given topic.
205
- *
206
- * @example
207
- *
208
- * ```TypeScript
209
- * const topic = 'topic'
210
- * const data = uint8ArrayFromString('data')
211
- *
212
- * await libp2p.pubsub.publish(topic, data)
213
- * ```
214
- */
215
- publish(topic: string, data?: Uint8Array): Promise<PublishResult>;
216
- }
217
- export interface FloodSubComponents {
218
- peerId: PeerId;
219
- privateKey: PrivateKey;
220
- registrar: Registrar;
221
- logger: ComponentLogger;
222
- }
223
- export interface FloodSubInit {
34
+ import { multicodec } from './config.js';
35
+ import type { PubSubInit, PubSub } from '@libp2p/interface';
36
+ import type { PubSubComponents } from '@libp2p/pubsub';
37
+ export { multicodec };
38
+ export interface FloodSubInit extends PubSubInit {
224
39
  seenTTL?: number;
225
- /**
226
- * Override the protocol registered with the registrar
227
- *
228
- * @default ['/floodsub/1.0.0']
229
- */
230
- protocols?: string[];
231
- /**
232
- * defines how signatures should be handled
233
- */
234
- globalSignaturePolicy?: SignaturePolicy;
235
- /**
236
- * if can relay messages not subscribed
237
- */
238
- canRelayMessage?: boolean;
239
- /**
240
- * if publish should emit to self, if subscribed
241
- */
242
- emitSelf?: boolean;
243
- /**
244
- * handle this many incoming pubsub messages concurrently
245
- */
246
- messageProcessingConcurrency?: number;
247
- /**
248
- * How many parallel incoming streams to allow on the pubsub protocol per-connection
249
- */
250
- maxInboundStreams?: number;
251
- /**
252
- * How many parallel outgoing streams to allow on the pubsub protocol per-connection
253
- */
254
- maxOutboundStreams?: number;
255
40
  }
256
- export declare function floodsub(init?: FloodSubInit): (components: FloodSubComponents) => FloodSub;
41
+ export interface FloodSubComponents extends PubSubComponents {
42
+ }
43
+ export declare function floodsub(init?: FloodSubInit): (components: FloodSubComponents) => PubSub;
257
44
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAE7C,OAAO,KAAK,EAAE,eAAe,EAAE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K,MAAM,CAE7F"}
package/dist/src/index.js CHANGED
@@ -31,52 +31,103 @@
31
31
  * node.services.pubsub.publish('fruit', new TextEncoder().encode('banana'))
32
32
  * ```
33
33
  */
34
- import { pubSubSymbol } from "./constants.js";
35
- import { FloodSub as FloodSubClass } from './floodsub.js';
36
- export const protocol = '/floodsub/1.0.0';
34
+ import { pubSubSymbol, serviceCapabilities, serviceDependencies } from '@libp2p/interface';
35
+ import { PubSubBaseProtocol } from '@libp2p/pubsub';
36
+ import { toString } from 'uint8arrays/to-string';
37
+ import { SimpleTimeCache } from './cache.js';
38
+ import { multicodec } from './config.js';
39
+ import { RPC } from './message/rpc.js';
40
+ export { multicodec };
37
41
  /**
38
- * On the producing side:
39
- * - Build messages with the signature, key (from may be enough for certain inlineable public key types), from and seqno fields.
40
- *
41
- * On the consuming side:
42
- * - Enforce the fields to be present, reject otherwise.
43
- * - Propagate only if the fields are valid and signature can be verified, reject otherwise.
44
- */
45
- export const StrictSign = 'StrictSign';
46
- /**
47
- * On the producing side:
48
- * - Build messages without the signature, key, from and seqno fields.
49
- * - The corresponding protobuf key-value pairs are absent from the marshaled message, not just empty.
50
- *
51
- * On the consuming side:
52
- * - Enforce the fields to be absent, reject otherwise.
53
- * - Propagate only if the fields are absent, reject otherwise.
54
- * - A message_id function will not be able to use the above fields, and should instead rely on the data field. A commonplace strategy is to calculate a hash.
42
+ * FloodSub (aka dumbsub is an implementation of pubsub focused on
43
+ * delivering an API for Publish/Subscribe, but with no CastTree Forming
44
+ * (it just floods the network).
55
45
  */
56
- export const StrictNoSign = 'StrictNoSign';
57
- export var TopicValidatorResult;
58
- (function (TopicValidatorResult) {
46
+ class FloodSub extends PubSubBaseProtocol {
47
+ seenCache;
48
+ constructor(components, init) {
49
+ super(components, {
50
+ ...init,
51
+ canRelayMessage: true,
52
+ multicodecs: [multicodec]
53
+ });
54
+ this.log = components.logger.forComponent('libp2p:floodsub');
55
+ /**
56
+ * Cache of seen messages
57
+ *
58
+ * @type {TimeCache}
59
+ */
60
+ this.seenCache = new SimpleTimeCache({
61
+ validityMs: init?.seenTTL ?? 30000
62
+ });
63
+ }
64
+ [pubSubSymbol] = true;
65
+ [Symbol.toStringTag] = '@libp2p/floodsub';
66
+ [serviceCapabilities] = [
67
+ '@libp2p/pubsub'
68
+ ];
69
+ [serviceDependencies] = [
70
+ '@libp2p/identify'
71
+ ];
59
72
  /**
60
- * The message is considered valid, and it should be delivered and forwarded to the network
73
+ * Decode a Uint8Array into an RPC object
61
74
  */
62
- TopicValidatorResult["Accept"] = "accept";
75
+ decodeRpc(bytes) {
76
+ return RPC.decode(bytes);
77
+ }
63
78
  /**
64
- * The message is neither delivered nor forwarded to the network
79
+ * Encode an RPC object into a Uint8Array
65
80
  */
66
- TopicValidatorResult["Ignore"] = "ignore";
81
+ encodeRpc(rpc) {
82
+ return RPC.encode(rpc);
83
+ }
84
+ decodeMessage(bytes) {
85
+ return RPC.Message.decode(bytes);
86
+ }
87
+ encodeMessage(rpc) {
88
+ return RPC.Message.encode(rpc);
89
+ }
67
90
  /**
68
- * The message is considered invalid, and it should be rejected
91
+ * Process incoming message
92
+ * Extends base implementation to check router cache.
69
93
  */
70
- TopicValidatorResult["Reject"] = "reject";
71
- })(TopicValidatorResult || (TopicValidatorResult = {}));
72
- export { pubSubSymbol };
73
- /**
74
- * Returns true if the passed argument is a PubSub implementation
75
- */
76
- export function isPubSub(obj) {
77
- return Boolean(obj?.[pubSubSymbol]);
94
+ async processMessage(from, message) {
95
+ // Check if I've seen the message, if yes, ignore
96
+ const seqno = await super.getMsgId(message);
97
+ const msgIdStr = toString(seqno, 'base64');
98
+ if (this.seenCache.has(msgIdStr)) {
99
+ return;
100
+ }
101
+ this.seenCache.put(msgIdStr, true);
102
+ await super.processMessage(from, message);
103
+ }
104
+ /**
105
+ * Publish message created. Forward it to the peers.
106
+ */
107
+ async publishMessage(from, message) {
108
+ const peers = this.getSubscribers(message.topic);
109
+ const recipients = [];
110
+ if (peers == null || peers.length === 0) {
111
+ this.log('no peers are subscribed to topic %s', message.topic);
112
+ return { recipients };
113
+ }
114
+ peers.forEach(id => {
115
+ if (this.components.peerId.equals(id)) {
116
+ this.log('not sending message on topic %s to myself', message.topic);
117
+ return;
118
+ }
119
+ if (id.equals(from)) {
120
+ this.log('not sending message on topic %s to sender %p', message.topic, id);
121
+ return;
122
+ }
123
+ this.log('publish msgs on topics %s %p', message.topic, id);
124
+ recipients.push(id);
125
+ this.send(id, { messages: [message] });
126
+ });
127
+ return { recipients };
128
+ }
78
129
  }
79
130
  export function floodsub(init = {}) {
80
- return (components) => new FloodSubClass(components, init);
131
+ return (components) => new FloodSub(components, init);
81
132
  }
82
133
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAAE,QAAQ,IAAI,aAAa,EAAE,MAAM,eAAe,CAAA;AAIzD,MAAM,CAAC,MAAM,QAAQ,GAAG,iBAAiB,CAAA;AAEzC;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,YAAY,CAAA;AAEtC;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,cAAc,CAAA;AAyC1C,MAAM,CAAN,IAAY,oBAaX;AAbD,WAAY,oBAAoB;IAC9B;;OAEG;IACH,yCAAiB,CAAA;IACjB;;OAEG;IACH,yCAAiB,CAAA;IACjB;;OAEG;IACH,yCAAiB,CAAA;AACnB,CAAC,EAbW,oBAAoB,KAApB,oBAAoB,QAa/B;AAYD,OAAO,EAAE,YAAY,EAAE,CAAA;AAEvB;;GAEG;AACH,MAAM,UAAU,QAAQ,CAAE,GAAS;IACjC,OAAO,OAAO,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,CAAC,CAAA;AACrC,CAAC;A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AC,GAAG,CAAC,qCAAqC,EAAE,OAAO,CAAC,KAAK,CAAC,CAAA;YAC9D,OAAO,EAAE,UAAU,EAAE,CAAA;QACvB,CAAC;QAED,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE;YACjB,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC;gBACtC,IAAI,CAAC,GAAG,CAAC,2CAA2C,EAAE,OAAO,CAAC,KAAK,CAAC,CAAA;gBACpE,OAAM;YACR,CAAC;YAED,IAAI,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;gBACpB,IAAI,CAAC,GAAG,CAAC,8CAA8C,EAAE,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAA;gBAC3E,OAAM;YACR,CAAC;YAED,IAAI,CAAC,GAAG,CAAC,8BAA8B,EAAE,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAA;YAE3D,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;YACnB,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,CAAA;QACxC,CAAC,CAAC,CAAA;QAEF,OAAO,EAAE,UAAU,EAAE,CAAA;IACvB,CAAC;CACF;AAED,MAAM,UAAU,QAAQ,CAAE,OAAqB,EAAE;IAC/C,OAAO,CAAC,UAA8B,EAAE,EAAE,CAAC,IAAI,QAAQ,CAAC,UAAU,EAAE,IAAI,CAAC,CAAA;AAC3E,CAAC"}
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@libp2p/floodsub",
3
- "version": "10.1.46-6059227cb",
3
+ "version": "10.1.46-87bc8d4fb",
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/main/packages/floodsub#readme",
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"
@@ -53,34 +53,25 @@
53
53
  "test:electron-main": "aegir test -t electron-main"
54
54
  },
55
55
  "dependencies": {
56
- "@libp2p/crypto": "5.1.8-6059227cb",
57
- "@libp2p/interface": "2.11.0-6059227cb",
58
- "@libp2p/interface-internal": "2.3.19-6059227cb",
59
- "@libp2p/peer-collections": "6.0.35-6059227cb",
60
- "@libp2p/peer-id": "5.1.9-6059227cb",
61
- "@libp2p/utils": "6.7.2-6059227cb",
62
- "it-length-prefixed": "^10.0.1",
63
- "it-pipe": "^3.0.1",
64
- "it-pushable": "^3.2.3",
65
- "main-event": "^1.0.1",
66
- "multiformats": "^13.4.1",
67
- "p-event": "^7.0.0",
68
- "p-queue": "^8.1.1",
69
- "protons-runtime": "^5.6.0",
56
+ "@libp2p/interface": "2.11.0-87bc8d4fb",
57
+ "@libp2p/pubsub": "10.1.18-87bc8d4fb",
58
+ "protons-runtime": "^5.5.0",
70
59
  "uint8arraylist": "^2.4.8",
71
60
  "uint8arrays": "^5.1.0"
72
61
  },
73
62
  "devDependencies": {
74
- "@libp2p/logger": "5.2.0-6059227cb",
75
- "@multiformats/multiaddr": "^13.0.1",
63
+ "@libp2p/crypto": "5.1.8-87bc8d4fb",
64
+ "@libp2p/interface-compliance-tests": "6.5.0-87bc8d4fb",
65
+ "@libp2p/logger": "5.2.0-87bc8d4fb",
66
+ "@libp2p/peer-collections": "6.0.35-87bc8d4fb",
67
+ "@libp2p/peer-id": "5.1.9-87bc8d4fb",
68
+ "@multiformats/multiaddr": "^12.4.4",
76
69
  "@types/sinon": "^17.0.4",
77
- "aegir": "^47.0.22",
78
- "delay": "^6.0.0",
79
- "it-all": "^3.0.9",
70
+ "aegir": "^47.0.14",
71
+ "multiformats": "^13.3.6",
80
72
  "p-wait-for": "^5.0.2",
81
- "protons": "^7.7.0",
82
- "sinon": "^21.0.0",
83
- "sinon-ts": "^2.0.0"
73
+ "protons": "^7.6.1",
74
+ "sinon": "^20.0.0"
84
75
  },
85
76
  "sideEffects": false
86
77
  }
package/src/config.ts ADDED
@@ -0,0 +1 @@
1
+ export const multicodec = '/floodsub/1.0.0'