mirror of
https://github.com/fluencelabs/js-libp2p-interfaces
synced 2025-04-24 16:32:32 +00:00
chore: add interface constructors
This commit is contained in:
parent
8fdc05d37d
commit
0801fc3c0b
@ -2,6 +2,7 @@
|
||||
* A libp2p stream muxer
|
||||
*/
|
||||
export interface Muxer {
|
||||
new (options: MuxerOptions): Muxer; // eslint-disable-line
|
||||
multicodec: string;
|
||||
readonly streams: Array<MuxedStream>;
|
||||
/**
|
||||
@ -21,6 +22,12 @@ export interface Muxer {
|
||||
onStreamEnd (stream: MuxedStream): void;
|
||||
}
|
||||
|
||||
export type MuxerOptions = {
|
||||
onStream: (stream: MuxedStream) => void;
|
||||
onStreamEnd: (stream: MuxedStream) => void;
|
||||
maxMsgSize?: number;
|
||||
}
|
||||
|
||||
export type MuxedTimeline = {
|
||||
open: number;
|
||||
close?: number;
|
||||
|
@ -6,6 +6,7 @@ import Connection from '../connection/connection'
|
||||
* A libp2p transport is understood as something that offers a dial and listen interface to establish connections.
|
||||
*/
|
||||
export interface Transport {
|
||||
new (upgrader: Upgrader, ...others: any): Transport; // eslint-disable-line
|
||||
/**
|
||||
* Dial a given multiaddr.
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user