Hierarchy

  • PeerRouting

Properties

findPeer: ((peerId: PeerId, options?: AbortOptions) => Promise<PeerInfo>)

Type declaration

getClosestPeers: ((key: Uint8Array, options?: AbortOptions) => AsyncIterable<PeerInfo>)

Type declaration

    • (key: Uint8Array, options?: AbortOptions): AsyncIterable<PeerInfo>
    • Search the network for peers that are closer to the passed key. Peer info should be yielded in ever-increasing closeness to the key.

      Example

      // Iterate over the closest peers found for the given key
      for await (const peer of peerRouting.getClosestPeers(key)) {
      console.log(peer.id, peer.multiaddrs)
      }

      Parameters

      Returns AsyncIterable<PeerInfo>