mirror of
https://github.com/fluencelabs/libp2p-ts
synced 2025-03-16 18:20:50 +00:00
Merge pull request #25 from ChainSafe/libp2p-additions
Add misc libp2p methods
This commit is contained in:
commit
8b67e475b4
2
types/libp2p-bootstrap/index.d.ts
vendored
2
types/libp2p-bootstrap/index.d.ts
vendored
@ -18,7 +18,7 @@ declare namespace LibP2pBootstrap {
|
||||
declare class LibP2pBootstrap {
|
||||
constructor (options: LibP2pBootstrap.Options);
|
||||
|
||||
on (event: LibP2pBootstrap.Events, cb: (peerInfo: PeerInfo) => any): void;
|
||||
on (event: LibP2pBootstrap.Events, cb: (peerInfo: PeerInfo) => any): this;
|
||||
}
|
||||
|
||||
declare module 'libp2p-bootstrap' {
|
||||
|
2
types/libp2p-mdns/index.d.ts
vendored
2
types/libp2p-mdns/index.d.ts
vendored
@ -21,7 +21,7 @@ declare namespace LibP2pMdns {
|
||||
declare class LibP2pMdns extends LibP2pBootstrap {
|
||||
constructor (options: LibP2pMdns.Options);
|
||||
|
||||
on (event: LibP2pMdns.Events, cb: (peerInfo: PeerInfo) => any): void;
|
||||
on (event: LibP2pMdns.Events, cb: (peerInfo: PeerInfo) => any): this;
|
||||
}
|
||||
|
||||
declare module 'libp2p-mdns' {
|
||||
|
16
types/libp2p/index.d.ts
vendored
16
types/libp2p/index.d.ts
vendored
@ -25,6 +25,11 @@ declare namespace LibP2p {
|
||||
dht?: boolean
|
||||
},
|
||||
peerDiscovery?: {
|
||||
bootstrap?: {
|
||||
interval?: number
|
||||
enabled?: boolean
|
||||
list: Multiaddr.Multiaddr[]
|
||||
},
|
||||
mdns?: {
|
||||
interval?: number
|
||||
enabled?: boolean
|
||||
@ -49,10 +54,10 @@ declare namespace LibP2p {
|
||||
};
|
||||
|
||||
export type OptionsModules = {
|
||||
connEncryption: Array<LibP2pSecio>,
|
||||
connEncryption?: Array<LibP2pSecio>,
|
||||
streamMuxer: Array<LibP2pMplex | LibP2pSpdy | PullMplex>,
|
||||
dht?: typeof LibP2pKadDht,
|
||||
peerDiscovery: Array<LibP2pBootstrap>,
|
||||
peerDiscovery: Array<typeof LibP2pBootstrap>,
|
||||
transport: LibP2pTransport[]
|
||||
};
|
||||
|
||||
@ -72,12 +77,17 @@ declare class LibP2p {
|
||||
constructor(options: LibP2p.Options);
|
||||
|
||||
readonly peerInfo: PeerInfo;
|
||||
readonly peerBook: PeerBook;
|
||||
|
||||
dial(peerInfo: PeerInfo, cb: (error: Error | null) => any): void;
|
||||
dialProtocol(peerInfo: PeerInfo | Multiaddr.Multiaddr, protocol: string, cb: (error: Error | null, conn?: LibP2pConnection) => any): void;
|
||||
hangUp(peerInfo: PeerInfo, cb: (error: Error | null) => any): void;
|
||||
handle(protocol: string, handler: (protocol: string, conn: LibP2pConnection) => any, matcher?: (protocol: string, requestedProtocol: string, cb: (error: Error | null, accept: boolean) => void) => any): void;
|
||||
unhandle(protocol: string): void;
|
||||
isStarted(): boolean;
|
||||
on(event: LibP2p.Events, cb: (event: any) => any): void;
|
||||
on(event: LibP2p.Events, cb: (event: any) => any): this;
|
||||
once(event: LibP2p.Events, cb: (event: any) => any): this;
|
||||
removeListener(event: LibP2p.Events, cb: (event: any) => any): this;
|
||||
ping(peerInfo: PeerInfo, callback: (error: Error | null, ping: any) => void): void;
|
||||
start(cb: (error: Error | null) => any): void;
|
||||
stop(cb: (error: Error | null) => any): void;
|
||||
|
1
types/pull-pushable/index.d.ts
vendored
1
types/pull-pushable/index.d.ts
vendored
@ -8,6 +8,7 @@
|
||||
declare module 'pull-pushable' {
|
||||
export type Pushable = {
|
||||
push: (buffer: Buffer) => void
|
||||
end: (end?: any) => void
|
||||
};
|
||||
|
||||
export type PullPushable = (errorHandler?: (error: Error) => void) => Pushable;
|
||||
|
Loading…
x
Reference in New Issue
Block a user