This repository has been archived by the owner on Oct 30, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
fix!: use @helia/delegated-routing-v1-http-api-client internally #27
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,49 @@ | ||
# @libp2p/http-v1-content-routing <!-- omit in toc --> | ||
# @libp2p/delegated-routing-v1-http-api-content-routing <!-- omit in toc --> | ||
|
||
[![libp2p.io](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](http://libp2p.io/) | ||
[![Discuss](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg?style=flat-square)](https://discuss.libp2p.io) | ||
[![codecov](https://img.shields.io/codecov/c/github/libp2p/js-http-v1-content-routing.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-http-v1-content-routing) | ||
[![CI](https://img.shields.io/github/actions/workflow/status/libp2p/js-http-v1-content-routing/js-test-and-release.yml?branch=main\&style=flat-square)](https://github.com/libp2p/js-http-v1-content-routing/actions/workflows/js-test-and-release.yml?query=branch%3Amain) | ||
[![codecov](https://img.shields.io/codecov/c/github/libp2p/js-delegated-routing-v1-http-api-content-routing.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-delegated-routing-v1-http-api-content-routing) | ||
[![CI](https://img.shields.io/github/actions/workflow/status/libp2p/js-delegated-routing-v1-http-api-content-routing/js-test-and-release.yml?branch=main\&style=flat-square)](https://github.com/libp2p/js-delegated-routing-v1-http-api-content-routing/actions/workflows/js-test-and-release.yml?query=branch%3Amain) | ||
|
||
> Use a Routing V1 HTTP service to discover content providers | ||
> Use a Delegated Routing V1 HTTP service to discover content providers | ||
|
||
This is a [ContentRouting](https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.content_routing.ContentRouting.html) | ||
implementation that makes use of the [@helia/delegated-routing-v1-http-api-client](https://www.npmjs.com/package/@helia/delegated-routing-v1-http-api-client) | ||
to use servers that implement the snappily-titled [Delegated Routing V1 HTTP API](Delegated Routing V1 HTTP API) | ||
spec to get/put IPNS records and to resolve providers for CIDs. | ||
|
||
## Table of contents <!-- omit in toc --> | ||
|
||
- [Install](#install) | ||
- [Browser `<script>` tag](#browser-script-tag) | ||
- - [Install](#install) | ||
- [Browser `<script>` tag](#browser-script-tag) | ||
- [Example](#example) | ||
- [API Docs](#api-docs) | ||
- [License](#license) | ||
- [Contribution](#contribution) | ||
- [API Docs](#api-docs) | ||
- [License](#license) | ||
- [Contribution](#contribution) | ||
|
||
## Install | ||
|
||
```console | ||
$ npm i @libp2p/http-v1-content-routing | ||
$ 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 `Libp2pHttpV1ContentRouting` in the global namespace. | ||
Loading this module through a script tag will make it's exports available as `Libp2pDelegatedRoutingV1HttpApiContentRouting` in the global namespace. | ||
|
||
```html | ||
<script src="https://unpkg.com/@libp2p/http-v1-content-routing/dist/index.min.js"></script> | ||
<script src="https://unpkg.com/@libp2p/delegated-routing-v1-http-api-content-routing/dist/index.min.js"></script> | ||
``` | ||
|
||
## Example | ||
# Example | ||
|
||
```js | ||
import { createLibp2p } from 'libp2p' | ||
import { reframeContentRouting } from '@libp2p/reframe-content-routing' | ||
import { delgatedRoutingV1HTTPAPIContentRouting } from '@libp2p/delegated-routing-http-v1-content-routing' | ||
|
||
const node = await createLibp2p({ | ||
contentRouters: [ | ||
reframeContentRouting('https://cid.contact/reframe') | ||
delgatedRoutingV1HTTPAPIContentRouting('https://example.org') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When ipshipyard/waterworks-community#1 lands (EOW week I expect), delegated-ipfs.dev will be a good default. |
||
] | ||
//.. other config | ||
}) | ||
|
@@ -51,7 +56,7 @@ for await (const provider of node.contentRouting.findProviders('cid')) { | |
|
||
## API Docs | ||
|
||
- <https://libp2p.github.io/js-http-v1-content-routing> | ||
- <https://libp2p.github.io/js-delegated-routing-v1-http-api-content-routing> | ||
|
||
## License | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume we mean to link to https://specs.ipfs.tech/routing/http-routing-v1/ ?