diff --git a/assets/anchor.js b/assets/anchor.js index 1f573dcb..f74c2de7 100644 --- a/assets/anchor.js +++ b/assets/anchor.js @@ -6,7 +6,7 @@ /* eslint-env amd, node */ // https://github.com/umdjs/umd/blob/master/templates/returnExports.js -(function (root, factory) { +(function(root, factory) { 'use strict'; if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. @@ -21,7 +21,7 @@ root.AnchorJS = factory(); root.anchors = new root.AnchorJS(); } -})(this, function () { +})(this, function() { 'use strict'; function AnchorJS(options) { this.options = options || {}; @@ -51,7 +51,7 @@ * https://github.com/Modernizr/Modernizr/blob/da22eb27631fc4957f67607fe6042e85c0a84656/feature-detects/touchevents.js#L40 * @returns {Boolean} - true if the current device supports touch. */ - this.isTouchDevice = function () { + this.isTouchDevice = function() { return !!( 'ontouchstart' in window || (window.DocumentTouch && document instanceof DocumentTouch) @@ -64,7 +64,7 @@ * to. Also accepts an array or nodeList containing the relavant elements. * @returns {this} - The AnchorJS object */ - this.add = function (selector) { + this.add = function(selector) { var elements, elsWithIds, idList, @@ -193,7 +193,7 @@ * OR a nodeList / array containing the DOM elements. * @returns {this} - The AnchorJS object */ - this.remove = function (selector) { + this.remove = function(selector) { var index, domAnchor, elements = _getElements(selector); @@ -216,7 +216,7 @@ /** * Removes all anchorjs links. Mostly used for tests. */ - this.removeAll = function () { + this.removeAll = function() { this.remove(this.elements); }; @@ -229,7 +229,7 @@ * @param {String} text - Any text. Usually pulled from the webpage element we are linking to. * @returns {String} - hyphen-delimited text for use in IDs and URLs. */ - this.urlify = function (text) { + this.urlify = function(text) { // Regex for finding the nonsafe URL characters (many need escaping): & +$,:;=?@"#{}|^~[`%!'<>]./()*\ var nonsafeChars = /[& +$,:;=?@"#{}|^~[`%!'<>\]\.\/\(\)\*\\]/g, urlText; @@ -260,7 +260,7 @@ * @param {HTMLElemnt} el - a DOM node * @returns {Boolean} true/false */ - this.hasAnchorJSLink = function (el) { + this.hasAnchorJSLink = function(el) { var hasLeftAnchor = el.firstChild && (' ' + el.firstChild.className + ' ').indexOf(' anchorjs-link ') > -1, diff --git a/assets/site.js b/assets/site.js index a624be7b..f86584f2 100644 --- a/assets/site.js +++ b/assets/site.js @@ -7,7 +7,7 @@ anchors.add('h3'); // Filter UI var tocElements = document.getElementById('toc').getElementsByTagName('li'); -document.getElementById('filter-input').addEventListener('keyup', function (e) { +document.getElementById('filter-input').addEventListener('keyup', function(e) { var i, element, children; // enter key @@ -22,14 +22,14 @@ document.getElementById('filter-input').addEventListener('keyup', function (e) { } } - var match = function () { + var match = function() { return true; }; var value = this.value.toLowerCase(); if (!value.match(/^\s*$/)) { - match = function (element) { + match = function(element) { var html = element.firstChild.innerHTML; return html && html.toLowerCase().indexOf(value) !== -1; }; @@ -114,12 +114,12 @@ var cw_without_sb = split_left.clientWidth; split_left.style.overflow = ''; Split(['#split-left', '#split-right'], { - elementStyle: function (dimension, size, gutterSize) { + elementStyle: function(dimension, size, gutterSize) { return { 'flex-basis': 'calc(' + size + '% - ' + gutterSize + 'px)' }; }, - gutterStyle: function (dimension, gutterSize) { + gutterStyle: function(dimension, gutterSize) { return { 'flex-basis': gutterSize + 'px' }; @@ -152,9 +152,9 @@ function loadState(ev) { } } -window.addEventListener('load', function () { +window.addEventListener('load', function() { // Restore after Firefox scrolls to hash. - setTimeout(function () { + setTimeout(function() { loadState(); // Update with initial scroll position. updateState(); diff --git a/index.html b/index.html index 62c62630..2dddfed3 100644 --- a/index.html +++ b/index.html @@ -2,7 +2,7 @@ - libp2p 0.28.5 | Documentation + libp2p 0.27.9 | Documentation @@ -15,7 +15,7 @@

libp2p

-
0.28.5
+
0.27.9
-
  • - #loadKeychain -
  • -
  • @@ -104,12 +98,6 @@ #dialProtocol
  • -
  • - #multiaddrs -
  • -
  • @@ -254,9 +242,9 @@
  • - getPeer + getPeerInfo @@ -264,129 +252,71 @@
  • - AddressManager - + href='#getpeerinforemote' + class=""> + getPeerInfoRemote + - -
  • - ConnectionManager - + href='#constructor' + class=""> + constructor + -
  • + + +
  • + start + + +
  • + + +
  • + stop - + + +
  • + + +
  • + setPeerValue + + +
  • + + +
  • + onConnect + + +
  • + + +
  • + onDisconnect -
  • + @@ -707,6 +637,16 @@ +
  • + getDialable + + + +
  • + +
  • @@ -727,163 +667,6 @@
  • -
  • - KeyInfo - - - -
  • - - -
  • - Keychain - - - - - -
  • - - -
  • - CMS - - - - - -
  • - - -
  • - certificateForKey - - - -
  • - - -
  • - findAsync - - - -
  • - -
  • @@ -1172,16 +955,6 @@
  • -
  • - FAULT_TOLERANCE - - - -
  • - -
  • @@ -1263,42 +1036,6 @@ - - - -
  • - - - - -
  • - AddressBook - - - - - -
  • - - -
  • - eventTransformer - - - -
  • - - -
  • - eventTransformer - - - -
  • - - -
  • - Book - - - - - -
  • - - -
  • - KeyBook - - - - - -
  • - - -
  • - MetadataBook - - - - - -
  • - - -
  • - eventProperty - - - -
  • - - -
  • - ProtoBook - - - - - -
  • - - -
  • - PersistentPeerStore - - - -
  • - peerStore + registrar @@ -1741,29 +1220,9 @@
  • - connectionManager - - - -
  • - - -
  • - peerId - - - -
  • - - -
  • - _libp2p + peerInfo @@ -1810,6 +1269,26 @@
  • +
  • + updatePeerAddresses + + + +
  • + + +
  • + updatePeerProtocols + + + +
  • + +
  • @@ -1867,7 +1346,7 @@ - + src/index.js @@ -1936,14 +1415,14 @@
    - + src/index.js
    -

    Like new Libp2p(options) except it will create a PeerId +

    Like new Libp2p(options) except it will create a PeerInfo instance if one is not provided in options.

    create(options: object): Libp2p
    @@ -2026,7 +1505,7 @@ instance if one is not provided in options.

    - + src/index.js @@ -2114,7 +1593,7 @@ if there is a handler. If not, errors will be logged.

    - + src/index.js @@ -2180,7 +1659,7 @@ if there is a handler. If not, errors will be logged.

    - + src/index.js @@ -2227,73 +1706,6 @@ if there is a handler. If not, errors will be logged.

    - - -
    -
    - -
    -
    -
    - - loadKeychain() -
    -
    - @@ -2313,7 +1725,7 @@ Imports the private key as 'self', if needed.

    - + src/index.js @@ -2380,17 +1792,17 @@ Imports the private key as 'self', if needed.

    -

    Dials to the provided peer. If successful, the known metadata of the +

    Dials to the provided peer. If successful, the PeerInfo of the peer will be added to the nodes peerStore

    -
    dial(peer: (PeerId | Multiaddr | string), options: object): Promise<Connection>
    +
    dial(peer: (PeerInfo | PeerId | Multiaddr | string), options: object): Promise<Connection>
    @@ -2407,7 +1819,7 @@ peer will be added to the nodes peerStore

    - peer ((PeerId | Multiaddr | string)) + peer ((PeerInfo | PeerId | Multiaddr | string)) The peer to dial
    @@ -2493,7 +1905,7 @@ peer will be added to the nodes peerStore

    - + src/index.js @@ -2501,10 +1913,10 @@ peer will be added to the nodes peerStore

    Dials to the provided peer and handshakes with the given protocol. -If successful, the known metadata of the peer will be added to the nodes peerStore, -and the Connection will be returned

    +If successful, the PeerInfo of the peer will be added to the nodes peerStore, +and the Connection will be sent in the callback

    -
    dialProtocol(peer: (PeerId | Multiaddr | string), protocols: (Array<string> | string), options: object): Promise<(Connection | any)>
    +
    dialProtocol(peer: (PeerInfo | PeerId | Multiaddr | string), protocols: (Array<string> | string), options: object): Promise<(Connection | any)>
    @@ -2521,7 +1933,7 @@ and the Connection will be returned

    - peer ((PeerId | Multiaddr | string)) + peer ((PeerInfo | PeerId | Multiaddr | string)) The peer to dial
    @@ -2596,74 +2008,6 @@ and the Connection will be returned

    - - -
    -
    - -
    -
    -
    - - multiaddrs -
    -
    - @@ -2683,7 +2027,7 @@ Duplicated addresses and noAnnounce addresses are filtered out.

    - + src/index.js @@ -2692,7 +2036,7 @@ Duplicated addresses and noAnnounce addresses are filtered out.

    Disconnects all connections to the given peer

    -
    hangUp(peer: (PeerId | multiaddr | string)): Promise<void>
    +
    hangUp(peer: (PeerInfo | PeerId | multiaddr | string)): Promise<void>
    @@ -2709,7 +2053,7 @@ Duplicated addresses and noAnnounce addresses are filtered out.

    - peer ((PeerId | multiaddr | string)) + peer ((PeerInfo | PeerId | multiaddr | string)) the peer to close connections to
    @@ -2763,16 +2107,16 @@ Duplicated addresses and noAnnounce addresses are filtered out.

    -

    Pings the given peer in order to obtain the operation latency.

    +

    Pings the given peer

    -
    ping(peer: (PeerId | Multiaddr | string)): Promise<number>
    +
    ping(peer: (PeerInfo | PeerId | Multiaddr | string)): Promise<number>
    @@ -2789,7 +2133,7 @@ Duplicated addresses and noAnnounce addresses are filtered out.

    - peer ((PeerId | Multiaddr | string)) + peer ((PeerInfo | PeerId | Multiaddr | string)) The peer to ping
    @@ -2843,7 +2187,7 @@ Duplicated addresses and noAnnounce addresses are filtered out.

    - + src/index.js @@ -2922,7 +2266,7 @@ Duplicated addresses and noAnnounce addresses are filtered out.

    - + src/index.js @@ -3002,7 +2346,7 @@ will no longer be supported on streams.

    - + src/peer-routing.js @@ -3011,7 +2355,7 @@ will no longer be supported on streams.

    Iterates over all peer routers in series to find the given peer.

    -
    findPeer(id: String, options: object?): Promise<{id: PeerId, multiaddrs: Array<Multiaddr>}>
    +
    findPeer(id: String, options: object?): Promise<PeerInfo>
    @@ -3076,7 +2420,7 @@ will no longer be supported on streams.

    Returns
    - Promise<{id: PeerId, multiaddrs: Array<Multiaddr>}>: + Promise<PeerInfo>: @@ -3111,7 +2455,7 @@ will no longer be supported on streams.

    - + src/content-routing.js @@ -3121,7 +2465,7 @@ will no longer be supported on streams.

    Iterates over all content routers in series to find providers of the given key. Once a content router succeeds, iteration will stop.

    -
    findProviders(key: CID, options: object?): AsyncIterable<{id: PeerId, multiaddrs: Array<Multiaddr>}>
    +
    findProviders(key: CID, options: object?): AsyncIterable<PeerInfo>
    @@ -3195,7 +2539,7 @@ Once a content router succeeds, iteration will stop.

    Returns
    - AsyncIterable<{id: PeerId, multiaddrs: Array<Multiaddr>}>: + AsyncIterable<PeerInfo>: @@ -3230,7 +2574,7 @@ Once a content router succeeds, iteration will stop.

    - + src/content-routing.js @@ -3307,7 +2651,7 @@ a provider of the given key.

    - + src/content-routing.js @@ -3424,7 +2768,7 @@ a provider of the given key.

    - + src/content-routing.js @@ -3534,7 +2878,7 @@ Times out after 1 minute by default.

    - + src/content-routing.js @@ -3651,7 +2995,7 @@ Times out after 1 minute by default.

    - + src/pubsub.js @@ -3735,7 +3079,7 @@ Times out after 1 minute by default.

    - + src/pubsub.js @@ -3811,7 +3155,7 @@ Times out after 1 minute by default.

    - + src/pubsub.js @@ -3894,7 +3238,7 @@ Times out after 1 minute by default.

    - + src/pubsub.js @@ -3956,7 +3300,7 @@ Times out after 1 minute by default.

    - + src/pubsub.js @@ -4026,22 +3370,23 @@ Times out after 1 minute by default.

    -

    Converts the given peer to a Peer object. -If a multiaddr is received, the addressBook is updated.

    +

    Converts the given peer to a PeerInfo instance. +The PeerStore will be checked for the resulting peer, and +the peer will be updated in the PeerStore.

    -
    getPeer(peer: (PeerId | Multiaddr | string), peerStore: PeerStore): {id: PeerId, multiaddrs: Array<Multiaddr>}
    +
    getPeerInfo(peer: (PeerInfo | PeerId | Multiaddr | string), peerStore: PeerStore): PeerInfo
    @@ -4058,7 +3403,7 @@ If a multiaddr is received, the addressBook is updated.

    - peer ((PeerId | Multiaddr | string)) + peer ((PeerInfo | PeerId | Multiaddr | string))
    @@ -4080,7 +3425,7 @@ If a multiaddr is received, the addressBook is updated.

    Returns
    - {id: PeerId, multiaddrs: Array<Multiaddr>}: + PeerInfo: @@ -4110,25 +3455,22 @@ If a multiaddr is received, the addressBook is updated.

    -

    - AddressManager +

    + getPeerInfoRemote

    - - src/address-manager/index.js + + src/get-peer-info.js
    -

    Responsible for managing this peers addresses. -Peers can specify their listen, announce and noAnnounce addresses. -The listen addresses will be used by the libp2p transports to listen for new connections, -while the announce an noAnnounce addresses will be combined with the listen addresses for -address adverstising to other peers in the network.

    +

    If getPeerInfo does not return a peer with multiaddrs, +the libp2p PeerRouter will be used to attempt to find the peer.

    -
    new AddressManager($0: Object, options: object?)
    +
    getPeerInfoRemote(peer: (PeerInfo | PeerId | Multiaddr | string), libp2p: Libp2p): Promise<PeerInfo>
    @@ -4145,62 +3487,15 @@ address adverstising to other peers in the network.

    - $0 (Object - = {}) + peer ((PeerInfo | PeerId | Multiaddr | string))
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameDescription
    $0.listen any - - (default []) -
    $0.announce any - - (default []) -
    $0.noAnnounce any - - (default []) -
    -
    - options (object?) + libp2p (Libp2p)
    @@ -4212,61 +3507,9 @@ address adverstising to other peers in the network.

    - - - - - - - - - - -
    Instance Members
    -
    - -
    -
    -
    - - getListenAddrs() -
    -
    - -
    - -
    -
    -
    - - getAnnounceAddrs() -
    -
    - -
    - -
    -
    -
    - - getNoAnnounceAddrs() -
    -
    - -
    - -
    - - - - - - @@ -4440,29 +3539,21 @@ address adverstising to other peers in the network.

    -

    - ConnectionManager +

    + constructor

    - + src/connection-manager/index.js
    -

    Responsible for managing known connections.

    - -
    new ConnectionManager(libp2p: Libp2p, options: object)
    +
    new constructor(libp2p: Libp2p, options: object)
    -

    - Extends - - EventEmitter - -

    @@ -4490,6 +3581,103 @@ address adverstising to other peers in the network.

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameDescription
    options.maxConnections Number + The maximum number of connections allowed. Default=Infinity +
    options.minConnections Number + The minimum number of connections to avoid pruning. Default=0 +
    options.maxData Number + The max data (in and out), per average interval to allow. Default=Infinity +
    options.maxSentData Number + The max outgoing data, per average interval to allow. Default=Infinity +
    options.maxReceivedData Number + The max incoming data, per average interval to allow.. Default=Infinity +
    options.maxEventLoopDelay Number + The upper limit the event loop can take to run. Default=Infinity +
    options.pollInterval Number + How often, in milliseconds, metrics and latency should be checked. Default=2000 +
    options.movingAverageInterval Number + How often, in milliseconds, to compute averages. Default=60000 +
    options.defaultPeerValue Number + The value of the peer. Default=1 +
    +
    @@ -4503,63 +3691,6 @@ address adverstising to other peers in the network.

    - - - - - -
    Instance Members
    -
    - -
    -
    -
    - - _peerValues -
    -
    - -
    - -
    -
    -
    - - connections -
    -
    - -
    - -
    -
    -
    - - size -
    -
    - -
    - -
    -
    -
    - - start() -
    -
    - -
    - -
    -
    -
    - - stop() -
    -
    - -
    - -
    -
    -
    - - _close() -
    -
    - -
    - -
    -
    -
    - - setPeerValue(peerId, value) -
    -
    - -
    - -
    -
    -
    - - onConnect(connection) -
    -
    - -
    - -
    -
    -
    - - onDisconnect(connection) -
    -
    - -
    - -
    -
    -
    - - get(peerId) -
    -
    - -
    - -
    -
    -
    - - getAll(peerId) -
    -
    - -
    - -
    - - - - - - @@ -5273,7 +4035,7 @@ will be disconnected first.

    - + src/connection-manager/latency-monitor.js @@ -5327,7 +4089,7 @@ will be disconnected first.

    - + src/connection-manager/latency-monitor.js @@ -5425,7 +4187,7 @@ will be disconnected first.

    - + src/connection-manager/latency-monitor.js @@ -5600,7 +4362,7 @@ monitor.on('data', (summary) => - + src/connection-manager/latency-monitor.js @@ -5675,7 +4437,7 @@ it will not count for this time period

    - + src/connection-manager/visibility-change-emitter.js @@ -5729,7 +4491,7 @@ it will not count for this time period

    - + src/connection-manager/visibility-change-emitter.js @@ -5803,7 +4565,7 @@ it will not count for this time period

    - + src/connection-manager/visibility-change-emitter.js @@ -5866,7 +4628,7 @@ it will not count for this time period

    - + src/circuit/index.js @@ -5965,7 +4727,7 @@ it will not count for this time period

    - + src/circuit/index.js @@ -6075,7 +4837,7 @@ it will not count for this time period

    - + src/circuit/index.js @@ -6158,7 +4920,7 @@ it will not count for this time period

    - + src/circuit/index.js @@ -6233,7 +4995,7 @@ it will not count for this time period

    - + src/circuit/index.js @@ -6287,7 +5049,7 @@ it will not count for this time period

    - + src/identify/index.js @@ -6355,7 +5117,7 @@ it will not count for this time period

    - + src/circuit/listener.js @@ -6425,7 +5187,7 @@ it will not count for this time period

    - + src/circuit/listener.js @@ -6504,7 +5266,7 @@ it will not count for this time period

    - + src/circuit/listener.js @@ -6570,7 +5332,7 @@ it will not count for this time period

    - + src/circuit/listener.js @@ -6655,7 +5417,7 @@ be dialed over TCP rather than any other transport

    - + src/circuit/circuit/hop.js @@ -6772,7 +5534,7 @@ peer. A new, virtual, connection will be created between the two via the relay.< - + src/circuit/circuit/utils.js @@ -6847,7 +5609,7 @@ peer. A new, virtual, connection will be created between the two via the relay.< - + src/circuit/circuit/utils.js @@ -6923,7 +5685,7 @@ peer. A new, virtual, connection will be created between the two via the relay.< - + src/circuit/circuit/stream-handler.js @@ -7026,7 +5788,7 @@ peer. A new, virtual, connection will be created between the two via the relay.< - + src/circuit/circuit/stream-handler.js @@ -7088,7 +5850,7 @@ peer. A new, virtual, connection will be created between the two via the relay.< - + src/circuit/circuit/stream-handler.js @@ -7156,7 +5918,7 @@ peer. A new, virtual, connection will be created between the two via the relay.< - + src/circuit/circuit/stream-handler.js @@ -7218,7 +5980,7 @@ peer. A new, virtual, connection will be created between the two via the relay.< - + src/circuit/circuit/stream-handler.js @@ -7280,7 +6042,7 @@ peer. A new, virtual, connection will be created between the two via the relay.< - + src/dialer/index.js @@ -7468,7 +6230,7 @@ peer. A new, virtual, connection will be created between the two via the relay.< - + src/dialer/index.js @@ -7522,18 +6284,18 @@ peer. A new, virtual, connection will be created between the two via the relay.< - + src/dialer/index.js
    -

    Connects to a given peer by dialing all of its known addresses. +

    Connects to a given PeerId or Multiaddr by dialing all of its known addresses. The dial to the first address that is successfully able to upgrade a connection will be used.

    -
    connectToPeer(peer: (PeerId | Multiaddr | string), options: object?): Promise<Connection>
    +
    connectToPeer(peer: (PeerInfo | Multiaddr), options: object?): Promise<Connection>
    @@ -7550,7 +6312,7 @@ will be used.

    - peer ((PeerId | Multiaddr | string)) + peer ((PeerInfo | Multiaddr)) The peer to dial
    @@ -7634,7 +6396,7 @@ will be used.

    - + src/dialer/index.js @@ -7717,7 +6479,7 @@ will be used.

    - + src/dialer/index.js @@ -7805,6 +6567,81 @@ will be used.

    + + + + + +
    + + +
    + +

    + getDialable +

    + + + + src/dialer/index.js + + +
    + + +

    Converts the given peer into a PeerInfo or Multiaddr.

    + +
    getDialable(peer: (PeerInfo | PeerId | Multiaddr | string)): (PeerInfo | Multiaddr)
    + + + + + + + + + + + +
    Parameters
    +
    + +
    +
    + peer ((PeerInfo | PeerId | Multiaddr | string)) + +
    + +
    + +
    + + + + + + +
    Returns
    + (PeerInfo | Multiaddr): + + + + + + + + + + + + + + + + + + +
    @@ -7820,7 +6657,7 @@ will be used.

    - + src/dialer/dial-request.js @@ -7931,7 +6768,7 @@ all other dials in the request will be cancelled.

    - + src/dialer/dial-request.js @@ -8015,1477 +6852,6 @@ all other dials in the request will be cancelled.

    - - - - - -
    - - -
    - -

    - KeyInfo -

    - - - - src/keychain/index.js - - -
    - - -

    Information about a key.

    - -
    KeyInfo
    - -

    - Type: - Object -

    - - - - - - - - - - - - - -
    Properties
    -
    - -
    - id (string) - : The universally unique key id. - - -
    - -
    - name (string) - : The local key name. - - -
    - -
    - - - - - - - - - - - - - - - - - -
    - - - - -
    - - -
    - -

    - Keychain -

    - - - - src/keychain/index.js - - -
    - - -

    Manages the lifecycle of a key. Keys are encrypted at rest using PKCS #8.

    -

    A key in the store has two entries

    -
      -
    • '/info/key-name', contains the KeyInfo for the key
    • -
    • '/pkcs8/key-name', contains the PKCS #8 for the key
    • -
    - -
    new Keychain(store: DS, options: object)
    - - - - - - - - - - - -
    Parameters
    -
    - -
    -
    - store (DS) - where the key are. - -
    - -
    - -
    -
    - options (object) - ??? - -
    - -
    - -
    - - - - - - - - - - - - - -
    Static Members
    -
    - -
    -
    -
    - - generateOptions() -
    -
    - -
    - -
    -
    -
    - - options -
    -
    - -
    - -
    - - - - -
    Instance Members
    -
    - -
    -
    -
    - - cms -
    -
    - -
    - -
    -
    -
    - - createKey(name, type, size) -
    -
    - -
    - -
    -
    -
    - - listKeys() -
    -
    - -
    - -
    -
    -
    - - findKeyById(id) -
    -
    - -
    - -
    -
    -
    - - findKeyByName(name) -
    -
    - -
    - -
    -
    -
    - - removeKey(name) -
    -
    - -
    - -
    -
    -
    - - renameKey(oldName, newName) -
    -
    - -
    - -
    -
    -
    - - exportKey(name, password) -
    -
    - -
    - -
    -
    -
    - - importKey(name, pem, password) -
    -
    - -
    - -
    - - - - - - -
    - - - - -
    - - -
    - -

    - CMS -

    - - - - src/keychain/cms.js - - -
    - - -

    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.

    - -
    new CMS(keychain: Keychain)
    - - - - - - - - - - - -
    Parameters
    -
    - -
    -
    - keychain (Keychain) - the available keys - -
    - -
    - -
    - - - - - - - - - - - - - - - -
    Instance Members
    -
    - -
    -
    -
    - - encrypt(name, plain) -
    -
    - -
    - -
    -
    -
    - - decrypt(cmsData) -
    -
    - -
    - -
    - - - - - - -
    - - - - -
    - - -
    - -

    - certificateForKey -

    - - - - src/keychain/util.js - - -
    - - -

    Gets a self-signed X.509 certificate for the key.

    -

    The output Buffer contains the PKCS #7 message in DER.

    -

    TODO: move to libp2p-crypto package

    - -
    certificateForKey(key: KeyInfo, privateKey: RsaPrivateKey): undefined
    - - - - - - - - - - - -
    Parameters
    -
    - -
    -
    - key (KeyInfo) - The id and name of the key - -
    - -
    - -
    -
    - privateKey (RsaPrivateKey) - The naked key - -
    - -
    - -
    - - - - - - -
    Returns
    - undefined: - - - - - - - - - - - - - - - - - - - -
    - - - - -
    - - -
    - -

    - findAsync -

    - - - - src/keychain/util.js - - -
    - - -

    Finds the first item in a collection that is matched in the -asyncCompare function.

    -

    asyncCompare is an async function that must -resolve to either true or false.

    - -
    findAsync(array: Array, asyncCompare: function (any))
    - - - - - - - - - - - -
    Parameters
    -
    - -
    -
    - array (Array) - -
    - -
    - -
    -
    - asyncCompare (function (any)) - An async function that returns a boolean - -
    - -
    - -
    - - - - - - - - - - - - - - - - - - -
    @@ -9501,7 +6867,7 @@ resolve to either true or false.

    - + src/metrics/index.js @@ -9543,14 +6909,6 @@ resolve to either true or false.

    - - options.connectionManager ConnectionManager - - - - - - options.computeThrottleMaxQueueSize number @@ -9623,7 +6981,7 @@ resolve to either true or false.

    - + src/metrics/index.js @@ -9678,7 +7036,7 @@ will be ignored.

    - + src/metrics/index.js @@ -9733,7 +7091,7 @@ Once stop is called, start must be called to resume st - + src/metrics/index.js @@ -9795,7 +7153,7 @@ Once stop is called, start must be called to resume st - + src/metrics/index.js @@ -9857,7 +7215,7 @@ Once stop is called, start must be called to resume st - + src/metrics/index.js @@ -9933,7 +7291,7 @@ is a live peer, or in the disconnected peer LRU cache.

    - + src/metrics/index.js @@ -9995,7 +7353,7 @@ is a live peer, or in the disconnected peer LRU cache.

    - + src/metrics/index.js @@ -10070,7 +7428,7 @@ is a live peer, or in the disconnected peer LRU cache.

    - + src/metrics/index.js @@ -10139,7 +7497,7 @@ be stopped and moved to an LRU for temporary retention.

    - + src/metrics/index.js @@ -10217,7 +7575,7 @@ placeholder stats will be merged with the existing stats.

    - + src/metrics/index.js @@ -10347,7 +7705,7 @@ with the placeholder string returned from here, and the known PeerId - + src/metrics/index.js @@ -10431,7 +7789,7 @@ and returned.

    - + src/metrics/old-peers.js @@ -10506,7 +7864,7 @@ and returned.

    - + src/metrics/stats.js @@ -10586,7 +7944,7 @@ and returned.

    - + src/metrics/stats.js @@ -10654,7 +8012,7 @@ should only need to be called if Stats.stop was previously called,
    - + src/metrics/stats.js @@ -10721,7 +8079,7 @@ timer.

    - + src/metrics/stats.js @@ -10787,7 +8145,7 @@ timer.

    - + src/metrics/stats.js @@ -10853,7 +8211,7 @@ timer.

    - + src/metrics/stats.js @@ -10919,7 +8277,7 @@ timer.

    - + src/metrics/stats.js @@ -11015,7 +8373,7 @@ current Timestamp, then resets the update timer.

    - + src/transport-manager.js @@ -11075,17 +8433,6 @@ current Timestamp, then resets the update timer.

    - - options.faultTolerance boolean - - (default FAULT_TOLERANCE.FATAL_ALL) - - Address listen error tolerance. - - - - - @@ -11126,7 +8473,7 @@ current Timestamp, then resets the update timer.

    - + src/transport-manager.js @@ -11219,7 +8566,7 @@ current Timestamp, then resets the update timer.

    - + src/transport-manager.js @@ -11273,7 +8620,7 @@ current Timestamp, then resets the update timer.

    - + src/transport-manager.js @@ -11356,7 +8703,7 @@ current Timestamp, then resets the update timer.

    - + src/transport-manager.js @@ -11418,7 +8765,7 @@ current Timestamp, then resets the update timer.

    - + src/transport-manager.js @@ -11480,7 +8827,7 @@ current Timestamp, then resets the update timer.

    - + src/transport-manager.js @@ -11555,16 +8902,16 @@ current Timestamp, then resets the update timer.

    - + src/transport-manager.js
    -

    Starts listeners for each listen Multiaddr.

    +

    Starts listeners for each given Multiaddr.

    -
    listen()
    +
    listen(addrs: Array<Multiaddr>)
    @@ -11576,6 +8923,19 @@ current Timestamp, then resets the update timer.

    +
    Parameters
    +
    + +
    +
    + addrs (Array<Multiaddr>) + +
    + +
    + +
    + @@ -11609,7 +8969,7 @@ current Timestamp, then resets the update timer.

    - + src/transport-manager.js @@ -11677,7 +9037,7 @@ If a transport has any running listeners, they will be closed.

    - + src/transport-manager.js @@ -11708,67 +9068,6 @@ If any listeners are running, they will be closed.

    - - - - - - - - - - - - - - -
    - - -
    - -

    - FAULT_TOLERANCE -

    - - - - src/transport-manager.js - - -
    - - -

    Enum Transport Manager Fault Tolerance values. -FATAL_ALL should be used for failing in any listen circumstance. -NO_FATAL should be used for not failing when not listening.

    - -
    FAULT_TOLERANCE
    - -

    - Type: - number -

    - - - - - - - - - - - - - - - - - - - - @@ -11793,7 +9092,7 @@ NO_FATAL should be used for not failing when not listening.

    - + src/upgrader.js @@ -11954,7 +9253,7 @@ NO_FATAL should be used for not failing when not listening.

    - + src/upgrader.js @@ -12033,7 +9332,7 @@ NO_FATAL should be used for not failing when not listening.

    - + src/upgrader.js @@ -12120,7 +9419,7 @@ NO_FATAL should be used for not failing when not listening.

    - + src/upgrader.js @@ -12284,7 +9583,7 @@ NO_FATAL should be used for not failing when not listening.

    - + src/upgrader.js @@ -12363,7 +9662,7 @@ NO_FATAL should be used for not failing when not listening.

    - + src/upgrader.js @@ -12450,14 +9749,14 @@ NO_FATAL should be used for not failing when not listening.

    - + src/peer-store/index.js
    -

    Responsible for managing known peers, as well as their addresses, protocols and metadata.

    +

    Responsible for managing known peers, as well as their addresses and metadata

    new PeerStore()
    @@ -12495,354 +9794,6 @@ NO_FATAL should be used for not failing when not listening.

    Instance Members
    -
    -
    -
    - - addressBook -
    -
    - -
    - -
    -
    -
    - - keyBook -
    -
    - -
    - -
    -
    -
    - - metadataBook -
    -
    - -
    - -
    -
    -
    - - protoBook -
    -
    - -
    - -
    -
    -
    - - start() -
    -
    - -
    - -
    -
    -
    - - stop() -
    -
    - -
    -
    @@ -12857,17 +9808,22 @@ NO_FATAL should be used for not failing when not listening.

    -

    Get all the stored information of every peer.

    +

    Map of peers

    peers
    +

    + Type: + Map<string, PeerInfo> +

    + @@ -12882,9 +9838,118 @@ NO_FATAL should be used for not failing when not listening.

    + + + + + + + + + + + + + + +
    + +
    +
    + +
    +
    +
    + + put(peerInfo, options = {silent:false}) +
    +
    +
    -
    +
    - delete(peerId) + add(peerInfo)
    + +
    +
    +
    + + update(peerInfo) +
    +
    + + + + + + + +
    Returns
    + PeerInfo: + + + + + + + + + + + + + + + + + + + + + +
    +
    + +
    +
    +
    + + has(peerId) +
    +
    + +
    + +
    +
    +
    + + remove(peerId) +
    +
    + +
    + +
    +
    +
    + + replace(peerInfo) +
    +
    + - - - - - - - - - - - -
    - - -
    - -

    - AddressBook -

    - - - - src/peer-store/address-book.js - - -
    - - -

    The AddressBook is responsible for keeping the known multiaddrs -of a peer.

    - -
    new AddressBook(peerStore: PeerStore)
    - - -

    - Extends - - Book - -

    - - - - - - - - - - -
    Parameters
    -
    - -
    -
    - peerStore (PeerStore) - -
    - -
    - -
    - - - - - - - - - - - - - - - -
    Instance Members
    -
    - -
    +
    - data + multiaddrsForPeer(peer)
    - -
    -
    - -
    -
    -
    - - set(peerId, multiaddrs) -
    -
    - -
    - -
    -
    -
    - - add(peerId, multiaddrs) -
    -
    - -
    - -
    -
    -
    - - getMultiaddrsForPeer(peerId) -
    -
    - -
    - -
    - - - - - - - - - - - -
    - - -
    - -

    - eventTransformer -

    - - - - src/peer-store/address-book.js - - -
    - - -

    PeerStore Event emitter, used by the AddressBook to emit: -"peer" - emitted when a peer is discovered by the node. -"change:multiaddrs" - emitted when the known multiaddrs of a peer change.

    - -
    eventTransformer
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - -
    - - -
    - -

    - eventTransformer -

    - - - - src/peer-store/proto-book.js - - -
    - - -

    PeerStore Event emitter, used by the ProtoBook to emit: -"change:protocols" - emitted when the known protocols of a peer change.

    - -
    eventTransformer
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - -
    - - -
    - -

    - Book -

    - - - - src/peer-store/book.js - - -
    - - -

    The Book is the skeleton for the PeerStore books.

    - -
    new Book($0: Object, properties: Object)
    - - - - - - - - - - - -
    Parameters
    -
    - -
    -
    - $0 (Object) - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameDescription
    $0.peerStore any -
    $0.eventName any -
    $0.eventProperty any -
    $0.eventTransformer any - - (default passthrough) -
    - -
    - -
    -
    - properties (Object) - -
    - -
    - -
    - - - - - - - - - - - - - - - -
    Instance Members
    -
    - -
    -
    -
    - - data -
    -
    - -
    - -
    -
    -
    - - set(peerId, data) -
    -
    - -
    - -
    -
    -
    - - get(peerId) -
    -
    - -
    - -
    -
    -
    - - delete(peerId) -
    -
    - -
    - -
    - - - - - - -
    - - - - -
    - - -
    - -

    - KeyBook -

    - - - - src/peer-store/key-book.js - - -
    - - -

    The KeyBook is responsible for keeping the known public keys of a peer.

    - -
    new KeyBook(peerStore: PeerStore)
    - - -

    - Extends - - Book - -

    - - - - - - - - - - -
    Parameters
    -
    - -
    -
    - peerStore (PeerStore) - -
    - -
    - -
    - - - - - - - - - - - - - - - -
    Instance Members
    -
    - -
    -
    -
    - - data -
    -
    - -
    - -
    -
    -
    - - set(peerId, publicKey) -
    -
    - -
    - -
    -
    -
    - - get(peerId) -
    -
    - -
    - -
    - - - - - - -
    - - - - -
    - - -
    - -

    - MetadataBook -

    - - - - src/peer-store/metadata-book.js - - -
    - - -

    The MetadataBook is responsible for keeping the known supported -protocols of a peer.

    - -
    new MetadataBook(peerStore: PeerStore)
    - - -

    - Extends - - Book - -

    - - - - - - - - - - -
    Parameters
    -
    - -
    -
    - peerStore (PeerStore) - -
    - -
    - -
    - - - - - - - - - - - - - - - -
    Instance Members
    -
    - -
    -
    -
    - - data -
    -
    - -
    - -
    -
    -
    - - set(peerId, key, value) -
    -
    - -
    - -
    -
    -
    - - _setValue(peerId, key, value, $3) -
    -
    - -
    - -
    -
    -
    - - get(peerId) -
    -
    - -
    - -
    -
    -
    - - getValue(peerId, key) -
    -
    - -
    - -
    -
    -
    - - delete(peerId) -
    -
    - -
    - -
    -
    -
    - - deleteValue(peerId, key) -
    -
    - -
    - -
    - - - - - - -
    - - - - -
    - - -
    - -

    - eventProperty -

    - - - - src/peer-store/metadata-book.js - - -
    - - -

    PeerStore Event emitter, used by the MetadataBook to emit: -"change:metadata" - emitted when the known metadata of a peer change.

    - -
    eventProperty
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - -
    - - -
    - -

    - ProtoBook -

    - - - - src/peer-store/proto-book.js - - -
    - - -

    The ProtoBook is responsible for keeping the known supported -protocols of a peer.

    - -
    new ProtoBook(peerStore: PeerStore)
    - - -

    - Extends - - Book - -

    - - - - - - - - - - -
    Parameters
    -
    - -
    -
    - peerStore (PeerStore) - -
    - -
    - -
    - - - - - - - - - - - - - - - -
    Instance Members
    -
    - -
    -
    -
    - - data -
    -
    - -
    - -
    -
    -
    - - set(peerId, protocols) -
    -
    - -
    - -
    -
    -
    - - add(peerId, protocols) -
    -
    - -
    - -
    - - - - - - -
    - - - - -
    - - -
    - -

    - PersistentPeerStore -

    - - - - src/peer-store/persistent/index.js - - -
    - - -

    Responsible for managing the persistence of data in the PeerStore.

    - -
    new PersistentPeerStore($0: Object, properties: Object)
    - - -

    - Extends - - PeerStore - -

    - - - - - - - - - - -
    Parameters
    -
    - -
    -
    - $0 (Object) - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameDescription
    $0.datastore any -
    $0.threshold any - - (default 5) -
    - -
    - -
    -
    - properties (Object) - -
    - -
    - -
    - - - - - - - - - - - - - - - -
    Instance Members
    -
    - -
    -
    -
    - - _datastore -
    -
    - -
    - -
    -
    -
    - - _dirtyPeers -
    -
    - -
    - -
    -
    -
    - - _dirtyMetadata -
    -
    - -
    - -
    -
    -
    - - start() -
    -
    - @@ -15771,7 +10553,7 @@ If the peer was not known before, it will be added.

    - + src/registrar.js @@ -15822,14 +10604,6 @@ If the peer was not known before, it will be added.

    - - $0.connectionManager any - - - - - - @@ -15862,6 +10636,70 @@ If the peer was not known before, it will be added.

    Instance Members
    +
    +
    +
    + + connections +
    +
    + +
    +
    @@ -15876,7 +10714,7 @@ If the peer was not known before, it will be added.

    - + src/registrar.js @@ -15925,11 +10763,11 @@ If the peer was not known before, it will be added.

    -
    +
    - getConnection(peerId) + close()
    + +
    +
    + +
    +
    +
    + + onConnect(peerInfo, conn) +
    +
    + + + + + + + +
    Returns
    + void: + + + + + + + + + + + + + + + + + + + + + +
    +
    + +
    +
    +
    + + onDisconnect(peerInfo, connection, error?) +
    +
    + +
    + +
    +
    +
    + + getConnection(peerInfo) +
    +
    + -
    - -
    -
    -
    - - _onDisconnect(connection, error?) -
    -
    - @@ -16273,7 +11266,7 @@ If the peer was not known before, it will be added.

    - + src/ping/index.js @@ -16282,7 +11275,7 @@ If the peer was not known before, it will be added.

    Ping a given peer and wait for its response, getting the operation latency.

    -
    ping(node: Libp2p, peer: PeerId): Promise<Number>
    +
    ping(node: Libp2p, peer: PeerInfo): Promise<Number>
    @@ -16307,7 +11300,7 @@ If the peer was not known before, it will be added.

    - peer (PeerId) + peer (PeerInfo)
    @@ -16356,7 +11349,7 @@ If the peer was not known before, it will be added.

    - + src/ping/index.js @@ -16423,7 +11416,7 @@ If the peer was not known before, it will be added.

    - + src/ping/index.js @@ -16490,7 +11483,7 @@ If the peer was not known before, it will be added.

    - + src/identify/index.js @@ -16533,7 +11526,7 @@ If the peer was not known before, it will be added.

    - options.libp2p Libp2p + options.registrar Registrar @@ -16549,6 +11542,15 @@ If the peer was not known before, it will be added.

    + + options.peerInfo PeerInfo + + The peer running the identify service + + + + + @@ -16584,12 +11586,12 @@ If the peer was not known before, it will be added.

    -

    - peerStore +

    + registrar

    - + src/identify/index.js @@ -16597,7 +11599,7 @@ If the peer was not known before, it will be added.

    -
    peerStore
    +
    registrar
    @@ -16637,12 +11639,12 @@ If the peer was not known before, it will be added.

    -

    - connectionManager +

    + peerInfo

    - + src/identify/index.js @@ -16650,113 +11652,7 @@ If the peer was not known before, it will be added.

    -
    connectionManager
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    - -

    - peerId -

    - - - - src/identify/index.js - - -
    - - - -
    peerId
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - -
    - - -
    - -

    - _libp2p -

    - - - - src/identify/index.js - - -
    - - - -
    _libp2p
    +
    peerInfo
    @@ -16801,7 +11697,7 @@ If the peer was not known before, it will be added.

    - + src/identify/index.js @@ -16876,7 +11772,7 @@ If the peer was not known before, it will be added.

    - + src/identify/index.js @@ -16943,7 +11839,7 @@ If the peer was not known before, it will be added.

    - + src/identify/index.js @@ -17020,7 +11916,7 @@ an error will be thrown.

    - + src/identify/index.js @@ -17120,6 +12016,158 @@ an error will be thrown.

    +
    + + + + +
    + + +
    + +

    + updatePeerAddresses +

    + + + + src/identify/index.js + + +
    + + +

    Replaces the multiaddrs on the given peerInfo, +with the provided multiaddrs

    + +
    updatePeerAddresses(peerInfo: PeerInfo, multiaddrs: (Array<Multiaddr> | Array<Buffer>))
    + + + + + + + + + + + +
    Parameters
    +
    + +
    +
    + peerInfo (PeerInfo) + +
    + +
    + +
    +
    + multiaddrs ((Array<Multiaddr> | Array<Buffer>)) + +
    + +
    + +
    + + + + + + + + + + + + + + + + + + + +
    + + + + +
    + + +
    + +

    + updatePeerProtocols +

    + + + + src/identify/index.js + + +
    + + +

    Replaces the protocols on the given peerInfo, +with the provided protocols

    + +
    updatePeerProtocols(peerInfo: PeerInfo, protocols: Array<string>)
    + + + + + + + + + + + +
    Parameters
    +
    + +
    +
    + peerInfo (PeerInfo) + +
    + +
    + +
    +
    + protocols (Array<string>) + +
    + +
    + +
    + + + + + + + + + + + + + + + + + + +
    @@ -17135,7 +12183,7 @@ an error will be thrown.

    - + src/identify/index.js