@libp2p/pubsub 8.0.13 → 8.0.14
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +1 -1
- package/dist/index.min.js +9 -9
- package/dist/src/index.d.ts +5 -5
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +33 -32
- package/dist/src/index.js.map +1 -1
- package/dist/src/peer-streams.d.ts +5 -7
- package/dist/src/peer-streams.d.ts.map +1 -1
- package/dist/src/peer-streams.js +9 -14
- package/dist/src/peer-streams.js.map +1 -1
- package/dist/src/sign.d.ts +2 -1
- package/dist/src/sign.d.ts.map +1 -1
- package/dist/src/sign.js.map +1 -1
- package/dist/src/utils.d.ts +1 -1
- package/dist/src/utils.d.ts.map +1 -1
- package/dist/src/utils.js +1 -1
- package/dist/src/utils.js.map +1 -1
- package/package.json +16 -20
- package/src/index.ts +37 -35
- package/src/peer-streams.ts +19 -23
- package/src/sign.ts +2 -1
- package/src/utils.ts +2 -2
- package/dist/typedoc-urls.json +0 -32
package/package.json
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
{
|
2
2
|
"name": "@libp2p/pubsub",
|
3
|
-
"version": "8.0.
|
3
|
+
"version": "8.0.14",
|
4
4
|
"description": "libp2p pubsub base class",
|
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/master/packages/pubsub#readme",
|
7
7
|
"repository": {
|
8
8
|
"type": "git",
|
9
9
|
"url": "git+https://github.com/libp2p/js-libp2p.git"
|
@@ -11,10 +11,6 @@
|
|
11
11
|
"bugs": {
|
12
12
|
"url": "https://github.com/libp2p/js-libp2p/issues"
|
13
13
|
},
|
14
|
-
"publishConfig": {
|
15
|
-
"access": "public",
|
16
|
-
"provenance": true
|
17
|
-
},
|
18
14
|
"keywords": [
|
19
15
|
"interface",
|
20
16
|
"libp2p"
|
@@ -71,7 +67,7 @@
|
|
71
67
|
"scripts": {
|
72
68
|
"clean": "aegir clean",
|
73
69
|
"lint": "aegir lint",
|
74
|
-
"dep-check": "aegir dep-check",
|
70
|
+
"dep-check": "aegir dep-check -i protons",
|
75
71
|
"build": "aegir build",
|
76
72
|
"generate": "protons test/message/rpc.proto",
|
77
73
|
"test": "aegir test",
|
@@ -83,30 +79,30 @@
|
|
83
79
|
"test:electron-main": "aegir test -t electron-main"
|
84
80
|
},
|
85
81
|
"dependencies": {
|
86
|
-
"@libp2p/crypto": "^
|
87
|
-
"@libp2p/interface": "^
|
88
|
-
"@libp2p/interface-internal": "^1.
|
89
|
-
"@libp2p/
|
90
|
-
"@libp2p/peer-
|
91
|
-
"@libp2p/
|
92
|
-
"
|
82
|
+
"@libp2p/crypto": "^2.0.8",
|
83
|
+
"@libp2p/interface": "^0.1.6",
|
84
|
+
"@libp2p/interface-internal": "^0.1.9",
|
85
|
+
"@libp2p/logger": "^3.1.0",
|
86
|
+
"@libp2p/peer-collections": "^4.0.8",
|
87
|
+
"@libp2p/peer-id": "^3.0.6",
|
88
|
+
"abortable-iterator": "^5.0.1",
|
89
|
+
"it-length-prefixed": "^9.0.1",
|
93
90
|
"it-pipe": "^3.0.1",
|
94
|
-
"it-pushable": "^3.2.
|
95
|
-
"multiformats": "^12.1
|
96
|
-
"p-queue": "^7.4
|
91
|
+
"it-pushable": "^3.2.0",
|
92
|
+
"multiformats": "^12.0.1",
|
93
|
+
"p-queue": "^7.3.4",
|
97
94
|
"uint8arraylist": "^2.4.3",
|
98
95
|
"uint8arrays": "^4.0.6"
|
99
96
|
},
|
100
97
|
"devDependencies": {
|
101
|
-
"@libp2p/
|
102
|
-
"@libp2p/peer-id-factory": "^3.0.10",
|
98
|
+
"@libp2p/peer-id-factory": "^3.0.8",
|
103
99
|
"@types/sinon": "^17.0.0",
|
104
100
|
"aegir": "^41.0.2",
|
105
101
|
"delay": "^6.0.0",
|
106
102
|
"it-pair": "^2.0.6",
|
107
103
|
"p-defer": "^4.0.0",
|
108
104
|
"p-wait-for": "^5.0.2",
|
109
|
-
"protons": "^7.
|
105
|
+
"protons": "^7.0.2",
|
110
106
|
"protons-runtime": "^5.0.0",
|
111
107
|
"sinon": "^17.0.0"
|
112
108
|
}
|
package/src/index.ts
CHANGED
@@ -13,8 +13,10 @@
|
|
13
13
|
* ```
|
14
14
|
*/
|
15
15
|
|
16
|
-
import { CodeError
|
17
|
-
import {
|
16
|
+
import { CodeError } from '@libp2p/interface/errors'
|
17
|
+
import { TypedEventEmitter, CustomEvent } from '@libp2p/interface/events'
|
18
|
+
import { type PubSub, type Message, type StrictNoSign, type StrictSign, type PubSubInit, type PubSubEvents, type PeerStreams, type PubSubRPCMessage, type PubSubRPC, type PubSubRPCSubscription, type SubscriptionChangeData, type PublishResult, type TopicValidatorFn, TopicValidatorResult } from '@libp2p/interface/pubsub'
|
19
|
+
import { logger } from '@libp2p/logger'
|
18
20
|
import { PeerMap, PeerSet } from '@libp2p/peer-collections'
|
19
21
|
import { pipe } from 'it-pipe'
|
20
22
|
import Queue from 'p-queue'
|
@@ -25,13 +27,16 @@ import {
|
|
25
27
|
verifySignature
|
26
28
|
} from './sign.js'
|
27
29
|
import { toMessage, ensureArray, noSignMsgId, msgId, toRpcMessage, randomSeqno } from './utils.js'
|
28
|
-
import type {
|
30
|
+
import type { Connection } from '@libp2p/interface/connection'
|
31
|
+
import type { PeerId } from '@libp2p/interface/peer-id'
|
32
|
+
import type { IncomingStreamData, Registrar } from '@libp2p/interface-internal/registrar'
|
29
33
|
import type { Uint8ArrayList } from 'uint8arraylist'
|
30
34
|
|
35
|
+
const log = logger('libp2p:pubsub')
|
36
|
+
|
31
37
|
export interface PubSubComponents {
|
32
38
|
peerId: PeerId
|
33
39
|
registrar: Registrar
|
34
|
-
logger: ComponentLogger
|
35
40
|
}
|
36
41
|
|
37
42
|
/**
|
@@ -39,8 +44,6 @@ export interface PubSubComponents {
|
|
39
44
|
* and specifies the API that pubsub routers should have.
|
40
45
|
*/
|
41
46
|
export abstract class PubSubBaseProtocol<Events extends Record<string, any> = PubSubEvents> extends TypedEventEmitter<Events> implements PubSub<Events> {
|
42
|
-
protected log: Logger
|
43
|
-
|
44
47
|
public started: boolean
|
45
48
|
/**
|
46
49
|
* Map of topics to which peers are subscribed to
|
@@ -95,7 +98,6 @@ export abstract class PubSubBaseProtocol<Events extends Record<string, any> = Pu
|
|
95
98
|
maxOutboundStreams = 1
|
96
99
|
} = props
|
97
100
|
|
98
|
-
this.log = components.logger.forComponent('libp2p:pubsub')
|
99
101
|
this.components = components
|
100
102
|
this.multicodecs = ensureArray(multicodecs)
|
101
103
|
this.enabled = props.enabled !== false
|
@@ -126,7 +128,7 @@ export abstract class PubSubBaseProtocol<Events extends Record<string, any> = Pu
|
|
126
128
|
return
|
127
129
|
}
|
128
130
|
|
129
|
-
|
131
|
+
log('starting')
|
130
132
|
|
131
133
|
const registrar = this.components.registrar
|
132
134
|
// Incoming streams
|
@@ -146,7 +148,7 @@ export abstract class PubSubBaseProtocol<Events extends Record<string, any> = Pu
|
|
146
148
|
}
|
147
149
|
this._registrarTopologyIds = await Promise.all(this.multicodecs.map(async multicodec => registrar.register(multicodec, topology)))
|
148
150
|
|
149
|
-
|
151
|
+
log('started')
|
150
152
|
this.started = true
|
151
153
|
}
|
152
154
|
|
@@ -171,7 +173,7 @@ export abstract class PubSubBaseProtocol<Events extends Record<string, any> = Pu
|
|
171
173
|
await registrar.unhandle(multicodec)
|
172
174
|
}))
|
173
175
|
|
174
|
-
|
176
|
+
log('stopping')
|
175
177
|
for (const peerStreams of this.peers.values()) {
|
176
178
|
peerStreams.close()
|
177
179
|
}
|
@@ -179,7 +181,7 @@ export abstract class PubSubBaseProtocol<Events extends Record<string, any> = Pu
|
|
179
181
|
this.peers.clear()
|
180
182
|
this.subscriptions = new Set()
|
181
183
|
this.started = false
|
182
|
-
|
184
|
+
log('stopped')
|
183
185
|
}
|
184
186
|
|
185
187
|
isStarted (): boolean {
|
@@ -202,18 +204,18 @@ export abstract class PubSubBaseProtocol<Events extends Record<string, any> = Pu
|
|
202
204
|
const inboundStream = peer.attachInboundStream(stream)
|
203
205
|
|
204
206
|
this.processMessages(peerId, inboundStream, peer)
|
205
|
-
.catch(err => {
|
207
|
+
.catch(err => { log(err) })
|
206
208
|
}
|
207
209
|
|
208
210
|
/**
|
209
211
|
* Registrar notifies an established connection with pubsub protocol
|
210
212
|
*/
|
211
213
|
protected _onPeerConnected (peerId: PeerId, conn: Connection): void {
|
212
|
-
|
214
|
+
log('connected %p', peerId)
|
213
215
|
|
214
216
|
// if this connection is already in use for pubsub, ignore it
|
215
217
|
if (conn.streams.find(stream => stream.direction === 'outbound' && stream.protocol != null && this.multicodecs.includes(stream.protocol)) != null) {
|
216
|
-
|
218
|
+
log('outbound pubsub streams already present on connection from %p', peerId)
|
217
219
|
return
|
218
220
|
}
|
219
221
|
|
@@ -229,14 +231,14 @@ export abstract class PubSubBaseProtocol<Events extends Record<string, any> = Pu
|
|
229
231
|
const peer = this.addPeer(peerId, stream.protocol)
|
230
232
|
await peer.attachOutboundStream(stream)
|
231
233
|
} catch (err: any) {
|
232
|
-
|
234
|
+
log.error(err)
|
233
235
|
}
|
234
236
|
|
235
237
|
// Immediately send my own subscriptions to the newly established conn
|
236
238
|
this.send(peerId, { subscriptions: Array.from(this.subscriptions).map(sub => sub.toString()), subscribe: true })
|
237
239
|
})
|
238
240
|
.catch(err => {
|
239
|
-
|
241
|
+
log.error(err)
|
240
242
|
})
|
241
243
|
}
|
242
244
|
|
@@ -246,7 +248,7 @@ export abstract class PubSubBaseProtocol<Events extends Record<string, any> = Pu
|
|
246
248
|
protected _onPeerDisconnected (peerId: PeerId, conn?: Connection): void {
|
247
249
|
const idB58Str = peerId.toString()
|
248
250
|
|
249
|
-
|
251
|
+
log('connection ended', idB58Str)
|
250
252
|
this._removePeer(peerId)
|
251
253
|
}
|
252
254
|
|
@@ -262,9 +264,9 @@ export abstract class PubSubBaseProtocol<Events extends Record<string, any> = Pu
|
|
262
264
|
}
|
263
265
|
|
264
266
|
// else create a new peer streams
|
265
|
-
|
267
|
+
log('new peer %p', peerId)
|
266
268
|
|
267
|
-
const peerStreams: PeerStreams = new PeerStreamsImpl(
|
269
|
+
const peerStreams: PeerStreams = new PeerStreamsImpl({
|
268
270
|
id: peerId,
|
269
271
|
protocol
|
270
272
|
})
|
@@ -290,7 +292,7 @@ export abstract class PubSubBaseProtocol<Events extends Record<string, any> = Pu
|
|
290
292
|
peerStreams.close()
|
291
293
|
|
292
294
|
// delete peer streams
|
293
|
-
|
295
|
+
log('delete peer %p', peerId)
|
294
296
|
this.peers.delete(peerId)
|
295
297
|
|
296
298
|
// remove peer from topics map
|
@@ -317,7 +319,7 @@ export abstract class PubSubBaseProtocol<Events extends Record<string, any> = Pu
|
|
317
319
|
|
318
320
|
for (const msg of (rpcMsg.messages ?? [])) {
|
319
321
|
if (msg.from == null || msg.data == null || msg.topic == null) {
|
320
|
-
|
322
|
+
log('message from %p was missing from, data or topic fields, dropping', peerId)
|
321
323
|
continue
|
322
324
|
}
|
323
325
|
|
@@ -342,7 +344,7 @@ export abstract class PubSubBaseProtocol<Events extends Record<string, any> = Pu
|
|
342
344
|
})),
|
343
345
|
messages
|
344
346
|
})
|
345
|
-
.catch(err => {
|
347
|
+
.catch(err => { log(err) })
|
346
348
|
}
|
347
349
|
}
|
348
350
|
)
|
@@ -356,16 +358,16 @@ export abstract class PubSubBaseProtocol<Events extends Record<string, any> = Pu
|
|
356
358
|
*/
|
357
359
|
async processRpc (from: PeerId, peerStreams: PeerStreams, rpc: PubSubRPC): Promise<boolean> {
|
358
360
|
if (!this.acceptFrom(from)) {
|
359
|
-
|
361
|
+
log('received message from unacceptable peer %p', from)
|
360
362
|
return false
|
361
363
|
}
|
362
364
|
|
363
|
-
|
365
|
+
log('rpc from %p', from)
|
364
366
|
|
365
367
|
const { subscriptions, messages } = rpc
|
366
368
|
|
367
369
|
if (subscriptions != null && subscriptions.length > 0) {
|
368
|
-
|
370
|
+
log('subscription update from %p', from)
|
369
371
|
|
370
372
|
// update peer subscriptions
|
371
373
|
subscriptions.forEach((subOpt) => {
|
@@ -384,11 +386,11 @@ export abstract class PubSubBaseProtocol<Events extends Record<string, any> = Pu
|
|
384
386
|
}
|
385
387
|
|
386
388
|
if (messages != null && messages.length > 0) {
|
387
|
-
|
389
|
+
log('messages from %p', from)
|
388
390
|
|
389
391
|
this.queue.addAll(messages.map(message => async () => {
|
390
392
|
if (message.topic == null || (!this.subscriptions.has(message.topic) && !this.canRelayMessage)) {
|
391
|
-
|
393
|
+
log('received message we didn\'t subscribe to. Dropping.')
|
392
394
|
return false
|
393
395
|
}
|
394
396
|
|
@@ -397,10 +399,10 @@ export abstract class PubSubBaseProtocol<Events extends Record<string, any> = Pu
|
|
397
399
|
|
398
400
|
await this.processMessage(from, msg)
|
399
401
|
} catch (err: any) {
|
400
|
-
|
402
|
+
log.error(err)
|
401
403
|
}
|
402
404
|
}))
|
403
|
-
.catch(err => {
|
405
|
+
.catch(err => { log(err) })
|
404
406
|
}
|
405
407
|
|
406
408
|
return true
|
@@ -443,7 +445,7 @@ export abstract class PubSubBaseProtocol<Events extends Record<string, any> = Pu
|
|
443
445
|
try {
|
444
446
|
await this.validate(from, msg)
|
445
447
|
} catch (err: any) {
|
446
|
-
|
448
|
+
log('Message is invalid, dropping it. %O', err)
|
447
449
|
return
|
448
450
|
}
|
449
451
|
|
@@ -533,13 +535,13 @@ export abstract class PubSubBaseProtocol<Events extends Record<string, any> = Pu
|
|
533
535
|
const peerStreams = this.peers.get(peer)
|
534
536
|
|
535
537
|
if (peerStreams == null) {
|
536
|
-
|
538
|
+
log.error('Cannot send RPC to %p as there are no streams to it available', peer)
|
537
539
|
|
538
540
|
return
|
539
541
|
}
|
540
542
|
|
541
543
|
if (!peerStreams.isWritable) {
|
542
|
-
|
544
|
+
log.error('Cannot send RPC to %p as there is no outbound stream to it available', peer)
|
543
545
|
|
544
546
|
return
|
545
547
|
}
|
@@ -662,7 +664,7 @@ export abstract class PubSubBaseProtocol<Events extends Record<string, any> = Pu
|
|
662
664
|
sequenceNumber: randomSeqno()
|
663
665
|
}
|
664
666
|
|
665
|
-
|
667
|
+
log('publish topic: %s from: %p data: %m', topic, message.from, message.data)
|
666
668
|
|
667
669
|
const rpcMessage = await this.buildMessage(message)
|
668
670
|
let emittedToSelf = false
|
@@ -704,7 +706,7 @@ export abstract class PubSubBaseProtocol<Events extends Record<string, any> = Pu
|
|
704
706
|
throw new Error('Pubsub has not started')
|
705
707
|
}
|
706
708
|
|
707
|
-
|
709
|
+
log('subscribe to topic: %s', topic)
|
708
710
|
|
709
711
|
if (!this.subscriptions.has(topic)) {
|
710
712
|
this.subscriptions.add(topic)
|
@@ -727,7 +729,7 @@ export abstract class PubSubBaseProtocol<Events extends Record<string, any> = Pu
|
|
727
729
|
|
728
730
|
const wasSubscribed = this.subscriptions.has(topic)
|
729
731
|
|
730
|
-
|
732
|
+
log('unsubscribe from %s - am subscribed %s', topic, wasSubscribed)
|
731
733
|
|
732
734
|
if (wasSubscribed) {
|
733
735
|
this.subscriptions.delete(topic)
|
package/src/peer-streams.ts
CHANGED
@@ -1,21 +1,22 @@
|
|
1
|
-
import { TypedEventEmitter, CustomEvent } from '@libp2p/interface'
|
2
|
-
import {
|
1
|
+
import { TypedEventEmitter, CustomEvent } from '@libp2p/interface/events'
|
2
|
+
import { logger } from '@libp2p/logger'
|
3
|
+
import { abortableSource } from 'abortable-iterator'
|
3
4
|
import * as lp from 'it-length-prefixed'
|
4
5
|
import { pipe } from 'it-pipe'
|
5
6
|
import { pushable } from 'it-pushable'
|
6
7
|
import { Uint8ArrayList } from 'uint8arraylist'
|
7
|
-
import type {
|
8
|
+
import type { Stream } from '@libp2p/interface/connection'
|
9
|
+
import type { PeerId } from '@libp2p/interface/peer-id'
|
10
|
+
import type { PeerStreamEvents } from '@libp2p/interface/pubsub'
|
8
11
|
import type { Pushable } from 'it-pushable'
|
9
12
|
|
13
|
+
const log = logger('libp2p-pubsub:peer-streams')
|
14
|
+
|
10
15
|
export interface PeerStreamsInit {
|
11
16
|
id: PeerId
|
12
17
|
protocol: string
|
13
18
|
}
|
14
19
|
|
15
|
-
export interface PeerStreamsComponents {
|
16
|
-
logger: ComponentLogger
|
17
|
-
}
|
18
|
-
|
19
20
|
/**
|
20
21
|
* Thin wrapper around a peer's inbound / outbound pubsub streams
|
21
22
|
*/
|
@@ -43,12 +44,10 @@ export class PeerStreams extends TypedEventEmitter<PeerStreamEvents> {
|
|
43
44
|
*/
|
44
45
|
private readonly _inboundAbortController: AbortController
|
45
46
|
private closed: boolean
|
46
|
-
private readonly log: Logger
|
47
47
|
|
48
|
-
constructor (
|
48
|
+
constructor (init: PeerStreamsInit) {
|
49
49
|
super()
|
50
50
|
|
51
|
-
this.log = components.logger.forComponent('libp2p-pubsub:peer-streams')
|
52
51
|
this.id = init.id
|
53
52
|
this.protocol = init.protocol
|
54
53
|
|
@@ -87,22 +86,18 @@ export class PeerStreams extends TypedEventEmitter<PeerStreamEvents> {
|
|
87
86
|
* Attach a raw inbound stream and setup a read stream
|
88
87
|
*/
|
89
88
|
attachInboundStream (stream: Stream): AsyncIterable<Uint8ArrayList> {
|
90
|
-
const abortListener = (): void => {
|
91
|
-
closeSource(stream.source, this.log)
|
92
|
-
}
|
93
|
-
|
94
|
-
this._inboundAbortController.signal.addEventListener('abort', abortListener, {
|
95
|
-
once: true
|
96
|
-
})
|
97
|
-
|
98
89
|
// Create and attach a new inbound stream
|
99
90
|
// The inbound stream is:
|
100
91
|
// - abortable, set to only return on abort, rather than throw
|
101
92
|
// - transformed with length-prefix transform
|
102
93
|
this._rawInboundStream = stream
|
103
|
-
this.inboundStream =
|
104
|
-
|
105
|
-
|
94
|
+
this.inboundStream = abortableSource(
|
95
|
+
pipe(
|
96
|
+
this._rawInboundStream,
|
97
|
+
(source) => lp.decode(source)
|
98
|
+
),
|
99
|
+
this._inboundAbortController.signal,
|
100
|
+
{ returnOnAbort: true }
|
106
101
|
)
|
107
102
|
|
108
103
|
this.dispatchEvent(new CustomEvent('stream:inbound'))
|
@@ -122,12 +117,13 @@ export class PeerStreams extends TypedEventEmitter<PeerStreamEvents> {
|
|
122
117
|
|
123
118
|
this._rawOutboundStream = stream
|
124
119
|
this.outboundStream = pushable<Uint8ArrayList>({
|
120
|
+
objectMode: true,
|
125
121
|
onEnd: (shouldEmit) => {
|
126
122
|
// close writable side of the stream
|
127
123
|
if (this._rawOutboundStream != null) { // eslint-disable-line @typescript-eslint/prefer-optional-chain
|
128
124
|
this._rawOutboundStream.closeWrite()
|
129
125
|
.catch(err => {
|
130
|
-
|
126
|
+
log('error closing outbound stream', err)
|
131
127
|
})
|
132
128
|
}
|
133
129
|
|
@@ -144,7 +140,7 @@ export class PeerStreams extends TypedEventEmitter<PeerStreamEvents> {
|
|
144
140
|
(source) => lp.encode(source),
|
145
141
|
this._rawOutboundStream
|
146
142
|
).catch((err: Error) => {
|
147
|
-
|
143
|
+
log.error(err)
|
148
144
|
})
|
149
145
|
|
150
146
|
// Only emit if the connection is new
|
package/src/sign.ts
CHANGED
@@ -3,7 +3,8 @@ import { peerIdFromKeys } from '@libp2p/peer-id'
|
|
3
3
|
import { concat as uint8ArrayConcat } from 'uint8arrays/concat'
|
4
4
|
import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'
|
5
5
|
import { toRpcMessage } from './utils.js'
|
6
|
-
import type { PeerId
|
6
|
+
import type { PeerId } from '@libp2p/interface/peer-id'
|
7
|
+
import type { PubSubRPCMessage, SignedMessage } from '@libp2p/interface/pubsub'
|
7
8
|
|
8
9
|
export const SignPrefix = uint8ArrayFromString('libp2p-pubsub:')
|
9
10
|
|
package/src/utils.ts
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
import { randomBytes } from '@libp2p/crypto'
|
2
|
-
import { CodeError } from '@libp2p/interface'
|
2
|
+
import { CodeError } from '@libp2p/interface/errors'
|
3
3
|
import { peerIdFromBytes, peerIdFromKeys } from '@libp2p/peer-id'
|
4
4
|
import { sha256 } from 'multiformats/hashes/sha2'
|
5
5
|
import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'
|
6
6
|
import { toString as uint8ArrayToString } from 'uint8arrays/to-string'
|
7
7
|
import { codes } from './errors.js'
|
8
|
-
import type { Message, PubSubRPCMessage } from '@libp2p/interface'
|
8
|
+
import type { Message, PubSubRPCMessage } from '@libp2p/interface/pubsub'
|
9
9
|
|
10
10
|
/**
|
11
11
|
* Generate a random sequence number
|
package/dist/typedoc-urls.json
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"codes": "https://libp2p.github.io/js-libp2p/variables/_libp2p_pubsub.errors.codes.html",
|
3
|
-
"./errors:codes": "https://libp2p.github.io/js-libp2p/variables/_libp2p_pubsub.errors.codes.html",
|
4
|
-
"PubSubBaseProtocol": "https://libp2p.github.io/js-libp2p/classes/_libp2p_pubsub.index.PubSubBaseProtocol.html",
|
5
|
-
".:PubSubBaseProtocol": "https://libp2p.github.io/js-libp2p/classes/_libp2p_pubsub.index.PubSubBaseProtocol.html",
|
6
|
-
"PubSubComponents": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_pubsub.index.PubSubComponents.html",
|
7
|
-
".:PubSubComponents": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_pubsub.index.PubSubComponents.html",
|
8
|
-
"PeerStreams": "https://libp2p.github.io/js-libp2p/classes/_libp2p_pubsub.peer_streams.PeerStreams.html",
|
9
|
-
"./peer-streams:PeerStreams": "https://libp2p.github.io/js-libp2p/classes/_libp2p_pubsub.peer_streams.PeerStreams.html",
|
10
|
-
"PeerStreamsComponents": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_pubsub.peer_streams.PeerStreamsComponents.html",
|
11
|
-
"./peer-streams:PeerStreamsComponents": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_pubsub.peer_streams.PeerStreamsComponents.html",
|
12
|
-
"PeerStreamsInit": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_pubsub.peer_streams.PeerStreamsInit.html",
|
13
|
-
"./peer-streams:PeerStreamsInit": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_pubsub.peer_streams.PeerStreamsInit.html",
|
14
|
-
"anyMatch": "https://libp2p.github.io/js-libp2p/functions/_libp2p_pubsub.utils.anyMatch.html",
|
15
|
-
"./utils:anyMatch": "https://libp2p.github.io/js-libp2p/functions/_libp2p_pubsub.utils.anyMatch.html",
|
16
|
-
"bigIntFromBytes": "https://libp2p.github.io/js-libp2p/functions/_libp2p_pubsub.utils.bigIntFromBytes.html",
|
17
|
-
"./utils:bigIntFromBytes": "https://libp2p.github.io/js-libp2p/functions/_libp2p_pubsub.utils.bigIntFromBytes.html",
|
18
|
-
"bigIntToBytes": "https://libp2p.github.io/js-libp2p/functions/_libp2p_pubsub.utils.bigIntToBytes.html",
|
19
|
-
"./utils:bigIntToBytes": "https://libp2p.github.io/js-libp2p/functions/_libp2p_pubsub.utils.bigIntToBytes.html",
|
20
|
-
"ensureArray": "https://libp2p.github.io/js-libp2p/functions/_libp2p_pubsub.utils.ensureArray.html",
|
21
|
-
"./utils:ensureArray": "https://libp2p.github.io/js-libp2p/functions/_libp2p_pubsub.utils.ensureArray.html",
|
22
|
-
"msgId": "https://libp2p.github.io/js-libp2p/functions/_libp2p_pubsub.utils.msgId.html",
|
23
|
-
"./utils:msgId": "https://libp2p.github.io/js-libp2p/functions/_libp2p_pubsub.utils.msgId.html",
|
24
|
-
"noSignMsgId": "https://libp2p.github.io/js-libp2p/functions/_libp2p_pubsub.utils.noSignMsgId.html",
|
25
|
-
"./utils:noSignMsgId": "https://libp2p.github.io/js-libp2p/functions/_libp2p_pubsub.utils.noSignMsgId.html",
|
26
|
-
"randomSeqno": "https://libp2p.github.io/js-libp2p/functions/_libp2p_pubsub.utils.randomSeqno.html",
|
27
|
-
"./utils:randomSeqno": "https://libp2p.github.io/js-libp2p/functions/_libp2p_pubsub.utils.randomSeqno.html",
|
28
|
-
"toMessage": "https://libp2p.github.io/js-libp2p/functions/_libp2p_pubsub.utils.toMessage.html",
|
29
|
-
"./utils:toMessage": "https://libp2p.github.io/js-libp2p/functions/_libp2p_pubsub.utils.toMessage.html",
|
30
|
-
"toRpcMessage": "https://libp2p.github.io/js-libp2p/functions/_libp2p_pubsub.utils.toRpcMessage.html",
|
31
|
-
"./utils:toRpcMessage": "https://libp2p.github.io/js-libp2p/functions/_libp2p_pubsub.utils.toRpcMessage.html"
|
32
|
-
}
|