2018-06-21 13:43:06 +02:00
|
|
|
// Type definitions for peer-book 0.8.0
|
|
|
|
// Project: https://github.com/libp2p/js-peer-book
|
|
|
|
// Definitions by: Jaco Greeff <https://github.com/jacogr>
|
|
|
|
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
|
|
|
|
2018-06-21 15:49:53 +02:00
|
|
|
import PeerId = require('peer-id');
|
|
|
|
import PeerInfo = require('peer-info');
|
2018-06-21 13:43:06 +02:00
|
|
|
|
|
|
|
declare class PeerBook {
|
|
|
|
constructor ();
|
|
|
|
|
|
|
|
get (peer: PeerId | PeerInfo | string): PeerInfo;
|
|
|
|
getAll (): { [peerId: string]: PeerInfo };
|
|
|
|
getAllArray (): PeerInfo[];
|
|
|
|
getMultiaddrs (peer: PeerId | PeerInfo | string): string[];
|
|
|
|
has (peer: PeerId | PeerInfo | string): boolean;
|
|
|
|
put (peerInfo: PeerInfo, replace?: boolean): PeerInfo;
|
|
|
|
remove (peerInfo: PeerInfo, replace?: boolean): void;
|
|
|
|
}
|
|
|
|
|
2018-06-21 15:49:53 +02:00
|
|
|
export = PeerBook;
|