@libp2p/interface
Advanced tools
| import type { AbortOptions, MessageStream } from './index.ts'; | ||
| export interface ConnectionProtector { | ||
| /** | ||
| * Takes a MessageStream and creates a private encryption stream between | ||
| * the two peers from the shared key the Protector instance was created with. | ||
| */ | ||
| protect(connection: MessageStream, options?: AbortOptions): Promise<MessageStream>; | ||
| } | ||
| //# sourceMappingURL=connection-protector.d.ts.map |
| {"version":3,"file":"connection-protector.d.ts","sourceRoot":"","sources":["../../src/connection-protector.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAE7D,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,OAAO,CAAE,UAAU,EAAE,aAAa,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,aAAa,CAAC,CAAA;CACpF"} |
| export {}; | ||
| //# sourceMappingURL=connection-protector.js.map |
| {"version":3,"file":"connection-protector.js","sourceRoot":"","sources":["../../src/connection-protector.ts"],"names":[],"mappings":""} |
| import type { Uint8ArrayList } from 'uint8arraylist'; | ||
| /** | ||
| * A custom implementation of MessageEvent as the Undici version does too much | ||
| * validation in it's constructor so is very slow. | ||
| */ | ||
| export declare class StreamMessageEvent extends Event { | ||
| data: Uint8Array | Uint8ArrayList; | ||
| constructor(data: Uint8Array | Uint8ArrayList, eventInitDict?: EventInit); | ||
| } | ||
| /** | ||
| * An event dispatched when the stream is closed. The `error` property can be | ||
| * inspected to discover if the closing was graceful or not, and the `remote` | ||
| * property shows which end of the stream initiated the closure | ||
| */ | ||
| export declare class StreamCloseEvent extends Event { | ||
| error?: Error; | ||
| local?: boolean; | ||
| constructor(local?: boolean, error?: Error, eventInitDict?: EventInit); | ||
| } | ||
| export declare class StreamAbortEvent extends StreamCloseEvent { | ||
| constructor(error: Error, eventInitDict?: EventInit); | ||
| } | ||
| export declare class StreamResetEvent extends StreamCloseEvent { | ||
| constructor(error: Error, eventInitDict?: EventInit); | ||
| } | ||
| //# sourceMappingURL=events.d.ts.map |
| {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/events.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAEpD;;;GAGG;AACH,qBAAa,kBAAmB,SAAQ,KAAK;IACpC,IAAI,EAAE,UAAU,GAAG,cAAc,CAAA;gBAE3B,IAAI,EAAE,UAAU,GAAG,cAAc,EAAE,aAAa,CAAC,EAAE,SAAS;CAK1E;AAED;;;;GAIG;AACH,qBAAa,gBAAiB,SAAQ,KAAK;IAClC,KAAK,CAAC,EAAE,KAAK,CAAA;IACb,KAAK,CAAC,EAAE,OAAO,CAAA;gBAET,KAAK,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,EAAE,KAAK,EAAE,aAAa,CAAC,EAAE,SAAS;CAMvE;AAED,qBAAa,gBAAiB,SAAQ,gBAAgB;gBACvC,KAAK,EAAE,KAAK,EAAE,aAAa,CAAC,EAAE,SAAS;CAGrD;AAED,qBAAa,gBAAiB,SAAQ,gBAAgB;gBACvC,KAAK,EAAE,KAAK,EAAE,aAAa,CAAC,EAAE,SAAS;CAGrD"} |
| /** | ||
| * A custom implementation of MessageEvent as the Undici version does too much | ||
| * validation in it's constructor so is very slow. | ||
| */ | ||
| export class StreamMessageEvent extends Event { | ||
| data; | ||
| constructor(data, eventInitDict) { | ||
| super('message', eventInitDict); | ||
| this.data = data; | ||
| } | ||
| } | ||
| /** | ||
| * An event dispatched when the stream is closed. The `error` property can be | ||
| * inspected to discover if the closing was graceful or not, and the `remote` | ||
| * property shows which end of the stream initiated the closure | ||
| */ | ||
| export class StreamCloseEvent extends Event { | ||
| error; | ||
| local; | ||
| constructor(local, error, eventInitDict) { | ||
| super('close', eventInitDict); | ||
| this.error = error; | ||
| this.local = local; | ||
| } | ||
| } | ||
| export class StreamAbortEvent extends StreamCloseEvent { | ||
| constructor(error, eventInitDict) { | ||
| super(true, error, eventInitDict); | ||
| } | ||
| } | ||
| export class StreamResetEvent extends StreamCloseEvent { | ||
| constructor(error, eventInitDict) { | ||
| super(false, error, eventInitDict); | ||
| } | ||
| } | ||
| //# sourceMappingURL=events.js.map |
| {"version":3,"file":"events.js","sourceRoot":"","sources":["../../src/events.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,OAAO,kBAAmB,SAAQ,KAAK;IACpC,IAAI,CAA6B;IAExC,YAAa,IAAiC,EAAE,aAAyB;QACvE,KAAK,CAAC,SAAS,EAAE,aAAa,CAAC,CAAA;QAE/B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;IAClB,CAAC;CACF;AAED;;;;GAIG;AACH,MAAM,OAAO,gBAAiB,SAAQ,KAAK;IAClC,KAAK,CAAQ;IACb,KAAK,CAAU;IAEtB,YAAa,KAAe,EAAE,KAAa,EAAE,aAAyB;QACpE,KAAK,CAAC,OAAO,EAAE,aAAa,CAAC,CAAA;QAE7B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;QAClB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;IACpB,CAAC;CACF;AAED,MAAM,OAAO,gBAAiB,SAAQ,gBAAgB;IACpD,YAAa,KAAY,EAAE,aAAyB;QAClD,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,aAAa,CAAC,CAAA;IACnC,CAAC;CACF;AAED,MAAM,OAAO,gBAAiB,SAAQ,gBAAgB;IACpD,YAAa,KAAY,EAAE,aAAyB;QAClD,KAAK,CAAC,KAAK,EAAE,KAAK,EAAE,aAAa,CAAC,CAAA;IACpC,CAAC;CACF"} |
| import type { Logger, StreamCloseEvent, StreamMessageEvent, TypedEventTarget, AbortOptions } from './index.js'; | ||
| import type { Uint8ArrayList } from 'uint8arraylist'; | ||
| /** | ||
| * The direction of the message stream | ||
| */ | ||
| export type MessageStreamDirection = 'inbound' | 'outbound'; | ||
| /** | ||
| * The states a message stream can be in | ||
| */ | ||
| export type MessageStreamStatus = 'open' | 'closing' | 'closed' | 'aborted' | 'reset'; | ||
| /** | ||
| * The states the readable end of a message stream can be in | ||
| */ | ||
| export type MessageStreamReadStatus = 'readable' | 'paused' | 'closing' | 'closed'; | ||
| /** | ||
| * The states the writable end of a message stream can be in | ||
| */ | ||
| export type MessageStreamWriteStatus = 'writable' | 'closing' | 'closed'; | ||
| /** | ||
| * An object that records the times of various events | ||
| */ | ||
| export interface MessageStreamTimeline { | ||
| /** | ||
| * A timestamp of when the message stream was opened | ||
| */ | ||
| open: number; | ||
| /** | ||
| * A timestamp of when the message stream was closed for both reading and | ||
| * writing by both ends of the stream | ||
| */ | ||
| close?: number; | ||
| } | ||
| export interface MessageStreamEvents { | ||
| /** | ||
| * Data was received from the remote end of the message stream | ||
| */ | ||
| message: StreamMessageEvent; | ||
| /** | ||
| * The local send buffer has emptied and the stream may be written to once | ||
| * more, unless it is currently closing. | ||
| */ | ||
| drain: Event; | ||
| /** | ||
| * The underlying resource is closed - no further events will be emitted and | ||
| * the stream cannot be used to send or receive any more data. | ||
| * | ||
| * When the `.error` field is set, the `local` property of the event will be | ||
| * `true` value if the `.abort` was invoked, otherwise it means a remote error | ||
| * occurred and the peer sent a reset signal. | ||
| */ | ||
| close: StreamCloseEvent; | ||
| /** | ||
| * Where the stream implementation supports half-closing, it may emit this | ||
| * event when the remote end of the stream closes it's writable end. | ||
| * | ||
| * After this event is received no further 'message' events will be emitted | ||
| * though the stream can still be written to, if it has not been closed at | ||
| * this end. | ||
| */ | ||
| remoteCloseWrite: Event; | ||
| /** | ||
| * The outgoing write queue emptied - there are no more bytes queued for | ||
| * sending to the remote end of the stream. | ||
| */ | ||
| idle: Event; | ||
| } | ||
| export interface MessageStream<Timeline extends MessageStreamTimeline = MessageStreamTimeline> extends TypedEventTarget<MessageStreamEvents>, AsyncIterable<Uint8Array | Uint8ArrayList> { | ||
| /** | ||
| * The current status of the message stream | ||
| */ | ||
| status: MessageStreamStatus; | ||
| /** | ||
| * Timestamps of when stream events occurred | ||
| */ | ||
| timeline: Timeline; | ||
| /** | ||
| * A logging implementation that can be used to log stream-specific messages | ||
| */ | ||
| log: Logger; | ||
| /** | ||
| * Whether this stream is inbound or outbound | ||
| */ | ||
| direction: MessageStreamDirection; | ||
| /** | ||
| * The maximum number of bytes to store when paused. If receipt of more bytes | ||
| * from the remote end of the stream causes the buffer size to exceed this | ||
| * value the stream will be reset and a 'close' event emitted. | ||
| * | ||
| * This value can be changed at runtime. | ||
| */ | ||
| maxReadBufferLength: number; | ||
| /** | ||
| * When the `.send` method returns false it means that the underlying resource | ||
| * has signalled that it's write buffer is full. If the user continues to call | ||
| * `.send`, outgoing bytes are stored in an internal buffer until the | ||
| * underlying resource signals that it can accept more data. | ||
| * | ||
| * If the size of that internal buffer exceed this value the stream will be | ||
| * reset and a 'close' event emitted. | ||
| * | ||
| * This value can be changed at runtime. | ||
| */ | ||
| maxWriteBufferLength?: number; | ||
| /** | ||
| * If no data is transmitted over the stream in this many ms, the stream will | ||
| * be aborted with an InactivityTimeoutError | ||
| */ | ||
| inactivityTimeout: number; | ||
| /** | ||
| * If this property is `true`, the underlying transport has signalled that its | ||
| * write buffer is full and that `.send` should not be called again. | ||
| * | ||
| * A `drain` event will be emitted after which is its safe to call `.send` | ||
| * again to resume sending. | ||
| */ | ||
| writableNeedsDrain: boolean; | ||
| /** | ||
| * Write data to the stream. If the method returns false it means the | ||
| * internal buffer is now full and the caller should wait for the 'drain' | ||
| * event before sending more data. | ||
| * | ||
| * This method may throw if: | ||
| * - The internal send buffer is full | ||
| * - The stream has previously been closed for writing locally or remotely | ||
| */ | ||
| send(data: Uint8Array | Uint8ArrayList): boolean; | ||
| /** | ||
| * Stop accepting new data to send and return a promise that resolves when any | ||
| * unsent data has been written into the underlying resource. | ||
| */ | ||
| close(options?: AbortOptions): Promise<void>; | ||
| /** | ||
| * Stop accepting new data to send, discard any unsent/unread data, and emit a | ||
| * 'close' event with the 'error' property set to the passed error. | ||
| */ | ||
| abort(err: Error): void; | ||
| /** | ||
| * Stop emitting further 'message' events. Any received data will be stored in | ||
| * an internal buffer. If the buffer size reaches `maxReadBufferLength`, the | ||
| * stream will be reset and a StreamAbortEvent emitted. | ||
| * | ||
| * If the underlying resource supports it, the remote peer will be instructed | ||
| * to pause transmission of further data. | ||
| */ | ||
| pause(): void; | ||
| /** | ||
| * Resume emitting 'message' events. | ||
| * | ||
| * If the underlying resource supports it, the remote peer will be informed | ||
| * that it is ok to start sending data again. | ||
| */ | ||
| resume(): void; | ||
| /** | ||
| * Queue the passed data to be emitted as a 'message' event either during the | ||
| * next tick or sooner if data is received from the underlying resource. | ||
| */ | ||
| push(buf: Uint8Array | Uint8ArrayList): void; | ||
| } | ||
| //# sourceMappingURL=message-stream.d.ts.map |
| {"version":3,"file":"message-stream.d.ts","sourceRoot":"","sources":["../../src/message-stream.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAC9G,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAEpD;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG,SAAS,GAAG,UAAU,CAAA;AAE3D;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,GAAG,OAAO,CAAA;AAErF;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG,UAAU,GAAG,QAAQ,GAAG,SAAS,GAAG,QAAQ,CAAA;AAElF;;GAEG;AACH,MAAM,MAAM,wBAAwB,GAAG,UAAU,GAAG,SAAS,GAAG,QAAQ,CAAA;AAExE;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC;;OAEG;IACH,IAAI,EAAE,MAAM,CAAA;IAEZ;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,OAAO,EAAE,kBAAkB,CAAA;IAE3B;;;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../src/message-stream.ts"],"names":[],"mappings":""} |
| import type { MessageStream, MessageStreamTimeline } from './message-stream.ts'; | ||
| import type { Multiaddr } from '@multiformats/multiaddr'; | ||
| export interface MultiaddrConnectionTimeline extends MessageStreamTimeline { | ||
| /** | ||
| * When the MultiaddrConnection was upgraded to a Connection - the type of | ||
| * connection encryption and multiplexing was negotiated. | ||
| */ | ||
| upgraded?: number; | ||
| } | ||
| /** | ||
| * A MultiaddrConnection is returned by a transport after dialing a peer. It is | ||
| * a low-level primitive and is the raw connection, typically without encryption | ||
| * or stream multiplexing. | ||
| */ | ||
| export interface MultiaddrConnection extends MessageStream<MultiaddrConnectionTimeline> { | ||
| /** | ||
| * The address of the remote end of the connection | ||
| */ | ||
| remoteAddr: Multiaddr; | ||
| /** | ||
| * When stream life cycle events occurred | ||
| */ | ||
| timeline: MultiaddrConnectionTimeline; | ||
| } | ||
| //# sourceMappingURL=multiaddr-connection.d.ts.map |
| {"version":3,"file":"multiaddr-connection.d.ts","sourceRoot":"","sources":["../../src/multiaddr-connection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAA;AAC/E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAExD,MAAM,WAAW,2BAA4B,SAAQ,qBAAqB;IACxE;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED;;;;GAIG;AACH,MAAM,WAAW,mBAAoB,SAAQ,aAAa,CAAC,2BAA2B,CAAC;IACrF;;OAEG;IACH,UAAU,EAAE,SAAS,CAAA;IAErB;;OAEG;IACH,QAAQ,EAAE,2BAA2B,CAAA;CACtC"} |
| export {}; | ||
| //# sourceMappingURL=multiaddr-connection.js.map |
| {"version":3,"file":"multiaddr-connection.js","sourceRoot":"","sources":["../../src/multiaddr-connection.ts"],"names":[],"mappings":""} |
| import type { AbortOptions } from './index.ts'; | ||
| import type { MessageStream, MessageStreamReadStatus, MessageStreamWriteStatus } from './message-stream.js'; | ||
| /** | ||
| * A Stream is a lightweight data channel between two peers that can be written | ||
| * to and read from at both ends. | ||
| * | ||
| * It is half-closable - that is in order for it to be closed fully and any | ||
| * associated memory reclaimed, both ends must close their writeable end of the | ||
| * stream. | ||
| * | ||
| * It's also possible to close the readable end of the stream, but this depends | ||
| * on the underlying stream muxer supporting this operation which not all do. | ||
| */ | ||
| export interface Stream extends MessageStream { | ||
| /** | ||
| * Unique identifier for a stream. Identifiers are not unique across muxers. | ||
| */ | ||
| id: string; | ||
| /** | ||
| * The protocol negotiated for this stream | ||
| */ | ||
| protocol: string; | ||
| /** | ||
| * The status of the readable end of the stream | ||
| */ | ||
| readStatus: MessageStreamReadStatus; | ||
| /** | ||
| * The status of the writable end of the stream | ||
| */ | ||
| writeStatus: MessageStreamWriteStatus; | ||
| /** | ||
| * The status of the readable end of the remote end of the stream - n.b. this | ||
| * requires the underlying stream transport to support sending STOP_SENDING | ||
| * messages or similar. | ||
| */ | ||
| remoteReadStatus: MessageStreamReadStatus; | ||
| /** | ||
| * The status of the writable end of the remote end of the stream | ||
| */ | ||
| remoteWriteStatus: MessageStreamWriteStatus; | ||
| /** | ||
| * Close stream for writing and return a promise that resolves once any | ||
| * pending data has been passed to the underlying transport. | ||
| * | ||
| * Note that the stream itself will remain readable until the remote end also | ||
| * closes it's writable end. | ||
| * | ||
| * To close without waiting for the remote, call `.abort` instead. If you want | ||
| * to wait for data to be sent first, ensure if the `.writableStatus` property | ||
| * is not 'paused', if it is, wait for a `drain` event before aborting. | ||
| */ | ||
| close(options?: AbortOptions): Promise<void>; | ||
| /** | ||
| * Send a message to the remote end of the stream informing them that any | ||
| * incoming data will be discarded so they should stop sending. | ||
| * | ||
| * This requires the underlying resource to support this operation - for | ||
| * example the QUIC, WebTransport, WebRTC transports do but anything | ||
| * multiplexed using Yamux or Mplex do not. | ||
| */ | ||
| closeRead(options?: AbortOptions): Promise<void>; | ||
| } | ||
| //# sourceMappingURL=stream.d.ts.map |
| {"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../../src/stream.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAC9C,OAAO,KAAK,EAAE,aAAa,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAA;AAE3G;;;;;;;;;;GAUG;AACH,MAAM,WAAW,MAAO,SAAQ,aAAa;IAC3C;;OAEG;IACH,EAAE,EAAE,MAAM,CAAA;IAEV;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAA;IAEhB;;OAEG;IACH,UAAU,EAAE,uBAAuB,CAAA;IAEnC;;OAEG;IACH,WAAW,EAAE,wBAAwB,CAAA;IAErC;;;;OAIG;IACH,gBAAgB,EAAE,uBAAuB,CAAA;IAEzC;;OAEG;IACH,iBAAiB,EAAE,wBAAwB,CAAA;IAE3C;;;;;;;;;;OAUG;IACH,KAAK,CAAE,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAE7C;;;;;;;OAOG;IACH,SAAS,CAAC,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CACjD"} |
| export {}; | ||
| //# sourceMappingURL=stream.js.map |
| {"version":3,"file":"stream.js","sourceRoot":"","sources":["../../src/stream.ts"],"names":[],"mappings":""} |
| import type { AbortOptions, MessageStream } from './index.ts' | ||
| export interface ConnectionProtector { | ||
| /** | ||
| * Takes a MessageStream and creates a private encryption stream between | ||
| * the two peers from the shared key the Protector instance was created with. | ||
| */ | ||
| protect (connection: MessageStream, options?: AbortOptions): Promise<MessageStream> | ||
| } |
| import type { Uint8ArrayList } from 'uint8arraylist' | ||
| /** | ||
| * A custom implementation of MessageEvent as the Undici version does too much | ||
| * validation in it's constructor so is very slow. | ||
| */ | ||
| export class StreamMessageEvent extends Event { | ||
| public data: Uint8Array | Uint8ArrayList | ||
| constructor (data: Uint8Array | Uint8ArrayList, eventInitDict?: EventInit) { | ||
| super('message', eventInitDict) | ||
| this.data = data | ||
| } | ||
| } | ||
| /** | ||
| * An event dispatched when the stream is closed. The `error` property can be | ||
| * inspected to discover if the closing was graceful or not, and the `remote` | ||
| * property shows which end of the stream initiated the closure | ||
| */ | ||
| export class StreamCloseEvent extends Event { | ||
| public error?: Error | ||
| public local?: boolean | ||
| constructor (local?: boolean, error?: Error, eventInitDict?: EventInit) { | ||
| super('close', eventInitDict) | ||
| this.error = error | ||
| this.local = local | ||
| } | ||
| } | ||
| export class StreamAbortEvent extends StreamCloseEvent { | ||
| constructor (error: Error, eventInitDict?: EventInit) { | ||
| super(true, error, eventInitDict) | ||
| } | ||
| } | ||
| export class StreamResetEvent extends StreamCloseEvent { | ||
| constructor (error: Error, eventInitDict?: EventInit) { | ||
| super(false, error, eventInitDict) | ||
| } | ||
| } |
| import type { Logger, StreamCloseEvent, StreamMessageEvent, TypedEventTarget, AbortOptions } from './index.js' | ||
| import type { Uint8ArrayList } from 'uint8arraylist' | ||
| /** | ||
| * The direction of the message stream | ||
| */ | ||
| export type MessageStreamDirection = 'inbound' | 'outbound' | ||
| /** | ||
| * The states a message stream can be in | ||
| */ | ||
| export type MessageStreamStatus = 'open' | 'closing' | 'closed' | 'aborted' | 'reset' | ||
| /** | ||
| * The states the readable end of a message stream can be in | ||
| */ | ||
| export type MessageStreamReadStatus = 'readable' | 'paused' | 'closing' | 'closed' | ||
| /** | ||
| * The states the writable end of a message stream can be in | ||
| */ | ||
| export type MessageStreamWriteStatus = 'writable' | 'closing' | 'closed' | ||
| /** | ||
| * An object that records the times of various events | ||
| */ | ||
| export interface MessageStreamTimeline { | ||
| /** | ||
| * A timestamp of when the message stream was opened | ||
| */ | ||
| open: number | ||
| /** | ||
| * A timestamp of when the message stream was closed for both reading and | ||
| * writing by both ends of the stream | ||
| */ | ||
| close?: number | ||
| } | ||
| export interface MessageStreamEvents { | ||
| /** | ||
| * Data was received from the remote end of the message stream | ||
| */ | ||
| message: StreamMessageEvent | ||
| /** | ||
| * The local send buffer has emptied and the stream may be written to once | ||
| * more, unless it is currently closing. | ||
| */ | ||
| drain: Event | ||
| /** | ||
| * The underlying resource is closed - no further events will be emitted and | ||
| * the stream cannot be used to send or receive any more data. | ||
| * | ||
| * When the `.error` field is set, the `local` property of the event will be | ||
| * `true` value if the `.abort` was invoked, otherwise it means a remote error | ||
| * occurred and the peer sent a reset signal. | ||
| */ | ||
| close: StreamCloseEvent | ||
| /** | ||
| * Where the stream implementation supports half-closing, it may emit this | ||
| * event when the remote end of the stream closes it's writable end. | ||
| * | ||
| * After this event is received no further 'message' events will be emitted | ||
| * though the stream can still be written to, if it has not been closed at | ||
| * this end. | ||
| */ | ||
| remoteCloseWrite: Event | ||
| /** | ||
| * The outgoing write queue emptied - there are no more bytes queued for | ||
| * sending to the remote end of the stream. | ||
| */ | ||
| idle: Event | ||
| } | ||
| export interface MessageStream<Timeline extends MessageStreamTimeline = MessageStreamTimeline> extends TypedEventTarget<MessageStreamEvents>, AsyncIterable<Uint8Array | Uint8ArrayList> { | ||
| /** | ||
| * The current status of the message stream | ||
| */ | ||
| status: MessageStreamStatus | ||
| /** | ||
| * Timestamps of when stream events occurred | ||
| */ | ||
| timeline: Timeline | ||
| /** | ||
| * A logging implementation that can be used to log stream-specific messages | ||
| */ | ||
| log: Logger | ||
| /** | ||
| * Whether this stream is inbound or outbound | ||
| */ | ||
| direction: MessageStreamDirection | ||
| /** | ||
| * The maximum number of bytes to store when paused. If receipt of more bytes | ||
| * from the remote end of the stream causes the buffer size to exceed this | ||
| * value the stream will be reset and a 'close' event emitted. | ||
| * | ||
| * This value can be changed at runtime. | ||
| */ | ||
| maxReadBufferLength: number | ||
| /** | ||
| * When the `.send` method returns false it means that the underlying resource | ||
| * has signalled that it's write buffer is full. If the user continues to call | ||
| * `.send`, outgoing bytes are stored in an internal buffer until the | ||
| * underlying resource signals that it can accept more data. | ||
| * | ||
| * If the size of that internal buffer exceed this value the stream will be | ||
| * reset and a 'close' event emitted. | ||
| * | ||
| * This value can be changed at runtime. | ||
| */ | ||
| maxWriteBufferLength?: number | ||
| /** | ||
| * If no data is transmitted over the stream in this many ms, the stream will | ||
| * be aborted with an InactivityTimeoutError | ||
| */ | ||
| inactivityTimeout: number | ||
| /** | ||
| * If this property is `true`, the underlying transport has signalled that its | ||
| * write buffer is full and that `.send` should not be called again. | ||
| * | ||
| * A `drain` event will be emitted after which is its safe to call `.send` | ||
| * again to resume sending. | ||
| */ | ||
| writableNeedsDrain: boolean | ||
| /** | ||
| * Write data to the stream. If the method returns false it means the | ||
| * internal buffer is now full and the caller should wait for the 'drain' | ||
| * event before sending more data. | ||
| * | ||
| * This method may throw if: | ||
| * - The internal send buffer is full | ||
| * - The stream has previously been closed for writing locally or remotely | ||
| */ | ||
| send (data: Uint8Array | Uint8ArrayList): boolean | ||
| /** | ||
| * Stop accepting new data to send and return a promise that resolves when any | ||
| * unsent data has been written into the underlying resource. | ||
| */ | ||
| close (options?: AbortOptions): Promise<void> | ||
| /** | ||
| * Stop accepting new data to send, discard any unsent/unread data, and emit a | ||
| * 'close' event with the 'error' property set to the passed error. | ||
| */ | ||
| abort (err: Error): void | ||
| /** | ||
| * Stop emitting further 'message' events. Any received data will be stored in | ||
| * an internal buffer. If the buffer size reaches `maxReadBufferLength`, the | ||
| * stream will be reset and a StreamAbortEvent emitted. | ||
| * | ||
| * If the underlying resource supports it, the remote peer will be instructed | ||
| * to pause transmission of further data. | ||
| */ | ||
| pause (): void | ||
| /** | ||
| * Resume emitting 'message' events. | ||
| * | ||
| * If the underlying resource supports it, the remote peer will be informed | ||
| * that it is ok to start sending data again. | ||
| */ | ||
| resume (): void | ||
| /** | ||
| * Queue the passed data to be emitted as a 'message' event either during the | ||
| * next tick or sooner if data is received from the underlying resource. | ||
| */ | ||
| push (buf: Uint8Array | Uint8ArrayList): void | ||
| } |
| import type { MessageStream, MessageStreamTimeline } from './message-stream.ts' | ||
| import type { Multiaddr } from '@multiformats/multiaddr' | ||
| export interface MultiaddrConnectionTimeline extends MessageStreamTimeline { | ||
| /** | ||
| * When the MultiaddrConnection was upgraded to a Connection - the type of | ||
| * connection encryption and multiplexing was negotiated. | ||
| */ | ||
| upgraded?: number | ||
| } | ||
| /** | ||
| * A MultiaddrConnection is returned by a transport after dialing a peer. It is | ||
| * a low-level primitive and is the raw connection, typically without encryption | ||
| * or stream multiplexing. | ||
| */ | ||
| export interface MultiaddrConnection extends MessageStream<MultiaddrConnectionTimeline> { | ||
| /** | ||
| * The address of the remote end of the connection | ||
| */ | ||
| remoteAddr: Multiaddr | ||
| /** | ||
| * When stream life cycle events occurred | ||
| */ | ||
| timeline: MultiaddrConnectionTimeline | ||
| } |
| import type { AbortOptions } from './index.ts' | ||
| import type { MessageStream, MessageStreamReadStatus, MessageStreamWriteStatus } from './message-stream.js' | ||
| /** | ||
| * A Stream is a lightweight data channel between two peers that can be written | ||
| * to and read from at both ends. | ||
| * | ||
| * It is half-closable - that is in order for it to be closed fully and any | ||
| * associated memory reclaimed, both ends must close their writeable end of the | ||
| * stream. | ||
| * | ||
| * It's also possible to close the readable end of the stream, but this depends | ||
| * on the underlying stream muxer supporting this operation which not all do. | ||
| */ | ||
| export interface Stream extends MessageStream { | ||
| /** | ||
| * Unique identifier for a stream. Identifiers are not unique across muxers. | ||
| */ | ||
| id: string | ||
| /** | ||
| * The protocol negotiated for this stream | ||
| */ | ||
| protocol: string | ||
| /** | ||
| * The status of the readable end of the stream | ||
| */ | ||
| readStatus: MessageStreamReadStatus | ||
| /** | ||
| * The status of the writable end of the stream | ||
| */ | ||
| writeStatus: MessageStreamWriteStatus | ||
| /** | ||
| * The status of the readable end of the remote end of the stream - n.b. this | ||
| * requires the underlying stream transport to support sending STOP_SENDING | ||
| * messages or similar. | ||
| */ | ||
| remoteReadStatus: MessageStreamReadStatus | ||
| /** | ||
| * The status of the writable end of the remote end of the stream | ||
| */ | ||
| remoteWriteStatus: MessageStreamWriteStatus | ||
| /** | ||
| * Close stream for writing and return a promise that resolves once any | ||
| * pending data has been passed to the underlying transport. | ||
| * | ||
| * Note that the stream itself will remain readable until the remote end also | ||
| * closes it's writable end. | ||
| * | ||
| * To close without waiting for the remote, call `.abort` instead. If you want | ||
| * to wait for data to be sent first, ensure if the `.writableStatus` property | ||
| * is not 'paused', if it is, wait for a `drain` event before aborting. | ||
| */ | ||
| close (options?: AbortOptions): Promise<void> | ||
| /** | ||
| * Send a message to the remote end of the stream informing them that any | ||
| * incoming data will be discarded so they should stop sending. | ||
| * | ||
| * This requires the underlying resource to support this operation - for | ||
| * example the QUIC, WebTransport, WebRTC transports do but anything | ||
| * multiplexed using Yamux or Mplex do not. | ||
| */ | ||
| closeRead(options?: AbortOptions): Promise<void> | ||
| } |
| (function (root, factory) {(typeof module === 'object' && module.exports) ? module.exports = factory() : root.Libp2PInterface = factory()}(typeof self !== 'undefined' ? self : this, function () { | ||
| "use strict";var Libp2PInterface=(()=>{var n=Object.defineProperty;var W=Object.getOwnPropertyDescriptor;var X=Object.getOwnPropertyNames;var Y=Object.prototype.hasOwnProperty;var Z=(t,r)=>{for(var e in r)n(t,e,{get:r[e],enumerable:!0})},$=(t,r,e,s)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of X(r))!Y.call(t,o)&&o!==e&&n(t,o,{get:()=>r[o],enumerable:!(s=W(r,o))||s.enumerable});return t};var k=t=>$(n({},"__esModule",{value:!0}),t);var fr={};Z(fr,{AbortError:()=>c,AlreadyStartedError:()=>M,ConnectionClosedError:()=>E,ConnectionClosingError:()=>f,ConnectionFailedError:()=>h,DialError:()=>N,FaultTolerance:()=>i,InvalidCIDError:()=>P,InvalidCryptoExchangeError:()=>l,InvalidMessageError:()=>C,InvalidMultiaddrError:()=>g,InvalidMultihashError:()=>A,InvalidParametersError:()=>u,InvalidPeerIdError:()=>I,InvalidPrivateKeyError:()=>x,InvalidPublicKeyError:()=>m,KEEP_ALIVE:()=>ar,LimitedConnectionError:()=>K,ListenError:()=>U,MuxerClosedError:()=>b,NotFoundError:()=>v,NotImplementedError:()=>F,NotStartedError:()=>D,ProtocolError:()=>w,StreamResetError:()=>S,StreamStateError:()=>y,StrictNoSign:()=>cr,StrictSign:()=>ir,TimeoutError:()=>T,TooManyInboundProtocolStreamsError:()=>R,TooManyOutboundProtocolStreamsError:()=>_,TopicValidatorResult:()=>a,TypedEventEmitter:()=>O,UnexpectedPeerError:()=>p,UnsupportedKeyTypeError:()=>B,UnsupportedOperationError:()=>d,UnsupportedProtocolError:()=>L,connectionSymbol:()=>q,contentRoutingSymbol:()=>tr,isConnection:()=>rr,isPeerId:()=>sr,isPrivateKey:()=>er,isPubSub:()=>pr,isPublicKey:()=>z,isStartable:()=>j,isTransport:()=>lr,peerDiscoverySymbol:()=>or,peerIdSymbol:()=>G,peerRoutingSymbol:()=>nr,pubSubSymbol:()=>H,serviceCapabilities:()=>xr,serviceDependencies:()=>dr,setMaxListeners:()=>Q,start:()=>ur,stop:()=>mr,transportSymbol:()=>J});var q=Symbol.for("@libp2p/connection");function rr(t){return t!=null&&!!t[q]}var tr=Symbol.for("@libp2p/content-routing");function z(t){return t==null?!1:(t.type==="RSA"||t.type==="Ed25519"||t.type==="secp256k1"||t.type==="ECDSA")&&t.raw instanceof Uint8Array&&typeof t.equals=="function"&&typeof t.toMultihash=="function"&&typeof t.toCID=="function"&&typeof t.verify=="function"}function er(t){return t==null?!1:(t.type==="RSA"||t.type==="Ed25519"||t.type==="secp256k1"||t.type==="ECDSA")&&z(t.publicKey)&&t.raw instanceof Uint8Array&&typeof t.equals=="function"&&typeof t.sign=="function"}var or=Symbol.for("@libp2p/peer-discovery");var G=Symbol.for("@libp2p/peer-id");function sr(t){return!!t?.[G]}var nr=Symbol.for("@libp2p/peer-routing");var ar="keep-alive";var ir="StrictSign",cr="StrictNoSign",a;(function(t){t.Accept="accept",t.Ignore="ignore",t.Reject="reject"})(a||(a={}));var H=Symbol.for("@libp2p/pubsub");function pr(t){return!!t?.[H]}var J=Symbol.for("@libp2p/transport");function lr(t){return t!=null&&!!t[J]}var i;(function(t){t[t.FATAL_ALL=0]="FATAL_ALL",t[t.NO_FATAL=1]="NO_FATAL"})(i||(i={}));var c=class extends Error{static name="AbortError";constructor(r="The operation was aborted"){super(r),this.name="AbortError"}},p=class extends Error{static name="UnexpectedPeerError";constructor(r="Unexpected Peer"){super(r),this.name="UnexpectedPeerError"}},l=class extends Error{static name="InvalidCryptoExchangeError";constructor(r="Invalid crypto exchange"){super(r),this.name="InvalidCryptoExchangeError"}},u=class extends Error{static name="InvalidParametersError";constructor(r="Invalid parameters"){super(r),this.name="InvalidParametersError"}},m=class extends Error{static name="InvalidPublicKeyError";constructor(r="Invalid public key"){super(r),this.name="InvalidPublicKeyError"}},x=class extends Error{static name="InvalidPrivateKeyError";constructor(r="Invalid private key"){super(r),this.name="InvalidPrivateKeyError"}},d=class extends Error{static name="UnsupportedOperationError";constructor(r="Unsupported operation"){super(r),this.name="UnsupportedOperationError"}},f=class extends Error{static name="ConnectionClosingError";constructor(r="The connection is closing"){super(r),this.name="ConnectionClosingError"}},E=class extends Error{static name="ConnectionClosedError";constructor(r="The connection is closed"){super(r),this.name="ConnectionClosedError"}},h=class extends Error{static name="ConnectionFailedError";constructor(r="Connection failed"){super(r),this.name="ConnectionFailedError"}},b=class extends Error{static name="MuxerClosedError";constructor(r="The muxer is closed"){super(r),this.name="MuxerClosedError"}},S=class extends Error{static name="StreamResetError";constructor(r="The stream has been reset"){super(r),this.name="StreamResetError"}},y=class extends Error{static name="StreamStateError";constructor(r="The stream is in an invalid state"){super(r),this.name="StreamStateError"}},v=class extends Error{static name="NotFoundError";constructor(r="Not found"){super(r),this.name="NotFoundError"}},I=class extends Error{static name="InvalidPeerIdError";constructor(r="Invalid PeerID"){super(r),this.name="InvalidPeerIdError"}},g=class extends Error{static name="InvalidMultiaddrError";constructor(r="Invalid multiaddr"){super(r),this.name="InvalidMultiaddrError"}},P=class extends Error{static name="InvalidCIDError";constructor(r="Invalid CID"){super(r),this.name="InvalidCIDError"}},A=class extends Error{static name="InvalidMultihashError";constructor(r="Invalid Multihash"){super(r),this.name="InvalidMultihashError"}},L=class extends Error{static name="UnsupportedProtocolError";constructor(r="Unsupported protocol error"){super(r),this.name="UnsupportedProtocolError"}},C=class extends Error{static name="InvalidMessageError";constructor(r="Invalid message"){super(r),this.name="InvalidMessageError"}},w=class extends Error{static name="ProtocolError";constructor(r="Protocol error"){super(r),this.name="ProtocolError"}},T=class extends Error{static name="TimeoutError";constructor(r="Timed out"){super(r),this.name="TimeoutError"}},D=class extends Error{static name="NotStartedError";constructor(r="Not started"){super(r),this.name="NotStartedError"}},M=class extends Error{static name="AlreadyStartedError";constructor(r="Already started"){super(r),this.name="AlreadyStartedError"}},N=class extends Error{static name="DialError";constructor(r="Dial error"){super(r),this.name="DialError"}},U=class extends Error{static name="ListenError";constructor(r="Listen error"){super(r),this.name="ListenError"}},K=class extends Error{static name="LimitedConnectionError";constructor(r="Limited connection"){super(r),this.name="LimitedConnectionError"}},R=class extends Error{static name="TooManyInboundProtocolStreamsError";constructor(r="Too many inbound protocol streams"){super(r),this.name="TooManyInboundProtocolStreamsError"}},_=class extends Error{static name="TooManyOutboundProtocolStreamsError";constructor(r="Too many outbound protocol streams"){super(r),this.name="TooManyOutboundProtocolStreamsError"}},B=class extends Error{static name="UnsupportedKeyTypeError";constructor(r="Unsupported key type"){super(r),this.name="UnsupportedKeyTypeError"}},F=class extends Error{static name="NotImplementedError";constructor(r="Not implemented"){super(r),this.name="NotImplementedError"}};function Q(){}var O=class extends EventTarget{#r=new Map;constructor(){super()}listenerCount(r){let e=this.#r.get(r);return e==null?0:e.length}addEventListener(r,e,s){super.addEventListener(r,e,s);let o=this.#r.get(r);o==null&&(o=[],this.#r.set(r,o)),o.push({callback:e,once:(s!==!0&&s!==!1&&s?.once)??!1})}removeEventListener(r,e,s){super.removeEventListener(r.toString(),e??null,s);let o=this.#r.get(r);o!=null&&(o=o.filter(({callback:V})=>V!==e),this.#r.set(r,o))}dispatchEvent(r){let e=super.dispatchEvent(r),s=this.#r.get(r.type);return s==null||(s=s.filter(({once:o})=>!o),this.#r.set(r.type,s)),e}safeDispatchEvent(r,e={}){return this.dispatchEvent(new CustomEvent(r,e))}};function j(t){return t!=null&&typeof t.start=="function"&&typeof t.stop=="function"}async function ur(...t){let r=[];for(let e of t)j(e)&&r.push(e);await Promise.all(r.map(async e=>{e.beforeStart!=null&&await e.beforeStart()})),await Promise.all(r.map(async e=>{await e.start()})),await Promise.all(r.map(async e=>{e.afterStart!=null&&await e.afterStart()}))}async function mr(...t){let r=[];for(let e of t)j(e)&&r.push(e);await Promise.all(r.map(async e=>{e.beforeStop!=null&&await e.beforeStop()})),await Promise.all(r.map(async e=>{await e.stop()})),await Promise.all(r.map(async e=>{e.afterStop!=null&&await e.afterStop()}))}var xr=Symbol.for("@libp2p/service-capabilities"),dr=Symbol.for("@libp2p/service-dependencies");return k(fr);})(); | ||
| "use strict";var Libp2PInterface=(()=>{var a=Object.defineProperty;var $=Object.getOwnPropertyDescriptor;var k=Object.getOwnPropertyNames;var rr=Object.prototype.hasOwnProperty;var tr=(t,r)=>{for(var e in r)a(t,e,{get:r[e],enumerable:!0})},er=(t,r,e,s)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of k(r))!rr.call(t,o)&&o!==e&&a(t,o,{get:()=>r[o],enumerable:!(s=$(r,o))||s.enumerable});return t};var or=t=>er(a({},"__esModule",{value:!0}),t);var Er={};tr(Er,{AbortError:()=>i,AlreadyStartedError:()=>U,ConnectionClosedError:()=>f,ConnectionClosingError:()=>d,ConnectionFailedError:()=>E,DialError:()=>N,FaultTolerance:()=>G,InvalidCIDError:()=>L,InvalidCryptoExchangeError:()=>p,InvalidMessageError:()=>T,InvalidMultiaddrError:()=>A,InvalidMultihashError:()=>g,InvalidParametersError:()=>l,InvalidPeerIdError:()=>P,InvalidPrivateKeyError:()=>m,InvalidPublicKeyError:()=>u,KEEP_ALIVE:()=>lr,LimitedConnectionError:()=>_,ListenError:()=>K,MuxerClosedError:()=>h,NotFoundError:()=>I,NotImplementedError:()=>R,NotStartedError:()=>M,ProtocolError:()=>C,StreamAbortEvent:()=>V,StreamAbortedError:()=>y,StreamBufferError:()=>S,StreamCloseEvent:()=>n,StreamMessageEvent:()=>q,StreamResetError:()=>b,StreamResetEvent:()=>j,StreamStateError:()=>v,TimeoutError:()=>D,TooManyInboundProtocolStreamsError:()=>B,TooManyOutboundProtocolStreamsError:()=>F,TypedEventEmitter:()=>H,UnexpectedPeerError:()=>c,UnsupportedKeyTypeError:()=>O,UnsupportedOperationError:()=>x,UnsupportedProtocolError:()=>w,connectionSymbol:()=>J,contentRoutingSymbol:()=>nr,isConnection:()=>sr,isPeerId:()=>cr,isPrivateKey:()=>ar,isPublicKey:()=>Q,isStartable:()=>z,isTransport:()=>xr,peerDiscoverySymbol:()=>ir,peerIdSymbol:()=>W,peerRoutingSymbol:()=>pr,serviceCapabilities:()=>dr,serviceDependencies:()=>fr,setMaxListeners:()=>Y,start:()=>ur,stop:()=>mr,transportSymbol:()=>X});var J=Symbol.for("@libp2p/connection");function sr(t){return t!=null&&!!t[J]}var nr=Symbol.for("@libp2p/content-routing");var i=class extends Error{static name="AbortError";constructor(r="The operation was aborted"){super(r),this.name="AbortError"}},c=class extends Error{static name="UnexpectedPeerError";constructor(r="Unexpected Peer"){super(r),this.name="UnexpectedPeerError"}},p=class extends Error{static name="InvalidCryptoExchangeError";constructor(r="Invalid crypto exchange"){super(r),this.name="InvalidCryptoExchangeError"}},l=class extends Error{static name="InvalidParametersError";constructor(r="Invalid parameters"){super(r),this.name="InvalidParametersError"}},u=class extends Error{static name="InvalidPublicKeyError";constructor(r="Invalid public key"){super(r),this.name="InvalidPublicKeyError"}},m=class extends Error{static name="InvalidPrivateKeyError";constructor(r="Invalid private key"){super(r),this.name="InvalidPrivateKeyError"}},x=class extends Error{static name="UnsupportedOperationError";constructor(r="Unsupported operation"){super(r),this.name="UnsupportedOperationError"}},d=class extends Error{static name="ConnectionClosingError";constructor(r="The connection is closing"){super(r),this.name="ConnectionClosingError"}},f=class extends Error{static name="ConnectionClosedError";constructor(r="The connection is closed"){super(r),this.name="ConnectionClosedError"}},E=class extends Error{static name="ConnectionFailedError";constructor(r="Connection failed"){super(r),this.name="ConnectionFailedError"}},h=class extends Error{static name="MuxerClosedError";constructor(r="The muxer is closed"){super(r),this.name="MuxerClosedError"}},b=class extends Error{static name="StreamResetError";constructor(r="The stream has been reset"){super(r),this.name="StreamResetError"}},y=class extends Error{static name="StreamAbortedError";constructor(r="The stream has been aborted"){super(r),this.name="StreamAbortedError"}},v=class extends Error{static name="StreamStateError";constructor(r="The stream is in an invalid state"){super(r),this.name="StreamStateError"}},S=class extends Error{static name="StreamBufferError";constructor(r="The stream buffer was full"){super(r),this.name="StreamBufferError"}},I=class extends Error{static name="NotFoundError";constructor(r="Not found"){super(r),this.name="NotFoundError"}},P=class extends Error{static name="InvalidPeerIdError";constructor(r="Invalid PeerID"){super(r),this.name="InvalidPeerIdError"}},A=class extends Error{static name="InvalidMultiaddrError";constructor(r="Invalid multiaddr"){super(r),this.name="InvalidMultiaddrError"}},L=class extends Error{static name="InvalidCIDError";constructor(r="Invalid CID"){super(r),this.name="InvalidCIDError"}},g=class extends Error{static name="InvalidMultihashError";constructor(r="Invalid Multihash"){super(r),this.name="InvalidMultihashError"}},w=class extends Error{static name="UnsupportedProtocolError";constructor(r="Unsupported protocol error"){super(r),this.name="UnsupportedProtocolError"}},T=class extends Error{static name="InvalidMessageError";constructor(r="Invalid message"){super(r),this.name="InvalidMessageError"}},C=class extends Error{static name="ProtocolError";constructor(r="Protocol error"){super(r),this.name="ProtocolError"}},D=class extends Error{static name="TimeoutError";constructor(r="Timed out"){super(r),this.name="TimeoutError"}},M=class extends Error{static name="NotStartedError";constructor(r="Not started"){super(r),this.name="NotStartedError"}},U=class extends Error{static name="AlreadyStartedError";constructor(r="Already started"){super(r),this.name="AlreadyStartedError"}},N=class extends Error{static name="DialError";constructor(r="Dial error"){super(r),this.name="DialError"}},K=class extends Error{static name="ListenError";constructor(r="Listen error"){super(r),this.name="ListenError"}},_=class extends Error{static name="LimitedConnectionError";constructor(r="Limited connection"){super(r),this.name="LimitedConnectionError"}},B=class extends Error{static name="TooManyInboundProtocolStreamsError";constructor(r="Too many inbound protocol streams"){super(r),this.name="TooManyInboundProtocolStreamsError"}},F=class extends Error{static name="TooManyOutboundProtocolStreamsError";constructor(r="Too many outbound protocol streams"){super(r),this.name="TooManyOutboundProtocolStreamsError"}},O=class extends Error{static name="UnsupportedKeyTypeError";constructor(r="Unsupported key type"){super(r),this.name="UnsupportedKeyTypeError"}},R=class extends Error{static name="NotImplementedError";constructor(r="Not implemented"){super(r),this.name="NotImplementedError"}};var q=class extends Event{data;constructor(r,e){super("message",e),this.data=r}},n=class extends Event{error;local;constructor(r,e,s){super("close",s),this.error=e,this.local=r}},V=class extends n{constructor(r,e){super(!0,r,e)}},j=class extends n{constructor(r,e){super(!1,r,e)}};function Q(t){return t==null?!1:(t.type==="RSA"||t.type==="Ed25519"||t.type==="secp256k1"||t.type==="ECDSA")&&t.raw instanceof Uint8Array&&typeof t.equals=="function"&&typeof t.toMultihash=="function"&&typeof t.toCID=="function"&&typeof t.verify=="function"}function ar(t){return t==null?!1:(t.type==="RSA"||t.type==="Ed25519"||t.type==="secp256k1"||t.type==="ECDSA")&&Q(t.publicKey)&&t.raw instanceof Uint8Array&&typeof t.equals=="function"&&typeof t.sign=="function"}var ir=Symbol.for("@libp2p/peer-discovery");var W=Symbol.for("@libp2p/peer-id");function cr(t){return!!t?.[W]}var pr=Symbol.for("@libp2p/peer-routing");var lr="keep-alive";function z(t){return t!=null&&typeof t.start=="function"&&typeof t.stop=="function"}async function ur(...t){let r=[];for(let e of t)z(e)&&r.push(e);await Promise.all(r.map(async e=>{e.beforeStart!=null&&await e.beforeStart()})),await Promise.all(r.map(async e=>{await e.start()})),await Promise.all(r.map(async e=>{e.afterStart!=null&&await e.afterStart()}))}async function mr(...t){let r=[];for(let e of t)z(e)&&r.push(e);await Promise.all(r.map(async e=>{e.beforeStop!=null&&await e.beforeStop()})),await Promise.all(r.map(async e=>{await e.stop()})),await Promise.all(r.map(async e=>{e.afterStop!=null&&await e.afterStop()}))}var X=Symbol.for("@libp2p/transport");function xr(t){return t!=null&&!!t[X]}var G;(function(t){t[t.FATAL_ALL=0]="FATAL_ALL",t[t.NO_FATAL=1]="NO_FATAL"})(G||(G={}));function Y(){}var H=class extends EventTarget{#r=new Map;constructor(){super()}listenerCount(r){let e=this.#r.get(r);return e==null?0:e.length}addEventListener(r,e,s){super.addEventListener(r,e,s);let o=this.#r.get(r);o==null&&(o=[],this.#r.set(r,o)),o.push({callback:e,once:(s!==!0&&s!==!1&&s?.once)??!1})}removeEventListener(r,e,s){super.removeEventListener(r.toString(),e??null,s);let o=this.#r.get(r);o!=null&&(o=o.filter(({callback:Z})=>Z!==e),this.#r.set(r,o))}dispatchEvent(r){let e=super.dispatchEvent(r),s=this.#r.get(r.type);return s==null||(s=s.filter(({once:o})=>!o),this.#r.set(r.type,s)),e}safeDispatchEvent(r,e={}){return this.dispatchEvent(new CustomEvent(r,e))}};var dr=Symbol.for("@libp2p/service-capabilities"),fr=Symbol.for("@libp2p/service-dependencies");return or(Er);})(); | ||
| return Libp2PInterface})); | ||
| //# sourceMappingURL=index.min.js.map |
@@ -1,6 +0,2 @@ | ||
| import type { MultiaddrConnection } from './connection.js'; | ||
| import type { AbortOptions, Logger, StreamMuxerFactory } from './index.js'; | ||
| import type { PeerId } from './peer-id.js'; | ||
| import type { Duplex } from 'it-stream-types'; | ||
| import type { Uint8ArrayList } from 'uint8arraylist'; | ||
| import type { AbortOptions, StreamMuxerFactory, PeerId, MessageStream } from './index.js'; | ||
| /** | ||
@@ -12,2 +8,5 @@ * If the remote PeerId is known and passed as an option, the securing operation | ||
| export interface SecureConnectionOptions extends AbortOptions { | ||
| /** | ||
| * This will be set if the remote peer is known in advance | ||
| */ | ||
| remotePeer?: PeerId; | ||
@@ -23,8 +22,2 @@ /** | ||
| /** | ||
| * A stream with an optional logger | ||
| */ | ||
| export interface SecurableStream extends Duplex<AsyncGenerator<Uint8Array | Uint8ArrayList>> { | ||
| log?: Logger; | ||
| } | ||
| /** | ||
| * A libp2p connection encrypter module must be compliant to this interface | ||
@@ -40,3 +33,3 @@ * to ensure all exchanged data between two peers is encrypted. | ||
| */ | ||
| secureOutbound<Stream extends SecurableStream = MultiaddrConnection>(connection: Stream, options?: SecureConnectionOptions): Promise<SecuredConnection<Stream, Extension>>; | ||
| secureOutbound(connection: MessageStream, options?: SecureConnectionOptions): Promise<SecuredConnection<Extension>>; | ||
| /** | ||
@@ -47,7 +40,16 @@ * Decrypt incoming data. If the remote PeerId is known, | ||
| */ | ||
| secureInbound<Stream extends SecurableStream = MultiaddrConnection>(connection: Stream, options?: SecureConnectionOptions): Promise<SecuredConnection<Stream, Extension>>; | ||
| secureInbound(connection: MessageStream, options?: SecureConnectionOptions): Promise<SecuredConnection<Extension>>; | ||
| } | ||
| export interface SecuredConnection<Stream = any, Extension = unknown> { | ||
| conn: Stream; | ||
| export interface SecuredConnection<Extension = unknown> { | ||
| /** | ||
| * The decrypted data stream | ||
| */ | ||
| connection: MessageStream; | ||
| /** | ||
| * Any extension data transferred as part of the encryption handshake | ||
| */ | ||
| remoteExtensions?: Extension; | ||
| /** | ||
| * The identifier of the remote peer | ||
| */ | ||
| remotePeer: PeerId; | ||
@@ -54,0 +56,0 @@ /** |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"connection-encrypter.d.ts","sourceRoot":"","sources":["../../src/connection-encrypter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAC1E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAC1C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iB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AAE,MAAM,YAAY,CAAA;AAEzF;;;;GAIG;AACH,MAAM,WAAW,uBAAwB,SAAQ,YAAY;IAC3D;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;IAEnB;;;;;OAKG;IACH,0BAA0B,CAAC,EAAE,OAAO,CAAA;CACrC;AAED;;;GAGG;AACH,MAAM,WAAW,mBAAmB,CAAC,SAAS,GAAG,OAAO;IACtD,QAAQ,EAAE,MAAM,CAAA;IAEhB;;;;OAIG;IACH,cAAc,CAAE,UAAU,EAAE,aAAa,EAAE,OAAO,CAAC,EAAE,uBAAuB,GAAG,OAAO,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC,CAAA;IAEpH;;;;OAIG;IACH,aAAa,CAAE,UAAU,EAAE,aAAa,EAAE,OAAO,CAAC,EAAE,uBAAuB,GAAG,OAAO,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC,CAAA;CACpH;AAED,MAAM,WAAW,iBAAiB,CAAC,SAAS,GAAG,OAAO;IACpD;;OAEG;IACH,UAAU,EAAE,aAAa,CAAA;IAEzB;;OAEG;IACH,gBAAgB,CAAC,EAAE,SAAS,CAAA;IAE5B;;OAEG;IACH,UAAU,EAAE,MAAM,CAAA;IAElB;;;;OAIG;IACH,WAAW,CAAC,EAAE,kBAAkB,CAAA;CACjC"} |
@@ -1,3 +0,2 @@ | ||
| import type { MultiaddrConnection } from './connection.js'; | ||
| import type { PeerId } from './peer-id.js'; | ||
| import type { MultiaddrConnection, PeerId } from './index.js'; | ||
| import type { Multiaddr } from '@multiformats/multiaddr'; | ||
@@ -4,0 +3,0 @@ export interface ConnectionGater { |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"connection-gater.d.ts","sourceRoot":"","sources":["../../src/connection-gater.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAC1D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAC1C,OAAO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;IAExG;;;;;;;;;OASG;IACH,+BAA+B,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAA;IAEzG;;;;;;;OAOG;IACH,6BAA6B,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAA;IAEvG;;;;;;;OAOG;IACH,8BAA8B,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAA;IAExG;;;;;OAKG;IACH,2BAA2B,CAAC,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAA;IAExE;;;;;;;;OAQG;IACH,6BAA6B,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAA;IAE/F;;;;;;;;OAQG;IACH,4BAA4B,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAA;IAE5F;;;;OAIG;IACH,sBAAsB,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAA;CACxF"} |
+36
-233
@@ -1,151 +0,24 @@ | ||
| import type { AbortOptions, Logger } from './index.js'; | ||
| import type { PeerId } from './peer-id.js'; | ||
| import type { AbortOptions, Logger, TypedEventTarget, Stream, MessageStreamEvents, PeerId, MultiaddrConnectionTimeline, MessageStreamStatus, MessageStreamDirection } from './index.js'; | ||
| import type { Multiaddr } from '@multiformats/multiaddr'; | ||
| import type { Duplex, Source } from 'it-stream-types'; | ||
| import type { Uint8ArrayList } from 'uint8arraylist'; | ||
| export interface ConnectionTimeline { | ||
| /** | ||
| * When the connection was opened | ||
| */ | ||
| open: number; | ||
| /** | ||
| * When the MultiaddrConnection was upgraded to a Connection - e.g. the type | ||
| * of connection encryption and multiplexing was negotiated. | ||
| */ | ||
| upgraded?: number; | ||
| /** | ||
| * When the connection was closed. | ||
| */ | ||
| close?: number; | ||
| } | ||
| export type ConnectionStatus = MessageStreamStatus; | ||
| /** | ||
| * Outbound connections are opened by the local node, inbound streams are opened by the remote | ||
| */ | ||
| export type Direction = 'inbound' | 'outbound'; | ||
| export interface StreamTimeline { | ||
| /** | ||
| * A timestamp of when the stream was opened | ||
| */ | ||
| open: number; | ||
| /** | ||
| * A timestamp of when the stream was closed for both reading and writing | ||
| */ | ||
| close?: number; | ||
| /** | ||
| * A timestamp of when the stream was closed for reading | ||
| */ | ||
| closeRead?: number; | ||
| /** | ||
| * A timestamp of when the stream was closed for writing | ||
| */ | ||
| closeWrite?: number; | ||
| /** | ||
| * A timestamp of when the stream was reset | ||
| */ | ||
| reset?: number; | ||
| /** | ||
| * A timestamp of when the stream was aborted | ||
| */ | ||
| abort?: number; | ||
| } | ||
| /** | ||
| * The states a stream can be in | ||
| */ | ||
| export type StreamStatus = 'open' | 'closing' | 'closed' | 'aborted' | 'reset'; | ||
| /** | ||
| * The states the readable end of a stream can be in | ||
| * Connection limits are present on connections that are only allowed to | ||
| * transfer a certain amount of bytes or be open for a certain number | ||
| * of seconds. | ||
| * | ||
| * ready - the readable end is ready for reading | ||
| * closing - the readable end is closing | ||
| * closed - the readable end has closed | ||
| * These limits are applied by Circuit Relay v2 servers, for example and | ||
| * the connection will normally be closed abruptly if the limits are | ||
| * exceeded. | ||
| */ | ||
| export type ReadStatus = 'ready' | 'closing' | 'closed'; | ||
| /** | ||
| * The states the writable end of a stream can be in | ||
| * | ||
| * ready - the writable end is ready for writing | ||
| * writing - the writable end is in the process of being written to | ||
| * done - the source passed to the `.sink` function yielded all values without error | ||
| * closing - the writable end is closing | ||
| * closed - the writable end has closed | ||
| */ | ||
| export type WriteStatus = 'ready' | 'writing' | 'done' | 'closing' | 'closed'; | ||
| /** | ||
| * A Stream is a data channel between two peers that | ||
| * can be written to and read from at both ends. | ||
| * | ||
| * It may be encrypted and multiplexed depending on the | ||
| * configuration of the nodes. | ||
| */ | ||
| export interface Stream extends Duplex<AsyncGenerator<Uint8ArrayList>, Source<Uint8ArrayList | Uint8Array>, Promise<void>> { | ||
| export interface ConnectionLimits { | ||
| /** | ||
| * Closes the stream for **reading** *and* **writing**. | ||
| * | ||
| * Any buffered data in the source can still be consumed and the stream will end normally. | ||
| * | ||
| * This will cause a `CLOSE` message to be sent to the remote, *unless* the sink has already ended. | ||
| * | ||
| * The sink and the source will return normally. | ||
| * If present this is the number of bytes remaining that may be | ||
| * transferred over this connection | ||
| */ | ||
| close(options?: AbortOptions): Promise<void>; | ||
| bytes?: bigint; | ||
| /** | ||
| * Closes the stream for **reading**. If iterating over the source of this stream in a `for await of` loop, it will return (exit the loop) after any buffered data has been consumed. | ||
| * | ||
| * This function is called automatically by the muxer when it receives a `CLOSE` message from the remote. | ||
| * | ||
| * The source will return normally, the sink will continue to consume. | ||
| * If present this is the number of seconds that this connection will | ||
| * remain open for | ||
| */ | ||
| closeRead(options?: AbortOptions): Promise<void>; | ||
| /** | ||
| * Closes the stream for **writing**. If iterating over the source of this stream in a `for await of` loop, it will return (exit the loop) after any buffered data has been consumed. | ||
| * | ||
| * The source will return normally, the sink will continue to consume. | ||
| */ | ||
| closeWrite(options?: AbortOptions): Promise<void>; | ||
| /** | ||
| * Closes the stream for **reading** *and* **writing**. This should be called when a *local error* has occurred. | ||
| * | ||
| * Note, if called without an error any buffered data in the source can still be consumed and the stream will end normally. | ||
| * | ||
| * This will cause a `RESET` message to be sent to the remote, *unless* the sink has already ended. | ||
| * | ||
| * The sink will return and the source will throw. | ||
| */ | ||
| abort(err: Error): void; | ||
| /** | ||
| * Unique identifier for a stream. Identifiers are not unique across muxers. | ||
| */ | ||
| id: string; | ||
| /** | ||
| * Outbound streams are opened by the local node, inbound streams are opened by the remote | ||
| */ | ||
| direction: Direction; | ||
| /** | ||
| * Lifecycle times for the stream | ||
| */ | ||
| timeline: StreamTimeline; | ||
| /** | ||
| * The protocol negotiated for this stream | ||
| */ | ||
| protocol?: string; | ||
| /** | ||
| * User defined stream metadata | ||
| */ | ||
| metadata: Record<string, any>; | ||
| /** | ||
| * The current status of the stream | ||
| */ | ||
| status: StreamStatus; | ||
| /** | ||
| * The current status of the readable end of the stream | ||
| */ | ||
| readStatus: ReadStatus; | ||
| /** | ||
| * The current status of the writable end of the stream | ||
| */ | ||
| writeStatus: WriteStatus; | ||
| /** | ||
| * The stream logger | ||
| */ | ||
| log: Logger; | ||
| seconds?: number; | ||
| } | ||
@@ -161,6 +34,7 @@ export interface NewStreamOptions extends AbortOptions { | ||
| * Opt-in to running over a limited connection - one that has restrictions | ||
| * on the amount of data that may be transferred or how long it may be open for. | ||
| * on the amount of data that may be transferred or how long it may be open | ||
| * for. | ||
| * | ||
| * These limits are typically enforced by a relay server, if the protocol | ||
| * will be transferring a lot of data or the stream will be open for a long time | ||
| * These limits are typically enforced by a relay server, if the protocol will | ||
| * be transferring a lot of data or the stream will be open for a long time | ||
| * consider upgrading to a direct connection before opening the stream. | ||
@@ -198,25 +72,3 @@ * | ||
| } | ||
| export type ConnectionStatus = 'open' | 'closing' | 'closed'; | ||
| /** | ||
| * Connection limits are present on connections that are only allowed to | ||
| * transfer a certain amount of bytes or be open for a certain number | ||
| * of seconds. | ||
| * | ||
| * These limits are applied by Circuit Relay v2 servers, for example and | ||
| * the connection will normally be closed abruptly if the limits are | ||
| * exceeded. | ||
| */ | ||
| export interface ConnectionLimits { | ||
| /** | ||
| * If present this is the number of bytes remaining that may be | ||
| * transferred over this connection | ||
| */ | ||
| bytes?: bigint; | ||
| /** | ||
| * If present this is the number of seconds that this connection will | ||
| * remain open for | ||
| */ | ||
| seconds?: number; | ||
| } | ||
| /** | ||
| * A Connection is a high-level representation of a connection | ||
@@ -227,3 +79,3 @@ * to a remote peer that may have been secured by encryption and | ||
| */ | ||
| export interface Connection { | ||
| export interface Connection extends TypedEventTarget<Omit<MessageStreamEvents, 'drain' | 'message'>> { | ||
| /** | ||
@@ -242,6 +94,2 @@ * The unique identifier for this connection | ||
| /** | ||
| * A list of tags applied to this connection | ||
| */ | ||
| tags: string[]; | ||
| /** | ||
| * A list of open streams on this connection | ||
@@ -253,7 +101,7 @@ */ | ||
| */ | ||
| direction: Direction; | ||
| direction: MessageStreamDirection; | ||
| /** | ||
| * Lifecycle times for the connection | ||
| * When stream life cycle events occurred | ||
| */ | ||
| timeline: ConnectionTimeline; | ||
| timeline: MultiaddrConnectionTimeline; | ||
| /** | ||
@@ -272,2 +120,6 @@ * The multiplexer negotiated for this connection | ||
| /** | ||
| * Whether this connection is direct or, for example, is via a relay | ||
| */ | ||
| direct: boolean; | ||
| /** | ||
| * If present, this connection has limits applied to it, perhaps by an | ||
@@ -285,2 +137,6 @@ * intermediate relay. Once the limits have been reached the connection will | ||
| /** | ||
| * The connection logger, used to log connection-specific information | ||
| */ | ||
| log: Logger; | ||
| /** | ||
| * Create a new stream on this connection and negotiate one of the passed protocols | ||
@@ -290,68 +146,15 @@ */ | ||
| /** | ||
| * Gracefully close the connection. All queued data will be written to the | ||
| * underlying transport. | ||
| * Gracefully close the connection. The returned promise will resolve when all | ||
| * queued data has been written to the underlying transport. Any unread data | ||
| * will still be emitted as a 'message' event. | ||
| */ | ||
| close(options?: AbortOptions): Promise<void>; | ||
| /** | ||
| * Immediately close the connection, any queued data will be discarded | ||
| * Immediately close the connection. Any data queued to be sent or read will | ||
| * be discarded. | ||
| */ | ||
| abort(err: Error): void; | ||
| /** | ||
| * The connection logger | ||
| */ | ||
| log: Logger; | ||
| } | ||
| export declare const connectionSymbol: unique symbol; | ||
| export declare function isConnection(other: any): other is Connection; | ||
| export interface ConnectionProtector { | ||
| /** | ||
| * Takes a given Connection and creates a private encryption stream | ||
| * between its two peers from the PSK the Protector instance was | ||
| * created with. | ||
| */ | ||
| protect(connection: MultiaddrConnection, options?: AbortOptions): Promise<MultiaddrConnection>; | ||
| } | ||
| export interface MultiaddrConnectionTimeline { | ||
| /** | ||
| * When the connection was opened | ||
| */ | ||
| open: number; | ||
| /** | ||
| * When the MultiaddrConnection was upgraded to a Connection - the type of | ||
| * connection encryption and multiplexing was negotiated. | ||
| */ | ||
| upgraded?: number; | ||
| /** | ||
| * When the connection was closed. | ||
| */ | ||
| close?: number; | ||
| } | ||
| /** | ||
| * A MultiaddrConnection is returned by transports after dialing | ||
| * a peer. It is a low-level primitive and is the raw connection | ||
| * without encryption or stream multiplexing. | ||
| */ | ||
| export interface MultiaddrConnection extends Duplex<AsyncGenerator<Uint8Array | Uint8ArrayList>> { | ||
| /** | ||
| * Gracefully close the connection. All queued data will be written to the | ||
| * underlying transport. | ||
| */ | ||
| close(options?: AbortOptions): Promise<void>; | ||
| /** | ||
| * Immediately close the connection, any queued data will be discarded | ||
| */ | ||
| abort(err: Error): void; | ||
| /** | ||
| * The address of the remote end of the connection | ||
| */ | ||
| remoteAddr: Multiaddr; | ||
| /** | ||
| * When connection life cycle events occurred | ||
| */ | ||
| timeline: MultiaddrConnectionTimeline; | ||
| /** | ||
| * The multiaddr connection logger | ||
| */ | ||
| log: Logger; | ||
| } | ||
| //# sourceMappingURL=connection.d.ts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../../src/connection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AACtD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAC1C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AACxD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AACrD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,g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AAI,IAAI,IAAI,OAAO,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC,CAAA;AAC1D,CAAC"} | ||
| {"version":3,"file":"connection.js","sourceRoot":"","sources":["../../src/connection.ts"],"names":[],"mappings":"AA4KA,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAA;AAEhE,MAAM,UAAU,YAAY,CAAE,KAAU;IACtC,OAAO,KAAK,IAAI,IAAI,IAAI,OAAO,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC,CAAA;AAC1D,CAAC"} |
+14
-0
@@ -88,2 +88,9 @@ /** | ||
| /** | ||
| * Thrown when a protocol stream is aborted locally | ||
| */ | ||
| export declare class StreamAbortedError extends Error { | ||
| static name: string; | ||
| constructor(message?: string); | ||
| } | ||
| /** | ||
| * Thrown when a stream is in an invalid state | ||
@@ -96,2 +103,9 @@ */ | ||
| /** | ||
| * Thrown when a stream buffer is full | ||
| */ | ||
| export declare class StreamBufferError extends Error { | ||
| static name: string; | ||
| constructor(message?: string); | ||
| } | ||
| /** | ||
| * Thrown when a value could not be found | ||
@@ -98,0 +112,0 @@ */ |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,qBAAa,UAAW,SAAQ,KAAK;IACnC,MAAM,CAAC,IAAI,SAAe;gBAEb,OAAO,GAAE,MAAoC;CAI3D;AAED;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,KAAK;IAC5C,MAAM,CAAC,IAAI,SAAwB;gBAEtB,OAAO,SAAoB;CAIzC;AAED;;GAEG;AACH,qBAAa,0BAA2B,SAAQ,KAAK;IACnD,MAAM,CAAC,IAAI,SAA+B;gBAE7B,OAAO,SAA4B;CAIjD;AAED;;GAEG;AACH,qBAAa,sBAAuB,SAAQ,KAAK;IAC/C,MAAM,CAAC,IAAI,SAA2B;gBAEzB,OAAO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AAI,SAAwC;gBAEtC,OAAO,SAAuC;CAI5D;AAED;;GAEG;AACH,qBAAa,uBAAwB,SAAQ,KAAK;IAChD,MAAM,CAAC,IAAI,SAA4B;gBAE1B,OAAO,SAAyB;CAI9C;AAED;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,KAAK;IAC5C,MAAM,CAAC,IAAI,SAAwB;gBAEtB,OAAO,SAAoB;CAIzC"} |
+20
-0
@@ -124,2 +124,12 @@ /** | ||
| /** | ||
| * Thrown when a protocol stream is aborted locally | ||
| */ | ||
| export class StreamAbortedError extends Error { | ||
| static name = 'StreamAbortedError'; | ||
| constructor(message = 'The stream has been aborted') { | ||
| super(message); | ||
| this.name = 'StreamAbortedError'; | ||
| } | ||
| } | ||
| /** | ||
| * Thrown when a stream is in an invalid state | ||
@@ -135,2 +145,12 @@ */ | ||
| /** | ||
| * Thrown when a stream buffer is full | ||
| */ | ||
| export class StreamBufferError extends Error { | ||
| static name = 'StreamBufferError'; | ||
| constructor(message = 'The stream buffer was full') { | ||
| super(message); | ||
| this.name = 'StreamBufferError'; | ||
| } | ||
| } | ||
| /** | ||
| * Thrown when a value could not be found | ||
@@ -137,0 +157,0 @@ */ |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,OAAO,UAAW,SAAQ,KAAK;IACnC,MAAM,CAAC,IAAI,GAAG,YAAY,CAAA;IAE1B,YAAa,UAAkB,2BAA2B;QACxD,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,YAAY,CAAA;IAC1B,CAAC;;AAGH;;GAEG;AACH,MAAM,OAAO,mBAAoB,SAAQ,KAAK;IAC5C,MAAM,CAAC,IAAI,GAAG,qBAAqB,CAAA;IAEnC,YAAa,OAAO,GAAG,iBAAiB;QACtC,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG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C,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,yBAAyB,CAAA;IACvC,CAAC;;AAGH;;GAEG;AACH,MAAM,OAAO,mBAAoB,SAAQ,KAAK;IAC5C,MAAM,CAAC,IAAI,GAAG,qBAAqB,CAAA;IAEnC,YAAa,OAAO,GAAG,iBAAiB;QACtC,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAA;IACnC,CAAC"} |
+35
-5
@@ -16,3 +16,3 @@ /** | ||
| */ | ||
| import type { Connection, NewStreamOptions, Stream } from './connection.js'; | ||
| import type { Connection, NewStreamOptions } from './connection.js'; | ||
| import type { ContentRouting } from './content-routing.js'; | ||
@@ -26,3 +26,4 @@ import type { Ed25519PublicKey, PublicKey, RSAPublicKey, Secp256k1PublicKey } from './keys.js'; | ||
| import type { Startable } from './startable.js'; | ||
| import type { StreamHandler, StreamHandlerOptions } from './stream-handler.js'; | ||
| import type { StreamHandler, StreamHandlerOptions, StreamMiddleware } from './stream-handler.js'; | ||
| import type { Stream } from './stream.js'; | ||
| import type { Topology } from './topology.js'; | ||
@@ -705,2 +706,27 @@ import type { Listener, OutboundConnectionUpgradeEvents } from './transport.js'; | ||
| /** | ||
| * Registers one or more middleware implementations that will be invoked for | ||
| * incoming and outgoing protocol streams that match the passed protocol. | ||
| * | ||
| * @example | ||
| * | ||
| * ```TypeScript | ||
| * libp2p.use('/my/protocol/1.0.0', (stream, connection, next) => { | ||
| * // do something with stream and/or connection | ||
| * next(stream, connection) | ||
| * }) | ||
| * ``` | ||
| */ | ||
| use(protocol: string, middleware: StreamMiddleware | StreamMiddleware[]): void; | ||
| /** | ||
| * Deregisters all middleware for the passed protocol. | ||
| * | ||
| * @example | ||
| * | ||
| * ```TypeScript | ||
| * libp2p.unuse('/my/protocol/1.0.0') | ||
| * // any previously registered middleware will no longer be invoked | ||
| * ``` | ||
| */ | ||
| unuse(protocol: string): void; | ||
| /** | ||
| * Returns the public key for the passed PeerId. If the PeerId is of the 'RSA' | ||
@@ -826,5 +852,10 @@ * type this may mean searching the routing if the peer's key is not present | ||
| export * from './connection-gater.js'; | ||
| export * from './connection-protector.js'; | ||
| export * from './content-routing.js'; | ||
| export * from './errors.js'; | ||
| export * from './events.js'; | ||
| export * from './keys.js'; | ||
| export * from './message-stream.js'; | ||
| export * from './metrics.js'; | ||
| export * from './multiaddr-connection.js'; | ||
| export * from './peer-discovery.js'; | ||
@@ -835,11 +866,10 @@ export * from './peer-id.js'; | ||
| export * from './peer-store.js'; | ||
| export * from './pubsub.js'; | ||
| export * from './record.js'; | ||
| export * from './startable.js'; | ||
| export * from './stream-handler.js'; | ||
| export * from './stream-muxer.js'; | ||
| export * from './stream.js'; | ||
| export * from './topology.js'; | ||
| export * from './transport.js'; | ||
| export * from './errors.js'; | ||
| export * from 'main-event'; | ||
| export * from './startable.js'; | ||
| //# sourceMappingURL=index.d.ts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AAC3E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,KAAK,EAAE,gBAAgB,EAAE,SAAS,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAA;AAC9F,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAC3C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,EAAE,SAAS,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAChG,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAC9C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AACpD,OAAO,KAAK,EAAE,OAAO,EAAE,IA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;AAE9B,cAAc,YAAY,CAAA"} |
@@ -35,5 +35,10 @@ /** | ||
| export * from './connection-gater.js'; | ||
| export * from './connection-protector.js'; | ||
| export * from './content-routing.js'; | ||
| export * from './errors.js'; | ||
| export * from './events.js'; | ||
| export * from './keys.js'; | ||
| export * from './message-stream.js'; | ||
| export * from './metrics.js'; | ||
| export * from './multiaddr-connection.js'; | ||
| export * from './peer-discovery.js'; | ||
@@ -44,11 +49,10 @@ export * from './peer-id.js'; | ||
| export * from './peer-store.js'; | ||
| export * from './pubsub.js'; | ||
| export * from './record.js'; | ||
| export * from './startable.js'; | ||
| export * from './stream-handler.js'; | ||
| export * from './stream-muxer.js'; | ||
| export * from './stream.js'; | ||
| export * from './topology.js'; | ||
| export * from './transport.js'; | ||
| export * from './errors.js'; | ||
| export * from 'main-event'; | ||
| export * from './startable.js'; | ||
| //# sourceMappingURL=index.js.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAk3BH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAC,GAAG,CAAC,8BAA8B,CAAC,CAAA;AAE7E;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAC,GAAG,CAAC,8BAA8B,CAAC,CAAA;AAE7E,cAAc,iBAAiB,CAAA;AAC/B,cAAc,2BAA2B,CAAA;AACzC,cAAc,uBAAuB,CAAA;AACrC,cAAc,sBAAsB,CAAA;AACpC,cAAc,WAAW,CAAA;AACzB,cAAc,cAAc,CAAA;AAC5B,cAAc,qBAAqB,CAAA;AACnC,cAAc,cAAc,CAAA;AAC5B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,mBAAmB,CAAA;AACjC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,qBAAqB,CAAA;AACnC,cAAc,mBAAmB,CAAA;AACjC,cAAc,eAAe,CAAA;AAC7B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,gBAAgB,CAAA"} | ||
| {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AA84BH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAC,GAAG,CAAC,8BAA8B,CAAC,CAAA;AAE7E;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAC,GAAG,CAAC,8BAA8B,CAAC,CAAA;AAE7E,cAAc,iBAAiB,CAAA;AAC/B,cAAc,2BAA2B,CAAA;AACzC,cAAc,uBAAuB,CAAA;AACrC,cAAc,2BAA2B,CAAA;AACzC,cAAc,sBAAsB,CAAA;AACpC,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,WAAW,CAAA;AACzB,cAAc,qBAAqB,CAAA;AACnC,cAAc,cAAc,CAAA;AAC5B,cAAc,2BAA2B,CAAA;AACzC,cAAc,qBAAqB,CAAA;AACnC,cAAc,cAAc,CAAA;AAC5B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,mBAAmB,CAAA;AACjC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,qBAAqB,CAAA;AACnC,cAAc,mBAAmB,CAAA;AACjC,cAAc,aAAa,CAAA;AAC3B,cAAc,eAAe,CAAA;AAC7B,cAAc,gBAAgB,CAAA;AAE9B,cAAc,YAAY,CAAA"} |
@@ -1,2 +0,2 @@ | ||
| import type { MultiaddrConnection, Stream, Connection } from './connection.js'; | ||
| import type { MultiaddrConnection, Stream } from './index.js'; | ||
| /** | ||
@@ -398,3 +398,3 @@ * Create tracked metrics with these options. Loosely based on the | ||
| */ | ||
| trackProtocolStream(stream: Stream, connection: Connection): void; | ||
| trackProtocolStream(stream: Stream): void; | ||
| /** | ||
@@ -401,0 +401,0 @@ * Register an arbitrary metric. Call this to set help/labels for metrics |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"metrics.d.ts","sourceRoot":"","sources":["../../src/metrics.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAE9E;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IAEd;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAED;;;GAGG;AACH,MAAM,MAAM,eAAe,CAAC,CAAC,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,MAAM,OAAO,CAAC,CAAC,CAAC,CAAC,CAAA;AAExE;;;GAGG;AACH,MAAM,WAAW,uBAAuB,CAAC,CAAC,GAAG,MAAM,CAAE,SAAQ,aAAa;IACxE;;;OAGG;IACH,SAAS,EAAE,eAAe,CAAC,CAAC,CAAC,CAAA;CAC9B;AAED;;;GAGG;AACH,MAAM,WAAW,SAAS;IAAG,IAAI,IAAI,CAAA;CAAE;AAEvC;;;GAGG;AACH,MAAM,WAAW,MAAM;IACrB;;OAEG;IACH,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IAE3B;;OAEG;IACH,SAAS,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAE/B;;OAEG;IACH,SAAS,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAE/B;;OAEG;IACH,KAAK,IAAI,IAAI,CAAA;IAEb;;;OAGG;IACH,KAAK,IAAI,SAAS,CAAA;CACnB;AAED;;;GAGG;AACH,MAAM,WAAW,WAAW,CAAC,CAAC,SAAS,MAAM,GAAG,GA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G,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,aAAa,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,SAAS,QAAQ,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAA;AAE9J,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,EAAE,GAAG,MAAM,EAAE,GAAG,OAAO,EAAE,CAAC,CAAA;AAEzG,MAAM,WAAW,oBAAoB,CAAC,CAAC,EAAE,CAAC;IACxC;;;;;;;OAOG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;IAErB;;OAEG;IACH,qBAAqB,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,UAAU,EAAE,eAAe,GAAG,eAAe,CAAA;IAE7E;;;;OAIG;IACH,4BAA4B,CAAC,CAAC,KAAK,EAAE,CAAC,EAAE,UAAU,EAAE,eAAe,GAAG,eAAe,CAAA;CACtF;AAED,MAAM,WAAW,6BAA6B,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,GAAG,CAAE,SAAQ,oBAAoB,CAAC,CAAC,EAAE,CAAC,CAAC;IAC9F;;;;OAIG;IACH,6BAA6B,CAAC,CAAE,KAAK,EAAE,CAAC,EAAE,UAAU,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,GAAG,eAAe,CAAA;CACvG"} |
@@ -288,7 +288,3 @@ import type { AbortOptions } from './index.ts'; | ||
| consumePeerRecord(buf: Uint8Array, options?: ConsumePeerRecordOptions): Promise<boolean>; | ||
| /** | ||
| * @deprecated Pass `expectedPeer` as a property of `options` instead | ||
| */ | ||
| consumePeerRecord(buf: Uint8Array, expectedPeer?: PeerId, options?: AbortOptions): Promise<boolean>; | ||
| } | ||
| //# sourceMappingURL=peer-store.d.ts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"peer-store.d.ts","s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O,CAAC,OAAO,CAAC,CAAA;CACzF"} |
@@ -1,13 +0,2 @@ | ||
| import type { Connection, Stream } from './connection.js'; | ||
| import type { AbortOptions } from './index.ts'; | ||
| export interface IncomingStreamData { | ||
| /** | ||
| * The newly opened stream | ||
| */ | ||
| stream: Stream; | ||
| /** | ||
| * The connection the stream was opened on | ||
| */ | ||
| connection: Connection; | ||
| } | ||
| import type { AbortOptions, Connection, Stream } from './index.ts'; | ||
| export interface StreamHandler { | ||
@@ -17,4 +6,10 @@ /** | ||
| */ | ||
| (data: IncomingStreamData): void | Promise<void>; | ||
| (stream: Stream, connection: Connection): void | Promise<void>; | ||
| } | ||
| /** | ||
| * Stream middleware allows accessing stream data outside of the stream handler | ||
| */ | ||
| export interface StreamMiddleware { | ||
| (stream: Stream, connection: Connection, next: (stream: Stream, connection: Connection) => void): void | Promise<void>; | ||
| } | ||
| export interface StreamHandlerOptions extends AbortOptions { | ||
@@ -43,2 +38,6 @@ /** | ||
| force?: true; | ||
| /** | ||
| * Middleware allows accessing stream data outside of the stream handler | ||
| */ | ||
| middleware?: StreamMiddleware[]; | ||
| } | ||
@@ -45,0 +44,0 @@ export interface StreamHandlerRecord { |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"stream-handler.d.ts","sourceRoot":"","sources":["../../src/stream-handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AACzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAE9C,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,MAAM,EAAE,MAAM,CAAA;IAEd;;OAEG;IACH,UAAU,EAAE,UAAU,CAAA;CACvB;AAED,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,CAAC,IAAI,EAAE,kBAAkB,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CACjD;AAED,MAAM,WAAW,oBAAqB,SAAQ,YAAY;I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AAa,CAAA;IAEtB;;OAEG;IACH,OAAO,EAAE,oBAAoB,CAAA;CAC9B"} |
+113
-30
@@ -1,20 +0,86 @@ | ||
| import type { Direction, Stream } from './connection.js'; | ||
| import type { AbortOptions, Logger } from './index.js'; | ||
| import type { Duplex } from 'it-stream-types'; | ||
| import type { Uint8ArrayList } from 'uint8arraylist'; | ||
| export interface StreamMuxerFactory { | ||
| import type { Stream, TypedEventTarget, MessageStream, AbortOptions } from './index.js'; | ||
| /** | ||
| * User-facing message stream muxer options | ||
| */ | ||
| export interface StreamMuxerOptions<MuxedStreamOptions extends StreamOptions = StreamOptions> { | ||
| /** | ||
| * The protocol used to select this muxer during connection opening | ||
| * Configuration options for each outgoing/incoming stream | ||
| */ | ||
| protocol: string; | ||
| streamOptions?: MuxedStreamOptions; | ||
| /** | ||
| * Creates a new stream muxer to be used with a new connection | ||
| * libp2p is notified of incoming streams via the muxer's 'stream' event. | ||
| * | ||
| * During connection establishment there may be a small window where a muxer | ||
| * starts to process incoming stream data before a listener has been added for | ||
| * the 'stream' event. | ||
| * | ||
| * If no handler is registered for this event incoming streams can be missed | ||
| * so when this is the case muxers queue streams internally as "early | ||
| * streams", and will defer emitting the 'stream' event until after a listener | ||
| * has been registered. | ||
| * | ||
| * Allowing an unlimited amount of early streams can cause excessive memory | ||
| * consumption so this setting controls how many early streams to store when | ||
| * no 'stream' listener has been registered. | ||
| * | ||
| * If more streams than this are opened before a listener is added the muxed | ||
| * connection will be reset. | ||
| * | ||
| * @default 10 | ||
| */ | ||
| createStreamMuxer(init?: StreamMuxerInit): StreamMuxer; | ||
| maxEarlyStreams?: number; | ||
| /** | ||
| * Maximum size of a message in bytes that we'll send on a stream - this | ||
| * ensures that a single stream doesn't hog a connection | ||
| * | ||
| * @default 65_536 | ||
| */ | ||
| maxMessageSize?: number; | ||
| /** | ||
| * Maximum number of concurrent inbound streams that we accept - if the peer | ||
| * tries to open more streams, those will be reset immediately | ||
| * | ||
| * @default 1_000 | ||
| */ | ||
| maxInboundStreams?: number; | ||
| /** | ||
| * Maximum number of concurrent outbound streams that we accept - if the | ||
| * application tries to open more streams, the call to `newStream` will throw | ||
| * | ||
| * @default 1_000 | ||
| */ | ||
| maxOutboundStreams?: number; | ||
| } | ||
| /** | ||
| * A libp2p stream muxer | ||
| * User-facing message stream options | ||
| */ | ||
| export interface StreamMuxer extends Duplex<AsyncGenerator<Uint8Array | Uint8ArrayList>> { | ||
| export interface StreamOptions { | ||
| /** | ||
| * If no data is sent or received in this number of ms the stream will be | ||
| * reset and an 'error' event emitted. | ||
| * | ||
| * @default 120_000 | ||
| */ | ||
| inactivityTimeout?: number; | ||
| /** | ||
| * The maximum number of bytes to store when paused or before a 'message' | ||
| * event handler is added. | ||
| * | ||
| * If the internal buffer overflows this value the stream will be reset. | ||
| * | ||
| * @default 4_194_304 | ||
| */ | ||
| maxReadBufferLength?: number; | ||
| /** | ||
| * The maximum number of bytes to store when the remote end of the stream is | ||
| * applying backpressure, or when it is slow to accept new bytes. | ||
| * | ||
| * If the internal buffer overflows this value the stream will be reset. | ||
| * | ||
| * @default Infinity | ||
| */ | ||
| maxWriteBufferLength?: number; | ||
| } | ||
| export interface StreamMuxerFactory<Muxer extends StreamMuxer = StreamMuxer> { | ||
| /** | ||
| * The protocol used to select this muxer during connection opening | ||
@@ -24,37 +90,54 @@ */ | ||
| /** | ||
| * A list of streams that are currently open. Closed streams will not be returned. | ||
| * Creates a new stream muxer to be used with a new connection | ||
| */ | ||
| readonly streams: Stream[]; | ||
| createStreamMuxer(maConn: MessageStream): Muxer; | ||
| } | ||
| export interface StreamMuxerEvents<MuxedStream extends Stream = Stream> { | ||
| /** | ||
| * Initiate a new stream with the given name. If no name is | ||
| * provided, the id of the stream will be used. | ||
| * An incoming stream was created | ||
| */ | ||
| newStream(name?: string): Stream | Promise<Stream>; | ||
| stream: CustomEvent<MuxedStream>; | ||
| } | ||
| export interface CreateStreamOptions extends AbortOptions, StreamOptions { | ||
| /** | ||
| * Close or abort all tracked streams and stop the muxer | ||
| * If a single protocol was requested and the muxer has support for this, | ||
| * pre-negotiate the protocol using this value, otherwise multistream-select | ||
| * will be run over the stream after opening. | ||
| */ | ||
| close(options?: AbortOptions): Promise<void>; | ||
| protocol?: string; | ||
| } | ||
| export type StreamMuxerStatus = 'open' | 'closing' | 'closed'; | ||
| /** | ||
| * A libp2p stream muxer | ||
| */ | ||
| export interface StreamMuxer<MuxedStream extends Stream = Stream> extends TypedEventTarget<StreamMuxerEvents<MuxedStream>> { | ||
| /** | ||
| * Close or abort all tracked streams and stop the muxer | ||
| * The protocol used to select this muxer during connection opening | ||
| */ | ||
| abort(err: Error): void; | ||
| } | ||
| export interface StreamMuxerInit { | ||
| protocol: string; | ||
| /** | ||
| * A callback function invoked every time an incoming stream is opened | ||
| * A list of streams that are currently open | ||
| */ | ||
| onIncomingStream?(stream: Stream): void; | ||
| streams: MuxedStream[]; | ||
| /** | ||
| * A callback function invoke every time a stream ends | ||
| * The status of the muxer | ||
| */ | ||
| onStreamEnd?(stream: Stream): void; | ||
| status: StreamMuxerStatus; | ||
| /** | ||
| * Outbound stream muxers are opened by the local node, inbound stream muxers are opened by the remote | ||
| * Create a new stream | ||
| */ | ||
| direction?: Direction; | ||
| createStream(options?: CreateStreamOptions): Promise<MuxedStream>; | ||
| /** | ||
| * The logger used by the connection | ||
| * Immediately close the muxer, abort every open stream and discard any | ||
| * unsent/unread data. | ||
| */ | ||
| log?: Logger; | ||
| abort(err: Error): void; | ||
| /** | ||
| * Gracefully close the muxer. All open streams will be gracefully closed, and | ||
| * the returned promise will either resolve when any/all unsent data has been | ||
| * sent, or it will reject if the passed abort signal fires before this | ||
| * happens. | ||
| */ | ||
| close(options?: AbortOptions): Promise<void>; | ||
| } | ||
| //# sourceMappingURL=stream-muxer.d.ts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"stream-muxer.d.ts","sourceRoot":"","sources":["../../src/stream-muxer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,S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BAAiB,CAAC,WAAW,CAAC,CAAC;IACxH;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAA;IAEhB;;OAEG;IACH,OAAO,EAAE,WAAW,EAAE,CAAA;IAEtB;;OAEG;IACH,MAAM,EAAE,iBAAiB,CAAA;IAEzB;;OAEG;IACH,YAAY,CAAC,OAAO,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC,WAAW,CAAC,CAAA;IAEjE;;;OAGG;IACH,KAAK,CAAE,GAAG,EAAE,KAAK,GAAG,IAAI,CAAA;IAExB;;;;;OAKG;IACH,KAAK,CAAE,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CAC9C"} |
@@ -7,3 +7,3 @@ import type { Connection } from './connection.js'; | ||
| * | ||
| * @see https://libp2p.github.io/js-libp2p/functions/_libp2p_peer_collections.peerFilter-1.html | ||
| * @see https://libp2p.github.io/js-libp2p/classes/_libp2p_peer-collections.PeerFilter.html | ||
| */ | ||
@@ -40,3 +40,3 @@ export interface TopologyFilter { | ||
| */ | ||
| onConnect?(peerId: PeerId, conn: Connection): void; | ||
| onConnect?(peerId: PeerId, conn: Connection): void | Promise<void>; | ||
| /** | ||
@@ -46,4 +46,4 @@ * Invoked when the last connection to a peer that supports the registered | ||
| */ | ||
| onDisconnect?(peerId: PeerId): void; | ||
| onDisconnect?(peerId: PeerId): void | Promise<void>; | ||
| } | ||
| //# sourceMappingURL=topology.d.ts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"topology.d.ts","sourceRoot":"","sources":["../../src/topology.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAE1C;;;;;GAKG;AACH,MAAM,WAAW,cAAc;IAC7B,GAAG,CAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAA;IAC7B,GAAG,CAAE,MAAM,EAAE,M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connection, ConnectionLimits, MultiaddrConnection } from './connection.js'; | ||
| import type { AbortOptions, ClearableSignal, ConnectionEncrypter } from './index.js'; | ||
| import type { StreamMuxerFactory } from './stream-muxer.js'; | ||
| import type { AbortOptions, ClearableSignal, ConnectionEncrypter, MultiaddrConnection, Connection, ConnectionLimits, StreamMuxerFactory, PeerId } from './index.js'; | ||
| import type { Multiaddr } from '@multiformats/multiaddr'; | ||
@@ -118,10 +116,2 @@ import type { TypedEventTarget } from 'main-event'; | ||
| /** | ||
| * If true the invoking transport is expected to implement it's own encryption | ||
| * and an encryption protocol will not attempted to be negotiated via | ||
| * multi-stream select | ||
| * | ||
| * @default false | ||
| */ | ||
| skipEncryption?: boolean; | ||
| /** | ||
| * If true no connection protection will be performed on the connection. | ||
@@ -151,2 +141,17 @@ */ | ||
| } | ||
| /** | ||
| * Options accepted by the upgrader during connection establishment | ||
| */ | ||
| export interface UpgraderWithoutEncryptionOptions extends UpgraderOptions { | ||
| /** | ||
| * If true the invoking transport is expected to implement it's own encryption | ||
| * and an encryption protocol will not attempted to be negotiated via | ||
| * multi-stream select | ||
| */ | ||
| skipEncryption: true; | ||
| /** | ||
| * If `skipEncryption` is true, a remote PeerId must be supplied | ||
| */ | ||
| remotePeer: PeerId; | ||
| } | ||
| export type InboundConnectionUpgradeEvents = ProgressEvent<'upgrader:encrypt-inbound-connection'> | ProgressEvent<'upgrader:multiplex-inbound-connection'>; | ||
@@ -158,3 +163,4 @@ export type OutboundConnectionUpgradeEvents = ProgressEvent<'upgrader:encrypt-outbound-connection'> | ProgressEvent<'upgrader:multiplex-outbound-connection'>; | ||
| */ | ||
| upgradeOutbound(maConn: MultiaddrConnection, opts?: UpgraderOptions<OutboundConnectionUpgradeEvents>): Promise<Connection>; | ||
| upgradeOutbound(maConn: MultiaddrConnection, opts: UpgraderOptions<OutboundConnectionUpgradeEvents>): Promise<Connection>; | ||
| upgradeOutbound(maConn: MultiaddrConnection, opts: UpgraderWithoutEncryptionOptions): Promise<Connection>; | ||
| /** | ||
@@ -164,3 +170,4 @@ * Upgrades an inbound connection received by a transport listener and | ||
| */ | ||
| upgradeInbound(maConn: MultiaddrConnection, opts?: UpgraderOptions<InboundConnectionUpgradeEvents>): Promise<void>; | ||
| upgradeInbound(maConn: MultiaddrConnection, opts: UpgraderOptions<InboundConnectionUpgradeEvents>): Promise<void>; | ||
| upgradeInbound(maConn: MultiaddrConnection, opts: UpgraderWithoutEncryptionOptions): Promise<void>; | ||
| /** | ||
@@ -167,0 +174,0 @@ * Used by transports that perform part of the upgrade process themselves and |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../../src/transport.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AACxF,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AACpF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AACxD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAClD,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAErE,MAAM,WAAW,cAAc;IAC7B;;;OAGG;IACH,SAAS,EAAE,WAAW,CAAA;IAEtB;;OAEG;IACH,KAAK,EAAE,WAAW,CAAC,KAAK,CAAC,CAAA;IAEzB;;;OAGG;IACH,KAAK,EAAE,WAAW,CAAA;CACnB;AAED,MAAM,WAAW,QAAS,SAAQ,gBAAgB,CAAC,cAAc,CAAC;IAChE;;OAEG;IACH,MAAM,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAC3C;;OAEG;IACH,QAAQ,IAAI,SAAS,EAAE,CAAA;IACvB;;;;OAIG;IACH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ACxB;;OAEG;IACH,6DAAa,CAAA;IAEb;;OAEG;IACH,2DAAQ,CAAA;AACV,CAAC,EAVW,cAAc,KAAd,cAAc,QAUzB"} | ||
| {"version":3,"file":"transport.js","sourceRoot":"","sources":["../../src/transport.ts"],"names":[],"mappings":"AAiDA,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAA;AA8D9D;;GAEG;AACH,MAAM,UAAU,WAAW,CAAE,KAAW;IACtC,OAAO,KAAK,IAAI,IAAI,IAAI,OAAO,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,CAAA;AACzD,CAAC;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,cAUX;AAVD,WAAY,cAAc;IACxB;;OAEG;IACH,6DAAa,CAAA;IAEb;;OAEG;IACH,2DAAQ,CAAA;AACV,CAAC,EAVW,cAAc,KAAd,cAAc,QAUzB"} |
+4
-6
| { | ||
| "name": "@libp2p/interface", | ||
| "version": "2.11.0-f5932c294", | ||
| "version": "2.11.0-fb19b055d", | ||
| "description": "The interface implemented by a libp2p node", | ||
@@ -45,7 +45,5 @@ "license": "Apache-2.0 OR MIT", | ||
| "@multiformats/dns": "^1.0.6", | ||
| "@multiformats/multiaddr": "^12.4.4", | ||
| "it-pushable": "^3.2.3", | ||
| "it-stream-types": "^2.0.2", | ||
| "@multiformats/multiaddr": "^13.0.1", | ||
| "main-event": "^1.0.1", | ||
| "multiformats": "^13.3.6", | ||
| "multiformats": "^13.4.0", | ||
| "progress-events": "^1.0.1", | ||
@@ -55,5 +53,5 @@ "uint8arraylist": "^2.4.8" | ||
| "devDependencies": { | ||
| "aegir": "^47.0.14" | ||
| "aegir": "^47.0.22" | ||
| }, | ||
| "sideEffects": false | ||
| } |
@@ -1,6 +0,2 @@ | ||
| import type { MultiaddrConnection } from './connection.js' | ||
| import type { AbortOptions, Logger, StreamMuxerFactory } from './index.js' | ||
| import type { PeerId } from './peer-id.js' | ||
| import type { Duplex } from 'it-stream-types' | ||
| import type { Uint8ArrayList } from 'uint8arraylist' | ||
| import type { AbortOptions, StreamMuxerFactory, PeerId, MessageStream } from './index.js' | ||
@@ -13,2 +9,5 @@ /** | ||
| export interface SecureConnectionOptions extends AbortOptions { | ||
| /** | ||
| * This will be set if the remote peer is known in advance | ||
| */ | ||
| remotePeer?: PeerId | ||
@@ -26,9 +25,2 @@ | ||
| /** | ||
| * A stream with an optional logger | ||
| */ | ||
| export interface SecurableStream extends Duplex<AsyncGenerator<Uint8Array | Uint8ArrayList>> { | ||
| log?: Logger | ||
| } | ||
| /** | ||
| * A libp2p connection encrypter module must be compliant to this interface | ||
@@ -45,3 +37,3 @@ * to ensure all exchanged data between two peers is encrypted. | ||
| */ | ||
| secureOutbound <Stream extends SecurableStream = MultiaddrConnection> (connection: Stream, options?: SecureConnectionOptions): Promise<SecuredConnection<Stream, Extension>> | ||
| secureOutbound (connection: MessageStream, options?: SecureConnectionOptions): Promise<SecuredConnection<Extension>> | ||
@@ -53,8 +45,19 @@ /** | ||
| */ | ||
| secureInbound <Stream extends SecurableStream = MultiaddrConnection> (connection: Stream, options?: SecureConnectionOptions): Promise<SecuredConnection<Stream, Extension>> | ||
| secureInbound (connection: MessageStream, options?: SecureConnectionOptions): Promise<SecuredConnection<Extension>> | ||
| } | ||
| export interface SecuredConnection<Stream = any, Extension = unknown> { | ||
| conn: Stream | ||
| export interface SecuredConnection<Extension = unknown> { | ||
| /** | ||
| * The decrypted data stream | ||
| */ | ||
| connection: MessageStream | ||
| /** | ||
| * Any extension data transferred as part of the encryption handshake | ||
| */ | ||
| remoteExtensions?: Extension | ||
| /** | ||
| * The identifier of the remote peer | ||
| */ | ||
| remotePeer: PeerId | ||
@@ -61,0 +64,0 @@ |
@@ -1,3 +0,2 @@ | ||
| import type { MultiaddrConnection } from './connection.js' | ||
| import type { PeerId } from './peer-id.js' | ||
| import type { MultiaddrConnection, PeerId } from './index.js' | ||
| import type { Multiaddr } from '@multiformats/multiaddr' | ||
@@ -4,0 +3,0 @@ |
+38
-270
@@ -1,177 +0,27 @@ | ||
| import type { AbortOptions, Logger } from './index.js' | ||
| import type { PeerId } from './peer-id.js' | ||
| import type { AbortOptions, Logger, TypedEventTarget, Stream, MessageStreamEvents, PeerId, MultiaddrConnectionTimeline, MessageStreamStatus, MessageStreamDirection } from './index.js' | ||
| import type { Multiaddr } from '@multiformats/multiaddr' | ||
| import type { Duplex, Source } from 'it-stream-types' | ||
| import type { Uint8ArrayList } from 'uint8arraylist' | ||
| export interface ConnectionTimeline { | ||
| /** | ||
| * When the connection was opened | ||
| */ | ||
| open: number | ||
| export type ConnectionStatus = MessageStreamStatus | ||
| /** | ||
| * When the MultiaddrConnection was upgraded to a Connection - e.g. the type | ||
| * of connection encryption and multiplexing was negotiated. | ||
| */ | ||
| upgraded?: number | ||
| /** | ||
| * When the connection was closed. | ||
| */ | ||
| close?: number | ||
| } | ||
| /** | ||
| * Outbound connections are opened by the local node, inbound streams are opened by the remote | ||
| */ | ||
| export type Direction = 'inbound' | 'outbound' | ||
| export interface StreamTimeline { | ||
| /** | ||
| * A timestamp of when the stream was opened | ||
| */ | ||
| open: number | ||
| /** | ||
| * A timestamp of when the stream was closed for both reading and writing | ||
| */ | ||
| close?: number | ||
| /** | ||
| * A timestamp of when the stream was closed for reading | ||
| */ | ||
| closeRead?: number | ||
| /** | ||
| * A timestamp of when the stream was closed for writing | ||
| */ | ||
| closeWrite?: number | ||
| /** | ||
| * A timestamp of when the stream was reset | ||
| */ | ||
| reset?: number | ||
| /** | ||
| * A timestamp of when the stream was aborted | ||
| */ | ||
| abort?: number | ||
| } | ||
| /** | ||
| * The states a stream can be in | ||
| */ | ||
| export type StreamStatus = 'open' | 'closing' | 'closed' | 'aborted' | 'reset' | ||
| /** | ||
| * The states the readable end of a stream can be in | ||
| * Connection limits are present on connections that are only allowed to | ||
| * transfer a certain amount of bytes or be open for a certain number | ||
| * of seconds. | ||
| * | ||
| * ready - the readable end is ready for reading | ||
| * closing - the readable end is closing | ||
| * closed - the readable end has closed | ||
| * These limits are applied by Circuit Relay v2 servers, for example and | ||
| * the connection will normally be closed abruptly if the limits are | ||
| * exceeded. | ||
| */ | ||
| export type ReadStatus = 'ready' | 'closing' | 'closed' | ||
| /** | ||
| * The states the writable end of a stream can be in | ||
| * | ||
| * ready - the writable end is ready for writing | ||
| * writing - the writable end is in the process of being written to | ||
| * done - the source passed to the `.sink` function yielded all values without error | ||
| * closing - the writable end is closing | ||
| * closed - the writable end has closed | ||
| */ | ||
| export type WriteStatus = 'ready' | 'writing' | 'done' | 'closing' | 'closed' | ||
| /** | ||
| * A Stream is a data channel between two peers that | ||
| * can be written to and read from at both ends. | ||
| * | ||
| * It may be encrypted and multiplexed depending on the | ||
| * configuration of the nodes. | ||
| */ | ||
| export interface Stream extends Duplex<AsyncGenerator<Uint8ArrayList>, Source<Uint8ArrayList | Uint8Array>, Promise<void>> { | ||
| export interface ConnectionLimits { | ||
| /** | ||
| * Closes the stream for **reading** *and* **writing**. | ||
| * | ||
| * Any buffered data in the source can still be consumed and the stream will end normally. | ||
| * | ||
| * This will cause a `CLOSE` message to be sent to the remote, *unless* the sink has already ended. | ||
| * | ||
| * The sink and the source will return normally. | ||
| * If present this is the number of bytes remaining that may be | ||
| * transferred over this connection | ||
| */ | ||
| close(options?: AbortOptions): Promise<void> | ||
| bytes?: bigint | ||
| /** | ||
| * Closes the stream for **reading**. If iterating over the source of this stream in a `for await of` loop, it will return (exit the loop) after any buffered data has been consumed. | ||
| * | ||
| * This function is called automatically by the muxer when it receives a `CLOSE` message from the remote. | ||
| * | ||
| * The source will return normally, the sink will continue to consume. | ||
| * If present this is the number of seconds that this connection will | ||
| * remain open for | ||
| */ | ||
| closeRead(options?: AbortOptions): Promise<void> | ||
| /** | ||
| * Closes the stream for **writing**. If iterating over the source of this stream in a `for await of` loop, it will return (exit the loop) after any buffered data has been consumed. | ||
| * | ||
| * The source will return normally, the sink will continue to consume. | ||
| */ | ||
| closeWrite(options?: AbortOptions): Promise<void> | ||
| /** | ||
| * Closes the stream for **reading** *and* **writing**. This should be called when a *local error* has occurred. | ||
| * | ||
| * Note, if called without an error any buffered data in the source can still be consumed and the stream will end normally. | ||
| * | ||
| * This will cause a `RESET` message to be sent to the remote, *unless* the sink has already ended. | ||
| * | ||
| * The sink will return and the source will throw. | ||
| */ | ||
| abort(err: Error): void | ||
| /** | ||
| * Unique identifier for a stream. Identifiers are not unique across muxers. | ||
| */ | ||
| id: string | ||
| /** | ||
| * Outbound streams are opened by the local node, inbound streams are opened by the remote | ||
| */ | ||
| direction: Direction | ||
| /** | ||
| * Lifecycle times for the stream | ||
| */ | ||
| timeline: StreamTimeline | ||
| /** | ||
| * The protocol negotiated for this stream | ||
| */ | ||
| protocol?: string | ||
| /** | ||
| * User defined stream metadata | ||
| */ | ||
| metadata: Record<string, any> | ||
| /** | ||
| * The current status of the stream | ||
| */ | ||
| status: StreamStatus | ||
| /** | ||
| * The current status of the readable end of the stream | ||
| */ | ||
| readStatus: ReadStatus | ||
| /** | ||
| * The current status of the writable end of the stream | ||
| */ | ||
| writeStatus: WriteStatus | ||
| /** | ||
| * The stream logger | ||
| */ | ||
| log: Logger | ||
| seconds?: number | ||
| } | ||
@@ -189,6 +39,7 @@ | ||
| * Opt-in to running over a limited connection - one that has restrictions | ||
| * on the amount of data that may be transferred or how long it may be open for. | ||
| * on the amount of data that may be transferred or how long it may be open | ||
| * for. | ||
| * | ||
| * These limits are typically enforced by a relay server, if the protocol | ||
| * will be transferring a lot of data or the stream will be open for a long time | ||
| * These limits are typically enforced by a relay server, if the protocol will | ||
| * be transferring a lot of data or the stream will be open for a long time | ||
| * consider upgrading to a direct connection before opening the stream. | ||
@@ -228,28 +79,3 @@ * | ||
| export type ConnectionStatus = 'open' | 'closing' | 'closed' | ||
| /** | ||
| * Connection limits are present on connections that are only allowed to | ||
| * transfer a certain amount of bytes or be open for a certain number | ||
| * of seconds. | ||
| * | ||
| * These limits are applied by Circuit Relay v2 servers, for example and | ||
| * the connection will normally be closed abruptly if the limits are | ||
| * exceeded. | ||
| */ | ||
| export interface ConnectionLimits { | ||
| /** | ||
| * If present this is the number of bytes remaining that may be | ||
| * transferred over this connection | ||
| */ | ||
| bytes?: bigint | ||
| /** | ||
| * If present this is the number of seconds that this connection will | ||
| * remain open for | ||
| */ | ||
| seconds?: number | ||
| } | ||
| /** | ||
| * A Connection is a high-level representation of a connection | ||
@@ -260,3 +86,3 @@ * to a remote peer that may have been secured by encryption and | ||
| */ | ||
| export interface Connection { | ||
| export interface Connection extends TypedEventTarget<Omit<MessageStreamEvents, 'drain' | 'message'>> { | ||
| /** | ||
@@ -278,7 +104,2 @@ * The unique identifier for this connection | ||
| /** | ||
| * A list of tags applied to this connection | ||
| */ | ||
| tags: string[] | ||
| /** | ||
| * A list of open streams on this connection | ||
@@ -291,8 +112,8 @@ */ | ||
| */ | ||
| direction: Direction | ||
| direction: MessageStreamDirection | ||
| /** | ||
| * Lifecycle times for the connection | ||
| * When stream life cycle events occurred | ||
| */ | ||
| timeline: ConnectionTimeline | ||
| timeline: MultiaddrConnectionTimeline | ||
@@ -315,2 +136,7 @@ /** | ||
| /** | ||
| * Whether this connection is direct or, for example, is via a relay | ||
| */ | ||
| direct: boolean | ||
| /** | ||
| * If present, this connection has limits applied to it, perhaps by an | ||
@@ -330,2 +156,7 @@ * intermediate relay. Once the limits have been reached the connection will | ||
| /** | ||
| * The connection logger, used to log connection-specific information | ||
| */ | ||
| log: Logger | ||
| /** | ||
| * Create a new stream on this connection and negotiate one of the passed protocols | ||
@@ -336,4 +167,5 @@ */ | ||
| /** | ||
| * Gracefully close the connection. All queued data will be written to the | ||
| * underlying transport. | ||
| * Gracefully close the connection. The returned promise will resolve when all | ||
| * queued data has been written to the underlying transport. Any unread data | ||
| * will still be emitted as a 'message' event. | ||
| */ | ||
@@ -343,10 +175,6 @@ close(options?: AbortOptions): Promise<void> | ||
| /** | ||
| * Immediately close the connection, any queued data will be discarded | ||
| * Immediately close the connection. Any data queued to be sent or read will | ||
| * be discarded. | ||
| */ | ||
| abort(err: Error): void | ||
| /** | ||
| * The connection logger | ||
| */ | ||
| log: Logger | ||
| } | ||
@@ -359,61 +187,1 @@ | ||
| } | ||
| export interface ConnectionProtector { | ||
| /** | ||
| * Takes a given Connection and creates a private encryption stream | ||
| * between its two peers from the PSK the Protector instance was | ||
| * created with. | ||
| */ | ||
| protect(connection: MultiaddrConnection, options?: AbortOptions): Promise<MultiaddrConnection> | ||
| } | ||
| export interface MultiaddrConnectionTimeline { | ||
| /** | ||
| * When the connection was opened | ||
| */ | ||
| open: number | ||
| /** | ||
| * When the MultiaddrConnection was upgraded to a Connection - the type of | ||
| * connection encryption and multiplexing was negotiated. | ||
| */ | ||
| upgraded?: number | ||
| /** | ||
| * When the connection was closed. | ||
| */ | ||
| close?: number | ||
| } | ||
| /** | ||
| * A MultiaddrConnection is returned by transports after dialing | ||
| * a peer. It is a low-level primitive and is the raw connection | ||
| * without encryption or stream multiplexing. | ||
| */ | ||
| export interface MultiaddrConnection extends Duplex<AsyncGenerator<Uint8Array | Uint8ArrayList>> { | ||
| /** | ||
| * Gracefully close the connection. All queued data will be written to the | ||
| * underlying transport. | ||
| */ | ||
| close(options?: AbortOptions): Promise<void> | ||
| /** | ||
| * Immediately close the connection, any queued data will be discarded | ||
| */ | ||
| abort(err: Error): void | ||
| /** | ||
| * The address of the remote end of the connection | ||
| */ | ||
| remoteAddr: Multiaddr | ||
| /** | ||
| * When connection life cycle events occurred | ||
| */ | ||
| timeline: MultiaddrConnectionTimeline | ||
| /** | ||
| * The multiaddr connection logger | ||
| */ | ||
| log: Logger | ||
| } |
+24
-0
@@ -148,2 +148,14 @@ /** | ||
| /** | ||
| * Thrown when a protocol stream is aborted locally | ||
| */ | ||
| export class StreamAbortedError extends Error { | ||
| static name = 'StreamAbortedError' | ||
| constructor (message = 'The stream has been aborted') { | ||
| super(message) | ||
| this.name = 'StreamAbortedError' | ||
| } | ||
| } | ||
| /** | ||
| * Thrown when a stream is in an invalid state | ||
@@ -161,2 +173,14 @@ */ | ||
| /** | ||
| * Thrown when a stream buffer is full | ||
| */ | ||
| export class StreamBufferError extends Error { | ||
| static name = 'StreamBufferError' | ||
| constructor (message = 'The stream buffer was full') { | ||
| super(message) | ||
| this.name = 'StreamBufferError' | ||
| } | ||
| } | ||
| /** | ||
| * Thrown when a value could not be found | ||
@@ -163,0 +187,0 @@ */ |
+38
-5
@@ -17,3 +17,3 @@ /** | ||
| import type { Connection, NewStreamOptions, Stream } from './connection.js' | ||
| import type { Connection, NewStreamOptions } from './connection.js' | ||
| import type { ContentRouting } from './content-routing.js' | ||
@@ -27,3 +27,4 @@ import type { Ed25519PublicKey, PublicKey, RSAPublicKey, Secp256k1PublicKey } from './keys.js' | ||
| import type { Startable } from './startable.js' | ||
| import type { StreamHandler, StreamHandlerOptions } from './stream-handler.js' | ||
| import type { StreamHandler, StreamHandlerOptions, StreamMiddleware } from './stream-handler.js' | ||
| import type { Stream } from './stream.js' | ||
| import type { Topology } from './topology.js' | ||
@@ -786,2 +787,29 @@ import type { Listener, OutboundConnectionUpgradeEvents } from './transport.js' | ||
| /** | ||
| * Registers one or more middleware implementations that will be invoked for | ||
| * incoming and outgoing protocol streams that match the passed protocol. | ||
| * | ||
| * @example | ||
| * | ||
| * ```TypeScript | ||
| * libp2p.use('/my/protocol/1.0.0', (stream, connection, next) => { | ||
| * // do something with stream and/or connection | ||
| * next(stream, connection) | ||
| * }) | ||
| * ``` | ||
| */ | ||
| use (protocol: string, middleware: StreamMiddleware | StreamMiddleware[]): void | ||
| /** | ||
| * Deregisters all middleware for the passed protocol. | ||
| * | ||
| * @example | ||
| * | ||
| * ```TypeScript | ||
| * libp2p.unuse('/my/protocol/1.0.0') | ||
| * // any previously registered middleware will no longer be invoked | ||
| * ``` | ||
| */ | ||
| unuse (protocol: string): void | ||
| /** | ||
| * Returns the public key for the passed PeerId. If the PeerId is of the 'RSA' | ||
@@ -921,5 +949,10 @@ * type this may mean searching the routing if the peer's key is not present | ||
| export * from './connection-gater.js' | ||
| export * from './connection-protector.js' | ||
| export * from './content-routing.js' | ||
| export * from './errors.js' | ||
| export * from './events.js' | ||
| export * from './keys.js' | ||
| export * from './message-stream.js' | ||
| export * from './metrics.js' | ||
| export * from './multiaddr-connection.js' | ||
| export * from './peer-discovery.js' | ||
@@ -930,10 +963,10 @@ export * from './peer-id.js' | ||
| export * from './peer-store.js' | ||
| export * from './pubsub.js' | ||
| export * from './record.js' | ||
| export * from './startable.js' | ||
| export * from './stream-handler.js' | ||
| export * from './stream-muxer.js' | ||
| export * from './stream.js' | ||
| export * from './topology.js' | ||
| export * from './transport.js' | ||
| export * from './errors.js' | ||
| export * from 'main-event' | ||
| export * from './startable.js' |
+2
-2
@@ -1,2 +0,2 @@ | ||
| import type { MultiaddrConnection, Stream, Connection } from './connection.js' | ||
| import type { MultiaddrConnection, Stream } from './index.js' | ||
@@ -437,3 +437,3 @@ /** | ||
| */ | ||
| trackProtocolStream(stream: Stream, connection: Connection): void | ||
| trackProtocolStream(stream: Stream): void | ||
@@ -440,0 +440,0 @@ /** |
@@ -317,7 +317,2 @@ import type { AbortOptions } from './index.ts' | ||
| consumePeerRecord(buf: Uint8Array, options?: ConsumePeerRecordOptions): Promise<boolean> | ||
| /** | ||
| * @deprecated Pass `expectedPeer` as a property of `options` instead | ||
| */ | ||
| consumePeerRecord(buf: Uint8Array, expectedPeer?: PeerId, options?: AbortOptions): Promise<boolean> | ||
| } |
+14
-15
@@ -1,16 +0,3 @@ | ||
| import type { Connection, Stream } from './connection.js' | ||
| import type { AbortOptions } from './index.ts' | ||
| import type { AbortOptions, Connection, Stream } from './index.ts' | ||
| export interface IncomingStreamData { | ||
| /** | ||
| * The newly opened stream | ||
| */ | ||
| stream: Stream | ||
| /** | ||
| * The connection the stream was opened on | ||
| */ | ||
| connection: Connection | ||
| } | ||
| export interface StreamHandler { | ||
@@ -20,5 +7,12 @@ /** | ||
| */ | ||
| (data: IncomingStreamData): void | Promise<void> | ||
| (stream: Stream, connection: Connection): void | Promise<void> | ||
| } | ||
| /** | ||
| * Stream middleware allows accessing stream data outside of the stream handler | ||
| */ | ||
| export interface StreamMiddleware { | ||
| (stream: Stream, connection: Connection, next: (stream: Stream, connection: Connection) => void): void | Promise<void> | ||
| } | ||
| export interface StreamHandlerOptions extends AbortOptions { | ||
@@ -50,2 +44,7 @@ /** | ||
| force?: true | ||
| /** | ||
| * Middleware allows accessing stream data outside of the stream handler | ||
| */ | ||
| middleware?: StreamMiddleware[] | ||
| } | ||
@@ -52,0 +51,0 @@ |
+122
-30
@@ -1,23 +0,95 @@ | ||
| import type { Direction, Stream } from './connection.js' | ||
| import type { AbortOptions, Logger } from './index.js' | ||
| import type { Duplex } from 'it-stream-types' | ||
| import type { Uint8ArrayList } from 'uint8arraylist' | ||
| import type { Stream, TypedEventTarget, MessageStream, AbortOptions } from './index.js' | ||
| export interface StreamMuxerFactory { | ||
| /** | ||
| * User-facing message stream muxer options | ||
| */ | ||
| export interface StreamMuxerOptions<MuxedStreamOptions extends StreamOptions = StreamOptions> { | ||
| /** | ||
| * The protocol used to select this muxer during connection opening | ||
| * Configuration options for each outgoing/incoming stream | ||
| */ | ||
| protocol: string | ||
| streamOptions?: MuxedStreamOptions | ||
| /** | ||
| * Creates a new stream muxer to be used with a new connection | ||
| * libp2p is notified of incoming streams via the muxer's 'stream' event. | ||
| * | ||
| * During connection establishment there may be a small window where a muxer | ||
| * starts to process incoming stream data before a listener has been added for | ||
| * the 'stream' event. | ||
| * | ||
| * If no handler is registered for this event incoming streams can be missed | ||
| * so when this is the case muxers queue streams internally as "early | ||
| * streams", and will defer emitting the 'stream' event until after a listener | ||
| * has been registered. | ||
| * | ||
| * Allowing an unlimited amount of early streams can cause excessive memory | ||
| * consumption so this setting controls how many early streams to store when | ||
| * no 'stream' listener has been registered. | ||
| * | ||
| * If more streams than this are opened before a listener is added the muxed | ||
| * connection will be reset. | ||
| * | ||
| * @default 10 | ||
| */ | ||
| createStreamMuxer(init?: StreamMuxerInit): StreamMuxer | ||
| maxEarlyStreams?: number | ||
| /** | ||
| * Maximum size of a message in bytes that we'll send on a stream - this | ||
| * ensures that a single stream doesn't hog a connection | ||
| * | ||
| * @default 65_536 | ||
| */ | ||
| maxMessageSize?: number | ||
| /** | ||
| * Maximum number of concurrent inbound streams that we accept - if the peer | ||
| * tries to open more streams, those will be reset immediately | ||
| * | ||
| * @default 1_000 | ||
| */ | ||
| maxInboundStreams?: number | ||
| /** | ||
| * Maximum number of concurrent outbound streams that we accept - if the | ||
| * application tries to open more streams, the call to `newStream` will throw | ||
| * | ||
| * @default 1_000 | ||
| */ | ||
| maxOutboundStreams?: number | ||
| } | ||
| /** | ||
| * A libp2p stream muxer | ||
| * User-facing message stream options | ||
| */ | ||
| export interface StreamMuxer extends Duplex<AsyncGenerator<Uint8Array | Uint8ArrayList>> { | ||
| export interface StreamOptions { | ||
| /** | ||
| * If no data is sent or received in this number of ms the stream will be | ||
| * reset and an 'error' event emitted. | ||
| * | ||
| * @default 120_000 | ||
| */ | ||
| inactivityTimeout?: number | ||
| /** | ||
| * The maximum number of bytes to store when paused or before a 'message' | ||
| * event handler is added. | ||
| * | ||
| * If the internal buffer overflows this value the stream will be reset. | ||
| * | ||
| * @default 4_194_304 | ||
| */ | ||
| maxReadBufferLength?: number | ||
| /** | ||
| * The maximum number of bytes to store when the remote end of the stream is | ||
| * applying backpressure, or when it is slow to accept new bytes. | ||
| * | ||
| * If the internal buffer overflows this value the stream will be reset. | ||
| * | ||
| * @default Infinity | ||
| */ | ||
| maxWriteBufferLength?: number | ||
| } | ||
| export interface StreamMuxerFactory<Muxer extends StreamMuxer = StreamMuxer> { | ||
| /** | ||
| * The protocol used to select this muxer during connection opening | ||
@@ -28,42 +100,62 @@ */ | ||
| /** | ||
| * A list of streams that are currently open. Closed streams will not be returned. | ||
| * Creates a new stream muxer to be used with a new connection | ||
| */ | ||
| readonly streams: Stream[] | ||
| createStreamMuxer(maConn: MessageStream): Muxer | ||
| } | ||
| export interface StreamMuxerEvents<MuxedStream extends Stream = Stream> { | ||
| /** | ||
| * Initiate a new stream with the given name. If no name is | ||
| * provided, the id of the stream will be used. | ||
| * An incoming stream was created | ||
| */ | ||
| newStream(name?: string): Stream | Promise<Stream> | ||
| stream: CustomEvent<MuxedStream> | ||
| } | ||
| export interface CreateStreamOptions extends AbortOptions, StreamOptions { | ||
| /** | ||
| * Close or abort all tracked streams and stop the muxer | ||
| * If a single protocol was requested and the muxer has support for this, | ||
| * pre-negotiate the protocol using this value, otherwise multistream-select | ||
| * will be run over the stream after opening. | ||
| */ | ||
| close(options?: AbortOptions): Promise<void> | ||
| protocol?: string | ||
| } | ||
| export type StreamMuxerStatus = 'open' | 'closing' | 'closed' | ||
| /** | ||
| * A libp2p stream muxer | ||
| */ | ||
| export interface StreamMuxer<MuxedStream extends Stream = Stream> extends TypedEventTarget<StreamMuxerEvents<MuxedStream>> { | ||
| /** | ||
| * Close or abort all tracked streams and stop the muxer | ||
| * The protocol used to select this muxer during connection opening | ||
| */ | ||
| abort(err: Error): void | ||
| } | ||
| protocol: string | ||
| export interface StreamMuxerInit { | ||
| /** | ||
| * A callback function invoked every time an incoming stream is opened | ||
| * A list of streams that are currently open | ||
| */ | ||
| onIncomingStream?(stream: Stream): void | ||
| streams: MuxedStream[] | ||
| /** | ||
| * A callback function invoke every time a stream ends | ||
| * The status of the muxer | ||
| */ | ||
| onStreamEnd?(stream: Stream): void | ||
| status: StreamMuxerStatus | ||
| /** | ||
| * Outbound stream muxers are opened by the local node, inbound stream muxers are opened by the remote | ||
| * Create a new stream | ||
| */ | ||
| direction?: Direction | ||
| createStream(options?: CreateStreamOptions): Promise<MuxedStream> | ||
| /** | ||
| * The logger used by the connection | ||
| * Immediately close the muxer, abort every open stream and discard any | ||
| * unsent/unread data. | ||
| */ | ||
| log?: Logger | ||
| abort (err: Error): void | ||
| /** | ||
| * Gracefully close the muxer. All open streams will be gracefully closed, and | ||
| * the returned promise will either resolve when any/all unsent data has been | ||
| * sent, or it will reject if the passed abort signal fires before this | ||
| * happens. | ||
| */ | ||
| close (options?: AbortOptions): Promise<void> | ||
| } |
+3
-3
@@ -8,3 +8,3 @@ import type { Connection } from './connection.js' | ||
| * | ||
| * @see https://libp2p.github.io/js-libp2p/functions/_libp2p_peer_collections.peerFilter-1.html | ||
| * @see https://libp2p.github.io/js-libp2p/classes/_libp2p_peer-collections.PeerFilter.html | ||
| */ | ||
@@ -44,3 +44,3 @@ export interface TopologyFilter { | ||
| */ | ||
| onConnect?(peerId: PeerId, conn: Connection): void | ||
| onConnect?(peerId: PeerId, conn: Connection): void | Promise<void> | ||
@@ -51,3 +51,3 @@ /** | ||
| */ | ||
| onDisconnect?(peerId: PeerId): void | ||
| onDisconnect?(peerId: PeerId): void | Promise<void> | ||
| } |
+25
-14
@@ -1,4 +0,2 @@ | ||
| import type { Connection, ConnectionLimits, MultiaddrConnection } from './connection.js' | ||
| import type { AbortOptions, ClearableSignal, ConnectionEncrypter } from './index.js' | ||
| import type { StreamMuxerFactory } from './stream-muxer.js' | ||
| import type { AbortOptions, ClearableSignal, ConnectionEncrypter, MultiaddrConnection, Connection, ConnectionLimits, StreamMuxerFactory, PeerId } from './index.js' | ||
| import type { Multiaddr } from '@multiformats/multiaddr' | ||
@@ -32,2 +30,3 @@ import type { TypedEventTarget } from 'main-event' | ||
| listen(multiaddr: Multiaddr): Promise<void> | ||
| /** | ||
@@ -37,2 +36,3 @@ * Get listen addresses | ||
| getAddrs(): Multiaddr[] | ||
| /** | ||
@@ -44,2 +44,3 @@ * Close listener | ||
| close(): Promise<void> | ||
| /** | ||
@@ -141,11 +142,2 @@ * Allows transports to amend announce addresses - to add certificate hashes | ||
| /** | ||
| * If true the invoking transport is expected to implement it's own encryption | ||
| * and an encryption protocol will not attempted to be negotiated via | ||
| * multi-stream select | ||
| * | ||
| * @default false | ||
| */ | ||
| skipEncryption?: boolean | ||
| /** | ||
| * If true no connection protection will be performed on the connection. | ||
@@ -179,2 +171,19 @@ */ | ||
| /** | ||
| * Options accepted by the upgrader during connection establishment | ||
| */ | ||
| export interface UpgraderWithoutEncryptionOptions extends UpgraderOptions { | ||
| /** | ||
| * If true the invoking transport is expected to implement it's own encryption | ||
| * and an encryption protocol will not attempted to be negotiated via | ||
| * multi-stream select | ||
| */ | ||
| skipEncryption: true | ||
| /** | ||
| * If `skipEncryption` is true, a remote PeerId must be supplied | ||
| */ | ||
| remotePeer: PeerId | ||
| } | ||
| export type InboundConnectionUpgradeEvents = | ||
@@ -192,3 +201,4 @@ ProgressEvent<'upgrader:encrypt-inbound-connection'> | | ||
| */ | ||
| upgradeOutbound(maConn: MultiaddrConnection, opts?: UpgraderOptions<OutboundConnectionUpgradeEvents>): Promise<Connection> | ||
| upgradeOutbound(maConn: MultiaddrConnection, opts: UpgraderOptions<OutboundConnectionUpgradeEvents>): Promise<Connection> | ||
| upgradeOutbound(maConn: MultiaddrConnection, opts: UpgraderWithoutEncryptionOptions): Promise<Connection> | ||
@@ -199,3 +209,4 @@ /** | ||
| */ | ||
| upgradeInbound(maConn: MultiaddrConnection, opts?: UpgraderOptions<InboundConnectionUpgradeEvents>): Promise<void> | ||
| upgradeInbound(maConn: MultiaddrConnection, opts: UpgraderOptions<InboundConnectionUpgradeEvents>): Promise<void> | ||
| upgradeInbound(maConn: MultiaddrConnection, opts: UpgraderWithoutEncryptionOptions): Promise<void> | ||
@@ -202,0 +213,0 @@ /** |
| import type { Stream } from './connection.js'; | ||
| import type { PublicKey } from './keys.js'; | ||
| import type { PeerId } from './peer-id.js'; | ||
| import type { Pushable } from 'it-pushable'; | ||
| import type { TypedEventTarget } from 'main-event'; | ||
| import type { Uint8ArrayList } from 'uint8arraylist'; | ||
| /** | ||
| * On the producing side: | ||
| * - Build messages with the signature, key (from may be enough for certain inlineable public key types), from and seqno fields. | ||
| * | ||
| * On the consuming side: | ||
| * - Enforce the fields to be present, reject otherwise. | ||
| * - Propagate only if the fields are valid and signature can be verified, reject otherwise. | ||
| */ | ||
| export declare const StrictSign = "StrictSign"; | ||
| /** | ||
| * On the producing side: | ||
| * - Build messages without the signature, key, from and seqno fields. | ||
| * - The corresponding protobuf key-value pairs are absent from the marshaled message, not just empty. | ||
| * | ||
| * On the consuming side: | ||
| * - Enforce the fields to be absent, reject otherwise. | ||
| * - Propagate only if the fields are absent, reject otherwise. | ||
| * - 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. | ||
| */ | ||
| export declare const StrictNoSign = "StrictNoSign"; | ||
| export type SignaturePolicy = typeof StrictSign | typeof StrictNoSign; | ||
| export interface SignedMessage { | ||
| type: 'signed'; | ||
| from: PeerId; | ||
| topic: string; | ||
| data: Uint8Array; | ||
| sequenceNumber: bigint; | ||
| signature: Uint8Array; | ||
| key: PublicKey; | ||
| } | ||
| export interface UnsignedMessage { | ||
| type: 'unsigned'; | ||
| topic: string; | ||
| data: Uint8Array; | ||
| } | ||
| export type Message = SignedMessage | UnsignedMessage; | ||
| export interface PubSubRPCMessage { | ||
| from?: Uint8Array; | ||
| topic?: string; | ||
| data?: Uint8Array; | ||
| sequenceNumber?: Uint8Array; | ||
| signature?: Uint8Array; | ||
| key?: Uint8Array; | ||
| } | ||
| export interface PubSubRPCSubscription { | ||
| subscribe?: boolean; | ||
| topic?: string; | ||
| } | ||
| export interface PubSubRPC { | ||
| subscriptions: PubSubRPCSubscription[]; | ||
| messages: PubSubRPCMessage[]; | ||
| } | ||
| export interface PeerStreams extends TypedEventTarget<PeerStreamEvents> { | ||
| id: PeerId; | ||
| protocol: string; | ||
| outboundStream?: Pushable<Uint8ArrayList>; | ||
| inboundStream?: AsyncIterable<Uint8ArrayList>; | ||
| isWritable: boolean; | ||
| close(): void; | ||
| write(buf: Uint8Array | Uint8ArrayList): void; | ||
| attachInboundStream(stream: Stream): AsyncIterable<Uint8ArrayList>; | ||
| attachOutboundStream(stream: Stream): Promise<Pushable<Uint8ArrayList>>; | ||
| } | ||
| export interface PubSubInit { | ||
| enabled?: boolean; | ||
| multicodecs?: string[]; | ||
| /** | ||
| * defines how signatures should be handled | ||
| */ | ||
| globalSignaturePolicy?: SignaturePolicy; | ||
| /** | ||
| * if can relay messages not subscribed | ||
| */ | ||
| canRelayMessage?: boolean; | ||
| /** | ||
| * if publish should emit to self, if subscribed | ||
| */ | ||
| emitSelf?: boolean; | ||
| /** | ||
| * handle this many incoming pubsub messages concurrently | ||
| */ | ||
| messageProcessingConcurrency?: number; | ||
| /** | ||
| * How many parallel incoming streams to allow on the pubsub protocol per-connection | ||
| */ | ||
| maxInboundStreams?: number; | ||
| /** | ||
| * How many parallel outgoing streams to allow on the pubsub protocol per-connection | ||
| */ | ||
| maxOutboundStreams?: number; | ||
| } | ||
| export interface Subscription { | ||
| topic: string; | ||
| subscribe: boolean; | ||
| } | ||
| export interface SubscriptionChangeData { | ||
| peerId: PeerId; | ||
| subscriptions: Subscription[]; | ||
| } | ||
| export interface PubSubEvents { | ||
| 'subscription-change': CustomEvent<SubscriptionChangeData>; | ||
| message: CustomEvent<Message>; | ||
| } | ||
| export interface PublishResult { | ||
| recipients: PeerId[]; | ||
| } | ||
| export declare enum TopicValidatorResult { | ||
| /** | ||
| * The message is considered valid, and it should be delivered and forwarded to the network | ||
| */ | ||
| Accept = "accept", | ||
| /** | ||
| * The message is neither delivered nor forwarded to the network | ||
| */ | ||
| Ignore = "ignore", | ||
| /** | ||
| * The message is considered invalid, and it should be rejected | ||
| */ | ||
| Reject = "reject" | ||
| } | ||
| export interface TopicValidatorFn { | ||
| (peer: PeerId, message: Message): TopicValidatorResult | Promise<TopicValidatorResult>; | ||
| } | ||
| /** | ||
| * @deprecated This will be removed from `@libp2p/interface` in a future release, pubsub implementations should declare their own types | ||
| */ | ||
| export interface PubSub<Events extends Record<string, any> = PubSubEvents> extends TypedEventTarget<Events> { | ||
| /** | ||
| * The global signature policy controls whether or not we sill send and receive | ||
| * signed or unsigned messages. | ||
| * | ||
| * Signed messages prevent spoofing message senders and should be preferred to | ||
| * using unsigned messages. | ||
| */ | ||
| globalSignaturePolicy: typeof StrictSign | typeof StrictNoSign; | ||
| /** | ||
| * A list of multicodecs that contain the pubsub protocol name. | ||
| */ | ||
| multicodecs: string[]; | ||
| /** | ||
| * Pubsub routers support message validators per topic, which will validate the message | ||
| * before its propagations. They are stored in a map where keys are the topic name and | ||
| * values are the validators. | ||
| * | ||
| * @example | ||
| * | ||
| * ```TypeScript | ||
| * const topic = 'topic' | ||
| * const validateMessage = (msgTopic, msg) => { | ||
| * const input = uint8ArrayToString(msg.data) | ||
| * const validInputs = ['a', 'b', 'c'] | ||
| * | ||
| * if (!validInputs.includes(input)) { | ||
| * throw new Error('no valid input received') | ||
| * } | ||
| * } | ||
| * libp2p.pubsub.topicValidators.set(topic, validateMessage) | ||
| * ``` | ||
| */ | ||
| topicValidators: Map<string, TopicValidatorFn>; | ||
| getPeers(): PeerId[]; | ||
| /** | ||
| * Gets a list of topics the node is subscribed to. | ||
| * | ||
| * ```TypeScript | ||
| * const topics = libp2p.pubsub.getTopics() | ||
| * ``` | ||
| */ | ||
| getTopics(): string[]; | ||
| /** | ||
| * Subscribes to a pubsub topic. | ||
| * | ||
| * @example | ||
| * | ||
| * ```TypeScript | ||
| * const topic = 'topic' | ||
| * const handler = (msg) => { | ||
| * if (msg.topic === topic) { | ||
| * // msg.data - pubsub data received | ||
| * } | ||
| * } | ||
| * | ||
| * libp2p.pubsub.addEventListener('message', handler) | ||
| * libp2p.pubsub.subscribe(topic) | ||
| * ``` | ||
| */ | ||
| subscribe(topic: string): void; | ||
| /** | ||
| * Unsubscribes from a pubsub topic. | ||
| * | ||
| * @example | ||
| * | ||
| * ```TypeScript | ||
| * const topic = 'topic' | ||
| * const handler = (msg) => { | ||
| * // msg.data - pubsub data received | ||
| * } | ||
| * | ||
| * libp2p.pubsub.removeEventListener(topic handler) | ||
| * libp2p.pubsub.unsubscribe(topic) | ||
| * ``` | ||
| */ | ||
| unsubscribe(topic: string): void; | ||
| /** | ||
| * Gets a list of the PeerIds that are subscribed to one topic. | ||
| * | ||
| * @example | ||
| * | ||
| * ```TypeScript | ||
| * const peerIds = libp2p.pubsub.getSubscribers(topic) | ||
| * ``` | ||
| */ | ||
| getSubscribers(topic: string): PeerId[]; | ||
| /** | ||
| * Publishes messages to the given topic. | ||
| * | ||
| * @example | ||
| * | ||
| * ```TypeScript | ||
| * const topic = 'topic' | ||
| * const data = uint8ArrayFromString('data') | ||
| * | ||
| * await libp2p.pubsub.publish(topic, data) | ||
| * ``` | ||
| */ | ||
| publish(topic: string, data: Uint8Array): Promise<PublishResult>; | ||
| } | ||
| export interface PeerStreamEvents { | ||
| 'stream:inbound': CustomEvent<never>; | ||
| 'stream:outbound': CustomEvent<never>; | ||
| close: CustomEvent<never>; | ||
| } | ||
| /** | ||
| * All Pubsub implementations must use this symbol as the name of a property | ||
| * with a boolean `true` value | ||
| */ | ||
| export declare const pubSubSymbol: unique symbol; | ||
| /** | ||
| * Returns true if the passed argument is a PubSub implementation | ||
| */ | ||
| export declare function isPubSub(obj?: any): obj is PubSub; | ||
| //# sourceMappingURL=pubsub.d.ts.map |
| {"version":3,"file":"pubsub.d.ts","sourceRoot":"","sources":["../../src/pubsub.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AAC7C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAC1C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAC1C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAC3C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAClD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAEpD;;;;;;;GAOG;AACH,eAAO,MAAM,UAAU,eAAe,CAAA;AAEtC;;;;;;;;;GASG;AACH,eAAO,MAAM,YAAY,iBAAiB,CAAA;AAE1C,MAAM,MAAM,eAAe,GAAG,OAAO,UAAU,GAAG,OAAO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AAA;CACvF;AAED;;GAEG;AACH,MAAM,WAAW,MAAM,CAAC,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,YAAY,CAAE,SAAQ,gBAAgB,CAAC,MAAM,CAAC;IACzG;;;;;;OAMG;IACH,qBAAqB,EAAE,OAAO,UAAU,GAAG,OAAO,YAAY,CAAA;IAE9D;;OAEG;IACH,WAAW,EAAE,MAAM,EAAE,CAAA;IAErB;;;;;;;;;;;;;;;;;;;OAmBG;IACH,eAAe,EAAE,GAAG,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAA;IAE9C,QAAQ,IAAI,MAAM,EAAE,CAAA;IAEpB;;;;;;OAMG;IACH,SAAS,IAAI,MAAM,EAAE,CAAA;IAErB;;;;;;;;;;;;;;;;OAgBG;IACH,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IAE9B;;;;;;;;;;;;;;OAcG;IACH,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IAEhC;;;;;;;;OAQG;IACH,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;IAEvC;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,aAAa,CAAC,CAAA;CACjE;AAED,MAAM,WAAW,gBAAgB;IAC/B,gBAAgB,EAAE,WAAW,CAAC,KAAK,CAAC,CAAA;IACpC,iBAAiB,EAAE,WAAW,CAAC,KAAK,CAAC,CAAA;IACrC,KAAK,EAAE,WAAW,CAAC,KAAK,CAAC,CAAA;CAC1B;AAED;;;GAGG;AACH,eAAO,MAAM,YAAY,eAA+B,CAAA;AAExD;;GAEG;AACH,wBAAgB,QAAQ,CAAE,GAAG,CAAC,EAAE,GAAG,GAAG,GAAG,IAAI,MAAM,CAElD"} |
| /** | ||
| * On the producing side: | ||
| * - Build messages with the signature, key (from may be enough for certain inlineable public key types), from and seqno fields. | ||
| * | ||
| * On the consuming side: | ||
| * - Enforce the fields to be present, reject otherwise. | ||
| * - Propagate only if the fields are valid and signature can be verified, reject otherwise. | ||
| */ | ||
| export const StrictSign = 'StrictSign'; | ||
| /** | ||
| * On the producing side: | ||
| * - Build messages without the signature, key, from and seqno fields. | ||
| * - The corresponding protobuf key-value pairs are absent from the marshaled message, not just empty. | ||
| * | ||
| * On the consuming side: | ||
| * - Enforce the fields to be absent, reject otherwise. | ||
| * - Propagate only if the fields are absent, reject otherwise. | ||
| * - 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. | ||
| */ | ||
| export const StrictNoSign = 'StrictNoSign'; | ||
| export var TopicValidatorResult; | ||
| (function (TopicValidatorResult) { | ||
| /** | ||
| * The message is considered valid, and it should be delivered and forwarded to the network | ||
| */ | ||
| TopicValidatorResult["Accept"] = "accept"; | ||
| /** | ||
| * The message is neither delivered nor forwarded to the network | ||
| */ | ||
| TopicValidatorResult["Ignore"] = "ignore"; | ||
| /** | ||
| * The message is considered invalid, and it should be rejected | ||
| */ | ||
| TopicValidatorResult["Reject"] = "reject"; | ||
| })(TopicValidatorResult || (TopicValidatorResult = {})); | ||
| /** | ||
| * All Pubsub implementations must use this symbol as the name of a property | ||
| * with a boolean `true` value | ||
| */ | ||
| export const pubSubSymbol = Symbol.for('@libp2p/pubsub'); | ||
| /** | ||
| * Returns true if the passed argument is a PubSub implementation | ||
| */ | ||
| export function isPubSub(obj) { | ||
| return Boolean(obj?.[pubSubSymbol]); | ||
| } | ||
| //# sourceMappingURL=pubsub.js.map |
| {"version":3,"file":"pubsub.js","sourceRoot":"","sources":["../../src/pubsub.ts"],"names":[],"mappings":"AAOA;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,YAAY,CAAA;AAEtC;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,cAAc,CAAA;AA6G1C,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;AA6HD;;;GAGG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAA;AAExD;;GAEG;AACH,MAAM,UAAU,QAAQ,CAAE,GAAS;IACjC,OAAO,OAAO,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,CAAC,CAAA;AACrC,CAAC"} |
-286
| import type { Stream } from './connection.js' | ||
| import type { PublicKey } from './keys.js' | ||
| import type { PeerId } from './peer-id.js' | ||
| import type { Pushable } from 'it-pushable' | ||
| import type { TypedEventTarget } from 'main-event' | ||
| import type { Uint8ArrayList } from 'uint8arraylist' | ||
| /** | ||
| * On the producing side: | ||
| * - Build messages with the signature, key (from may be enough for certain inlineable public key types), from and seqno fields. | ||
| * | ||
| * On the consuming side: | ||
| * - Enforce the fields to be present, reject otherwise. | ||
| * - Propagate only if the fields are valid and signature can be verified, reject otherwise. | ||
| */ | ||
| export const StrictSign = 'StrictSign' | ||
| /** | ||
| * On the producing side: | ||
| * - Build messages without the signature, key, from and seqno fields. | ||
| * - The corresponding protobuf key-value pairs are absent from the marshaled message, not just empty. | ||
| * | ||
| * On the consuming side: | ||
| * - Enforce the fields to be absent, reject otherwise. | ||
| * - Propagate only if the fields are absent, reject otherwise. | ||
| * - 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. | ||
| */ | ||
| export const StrictNoSign = 'StrictNoSign' | ||
| export type SignaturePolicy = typeof StrictSign | typeof StrictNoSign | ||
| export interface SignedMessage { | ||
| type: 'signed' | ||
| from: PeerId | ||
| topic: string | ||
| data: Uint8Array | ||
| sequenceNumber: bigint | ||
| signature: Uint8Array | ||
| key: PublicKey | ||
| } | ||
| export interface UnsignedMessage { | ||
| type: 'unsigned' | ||
| topic: string | ||
| data: Uint8Array | ||
| } | ||
| export type Message = SignedMessage | UnsignedMessage | ||
| export interface PubSubRPCMessage { | ||
| from?: Uint8Array | ||
| topic?: string | ||
| data?: Uint8Array | ||
| sequenceNumber?: Uint8Array | ||
| signature?: Uint8Array | ||
| key?: Uint8Array | ||
| } | ||
| export interface PubSubRPCSubscription { | ||
| subscribe?: boolean | ||
| topic?: string | ||
| } | ||
| export interface PubSubRPC { | ||
| subscriptions: PubSubRPCSubscription[] | ||
| messages: PubSubRPCMessage[] | ||
| } | ||
| export interface PeerStreams extends TypedEventTarget<PeerStreamEvents> { | ||
| id: PeerId | ||
| protocol: string | ||
| outboundStream?: Pushable<Uint8ArrayList> | ||
| inboundStream?: AsyncIterable<Uint8ArrayList> | ||
| isWritable: boolean | ||
| close(): void | ||
| write(buf: Uint8Array | Uint8ArrayList): void | ||
| attachInboundStream(stream: Stream): AsyncIterable<Uint8ArrayList> | ||
| attachOutboundStream(stream: Stream): Promise<Pushable<Uint8ArrayList>> | ||
| } | ||
| export interface PubSubInit { | ||
| enabled?: boolean | ||
| multicodecs?: string[] | ||
| /** | ||
| * defines how signatures should be handled | ||
| */ | ||
| globalSignaturePolicy?: SignaturePolicy | ||
| /** | ||
| * if can relay messages not subscribed | ||
| */ | ||
| canRelayMessage?: boolean | ||
| /** | ||
| * if publish should emit to self, if subscribed | ||
| */ | ||
| emitSelf?: boolean | ||
| /** | ||
| * handle this many incoming pubsub messages concurrently | ||
| */ | ||
| messageProcessingConcurrency?: number | ||
| /** | ||
| * How many parallel incoming streams to allow on the pubsub protocol per-connection | ||
| */ | ||
| maxInboundStreams?: number | ||
| /** | ||
| * How many parallel outgoing streams to allow on the pubsub protocol per-connection | ||
| */ | ||
| maxOutboundStreams?: number | ||
| } | ||
| export interface Subscription { | ||
| topic: string | ||
| subscribe: boolean | ||
| } | ||
| export interface SubscriptionChangeData { | ||
| peerId: PeerId | ||
| subscriptions: Subscription[] | ||
| } | ||
| export interface PubSubEvents { | ||
| 'subscription-change': CustomEvent<SubscriptionChangeData> | ||
| message: CustomEvent<Message> | ||
| } | ||
| export interface PublishResult { | ||
| recipients: PeerId[] | ||
| } | ||
| export enum TopicValidatorResult { | ||
| /** | ||
| * The message is considered valid, and it should be delivered and forwarded to the network | ||
| */ | ||
| Accept = 'accept', | ||
| /** | ||
| * The message is neither delivered nor forwarded to the network | ||
| */ | ||
| Ignore = 'ignore', | ||
| /** | ||
| * The message is considered invalid, and it should be rejected | ||
| */ | ||
| Reject = 'reject' | ||
| } | ||
| export interface TopicValidatorFn { | ||
| (peer: PeerId, message: Message): TopicValidatorResult | Promise<TopicValidatorResult> | ||
| } | ||
| /** | ||
| * @deprecated This will be removed from `@libp2p/interface` in a future release, pubsub implementations should declare their own types | ||
| */ | ||
| export interface PubSub<Events extends Record<string, any> = PubSubEvents> extends TypedEventTarget<Events> { | ||
| /** | ||
| * The global signature policy controls whether or not we sill send and receive | ||
| * signed or unsigned messages. | ||
| * | ||
| * Signed messages prevent spoofing message senders and should be preferred to | ||
| * using unsigned messages. | ||
| */ | ||
| globalSignaturePolicy: typeof StrictSign | typeof StrictNoSign | ||
| /** | ||
| * A list of multicodecs that contain the pubsub protocol name. | ||
| */ | ||
| multicodecs: string[] | ||
| /** | ||
| * Pubsub routers support message validators per topic, which will validate the message | ||
| * before its propagations. They are stored in a map where keys are the topic name and | ||
| * values are the validators. | ||
| * | ||
| * @example | ||
| * | ||
| * ```TypeScript | ||
| * const topic = 'topic' | ||
| * const validateMessage = (msgTopic, msg) => { | ||
| * const input = uint8ArrayToString(msg.data) | ||
| * const validInputs = ['a', 'b', 'c'] | ||
| * | ||
| * if (!validInputs.includes(input)) { | ||
| * throw new Error('no valid input received') | ||
| * } | ||
| * } | ||
| * libp2p.pubsub.topicValidators.set(topic, validateMessage) | ||
| * ``` | ||
| */ | ||
| topicValidators: Map<string, TopicValidatorFn> | ||
| getPeers(): PeerId[] | ||
| /** | ||
| * Gets a list of topics the node is subscribed to. | ||
| * | ||
| * ```TypeScript | ||
| * const topics = libp2p.pubsub.getTopics() | ||
| * ``` | ||
| */ | ||
| getTopics(): string[] | ||
| /** | ||
| * Subscribes to a pubsub topic. | ||
| * | ||
| * @example | ||
| * | ||
| * ```TypeScript | ||
| * const topic = 'topic' | ||
| * const handler = (msg) => { | ||
| * if (msg.topic === topic) { | ||
| * // msg.data - pubsub data received | ||
| * } | ||
| * } | ||
| * | ||
| * libp2p.pubsub.addEventListener('message', handler) | ||
| * libp2p.pubsub.subscribe(topic) | ||
| * ``` | ||
| */ | ||
| subscribe(topic: string): void | ||
| /** | ||
| * Unsubscribes from a pubsub topic. | ||
| * | ||
| * @example | ||
| * | ||
| * ```TypeScript | ||
| * const topic = 'topic' | ||
| * const handler = (msg) => { | ||
| * // msg.data - pubsub data received | ||
| * } | ||
| * | ||
| * libp2p.pubsub.removeEventListener(topic handler) | ||
| * libp2p.pubsub.unsubscribe(topic) | ||
| * ``` | ||
| */ | ||
| unsubscribe(topic: string): void | ||
| /** | ||
| * Gets a list of the PeerIds that are subscribed to one topic. | ||
| * | ||
| * @example | ||
| * | ||
| * ```TypeScript | ||
| * const peerIds = libp2p.pubsub.getSubscribers(topic) | ||
| * ``` | ||
| */ | ||
| getSubscribers(topic: string): PeerId[] | ||
| /** | ||
| * Publishes messages to the given topic. | ||
| * | ||
| * @example | ||
| * | ||
| * ```TypeScript | ||
| * const topic = 'topic' | ||
| * const data = uint8ArrayFromString('data') | ||
| * | ||
| * await libp2p.pubsub.publish(topic, data) | ||
| * ``` | ||
| */ | ||
| publish(topic: string, data: Uint8Array): Promise<PublishResult> | ||
| } | ||
| export interface PeerStreamEvents { | ||
| 'stream:inbound': CustomEvent<never> | ||
| 'stream:outbound': CustomEvent<never> | ||
| close: CustomEvent<never> | ||
| } | ||
| /** | ||
| * All Pubsub implementations must use this symbol as the name of a property | ||
| * with a boolean `true` value | ||
| */ | ||
| export const pubSubSymbol = Symbol.for('@libp2p/pubsub') | ||
| /** | ||
| * Returns true if the passed argument is a PubSub implementation | ||
| */ | ||
| export function isPubSub (obj?: any): obj is PubSub { | ||
| return Boolean(obj?.[pubSubSymbol]) | ||
| } |
Sorry, the diff of this file is too big to display
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
6
-25%124
19.23%424306
-1.42%8241
-0.48%20
53.85%- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
Updated