2018-02-07 08:40:53 +00:00
<!doctype html>
2019-12-12 10:43:33 +01:00
< html lang = "en" >
2019-08-21 19:52:04 +02:00
< head >
< meta charset = 'utf-8' >
2019-12-12 10:43:33 +01:00
< title > libp2p 0.27.0-pre.0 | Documentation< / title >
2019-08-21 19:52:04 +02:00
< meta name = 'description' content = 'JavaScript implementation of libp2p, a modular peer to peer network stack' >
< meta name = 'viewport' content = 'width=device-width,initial-scale=1' >
< link href = 'assets/bass.css' rel = 'stylesheet' >
< link href = 'assets/style.css' rel = 'stylesheet' >
< link href = 'assets/github.css' rel = 'stylesheet' >
< link href = 'assets/split.css' rel = 'stylesheet' >
< / head >
< body class = 'documentation m0' >
< div class = 'flex' >
< div id = 'split-left' class = 'overflow-auto fs0 height-viewport-100' >
< div class = 'py1 px2' >
< h3 class = 'mb0 no-anchor' > libp2p< / h3 >
2019-12-12 10:43:33 +01:00
< div class = 'mb1' > < code > 0.27.0-pre.0< / code > < / div >
2019-08-21 19:52:04 +02:00
< input
placeholder='Filter'
id='filter-input'
class='col12 block input'
type='text' />
< div id = 'toc' >
< ul class = 'list-reset h5 py1-ul' >
< li > < a
href='#intro'
class="h5 bold black caps">
Intro
< / a >
< / li >
< li > < a
href='#libp2p'
class=" toggle-sibling">
Libp2p
< span class = 'icon' > ▸< / span >
< / a >
< div class = 'toggle-target display-none' >
< ul class = 'list-reset py1-ul pl1' >
< li class = 'h5' > < span > Instance members< / span > < / li >
< li > < a
href='#libp2pemit'
class='regular pre-open'>
#emit
< / a > < / li >
< li > < a
href='#libp2pstart'
class='regular pre-open'>
#start
< / a > < / li >
< li > < a
href='#libp2pstop'
class='regular pre-open'>
#stop
< / a > < / li >
< li > < a
href='#libp2pdial'
class='regular pre-open'>
#dial
< / a > < / li >
< li > < a
href='#libp2pdialprotocol'
class='regular pre-open'>
#dialProtocol
< / a > < / li >
< li > < a
href='#libp2phangup'
class='regular pre-open'>
#hangUp
< / a > < / li >
< li > < a
href='#libp2pping'
class='regular pre-open'>
#ping
< / a > < / li >
2019-12-12 10:43:33 +01:00
< li > < a
href='#libp2phandle'
class='regular pre-open'>
#handle
< / a > < / li >
< li > < a
href='#libp2punhandle'
class='regular pre-open'>
#unhandle
< / a > < / li >
2019-08-21 19:52:04 +02:00
< / ul >
< / div >
< / li >
< li > < a
2019-12-12 10:43:33 +01:00
href='#index'
2019-08-21 19:52:04 +02:00
class=" toggle-sibling">
2019-12-12 10:43:33 +01:00
index
2019-08-21 19:52:04 +02:00
< span class = 'icon' > ▸< / span >
< / a >
< div class = 'toggle-target display-none' >
2019-12-12 10:43:33 +01:00
< ul class = 'list-reset py1-ul pl1' >
< li class = 'h5' > < span > Static members< / span > < / li >
2019-08-21 19:52:04 +02:00
< li > < a
2019-12-12 10:43:33 +01:00
href='#indexcreate'
2019-08-21 19:52:04 +02:00
class='regular pre-open'>
2019-12-12 10:43:33 +01:00
.create
2019-08-21 19:52:04 +02:00
< / a > < / li >
2019-12-12 10:43:33 +01:00
2019-08-21 19:52:04 +02:00
< li > < a
2019-12-12 10:43:33 +01:00
href='#indexmulticodecs'
2019-08-21 19:52:04 +02:00
class='regular pre-open'>
2019-12-12 10:43:33 +01:00
.multicodecs
2019-08-21 19:52:04 +02:00
< / a > < / li >
2019-12-12 10:43:33 +01:00
2019-08-21 19:52:04 +02:00
< / ul >
2019-12-12 10:43:33 +01:00
< / div >
2019-08-21 19:52:04 +02:00
< / li >
< li > < a
2019-12-12 10:43:33 +01:00
href='#findpeer'
2019-08-21 19:52:04 +02:00
class="">
2019-12-12 10:43:33 +01:00
findPeer
2019-08-21 19:52:04 +02:00
< / a >
< / li >
< li > < a
2019-12-12 10:43:33 +01:00
href='#findproviders'
2019-08-21 19:52:04 +02:00
class="">
2019-12-12 10:43:33 +01:00
findProviders
2019-08-21 19:52:04 +02:00
< / a >
< / li >
< li > < a
2019-12-12 10:43:33 +01:00
href='#provide'
2019-08-21 19:52:04 +02:00
class="">
2019-12-12 10:43:33 +01:00
provide
2019-08-21 19:52:04 +02:00
< / a >
< / li >
< li > < a
2019-12-12 10:43:33 +01:00
href='#put'
2019-08-21 19:52:04 +02:00
class="">
2019-12-12 10:43:33 +01:00
put
2019-08-21 19:52:04 +02:00
< / a >
< / li >
< li > < a
2019-12-12 10:43:33 +01:00
href='#get'
2019-08-21 19:52:04 +02:00
class="">
2019-12-12 10:43:33 +01:00
get
2019-08-21 19:52:04 +02:00
< / a >
< / li >
< li > < a
2019-12-12 10:43:33 +01:00
href='#getmany'
2019-08-21 19:52:04 +02:00
class="">
2019-12-12 10:43:33 +01:00
getMany
2019-08-21 19:52:04 +02:00
< / a >
< / li >
< li > < a
2019-12-12 10:43:33 +01:00
href='#subscribe'
2019-08-21 19:52:04 +02:00
class="">
2019-12-12 10:43:33 +01:00
subscribe
2019-08-21 19:52:04 +02:00
< / a >
< / li >
< li > < a
2019-12-12 10:43:33 +01:00
href='#unsubscribe'
2019-08-21 19:52:04 +02:00
class="">
2019-12-12 10:43:33 +01:00
unsubscribe
2019-08-21 19:52:04 +02:00
< / a >
< / li >
< li > < a
2019-12-12 10:43:33 +01:00
href='#publish'
2019-08-21 19:52:04 +02:00
class="">
2019-12-12 10:43:33 +01:00
publish
2019-08-21 19:52:04 +02:00
< / a >
< / li >
< li > < a
2019-12-12 10:43:33 +01:00
href='#gettopics'
2019-08-21 19:52:04 +02:00
class="">
2019-12-12 10:43:33 +01:00
getTopics
2019-08-21 19:52:04 +02:00
< / a >
< / li >
< li > < a
2019-12-12 10:43:33 +01:00
href='#getsubscribers'
2019-08-21 19:52:04 +02:00
class="">
2019-12-12 10:43:33 +01:00
getSubscribers
2019-08-21 19:52:04 +02:00
< / a >
< / li >
< li > < a
2019-12-12 10:43:33 +01:00
href='#getpeerinfo'
2019-08-21 19:52:04 +02:00
class="">
2019-12-12 10:43:33 +01:00
getPeerInfo
2019-08-21 19:52:04 +02:00
< / a >
< / li >
< li > < a
2019-12-12 10:43:33 +01:00
href='#getpeerinforemote'
2019-08-21 19:52:04 +02:00
class="">
2019-12-12 10:43:33 +01:00
getPeerInfoRemote
2019-08-21 19:52:04 +02:00
< / a >
< / li >
< li > < a
2019-12-12 10:43:33 +01:00
href='#constructor'
2019-08-21 19:52:04 +02:00
class="">
2019-12-12 10:43:33 +01:00
constructor
2019-08-21 19:52:04 +02:00
< / a >
< / li >
< li > < a
2019-12-12 10:43:33 +01:00
href='#start'
2019-08-21 19:52:04 +02:00
class="">
2019-12-12 10:43:33 +01:00
start
2019-08-21 19:52:04 +02:00
< / a >
< / li >
< li > < a
2019-12-12 10:43:33 +01:00
href='#stop'
2019-08-21 19:52:04 +02:00
class="">
2019-12-12 10:43:33 +01:00
stop
2019-08-21 19:52:04 +02:00
< / a >
< / li >
< li > < a
2019-12-12 10:43:33 +01:00
href='#setpeervalue'
2019-08-21 19:52:04 +02:00
class="">
2019-12-12 10:43:33 +01:00
setPeerValue
2019-08-21 19:52:04 +02:00
< / a >
< / li >
< li > < a
2019-12-12 10:43:33 +01:00
href='#onconnect'
2019-08-21 19:52:04 +02:00
class="">
2019-12-12 10:43:33 +01:00
onConnect
2019-08-21 19:52:04 +02:00
< / a >
< / li >
< li > < a
2019-12-12 10:43:33 +01:00
href='#ondisconnect'
2019-08-21 19:52:04 +02:00
class="">
2019-12-12 10:43:33 +01:00
onDisconnect
2019-08-21 19:52:04 +02:00
< / a >
< / li >
< li > < a
href='#constructor'
class="">
constructor
< / a >
< / li >
< li > < a
2019-12-12 10:43:33 +01:00
href='#dial'
2019-08-21 19:52:04 +02:00
class="">
2019-12-12 10:43:33 +01:00
dial
2019-08-21 19:52:04 +02:00
< / a >
< / li >
< li > < a
2019-12-12 10:43:33 +01:00
href='#createlistener'
2019-08-21 19:52:04 +02:00
class="">
2019-12-12 10:43:33 +01:00
createListener
2019-08-21 19:52:04 +02:00
< / a >
< / li >
< li > < a
2019-12-12 10:43:33 +01:00
href='#filter'
2019-08-21 19:52:04 +02:00
class="">
2019-12-12 10:43:33 +01:00
filter
2019-08-21 19:52:04 +02:00
< / a >
< / li >
< li > < a
2019-12-12 10:43:33 +01:00
href='#listener'
2019-08-21 19:52:04 +02:00
class=" toggle-sibling">
2019-12-12 10:43:33 +01:00
listener
2019-08-21 19:52:04 +02:00
< span class = 'icon' > ▸< / span >
< / a >
< div class = 'toggle-target display-none' >
< ul class = 'list-reset py1-ul pl1' >
< li class = 'h5' > < span > Static members< / span > < / li >
< li > < a
2019-12-12 10:43:33 +01:00
href='#listenerlisten'
2019-08-21 19:52:04 +02:00
class='regular pre-open'>
2019-12-12 10:43:33 +01:00
.listen
2019-08-21 19:52:04 +02:00
< / a > < / li >
< li > < a
2019-12-12 10:43:33 +01:00
href='#listenerclose'
2019-08-21 19:52:04 +02:00
class='regular pre-open'>
2019-12-12 10:43:33 +01:00
.close
2019-08-21 19:52:04 +02:00
< / a > < / li >
2019-12-12 10:43:33 +01:00
2019-08-21 19:52:04 +02:00
< li > < a
2019-12-12 10:43:33 +01:00
href='#listenergetaddrs'
2019-08-21 19:52:04 +02:00
class='regular pre-open'>
2019-12-12 10:43:33 +01:00
.getAddrs
2019-08-21 19:52:04 +02:00
< / a > < / li >
2019-12-12 10:43:33 +01:00
2019-08-21 19:52:04 +02:00
< / ul >
2019-12-12 10:43:33 +01:00
2019-08-21 19:52:04 +02:00
< / div >
< / li >
< li > < a
2019-12-12 10:43:33 +01:00
href='#hop'
2019-08-21 19:52:04 +02:00
class="">
2019-12-12 10:43:33 +01:00
hop
2019-08-21 19:52:04 +02:00
< / a >
< / li >
< li > < a
2019-12-12 10:43:33 +01:00
href='#writeresponse'
2019-08-21 19:52:04 +02:00
class="">
2019-12-12 10:43:33 +01:00
writeResponse
2019-08-21 19:52:04 +02:00
< / a >
< / li >
< li > < a
2019-12-12 10:43:33 +01:00
href='#validateaddrs'
class="">
validateAddrs
2019-08-21 19:52:04 +02:00
< / a >
2019-12-12 10:43:33 +01:00
< / li >
< li > < a
href='#constructor'
class="">
constructor
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< / a >
2019-08-21 19:52:04 +02:00
< / li >
< li > < a
2019-12-12 10:43:33 +01:00
href='#read'
class="">
read
2019-08-21 19:52:04 +02:00
< / a >
2019-12-12 10:43:33 +01:00
< / li >
< li > < a
href='#write'
class="">
write
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< / a >
2019-08-21 19:52:04 +02:00
< / li >
< li > < a
2019-12-12 10:43:33 +01:00
href='#rest'
2019-08-21 19:52:04 +02:00
class="">
2019-12-12 10:43:33 +01:00
rest
2019-08-21 19:52:04 +02:00
< / a >
< / li >
< li > < a
2019-12-12 10:43:33 +01:00
href='#close'
2019-08-21 19:52:04 +02:00
class="">
2019-12-12 10:43:33 +01:00
close
2019-08-21 19:52:04 +02:00
< / a >
< / li >
< li > < a
2019-12-12 10:43:33 +01:00
href='#constructor'
2019-08-21 19:52:04 +02:00
class="">
2019-12-12 10:43:33 +01:00
constructor
2019-08-21 19:52:04 +02:00
< / a >
< / li >
< li > < a
2019-12-12 10:43:33 +01:00
href='#destroy'
2019-08-21 19:52:04 +02:00
class="">
2019-12-12 10:43:33 +01:00
destroy
2019-08-21 19:52:04 +02:00
< / a >
< / li >
< li > < a
2019-12-12 10:43:33 +01:00
href='#connecttomultiaddr'
class="">
connectToMultiaddr
2019-08-21 19:52:04 +02:00
< / a >
< / li >
< li > < a
2019-12-12 10:43:33 +01:00
href='#connecttopeer'
2019-08-21 19:52:04 +02:00
class="">
2019-12-12 10:43:33 +01:00
connectToPeer
2019-08-21 19:52:04 +02:00
< / a >
< / li >
< li > < a
2019-12-12 10:43:33 +01:00
href='#constructor'
2019-08-21 19:52:04 +02:00
class="">
2019-12-12 10:43:33 +01:00
constructor
2019-08-21 19:52:04 +02:00
< / a >
< / li >
< li > < a
2019-12-12 10:43:33 +01:00
href='#run'
2019-08-21 19:52:04 +02:00
class="">
2019-12-12 10:43:33 +01:00
run
2019-08-21 19:52:04 +02:00
< / a >
< / li >
< li > < a
2019-12-12 10:43:33 +01:00
href='#constructor'
2019-08-21 19:52:04 +02:00
class="">
2019-12-12 10:43:33 +01:00
constructor
2019-08-21 19:52:04 +02:00
< / a >
< / li >
< li > < a
2019-12-12 10:43:33 +01:00
href='#start'
2019-08-21 19:52:04 +02:00
class="">
2019-12-12 10:43:33 +01:00
start
2019-08-21 19:52:04 +02:00
< / a >
< / li >
< li > < a
2019-12-12 10:43:33 +01:00
href='#stop'
2019-08-21 19:52:04 +02:00
class="">
2019-12-12 10:43:33 +01:00
stop
2019-08-21 19:52:04 +02:00
< / a >
< / li >
< li > < a
2019-12-12 10:43:33 +01:00
href='#global'
2019-08-21 19:52:04 +02:00
class="">
2019-12-12 10:43:33 +01:00
global
2019-08-21 19:52:04 +02:00
< / a >
< / li >
< li > < a
2019-12-12 10:43:33 +01:00
href='#peers'
2019-08-21 19:52:04 +02:00
class="">
2019-12-12 10:43:33 +01:00
peers
2019-08-21 19:52:04 +02:00
< / a >
< / li >
< li > < a
2019-12-12 10:43:33 +01:00
href='#forpeer'
2019-08-21 19:52:04 +02:00
class="">
2019-12-12 10:43:33 +01:00
forPeer
2019-08-21 19:52:04 +02:00
< / a >
< / li >
< li > < a
2019-12-12 10:43:33 +01:00
href='#protocols'
2019-08-21 19:52:04 +02:00
class="">
2019-12-12 10:43:33 +01:00
protocols
2019-08-21 19:52:04 +02:00
< / a >
< / li >
< li > < a
2019-12-12 10:43:33 +01:00
href='#forprotocol'
2019-08-21 19:52:04 +02:00
class="">
2019-12-12 10:43:33 +01:00
forProtocol
2019-08-21 19:52:04 +02:00
< / a >
< / li >
< li > < a
2019-12-12 10:43:33 +01:00
href='#onpeerdisconnected'
2019-08-21 19:52:04 +02:00
class="">
2019-12-12 10:43:33 +01:00
onPeerDisconnected
2019-08-21 19:52:04 +02:00
< / a >
< / li >
< li > < a
2019-12-12 10:43:33 +01:00
href='#updateplaceholder'
2019-08-21 19:52:04 +02:00
class="">
2019-12-12 10:43:33 +01:00
updatePlaceholder
2019-08-21 19:52:04 +02:00
< / a >
< / li >
< li > < a
2019-12-12 10:43:33 +01:00
href='#trackstream'
2019-08-21 19:52:04 +02:00
class="">
2019-12-12 10:43:33 +01:00
trackStream
2019-08-21 19:52:04 +02:00
< / a >
< / li >
< li > < a
2019-12-12 10:43:33 +01:00
href='#mergestats'
2019-08-21 19:52:04 +02:00
class="">
2019-12-12 10:43:33 +01:00
mergeStats
2019-08-21 19:52:04 +02:00
< / a >
< / li >
< li > < a
2019-12-12 10:43:33 +01:00
href='#old-peers'
2019-08-21 19:52:04 +02:00
class="">
2019-12-12 10:43:33 +01:00
old-peers
2019-08-21 19:52:04 +02:00
< / a >
< / li >
< li > < a
2019-12-12 10:43:33 +01:00
href='#stats'
2019-08-21 19:52:04 +02:00
class=" toggle-sibling">
2019-12-12 10:43:33 +01:00
Stats
2019-08-21 19:52:04 +02:00
< span class = 'icon' > ▸< / span >
< / a >
< div class = 'toggle-target display-none' >
< ul class = 'list-reset py1-ul pl1' >
< li class = 'h5' > < span > Instance members< / span > < / li >
< li > < a
2019-12-12 10:43:33 +01:00
href='#statsstart'
2019-08-21 19:52:04 +02:00
class='regular pre-open'>
2019-12-12 10:43:33 +01:00
#start
2019-08-21 19:52:04 +02:00
< / a > < / li >
< li > < a
2019-12-12 10:43:33 +01:00
href='#statsstop'
2019-08-21 19:52:04 +02:00
class='regular pre-open'>
2019-12-12 10:43:33 +01:00
#stop
2019-08-21 19:52:04 +02:00
< / a > < / li >
< li > < a
2019-12-12 10:43:33 +01:00
href='#statssnapshot'
2019-08-21 19:52:04 +02:00
class='regular pre-open'>
2019-12-12 10:43:33 +01:00
#snapshot
2019-08-21 19:52:04 +02:00
< / a > < / li >
< li > < a
2019-12-12 10:43:33 +01:00
href='#statsmovingaverages'
2019-08-21 19:52:04 +02:00
class='regular pre-open'>
2019-12-12 10:43:33 +01:00
#movingAverages
2019-08-21 19:52:04 +02:00
< / a > < / li >
< li > < a
2019-12-12 10:43:33 +01:00
href='#statstojson'
2019-08-21 19:52:04 +02:00
class='regular pre-open'>
2019-12-12 10:43:33 +01:00
#toJSON
2019-08-21 19:52:04 +02:00
< / a > < / li >
< li > < a
2019-12-12 10:43:33 +01:00
href='#statspush'
2019-08-21 19:52:04 +02:00
class='regular pre-open'>
2019-12-12 10:43:33 +01:00
#push
2019-08-21 19:52:04 +02:00
< / a > < / li >
< / ul >
< / div >
< / li >
< li > < a
2019-12-12 10:43:33 +01:00
href='#constructor'
2019-08-21 19:52:04 +02:00
class="">
2019-12-12 10:43:33 +01:00
constructor
2019-08-21 19:52:04 +02:00
< / a >
< / li >
< li > < a
2019-12-12 10:43:33 +01:00
href='#add'
2019-08-21 19:52:04 +02:00
class="">
2019-12-12 10:43:33 +01:00
add
2019-08-21 19:52:04 +02:00
< / a >
< / li >
< li > < a
href='#close'
class="">
close
< / a >
< / li >
< li > < a
2019-12-12 10:43:33 +01:00
href='#dial'
2019-08-21 19:52:04 +02:00
class="">
2019-12-12 10:43:33 +01:00
dial
2019-08-21 19:52:04 +02:00
< / a >
< / li >
< li > < a
2019-12-12 10:43:33 +01:00
href='#getaddrs'
2019-08-21 19:52:04 +02:00
class="">
2019-12-12 10:43:33 +01:00
getAddrs
2019-08-21 19:52:04 +02:00
< / a >
< / li >
< li > < a
2019-12-12 10:43:33 +01:00
href='#gettransports'
2019-08-21 19:52:04 +02:00
class="">
2019-12-12 10:43:33 +01:00
getTransports
2019-08-21 19:52:04 +02:00
< / a >
< / li >
< li > < a
2019-12-12 10:43:33 +01:00
href='#transportformultiaddr'
2019-08-21 19:52:04 +02:00
class="">
2019-12-12 10:43:33 +01:00
transportForMultiaddr
2019-08-21 19:52:04 +02:00
< / a >
< / li >
< li > < a
2019-12-12 10:43:33 +01:00
href='#listen'
2019-08-21 19:52:04 +02:00
class="">
2019-12-12 10:43:33 +01:00
listen
2019-08-21 19:52:04 +02:00
< / a >
< / li >
< li > < a
2019-12-12 10:43:33 +01:00
href='#remove'
2019-08-21 19:52:04 +02:00
class="">
2019-12-12 10:43:33 +01:00
remove
2019-08-21 19:52:04 +02:00
< / a >
< / li >
< li > < a
2019-12-12 10:43:33 +01:00
href='#removeall'
2019-08-21 19:52:04 +02:00
class="">
2019-12-12 10:43:33 +01:00
removeAll
2019-08-21 19:52:04 +02:00
< / a >
< / li >
< li > < a
2019-12-12 10:43:33 +01:00
href='#upgrader'
class=" toggle-sibling">
Upgrader
< span class = 'icon' > ▸< / span >
2019-08-21 19:52:04 +02:00
< / a >
2019-12-12 10:43:33 +01:00
< div class = 'toggle-target display-none' >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< ul class = 'list-reset py1-ul pl1' >
< li class = 'h5' > < span > Instance members< / span > < / li >
< li > < a
href='#upgraderupgradeinbound'
class='regular pre-open'>
#upgradeInbound
< / a > < / li >
< li > < a
href='#upgraderupgradeoutbound'
class='regular pre-open'>
#upgradeOutbound
< / a > < / li >
< / ul >
< / div >
2019-08-21 19:52:04 +02:00
< / li >
< li > < a
2019-12-12 10:43:33 +01:00
href='#upgrader'
class=" toggle-sibling">
Upgrader
< span class = 'icon' > ▸< / span >
< / a >
< div class = 'toggle-target display-none' >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< ul class = 'list-reset py1-ul pl1' >
< li class = 'h5' > < span > Instance members< / span > < / li >
< li > < a
href='#upgraderupgradeinbound'
class='regular pre-open'>
#upgradeInbound
< / a > < / li >
< li > < a
href='#upgraderupgradeoutbound'
class='regular pre-open'>
#upgradeOutbound
< / a > < / li >
< / ul >
< / div >
2019-08-21 19:52:04 +02:00
< / li >
< li > < a
2019-12-12 10:43:33 +01:00
href='#peerstore'
2019-08-21 19:52:04 +02:00
class=" toggle-sibling">
2019-12-12 10:43:33 +01:00
PeerStore
2019-08-21 19:52:04 +02:00
< span class = 'icon' > ▸< / span >
< / a >
< div class = 'toggle-target display-none' >
< ul class = 'list-reset py1-ul pl1' >
< li class = 'h5' > < span > Instance members< / span > < / li >
< li > < a
2019-12-12 10:43:33 +01:00
href='#peerstorepeers'
2019-08-21 19:52:04 +02:00
class='regular pre-open'>
2019-12-12 10:43:33 +01:00
#peers
2019-08-21 19:52:04 +02:00
< / a > < / li >
< li > < a
2019-12-12 10:43:33 +01:00
href='#peerstoreput'
2019-08-21 19:52:04 +02:00
class='regular pre-open'>
2019-12-12 10:43:33 +01:00
#put
2019-08-21 19:52:04 +02:00
< / a > < / li >
< li > < a
2019-12-12 10:43:33 +01:00
href='#peerstoreadd'
2019-08-21 19:52:04 +02:00
class='regular pre-open'>
2019-12-12 10:43:33 +01:00
#add
2019-08-21 19:52:04 +02:00
< / a > < / li >
< li > < a
2019-12-12 10:43:33 +01:00
href='#peerstoreupdate'
2019-08-21 19:52:04 +02:00
class='regular pre-open'>
2019-12-12 10:43:33 +01:00
#update
2019-08-21 19:52:04 +02:00
< / a > < / li >
< li > < a
2019-12-12 10:43:33 +01:00
href='#peerstoreget'
2019-08-21 19:52:04 +02:00
class='regular pre-open'>
2019-12-12 10:43:33 +01:00
#get
< / a > < / li >
< li > < a
href='#peerstorehas'
class='regular pre-open'>
#has
< / a > < / li >
< li > < a
href='#peerstoreremove'
class='regular pre-open'>
#remove
< / a > < / li >
< li > < a
href='#peerstorereplace'
class='regular pre-open'>
#replace
< / a > < / li >
< li > < a
href='#peerstoremultiaddrsforpeer'
class='regular pre-open'>
#multiaddrsForPeer
2019-08-21 19:52:04 +02:00
< / a > < / li >
< / ul >
< / div >
< / li >
< li > < a
2019-12-12 10:43:33 +01:00
href='#registrar'
class=" toggle-sibling">
Registrar
< span class = 'icon' > ▸< / span >
2019-08-21 19:52:04 +02:00
< / a >
2019-12-12 10:43:33 +01:00
< div class = 'toggle-target display-none' >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< ul class = 'list-reset py1-ul pl1' >
< li class = 'h5' > < span > Instance members< / span > < / li >
< li > < a
href='#registrarconnections'
class='regular pre-open'>
#connections
< / a > < / li >
< li > < a
href='#registrartopologies'
class='regular pre-open'>
#topologies
< / a > < / li >
< li > < a
href='#registrarclose'
class='regular pre-open'>
#close
< / a > < / li >
< li > < a
href='#registraronconnect'
class='regular pre-open'>
#onConnect
< / a > < / li >
< li > < a
href='#registrarondisconnect'
class='regular pre-open'>
#onDisconnect
< / a > < / li >
< li > < a
href='#registrargetconnection'
class='regular pre-open'>
#getConnection
< / a > < / li >
< li > < a
href='#registrarregister'
class='regular pre-open'>
#register
< / a > < / li >
< li > < a
href='#registrarunregister'
class='regular pre-open'>
#unregister
< / a > < / li >
< / ul >
< / div >
< / li >
< li > < a
href='#ping'
class="">
ping
2019-08-21 19:52:04 +02:00
< / a >
< / li >
< li > < a
2019-12-12 10:43:33 +01:00
href='#mount'
2019-08-21 19:52:04 +02:00
class="">
2019-12-12 10:43:33 +01:00
mount
2019-08-21 19:52:04 +02:00
< / a >
< / li >
< li > < a
2019-12-12 10:43:33 +01:00
href='#unmount'
2019-08-21 19:52:04 +02:00
class="">
2019-12-12 10:43:33 +01:00
unmount
2019-08-21 19:52:04 +02:00
< / a >
< / li >
< li > < a
2019-12-12 10:43:33 +01:00
href='#constructor'
2019-08-21 19:52:04 +02:00
class="">
2019-12-12 10:43:33 +01:00
constructor
2019-08-21 19:52:04 +02:00
< / a >
< / li >
< li > < a
2019-12-12 10:43:33 +01:00
href='#registrar'
2019-08-21 19:52:04 +02:00
class="">
2019-12-12 10:43:33 +01:00
registrar
< / a >
< / li >
< li > < a
href='#peerinfo'
class="">
peerInfo
< / a >
< / li >
< li > < a
href='#push'
class="">
push
< / a >
< / li >
< li > < a
href='#pushtopeerstore'
class="">
pushToPeerStore
< / a >
< / li >
< li > < a
href='#identify'
class="">
identify
< / a >
< / li >
< li > < a
href='#handlemessage'
class="">
handleMessage
< / a >
< / li >
< li > < a
href='#updatepeeraddresses'
class="">
updatePeerAddresses
< / a >
< / li >
< li > < a
href='#updatepeerprotocols'
class="">
updatePeerProtocols
< / a >
< / li >
< li > < a
href='#getcleanmultiaddr'
class="">
getCleanMultiaddr
2019-08-21 19:52:04 +02:00
< / a >
< / li >
< / ul >
< / div >
< div class = 'mt1 h6 quiet' >
< a href = 'https://documentation.js.org/reading-documentation.html' > Need help reading this?< / a >
< / div >
< / div >
< / div >
< div id = 'split-right' class = 'relative overflow-auto height-viewport-100' >
< div class = 'keyline-top-not py2' > < section class = 'py2 clearfix' >
< h2 id = 'intro' class = 'mt0' >
Intro
< / h2 >
< p > Installable via < code > npm install --save libp2p< / code > , it can also be used directly in the browser.< / p >
2018-02-07 08:40:53 +00:00
< h2 > Download< / h2 >
< p > The source is available for download from < a href = "https://github.com/libp2p/js-libp2p.git" > GitHub< / a > . Alternatively, you can install using npm:< / p >
< pre class = 'hljs' > $ npm install --save libp2p< / pre >
< p > You can then < code > require()< / code > libp2p as normal:< / p >
< pre class = 'hljs' > < span class = "hljs-keyword" > const< / span > libp2P = < span class = "hljs-built_in" > require< / span > (< span class = "hljs-string" > 'libp2p'< / span > )< / pre >
< h2 > In the Browser< / h2 >
< p > Libp2p should work in any ES2015 environment out of the box.< / p >
< p > Usage:< / p >
2019-06-07 17:10:19 +02:00
< pre class = 'hljs' > < span class = "hljs-tag" > < < span class = "hljs-name" > script< / span > < span class = "hljs-attr" > type< / span > =< span class = "hljs-string" > "text/javascript"< / span > < span class = "hljs-attr" > src< / span > =< span class = "hljs-string" > "index.js"< / span > > < / span > < span class = "hljs-tag" > < /< span class = "hljs-name" > script< / span > > < / span > < / pre >
2018-11-16 14:12:15 +01:00
< p > The portable versions of libp2p, including < code > index.js< / code > and < code > index.min.js< / code > , are included in the < code > /dist< / code > folder. Libp2p can also be found on < a href = "https://unpkg.com" > unpkg.com< / a > under< / p >
2018-02-07 08:40:53 +00:00
< ul >
< li > < a href = "https://unpkg.com/libp2p/dist/index.min.js" > https://unpkg.com/libp2p/dist/index.min.js< / a > < / li >
< li > < a href = "https://unpkg.com/libp2p/dist/index.js" > https://unpkg.com/libp2p/dist/index.js< / a > < / li >
< / ul >
2019-08-21 19:52:04 +02:00
< / section > < / div >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
< div class = 'clearfix' >
< h3 class = 'fl m0' id = 'libp2p' >
Libp2p
< / h3 >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/index.js#L38-L490' >
2019-08-21 19:52:04 +02:00
< span > src/index.js< / span >
< / a >
< / div >
< div class = 'pre p1 fill-light mt0' > new Libp2p(_options: any)< / div >
< p >
Extends
EventEmitter
< / p >
< div class = 'py1 quiet mt1 prose-big' > Parameters< / div >
< div class = 'prose' >
< div class = 'space-bottom0' >
< div >
< span class = 'code bold' > _options< / span > < code class = 'quiet' > (any)< / code >
< / div >
< / div >
< / div >
< div class = 'py1 quiet mt1 prose-big' > Instance Members< / div >
< div class = "clearfix" >
< div class = 'border-bottom' id = 'libp2pemit' >
< div class = "clearfix small pointer toggle-sibling" >
< div class = "py1 contain" >
< a class = 'icon pin-right py1 dark-link caret-right' > ▸< / a >
< span class = 'code strong strong truncate' > emit(eventName, args)< / span >
< / div >
< / div >
< div class = "clearfix display-none toggle-target" >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/index.js#L181-L187' >
2019-08-21 19:52:04 +02:00
< span > src/index.js< / span >
< / a >
< / div >
< p > Overrides EventEmitter.emit to conditionally emit errors
2018-11-16 14:12:15 +01:00
if there is a handler. If not, errors will be logged.< / p >
2019-08-21 19:52:04 +02:00
< div class = 'pre p1 fill-light mt0' > emit(eventName: < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String" > string< / a > , args: ...any): void< / div >
< div class = 'py1 quiet mt1 prose-big' > Parameters< / div >
< div class = 'prose' >
< div class = 'space-bottom0' >
< div >
< span class = 'code bold' > eventName< / span > < code class = 'quiet' > (< a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String" > string< / a > )< / code >
< / div >
< / div >
< div class = 'space-bottom0' >
< div >
< span class = 'code bold' > args< / span > < code class = 'quiet' > (...any)< / code >
< / div >
< / div >
< / div >
< div class = 'py1 quiet mt1 prose-big' > Returns< / div >
< code > void< / code > :
< / section >
< / div >
< / div >
< div class = 'border-bottom' id = 'libp2pstart' >
< div class = "clearfix small pointer toggle-sibling" >
< div class = "py1 contain" >
< a class = 'icon pin-right py1 dark-link caret-right' > ▸< / a >
2019-12-12 10:43:33 +01:00
< span class = 'code strong strong truncate' > start()< / span >
2019-08-21 19:52:04 +02:00
< / div >
< / div >
< div class = "clearfix display-none toggle-target" >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/index.js#L194-L206' >
2019-08-21 19:52:04 +02:00
< span > src/index.js< / span >
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Starts the libp2p node and all its subsystems< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > start(): < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise" > Promise< / a > < void>< / div >
2019-08-21 19:52:04 +02:00
< div class = 'py1 quiet mt1 prose-big' > Returns< / div >
2019-12-12 10:43:33 +01:00
< code > < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise" > Promise< / a > < void>< / code > :
2019-08-21 19:52:04 +02:00
< / section >
< / div >
< / div >
< div class = 'border-bottom' id = 'libp2pstop' >
< div class = "clearfix small pointer toggle-sibling" >
< div class = "py1 contain" >
< a class = 'icon pin-right py1 dark-link caret-right' > ▸< / a >
2019-12-12 10:43:33 +01:00
< span class = 'code strong strong truncate' > stop()< / span >
2019-08-21 19:52:04 +02:00
< / div >
< / div >
< div class = "clearfix display-none toggle-target" >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/index.js#L213-L237' >
2019-08-21 19:52:04 +02:00
< span > src/index.js< / span >
< / a >
< / div >
< p > Stop the libp2p node by closing its listeners and open connections< / p >
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > stop(): void< / div >
2019-08-21 19:52:04 +02:00
< div class = 'py1 quiet mt1 prose-big' > Returns< / div >
< code > void< / code > :
< / section >
< / div >
< / div >
< div class = 'border-bottom' id = 'libp2pdial' >
< div class = "clearfix small pointer toggle-sibling" >
< div class = "py1 contain" >
< a class = 'icon pin-right py1 dark-link caret-right' > ▸< / a >
2019-12-12 10:43:33 +01:00
< span class = 'code strong strong truncate' > dial(peer, options)< / span >
2019-08-21 19:52:04 +02:00
< / div >
< / div >
< div class = "clearfix display-none toggle-target" >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/index.js#L252-L254' >
2019-08-21 19:52:04 +02:00
< span > src/index.js< / span >
< / a >
< / div >
< p > Dials to the provided peer. If successful, the < code > PeerInfo< / code > of the
2019-12-12 10:43:33 +01:00
peer will be added to the nodes < code > peerStore< / code > < / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > dial(peer: (PeerInfo | PeerId | Multiaddr | < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String" > string< / a > ), options: < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object" > object< / a > ): < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise" > Promise< / a > < Connection>< / div >
2019-08-21 19:52:04 +02:00
< div class = 'py1 quiet mt1 prose-big' > Parameters< / div >
< div class = 'prose' >
< div class = 'space-bottom0' >
< div >
< span class = 'code bold' > peer< / span > < code class = 'quiet' > ((PeerInfo | PeerId | Multiaddr | < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String" > string< / a > ))< / code >
The peer to dial
< / div >
< / div >
< div class = 'space-bottom0' >
< div >
2019-12-12 10:43:33 +01:00
< span class = 'code bold' > options< / span > < code class = 'quiet' > (< a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object" > object< / a > )< / code >
2019-08-21 19:52:04 +02:00
< / div >
2019-12-12 10:43:33 +01:00
< table class = 'mt1 mb2 fixed-table h5 col-12' >
< colgroup >
< col width = '30%' / >
< col width = '70%' / >
< / colgroup >
< thead >
< tr class = 'bold fill-light' >
< th > Name< / th >
< th > Description< / th >
< / tr >
< / thead >
< tbody class = 'mt1' >
< tr >
< td class = 'break-word' > < span class = 'code bold' > options.signal< / span > < code class = 'quiet' > AbortSignal?< / code >
< / td >
< td class = 'break-word' > < span > < / span > < / td >
< / tr >
< / tbody >
< / table >
2019-08-21 19:52:04 +02:00
< / div >
< / div >
< div class = 'py1 quiet mt1 prose-big' > Returns< / div >
2019-12-12 10:43:33 +01:00
< code > < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise" > Promise< / a > < Connection>< / code > :
2019-08-21 19:52:04 +02:00
< / section >
< / div >
< / div >
< div class = 'border-bottom' id = 'libp2pdialprotocol' >
< div class = "clearfix small pointer toggle-sibling" >
< div class = "py1 contain" >
< a class = 'icon pin-right py1 dark-link caret-right' > ▸< / a >
2019-12-12 10:43:33 +01:00
< span class = 'code strong strong truncate' > dialProtocol(peer, protocols, options)< / span >
2019-08-21 19:52:04 +02:00
< / div >
< / div >
< div class = "clearfix display-none toggle-target" >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/index.js#L268-L291' >
2019-08-21 19:52:04 +02:00
< span > src/index.js< / span >
< / a >
< / div >
< p > Dials to the provided peer and handshakes with the given protocol.
2019-12-12 10:43:33 +01:00
If successful, the < code > PeerInfo< / code > of the peer will be added to the nodes < code > peerStore< / code > ,
2018-11-16 14:12:15 +01:00
and the < code > Connection< / code > will be sent in the callback< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > dialProtocol(peer: (PeerInfo | PeerId | Multiaddr | < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String" > string< / a > ), protocols: (< a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array" > Array< / a > < < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String" > string< / a > > | < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String" > string< / a > ), options: < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object" > object< / a > ): < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise" > Promise< / a > < (Connection | any)>< / div >
2019-08-21 19:52:04 +02:00
< div class = 'py1 quiet mt1 prose-big' > Parameters< / div >
< div class = 'prose' >
< div class = 'space-bottom0' >
< div >
< span class = 'code bold' > peer< / span > < code class = 'quiet' > ((PeerInfo | PeerId | Multiaddr | < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String" > string< / a > ))< / code >
The peer to dial
< / div >
< / div >
< div class = 'space-bottom0' >
< div >
2019-12-12 10:43:33 +01:00
< span class = 'code bold' > protocols< / span > < code class = 'quiet' > ((< a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array" > Array< / a > < < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String" > string< / a > > | < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String" > string< / a > ))< / code >
2019-08-21 19:52:04 +02:00
< / div >
< / div >
< div class = 'space-bottom0' >
< div >
2019-12-12 10:43:33 +01:00
< span class = 'code bold' > options< / span > < code class = 'quiet' > (< a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object" > object< / a > )< / code >
2019-08-21 19:52:04 +02:00
< / div >
2019-12-12 10:43:33 +01:00
< table class = 'mt1 mb2 fixed-table h5 col-12' >
< colgroup >
< col width = '30%' / >
< col width = '70%' / >
< / colgroup >
< thead >
< tr class = 'bold fill-light' >
< th > Name< / th >
< th > Description< / th >
< / tr >
< / thead >
< tbody class = 'mt1' >
< tr >
< td class = 'break-word' > < span class = 'code bold' > options.signal< / span > < code class = 'quiet' > AbortSignal?< / code >
< / td >
< td class = 'break-word' > < span > < / span > < / td >
< / tr >
< / tbody >
< / table >
2019-08-21 19:52:04 +02:00
< / div >
< / div >
< div class = 'py1 quiet mt1 prose-big' > Returns< / div >
2019-12-12 10:43:33 +01:00
< code > < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise" > Promise< / a > < (Connection | any)>< / code > :
2019-08-21 19:52:04 +02:00
< / section >
< / div >
< / div >
2019-12-12 10:43:33 +01:00
< div class = 'border-bottom' id = 'libp2phangup' >
2019-08-21 19:52:04 +02:00
< div class = "clearfix small pointer toggle-sibling" >
< div class = "py1 contain" >
< a class = 'icon pin-right py1 dark-link caret-right' > ▸< / a >
2019-12-12 10:43:33 +01:00
< span class = 'code strong strong truncate' > hangUp(peer)< / span >
2019-08-21 19:52:04 +02:00
< / div >
< / div >
< div class = "clearfix display-none toggle-target" >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/index.js#L299-L305' >
2019-08-21 19:52:04 +02:00
< span > src/index.js< / span >
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Disconnects all connections to the given < code > peer< / code > < / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > hangUp(peer: PeerId): < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise" > Promise< / a > < void>< / div >
2019-08-21 19:52:04 +02:00
< div class = 'py1 quiet mt1 prose-big' > Parameters< / div >
< div class = 'prose' >
< div class = 'space-bottom0' >
< div >
2019-12-12 10:43:33 +01:00
< span class = 'code bold' > peer< / span > < code class = 'quiet' > (PeerId)< / code >
The PeerId to close connections to
2019-08-21 19:52:04 +02:00
< / div >
< / div >
< / div >
< div class = 'py1 quiet mt1 prose-big' > Returns< / div >
2019-12-12 10:43:33 +01:00
< code > < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise" > Promise< / a > < void>< / code > :
2019-08-21 19:52:04 +02:00
< / section >
< / div >
< / div >
2019-12-12 10:43:33 +01:00
< div class = 'border-bottom' id = 'libp2pping' >
2019-08-21 19:52:04 +02:00
< div class = "clearfix small pointer toggle-sibling" >
< div class = "py1 contain" >
< a class = 'icon pin-right py1 dark-link caret-right' > ▸< / a >
2019-12-12 10:43:33 +01:00
< span class = 'code strong strong truncate' > ping(peer)< / span >
2019-08-21 19:52:04 +02:00
< / div >
< / div >
< div class = "clearfix display-none toggle-target" >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/index.js#L312-L316' >
2019-08-21 19:52:04 +02:00
< span > src/index.js< / span >
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Pings the given peer< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > ping(peer: (PeerInfo | PeerId | Multiaddr | < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String" > string< / a > )): < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise" > Promise< / a > < < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number" > number< / a > >< / div >
2019-08-21 19:52:04 +02:00
< div class = 'py1 quiet mt1 prose-big' > Parameters< / div >
< div class = 'prose' >
< div class = 'space-bottom0' >
< div >
< span class = 'code bold' > peer< / span > < code class = 'quiet' > ((PeerInfo | PeerId | Multiaddr | < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String" > string< / a > ))< / code >
The peer to ping
< / div >
< / div >
< / div >
< div class = 'py1 quiet mt1 prose-big' > Returns< / div >
2019-12-12 10:43:33 +01:00
< code > < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise" > Promise< / a > < < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number" > number< / a > >< / code > :
2019-08-21 19:52:04 +02:00
< / section >
< / div >
< / div >
2019-12-12 10:43:33 +01:00
< div class = 'border-bottom' id = 'libp2phandle' >
2019-08-21 19:52:04 +02:00
< div class = "clearfix small pointer toggle-sibling" >
< div class = "py1 contain" >
< a class = 'icon pin-right py1 dark-link caret-right' > ▸< / a >
2019-12-12 10:43:33 +01:00
< span class = 'code strong strong truncate' > handle(protocols, handler)< / span >
2019-08-21 19:52:04 +02:00
< / div >
< / div >
< div class = "clearfix display-none toggle-target" >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/index.js#L323-L333' >
2019-08-21 19:52:04 +02:00
< span > src/index.js< / span >
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Registers the < code > handler< / code > for each protocol< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > handle(protocols: (< a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array" > Array< / a > < < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String" > string< / a > > | < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String" > string< / a > ), handler: function ({connection: any, stream: any, protocol: < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String" > string< / a > }))< / div >
2019-08-21 19:52:04 +02:00
< div class = 'py1 quiet mt1 prose-big' > Parameters< / div >
< div class = 'prose' >
< div class = 'space-bottom0' >
< div >
2019-12-12 10:43:33 +01:00
< span class = 'code bold' > protocols< / span > < code class = 'quiet' > ((< a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array" > Array< / a > < < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String" > string< / a > > | < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String" > string< / a > ))< / code >
2019-08-21 19:52:04 +02:00
< / div >
< / div >
< div class = 'space-bottom0' >
< div >
2019-12-12 10:43:33 +01:00
< span class = 'code bold' > handler< / span > < code class = 'quiet' > (function ({connection: any, stream: any, protocol: < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String" > string< / a > }))< / code >
2019-08-21 19:52:04 +02:00
< / div >
< / div >
< / div >
< / section >
< / div >
< / div >
2019-12-12 10:43:33 +01:00
< div class = 'border-bottom' id = 'libp2punhandle' >
< div class = "clearfix small pointer toggle-sibling" >
< div class = "py1 contain" >
< a class = 'icon pin-right py1 dark-link caret-right' > ▸< / a >
< span class = 'code strong strong truncate' > unhandle(protocols)< / span >
< / div >
< / div >
< div class = "clearfix display-none toggle-target" >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
2019-08-21 19:52:04 +02:00
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/index.js#L340-L350' >
2019-08-21 19:52:04 +02:00
< span > src/index.js< / span >
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Removes the handler for each protocol. The protocol
will no longer be supported on streams.< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > unhandle(protocols: (< a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array" > Array< / a > < < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String" > string< / a > > | < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String" > string< / a > ))< / div >
2019-08-21 19:52:04 +02:00
< div class = 'py1 quiet mt1 prose-big' > Parameters< / div >
< div class = 'prose' >
< div class = 'space-bottom0' >
< div >
2019-12-12 10:43:33 +01:00
< span class = 'code bold' > protocols< / span > < code class = 'quiet' > ((< a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array" > Array< / a > < < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String" > string< / a > > | < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String" > string< / a > ))< / code >
2019-08-21 19:52:04 +02:00
< / div >
< / div >
< / div >
2019-12-12 10:43:33 +01:00
< / section >
< / div >
< / div >
< / div >
2019-08-21 19:52:04 +02:00
< / section >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< h3 class = 'fl m0' id = 'index' >
index
2019-08-21 19:52:04 +02:00
< / h3 >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/circuit/index.js#L186-L186' >
< span > src/circuit/index.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > index< / div >
2019-08-21 19:52:04 +02:00
< p >
2019-12-12 10:43:33 +01:00
Type:
Circuit
2019-08-21 19:52:04 +02:00
< / p >
2019-12-12 10:43:33 +01:00
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'py1 quiet mt1 prose-big' > Static Members< / div >
2019-08-21 19:52:04 +02:00
< div class = "clearfix" >
2019-12-12 10:43:33 +01:00
< div class = 'border-bottom' id = 'indexcreate' >
2019-08-21 19:52:04 +02:00
< div class = "clearfix small pointer toggle-sibling" >
< div class = "py1 contain" >
< a class = 'icon pin-right py1 dark-link caret-right' > ▸< / a >
2019-12-12 10:43:33 +01:00
< span class = 'code strong strong truncate' > create(options)< / span >
2019-08-21 19:52:04 +02:00
< / div >
< / div >
< div class = "clearfix display-none toggle-target" >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/index.js#L499-L508' >
< span > src/index.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Like < code > new Libp2p(options)< / code > except it will create a < code > PeerInfo< / code >
instance if one is not provided in options.< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > create(options: < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object" > object< / a > ): < a href = "#libp2p" > Libp2p< / a > < / div >
2019-08-21 19:52:04 +02:00
< div class = 'py1 quiet mt1 prose-big' > Parameters< / div >
< div class = 'prose' >
< div class = 'space-bottom0' >
< div >
2019-12-12 10:43:33 +01:00
< span class = 'code bold' > options< / span > < code class = 'quiet' > (< a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object" > object< / a >
= < code > {}< / code > )< / code >
Libp2p configuration options
2019-08-21 19:52:04 +02:00
< / div >
< / div >
< / div >
< div class = 'py1 quiet mt1 prose-big' > Returns< / div >
2019-12-12 10:43:33 +01:00
< code > < a href = "#libp2p" > Libp2p< / a > < / code > :
2019-08-21 19:52:04 +02:00
< / section >
< / div >
< / div >
2019-12-12 10:43:33 +01:00
< div class = 'border-bottom' id = 'indexmulticodecs' >
2019-08-21 19:52:04 +02:00
< div class = "clearfix small pointer toggle-sibling" >
< div class = "py1 contain" >
< a class = 'icon pin-right py1 dark-link caret-right' > ▸< / a >
2019-12-12 10:43:33 +01:00
< span class = 'code strong strong truncate' > multicodecs< / span >
2019-08-21 19:52:04 +02:00
< / div >
< / div >
< div class = "clearfix display-none toggle-target" >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/identify/index.js#L294-L297' >
< span > src/identify/index.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > The protocols the IdentifyService supports< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > multicodecs< / div >
2019-08-21 19:52:04 +02:00
< / section >
< / div >
< / div >
2019-12-12 10:43:33 +01:00
< / div >
< / section >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
2019-08-21 19:52:04 +02:00
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< h3 class = 'fl m0' id = 'findpeer' >
findPeer
< / h3 >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/peer-routing.js#L23-L38' >
< span > src/peer-routing.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Iterates over all peer routers in series to find the given peer.< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > findPeer(id: < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String" > String< / a > , options: < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object" > object< / a > ?): < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise" > Promise< / a > < PeerInfo>< / div >
2019-08-21 19:52:04 +02:00
< div class = 'py1 quiet mt1 prose-big' > Parameters< / div >
< div class = 'prose' >
< div class = 'space-bottom0' >
< div >
2019-12-12 10:43:33 +01:00
< span class = 'code bold' > id< / span > < code class = 'quiet' > (< a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String" > String< / a > )< / code >
The id of the peer to find
< / div >
< / div >
< div class = 'space-bottom0' >
< div >
< span class = 'code bold' > options< / span > < code class = 'quiet' > (< a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object" > object< / a > ?)< / code >
2019-08-21 19:52:04 +02:00
< / div >
2019-12-12 10:43:33 +01:00
< table class = 'mt1 mb2 fixed-table h5 col-12' >
< colgroup >
< col width = '30%' / >
< col width = '70%' / >
< / colgroup >
< thead >
< tr class = 'bold fill-light' >
< th > Name< / th >
< th > Description< / th >
< / tr >
< / thead >
< tbody class = 'mt1' >
< tr >
< td class = 'break-word' > < span class = 'code bold' > options.timeout< / span > < code class = 'quiet' > < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number" > number< / a > ?< / code >
< / td >
< td class = 'break-word' > < span > How long the query should run
< / span > < / td >
< / tr >
< / tbody >
< / table >
2019-08-21 19:52:04 +02:00
< / div >
< / div >
< div class = 'py1 quiet mt1 prose-big' > Returns< / div >
2019-12-12 10:43:33 +01:00
< code > < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise" > Promise< / a > < PeerInfo>< / code > :
2019-08-21 19:52:04 +02:00
< / section >
2019-12-12 10:43:33 +01:00
< section class = 'p2 mb2 clearfix bg-white minishadow' >
2019-08-21 19:52:04 +02:00
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< h3 class = 'fl m0' id = 'findproviders' >
findProviders
< / h3 >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/content-routing.js#L29-L48' >
< span > src/content-routing.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Iterates over all content routers in series to find providers of the given key.
Once a content router succeeds, iteration will stop.< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > findProviders(key: CID, options: < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object" > object< / a > ?): AsyncIterable< PeerInfo>< / div >
2019-08-21 19:52:04 +02:00
< div class = 'py1 quiet mt1 prose-big' > Parameters< / div >
< div class = 'prose' >
< div class = 'space-bottom0' >
< div >
2019-12-12 10:43:33 +01:00
< span class = 'code bold' > key< / span > < code class = 'quiet' > (CID)< / code >
The CID key of the content to find
2019-08-21 19:52:04 +02:00
< / div >
< / div >
< div class = 'space-bottom0' >
< div >
2019-12-12 10:43:33 +01:00
< span class = 'code bold' > options< / span > < code class = 'quiet' > (< a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object" > object< / a > ?)< / code >
2019-08-21 19:52:04 +02:00
< / div >
2019-12-12 10:43:33 +01:00
< table class = 'mt1 mb2 fixed-table h5 col-12' >
< colgroup >
< col width = '30%' / >
< col width = '70%' / >
< / colgroup >
< thead >
< tr class = 'bold fill-light' >
< th > Name< / th >
< th > Description< / th >
< / tr >
< / thead >
< tbody class = 'mt1' >
< tr >
< td class = 'break-word' > < span class = 'code bold' > options.timeout< / span > < code class = 'quiet' > < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number" > number< / a > ?< / code >
< / td >
< td class = 'break-word' > < span > How long the query should run
< / span > < / td >
< / tr >
< tr >
< td class = 'break-word' > < span class = 'code bold' > options.maxNumProviders< / span > < code class = 'quiet' > < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number" > number< / a > ?< / code >
< / td >
< td class = 'break-word' > < span > maximum number of providers to find
< / span > < / td >
< / tr >
< / tbody >
< / table >
2019-08-21 19:52:04 +02:00
< / div >
< / div >
< div class = 'py1 quiet mt1 prose-big' > Returns< / div >
2019-12-12 10:43:33 +01:00
< code > AsyncIterable< PeerInfo>< / code > :
2019-08-21 19:52:04 +02:00
< / section >
2019-12-12 10:43:33 +01:00
< section class = 'p2 mb2 clearfix bg-white minishadow' >
2019-08-21 19:52:04 +02:00
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< h3 class = 'fl m0' id = 'provide' >
provide
< / h3 >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/content-routing.js#L57-L63' >
< span > src/content-routing.js< / span >
< / a >
2019-08-21 19:52:04 +02:00
< / div >
2019-12-12 10:43:33 +01:00
< p > Iterates over all content routers in parallel to notify it is
a provider of the given key.< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > provide(key: CID): < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise" > Promise< / a > < void>< / div >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'py1 quiet mt1 prose-big' > Parameters< / div >
< div class = 'prose' >
< div class = 'space-bottom0' >
< div >
< span class = 'code bold' > key< / span > < code class = 'quiet' > (CID)< / code >
The CID key of the content to find
< / div >
< / div >
< / div >
2019-08-21 19:52:04 +02:00
< div class = 'py1 quiet mt1 prose-big' > Returns< / div >
2019-12-12 10:43:33 +01:00
< code > < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise" > Promise< / a > < void>< / code > :
2019-08-21 19:52:04 +02:00
< / section >
2019-12-12 10:43:33 +01:00
< section class = 'p2 mb2 clearfix bg-white minishadow' >
2019-08-21 19:52:04 +02:00
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< h3 class = 'fl m0' id = 'put' >
put
< / h3 >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/content-routing.js#L73-L79' >
< span > src/content-routing.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Store the given key/value pair in the DHT.< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > put(key: < a href = "https://nodejs.org/api/buffer.html" > Buffer< / a > , value: < a href = "https://nodejs.org/api/buffer.html" > Buffer< / a > , options: < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object" > Object< / a > ?): < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise" > Promise< / a > < void>< / div >
2019-08-21 19:52:04 +02:00
< div class = 'py1 quiet mt1 prose-big' > Parameters< / div >
< div class = 'prose' >
< div class = 'space-bottom0' >
< div >
2019-12-12 10:43:33 +01:00
< span class = 'code bold' > key< / span > < code class = 'quiet' > (< a href = "https://nodejs.org/api/buffer.html" > Buffer< / a > )< / code >
< / div >
< / div >
< div class = 'space-bottom0' >
< div >
< span class = 'code bold' > value< / span > < code class = 'quiet' > (< a href = "https://nodejs.org/api/buffer.html" > Buffer< / a > )< / code >
< / div >
< / div >
< div class = 'space-bottom0' >
< div >
< span class = 'code bold' > options< / span > < code class = 'quiet' > (< a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object" > Object< / a > ?)< / code >
put options
2019-08-21 19:52:04 +02:00
< / div >
2019-12-12 10:43:33 +01:00
< table class = 'mt1 mb2 fixed-table h5 col-12' >
< colgroup >
< col width = '30%' / >
< col width = '70%' / >
< / colgroup >
< thead >
< tr class = 'bold fill-light' >
< th > Name< / th >
< th > Description< / th >
< / tr >
< / thead >
< tbody class = 'mt1' >
< tr >
< td class = 'break-word' > < span class = 'code bold' > options.minPeers< / span > < code class = 'quiet' > < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number" > number< / a > ?< / code >
< / td >
< td class = 'break-word' > < span > minimum number of peers required to successfully put
< / span > < / td >
< / tr >
< / tbody >
< / table >
2019-08-21 19:52:04 +02:00
< / div >
< / div >
< div class = 'py1 quiet mt1 prose-big' > Returns< / div >
2019-12-12 10:43:33 +01:00
< code > < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise" > Promise< / a > < void>< / code > :
2019-08-21 19:52:04 +02:00
< / section >
2019-12-12 10:43:33 +01:00
< section class = 'p2 mb2 clearfix bg-white minishadow' >
2019-08-21 19:52:04 +02:00
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< h3 class = 'fl m0' id = 'get' >
get
< / h3 >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/content-routing.js#L89-L95' >
< span > src/content-routing.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Get the value to the given key.
Times out after 1 minute by default.< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > get(key: < a href = "https://nodejs.org/api/buffer.html" > Buffer< / a > , options: < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object" > Object< / a > ?): < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise" > Promise< / a > < {from: PeerId, val: < a href = "https://nodejs.org/api/buffer.html" > Buffer< / a > }>< / div >
2019-08-21 19:52:04 +02:00
< div class = 'py1 quiet mt1 prose-big' > Parameters< / div >
< div class = 'prose' >
< div class = 'space-bottom0' >
< div >
2019-12-12 10:43:33 +01:00
< span class = 'code bold' > key< / span > < code class = 'quiet' > (< a href = "https://nodejs.org/api/buffer.html" > Buffer< / a > )< / code >
< / div >
< / div >
< div class = 'space-bottom0' >
< div >
< span class = 'code bold' > options< / span > < code class = 'quiet' > (< a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object" > Object< / a > ?)< / code >
get options
2019-08-21 19:52:04 +02:00
< / div >
2019-12-12 10:43:33 +01:00
< table class = 'mt1 mb2 fixed-table h5 col-12' >
< colgroup >
< col width = '30%' / >
< col width = '70%' / >
< / colgroup >
< thead >
< tr class = 'bold fill-light' >
< th > Name< / th >
< th > Description< / th >
< / tr >
< / thead >
< tbody class = 'mt1' >
< tr >
< td class = 'break-word' > < span class = 'code bold' > options.timeout< / span > < code class = 'quiet' > < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number" > number< / a > ?< / code >
< / td >
< td class = 'break-word' > < span > optional timeout (default: 60000)
< / span > < / td >
< / tr >
< / tbody >
< / table >
2019-08-21 19:52:04 +02:00
< / div >
< / div >
< div class = 'py1 quiet mt1 prose-big' > Returns< / div >
2019-12-12 10:43:33 +01:00
< code > < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise" > Promise< / a > < {from: PeerId, val: < a href = "https://nodejs.org/api/buffer.html" > Buffer< / a > }>< / code > :
2019-08-21 19:52:04 +02:00
< / section >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< h3 class = 'fl m0' id = 'getmany' >
getMany
2019-08-21 19:52:04 +02:00
< / h3 >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/content-routing.js#L105-L111' >
< span > src/content-routing.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Get the < code > n< / code > values to the given key without sorting.< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > getMany(key: < a href = "https://nodejs.org/api/buffer.html" > Buffer< / a > , nVals: < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number" > number< / a > , options: < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object" > Object< / a > ?): < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise" > Promise< / a > < < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array" > Array< / a > < {from: PeerId, val: < a href = "https://nodejs.org/api/buffer.html" > Buffer< / a > }>>< / div >
2019-08-21 19:52:04 +02:00
< div class = 'py1 quiet mt1 prose-big' > Parameters< / div >
< div class = 'prose' >
< div class = 'space-bottom0' >
< div >
2019-12-12 10:43:33 +01:00
< span class = 'code bold' > key< / span > < code class = 'quiet' > (< a href = "https://nodejs.org/api/buffer.html" > Buffer< / a > )< / code >
2019-08-21 19:52:04 +02:00
< / div >
< / div >
< div class = 'space-bottom0' >
< div >
2019-12-12 10:43:33 +01:00
< span class = 'code bold' > nVals< / span > < code class = 'quiet' > (< a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number" > number< / a > )< / code >
< / div >
< / div >
< div class = 'space-bottom0' >
< div >
< span class = 'code bold' > options< / span > < code class = 'quiet' > (< a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object" > Object< / a > ?)< / code >
get options
2019-08-21 19:52:04 +02:00
< / div >
2019-12-12 10:43:33 +01:00
< table class = 'mt1 mb2 fixed-table h5 col-12' >
< colgroup >
< col width = '30%' / >
< col width = '70%' / >
< / colgroup >
< thead >
< tr class = 'bold fill-light' >
< th > Name< / th >
< th > Description< / th >
< / tr >
< / thead >
< tbody class = 'mt1' >
< tr >
< td class = 'break-word' > < span class = 'code bold' > options.timeout< / span > < code class = 'quiet' > < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number" > number< / a > ?< / code >
< / td >
< td class = 'break-word' > < span > optional timeout (default: 60000)
< / span > < / td >
< / tr >
< / tbody >
< / table >
2019-08-21 19:52:04 +02:00
< / div >
< / div >
2019-12-12 10:43:33 +01:00
< div class = 'py1 quiet mt1 prose-big' > Returns< / div >
< code > < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise" > Promise< / a > < < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array" > Array< / a > < {from: PeerId, val: < a href = "https://nodejs.org/api/buffer.html" > Buffer< / a > }>>< / code > :
2019-08-21 19:52:04 +02:00
< / section >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< h3 class = 'fl m0' id = 'subscribe' >
subscribe
2019-08-21 19:52:04 +02:00
< / h3 >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/pubsub.js#L16-L26' >
< span > src/pubsub.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Subscribe the given handler to a pubsub topic< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > subscribe(topic: < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String" > string< / a > , handler: < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function" > function< / a > ): void< / div >
2019-08-21 19:52:04 +02:00
< div class = 'py1 quiet mt1 prose-big' > Parameters< / div >
< div class = 'prose' >
< div class = 'space-bottom0' >
< div >
2019-12-12 10:43:33 +01:00
< span class = 'code bold' > topic< / span > < code class = 'quiet' > (< a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String" > string< / a > )< / code >
2019-08-21 19:52:04 +02:00
< / div >
< / div >
2019-12-12 10:43:33 +01:00
< div class = 'space-bottom0' >
< div >
< span class = 'code bold' > handler< / span > < code class = 'quiet' > (< a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function" > function< / a > )< / code >
The handler to subscribe
< / div >
< / div >
2019-08-21 19:52:04 +02:00
< / div >
< div class = 'py1 quiet mt1 prose-big' > Returns< / div >
< code > void< / code > :
< / section >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< h3 class = 'fl m0' id = 'unsubscribe' >
unsubscribe
2019-08-21 19:52:04 +02:00
< / h3 >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/pubsub.js#L33-L47' >
< span > src/pubsub.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Unsubscribes from a pubsub topic< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > unsubscribe(topic: < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String" > string< / a > , handler: < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function" > function< / a > ?)< / div >
2019-08-21 19:52:04 +02:00
< div class = 'py1 quiet mt1 prose-big' > Parameters< / div >
< div class = 'prose' >
< div class = 'space-bottom0' >
< div >
2019-12-12 10:43:33 +01:00
< span class = 'code bold' > topic< / span > < code class = 'quiet' > (< a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String" > string< / a > )< / code >
2019-08-21 19:52:04 +02:00
< / div >
< / div >
< div class = 'space-bottom0' >
< div >
2019-12-12 10:43:33 +01:00
< span class = 'code bold' > handler< / span > < code class = 'quiet' > (< a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function" > function< / a > ?)< / code >
The handler to unsubscribe from
2019-08-21 19:52:04 +02:00
< / div >
< / div >
< / div >
< / section >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< h3 class = 'fl m0' id = 'publish' >
publish
2019-08-21 19:52:04 +02:00
< / h3 >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/pubsub.js#L55-L67' >
< span > src/pubsub.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Publish messages to the given topics.< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > publish(topic: (< a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array" > Array< / a > < < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String" > string< / a > > | < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String" > string< / a > ), data: < a href = "https://nodejs.org/api/buffer.html" > Buffer< / a > ): < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise" > Promise< / a > < void>< / div >
2019-08-21 19:52:04 +02:00
< div class = 'py1 quiet mt1 prose-big' > Parameters< / div >
< div class = 'prose' >
< div class = 'space-bottom0' >
< div >
2019-12-12 10:43:33 +01:00
< span class = 'code bold' > topic< / span > < code class = 'quiet' > ((< a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array" > Array< / a > < < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String" > string< / a > > | < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String" > string< / a > ))< / code >
2019-08-21 19:52:04 +02:00
< / div >
< / div >
< div class = 'space-bottom0' >
< div >
2019-12-12 10:43:33 +01:00
< span class = 'code bold' > data< / span > < code class = 'quiet' > (< a href = "https://nodejs.org/api/buffer.html" > Buffer< / a > )< / code >
2019-08-21 19:52:04 +02:00
< / div >
< / div >
< / div >
< div class = 'py1 quiet mt1 prose-big' > Returns< / div >
2019-12-12 10:43:33 +01:00
< code > < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise" > Promise< / a > < void>< / code > :
2019-08-21 19:52:04 +02:00
< / section >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< h3 class = 'fl m0' id = 'gettopics' >
getTopics
2019-08-21 19:52:04 +02:00
< / h3 >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/pubsub.js#L73-L79' >
< span > src/pubsub.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Get a list of topics the node is subscribed to.< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > getTopics(): < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array" > Array< / a > < < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String" > String< / a > >< / div >
2019-08-21 19:52:04 +02:00
< div class = 'py1 quiet mt1 prose-big' > Returns< / div >
2019-12-12 10:43:33 +01:00
< code > < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array" > Array< / a > < < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String" > String< / a > >< / code > :
topics
2019-08-21 19:52:04 +02:00
< / section >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< h3 class = 'fl m0' id = 'getsubscribers' >
getSubscribers
2019-08-21 19:52:04 +02:00
< / h3 >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/pubsub.js#L86-L92' >
< span > src/pubsub.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Get a list of the peer-ids that are subscribed to one topic.< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > getSubscribers(topic: < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String" > string< / a > ): < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array" > Array< / a > < < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String" > string< / a > >< / div >
2019-08-21 19:52:04 +02:00
< div class = 'py1 quiet mt1 prose-big' > Parameters< / div >
< div class = 'prose' >
< div class = 'space-bottom0' >
< div >
2019-12-12 10:43:33 +01:00
< span class = 'code bold' > topic< / span > < code class = 'quiet' > (< a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String" > string< / a > )< / code >
2019-08-21 19:52:04 +02:00
< / div >
< / div >
2019-12-12 10:43:33 +01:00
< / div >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'py1 quiet mt1 prose-big' > Returns< / div >
< code > < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array" > Array< / a > < < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String" > string< / a > >< / code > :
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
2019-08-21 19:52:04 +02:00
< / section >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< h3 class = 'fl m0' id = 'getpeerinfo' >
getPeerInfo
2019-08-21 19:52:04 +02:00
< / h3 >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/get-peer-info.js#L17-L42' >
< span > src/get-peer-info.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Converts the given < code > peer< / code > to a < code > PeerInfo< / code > instance.
The < code > PeerStore< / code > will be checked for the resulting peer, and
the peer will be updated in the < code > PeerStore< / code > .< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > getPeerInfo(peer: (PeerInfo | PeerId | Multiaddr | < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String" > string< / a > ), peerStore: < a href = "#peerstore" > PeerStore< / a > ): PeerInfo< / div >
2019-08-21 19:52:04 +02:00
< div class = 'py1 quiet mt1 prose-big' > Parameters< / div >
< div class = 'prose' >
< div class = 'space-bottom0' >
< div >
2019-12-12 10:43:33 +01:00
< span class = 'code bold' > peer< / span > < code class = 'quiet' > ((PeerInfo | PeerId | Multiaddr | < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String" > string< / a > ))< / code >
2019-08-21 19:52:04 +02:00
< / div >
< / div >
< div class = 'space-bottom0' >
< div >
2019-12-12 10:43:33 +01:00
< span class = 'code bold' > peerStore< / span > < code class = 'quiet' > (< a href = "#peerstore" > PeerStore< / a > )< / code >
2019-08-21 19:52:04 +02:00
< / div >
< / div >
< / div >
< div class = 'py1 quiet mt1 prose-big' > Returns< / div >
2019-12-12 10:43:33 +01:00
< code > PeerInfo< / code > :
2019-08-21 19:52:04 +02:00
< / section >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< h3 class = 'fl m0' id = 'getpeerinforemote' >
getPeerInfoRemote
2019-08-21 19:52:04 +02:00
< / h3 >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/get-peer-info.js#L53-L68' >
< span > src/get-peer-info.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > If < code > getPeerInfo< / code > does not return a peer with multiaddrs,
the < code > libp2p< / code > PeerRouter will be used to attempt to find the peer.< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > getPeerInfoRemote(peer: (PeerInfo | PeerId | Multiaddr | < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String" > string< / a > ), libp2p: < a href = "#libp2p" > Libp2p< / a > ): < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise" > Promise< / a > < PeerInfo>< / div >
2019-08-21 19:52:04 +02:00
< div class = 'py1 quiet mt1 prose-big' > Parameters< / div >
< div class = 'prose' >
< div class = 'space-bottom0' >
< div >
2019-12-12 10:43:33 +01:00
< span class = 'code bold' > peer< / span > < code class = 'quiet' > ((PeerInfo | PeerId | Multiaddr | < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String" > string< / a > ))< / code >
2019-08-21 19:52:04 +02:00
< / div >
< / div >
< div class = 'space-bottom0' >
< div >
2019-12-12 10:43:33 +01:00
< span class = 'code bold' > libp2p< / span > < code class = 'quiet' > (< a href = "#libp2p" > Libp2p< / a > )< / code >
2019-08-21 19:52:04 +02:00
< / div >
< / div >
< / div >
< div class = 'py1 quiet mt1 prose-big' > Returns< / div >
2019-12-12 10:43:33 +01:00
< code > < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise" > Promise< / a > < PeerInfo>< / code > :
2019-08-21 19:52:04 +02:00
< / section >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< h3 class = 'fl m0' id = 'constructor' >
constructor
2019-08-21 19:52:04 +02:00
< / h3 >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/connection-manager/index.js#L36-L54' >
< span > src/connection-manager/index.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > new constructor(libp2p: < a href = "#libp2p" > Libp2p< / a > , options: < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object" > object< / a > )< / div >
2019-08-21 19:52:04 +02:00
< div class = 'py1 quiet mt1 prose-big' > Parameters< / div >
< div class = 'prose' >
< div class = 'space-bottom0' >
< div >
2019-12-12 10:43:33 +01:00
< span class = 'code bold' > libp2p< / span > < code class = 'quiet' > (< a href = "#libp2p" > Libp2p< / a > )< / code >
2019-08-21 19:52:04 +02:00
< / div >
< / div >
< div class = 'space-bottom0' >
< div >
2019-12-12 10:43:33 +01:00
< span class = 'code bold' > options< / span > < code class = 'quiet' > (< a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object" > object< / a > )< / code >
2019-08-21 19:52:04 +02:00
< / div >
2019-12-12 10:43:33 +01:00
< table class = 'mt1 mb2 fixed-table h5 col-12' >
< colgroup >
< col width = '30%' / >
< col width = '70%' / >
< / colgroup >
< thead >
< tr class = 'bold fill-light' >
< th > Name< / th >
< th > Description< / th >
< / tr >
< / thead >
< tbody class = 'mt1' >
< tr >
< td class = 'break-word' > < span class = 'code bold' > options.maxConnections< / span > < code class = 'quiet' > < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number" > Number< / a > < / code >
< / td >
< td class = 'break-word' > < span > The maximum number of connections allowed. Default=Infinity
< / span > < / td >
< / tr >
< tr >
< td class = 'break-word' > < span class = 'code bold' > options.minConnections< / span > < code class = 'quiet' > < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number" > Number< / a > < / code >
< / td >
< td class = 'break-word' > < span > The minimum number of connections to avoid pruning. Default=0
< / span > < / td >
< / tr >
< tr >
< td class = 'break-word' > < span class = 'code bold' > options.maxData< / span > < code class = 'quiet' > < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number" > Number< / a > < / code >
< / td >
< td class = 'break-word' > < span > The max data (in and out), per average interval to allow. Default=Infinity
< / span > < / td >
< / tr >
< tr >
< td class = 'break-word' > < span class = 'code bold' > options.maxSentData< / span > < code class = 'quiet' > < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number" > Number< / a > < / code >
< / td >
< td class = 'break-word' > < span > The max outgoing data, per average interval to allow. Default=Infinity
< / span > < / td >
< / tr >
< tr >
< td class = 'break-word' > < span class = 'code bold' > options.maxReceivedData< / span > < code class = 'quiet' > < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number" > Number< / a > < / code >
< / td >
< td class = 'break-word' > < span > The max incoming data, per average interval to allow.. Default=Infinity
< / span > < / td >
< / tr >
< tr >
< td class = 'break-word' > < span class = 'code bold' > options.maxEventLoopDelay< / span > < code class = 'quiet' > < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number" > Number< / a > < / code >
< / td >
< td class = 'break-word' > < span > The upper limit the event loop can take to run. Default=Infinity
< / span > < / td >
< / tr >
< tr >
< td class = 'break-word' > < span class = 'code bold' > options.pollInterval< / span > < code class = 'quiet' > < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number" > Number< / a > < / code >
< / td >
< td class = 'break-word' > < span > How often, in milliseconds, metrics and latency should be checked. Default=2000
< / span > < / td >
< / tr >
< tr >
< td class = 'break-word' > < span class = 'code bold' > options.movingAverageInterval< / span > < code class = 'quiet' > < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number" > Number< / a > < / code >
< / td >
< td class = 'break-word' > < span > How often, in milliseconds, to compute averages. Default=60000
< / span > < / td >
< / tr >
< tr >
< td class = 'break-word' > < span class = 'code bold' > options.defaultPeerValue< / span > < code class = 'quiet' > < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number" > Number< / a > < / code >
< / td >
< td class = 'break-word' > < span > The value of the peer. Default=1
< / span > < / td >
< / tr >
< / tbody >
< / table >
2019-08-21 19:52:04 +02:00
< / div >
< / div >
< / section >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< h3 class = 'fl m0' id = 'start' >
start
2019-08-21 19:52:04 +02:00
< / h3 >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/connection-manager/index.js#L60-L73' >
< span > src/connection-manager/index.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Starts the Connection Manager. If Metrics are not enabled on libp2p
only event loop and connection limits will be monitored.< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > start()< / div >
2019-08-21 19:52:04 +02:00
< / section >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< h3 class = 'fl m0' id = 'stop' >
stop
2019-08-21 19:52:04 +02:00
< / h3 >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/connection-manager/index.js#L78-L82' >
< span > src/connection-manager/index.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Stops the Connection Manager< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > stop()< / div >
2019-08-21 19:52:04 +02:00
< / section >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< h3 class = 'fl m0' id = 'setpeervalue' >
setPeerValue
2019-08-21 19:52:04 +02:00
< / h3 >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/connection-manager/index.js#L90-L98' >
< span > src/connection-manager/index.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Sets the value of the given peer. Peers with lower values
will be disconnected first.< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > setPeerValue(peerId: PeerId, value: < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number" > number< / a > )< / div >
2019-08-21 19:52:04 +02:00
< div class = 'py1 quiet mt1 prose-big' > Parameters< / div >
< div class = 'prose' >
< div class = 'space-bottom0' >
< div >
2019-12-12 10:43:33 +01:00
< span class = 'code bold' > peerId< / span > < code class = 'quiet' > (PeerId)< / code >
2019-08-21 19:52:04 +02:00
< / div >
< / div >
< div class = 'space-bottom0' >
< div >
2019-12-12 10:43:33 +01:00
< span class = 'code bold' > value< / span > < code class = 'quiet' > (< a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number" > number< / a > )< / code >
A number between 0 and 1
2019-08-21 19:52:04 +02:00
< / div >
< / div >
< / div >
< / section >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< h3 class = 'fl m0' id = 'onconnect' >
onConnect
2019-08-21 19:52:04 +02:00
< / h3 >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/connection-manager/index.js#L121-L128' >
< span > src/connection-manager/index.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Tracks the incoming connection and check the connection limit< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > onConnect(connection: Connection)< / div >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'py1 quiet mt1 prose-big' > Parameters< / div >
< div class = 'prose' >
< div class = 'space-bottom0' >
< div >
< span class = 'code bold' > connection< / span > < code class = 'quiet' > (Connection)< / code >
< / div >
< / div >
< / div >
2019-08-21 19:52:04 +02:00
< / section >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< h3 class = 'fl m0' id = 'ondisconnect' >
onDisconnect
2019-08-21 19:52:04 +02:00
< / h3 >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/connection-manager/index.js#L134-L137' >
< span > src/connection-manager/index.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Removes the connection from tracking< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > onDisconnect(connection: Connection)< / div >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'py1 quiet mt1 prose-big' > Parameters< / div >
< div class = 'prose' >
< div class = 'space-bottom0' >
< div >
< span class = 'code bold' > connection< / span > < code class = 'quiet' > (Connection)< / code >
< / div >
< / div >
< / div >
2019-08-21 19:52:04 +02:00
< / section >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< h3 class = 'fl m0' id = 'constructor' >
constructor
< / h3 >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/circuit/index.js#L30-L37' >
< span > src/circuit/index.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Creates an instance of Circuit.< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > new constructor(options: < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object" > object< / a > )< / div >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'py1 quiet mt1 prose-big' > Parameters< / div >
< div class = 'prose' >
< div class = 'space-bottom0' >
< div >
< span class = 'code bold' > options< / span > < code class = 'quiet' > (< a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object" > object< / a > )< / code >
< / div >
< table class = 'mt1 mb2 fixed-table h5 col-12' >
< colgroup >
< col width = '30%' / >
< col width = '70%' / >
< / colgroup >
< thead >
< tr class = 'bold fill-light' >
< th > Name< / th >
< th > Description< / th >
< / tr >
< / thead >
< tbody class = 'mt1' >
< tr >
< td class = 'break-word' > < span class = 'code bold' > options.libp2p< / span > < code class = 'quiet' > < a href = "#libp2p" > Libp2p< / a > < / code >
< / td >
< td class = 'break-word' > < span > < / span > < / td >
< / tr >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< tr >
< td class = 'break-word' > < span class = 'code bold' > options.upgrader< / span > < code class = 'quiet' > < a href = "#upgrader" > Upgrader< / a > < / code >
< / td >
< td class = 'break-word' > < span > < / span > < / td >
< / tr >
< / tbody >
< / table >
< / div >
< / div >
2019-08-21 19:52:04 +02:00
< / section >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< h3 class = 'fl m0' id = 'dial' >
dial
2019-08-21 19:52:04 +02:00
< / h3 >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/circuit/index.js#L101-L147' >
< span > src/circuit/index.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Dial a peer over a relay< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > dial(ma: multiaddr, options: < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object" > Object< / a > ): Connection< / div >
2019-08-21 19:52:04 +02:00
< div class = 'py1 quiet mt1 prose-big' > Parameters< / div >
< div class = 'prose' >
< div class = 'space-bottom0' >
< div >
2019-12-12 10:43:33 +01:00
< span class = 'code bold' > ma< / span > < code class = 'quiet' > (multiaddr)< / code >
the multiaddr of the peer to dial
< / div >
< / div >
< div class = 'space-bottom0' >
< div >
< span class = 'code bold' > options< / span > < code class = 'quiet' > (< a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object" > Object< / a > )< / code >
dial options
2019-08-21 19:52:04 +02:00
< / div >
2019-12-12 10:43:33 +01:00
< table class = 'mt1 mb2 fixed-table h5 col-12' >
< colgroup >
< col width = '30%' / >
< col width = '70%' / >
< / colgroup >
< thead >
< tr class = 'bold fill-light' >
< th > Name< / th >
< th > Description< / th >
< / tr >
< / thead >
< tbody class = 'mt1' >
< tr >
< td class = 'break-word' > < span class = 'code bold' > options.signal< / span > < code class = 'quiet' > AbortSignal?< / code >
< / td >
< td class = 'break-word' > < span > An optional abort signal
< / span > < / td >
< / tr >
< / tbody >
< / table >
2019-08-21 19:52:04 +02:00
< / div >
< / div >
< div class = 'py1 quiet mt1 prose-big' > Returns< / div >
2019-12-12 10:43:33 +01:00
< code > Connection< / code > :
the connection
2019-08-21 19:52:04 +02:00
< / section >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< h3 class = 'fl m0' id = 'createlistener' >
createListener
2019-08-21 19:52:04 +02:00
< / h3 >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/circuit/index.js#L156-L166' >
< span > src/circuit/index.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Create a listener< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > createListener(options: any, handler: < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function" > Function< / a > ): < a href = "#listener" > listener< / a > < / div >
2019-08-21 19:52:04 +02:00
< div class = 'py1 quiet mt1 prose-big' > Parameters< / div >
< div class = 'prose' >
< div class = 'space-bottom0' >
< div >
2019-12-12 10:43:33 +01:00
< span class = 'code bold' > options< / span > < code class = 'quiet' > (any)< / code >
2019-08-21 19:52:04 +02:00
< / div >
< / div >
< div class = 'space-bottom0' >
< div >
2019-12-12 10:43:33 +01:00
< span class = 'code bold' > handler< / span > < code class = 'quiet' > (< a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function" > Function< / a > )< / code >
2019-08-21 19:52:04 +02:00
< / div >
< / div >
< / div >
< div class = 'py1 quiet mt1 prose-big' > Returns< / div >
2019-12-12 10:43:33 +01:00
< code > < a href = "#listener" > listener< / a > < / code > :
2019-08-21 19:52:04 +02:00
< / section >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< h3 class = 'fl m0' id = 'filter' >
filter
2019-08-21 19:52:04 +02:00
< / h3 >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/circuit/index.js#L174-L180' >
< span > src/circuit/index.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Filter check for all Multiaddrs that this transport can dial on< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > filter(multiaddrs: < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array" > Array< / a > < Multiaddr>): < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array" > Array< / a > < Multiaddr>< / div >
2019-08-21 19:52:04 +02:00
< div class = 'py1 quiet mt1 prose-big' > Parameters< / div >
< div class = 'prose' >
< div class = 'space-bottom0' >
< div >
2019-12-12 10:43:33 +01:00
< span class = 'code bold' > multiaddrs< / span > < code class = 'quiet' > (< a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array" > Array< / a > < Multiaddr>)< / code >
2019-08-21 19:52:04 +02:00
< / div >
< / div >
< / div >
< div class = 'py1 quiet mt1 prose-big' > Returns< / div >
2019-12-12 10:43:33 +01:00
< code > < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array" > Array< / a > < Multiaddr>< / code > :
2019-08-21 19:52:04 +02:00
< / section >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< h3 class = 'fl m0' id = 'listener' >
listener
2019-08-21 19:52:04 +02:00
< / h3 >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/circuit/listener.js#L14-L66' >
< span > src/circuit/listener.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > listener(circuit: any): Listener< / div >
2019-08-21 19:52:04 +02:00
< div class = 'py1 quiet mt1 prose-big' > Parameters< / div >
< div class = 'prose' >
< div class = 'space-bottom0' >
< div >
2019-12-12 10:43:33 +01:00
< span class = 'code bold' > circuit< / span > < code class = 'quiet' > (any)< / code >
2019-08-21 19:52:04 +02:00
< / div >
< / div >
< / div >
< div class = 'py1 quiet mt1 prose-big' > Returns< / div >
2019-12-12 10:43:33 +01:00
< code > Listener< / code > :
a transport listener
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'py1 quiet mt1 prose-big' > Static Members< / div >
< div class = "clearfix" >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'border-bottom' id = 'listenerlisten' >
< div class = "clearfix small pointer toggle-sibling" >
< div class = "py1 contain" >
< a class = 'icon pin-right py1 dark-link caret-right' > ▸< / a >
< span class = 'code strong strong truncate' > listen(addr)< / span >
< / div >
< / div >
< div class = "clearfix display-none toggle-target" >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
2019-08-21 19:52:04 +02:00
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/circuit/listener.js#L24-L32' >
2019-08-21 19:52:04 +02:00
< span > src/circuit/listener.js< / span >
< / a >
< / div >
< p > Add swarm handler and listen for incoming connections< / p >
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > listen(addr: Multiaddr): void< / div >
2019-08-21 19:52:04 +02:00
< div class = 'py1 quiet mt1 prose-big' > Parameters< / div >
< div class = 'prose' >
< div class = 'space-bottom0' >
< div >
2019-12-12 10:43:33 +01:00
< span class = 'code bold' > addr< / span > < code class = 'quiet' > (Multiaddr)< / code >
2019-08-21 19:52:04 +02:00
< / div >
< / div >
< / div >
< div class = 'py1 quiet mt1 prose-big' > Returns< / div >
< code > void< / code > :
< / section >
2019-12-12 10:43:33 +01:00
< / div >
< / div >
< div class = 'border-bottom' id = 'listenerclose' >
< div class = "clearfix small pointer toggle-sibling" >
< div class = "py1 contain" >
< a class = 'icon pin-right py1 dark-link caret-right' > ▸< / a >
< span class = 'code strong strong truncate' > close()< / span >
< / div >
< / div >
< div class = "clearfix display-none toggle-target" >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
2019-08-21 19:52:04 +02:00
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/circuit/listener.js#L39-L39' >
2019-08-21 19:52:04 +02:00
< span > src/circuit/listener.js< / span >
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > TODO: Remove the peers from our topology< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > close(): void< / div >
2019-08-21 19:52:04 +02:00
< div class = 'py1 quiet mt1 prose-big' > Returns< / div >
< code > void< / code > :
< / section >
2019-12-12 10:43:33 +01:00
< / div >
< / div >
< div class = 'border-bottom' id = 'listenergetaddrs' >
< div class = "clearfix small pointer toggle-sibling" >
< div class = "py1 contain" >
< a class = 'icon pin-right py1 dark-link caret-right' > ▸< / a >
< span class = 'code strong strong truncate' > getAddrs()< / span >
< / div >
< / div >
< div class = "clearfix display-none toggle-target" >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
2019-08-21 19:52:04 +02:00
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/circuit/listener.js#L57-L63' >
2019-08-21 19:52:04 +02:00
< span > src/circuit/listener.js< / span >
< / a >
< / div >
< p > Get fixed up multiaddrs< / p >
< p > NOTE: This method will grab the peers multiaddrs and expand them such that:< / p >
< p > a) If it's an existing /p2p-circuit address for a specific relay i.e.
< code > /ip4/0.0.0.0/tcp/0/ipfs/QmRelay/p2p-circuit< / code > this method will expand the
address to < code > /ip4/0.0.0.0/tcp/0/ipfs/QmRelay/p2p-circuit/ipfs/QmPeer< / code > where
< code > QmPeer< / code > is this peers id
b) If it's not a /p2p-circuit address, it will encapsulate the address as a /p2p-circuit
addr, such when dialing over a relay with this address, it will create the circuit using
the encapsulated transport address. This is useful when for example, a peer should only
be dialed over TCP rather than any other transport< / p >
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > getAddrs(): < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array" > Array< / a > < Multiaddr>< / div >
2019-08-21 19:52:04 +02:00
< div class = 'py1 quiet mt1 prose-big' > Returns< / div >
2019-12-12 10:43:33 +01:00
< code > < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array" > Array< / a > < Multiaddr>< / code > :
2019-08-21 19:52:04 +02:00
< / section >
2019-12-12 10:43:33 +01:00
< / div >
< / div >
< / div >
< / section >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
2019-08-21 19:52:04 +02:00
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< h3 class = 'fl m0' id = 'hop' >
hop
2019-08-21 19:52:04 +02:00
< / h3 >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/circuit/circuit/hop.js#L99-L119' >
< span > src/circuit/circuit/hop.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Performs a HOP request to a relay peer, to request a connection to another
peer. A new, virtual, connection will be created between the two via the relay.< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > hop(options: < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object" > object< / a > ): < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise" > Promise< / a > < Connection>< / div >
2019-08-21 19:52:04 +02:00
< div class = 'py1 quiet mt1 prose-big' > Parameters< / div >
< div class = 'prose' >
< div class = 'space-bottom0' >
< div >
2019-12-12 10:43:33 +01:00
< span class = 'code bold' > options< / span > < code class = 'quiet' > (< a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object" > object< / a > )< / code >
2019-08-21 19:52:04 +02:00
< / div >
2019-12-12 10:43:33 +01:00
< table class = 'mt1 mb2 fixed-table h5 col-12' >
< colgroup >
< col width = '30%' / >
< col width = '70%' / >
< / colgroup >
< thead >
< tr class = 'bold fill-light' >
< th > Name< / th >
< th > Description< / th >
< / tr >
< / thead >
< tbody class = 'mt1' >
< tr >
< td class = 'break-word' > < span class = 'code bold' > options.connection< / span > < code class = 'quiet' > Connection< / code >
< / td >
< td class = 'break-word' > < span > Connection to the relay
< / span > < / td >
< / tr >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< tr >
< td class = 'break-word' > < span class = 'code bold' > options.request< / span > < code class = 'quiet' > any< / code >
< / td >
< td class = 'break-word' > < span > < / span > < / td >
< / tr >
< tr >
< td class = 'break-word' > < span class = 'code bold' > options.circuit< / span > < code class = 'quiet' > Circuit< / code >
< / td >
< td class = 'break-word' > < span > < / span > < / td >
< / tr >
< / tbody >
< / table >
2019-08-21 19:52:04 +02:00
< / div >
< / div >
< div class = 'py1 quiet mt1 prose-big' > Returns< / div >
2019-12-12 10:43:33 +01:00
< code > < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise" > Promise< / a > < Connection>< / code > :
2019-08-21 19:52:04 +02:00
< / section >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< h3 class = 'fl m0' id = 'writeresponse' >
writeResponse
2019-08-21 19:52:04 +02:00
< / h3 >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/circuit/circuit/utils.js#L12-L17' >
< span > src/circuit/circuit/utils.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Write a response< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > writeResponse(streamHandler: StreamHandler, status: CircuitRelay.Status)< / div >
2019-08-21 19:52:04 +02:00
< div class = 'py1 quiet mt1 prose-big' > Parameters< / div >
< div class = 'prose' >
< div class = 'space-bottom0' >
< div >
2019-12-12 10:43:33 +01:00
< span class = 'code bold' > streamHandler< / span > < code class = 'quiet' > (StreamHandler)< / code >
2019-08-21 19:52:04 +02:00
< / div >
< / div >
< div class = 'space-bottom0' >
< div >
2019-12-12 10:43:33 +01:00
< span class = 'code bold' > status< / span > < code class = 'quiet' > (CircuitRelay.Status)< / code >
2019-08-21 19:52:04 +02:00
< / div >
< / div >
< / div >
< / section >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< h3 class = 'fl m0' id = 'validateaddrs' >
validateAddrs
2019-08-21 19:52:04 +02:00
< / h3 >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/circuit/circuit/utils.js#L25-L47' >
< span > src/circuit/circuit/utils.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Validate incomming HOP/STOP message< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > validateAddrs(msg: any, streamHandler: StreamHandler)< / div >
2019-08-21 19:52:04 +02:00
< div class = 'py1 quiet mt1 prose-big' > Parameters< / div >
< div class = 'prose' >
< div class = 'space-bottom0' >
< div >
2019-12-12 10:43:33 +01:00
< span class = 'code bold' > msg< / span > < code class = 'quiet' > (any)< / code >
A CircuitRelay unencoded protobuf message
2019-08-21 19:52:04 +02:00
< / div >
< / div >
< div class = 'space-bottom0' >
< div >
2019-12-12 10:43:33 +01:00
< span class = 'code bold' > streamHandler< / span > < code class = 'quiet' > (StreamHandler)< / code >
2019-08-21 19:52:04 +02:00
< / div >
< / div >
< / div >
< / section >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< h3 class = 'fl m0' id = 'constructor' >
constructor
2019-08-21 19:52:04 +02:00
< / h3 >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/circuit/circuit/stream-handler.js#L19-L24' >
< span > src/circuit/circuit/stream-handler.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Create a stream handler for connection< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > constructor(options: < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object" > object< / a > )< / div >
2019-08-21 19:52:04 +02:00
< div class = 'py1 quiet mt1 prose-big' > Parameters< / div >
< div class = 'prose' >
< div class = 'space-bottom0' >
< div >
2019-12-12 10:43:33 +01:00
< span class = 'code bold' > options< / span > < code class = 'quiet' > (< a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object" > object< / a > )< / code >
2019-08-21 19:52:04 +02:00
< / div >
2019-12-12 10:43:33 +01:00
< table class = 'mt1 mb2 fixed-table h5 col-12' >
< colgroup >
< col width = '30%' / >
< col width = '70%' / >
< / colgroup >
< thead >
< tr class = 'bold fill-light' >
< th > Name< / th >
< th > Description< / th >
< / tr >
< / thead >
< tbody class = 'mt1' >
< tr >
< td class = 'break-word' > < span class = 'code bold' > options.stream< / span > < code class = 'quiet' > any< / code >
< / td >
< td class = 'break-word' > < span > A duplex iterable
< / span > < / td >
< / tr >
< tr >
< td class = 'break-word' > < span class = 'code bold' > options.maxLength< / span > < code class = 'quiet' > < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number" > Number< / a > < / code >
(default < code > 4096< / code > )
< / td >
< td class = 'break-word' > < span > max bytes length of message
< / span > < / td >
< / tr >
< / tbody >
< / table >
2019-08-21 19:52:04 +02:00
< / div >
< / div >
< / section >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< h3 class = 'fl m0' id = 'read' >
read
2019-08-21 19:52:04 +02:00
< / h3 >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/circuit/circuit/stream-handler.js#L31-L42' >
< span > src/circuit/circuit/stream-handler.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Read and decode message< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > read(): void< / div >
2019-08-21 19:52:04 +02:00
< div class = 'py1 quiet mt1 prose-big' > Returns< / div >
< code > void< / code > :
< / section >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< h3 class = 'fl m0' id = 'write' >
write
2019-08-21 19:52:04 +02:00
< / h3 >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/circuit/circuit/stream-handler.js#L49-L52' >
< span > src/circuit/circuit/stream-handler.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Encode and write array of buffers< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > write(msg: any)< / div >
2019-08-21 19:52:04 +02:00
< div class = 'py1 quiet mt1 prose-big' > Parameters< / div >
< div class = 'prose' >
< div class = 'space-bottom0' >
< div >
2019-12-12 10:43:33 +01:00
< span class = 'code bold' > msg< / span > < code class = 'quiet' > (any)< / code >
An unencoded CircuitRelay protobuf message
2019-08-21 19:52:04 +02:00
< / div >
< / div >
< / div >
2019-12-12 10:43:33 +01:00
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< / section >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
2019-08-21 19:52:04 +02:00
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< h3 class = 'fl m0' id = 'rest' >
rest
< / h3 >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/circuit/circuit/stream-handler.js#L59-L62' >
< span > src/circuit/circuit/stream-handler.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Return the handshake rest stream and invalidate handler< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > rest(): any< / div >
2019-08-21 19:52:04 +02:00
< div class = 'py1 quiet mt1 prose-big' > Returns< / div >
2019-12-12 10:43:33 +01:00
< code > any< / code > :
A duplex iterable
2019-08-21 19:52:04 +02:00
< / section >
2019-12-12 10:43:33 +01:00
< section class = 'p2 mb2 clearfix bg-white minishadow' >
2019-08-21 19:52:04 +02:00
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< h3 class = 'fl m0' id = 'close' >
close
< / h3 >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/circuit/circuit/stream-handler.js#L74-L77' >
< span > src/circuit/circuit/stream-handler.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Close the stream< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > close(): void< / div >
2019-08-21 19:52:04 +02:00
< div class = 'py1 quiet mt1 prose-big' > Returns< / div >
< code > void< / code > :
< / section >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< h3 class = 'fl m0' id = 'constructor' >
constructor
2019-08-21 19:52:04 +02:00
< / h3 >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/dialer/index.js#L28-L42' >
< span > src/dialer/index.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > new constructor($0: < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object" > Object< / a > , options: < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object" > object< / a > , peerStore: Peerstore)< / div >
2019-08-21 19:52:04 +02:00
< div class = 'py1 quiet mt1 prose-big' > Parameters< / div >
< div class = 'prose' >
< div class = 'space-bottom0' >
< div >
2019-12-12 10:43:33 +01:00
< span class = 'code bold' > $0< / span > < code class = 'quiet' > (< a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object" > Object< / a > )< / code >
2019-08-21 19:52:04 +02:00
< / div >
2019-12-12 10:43:33 +01:00
< table class = 'mt1 mb2 fixed-table h5 col-12' >
< colgroup >
< col width = '30%' / >
< col width = '70%' / >
< / colgroup >
< thead >
< tr class = 'bold fill-light' >
< th > Name< / th >
< th > Description< / th >
< / tr >
< / thead >
< tbody class = 'mt1' >
< tr >
< td class = 'break-word' > < span class = 'code bold' > $0.transportManager< / span > < code class = 'quiet' > any< / code >
< / td >
< td class = 'break-word' > < span > < / span > < / td >
< / tr >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< tr >
< td class = 'break-word' > < span class = 'code bold' > $0.peerStore< / span > < code class = 'quiet' > any< / code >
< / td >
< td class = 'break-word' > < span > < / span > < / td >
< / tr >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< tr >
< td class = 'break-word' > < span class = 'code bold' > $0.concurrency< / span > < code class = 'quiet' > any< / code >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
(default < code > MAX_PARALLEL_DIALS< / code > )
< / td >
< td class = 'break-word' > < span > < / span > < / td >
< / tr >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< tr >
< td class = 'break-word' > < span class = 'code bold' > $0.timeout< / span > < code class = 'quiet' > any< / code >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
(default < code > DIAL_TIMEOUT< / code > )
< / td >
< td class = 'break-word' > < span > < / span > < / td >
< / tr >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< tr >
< td class = 'break-word' > < span class = 'code bold' > $0.perPeerLimit< / span > < code class = 'quiet' > any< / code >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
(default < code > MAX_PER_PEER_DIALS< / code > )
< / td >
< td class = 'break-word' > < span > < / span > < / td >
< / tr >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< / tbody >
< / table >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< / div >
< div class = 'space-bottom0' >
< div >
< span class = 'code bold' > options< / span > < code class = 'quiet' > (< a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object" > object< / a > )< / code >
< / div >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< table class = 'mt1 mb2 fixed-table h5 col-12' >
< colgroup >
< col width = '30%' / >
< col width = '70%' / >
< / colgroup >
< thead >
< tr class = 'bold fill-light' >
< th > Name< / th >
< th > Description< / th >
< / tr >
< / thead >
< tbody class = 'mt1' >
< tr >
< td class = 'break-word' > < span class = 'code bold' > options.transportManager< / span > < code class = 'quiet' > TransportManager< / code >
< / td >
< td class = 'break-word' > < span > < / span > < / td >
< / tr >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< tr >
< td class = 'break-word' > < span class = 'code bold' > options.concurrency< / span > < code class = 'quiet' > < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number" > number< / a > < / code >
< / td >
< td class = 'break-word' > < span > Number of max concurrent dials. Defaults to
< code > MAX_PARALLEL_DIALS< / code >
< / span > < / td >
< / tr >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< tr >
< td class = 'break-word' > < span class = 'code bold' > options.timeout< / span > < code class = 'quiet' > < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number" > number< / a > < / code >
< / td >
< td class = 'break-word' > < span > How long a dial attempt is allowed to take. Defaults to
< code > DIAL_TIMEOUT< / code >
< / span > < / td >
< / tr >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< / tbody >
< / table >
< / div >
2019-08-21 19:52:04 +02:00
< div class = 'space-bottom0' >
< div >
2019-12-12 10:43:33 +01:00
< span class = 'code bold' > peerStore< / span > < code class = 'quiet' > (Peerstore)< / code >
2019-08-21 19:52:04 +02:00
< / div >
< / div >
< / div >
< / section >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< h3 class = 'fl m0' id = 'destroy' >
destroy
2019-08-21 19:52:04 +02:00
< / h3 >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/dialer/index.js#L47-L56' >
< span > src/dialer/index.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Clears any pending dials< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > destroy()< / div >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< / section >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
2019-08-21 19:52:04 +02:00
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< h3 class = 'fl m0' id = 'connecttomultiaddr' >
connectToMultiaddr
< / h3 >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/dialer/index.js#L67-L107' >
< span > src/dialer/index.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Connects to the first success of a given list of < code > Multiaddr< / code > . < code > addrs< / code > should
include the id of the peer being dialed, it will be used for encryption verification.< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > connectToMultiaddr(addrs: (< a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array" > Array< / a > < Multiaddr> | Multiaddr), options: < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object" > object< / a > ?): < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise" > Promise< / a > < Connection>< / div >
2019-08-21 19:52:04 +02:00
< div class = 'py1 quiet mt1 prose-big' > Parameters< / div >
< div class = 'prose' >
< div class = 'space-bottom0' >
< div >
2019-12-12 10:43:33 +01:00
< span class = 'code bold' > addrs< / span > < code class = 'quiet' > ((< a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array" > Array< / a > < Multiaddr> | Multiaddr))< / code >
2019-08-21 19:52:04 +02:00
< / div >
< / div >
< div class = 'space-bottom0' >
< div >
2019-12-12 10:43:33 +01:00
< span class = 'code bold' > options< / span > < code class = 'quiet' > (< a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object" > object< / a > ?
= < code > {}< / code > )< / code >
2019-08-21 19:52:04 +02:00
< / div >
2019-12-12 10:43:33 +01:00
< table class = 'mt1 mb2 fixed-table h5 col-12' >
< colgroup >
< col width = '30%' / >
< col width = '70%' / >
< / colgroup >
< thead >
< tr class = 'bold fill-light' >
< th > Name< / th >
< th > Description< / th >
< / tr >
< / thead >
< tbody class = 'mt1' >
< tr >
< td class = 'break-word' > < span class = 'code bold' > options.signal< / span > < code class = 'quiet' > AbortSignal?< / code >
< / td >
< td class = 'break-word' > < span > An AbortController signal
< / span > < / td >
< / tr >
< / tbody >
< / table >
2019-08-21 19:52:04 +02:00
< / div >
< / div >
< div class = 'py1 quiet mt1 prose-big' > Returns< / div >
2019-12-12 10:43:33 +01:00
< code > < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise" > Promise< / a > < Connection>< / code > :
2019-08-21 19:52:04 +02:00
< / section >
2019-12-12 10:43:33 +01:00
< section class = 'p2 mb2 clearfix bg-white minishadow' >
2019-08-21 19:52:04 +02:00
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< h3 class = 'fl m0' id = 'connecttopeer' >
connectToPeer
< / h3 >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/dialer/index.js#L119-L125' >
< span > src/dialer/index.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Connects to a given < code > PeerInfo< / code > or < code > PeerId< / code > by dialing all of its known addresses.
The dial to the first address that is successfully able to upgrade a connection
will be used.< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > connectToPeer(peerId: PeerId, options: < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object" > object< / a > ?): < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise" > Promise< / a > < Connection>< / div >
2019-08-21 19:52:04 +02:00
< div class = 'py1 quiet mt1 prose-big' > Parameters< / div >
< div class = 'prose' >
< div class = 'space-bottom0' >
< div >
2019-12-12 10:43:33 +01:00
< span class = 'code bold' > peerId< / span > < code class = 'quiet' > (PeerId)< / code >
The remote peer id to dial
2019-08-21 19:52:04 +02:00
< / div >
< / div >
< div class = 'space-bottom0' >
< div >
2019-12-12 10:43:33 +01:00
< span class = 'code bold' > options< / span > < code class = 'quiet' > (< a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object" > object< / a > ?
= < code > {}< / code > )< / code >
2019-08-21 19:52:04 +02:00
< / div >
2019-12-12 10:43:33 +01:00
< table class = 'mt1 mb2 fixed-table h5 col-12' >
< colgroup >
< col width = '30%' / >
< col width = '70%' / >
< / colgroup >
< thead >
< tr class = 'bold fill-light' >
< th > Name< / th >
< th > Description< / th >
< / tr >
< / thead >
< tbody class = 'mt1' >
< tr >
< td class = 'break-word' > < span class = 'code bold' > options.signal< / span > < code class = 'quiet' > AbortSignal?< / code >
< / td >
< td class = 'break-word' > < span > An AbortController signal
< / span > < / td >
< / tr >
< / tbody >
< / table >
2019-08-21 19:52:04 +02:00
< / div >
< / div >
< div class = 'py1 quiet mt1 prose-big' > Returns< / div >
2019-12-12 10:43:33 +01:00
< code > < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise" > Promise< / a > < Connection>< / code > :
2019-08-21 19:52:04 +02:00
< / section >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< h3 class = 'fl m0' id = 'constructor' >
constructor
2019-08-21 19:52:04 +02:00
< / h3 >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/dialer/dial-request.js#L24-L32' >
< span > src/dialer/dial-request.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Manages running the < code > dialAction< / code > on multiple provided < code > addrs< / code > in parallel
up to a maximum determined by the number of tokens returned
from < code > dialer.getTokens< / code > . Once a DialRequest is created, it can be
started using < code > DialRequest.run(options)< / code > . Once a single dial has succeeded,
all other dials in the request will be cancelled.< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > constructor(options: < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object" > object< / a > )< / div >
2019-08-21 19:52:04 +02:00
< div class = 'py1 quiet mt1 prose-big' > Parameters< / div >
< div class = 'prose' >
< div class = 'space-bottom0' >
< div >
2019-12-12 10:43:33 +01:00
< span class = 'code bold' > options< / span > < code class = 'quiet' > (< a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object" > object< / a > )< / code >
2019-08-21 19:52:04 +02:00
< / div >
2019-12-12 10:43:33 +01:00
< table class = 'mt1 mb2 fixed-table h5 col-12' >
< colgroup >
< col width = '30%' / >
< col width = '70%' / >
< / colgroup >
< thead >
< tr class = 'bold fill-light' >
< th > Name< / th >
< th > Description< / th >
< / tr >
< / thead >
< tbody class = 'mt1' >
< tr >
< td class = 'break-word' > < span class = 'code bold' > options.addrs< / span > < code class = 'quiet' > < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array" > Array< / a > < Multiaddr>< / code >
< / td >
< td class = 'break-word' > < span > < / span > < / td >
< / tr >
< tr >
< td class = 'break-word' > < span class = 'code bold' > options.dialAction< / span > < code class = 'quiet' > function (Multiaddr): < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise" > Promise< / a > < Connection>< / code >
< / td >
< td class = 'break-word' > < span > < / span > < / td >
< / tr >
< tr >
< td class = 'break-word' > < span class = 'code bold' > options.dialer< / span > < code class = 'quiet' > Dialer< / code >
< / td >
< td class = 'break-word' > < span > < / span > < / td >
< / tr >
< / tbody >
< / table >
2019-08-21 19:52:04 +02:00
< / div >
< / div >
2019-12-12 10:43:33 +01:00
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< / section >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
2019-08-21 19:52:04 +02:00
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< h3 class = 'fl m0' id = 'run' >
run
< / h3 >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/dialer/dial-request.js#L40-L77' >
< span > src/dialer/dial-request.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > run(options: < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object" > object< / a > ): Connection< / div >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'py1 quiet mt1 prose-big' > Parameters< / div >
< div class = 'prose' >
2019-08-21 19:52:04 +02:00
< div class = 'space-bottom0' >
< div >
2019-12-12 10:43:33 +01:00
< span class = 'code bold' > options< / span > < code class = 'quiet' > (< a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object" > object< / a > )< / code >
2019-08-21 19:52:04 +02:00
< / div >
2019-12-12 10:43:33 +01:00
< table class = 'mt1 mb2 fixed-table h5 col-12' >
< colgroup >
< col width = '30%' / >
< col width = '70%' / >
< / colgroup >
< thead >
< tr class = 'bold fill-light' >
< th > Name< / th >
< th > Description< / th >
< / tr >
< / thead >
< tbody class = 'mt1' >
< tr >
< td class = 'break-word' > < span class = 'code bold' > options.signal< / span > < code class = 'quiet' > AbortSignal< / code >
< / td >
< td class = 'break-word' > < span > An AbortController signal
< / span > < / td >
< / tr >
< / tbody >
< / table >
2019-08-21 19:52:04 +02:00
< / div >
< / div >
< div class = 'py1 quiet mt1 prose-big' > Returns< / div >
2019-12-12 10:43:33 +01:00
< code > Connection< / code > :
2019-08-21 19:52:04 +02:00
< / section >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< h3 class = 'fl m0' id = 'constructor' >
constructor
2019-08-21 19:52:04 +02:00
< / h3 >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/metrics/index.js#L29-L37' >
< span > src/metrics/index.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > constructor(options: < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object" > object< / a > )< / div >
2019-08-21 19:52:04 +02:00
< div class = 'py1 quiet mt1 prose-big' > Parameters< / div >
< div class = 'prose' >
< div class = 'space-bottom0' >
< div >
2019-12-12 10:43:33 +01:00
< span class = 'code bold' > options< / span > < code class = 'quiet' > (< a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object" > object< / a > )< / code >
2019-08-21 19:52:04 +02:00
< / div >
2019-12-12 10:43:33 +01:00
< table class = 'mt1 mb2 fixed-table h5 col-12' >
< colgroup >
< col width = '30%' / >
< col width = '70%' / >
< / colgroup >
< thead >
< tr class = 'bold fill-light' >
< th > Name< / th >
< th > Description< / th >
< / tr >
< / thead >
< tbody class = 'mt1' >
< tr >
< td class = 'break-word' > < span class = 'code bold' > options.computeThrottleMaxQueueSize< / span > < code class = 'quiet' > < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number" > number< / a > < / code >
< / td >
< td class = 'break-word' > < span > < / span > < / td >
< / tr >
< tr >
< td class = 'break-word' > < span class = 'code bold' > options.computeThrottleTimeout< / span > < code class = 'quiet' > < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number" > number< / a > < / code >
< / td >
< td class = 'break-word' > < span > < / span > < / td >
< / tr >
< tr >
< td class = 'break-word' > < span class = 'code bold' > options.movingAverageIntervals< / span > < code class = 'quiet' > < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array" > Array< / a > < < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number" > number< / a > >< / code >
< / td >
< td class = 'break-word' > < span > < / span > < / td >
< / tr >
< tr >
< td class = 'break-word' > < span class = 'code bold' > options.maxOldPeersRetention< / span > < code class = 'quiet' > < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number" > number< / a > < / code >
< / td >
< td class = 'break-word' > < span > < / span > < / td >
< / tr >
< / tbody >
< / table >
2019-08-21 19:52:04 +02:00
< / div >
< / div >
< / section >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< h3 class = 'fl m0' id = 'start' >
start
2019-08-21 19:52:04 +02:00
< / h3 >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/metrics/index.js#L43-L45' >
< span > src/metrics/index.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Must be called for stats to saved. Any data pushed for tracking
will be ignored.< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > start()< / div >
2019-08-21 19:52:04 +02:00
< / section >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< h3 class = 'fl m0' id = 'stop' >
stop
2019-08-21 19:52:04 +02:00
< / h3 >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/metrics/index.js#L51-L60' >
< span > src/metrics/index.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Stops all averages timers and prevents new data from being tracked.
Once < code > stop< / code > is called, < code > start< / code > must be called to resume stats tracking.< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > stop()< / div >
2019-08-21 19:52:04 +02:00
< / section >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< h3 class = 'fl m0' id = 'global' >
global
2019-08-21 19:52:04 +02:00
< / h3 >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/metrics/index.js#L66-L68' >
< span > src/metrics/index.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Gets the global < code > Stats< / code > object< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > global< / div >
2019-08-21 19:52:04 +02:00
< div class = 'py1 quiet mt1 prose-big' > Returns< / div >
2019-12-12 10:43:33 +01:00
< code > < a href = "#stats" > Stats< / a > < / code > :
2019-08-21 19:52:04 +02:00
< / section >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< h3 class = 'fl m0' id = 'peers' >
peers
2019-08-21 19:52:04 +02:00
< / h3 >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/metrics/index.js#L74-L76' >
< span > src/metrics/index.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Returns a list of < code > PeerId< / code > strings currently being tracked< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > peers< / div >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'py1 quiet mt1 prose-big' > Returns< / div >
< code > < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array" > Array< / a > < < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String" > string< / a > >< / code > :
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< / section >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
2019-08-21 19:52:04 +02:00
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< h3 class = 'fl m0' id = 'forpeer' >
forPeer
< / h3 >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/metrics/index.js#L84-L87' >
< span > src/metrics/index.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Returns the < code > Stats< / code > object for the given < code > PeerId< / code > whether it
is a live peer, or in the disconnected peer LRU cache.< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > forPeer(peerId: PeerId): < a href = "#stats" > Stats< / a > < / div >
2019-08-21 19:52:04 +02:00
< div class = 'py1 quiet mt1 prose-big' > Parameters< / div >
< div class = 'prose' >
< div class = 'space-bottom0' >
< div >
2019-12-12 10:43:33 +01:00
< span class = 'code bold' > peerId< / span > < code class = 'quiet' > (PeerId)< / code >
2019-08-21 19:52:04 +02:00
< / div >
< / div >
< / div >
< div class = 'py1 quiet mt1 prose-big' > Returns< / div >
2019-12-12 10:43:33 +01:00
< code > < a href = "#stats" > Stats< / a > < / code > :
2019-08-21 19:52:04 +02:00
< / section >
2019-12-12 10:43:33 +01:00
< section class = 'p2 mb2 clearfix bg-white minishadow' >
2019-08-21 19:52:04 +02:00
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< h3 class = 'fl m0' id = 'protocols' >
protocols
< / h3 >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/metrics/index.js#L93-L95' >
< span > src/metrics/index.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Returns a list of all protocol strings currently being tracked.< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > protocols< / div >
2019-08-21 19:52:04 +02:00
< div class = 'py1 quiet mt1 prose-big' > Returns< / div >
2019-12-12 10:43:33 +01:00
< code > < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array" > Array< / a > < < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String" > string< / a > >< / code > :
2019-08-21 19:52:04 +02:00
< / section >
2019-12-12 10:43:33 +01:00
< section class = 'p2 mb2 clearfix bg-white minishadow' >
2019-08-21 19:52:04 +02:00
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< h3 class = 'fl m0' id = 'forprotocol' >
forProtocol
< / h3 >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/metrics/index.js#L102-L104' >
< span > src/metrics/index.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Returns the < code > Stats< / code > object for the given < code > protocol< / code > .< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > forProtocol(protocol: < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String" > string< / a > ): < a href = "#stats" > Stats< / a > < / div >
2019-08-21 19:52:04 +02:00
< div class = 'py1 quiet mt1 prose-big' > Parameters< / div >
< div class = 'prose' >
< div class = 'space-bottom0' >
< div >
2019-12-12 10:43:33 +01:00
< span class = 'code bold' > protocol< / span > < code class = 'quiet' > (< a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String" > string< / a > )< / code >
2019-08-21 19:52:04 +02:00
< / div >
< / div >
< / div >
< div class = 'py1 quiet mt1 prose-big' > Returns< / div >
2019-12-12 10:43:33 +01:00
< code > < a href = "#stats" > Stats< / a > < / code > :
2019-08-21 19:52:04 +02:00
< / section >
2019-12-12 10:43:33 +01:00
< section class = 'p2 mb2 clearfix bg-white minishadow' >
2019-08-21 19:52:04 +02:00
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< h3 class = 'fl m0' id = 'onpeerdisconnected' >
onPeerDisconnected
< / h3 >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/metrics/index.js#L112-L120' >
< span > src/metrics/index.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Should be called when all connections to a given peer
have closed. The < code > Stats< / code > collection for the peer will
be stopped and moved to an LRU for temporary retention.< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > onPeerDisconnected(peerId: PeerId)< / div >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'py1 quiet mt1 prose-big' > Parameters< / div >
< div class = 'prose' >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'space-bottom0' >
< div >
< span class = 'code bold' > peerId< / span > < code class = 'quiet' > (PeerId)< / code >
< / div >
< / div >
< / div >
2019-08-21 19:52:04 +02:00
< / section >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< h3 class = 'fl m0' id = 'updateplaceholder' >
updatePlaceholder
2019-08-21 19:52:04 +02:00
< / h3 >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/metrics/index.js#L168-L186' >
< span > src/metrics/index.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Replaces the < code > PeerId< / code > string with the given < code > peerId< / code > .
If stats are already being tracked for the given < code > peerId< / code > , the
placeholder stats will be merged with the existing stats.< / p >
< div class = 'pre p1 fill-light mt0' > updatePlaceholder(placeholder: < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String" > string< / a > , peerId: PeerId)< / div >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'py1 quiet mt1 prose-big' > Parameters< / div >
< div class = 'prose' >
2019-08-21 19:52:04 +02:00
< div class = 'space-bottom0' >
2019-12-12 10:43:33 +01:00
< div >
< span class = 'code bold' > placeholder< / span > < code class = 'quiet' > (< a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String" > string< / a > )< / code >
A peerId string
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< / div >
2019-08-21 19:52:04 +02:00
< / div >
< div class = 'space-bottom0' >
2019-12-12 10:43:33 +01:00
< div >
< span class = 'code bold' > peerId< / span > < code class = 'quiet' > (PeerId)< / code >
< / div >
2019-08-21 19:52:04 +02:00
< / div >
< / div >
2019-12-12 10:43:33 +01:00
2019-08-21 19:52:04 +02:00
< / section >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< h3 class = 'fl m0' id = 'trackstream' >
trackStream
2019-08-21 19:52:04 +02:00
< / h3 >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/metrics/index.js#L201-L226' >
< span > src/metrics/index.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Tracks data running through a given Duplex Iterable < code > stream< / code > . If
the < code > peerId< / code > is not provided, a placeholder string will be created and
returned. This allows lazy tracking of a peer when the peer is not yet known.
When the < code > PeerId< / code > is known, < code > Metrics.updatePlaceholder< / code > should be called
with the placeholder string returned from here, and the known < code > PeerId< / code > .< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > trackStream(options: < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object" > Object< / a > ): < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String" > string< / a > < / div >
2019-08-21 19:52:04 +02:00
< div class = 'py1 quiet mt1 prose-big' > Parameters< / div >
< div class = 'prose' >
< div class = 'space-bottom0' >
< div >
2019-12-12 10:43:33 +01:00
< span class = 'code bold' > options< / span > < code class = 'quiet' > (< a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object" > Object< / a > )< / code >
2019-08-21 19:52:04 +02:00
< / div >
< table class = 'mt1 mb2 fixed-table h5 col-12' >
< colgroup >
< col width = '30%' / >
< col width = '70%' / >
< / colgroup >
< thead >
< tr class = 'bold fill-light' >
< th > Name< / th >
< th > Description< / th >
< / tr >
< / thead >
< tbody class = 'mt1' >
< tr >
2019-12-12 10:43:33 +01:00
< td class = 'break-word' > < span class = 'code bold' > options.stream< / span > < code class = 'quiet' > {sink: function (any), source: function ()}< / code >
2019-08-21 19:52:04 +02:00
< / td >
2019-12-12 10:43:33 +01:00
< td class = 'break-word' > < span > A duplex iterable stream
< / span > < / td >
2019-08-21 19:52:04 +02:00
< / tr >
< tr >
2019-12-12 10:43:33 +01:00
< td class = 'break-word' > < span class = 'code bold' > options.protocol< / span > < code class = 'quiet' > < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String" > string< / a > ?< / code >
2019-08-21 19:52:04 +02:00
< / td >
2019-12-12 10:43:33 +01:00
< td class = 'break-word' > < span > The protocol the stream is running
< / span > < / td >
2019-08-21 19:52:04 +02:00
< / tr >
< tr >
2019-12-12 10:43:33 +01:00
< td class = 'break-word' > < span class = 'code bold' > options.peerId< / span > < code class = 'quiet' > PeerId?< / code >
2019-08-21 19:52:04 +02:00
< / td >
2019-12-12 10:43:33 +01:00
< td class = 'break-word' > < span > The id of the remote peer that's connected
< / span > < / td >
2019-08-21 19:52:04 +02:00
< / tr >
< tr >
2019-12-12 10:43:33 +01:00
< td class = 'break-word' > < span class = 'code bold' > options.remotePeer< / span > < code class = 'quiet' > any< / code >
2019-08-21 19:52:04 +02:00
< / td >
< td class = 'break-word' > < span > < / span > < / td >
< / tr >
< / tbody >
< / table >
< / div >
< / div >
< div class = 'py1 quiet mt1 prose-big' > Returns< / div >
2019-12-12 10:43:33 +01:00
< code > < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String" > string< / a > < / code > :
The peerId string or placeholder string
2019-08-21 19:52:04 +02:00
< / section >
2019-12-12 10:43:33 +01:00
< section class = 'p2 mb2 clearfix bg-white minishadow' >
2019-08-21 19:52:04 +02:00
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< h3 class = 'fl m0' id = 'mergestats' >
mergeStats
< / h3 >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/metrics/index.js#L235-L244' >
< span > src/metrics/index.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Merges < code > other< / code > into < code > target< / code > . < code > target< / code > will be modified
and returned.< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > mergeStats(target: < a href = "#stats" > Stats< / a > , other: < a href = "#stats" > Stats< / a > ): < a href = "#stats" > Stats< / a > < / div >
2019-08-21 19:52:04 +02:00
< div class = 'py1 quiet mt1 prose-big' > Parameters< / div >
< div class = 'prose' >
< div class = 'space-bottom0' >
< div >
2019-12-12 10:43:33 +01:00
< span class = 'code bold' > target< / span > < code class = 'quiet' > (< a href = "#stats" > Stats< / a > )< / code >
2019-08-21 19:52:04 +02:00
< / div >
< / div >
< div class = 'space-bottom0' >
< div >
2019-12-12 10:43:33 +01:00
< span class = 'code bold' > other< / span > < code class = 'quiet' > (< a href = "#stats" > Stats< / a > )< / code >
2019-08-21 19:52:04 +02:00
< / div >
< / div >
< / div >
< div class = 'py1 quiet mt1 prose-big' > Returns< / div >
2019-12-12 10:43:33 +01:00
< code > < a href = "#stats" > Stats< / a > < / code > :
2019-08-21 19:52:04 +02:00
< / section >
2019-12-12 10:43:33 +01:00
< section class = 'p2 mb2 clearfix bg-white minishadow' >
2019-08-21 19:52:04 +02:00
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< h3 class = 'fl m0' id = 'old-peers' >
old-peers
< / h3 >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/metrics/old-peers.js#L11-L15' >
< span > src/metrics/old-peers.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Creates and returns a Least Recently Used Cache< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > old-peers(maxSize: < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number" > Number< / a > ): LRUCache< / div >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'py1 quiet mt1 prose-big' > Parameters< / div >
< div class = 'prose' >
< div class = 'space-bottom0' >
< div >
< span class = 'code bold' > maxSize< / span > < code class = 'quiet' > (< a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number" > Number< / a > )< / code >
< / div >
< / div >
< / div >
2019-08-21 19:52:04 +02:00
< div class = 'py1 quiet mt1 prose-big' > Returns< / div >
2019-12-12 10:43:33 +01:00
< code > LRUCache< / code > :
2019-08-21 19:52:04 +02:00
< / section >
2019-12-12 10:43:33 +01:00
< section class = 'p2 mb2 clearfix bg-white minishadow' >
2019-08-21 19:52:04 +02:00
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< h3 class = 'fl m0' id = 'stats' >
Stats
< / h3 >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/metrics/stats.js#L14-L262' >
< span > src/metrics/stats.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > A queue based manager for stat processing< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > new Stats(initialCounters: < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array" > Array< / a > < < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String" > string< / a > >, options: any)< / div >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< p >
Extends
EventEmitter
< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'py1 quiet mt1 prose-big' > Parameters< / div >
< div class = 'prose' >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'space-bottom0' >
< div >
< span class = 'code bold' > initialCounters< / span > < code class = 'quiet' > (< a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array" > Array< / a > < < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String" > string< / a > >)< / code >
< / div >
< / div >
< div class = 'space-bottom0' >
< div >
< span class = 'code bold' > options< / span > < code class = 'quiet' > (any)< / code >
< / div >
< / div >
< / div >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'py1 quiet mt1 prose-big' > Instance Members< / div >
< div class = "clearfix" >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'border-bottom' id = 'statsstart' >
2019-08-21 19:52:04 +02:00
< div class = "clearfix small pointer toggle-sibling" >
< div class = "py1 contain" >
< a class = 'icon pin-right py1 dark-link caret-right' > ▸< / a >
2019-12-12 10:43:33 +01:00
< span class = 'code strong strong truncate' > start()< / span >
2019-08-21 19:52:04 +02:00
< / div >
< / div >
< div class = "clearfix display-none toggle-target" >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/metrics/stats.js#L49-L53' >
< span > src/metrics/stats.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Initializes the internal timer if there are items in the queue. This
should only need to be called if < code > Stats.stop< / code > was previously called, as
< code > Stats.push< / code > will also start the processing.< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > start(): void< / div >
2019-08-21 19:52:04 +02:00
< div class = 'py1 quiet mt1 prose-big' > Returns< / div >
< code > void< / code > :
< / section >
< / div >
< / div >
2019-12-12 10:43:33 +01:00
< div class = 'border-bottom' id = 'statsstop' >
2019-08-21 19:52:04 +02:00
< div class = "clearfix small pointer toggle-sibling" >
< div class = "py1 contain" >
< a class = 'icon pin-right py1 dark-link caret-right' > ▸< / a >
2019-12-12 10:43:33 +01:00
< span class = 'code strong strong truncate' > stop()< / span >
2019-08-21 19:52:04 +02:00
< / div >
< / div >
< div class = "clearfix display-none toggle-target" >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/metrics/stats.js#L61-L66' >
< span > src/metrics/stats.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Stops processing and computing of stats by clearing the internal
timer.< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > stop(): void< / div >
2019-08-21 19:52:04 +02:00
< div class = 'py1 quiet mt1 prose-big' > Returns< / div >
< code > void< / code > :
< / section >
< / div >
< / div >
2019-12-12 10:43:33 +01:00
< div class = 'border-bottom' id = 'statssnapshot' >
< div class = "clearfix small pointer toggle-sibling" >
< div class = "py1 contain" >
< a class = 'icon pin-right py1 dark-link caret-right' > ▸< / a >
< span class = 'code strong strong truncate' > snapshot< / span >
< / div >
< / div >
< div class = "clearfix display-none toggle-target" >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
2019-08-21 19:52:04 +02:00
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/metrics/stats.js#L73-L75' >
< span > src/metrics/stats.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Returns a clone of the current stats.< / p >
< div class = 'pre p1 fill-light mt0' > snapshot< / div >
2019-08-21 19:52:04 +02:00
< div class = 'py1 quiet mt1 prose-big' > Returns< / div >
2019-12-12 10:43:33 +01:00
< code > < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Map" > Map< / a > < < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String" > string< / a > , Stat>< / code > :
2019-08-21 19:52:04 +02:00
< / section >
2019-12-12 10:43:33 +01:00
< / div >
< / div >
< div class = 'border-bottom' id = 'statsmovingaverages' >
< div class = "clearfix small pointer toggle-sibling" >
< div class = "py1 contain" >
< a class = 'icon pin-right py1 dark-link caret-right' > ▸< / a >
< span class = 'code strong strong truncate' > movingAverages< / span >
< / div >
< / div >
< div class = "clearfix display-none toggle-target" >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
2019-08-21 19:52:04 +02:00
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/metrics/stats.js#L82-L84' >
< span > src/metrics/stats.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Returns a clone of the internal movingAverages< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > movingAverages< / div >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'py1 quiet mt1 prose-big' > Returns< / div >
< code > < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array" > Array< / a > < MovingAverage>< / code > :
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
2019-08-21 19:52:04 +02:00
< / section >
2019-12-12 10:43:33 +01:00
< / div >
< / div >
< div class = 'border-bottom' id = 'statstojson' >
< div class = "clearfix small pointer toggle-sibling" >
< div class = "py1 contain" >
< a class = 'icon pin-right py1 dark-link caret-right' > ▸< / a >
< span class = 'code strong strong truncate' > toJSON()< / span >
< / div >
< / div >
< div class = "clearfix display-none toggle-target" >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
2019-08-21 19:52:04 +02:00
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/metrics/stats.js#L91-L109' >
< span > src/metrics/stats.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Returns a plain JSON object of the stats< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > toJSON(): any< / div >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'py1 quiet mt1 prose-big' > Returns< / div >
< code > any< / code > :
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
2019-08-21 19:52:04 +02:00
< / section >
2019-12-12 10:43:33 +01:00
< / div >
< / div >
< div class = 'border-bottom' id = 'statspush' >
< div class = "clearfix small pointer toggle-sibling" >
< div class = "py1 contain" >
< a class = 'icon pin-right py1 dark-link caret-right' > ▸< / a >
< span class = 'code strong strong truncate' > push(counter, inc)< / span >
< / div >
< / div >
< div class = "clearfix display-none toggle-target" >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
2019-08-21 19:52:04 +02:00
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/metrics/stats.js#L119-L122' >
< span > src/metrics/stats.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Pushes the given operation data to the queue, along with the
current Timestamp, then resets the update timer.< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > push(counter: < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String" > string< / a > , inc: < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number" > number< / a > ): void< / div >
2019-08-21 19:52:04 +02:00
< div class = 'py1 quiet mt1 prose-big' > Parameters< / div >
< div class = 'prose' >
< div class = 'space-bottom0' >
< div >
2019-12-12 10:43:33 +01:00
< span class = 'code bold' > counter< / span > < code class = 'quiet' > (< a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String" > string< / a > )< / code >
< / div >
< / div >
< div class = 'space-bottom0' >
< div >
< span class = 'code bold' > inc< / span > < code class = 'quiet' > (< a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number" > number< / a > )< / code >
2019-08-21 19:52:04 +02:00
< / div >
< / div >
< / div >
2019-12-12 10:43:33 +01:00
< div class = 'py1 quiet mt1 prose-big' > Returns< / div >
< code > void< / code > :
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< / section >
< / div >
< / div >
< / div >
2019-08-21 19:52:04 +02:00
< / section >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< h3 class = 'fl m0' id = 'constructor' >
constructor
2019-08-21 19:52:04 +02:00
< / h3 >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/transport-manager.js#L17-L22' >
< span > src/transport-manager.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > new constructor(options: < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object" > object< / a > )< / div >
2019-08-21 19:52:04 +02:00
< div class = 'py1 quiet mt1 prose-big' > Parameters< / div >
< div class = 'prose' >
< div class = 'space-bottom0' >
< div >
< span class = 'code bold' > options< / span > < code class = 'quiet' > (< a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object" > object< / a > )< / code >
< / div >
< table class = 'mt1 mb2 fixed-table h5 col-12' >
< colgroup >
< col width = '30%' / >
< col width = '70%' / >
< / colgroup >
< thead >
< tr class = 'bold fill-light' >
< th > Name< / th >
< th > Description< / th >
< / tr >
< / thead >
< tbody class = 'mt1' >
< tr >
2019-12-12 10:43:33 +01:00
< td class = 'break-word' > < span class = 'code bold' > options.libp2p< / span > < code class = 'quiet' > < a href = "#libp2p" > Libp2p< / a > < / code >
2019-08-21 19:52:04 +02:00
< / td >
2019-12-12 10:43:33 +01:00
< td class = 'break-word' > < span > The Libp2p instance. It will be passed to the transports.
2019-08-21 19:52:04 +02:00
< / span > < / td >
< / tr >
< tr >
2019-12-12 10:43:33 +01:00
< td class = 'break-word' > < span class = 'code bold' > options.upgrader< / span > < code class = 'quiet' > < a href = "#upgrader" > Upgrader< / a > < / code >
2019-08-21 19:52:04 +02:00
< / td >
2019-12-12 10:43:33 +01:00
< td class = 'break-word' > < span > The upgrader to provide to the transports
2019-08-21 19:52:04 +02:00
< / span > < / td >
< / tr >
< / tbody >
< / table >
< / div >
< / div >
< / section >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< h3 class = 'fl m0' id = 'add' >
add
2019-08-21 19:52:04 +02:00
< / h3 >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/transport-manager.js#L31-L49' >
< span > src/transport-manager.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Adds a < code > Transport< / code > to the manager< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > add(key: < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String" > String< / a > , Transport: Transport): void< / div >
2019-08-21 19:52:04 +02:00
< div class = 'py1 quiet mt1 prose-big' > Parameters< / div >
< div class = 'prose' >
< div class = 'space-bottom0' >
< div >
2019-12-12 10:43:33 +01:00
< span class = 'code bold' > key< / span > < code class = 'quiet' > (< a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String" > String< / a > )< / code >
2019-08-21 19:52:04 +02:00
< / div >
< / div >
< div class = 'space-bottom0' >
< div >
2019-12-12 10:43:33 +01:00
< span class = 'code bold' > Transport< / span > < code class = 'quiet' > (Transport)< / code >
2019-08-21 19:52:04 +02:00
< / div >
< / div >
< / div >
2019-12-12 10:43:33 +01:00
< div class = 'py1 quiet mt1 prose-big' > Returns< / div >
< code > void< / code > :
2019-08-21 19:52:04 +02:00
< / section >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< h3 class = 'fl m0' id = 'close' >
close
2019-08-21 19:52:04 +02:00
< / h3 >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/transport-manager.js#L55-L70' >
< span > src/transport-manager.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Stops all listeners< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > close()< / div >
2019-08-21 19:52:04 +02:00
< / section >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< h3 class = 'fl m0' id = 'dial' >
dial
2019-08-21 19:52:04 +02:00
< / h3 >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/transport-manager.js#L78-L90' >
< span > src/transport-manager.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Dials the given Multiaddr over it's supported transport< / p >
< div class = 'pre p1 fill-light mt0' > dial(ma: Multiaddr, options: any): < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise" > Promise< / a > < Connection>< / div >
2019-08-21 19:52:04 +02:00
< div class = 'py1 quiet mt1 prose-big' > Parameters< / div >
< div class = 'prose' >
< div class = 'space-bottom0' >
< div >
2019-12-12 10:43:33 +01:00
< span class = 'code bold' > ma< / span > < code class = 'quiet' > (Multiaddr)< / code >
< / div >
< / div >
< div class = 'space-bottom0' >
< div >
< span class = 'code bold' > options< / span > < code class = 'quiet' > (any)< / code >
2019-08-21 19:52:04 +02:00
< / div >
< / div >
< / div >
2019-12-12 10:43:33 +01:00
< div class = 'py1 quiet mt1 prose-big' > Returns< / div >
< code > < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise" > Promise< / a > < Connection>< / code > :
2019-08-21 19:52:04 +02:00
< / section >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< h3 class = 'fl m0' id = 'getaddrs' >
getAddrs
2019-08-21 19:52:04 +02:00
< / h3 >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/transport-manager.js#L96-L104' >
< span > src/transport-manager.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Returns all Multiaddr's the listeners are using< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > getAddrs(): < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array" > Array< / a > < Multiaddr>< / div >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'py1 quiet mt1 prose-big' > Returns< / div >
< code > < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array" > Array< / a > < Multiaddr>< / code > :
2019-08-21 19:52:04 +02:00
< / section >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< h3 class = 'fl m0' id = 'gettransports' >
getTransports
2019-08-21 19:52:04 +02:00
< / h3 >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/transport-manager.js#L110-L112' >
< span > src/transport-manager.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Returns all the transports instances.< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > getTransports(): Iterator< Transport>< / div >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'py1 quiet mt1 prose-big' > Returns< / div >
< code > Iterator< Transport>< / code > :
2019-08-21 19:52:04 +02:00
< / section >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< h3 class = 'fl m0' id = 'transportformultiaddr' >
transportForMultiaddr
2019-08-21 19:52:04 +02:00
< / h3 >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/transport-manager.js#L119-L125' >
< span > src/transport-manager.js< / span >
< / a >
< / div >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< p > Finds a transport that matches the given Multiaddr< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > transportForMultiaddr(ma: Multiaddr): (Transport | null)< / div >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'py1 quiet mt1 prose-big' > Parameters< / div >
< div class = 'prose' >
< div class = 'space-bottom0' >
< div >
< span class = 'code bold' > ma< / span > < code class = 'quiet' > (Multiaddr)< / code >
< / div >
2019-08-21 19:52:04 +02:00
< / div >
< / div >
< div class = 'py1 quiet mt1 prose-big' > Returns< / div >
2019-12-12 10:43:33 +01:00
< code > (Transport | null)< / code > :
2019-08-21 19:52:04 +02:00
< / section >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< h3 class = 'fl m0' id = 'listen' >
listen
2019-08-21 19:52:04 +02:00
< / h3 >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/transport-manager.js#L132-L175' >
< span > src/transport-manager.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Starts listeners for each given Multiaddr.< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > listen(addrs: < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array" > Array< / a > < Multiaddr>)< / div >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'py1 quiet mt1 prose-big' > Parameters< / div >
< div class = 'prose' >
< div class = 'space-bottom0' >
< div >
< span class = 'code bold' > addrs< / span > < code class = 'quiet' > (< a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array" > Array< / a > < Multiaddr>)< / code >
< / div >
< / div >
< / div >
2019-08-21 19:52:04 +02:00
< / section >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< h3 class = 'fl m0' id = 'remove' >
remove
2019-08-21 19:52:04 +02:00
< / h3 >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/transport-manager.js#L184-L195' >
< span > src/transport-manager.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Removes the given transport from the manager.
If a transport has any running listeners, they will be closed.< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > remove(key: < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String" > string< / a > )< / div >
2019-08-21 19:52:04 +02:00
< div class = 'py1 quiet mt1 prose-big' > Parameters< / div >
< div class = 'prose' >
< div class = 'space-bottom0' >
< div >
2019-12-12 10:43:33 +01:00
< span class = 'code bold' > key< / span > < code class = 'quiet' > (< a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String" > string< / a > )< / code >
2019-08-21 19:52:04 +02:00
< / div >
< / div >
< / div >
< / section >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< h3 class = 'fl m0' id = 'removeall' >
removeAll
2019-08-21 19:52:04 +02:00
< / h3 >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/transport-manager.js#L202-L209' >
< span > src/transport-manager.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Removes all transports from the manager.
If any listeners are running, they will be closed.< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > removeAll()< / div >
2019-08-21 19:52:04 +02:00
< / section >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< h3 class = 'fl m0' id = 'upgrader' >
Upgrader
2019-08-21 19:52:04 +02:00
< / h3 >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/upgrader.js#L30-L398' >
< span > src/upgrader.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > new Upgrader($0: < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object" > Object< / a > )< / div >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'py1 quiet mt1 prose-big' > Parameters< / div >
< div class = 'prose' >
< div class = 'space-bottom0' >
< div >
< span class = 'code bold' > $0< / span > < code class = 'quiet' > (< a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object" > Object< / a > )< / code >
< / div >
< table class = 'mt1 mb2 fixed-table h5 col-12' >
< colgroup >
< col width = '30%' / >
< col width = '70%' / >
< / colgroup >
< thead >
< tr class = 'bold fill-light' >
< th > Name< / th >
< th > Description< / th >
< / tr >
< / thead >
< tbody class = 'mt1' >
< tr >
< td class = 'break-word' > < span class = 'code bold' > $0.localPeer< / span > < code class = 'quiet' > any< / code >
< / td >
< td class = 'break-word' > < span > < / span > < / td >
< / tr >
< tr >
< td class = 'break-word' > < span class = 'code bold' > $0.metrics< / span > < code class = 'quiet' > any< / code >
< / td >
< td class = 'break-word' > < span > < / span > < / td >
< / tr >
< tr >
< td class = 'break-word' > < span class = 'code bold' > $0.cryptos< / span > < code class = 'quiet' > any< / code >
< / td >
< td class = 'break-word' > < span > < / span > < / td >
< / tr >
< tr >
< td class = 'break-word' > < span class = 'code bold' > $0.muxers< / span > < code class = 'quiet' > any< / code >
< / td >
< td class = 'break-word' > < span > < / span > < / td >
< / tr >
< tr >
< td class = 'break-word' > < span class = 'code bold' > $0.onConnectionEnd< / span > < code class = 'quiet' > any< / code >
(default < code > ()=> {}< / code > )
< / td >
< td class = 'break-word' > < span > < / span > < / td >
< / tr >
< tr >
< td class = 'break-word' > < span class = 'code bold' > $0.onConnection< / span > < code class = 'quiet' > any< / code >
(default < code > ()=> {}< / code > )
< / td >
< td class = 'break-word' > < span > < / span > < / td >
< / tr >
< / tbody >
< / table >
< / div >
< / div >
2019-08-21 19:52:04 +02:00
< div class = 'py1 quiet mt1 prose-big' > Properties< / div >
< div >
< div class = 'space-bottom0' >
2019-12-12 10:43:33 +01:00
< span class = 'code bold' > sink< / span > < code class = 'quiet' > (< a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function" > function< / a > )< / code >
2019-08-21 19:52:04 +02:00
< / div >
< div class = 'space-bottom0' >
2019-12-12 10:43:33 +01:00
< span class = 'code bold' > source< / span > < code class = 'quiet' > (AsyncIterator)< / code >
2019-08-21 19:52:04 +02:00
< / div >
< div class = 'space-bottom0' >
2019-12-12 10:43:33 +01:00
< span class = 'code bold' > conn< / span > < code class = 'quiet' > (any)< / code >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< / div >
< div class = 'space-bottom0' >
< span class = 'code bold' > remoteAddr< / span > < code class = 'quiet' > (Multiaddr)< / code >
2019-08-21 19:52:04 +02:00
< / div >
< / div >
2019-12-12 10:43:33 +01:00
< div class = 'py1 quiet mt1 prose-big' > Instance Members< / div >
< div class = "clearfix" >
< div class = 'border-bottom' id = 'upgraderupgradeinbound' >
< div class = "clearfix small pointer toggle-sibling" >
< div class = "py1 contain" >
< a class = 'icon pin-right py1 dark-link caret-right' > ▸< / a >
< span class = 'code strong strong truncate' > upgradeInbound(maConn)< / span >
< / div >
< / div >
< div class = "clearfix display-none toggle-target" >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
< div class = 'clearfix' >
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/upgrader.js#L64-L120' >
< span > src/upgrader.js< / span >
< / a >
< / div >
< p > Upgrades an inbound connection< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > upgradeInbound(maConn: MultiaddrConnection): < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise" > Promise< / a > < Connection>< / div >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'py1 quiet mt1 prose-big' > Parameters< / div >
< div class = 'prose' >
< div class = 'space-bottom0' >
< div >
< span class = 'code bold' > maConn< / span > < code class = 'quiet' > (MultiaddrConnection)< / code >
< / div >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< / div >
< / div >
< div class = 'py1 quiet mt1 prose-big' > Returns< / div >
< code > < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise" > Promise< / a > < Connection>< / code > :
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< / section >
< / div >
< / div >
< div class = 'border-bottom' id = 'upgraderupgradeoutbound' >
< div class = "clearfix small pointer toggle-sibling" >
< div class = "py1 contain" >
< a class = 'icon pin-right py1 dark-link caret-right' > ▸< / a >
< span class = 'code strong strong truncate' > upgradeOutbound(maConn)< / span >
< / div >
< / div >
< div class = "clearfix display-none toggle-target" >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
2019-08-21 19:52:04 +02:00
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/upgrader.js#L128-L190' >
< span > src/upgrader.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Upgrades an outbound connection< / p >
< div class = 'pre p1 fill-light mt0' > upgradeOutbound(maConn: MultiaddrConnection): < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise" > Promise< / a > < Connection>< / div >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'py1 quiet mt1 prose-big' > Parameters< / div >
< div class = 'prose' >
< div class = 'space-bottom0' >
< div >
< span class = 'code bold' > maConn< / span > < code class = 'quiet' > (MultiaddrConnection)< / code >
< / div >
< / div >
< / div >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'py1 quiet mt1 prose-big' > Returns< / div >
< code > < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise" > Promise< / a > < Connection>< / code > :
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< / section >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< / div >
< / div >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< / div >
2019-08-21 19:52:04 +02:00
< / section >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< h3 class = 'fl m0' id = 'upgrader' >
Upgrader
2019-08-21 19:52:04 +02:00
< / h3 >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/upgrader.js#L30-L398' >
< span > src/upgrader.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > new Upgrader($0: < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object" > Object< / a > , options: < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object" > object< / a > )< / div >
2019-08-21 19:52:04 +02:00
< div class = 'py1 quiet mt1 prose-big' > Parameters< / div >
< div class = 'prose' >
< div class = 'space-bottom0' >
< div >
2019-12-12 10:43:33 +01:00
< span class = 'code bold' > $0< / span > < code class = 'quiet' > (< a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object" > Object< / a > )< / code >
2019-08-21 19:52:04 +02:00
< / div >
< table class = 'mt1 mb2 fixed-table h5 col-12' >
< colgroup >
< col width = '30%' / >
< col width = '70%' / >
< / colgroup >
< thead >
< tr class = 'bold fill-light' >
< th > Name< / th >
< th > Description< / th >
< / tr >
< / thead >
< tbody class = 'mt1' >
< tr >
2019-12-12 10:43:33 +01:00
< td class = 'break-word' > < span class = 'code bold' > $0.localPeer< / span > < code class = 'quiet' > any< / code >
< / td >
< td class = 'break-word' > < span > < / span > < / td >
< / tr >
< tr >
< td class = 'break-word' > < span class = 'code bold' > $0.metrics< / span > < code class = 'quiet' > any< / code >
< / td >
< td class = 'break-word' > < span > < / span > < / td >
< / tr >
< tr >
< td class = 'break-word' > < span class = 'code bold' > $0.cryptos< / span > < code class = 'quiet' > any< / code >
< / td >
< td class = 'break-word' > < span > < / span > < / td >
< / tr >
< tr >
< td class = 'break-word' > < span class = 'code bold' > $0.muxers< / span > < code class = 'quiet' > any< / code >
2019-08-21 19:52:04 +02:00
< / td >
< td class = 'break-word' > < span > < / span > < / td >
< / tr >
< tr >
2019-12-12 10:43:33 +01:00
< td class = 'break-word' > < span class = 'code bold' > $0.onConnectionEnd< / span > < code class = 'quiet' > any< / code >
(default < code > ()=> {}< / code > )
2019-08-21 19:52:04 +02:00
< / td >
< td class = 'break-word' > < span > < / span > < / td >
< / tr >
< tr >
2019-12-12 10:43:33 +01:00
< td class = 'break-word' > < span class = 'code bold' > $0.onConnection< / span > < code class = 'quiet' > any< / code >
(default < code > ()=> {}< / code > )
2019-08-21 19:52:04 +02:00
< / td >
< td class = 'break-word' > < span > < / span > < / td >
< / tr >
< / tbody >
< / table >
< / div >
2019-12-12 10:43:33 +01:00
< div class = 'space-bottom0' >
< div >
< span class = 'code bold' > options< / span > < code class = 'quiet' > (< a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object" > object< / a > )< / code >
< / div >
< / div >
2019-08-21 19:52:04 +02:00
< / div >
2019-12-12 10:43:33 +01:00
< div class = 'py1 quiet mt1 prose-big' > Properties< / div >
< div >
< div class = 'space-bottom0' >
< span class = 'code bold' > conn< / span > < code class = 'quiet' > (any)< / code >
: A duplex iterable
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< / div >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'space-bottom0' >
< span class = 'code bold' > remotePeer< / span > < code class = 'quiet' > (PeerId)< / code >
< / div >
< div class = 'space-bottom0' >
< span class = 'code bold' > protocol< / span > < code class = 'quiet' > (< a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String" > string< / a > )< / code >
< / div >
< / div >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'py1 quiet mt1 prose-big' > Instance Members< / div >
< div class = "clearfix" >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'border-bottom' id = 'upgraderupgradeinbound' >
< div class = "clearfix small pointer toggle-sibling" >
< div class = "py1 contain" >
< a class = 'icon pin-right py1 dark-link caret-right' > ▸< / a >
< span class = 'code strong strong truncate' > upgradeInbound(maConn)< / span >
< / div >
< / div >
< div class = "clearfix display-none toggle-target" >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
2019-08-21 19:52:04 +02:00
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/upgrader.js#L64-L120' >
< span > src/upgrader.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Upgrades an inbound connection< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > upgradeInbound(maConn: MultiaddrConnection): < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise" > Promise< / a > < Connection>< / div >
2019-08-21 19:52:04 +02:00
< div class = 'py1 quiet mt1 prose-big' > Parameters< / div >
< div class = 'prose' >
< div class = 'space-bottom0' >
< div >
2019-12-12 10:43:33 +01:00
< span class = 'code bold' > maConn< / span > < code class = 'quiet' > (MultiaddrConnection)< / code >
2019-08-21 19:52:04 +02:00
< / div >
< / div >
< / div >
< div class = 'py1 quiet mt1 prose-big' > Returns< / div >
2019-12-12 10:43:33 +01:00
< code > < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise" > Promise< / a > < Connection>< / code > :
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< / section >
< / div >
< / div >
< div class = 'border-bottom' id = 'upgraderupgradeoutbound' >
2019-08-21 19:52:04 +02:00
< div class = "clearfix small pointer toggle-sibling" >
< div class = "py1 contain" >
< a class = 'icon pin-right py1 dark-link caret-right' > ▸< / a >
2019-12-12 10:43:33 +01:00
< span class = 'code strong strong truncate' > upgradeOutbound(maConn)< / span >
2019-08-21 19:52:04 +02:00
< / div >
< / div >
< div class = "clearfix display-none toggle-target" >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/upgrader.js#L128-L190' >
< span > src/upgrader.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Upgrades an outbound connection< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > upgradeOutbound(maConn: MultiaddrConnection): < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise" > Promise< / a > < Connection>< / div >
2019-08-21 19:52:04 +02:00
< div class = 'py1 quiet mt1 prose-big' > Parameters< / div >
< div class = 'prose' >
< div class = 'space-bottom0' >
< div >
2019-12-12 10:43:33 +01:00
< span class = 'code bold' > maConn< / span > < code class = 'quiet' > (MultiaddrConnection)< / code >
2019-08-21 19:52:04 +02:00
< / div >
< / div >
< / div >
< div class = 'py1 quiet mt1 prose-big' > Returns< / div >
2019-12-12 10:43:33 +01:00
< code > < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise" > Promise< / a > < Connection>< / code > :
2019-08-21 19:52:04 +02:00
< / section >
< / div >
< / div >
2019-12-12 10:43:33 +01:00
< / div >
< / section >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
2019-08-21 19:52:04 +02:00
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< h3 class = 'fl m0' id = 'peerstore' >
PeerStore
< / h3 >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/peer-store/index.js#L19-L230' >
< span > src/peer-store/index.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Responsible for managing known peers, as well as their addresses and metadata< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > new PeerStore()< / div >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< p >
Extends
EventEmitter
< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'py1 quiet mt1 prose-big' > Instance Members< / div >
< div class = "clearfix" >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'border-bottom' id = 'peerstorepeers' >
2019-08-21 19:52:04 +02:00
< div class = "clearfix small pointer toggle-sibling" >
< div class = "py1 contain" >
< a class = 'icon pin-right py1 dark-link caret-right' > ▸< / a >
2019-12-12 10:43:33 +01:00
< span class = 'code strong strong truncate' > peers< / span >
2019-08-21 19:52:04 +02:00
< / div >
< / div >
< div class = "clearfix display-none toggle-target" >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/peer-store/index.js#L28-L28' >
< span > src/peer-store/index.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Map of peers< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > peers< / div >
< p >
Type:
< a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Map" > Map< / a > < < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String" > string< / a > , PeerInfo>
< / p >
2019-08-21 19:52:04 +02:00
< / section >
< / div >
< / div >
2019-12-12 10:43:33 +01:00
< div class = 'border-bottom' id = 'peerstoreput' >
2019-08-21 19:52:04 +02:00
< div class = "clearfix small pointer toggle-sibling" >
< div class = "py1 contain" >
< a class = 'icon pin-right py1 dark-link caret-right' > ▸< / a >
2019-12-12 10:43:33 +01:00
< span class = 'code strong strong truncate' > put(peerInfo)< / span >
2019-08-21 19:52:04 +02:00
< / div >
< / div >
< div class = "clearfix display-none toggle-target" >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/peer-store/index.js#L43-L57' >
< span > src/peer-store/index.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Stores the peerInfo of a new peer.
If already exist, its info is updated.< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > put(peerInfo: PeerInfo): PeerInfo< / div >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'py1 quiet mt1 prose-big' > Parameters< / div >
< div class = 'prose' >
< div class = 'space-bottom0' >
< div >
< span class = 'code bold' > peerInfo< / span > < code class = 'quiet' > (PeerInfo)< / code >
< / div >
< / div >
< / div >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'py1 quiet mt1 prose-big' > Returns< / div >
< code > PeerInfo< / code > :
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
2019-08-21 19:52:04 +02:00
< / section >
< / div >
< / div >
2019-12-12 10:43:33 +01:00
< div class = 'border-bottom' id = 'peerstoreadd' >
2019-08-21 19:52:04 +02:00
< div class = "clearfix small pointer toggle-sibling" >
< div class = "py1 contain" >
< a class = 'icon pin-right py1 dark-link caret-right' > ▸< / a >
2019-12-12 10:43:33 +01:00
< span class = 'code strong strong truncate' > add(peerInfo)< / span >
2019-08-21 19:52:04 +02:00
< / div >
< / div >
< div class = "clearfix display-none toggle-target" >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/peer-store/index.js#L64-L95' >
< span > src/peer-store/index.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Add a new peer to the store.< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > add(peerInfo: PeerInfo): PeerInfo< / div >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'py1 quiet mt1 prose-big' > Parameters< / div >
< div class = 'prose' >
< div class = 'space-bottom0' >
< div >
< span class = 'code bold' > peerInfo< / span > < code class = 'quiet' > (PeerInfo)< / code >
< / div >
< / div >
< / div >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'py1 quiet mt1 prose-big' > Returns< / div >
< code > PeerInfo< / code > :
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
2019-08-21 19:52:04 +02:00
< / section >
< / div >
< / div >
2019-12-12 10:43:33 +01:00
< div class = 'border-bottom' id = 'peerstoreupdate' >
2019-08-21 19:52:04 +02:00
< div class = "clearfix small pointer toggle-sibling" >
< div class = "py1 contain" >
< a class = 'icon pin-right py1 dark-link caret-right' > ▸< / a >
2019-12-12 10:43:33 +01:00
< span class = 'code strong strong truncate' > update(peerInfo)< / span >
2019-08-21 19:52:04 +02:00
< / div >
< / div >
< div class = "clearfix display-none toggle-target" >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/peer-store/index.js#L102-L155' >
< span > src/peer-store/index.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Updates an already known peer.< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > update(peerInfo: PeerInfo): PeerInfo< / div >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'py1 quiet mt1 prose-big' > Parameters< / div >
< div class = 'prose' >
< div class = 'space-bottom0' >
< div >
< span class = 'code bold' > peerInfo< / span > < code class = 'quiet' > (PeerInfo)< / code >
< / div >
< / div >
< / div >
2019-08-21 19:52:04 +02:00
< div class = 'py1 quiet mt1 prose-big' > Returns< / div >
2019-12-12 10:43:33 +01:00
< code > PeerInfo< / code > :
2019-08-21 19:52:04 +02:00
< / section >
< / div >
< / div >
2019-12-12 10:43:33 +01:00
< div class = 'border-bottom' id = 'peerstoreget' >
< div class = "clearfix small pointer toggle-sibling" >
< div class = "py1 contain" >
< a class = 'icon pin-right py1 dark-link caret-right' > ▸< / a >
< span class = 'code strong strong truncate' > get(peerId)< / span >
< / div >
< / div >
< div class = "clearfix display-none toggle-target" >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
2019-08-21 19:52:04 +02:00
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/peer-store/index.js#L162-L169' >
< span > src/peer-store/index.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Get the info to the given id.< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > get(peerId: (PeerId | < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String" > string< / a > )): PeerInfo< / div >
2019-08-21 19:52:04 +02:00
< div class = 'py1 quiet mt1 prose-big' > Parameters< / div >
< div class = 'prose' >
< div class = 'space-bottom0' >
< div >
2019-12-12 10:43:33 +01:00
< span class = 'code bold' > peerId< / span > < code class = 'quiet' > ((PeerId | < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String" > string< / a > ))< / code >
b58str id
2019-08-21 19:52:04 +02:00
< / div >
< / div >
< / div >
< div class = 'py1 quiet mt1 prose-big' > Returns< / div >
2019-12-12 10:43:33 +01:00
< code > PeerInfo< / code > :
2019-08-21 19:52:04 +02:00
< / section >
2019-12-12 10:43:33 +01:00
< / div >
< / div >
< div class = 'border-bottom' id = 'peerstorehas' >
< div class = "clearfix small pointer toggle-sibling" >
< div class = "py1 contain" >
< a class = 'icon pin-right py1 dark-link caret-right' > ▸< / a >
< span class = 'code strong strong truncate' > has(peerId)< / span >
< / div >
< / div >
< div class = "clearfix display-none toggle-target" >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
2019-08-21 19:52:04 +02:00
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/peer-store/index.js#L176-L183' >
< span > src/peer-store/index.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Has the info to the given id.< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > has(peerId: (PeerId | < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String" > string< / a > )): < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean" > boolean< / a > < / div >
2019-08-21 19:52:04 +02:00
< div class = 'py1 quiet mt1 prose-big' > Parameters< / div >
< div class = 'prose' >
< div class = 'space-bottom0' >
< div >
2019-12-12 10:43:33 +01:00
< span class = 'code bold' > peerId< / span > < code class = 'quiet' > ((PeerId | < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String" > string< / a > ))< / code >
b58str id
2019-08-21 19:52:04 +02:00
< / div >
< / div >
< / div >
< div class = 'py1 quiet mt1 prose-big' > Returns< / div >
2019-12-12 10:43:33 +01:00
< code > < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean" > boolean< / a > < / code > :
2019-08-21 19:52:04 +02:00
< / section >
2019-12-12 10:43:33 +01:00
< / div >
< / div >
< div class = 'border-bottom' id = 'peerstoreremove' >
< div class = "clearfix small pointer toggle-sibling" >
< div class = "py1 contain" >
< a class = 'icon pin-right py1 dark-link caret-right' > ▸< / a >
< span class = 'code strong strong truncate' > remove(peerId)< / span >
< / div >
< / div >
< div class = "clearfix display-none toggle-target" >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
2019-08-21 19:52:04 +02:00
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/peer-store/index.js#L190-L197' >
< span > src/peer-store/index.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Removes the Peer with the matching < code > peerId< / code > from the PeerStore< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > remove(peerId: (PeerId | < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String" > string< / a > )): < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean" > boolean< / a > < / div >
2019-08-21 19:52:04 +02:00
< div class = 'py1 quiet mt1 prose-big' > Parameters< / div >
< div class = 'prose' >
< div class = 'space-bottom0' >
< div >
2019-12-12 10:43:33 +01:00
< span class = 'code bold' > peerId< / span > < code class = 'quiet' > ((PeerId | < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String" > string< / a > ))< / code >
b58str id
2019-08-21 19:52:04 +02:00
< / div >
< / div >
< / div >
< div class = 'py1 quiet mt1 prose-big' > Returns< / div >
2019-12-12 10:43:33 +01:00
< code > < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean" > boolean< / a > < / code > :
true if found and removed
2019-08-21 19:52:04 +02:00
< / section >
2019-12-12 10:43:33 +01:00
< / div >
< / div >
< div class = 'border-bottom' id = 'peerstorereplace' >
< div class = "clearfix small pointer toggle-sibling" >
< div class = "py1 contain" >
< a class = 'icon pin-right py1 dark-link caret-right' > ▸< / a >
< span class = 'code strong strong truncate' > replace(peerInfo)< / span >
< / div >
< / div >
< div class = "clearfix display-none toggle-target" >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
2019-08-21 19:52:04 +02:00
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/peer-store/index.js#L204-L219' >
< span > src/peer-store/index.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Completely replaces the existing peers metadata with the given < code > peerInfo< / code > < / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > replace(peerInfo: PeerInfo): void< / div >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'py1 quiet mt1 prose-big' > Parameters< / div >
< div class = 'prose' >
< div class = 'space-bottom0' >
< div >
< span class = 'code bold' > peerInfo< / span > < code class = 'quiet' > (PeerInfo)< / code >
< / div >
< / div >
< / div >
2019-08-21 19:52:04 +02:00
< div class = 'py1 quiet mt1 prose-big' > Returns< / div >
2019-12-12 10:43:33 +01:00
< code > void< / code > :
2019-08-21 19:52:04 +02:00
< / section >
2019-12-12 10:43:33 +01:00
< / div >
< / div >
< div class = 'border-bottom' id = 'peerstoremultiaddrsforpeer' >
< div class = "clearfix small pointer toggle-sibling" >
< div class = "py1 contain" >
< a class = 'icon pin-right py1 dark-link caret-right' > ▸< / a >
< span class = 'code strong strong truncate' > multiaddrsForPeer(peerId)< / span >
< / div >
< / div >
< div class = "clearfix display-none toggle-target" >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
2019-08-21 19:52:04 +02:00
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/peer-store/index.js#L226-L229' >
< span > src/peer-store/index.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Returns the known multiaddrs for a given < code > PeerId< / code > < / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > multiaddrsForPeer(peerId: PeerId): < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array" > Array< / a > < Multiaddr>< / div >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'py1 quiet mt1 prose-big' > Parameters< / div >
< div class = 'prose' >
< div class = 'space-bottom0' >
< div >
< span class = 'code bold' > peerId< / span > < code class = 'quiet' > (PeerId)< / code >
< / div >
< / div >
< / div >
2019-08-21 19:52:04 +02:00
< div class = 'py1 quiet mt1 prose-big' > Returns< / div >
2019-12-12 10:43:33 +01:00
< code > < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array" > Array< / a > < Multiaddr>< / code > :
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< / section >
< / div >
< / div >
< / div >
2019-08-21 19:52:04 +02:00
< / section >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< h3 class = 'fl m0' id = 'registrar' >
Registrar
2019-08-21 19:52:04 +02:00
< / h3 >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/registrar.js#L15-L155' >
< span > src/registrar.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Responsible for notifying registered protocols of events in the network.< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > new Registrar($0: < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object" > Object< / a > , props: < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object" > Object< / a > )< / div >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'py1 quiet mt1 prose-big' > Parameters< / div >
< div class = 'prose' >
< div class = 'space-bottom0' >
< div >
< span class = 'code bold' > $0< / span > < code class = 'quiet' > (< a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object" > Object< / a > )< / code >
< / div >
< table class = 'mt1 mb2 fixed-table h5 col-12' >
< colgroup >
< col width = '30%' / >
< col width = '70%' / >
< / colgroup >
< thead >
< tr class = 'bold fill-light' >
< th > Name< / th >
< th > Description< / th >
< / tr >
< / thead >
< tbody class = 'mt1' >
< tr >
< td class = 'break-word' > < span class = 'code bold' > $0.peerStore< / span > < code class = 'quiet' > any< / code >
< / td >
< td class = 'break-word' > < span > < / span > < / td >
< / tr >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< / tbody >
< / table >
< / div >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'space-bottom0' >
< div >
< span class = 'code bold' > props< / span > < code class = 'quiet' > (< a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object" > Object< / a > )< / code >
< / div >
< / div >
< / div >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'py1 quiet mt1 prose-big' > Instance Members< / div >
< div class = "clearfix" >
< div class = 'border-bottom' id = 'registrarconnections' >
< div class = "clearfix small pointer toggle-sibling" >
< div class = "py1 contain" >
< a class = 'icon pin-right py1 dark-link caret-right' > ▸< / a >
< span class = 'code strong strong truncate' > connections< / span >
< / div >
< / div >
< div class = "clearfix display-none toggle-target" >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
2019-08-21 19:52:04 +02:00
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/registrar.js#L29-L29' >
< span > src/registrar.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Map of connections per peer
TODO: this should be handled by connectionManager< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > connections< / div >
< p >
Type:
< a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Map" > Map< / a > < < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String" > string< / a > , < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array" > Array< / a > < conn>>
< / p >
2019-08-21 19:52:04 +02:00
< / section >
2019-12-12 10:43:33 +01:00
< / div >
< / div >
< div class = 'border-bottom' id = 'registrartopologies' >
< div class = "clearfix small pointer toggle-sibling" >
< div class = "py1 contain" >
< a class = 'icon pin-right py1 dark-link caret-right' > ▸< / a >
< span class = 'code strong strong truncate' > topologies< / span >
< / div >
< / div >
< div class = "clearfix display-none toggle-target" >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
2019-08-21 19:52:04 +02:00
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/registrar.js#L36-L36' >
< span > src/registrar.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Map of topologies< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > topologies< / div >
< p >
Type:
< a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Map" > Map< / a > < < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String" > string< / a > , < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object" > object< / a > >
< / p >
2019-08-21 19:52:04 +02:00
< / section >
2019-12-12 10:43:33 +01:00
< / div >
< / div >
< div class = 'border-bottom' id = 'registrarclose' >
< div class = "clearfix small pointer toggle-sibling" >
< div class = "py1 contain" >
< a class = 'icon pin-right py1 dark-link caret-right' > ▸< / a >
< span class = 'code strong strong truncate' > close()< / span >
< / div >
< / div >
< div class = "clearfix display-none toggle-target" >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
2019-08-21 19:52:04 +02:00
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/registrar.js#L53-L64' >
< span > src/registrar.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Cleans up the registrar< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > close()< / div >
2019-08-21 19:52:04 +02:00
< / section >
2019-12-12 10:43:33 +01:00
< / div >
< / div >
< div class = 'border-bottom' id = 'registraronconnect' >
< div class = "clearfix small pointer toggle-sibling" >
< div class = "py1 contain" >
< a class = 'icon pin-right py1 dark-link caret-right' > ▸< / a >
< span class = 'code strong strong truncate' > onConnect(peerInfo, conn)< / span >
< / div >
< / div >
< div class = "clearfix display-none toggle-target" >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
2019-08-21 19:52:04 +02:00
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/registrar.js#L73-L85' >
< span > src/registrar.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Add a new connected peer to the record
TODO: this should live in the ConnectionManager< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > onConnect(peerInfo: PeerInfo, conn: Connection): void< / div >
2019-08-21 19:52:04 +02:00
< div class = 'py1 quiet mt1 prose-big' > Parameters< / div >
< div class = 'prose' >
< div class = 'space-bottom0' >
< div >
2019-12-12 10:43:33 +01:00
< span class = 'code bold' > peerInfo< / span > < code class = 'quiet' > (PeerInfo)< / code >
2019-08-21 19:52:04 +02:00
< / div >
< / div >
< div class = 'space-bottom0' >
< div >
2019-12-12 10:43:33 +01:00
< span class = 'code bold' > conn< / span > < code class = 'quiet' > (Connection)< / code >
2019-08-21 19:52:04 +02:00
< / div >
< / div >
< / div >
< div class = 'py1 quiet mt1 prose-big' > Returns< / div >
2019-12-12 10:43:33 +01:00
< code > void< / code > :
2019-08-21 19:52:04 +02:00
< / section >
2019-12-12 10:43:33 +01:00
< / div >
< / div >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'border-bottom' id = 'registrarondisconnect' >
< div class = "clearfix small pointer toggle-sibling" >
< div class = "py1 contain" >
< a class = 'icon pin-right py1 dark-link caret-right' > ▸< / a >
< span class = 'code strong strong truncate' > onDisconnect(peerInfo, connection, error?)< / span >
< / div >
< / div >
< div class = "clearfix display-none toggle-target" >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
2019-08-21 19:52:04 +02:00
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/registrar.js#L95-L111' >
< span > src/registrar.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Remove a disconnected peer from the record
TODO: this should live in the ConnectionManager< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > onDisconnect(peerInfo: PeerInfo, connection: Connection, error: < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error" > Error< / a > ?): void< / div >
2019-08-21 19:52:04 +02:00
< div class = 'py1 quiet mt1 prose-big' > Parameters< / div >
< div class = 'prose' >
< div class = 'space-bottom0' >
< div >
2019-12-12 10:43:33 +01:00
< span class = 'code bold' > peerInfo< / span > < code class = 'quiet' > (PeerInfo)< / code >
< / div >
< / div >
< div class = 'space-bottom0' >
< div >
< span class = 'code bold' > connection< / span > < code class = 'quiet' > (Connection)< / code >
< / div >
< / div >
< div class = 'space-bottom0' >
< div >
< span class = 'code bold' > error< / span > < code class = 'quiet' > (< a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error" > Error< / a > ?)< / code >
2019-08-21 19:52:04 +02:00
< / div >
< / div >
< / div >
< div class = 'py1 quiet mt1 prose-big' > Returns< / div >
2019-12-12 10:43:33 +01:00
< code > void< / code > :
2019-08-21 19:52:04 +02:00
< / section >
2019-12-12 10:43:33 +01:00
< / div >
< / div >
< div class = 'border-bottom' id = 'registrargetconnection' >
< div class = "clearfix small pointer toggle-sibling" >
< div class = "py1 contain" >
< a class = 'icon pin-right py1 dark-link caret-right' > ▸< / a >
< span class = 'code strong strong truncate' > getConnection(peerInfo)< / span >
< / div >
< / div >
< div class = "clearfix display-none toggle-target" >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
2019-08-21 19:52:04 +02:00
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/registrar.js#L118-L124' >
< span > src/registrar.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Get a connection with a peer.< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > getConnection(peerInfo: PeerInfo): Connection< / div >
2019-08-21 19:52:04 +02:00
< div class = 'py1 quiet mt1 prose-big' > Parameters< / div >
< div class = 'prose' >
< div class = 'space-bottom0' >
< div >
2019-12-12 10:43:33 +01:00
< span class = 'code bold' > peerInfo< / span > < code class = 'quiet' > (PeerInfo)< / code >
2019-08-21 19:52:04 +02:00
< / div >
< / div >
< / div >
< div class = 'py1 quiet mt1 prose-big' > Returns< / div >
2019-12-12 10:43:33 +01:00
< code > Connection< / code > :
2019-08-21 19:52:04 +02:00
< / section >
2019-12-12 10:43:33 +01:00
< / div >
< / div >
< div class = 'border-bottom' id = 'registrarregister' >
< div class = "clearfix small pointer toggle-sibling" >
< div class = "py1 contain" >
< a class = 'icon pin-right py1 dark-link caret-right' > ▸< / a >
< span class = 'code strong strong truncate' > register(topology)< / span >
< / div >
< / div >
< div class = "clearfix display-none toggle-target" >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
2019-08-21 19:52:04 +02:00
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/registrar.js#L131-L145' >
< span > src/registrar.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Register handlers for a set of multicodecs given< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > register(topology: Topology): < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String" > string< / a > < / div >
2019-08-21 19:52:04 +02:00
< div class = 'py1 quiet mt1 prose-big' > Parameters< / div >
< div class = 'prose' >
< div class = 'space-bottom0' >
< div >
2019-12-12 10:43:33 +01:00
< span class = 'code bold' > topology< / span > < code class = 'quiet' > (Topology)< / code >
protocol topology
2019-08-21 19:52:04 +02:00
< / div >
< / div >
< / div >
2019-12-12 10:43:33 +01:00
< div class = 'py1 quiet mt1 prose-big' > Returns< / div >
< code > < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String" > string< / a > < / code > :
registrar identifier
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< / section >
< / div >
< / div >
< div class = 'border-bottom' id = 'registrarunregister' >
2019-08-21 19:52:04 +02:00
< div class = "clearfix small pointer toggle-sibling" >
< div class = "py1 contain" >
< a class = 'icon pin-right py1 dark-link caret-right' > ▸< / a >
2019-12-12 10:43:33 +01:00
< span class = 'code strong strong truncate' > unregister(id)< / span >
2019-08-21 19:52:04 +02:00
< / div >
< / div >
< div class = "clearfix display-none toggle-target" >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/registrar.js#L152-L154' >
< span > src/registrar.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Unregister topology.< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > unregister(id: < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String" > string< / a > ): < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean" > boolean< / a > < / div >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'py1 quiet mt1 prose-big' > Parameters< / div >
< div class = 'prose' >
< div class = 'space-bottom0' >
< div >
< span class = 'code bold' > id< / span > < code class = 'quiet' > (< a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String" > string< / a > )< / code >
registrar identifier
< / div >
< / div >
< / div >
2019-08-21 19:52:04 +02:00
< div class = 'py1 quiet mt1 prose-big' > Returns< / div >
2019-12-12 10:43:33 +01:00
< code > < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean" > boolean< / a > < / code > :
unregistered successfully
2019-08-21 19:52:04 +02:00
< / section >
2019-12-12 10:43:33 +01:00
< / div >
< / div >
< / div >
< / section >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
2019-08-21 19:52:04 +02:00
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< h3 class = 'fl m0' id = 'ping' >
ping
< / h3 >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/ping/index.js#L21-L42' >
< span > src/ping/index.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Ping a given peer and wait for its response, getting the operation latency.< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > ping(node: < a href = "#libp2p" > Libp2p< / a > , peer: PeerInfo): < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise" > Promise< / a > < < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number" > Number< / a > >< / div >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'py1 quiet mt1 prose-big' > Parameters< / div >
< div class = 'prose' >
< div class = 'space-bottom0' >
< div >
< span class = 'code bold' > node< / span > < code class = 'quiet' > (< a href = "#libp2p" > Libp2p< / a > )< / code >
< / div >
< / div >
< div class = 'space-bottom0' >
< div >
< span class = 'code bold' > peer< / span > < code class = 'quiet' > (PeerInfo)< / code >
< / div >
< / div >
< / div >
2019-08-21 19:52:04 +02:00
< div class = 'py1 quiet mt1 prose-big' > Returns< / div >
2019-12-12 10:43:33 +01:00
< code > < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise" > Promise< / a > < < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number" > Number< / a > >< / code > :
2019-08-21 19:52:04 +02:00
< / section >
2019-12-12 10:43:33 +01:00
< section class = 'p2 mb2 clearfix bg-white minishadow' >
2019-08-21 19:52:04 +02:00
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< h3 class = 'fl m0' id = 'mount' >
mount
< / h3 >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/ping/index.js#L48-L50' >
< span > src/ping/index.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Subscribe ping protocol handler.< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > mount(node: < a href = "#libp2p" > Libp2p< / a > )< / div >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'py1 quiet mt1 prose-big' > Parameters< / div >
< div class = 'prose' >
< div class = 'space-bottom0' >
< div >
< span class = 'code bold' > node< / span > < code class = 'quiet' > (< a href = "#libp2p" > Libp2p< / a > )< / code >
< / div >
< / div >
< / div >
2019-08-21 19:52:04 +02:00
< / section >
2019-12-12 10:43:33 +01:00
< section class = 'p2 mb2 clearfix bg-white minishadow' >
2019-08-21 19:52:04 +02:00
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< h3 class = 'fl m0' id = 'unmount' >
unmount
< / h3 >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/ping/index.js#L56-L58' >
< span > src/ping/index.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Unsubscribe ping protocol handler.< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > unmount(node: < a href = "#libp2p" > Libp2p< / a > )< / div >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'py1 quiet mt1 prose-big' > Parameters< / div >
< div class = 'prose' >
< div class = 'space-bottom0' >
< div >
< span class = 'code bold' > node< / span > < code class = 'quiet' > (< a href = "#libp2p" > Libp2p< / a > )< / code >
< / div >
< / div >
< / div >
2019-08-21 19:52:04 +02:00
< / section >
2019-12-12 10:43:33 +01:00
< section class = 'p2 mb2 clearfix bg-white minishadow' >
2019-08-21 19:52:04 +02:00
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< h3 class = 'fl m0' id = 'constructor' >
constructor
< / h3 >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/identify/index.js#L86-L99' >
< span > src/identify/index.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > new constructor(options: < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object" > object< / a > )< / div >
2019-08-21 19:52:04 +02:00
< div class = 'py1 quiet mt1 prose-big' > Parameters< / div >
< div class = 'prose' >
< div class = 'space-bottom0' >
< div >
2019-12-12 10:43:33 +01:00
< span class = 'code bold' > options< / span > < code class = 'quiet' > (< a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object" > object< / a > )< / code >
2019-08-21 19:52:04 +02:00
< / div >
2019-12-12 10:43:33 +01:00
< table class = 'mt1 mb2 fixed-table h5 col-12' >
< colgroup >
< col width = '30%' / >
< col width = '70%' / >
< / colgroup >
< thead >
< tr class = 'bold fill-light' >
< th > Name< / th >
< th > Description< / th >
< / tr >
< / thead >
< tbody class = 'mt1' >
< tr >
< td class = 'break-word' > < span class = 'code bold' > options.registrar< / span > < code class = 'quiet' > < a href = "#registrar" > Registrar< / a > < / code >
< / td >
< td class = 'break-word' > < span > < / span > < / td >
< / tr >
< tr >
< td class = 'break-word' > < span class = 'code bold' > options.protocols< / span > < code class = 'quiet' > < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Map" > Map< / a > < < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String" > string< / a > , handler>< / code >
< / td >
< td class = 'break-word' > < span > A reference to the protocols we support
< / span > < / td >
< / tr >
< tr >
< td class = 'break-word' > < span class = 'code bold' > options.peerInfo< / span > < code class = 'quiet' > PeerInfo< / code >
< / td >
< td class = 'break-word' > < span > The peer running the identify service
< / span > < / td >
< / tr >
< / tbody >
< / table >
2019-08-21 19:52:04 +02:00
< / div >
< / div >
2019-12-12 10:43:33 +01:00
< / section >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< section class = 'p2 mb2 clearfix bg-white minishadow' >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'clearfix' >
< h3 class = 'fl m0' id = 'registrar' >
registrar
< / h3 >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/identify/index.js#L90-L90' >
< span > src/identify/index.js< / span >
< / a >
< / div >
< div class = 'pre p1 fill-light mt0' > registrar< / div >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
2019-08-21 19:52:04 +02:00
< / section >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< h3 class = 'fl m0' id = 'peerinfo' >
peerInfo
2019-08-21 19:52:04 +02:00
< / h3 >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/identify/index.js#L94-L94' >
< span > src/identify/index.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > peerInfo< / div >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
2019-08-21 19:52:04 +02:00
< / section >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< h3 class = 'fl m0' id = 'push' >
push
2019-08-21 19:52:04 +02:00
< / h3 >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/identify/index.js#L106-L126' >
< span > src/identify/index.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Send an Identify Push update to the list of connections< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > push(connections: < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array" > Array< / a > < Connection>): < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise" > Promise< / a > < void>< / div >
2019-08-21 19:52:04 +02:00
< div class = 'py1 quiet mt1 prose-big' > Parameters< / div >
< div class = 'prose' >
< div class = 'space-bottom0' >
< div >
2019-12-12 10:43:33 +01:00
< span class = 'code bold' > connections< / span > < code class = 'quiet' > (< a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array" > Array< / a > < Connection>)< / code >
2019-08-21 19:52:04 +02:00
< / div >
< / div >
< / div >
< div class = 'py1 quiet mt1 prose-big' > Returns< / div >
2019-12-12 10:43:33 +01:00
< code > < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise" > Promise< / a > < void>< / code > :
2019-08-21 19:52:04 +02:00
< / section >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< h3 class = 'fl m0' id = 'pushtopeerstore' >
pushToPeerStore
2019-08-21 19:52:04 +02:00
< / h3 >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/identify/index.js#L132-L142' >
< span > src/identify/index.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Calls < code > push< / code > for all peers in the < code > peerStore< / code > that are connected< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > pushToPeerStore(peerStore: < a href = "#peerstore" > PeerStore< / a > )< / div >
2019-08-21 19:52:04 +02:00
< div class = 'py1 quiet mt1 prose-big' > Parameters< / div >
< div class = 'prose' >
< div class = 'space-bottom0' >
< div >
2019-12-12 10:43:33 +01:00
< span class = 'code bold' > peerStore< / span > < code class = 'quiet' > (< a href = "#peerstore" > PeerStore< / a > )< / code >
2019-08-21 19:52:04 +02:00
< / div >
< / div >
< / div >
< / section >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< h3 class = 'fl m0' id = 'identify' >
identify
2019-08-21 19:52:04 +02:00
< / h3 >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/identify/index.js#L153-L197' >
< span > src/identify/index.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Requests the < code > Identify< / code > message from peer associated with the given < code > connection< / code > .
If the identified peer does not match the < code > PeerId< / code > associated with the connection,
an error will be thrown.< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > identify(connection: Connection): < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise" > Promise< / a > < void>< / div >
2019-08-21 19:52:04 +02:00
< div class = 'py1 quiet mt1 prose-big' > Parameters< / div >
< div class = 'prose' >
< div class = 'space-bottom0' >
< div >
2019-12-12 10:43:33 +01:00
< span class = 'code bold' > connection< / span > < code class = 'quiet' > (Connection)< / code >
2019-08-21 19:52:04 +02:00
< / div >
< / div >
< / div >
< div class = 'py1 quiet mt1 prose-big' > Returns< / div >
2019-12-12 10:43:33 +01:00
< code > < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise" > Promise< / a > < void>< / code > :
2019-08-21 19:52:04 +02:00
< / section >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< h3 class = 'fl m0' id = 'handlemessage' >
handleMessage
2019-08-21 19:52:04 +02:00
< / h3 >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/identify/index.js#L208-L217' >
< span > src/identify/index.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > A handler to register with Libp2p to process identify messages.< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > handleMessage(options: < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object" > object< / a > ): < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise" > Promise< / a > < void>< / div >
2019-08-21 19:52:04 +02:00
< div class = 'py1 quiet mt1 prose-big' > Parameters< / div >
< div class = 'prose' >
< div class = 'space-bottom0' >
< div >
2019-12-12 10:43:33 +01:00
< span class = 'code bold' > options< / span > < code class = 'quiet' > (< a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object" > object< / a > )< / code >
2019-08-21 19:52:04 +02:00
< / div >
2019-12-12 10:43:33 +01:00
< table class = 'mt1 mb2 fixed-table h5 col-12' >
< colgroup >
< col width = '30%' / >
< col width = '70%' / >
< / colgroup >
< thead >
< tr class = 'bold fill-light' >
< th > Name< / th >
< th > Description< / th >
< / tr >
< / thead >
< tbody class = 'mt1' >
< tr >
< td class = 'break-word' > < span class = 'code bold' > options.connection< / span > < code class = 'quiet' > Connection< / code >
< / td >
< td class = 'break-word' > < span > < / span > < / td >
< / tr >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< tr >
< td class = 'break-word' > < span class = 'code bold' > options.stream< / span > < code class = 'quiet' > any< / code >
< / td >
< td class = 'break-word' > < span > < / span > < / td >
< / tr >
< tr >
< td class = 'break-word' > < span class = 'code bold' > options.protocol< / span > < code class = 'quiet' > < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String" > String< / a > < / code >
< / td >
< td class = 'break-word' > < span > < / span > < / td >
< / tr >
< / tbody >
< / table >
2019-08-21 19:52:04 +02:00
< / div >
< / div >
< div class = 'py1 quiet mt1 prose-big' > Returns< / div >
2019-12-12 10:43:33 +01:00
< code > < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise" > Promise< / a > < void>< / code > :
2019-08-21 19:52:04 +02:00
< / section >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< h3 class = 'fl m0' id = 'updatepeeraddresses' >
updatePeerAddresses
2019-08-21 19:52:04 +02:00
< / h3 >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/identify/index.js#L36-L47' >
< span > src/identify/index.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Replaces the multiaddrs on the given < code > peerInfo< / code > ,
with the provided < code > multiaddrs< / code > < / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > updatePeerAddresses(peerInfo: PeerInfo, multiaddrs: (< a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array" > Array< / a > < Multiaddr> | < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array" > Array< / a > < < a href = "https://nodejs.org/api/buffer.html" > Buffer< / a > >))< / div >
2019-08-21 19:52:04 +02:00
< div class = 'py1 quiet mt1 prose-big' > Parameters< / div >
< div class = 'prose' >
< div class = 'space-bottom0' >
< div >
2019-12-12 10:43:33 +01:00
< span class = 'code bold' > peerInfo< / span > < code class = 'quiet' > (PeerInfo)< / code >
2019-08-21 19:52:04 +02:00
< / div >
< / div >
< div class = 'space-bottom0' >
< div >
2019-12-12 10:43:33 +01:00
< span class = 'code bold' > multiaddrs< / span > < code class = 'quiet' > ((< a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array" > Array< / a > < Multiaddr> | < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array" > Array< / a > < < a href = "https://nodejs.org/api/buffer.html" > Buffer< / a > >))< / code >
2019-08-21 19:52:04 +02:00
< / div >
< / div >
< / div >
< / section >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< h3 class = 'fl m0' id = 'updatepeerprotocols' >
updatePeerProtocols
2019-08-21 19:52:04 +02:00
< / h3 >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/identify/index.js#L56-L61' >
< span > src/identify/index.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Replaces the protocols on the given < code > peerInfo< / code > ,
with the provided < code > protocols< / code > < / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > updatePeerProtocols(peerInfo: PeerInfo, protocols: < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array" > Array< / a > < < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String" > string< / a > >)< / div >
2019-08-21 19:52:04 +02:00
< div class = 'py1 quiet mt1 prose-big' > Parameters< / div >
< div class = 'prose' >
< div class = 'space-bottom0' >
< div >
2019-12-12 10:43:33 +01:00
< span class = 'code bold' > peerInfo< / span > < code class = 'quiet' > (PeerInfo)< / code >
2019-08-21 19:52:04 +02:00
< / div >
< / div >
< div class = 'space-bottom0' >
< div >
2019-12-12 10:43:33 +01:00
< span class = 'code bold' > protocols< / span > < code class = 'quiet' > (< a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array" > Array< / a > < < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String" > string< / a > >)< / code >
2019-08-21 19:52:04 +02:00
< / div >
< / div >
< / div >
< / section >
< section class = 'p2 mb2 clearfix bg-white minishadow' >
< div class = 'clearfix' >
2019-12-12 10:43:33 +01:00
< h3 class = 'fl m0' id = 'getcleanmultiaddr' >
getCleanMultiaddr
2019-08-21 19:52:04 +02:00
< / h3 >
2019-12-12 10:43:33 +01:00
< a class = 'fr fill-darken0 round round pad1x quiet h5' href = 'https://github.com/libp2p/js-libp2p/blob/9c884a72b0165f186ebe333c30e372b3fd52c9a1/src/identify/index.js#L68-L77' >
< span > src/identify/index.js< / span >
2019-08-21 19:52:04 +02:00
< / a >
< / div >
2019-12-12 10:43:33 +01:00
< p > Takes the < code > addr< / code > and converts it to a Multiaddr if possible< / p >
2019-08-21 19:52:04 +02:00
2019-12-12 10:43:33 +01:00
< div class = 'pre p1 fill-light mt0' > getCleanMultiaddr(addr: (< a href = "https://nodejs.org/api/buffer.html" > Buffer< / a > | < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String" > String< / a > )): (Multiaddr | null)< / div >
2019-08-21 19:52:04 +02:00
< div class = 'py1 quiet mt1 prose-big' > Parameters< / div >
< div class = 'prose' >
< div class = 'space-bottom0' >
< div >
2019-12-12 10:43:33 +01:00
< span class = 'code bold' > addr< / span > < code class = 'quiet' > ((< a href = "https://nodejs.org/api/buffer.html" > Buffer< / a > | < a href = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String" > String< / a > ))< / code >
2019-08-21 19:52:04 +02:00
< / div >
< / div >
< / div >
< div class = 'py1 quiet mt1 prose-big' > Returns< / div >
2019-12-12 10:43:33 +01:00
< code > (Multiaddr | null)< / code > :
2019-08-21 19:52:04 +02:00
< / section >
< / div >
< / div >
< script src = 'assets/anchor.js' > < / script >
< script src = 'assets/split.js' > < / script >
< script src = 'assets/site.js' > < / script >
< / body >
< / html >