This repository was archived by the owner on Jun 26, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 7 files changed +31
-22
lines changed
Expand file tree Collapse file tree 7 files changed +31
-22
lines changed Original file line number Diff line number Diff line change 1- export = ContentRouting ;
2-
31import PeerId from 'peer-id'
4- import Multiaddr from 'multiaddr'
2+ import { Multiaddr } from 'multiaddr'
53import CID from 'cids'
64
7- declare class ContentRouting {
8- constructor ( options : Object ) ;
5+ export interface ContentRoutingFactory {
6+ new ( options ?: any ) : ContentRouting ;
7+ }
8+
9+ export interface ContentRouting {
910 provide ( cid : CID ) : Promise < void > ;
1011 findProviders ( cid : CID , options : Object ) : AsyncIterable < { id : PeerId , multiaddrs : Multiaddr [ ] } > ;
1112}
13+
14+ export default ContentRouting ;
Original file line number Diff line number Diff line change 1- export = PeerDiscovery ;
1+ import { EventEmitter } from 'events' ;
22
3- import events from 'events' ;
4-
5- declare class PeerDiscovery extends events . EventEmitter {
6- constructor ( options : Object ) ;
7- start ( ) : Promise < void > ;
8- stop ( ) : Promise < void > ;
3+ export interface PeerDiscoveryFactory {
4+ new ( options ?: any ) : PeerDiscovery ;
95 tag : string ;
106}
7+
8+ export interface PeerDiscovery extends EventEmitter {
9+ start ( ) : void | Promise < void > ;
10+ stop ( ) : void | Promise < void > ;
11+ }
12+
13+ export default PeerDiscovery ;
Original file line number Diff line number Diff line change 1- export = PeerRouting ;
2-
31import PeerId from 'peer-id'
4- import Multiaddr from 'multiaddr'
2+ import { Multiaddr } from 'multiaddr'
3+
4+ export interface PeerRoutingFactory {
5+ new ( options ?: any ) : PeerRouting ;
6+ }
57
6- declare class PeerRouting {
7- constructor ( options ?: Object ) ;
8+ export interface PeerRouting {
89 findPeer ( peerId : PeerId , options ?: Object ) : Promise < { id : PeerId , multiaddrs : Multiaddr [ ] } > ;
910 getClosestPeers ( key : Uint8Array , options ?: Object ) : AsyncIterable < { id : PeerId , multiaddrs : Multiaddr [ ] } > ;
1011}
12+
13+ export default PeerRouting ;
Original file line number Diff line number Diff line change 11'use strict'
22
33const debug = require ( 'debug' )
4- const EventEmitter = require ( 'events' )
4+ const { EventEmitter } = require ( 'events' )
55const errcode = require ( 'err-code' )
66
77const { pipe } = require ( 'it-pipe' )
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ const debug = require('debug')
44const log = Object . assign ( debug ( 'libp2p-pubsub:peer-streams' ) , {
55 error : debug ( 'libp2p-pubsub:peer-streams:err' )
66} )
7- const EventEmitter = require ( 'events' )
7+ const { EventEmitter } = require ( 'events' )
88
99const lp = require ( 'it-length-prefixed' )
1010const pushable = require ( 'it-pushable' )
Original file line number Diff line number Diff line change 11import BufferList from 'bl'
22import events from 'events'
3- import Multiaddr from 'multiaddr'
3+ import { Multiaddr } from 'multiaddr'
44import Connection from '../connection/connection'
55import { Sink } from '../stream-muxer/types'
66
Original file line number Diff line number Diff line change 1- export type SelectFn = function ( Uint8Array , Uint8Array [ ] ) : number
2- export type ValidateFn = function ( Uint8Array , Uint8Array ) : Promise < void >
1+ export type SelectFn = ( key : Uint8Array , records : Uint8Array [ ] ) => number
2+ export type ValidateFn = ( a : Uint8Array , b : Uint8Array ) => Promise < void >
33
44export type DhtSelectors = { [ key : string ] : SelectFn }
55export type DhtValidators = { [ key : string ] : { func : ValidateFn } }
You can’t perform that action at this time.
0 commit comments