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