You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

@libp2p/delegated-peer-routing

Package Overview
Dependencies
Maintainers
6
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@libp2p/delegated-peer-routing

Leverage other peers in the libp2p network to perform Peer Routing calls.

4.0.14
latest
Source
npmnpm
Version published
Maintainers
6
Created
Source

@libp2p/delegated-peer-routing

libp2p.io Discuss codecov CI

Leverage other peers in the libp2p network to perform Peer Routing calls.

Table of contents

Install

$ npm i @libp2p/delegated-peer-routing

Browser <script> tag

Loading this module through a script tag will make it's exports available as Libp2pDelegatedPeerRouting in the global namespace.

<script src="https://unpkg.com/@libp2p/delegated-peer-routing/dist/index.min.js"></script>

Leverage other peers in the network to perform Peer Routing calls.

Requires access to /api/v0/dht/findpeer and /api/v0/dht/query HTTP API endpoints of the delegate node.

Requirements

libp2p-delegated-peer-routing leverages the kubo-rpc-client library and requires an instance of it as a constructor argument.

npm install kubo-rpc-client libp2p-delegated-peer-routing

Example

import { createLibp2p } from 'libp2p'
import { delegatedPeerRouting } from '@libp2p/delegated-peer-routing'
import { create as kuboClient } from 'kubo-rpc-client'

// default is to use ipfs.io
const client = kuboClient({
  // use default api settings
  protocol: 'https',
  port: 443,
  host: 'node0.delegate.ipfs.io'
})

const node = await createLibp2p({
  peerRouters: [
    delegatedPeerRouting(client)
  ]
  //.. other config
})
await node.start()

const peerInfo = await node.peerRouting.findPeer('peerid')
console.log('peerInfo', peerInfo)

API Docs

License

Licensed under either of

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

FAQs

Package last updated on 09 Oct 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts