Responsible for managing the peer addresses. + Peers can specify their listen and announce addresses. + The listen addresses will be used by the libp2p transports to listen for new connections, + while the announce addresses will be used for the peer addresses' to other peers in the network.
+Get peer announcing multiaddrs.
+Get peer listen multiaddrs.
+Attempt to listen on the given relay connection.
+Remove listen relay.
+Try to listen on available hop relay connections. + The following order will happen while we do not have enough relays.
+Peer disconnects.
+connection to the peer
+Check if a peer supports the relay protocol. + If the protocol is not supported, check if it was supported before and remove it as a listen relay. + If the protocol is supported, check if the peer supports HOP and add it as a listener if + inside the threshold.
+Create a stream handler for connection
+Close the stream
+Read and decode message
+Return the handshake rest stream and invalidate handler
+A duplex iterable
+Encode and write array of buffers
+An unencoded CircuitRelay protobuf message
+Advertise hop relay service in the network.
+Start Relay service.
+Stop Relay service.
+Create a listener
+Dial a peer over a relay
+the multiaddr of the peer to dial
+dial options
+Checks if the given value is a Transport instance.
+Responsible for managing known connections.
+Proactively tries to connect to known peers stored in the PeerStore. + It will keep the number of connections below the upper limit and sort + the peers to connect based on wether we know their keys and protocols.
+If the value
of name
has exceeded its limit, maybe close a connection
Checks the libp2p metrics to determine if any values have exceeded + the configured maximums.
+If we have more connections than our maximum, close a connection + to the lowest valued peer.
+If the event loop is slow, maybe close a connection
+Map of peer identifiers to their peer value for pruning connections.
+Map of connections per peer
+This symbol shall be used to install a listener for only monitoring 'error'
+ events. Listeners installed using this symbol are called before the regular
+ 'error'
listeners are called.
Installing a listener using this symbol does not change the behavior once an
+ 'error'
event is emitted, therefore the process will still crash if no
+ regular 'error'
listener is installed.
Get current number of open connections.
+Cleans up the connections
+Get a connection with a peer.
+Get all open connections with a peer.
+Tracks the incoming connection and check the connection limit
+Removes the connection from tracking
+Sets the value of the given peer. Peers with lower values + will be disconnected first.
+A number between 0 and 1
+Starts the Connection Manager. If Metrics are not enabled on libp2p + only event loop and connection limits will be monitored.
+Stops the Connection Manager
+A class to monitor latency of any async function which works in a browser or node. This works by periodically calling + the asyncTestFn and timing how long it takes the callback to be called. It can also periodically emit stats about this. + This can be disabled and stats can be pulled via setting dataEmitIntervalMs = 0.
+Randomly calls an async fn every roughly latencyCheckIntervalMs (plus some randomness). If no async fn is found, + it will simply report on event loop latency.
+Emit summary only if there were events. It might not have any events if it was forced via a page hidden/show
+Start internal timers
+Stop internal timers
+This symbol shall be used to install a listener for only monitoring 'error'
+ events. Listeners installed using this symbol are called before the regular
+ 'error'
listeners are called.
Installing a listener using this symbol does not change the behavior once an
+ 'error'
event is emitted, therefore the process will still crash if no
+ regular 'error'
listener is installed.
Calling this function will end the collection period. If a timing event was already fired and somewhere in the queue, + it will not count for this time period
+Listen to page visibility change events (i.e. when the page is focused / blurred) by an event emitter.
+Warning: This does not work on all browsers, but should work on all modern browsers
+ +Adds an event listener on the document that listens to changes in document.visibilityChange + (or whatever name by which the visibilityChange variable is known in the browser)
+The function that is called when document.visibilityChange has changed + It emits an event called visibilityChange and sends the value of document.hidden as a + parameter
+document.hidden and document.visibilityChange are the two variables we need to check for; + Since these variables are named differently in different browsers, this function sets + the appropriate name based on the browser being used. Once executed, tha actual names of + document.hidden and document.visibilityChange are found in this._hidden and this._visibilityChange + respectively
+This symbol shall be used to install a listener for only monitoring 'error'
+ events. Listeners installed using this symbol are called before the regular
+ 'error'
listeners are called.
Installing a listener using this symbol does not change the behavior once an
+ 'error'
event is emitted, therefore the process will still crash if no
+ regular 'error'
listener is installed.
The function returns true
if the page is visible or false
if the page is not visible and
+ undefined
if the page visibility API is not supported by the browser.
whether the page is now visible or not (undefined is unknown)
+Iterates over all content routers in series to find providers of the given key. + Once a content router succeeds, iteration will stop.
+The CID key of the content to find
+++}
+
Get the value to the given key. + Times out after 1 minute by default.
+Get the n
values to the given key without sorting.
Iterates over all content routers in parallel to notify it is + a provider of the given key.
+The CID key of the content to find
+Store the given key/value pair in the DHT.
+Manages running the dialAction
on multiple provided addrs
in parallel
+ up to a maximum determined by the number of tokens returned
+ from dialer.getTokens
. Once a DialRequest is created, it can be
+ started using DialRequest.run(options)
. Once a single dial has succeeded,
+ all other dials in the request will be cancelled.
Creates a DialTarget. The DialTarget is used to create and track + the DialRequest to a given peer. + If a multiaddr is received it should be the first address attempted.
+Creates a PendingDial that wraps the underlying DialRequest
+Connects to a given peer
by dialing all of its known addresses.
+ The dial to the first address that is successfully able to upgrade a connection
+ will be used.
The peer to dial
+Clears any pending dials
+Sends the Identify
response with the Signed Peer Record
+ to the requesting peer over the given connection
Reads the Identify Push message from the given connection
A handler to register with Libp2p to process identify messages.
+Requests the Identify
message from peer associated with the given connection
.
+ If the identified peer does not match the PeerId
associated with the connection,
+ an error will be thrown.
Send an Identify Push update to the list of connections
+Calls push
for all peers in the peerStore
that are connected
Takes the addr
and converts it to a Multiaddr if possible
Cryptographic Message Syntax (aka PKCS #7)
+CMS describes an encapsulation syntax for data protection. It + is used to digitally sign, digest, authenticate, or encrypt + arbitrary message content.
+See RFC 5652 for all the details.
+Reads some protected data.
+The keychain must contain one of the keys used to encrypt the data. If none of the keys + exists, an Error is returned with the property 'missingKeys'. It is array of key ids.
+The CMS encrypted data to decrypt.
+Creates some protected data.
+The output Uint8Array contains the PKCS #7 message in DER.
+The local key name.
+The data to encrypt.
+Manages the lifecycle of a key. Keys are encrypted at rest using PKCS #8.
+A key in the store has two entries
+Creates a new instance of a key chain.
+where the key are.
+Gets the private key as PEM encoded PKCS #8 string.
+Gets an object that can encrypt/decrypt protected data + using the Cryptographic Message Syntax (CMS).
+CMS describes an encapsulation syntax for data protection. It + is used to digitally sign, digest, authenticate, or encrypt + arbitrary message content.
+Gets an object that can encrypt/decrypt protected data. + The default options for a keychain.
+Create a new key.
+The local key name; cannot already exist.
+One of the key types; 'rsa'.
+Export an existing key as a PEM encrypted PKCS #8 string
+The local key name; must already exist.
+The password
+Find a key by it's id.
+The universally unique key identifier.
+Find a key by it's name.
+The local key name.
+Import a new key from a PEM encoded PKCS #8 string
+The local key name; must not already exist.
+The PEM encoded PKCS #8 string
+The password.
+List all the keys.
+Remove an existing key.
+The local key name; must already exist.
+Rename a key
+The old local key name; must already exist.
+The new local key name; must not already exist.
+Generates the options for a keychain. A random salt is produced.
+Takes the metadata for a message and tracks it in the + appropriate categories. If the protocol is present, protocol + stats will also be tracked.
+Gets the global Stats
object
Returns a list of PeerId
strings currently being tracked
Returns a list of all protocol strings currently being tracked.
+Returns the Stats
object for the given protocol
.
Should be called when all connections to a given peer
+ have closed. The Stats
collection for the peer will
+ be stopped and moved to an LRU for temporary retention.
Must be called for stats to saved. Any data pushed for tracking + will be ignored.
+Stops all averages timers and prevents new data from being tracked.
+ Once stop
is called, start
must be called to resume stats tracking.
Tracks data running through a given Duplex Iterable stream
. If
+ the peerId
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 PeerId
is known, Metrics.updatePlaceholder
should be called
+ with the placeholder string returned from here, and the known PeerId
.
The peerId string or placeholder string
+A queue based manager for stat processing
+For the given operation, op
, the stats and frequencyAccumulator
+ will be updated or initialized if they don't already exist.
Calculates and returns the timeout for the next update based on + the urgency of the update.
+Resets the timeout for triggering updates.
+If there are items in the queue, they will will be processed and
+ the frequency for all items will be updated based on the Timestamp
+ of the last item in the queue. The update
event will also be emitted
+ with the latest stats.
If there are no items in the queue, no action is taken.
+ +For each key in the stats, the frequency and moving averages + will be updated via Stats._updateFrequencyFor based on the time + difference between calls to this method.
+Updates the movingAverages
for the given key
and also
+ resets the frequencyAccumulator
for the key
.
This symbol shall be used to install a listener for only monitoring 'error'
+ events. Listeners installed using this symbol are called before the regular
+ 'error'
listeners are called.
Installing a listener using this symbol does not change the behavior once an
+ 'error'
event is emitted, therefore the process will still crash if no
+ regular 'error'
listener is installed.
Returns a clone of the internal movingAverages
+Returns a clone of the current stats.
+Pushes the given operation data to the queue, along with the + current Timestamp, then resets the update timer.
+Initializes the internal timer if there are items in the queue. This
+ should only need to be called if Stats.stop
was previously called, as
+ Stats.push
will also start the processing.
Stops processing and computing of stats by clearing the internal + timer.
+Returns a plain JSON object of the stats
+Recurrent task to find closest peers and add their addresses to the Address Book.
+Start peer routing service.
+Stop peer routing service.
+The AddressBook is responsible for keeping the known multiaddrs of a peer.
+Transforms received multiaddrs into Address.
+Map known peers to their data.
+Emit data.
+Set data into the datastructure, persistence and emit it using the provided transformers.
+peerId of the data to store
+data to store.
+Add known addresses of a provided peer. + If the peer is not known, it is set with the given addresses.
+ConsumePeerRecord adds addresses from a signed peer record contained in a record envelope. + This will return a boolean that indicates if the record was successfully processed and added + into the AddressBook.
+Deletes the provided peer from the book.
+Get the known data of a provided peer.
+ Returns undefined
if there is no available data for the given peer.
Get the known multiaddrs for a given peer. All returned multiaddrs
+ will include the encapsulated PeerId
of the peer.
+ Returns undefined
if there are no known multiaddrs for the given peer.
Get the raw Envelope for a peer. Returns + undefined if no Envelope is found.
+Set known data of a provided peer.
+The Book is the skeleton for the PeerStore books.
+Map known peers to their data.
+Emit data.
+Set data into the datastructure, persistence and emit it using the provided transformers.
+peerId of the data to store
+data to store.
+Deletes the provided peer from the book.
+Get the known data of a provided peer.
+ Returns undefined
if there is no available data for the given peer.
Set known data of a provided peer.
+AddressBook containing a map of peerIdStr to Address.
+KeyBook containing a map of peerIdStr to their PeerId with public keys.
+MetadataBook containing a map of peerIdStr to their metadata Map.
+ProtoBook containing a map of peerIdStr to supported protocols.
+This symbol shall be used to install a listener for only monitoring 'error'
+ events. Listeners installed using this symbol are called before the regular
+ 'error'
listeners are called.
Installing a listener using this symbol does not change the behavior once an
+ 'error'
event is emitted, therefore the process will still crash if no
+ regular 'error'
listener is installed.
Delete the information of the given peer in every book.
+true if found and removed
+Start the PeerStore.
+Stop the PeerStore.
+Map known peers to their data.
+Emit data.
+Set data into the datastructure, persistence and emit it using the provided transformers.
+peerId of the data to store
+data to store.
+Deletes the provided peer from the book.
+Get the known data of a provided peer.
+ Returns undefined
if there is no available data for the given peer.
Set known data of a provided peer.
+The MetadataBook is responsible for keeping the known supported + protocols of a peer.
+Map known peers to their data.
+Emit data.
+Set data into the datastructure, persistence and emit it using the provided transformers.
+peerId of the data to store
+data to store.
+Set data into the datastructure
+Deletes the provided peer from the book.
+Deletes the provided peer metadata key from the book.
+Get the known data of a provided peer.
+ Returns undefined
if there is no available data for the given peer.
Get specific metadata value, if it exists
+Set known data of a provided peer.
+Responsible for managing the persistence of data in the PeerStore.
+Add modified peer to the dirty set
+Add modified peer key to the dirty set
+Add modified metadata peer to the set.
+Add address book data of the peer to the batch.
+Add Key book data of the peer to the batch.
+Add metadata book data of the peer to the batch.
+Add proto book data of the peer to the batch.
+Add all the peers current data to a datastore batch and commit it.
+Backend datastore used to persist data.
+Peers metadata changed mapping peer identifers to metadata changed.
+Peers modified after the latest data persisted.
+Process datastore entry and add its data to the correct book.
+AddressBook containing a map of peerIdStr to Address.
+KeyBook containing a map of peerIdStr to their PeerId with public keys.
+MetadataBook containing a map of peerIdStr to their metadata Map.
+ProtoBook containing a map of peerIdStr to supported protocols.
+Delete the information of the given peer in every book.
+true if found and removed
+Start the PeerStore.
+Stop the PeerStore.
+Map known peers to their data.
+Emit data.
+Set data into the datastructure, persistence and emit it using the provided transformers.
+peerId of the data to store
+data to store.
+Deletes the provided peer from the book.
+Get the known data of a provided peer.
+ Returns undefined
if there is no available data for the given peer.
Set known data of a provided peer.
+Takes a Private Shared Key (psk) and provides a protect
method
+ for wrapping existing connections in a private encryption stream.
The private shared key buffer
+Takes a given Connection and creates a private encryption stream + between its two peers from the PSK the Protector instance was + created with.
+The connection to protect
+A protected duplex iterable
+The Envelope is responsible for keeping an arbitrary signed record + by a libp2p peer.
+Verifies if the other Envelope is identical to this one.
+Marshal the envelope content.
+Validate envelope data signature for the given domain.
+The PeerRecord is used for distributing peer routing records across the network. + It contains the peer's reachable listen addresses.
+Returns true if this
record equals the other
.
Marshal a record to be used in an envelope.
+Responsible for notifying registered protocols of events in the network.
+Map of topologies
+Remove a disconnected peer from the record
+Get a connection with a peer.
+Register handlers for a set of multicodecs given
+protocol topology
+registrar identifier
+Unregister topology.
+registrar identifier
+unregistered successfully
+Adds a Transport
to the manager
Additional options to pass to the transport
+Stops all listeners
+Dials the given Multiaddr over it's supported transport
+Returns all Multiaddr's the listeners are using
+Returns all the transports instances.
+Starts listeners for each listen Multiaddr.
+addresses to attempt to listen on
+Removes the given transport from the manager. + If a transport has any running listeners, they will be closed.
+Removes all transports from the manager. + If any listeners are running, they will be closed.
+Finds a transport that matches the given Multiaddr
+A convenience method for generating a new Connection
Attempts to encrypt the incoming connection
with the provided cryptos
.
Attempts to encrypt the given connection
with the provided cryptos
.
+ The first Crypto
module to succeed will be used
Registers support for one of the given muxers via multistream-select. The + selected muxer will be used for all future streams on the connection.
+Selects one of the given muxers via multistream-select. That + muxer will be used for all future streams on the connection.
+Routes incoming streams to the correct handler
+Upgrades an inbound connection
+Upgrades an outbound connection
+
+- property
+
+ - property
+
+
+{string[]} [listen = []] - list of multiaddrs string representation to listen.
+{string[]} [announce = []] - list of multiaddrs string representation to announce.
+