2.0.1 • Published 1 year ago

@libp2p/delegated-routing-v1-http-api-content-routing v2.0.1

Weekly downloads
-
License
Apache-2.0 OR MIT
Repository
github
Last release
1 year ago

⛔️ DEPRECATED

As of 1.1.0 the @helia/delegated-routing-v1-http-api-client module supports both the libp2p ContentRouting and PeerRouting interfaces so should be used instead.

This library will not be maintained.


@libp2p/delegated-routing-v1-http-api-content-routing

libp2p.io Discuss codecov CI

Use a Delegated Routing V1 HTTP service to discover content providers

This is a ContentRouting implementation that makes use of the @helia/delegated-routing-v1-http-api-client to use servers that implement the snappily-titled Delegated Routing V1 HTTP API spec to get/put IPNS records and to resolve providers for CIDs.

Table of contents

Install

$ npm i @libp2p/delegated-routing-v1-http-api-content-routing

Browser <script> tag

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

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

Example

import { createLibp2p } from 'libp2p'
import { delgatedRoutingV1HTTPAPIContentRouting } from '@libp2p/delegated-routing-http-v1-content-routing'

const node = await createLibp2p({
  contentRouters: [
    delgatedRoutingV1HTTPAPIContentRouting('https://example.org')
  ]
  //.. other config
})
await node.start()

for await (const provider of node.contentRouting.findProviders('cid')) {
  console.log('provider', provider)
}

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.