From 2a82858899c0313addbdf89bba02b798da29867d Mon Sep 17 00:00:00 2001 From: achingbrain Date: Mon, 5 Jun 2023 12:34:34 +0100 Subject: [PATCH 1/3] chore: convert to monorepo Converts this repository to a monorepo - in the initial pass the only monorepo package is libp2p itself. --- .github/workflows/main.yml | 50 ++-- .release-please-manifest.json | 3 + .release-please.json | 9 + ISSUE_TEMPLATE.md | 43 ---- MIGRATION_TEMPLATE.md | 45 ---- OKR.md | 19 -- examples/auto-relay/dialer.js | 2 +- examples/auto-relay/listener.js | 2 +- examples/connection-encryption/1.js | 2 +- examples/delegated-routing/package.json | 2 +- examples/libp2p-in-the-browser/package.json | 2 +- examples/package.json | 2 +- interop/Dockerfile | 8 +- interop/package.json | 2 +- package.json | 239 +++--------------- .aegir.js => packages/libp2p/.aegir.js | 0 CHANGELOG.md => packages/libp2p/CHANGELOG.md | 0 LICENSE => packages/libp2p/LICENSE | 0 .../libp2p/LICENSE-APACHE | 0 LICENSE-MIT => packages/libp2p/LICENSE-MIT | 0 packages/libp2p/README.md | 212 ++++++++++++++++ .../libp2p/package-list.json | 0 packages/libp2p/package.json | 229 +++++++++++++++++ .../libp2p/scripts}/update-version.js | 0 .../libp2p/src}/address-manager/README.md | 0 .../libp2p/src}/address-manager/index.ts | 0 .../libp2p/src}/address-manager/utils.ts | 0 .../libp2p/src}/autonat/constants.ts | 0 {src => packages/libp2p/src}/autonat/index.ts | 0 .../libp2p/src}/autonat/pb/index.proto | 0 .../libp2p/src}/autonat/pb/index.ts | 0 .../libp2p/src}/circuit-relay/constants.ts | 0 .../libp2p/src}/circuit-relay/index.ts | 0 .../libp2p/src}/circuit-relay/pb/index.proto | 0 .../libp2p/src}/circuit-relay/pb/index.ts | 0 .../circuit-relay/server/advert-service.ts | 0 .../libp2p/src}/circuit-relay/server/index.ts | 0 .../circuit-relay/server/reservation-store.ts | 0 .../server/reservation-voucher.ts | 0 .../src}/circuit-relay/transport/discovery.ts | 0 .../src}/circuit-relay/transport/index.ts | 0 .../src}/circuit-relay/transport/listener.ts | 0 .../transport/reservation-store.ts | 0 .../libp2p/src}/circuit-relay/utils.ts | 0 {src => packages/libp2p/src}/components.ts | 0 {src => packages/libp2p/src}/config.ts | 0 .../src}/config/connection-gater.browser.ts | 0 .../libp2p/src}/config/connection-gater.ts | 0 .../src}/connection-manager/auto-dial.ts | 0 .../connection-manager/connection-pruner.ts | 0 .../src}/connection-manager/constants.ts | 0 .../src}/connection-manager/dial-queue.ts | 0 .../libp2p/src}/connection-manager/index.ts | 0 .../libp2p/src}/connection-manager/utils.ts | 0 .../libp2p/src}/connection/index.ts | 0 .../libp2p/src}/content-routing/index.ts | 0 .../libp2p/src}/content-routing/utils.ts | 0 {src => packages/libp2p/src}/errors.ts | 0 {src => packages/libp2p/src}/fetch/README.md | 0 .../libp2p/src}/fetch/constants.ts | 0 {src => packages/libp2p/src}/fetch/index.ts | 0 .../libp2p/src}/fetch/pb/proto.proto | 0 .../libp2p/src}/fetch/pb/proto.ts | 0 {src => packages/libp2p/src}/get-peer.ts | 0 .../libp2p/src}/identify/README.md | 0 .../libp2p/src}/identify/consts.ts | 0 .../libp2p/src}/identify/identify.ts | 0 .../libp2p/src}/identify/index.ts | 0 .../libp2p/src}/identify/pb/message.proto | 0 .../libp2p/src}/identify/pb/message.ts | 0 {src => packages/libp2p/src}/index.ts | 0 .../libp2p/src}/insecure/index.ts | 0 .../libp2p/src}/insecure/pb/proto.proto | 0 .../libp2p/src}/insecure/pb/proto.ts | 0 {src => packages/libp2p/src}/libp2p.ts | 0 {src => packages/libp2p/src}/peer-routing.ts | 0 {src => packages/libp2p/src}/ping/README.md | 0 .../libp2p/src}/ping/constants.ts | 0 {src => packages/libp2p/src}/ping/index.ts | 0 {src => packages/libp2p/src}/pnet/README.md | 0 {src => packages/libp2p/src}/pnet/crypto.ts | 0 {src => packages/libp2p/src}/pnet/errors.ts | 0 {src => packages/libp2p/src}/pnet/index.ts | 0 .../libp2p/src}/pnet/key-generator.ts | 0 .../libp2p/src}/pubsub/dummy-pubsub.ts | 0 {src => packages/libp2p/src}/registrar.ts | 0 .../libp2p/src}/transport-manager.ts | 0 {src => packages/libp2p/src}/upgrader.ts | 0 .../libp2p/src}/upnp-nat/index.ts | 0 {src => packages/libp2p/src}/version.ts | 0 .../test}/addresses/address-manager.spec.ts | 0 .../libp2p/test}/addresses/addresses.node.ts | 0 .../libp2p/test}/addresses/utils.ts | 0 .../libp2p/test}/autonat/index.spec.ts | 0 .../test}/circuit-relay/discovery.node.ts | 0 .../libp2p/test}/circuit-relay/hop.spec.ts | 0 .../libp2p/test}/circuit-relay/relay.node.ts | 0 .../libp2p/test}/circuit-relay/relay.spec.ts | 0 .../circuit-relay/reservation-store.spec.ts | 0 .../libp2p/test}/circuit-relay/stop.spec.ts | 0 .../libp2p/test}/circuit-relay/utils.spec.ts | 0 .../libp2p/test}/circuit-relay/utils.ts | 0 .../configuration/protocol-prefix.node.ts | 0 .../libp2p/test}/configuration/pubsub.spec.ts | 0 .../libp2p/test}/configuration/utils.ts | 0 .../connection-manager/auto-dial.spec.ts | 0 .../connection-manager/dial-queue.spec.ts | 0 .../test}/connection-manager/direct.node.ts | 0 .../test}/connection-manager/direct.spec.ts | 0 .../test}/connection-manager/index.node.ts | 0 .../test}/connection-manager/index.spec.ts | 0 .../test}/connection-manager/resolver.spec.ts | 0 .../test}/connection/compliance.spec.ts | 0 .../libp2p/test}/connection/fixtures/pair.ts | 0 .../libp2p/test}/connection/index.spec.ts | 0 .../content-routing/content-routing.node.ts | 0 .../content-routing/dht/operation.node.ts | 0 .../libp2p/test}/content-routing/dht/utils.ts | 0 .../libp2p/test}/content-routing/utils.ts | 0 .../test}/core/consume-peer-record.spec.ts | 0 .../libp2p/test}/core/encryption.spec.ts | 0 .../libp2p/test}/core/events.spec.ts | 0 .../libp2p/test}/core/get-public-key.spec.ts | 0 .../libp2p/test}/core/listening.node.ts | 0 .../libp2p/test}/core/peer-id.spec.ts | 0 .../libp2p/test}/core/start.spec.ts | 0 .../libp2p/test}/fetch/fetch.node.ts | 0 .../libp2p/test}/fetch/index.spec.ts | 0 .../libp2p/test}/fixtures/match-peer-id.ts | 0 .../libp2p/test}/fixtures/swarm.key.ts | 0 .../libp2p/test}/identify/index.spec.ts | 0 .../libp2p/test}/identify/push.spec.ts | 0 .../libp2p/test}/identify/service.node.ts | 0 .../libp2p/test}/identify/service.spec.ts | 0 .../libp2p/test}/insecure/compliance.spec.ts | 0 .../libp2p/test}/insecure/plaintext.spec.ts | 0 {test => packages/libp2p/test}/interop.ts | 0 .../libp2p/test}/peer-discovery/index.node.ts | 0 .../libp2p/test}/peer-discovery/index.spec.ts | 0 .../test}/peer-routing/peer-routing.node.ts | 0 .../libp2p/test}/peer-routing/utils.ts | 0 .../libp2p/test}/ping/index.spec.ts | 0 .../libp2p/test}/ping/ping.node.ts | 0 .../libp2p/test}/pnet/index.spec.ts | 0 .../libp2p/test}/registrar/registrar.spec.ts | 0 .../transports/transport-manager.node.ts | 0 .../transports/transport-manager.spec.ts | 0 .../libp2p/test}/upgrading/upgrader.spec.ts | 0 .../libp2p/test}/upnp-nat/upnp-nat.node.ts | 0 .../test}/utils/base-options.browser.ts | 0 .../libp2p/test}/utils/base-options.ts | 0 .../libp2p/test}/utils/creators/peer.ts | 0 .../libp2p/tsconfig.json | 2 +- 153 files changed, 525 insertions(+), 348 deletions(-) create mode 100644 .release-please-manifest.json create mode 100644 .release-please.json delete mode 100644 ISSUE_TEMPLATE.md delete mode 100644 MIGRATION_TEMPLATE.md delete mode 100644 OKR.md rename .aegir.js => packages/libp2p/.aegir.js (100%) rename CHANGELOG.md => packages/libp2p/CHANGELOG.md (100%) rename LICENSE => packages/libp2p/LICENSE (100%) rename LICENSE-APACHE => packages/libp2p/LICENSE-APACHE (100%) rename LICENSE-MIT => packages/libp2p/LICENSE-MIT (100%) create mode 100644 packages/libp2p/README.md rename package-list.json => packages/libp2p/package-list.json (100%) create mode 100644 packages/libp2p/package.json rename {scripts => packages/libp2p/scripts}/update-version.js (100%) rename {src => packages/libp2p/src}/address-manager/README.md (100%) rename {src => packages/libp2p/src}/address-manager/index.ts (100%) rename {src => packages/libp2p/src}/address-manager/utils.ts (100%) rename {src => packages/libp2p/src}/autonat/constants.ts (100%) rename {src => packages/libp2p/src}/autonat/index.ts (100%) rename {src => packages/libp2p/src}/autonat/pb/index.proto (100%) rename {src => packages/libp2p/src}/autonat/pb/index.ts (100%) rename {src => packages/libp2p/src}/circuit-relay/constants.ts (100%) rename {src => packages/libp2p/src}/circuit-relay/index.ts (100%) rename {src => packages/libp2p/src}/circuit-relay/pb/index.proto (100%) rename {src => packages/libp2p/src}/circuit-relay/pb/index.ts (100%) rename {src => packages/libp2p/src}/circuit-relay/server/advert-service.ts (100%) rename {src => packages/libp2p/src}/circuit-relay/server/index.ts (100%) rename {src => packages/libp2p/src}/circuit-relay/server/reservation-store.ts (100%) rename {src => packages/libp2p/src}/circuit-relay/server/reservation-voucher.ts (100%) rename {src => packages/libp2p/src}/circuit-relay/transport/discovery.ts (100%) rename {src => packages/libp2p/src}/circuit-relay/transport/index.ts (100%) rename {src => packages/libp2p/src}/circuit-relay/transport/listener.ts (100%) rename {src => packages/libp2p/src}/circuit-relay/transport/reservation-store.ts (100%) rename {src => packages/libp2p/src}/circuit-relay/utils.ts (100%) rename {src => packages/libp2p/src}/components.ts (100%) rename {src => packages/libp2p/src}/config.ts (100%) rename {src => packages/libp2p/src}/config/connection-gater.browser.ts (100%) rename {src => packages/libp2p/src}/config/connection-gater.ts (100%) rename {src => packages/libp2p/src}/connection-manager/auto-dial.ts (100%) rename {src => packages/libp2p/src}/connection-manager/connection-pruner.ts (100%) rename {src => packages/libp2p/src}/connection-manager/constants.ts (100%) rename {src => packages/libp2p/src}/connection-manager/dial-queue.ts (100%) rename {src => packages/libp2p/src}/connection-manager/index.ts (100%) rename {src => packages/libp2p/src}/connection-manager/utils.ts (100%) rename {src => packages/libp2p/src}/connection/index.ts (100%) rename {src => packages/libp2p/src}/content-routing/index.ts (100%) rename {src => packages/libp2p/src}/content-routing/utils.ts (100%) rename {src => packages/libp2p/src}/errors.ts (100%) rename {src => packages/libp2p/src}/fetch/README.md (100%) rename {src => packages/libp2p/src}/fetch/constants.ts (100%) rename {src => packages/libp2p/src}/fetch/index.ts (100%) rename {src => packages/libp2p/src}/fetch/pb/proto.proto (100%) rename {src => packages/libp2p/src}/fetch/pb/proto.ts (100%) rename {src => packages/libp2p/src}/get-peer.ts (100%) rename {src => packages/libp2p/src}/identify/README.md (100%) rename {src => packages/libp2p/src}/identify/consts.ts (100%) rename {src => packages/libp2p/src}/identify/identify.ts (100%) rename {src => packages/libp2p/src}/identify/index.ts (100%) rename {src => packages/libp2p/src}/identify/pb/message.proto (100%) rename {src => packages/libp2p/src}/identify/pb/message.ts (100%) rename {src => packages/libp2p/src}/index.ts (100%) rename {src => packages/libp2p/src}/insecure/index.ts (100%) rename {src => packages/libp2p/src}/insecure/pb/proto.proto (100%) rename {src => packages/libp2p/src}/insecure/pb/proto.ts (100%) rename {src => packages/libp2p/src}/libp2p.ts (100%) rename {src => packages/libp2p/src}/peer-routing.ts (100%) rename {src => packages/libp2p/src}/ping/README.md (100%) rename {src => packages/libp2p/src}/ping/constants.ts (100%) rename {src => packages/libp2p/src}/ping/index.ts (100%) rename {src => packages/libp2p/src}/pnet/README.md (100%) rename {src => packages/libp2p/src}/pnet/crypto.ts (100%) rename {src => packages/libp2p/src}/pnet/errors.ts (100%) rename {src => packages/libp2p/src}/pnet/index.ts (100%) rename {src => packages/libp2p/src}/pnet/key-generator.ts (100%) rename {src => packages/libp2p/src}/pubsub/dummy-pubsub.ts (100%) rename {src => packages/libp2p/src}/registrar.ts (100%) rename {src => packages/libp2p/src}/transport-manager.ts (100%) rename {src => packages/libp2p/src}/upgrader.ts (100%) rename {src => packages/libp2p/src}/upnp-nat/index.ts (100%) rename {src => packages/libp2p/src}/version.ts (100%) rename {test => packages/libp2p/test}/addresses/address-manager.spec.ts (100%) rename {test => packages/libp2p/test}/addresses/addresses.node.ts (100%) rename {test => packages/libp2p/test}/addresses/utils.ts (100%) rename {test => packages/libp2p/test}/autonat/index.spec.ts (100%) rename {test => packages/libp2p/test}/circuit-relay/discovery.node.ts (100%) rename {test => packages/libp2p/test}/circuit-relay/hop.spec.ts (100%) rename {test => packages/libp2p/test}/circuit-relay/relay.node.ts (100%) rename {test => packages/libp2p/test}/circuit-relay/relay.spec.ts (100%) rename {test => packages/libp2p/test}/circuit-relay/reservation-store.spec.ts (100%) rename {test => packages/libp2p/test}/circuit-relay/stop.spec.ts (100%) rename {test => packages/libp2p/test}/circuit-relay/utils.spec.ts (100%) rename {test => packages/libp2p/test}/circuit-relay/utils.ts (100%) rename {test => packages/libp2p/test}/configuration/protocol-prefix.node.ts (100%) rename {test => packages/libp2p/test}/configuration/pubsub.spec.ts (100%) rename {test => packages/libp2p/test}/configuration/utils.ts (100%) rename {test => packages/libp2p/test}/connection-manager/auto-dial.spec.ts (100%) rename {test => packages/libp2p/test}/connection-manager/dial-queue.spec.ts (100%) rename {test => packages/libp2p/test}/connection-manager/direct.node.ts (100%) rename {test => packages/libp2p/test}/connection-manager/direct.spec.ts (100%) rename {test => packages/libp2p/test}/connection-manager/index.node.ts (100%) rename {test => packages/libp2p/test}/connection-manager/index.spec.ts (100%) rename {test => packages/libp2p/test}/connection-manager/resolver.spec.ts (100%) rename {test => packages/libp2p/test}/connection/compliance.spec.ts (100%) rename {test => packages/libp2p/test}/connection/fixtures/pair.ts (100%) rename {test => packages/libp2p/test}/connection/index.spec.ts (100%) rename {test => packages/libp2p/test}/content-routing/content-routing.node.ts (100%) rename {test => packages/libp2p/test}/content-routing/dht/operation.node.ts (100%) rename {test => packages/libp2p/test}/content-routing/dht/utils.ts (100%) rename {test => packages/libp2p/test}/content-routing/utils.ts (100%) rename {test => packages/libp2p/test}/core/consume-peer-record.spec.ts (100%) rename {test => packages/libp2p/test}/core/encryption.spec.ts (100%) rename {test => packages/libp2p/test}/core/events.spec.ts (100%) rename {test => packages/libp2p/test}/core/get-public-key.spec.ts (100%) rename {test => packages/libp2p/test}/core/listening.node.ts (100%) rename {test => packages/libp2p/test}/core/peer-id.spec.ts (100%) rename {test => packages/libp2p/test}/core/start.spec.ts (100%) rename {test => packages/libp2p/test}/fetch/fetch.node.ts (100%) rename {test => packages/libp2p/test}/fetch/index.spec.ts (100%) rename {test => packages/libp2p/test}/fixtures/match-peer-id.ts (100%) rename {test => packages/libp2p/test}/fixtures/swarm.key.ts (100%) rename {test => packages/libp2p/test}/identify/index.spec.ts (100%) rename {test => packages/libp2p/test}/identify/push.spec.ts (100%) rename {test => packages/libp2p/test}/identify/service.node.ts (100%) rename {test => packages/libp2p/test}/identify/service.spec.ts (100%) rename {test => packages/libp2p/test}/insecure/compliance.spec.ts (100%) rename {test => packages/libp2p/test}/insecure/plaintext.spec.ts (100%) rename {test => packages/libp2p/test}/interop.ts (100%) rename {test => packages/libp2p/test}/peer-discovery/index.node.ts (100%) rename {test => packages/libp2p/test}/peer-discovery/index.spec.ts (100%) rename {test => packages/libp2p/test}/peer-routing/peer-routing.node.ts (100%) rename {test => packages/libp2p/test}/peer-routing/utils.ts (100%) rename {test => packages/libp2p/test}/ping/index.spec.ts (100%) rename {test => packages/libp2p/test}/ping/ping.node.ts (100%) rename {test => packages/libp2p/test}/pnet/index.spec.ts (100%) rename {test => packages/libp2p/test}/registrar/registrar.spec.ts (100%) rename {test => packages/libp2p/test}/transports/transport-manager.node.ts (100%) rename {test => packages/libp2p/test}/transports/transport-manager.spec.ts (100%) rename {test => packages/libp2p/test}/upgrading/upgrader.spec.ts (100%) rename {test => packages/libp2p/test}/upnp-nat/upnp-nat.node.ts (100%) rename {test => packages/libp2p/test}/utils/base-options.browser.ts (100%) rename {test => packages/libp2p/test}/utils/base-options.ts (100%) rename {test => packages/libp2p/test}/utils/creators/peer.ts (100%) rename tsconfig.json => packages/libp2p/tsconfig.json (96%) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 16b2e0cd3c..c18845b81e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -159,18 +159,34 @@ jobs: release: runs-on: ubuntu-latest - needs: [test-node, test-chrome, test-chrome-webworker, test-firefox, test-firefox-webworker, test-electron-main, test-electron-renderer, test-interop] + needs: [ + test-node, + test-chrome, + test-chrome-webworker, + test-firefox, + test-firefox-webworker, + test-electron-main, + test-electron-renderer, + test-interop + ] if: github.event_name == 'push' && github.ref == 'refs/heads/master' steps: - uses: GoogleCloudPlatform/release-please-action@v2 id: release with: token: ${{ secrets.GITHUB_TOKEN }} + command: manifest release-type: node - # breaking changes should rev the minor (remove after v1) - bump-minor-pre-major: true - # features should rev the patch (remove after v1) - bump-patch-for-minor-pre-major: true + manifest-file: .release-please-manifest.json + config-file: .release-please.json + changelog-types: | + [ + { "type": "feat", "section": "Features", "hidden": false }, + { "type": "fix", "section": "Bug Fixes", "hidden": false }, + { "type": "chore", "section": "Trivial Changes", "hidden": false }, + { "type": "docs", "section": "Documentation", "hidden": false }, + { "type": "deps", "section": "Dependencies", "hidden": false } + ] - uses: actions/checkout@v3 with: fetch-depth: 0 @@ -179,23 +195,21 @@ jobs: node-version: lts/* registry-url: 'https://registry.npmjs.org' - uses: ipfs/aegir/actions/cache-node-modules@master - - if: ${{ steps.release.outputs.release_created }} - name: Generate typedoc URLs - run: npm --if-present run docs -- --publish false - - if: ${{ steps.release.outputs.release_created }} + - uses: ipfs/aegir/actions/docker-login@master + with: + docker-token: ${{ secrets.DOCKER_TOKEN }} + docker-username: ${{ secrets.DOCKER_USERNAME }} + - if: ${{ steps.release.outputs.releases_created }} name: Run release version - run: npm publish + run: | + git update-index --assume-unchanged packages/libp2p/src/version.ts + npm run --if-present release env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - - if: ${{ steps.release.outputs.release_created }} - name: Publish docs - run: npm run --if-present docs - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - if: ${{ !steps.release.outputs.release_created }} + - if: ${{ !steps.release.outputs.releases_created }} name: Run release rc run: | - npm version `node -p -e "require('./package.json').version"`-`git rev-parse --short HEAD` --no-git-tag-version - npm publish --tag next + git update-index --assume-unchanged packages/libp2p/src/version.ts + npm run --if-present release:rc env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.release-please-manifest.json b/.release-please-manifest.json new file mode 100644 index 0000000000..3f9472347f --- /dev/null +++ b/.release-please-manifest.json @@ -0,0 +1,3 @@ +{ + "packages/libp2p":"0.45.5" +} \ No newline at end of file diff --git a/.release-please.json b/.release-please.json new file mode 100644 index 0000000000..7e7bfcbad7 --- /dev/null +++ b/.release-please.json @@ -0,0 +1,9 @@ +{ + "plugins": ["node-workspace"], + "bump-minor-pre-major": true, + "bump-patch-for-minor-pre-major": true, + "group-pull-request-title-pattern": "chore: release ${component}", + "packages": { + "packages/libp2p": {} + } +} diff --git a/ISSUE_TEMPLATE.md b/ISSUE_TEMPLATE.md deleted file mode 100644 index 8c1c8dd843..0000000000 --- a/ISSUE_TEMPLATE.md +++ /dev/null @@ -1,43 +0,0 @@ - - -- **Version**: -- **Platform**: -- **Subsystem**: - - -#### Type: - - -#### Severity: - -#### Description: - -#### Steps to reproduce the error: - - diff --git a/MIGRATION_TEMPLATE.md b/MIGRATION_TEMPLATE.md deleted file mode 100644 index 34425aaadb..0000000000 --- a/MIGRATION_TEMPLATE.md +++ /dev/null @@ -1,45 +0,0 @@ - -# Migrating to libp2p@__ - -A migration guide for refactoring your application code from libp2p v__ to v__. - -## Table of Contents - -- [API](#api) -- [Module Updates](#module-updates) - -## API - - - -## Module Updates - -With this release you should update the following libp2p modules if you are relying on them: - - - -```json - -``` diff --git a/OKR.md b/OKR.md deleted file mode 100644 index 7b2356b641..0000000000 --- a/OKR.md +++ /dev/null @@ -1,19 +0,0 @@ -# Quarterly Objectives and Key Results - -We try to frame our ongoing work using a process based on quarterly Objectives and Key Results (OKRs). Objectives reflect outcomes that are challenging, but realistic. Results are tangible and measurable. - -## 2019 Q1 - -Find the js-libp2p OKRs for 2019 Q1 at the [2019 Q1 libp2p OKRs Spreadsheet](https://docs.google.com/spreadsheets/d/11GKG1DBRIIAiQnHvLD7_IqWxDGsVdaZFpxJM6NWtXe8/edit#gid=1271182838) - -## 2018 Q4 - -Find the js-libp2p OKRs for 2018 Q4 at the [2018 Q4 libp2p OKRs Spreadsheet](https://docs.google.com/spreadsheets/d/1BYwmbVicgo6_tOHAbgiUXWge8Ej0qR1M_gAUulazmrg/edit#gid=1241853194) - -## 2018 Q3 - -Find the js-libp2p OKRs for 2018 Q3 at the [2018 Q3 libp2p OKRs Spreadsheet](https://docs.google.com/spreadsheets/d/1HTXfgR5FyPTFhsTkFPRThkeMvHvCgJOaAs7BSl_vQ_0/edit#gid=1241853194) - -## Previous Quarters - -For the quarters before 2018 Q3, js-libp2p shared their KRs with the [IPFS OKRs](https://github.com/ipfs/js-ipfs/blob/master/OKR.md). diff --git a/examples/auto-relay/dialer.js b/examples/auto-relay/dialer.js index 207aa7e7d1..5cfabfe83c 100644 --- a/examples/auto-relay/dialer.js +++ b/examples/auto-relay/dialer.js @@ -3,7 +3,7 @@ import { webSockets } from '@libp2p/websockets' import { noise } from '@chainsafe/libp2p-noise' import { mplex } from '@libp2p/mplex' import { multiaddr } from '@multiformats/multiaddr' -import { yamux } from '@chainsafe/libp2p-yamux/dist/src' +import { yamux } from '@chainsafe/libp2p-yamux' import { circuitRelayTransport } from 'libp2p/circuit-relay' import { identifyService } from 'libp2p/identify' diff --git a/examples/auto-relay/listener.js b/examples/auto-relay/listener.js index 864a5e8f73..22b20a4cb8 100644 --- a/examples/auto-relay/listener.js +++ b/examples/auto-relay/listener.js @@ -3,7 +3,7 @@ import { webSockets } from '@libp2p/websockets' import { noise } from '@chainsafe/libp2p-noise' import { mplex } from '@libp2p/mplex' import { multiaddr } from '@multiformats/multiaddr' -import { yamux } from '@chainsafe/libp2p-yamux/dist/src' +import { yamux } from '@chainsafe/libp2p-yamux' import { circuitRelayTransport } from 'libp2p/circuit-relay' import { identifyService } from 'libp2p/identify' diff --git a/examples/connection-encryption/1.js b/examples/connection-encryption/1.js index fab21cb575..4c1a777fc4 100644 --- a/examples/connection-encryption/1.js +++ b/examples/connection-encryption/1.js @@ -1,4 +1,4 @@ -import { createLibp2p } from '../../dist/src/index.js' +import { createLibp2p } from '../../packages/libp2p/dist/src/index.js' import { tcp } from '@libp2p/tcp' import { mplex } from '@libp2p/mplex' import { yamux } from '@chainsafe/libp2p-yamux' diff --git a/examples/delegated-routing/package.json b/examples/delegated-routing/package.json index 78fa2d0ea0..af15656731 100644 --- a/examples/delegated-routing/package.json +++ b/examples/delegated-routing/package.json @@ -6,7 +6,7 @@ "@chainsafe/libp2p-noise": "^12.0.0", "ipfs-core": "^0.15.4", "ipfs-http-client": "^58.0.1", - "libp2p": "file:../../", + "libp2p": "file:../../packages/libp2p", "@libp2p/delegated-content-routing": "^4.0.0", "@libp2p/delegated-peer-routing": "^4.0.0", "@libp2p/kad-dht": "^9.2.0", diff --git a/examples/libp2p-in-the-browser/package.json b/examples/libp2p-in-the-browser/package.json index 0a108a8ad0..b00b0dfd22 100644 --- a/examples/libp2p-in-the-browser/package.json +++ b/examples/libp2p-in-the-browser/package.json @@ -18,7 +18,7 @@ "@libp2p/webrtc": "^1.2.0", "@libp2p/websockets": "^6.0.1", "@libp2p/webtransport": "^2.0.1", - "libp2p": "file:../../" + "libp2p": "file:../../packages/libp2p" }, "devDependencies": { "vite": "^2.8.6" diff --git a/examples/package.json b/examples/package.json index 2c7d9dec0b..d297e6b98b 100644 --- a/examples/package.json +++ b/examples/package.json @@ -15,7 +15,7 @@ "execa": "^6.1.0", "fs-extra": "^10.1.0", "it-to-buffer": "^3.0.1", - "libp2p": "file:../", + "libp2p": "file:../packages/libp2p", "p-defer": "^4.0.0", "uint8arrays": "^4.0.0", "which": "^2.0.1" diff --git a/interop/Dockerfile b/interop/Dockerfile index b97c8fd7ce..89b7f645a0 100644 --- a/interop/Dockerfile +++ b/interop/Dockerfile @@ -1,17 +1,13 @@ FROM node:18 + WORKDIR /app COPY package.json . COPY ./node_modules ./node_modules +COPY ./packages/libp2p ./packages/libp2p WORKDIR /app/interop COPY ./interop/node_modules ./node_modules - -WORKDIR /app -COPY ./dist ./dist - -WORKDIR /app/interop COPY ./interop/dist ./dist - COPY ./interop/package.json . COPY ./interop/.aegir.js . diff --git a/interop/package.json b/interop/package.json index 80c4e01475..31b7ea47f7 100644 --- a/interop/package.json +++ b/interop/package.json @@ -25,7 +25,7 @@ "@libp2p/webtransport": "^2.0.1", "@multiformats/mafmt": "^12.1.2", "@multiformats/multiaddr": "^12.1.3", - "libp2p": "../", + "libp2p": "../packages/libp2p", "redis": "4.5.1" }, "browser": { diff --git a/package.json b/package.json index 7049e570db..6588c4f66f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { - "name": "libp2p", - "version": "0.45.5", + "name": "js-libp2p-monorepo", + "version": "1.0.0", "description": "JavaScript implementation of libp2p, a modular peer to peer network stack", "license": "Apache-2.0 OR MIT", "homepage": "https://github.com/libp2p/js-libp2p#readme", @@ -11,218 +11,39 @@ "bugs": { "url": "https://github.com/libp2p/js-libp2p/issues" }, - "keywords": [ - "IPFS", - "libp2p", - "network", - "p2p", - "peer", - "peer-to-peer" - ], - "engines": { - "node": ">=16.0.0", - "npm": ">=7.0.0" - }, - "type": "module", - "types": "./dist/src/index.d.ts", - "typesVersions": { - "*": { - "*": [ - "*", - "dist/*", - "dist/src/*", - "dist/src/*/index" - ], - "src/*": [ - "*", - "dist/*", - "dist/src/*", - "dist/src/*/index" - ] - } + "private": true, + "scripts": { + "reset": "aegir run clean && aegir clean packages/*/node_modules node_modules package-lock.json packages/*/package-lock.json", + "test": "aegir run test", + "test:node": "aegir run test:node", + "test:chrome": "aegir run test:chrome", + "test:chrome-webworker": "aegir run test:chrome-webworker", + "test:firefox": "aegir run test:firefox", + "test:firefox-webworker": "aegir run test:firefox-webworker", + "test:electron-main": "aegir run test:electron-main", + "test:external": "aegir run test:external", + "test:cli": "aegir run test:cli", + "test:interop": "aegir run test:interop", + "test:examples": "cd examples && npm run test:all", + "coverage": "aegir run coverage", + "build": "aegir run build", + "clean": "aegir run clean", + "lint": "aegir run lint", + "dep-check": "aegir run dep-check", + "release": "run-s build npm:release docker:release", + "npm:release": "aegir exec npm -- publish", + "release:rc": "aegir release-rc" }, - "files": [ - "src", - "dist", - "!dist/test", - "!**/*.tsbuildinfo" - ], - "exports": { - ".": { - "types": "./dist/src/index.d.ts", - "import": "./dist/src/index.js" - }, - "./autonat": { - "types": "./dist/src/autonat/index.d.ts", - "import": "./dist/src/autonat/index.js" - }, - "./circuit-relay": { - "types": "./dist/src/circuit-relay/index.d.ts", - "import": "./dist/src/circuit-relay/index.js" - }, - "./fetch": { - "types": "./dist/src/fetch/index.d.ts", - "import": "./dist/src/fetch/index.js" - }, - "./identify": { - "types": "./dist/src/identify/index.d.ts", - "import": "./dist/src/identify/index.js" - }, - "./insecure": { - "types": "./dist/src/insecure/index.d.ts", - "import": "./dist/src/insecure/index.js" - }, - "./upnp-nat": { - "types": "./dist/src/upnp-nat/index.d.ts", - "import": "./dist/src/upnp-nat/index.js" - }, - "./ping": { - "types": "./dist/src/ping/index.d.ts", - "import": "./dist/src/ping/index.js" - }, - "./pnet": { - "types": "./dist/src/pnet/index.d.ts", - "import": "./dist/src/pnet/index.js" - } + "devDependencies": { + "aegir": "^39.0.5" }, "eslintConfig": { "extends": "ipfs", - "parserOptions": { - "sourceType": "module" - }, "ignorePatterns": [ - "!.aegir.js", - "test/ts-use", - "*.d.ts" + "!.aegir.js" ] }, - "scripts": { - "clean": "aegir clean", - "lint": "aegir lint", - "dep-check": "aegir dep-check -i protons", - "prepublishOnly": "node scripts/update-version.js && npm run build", - "build": "aegir build", - "docs": "aegir docs", - "generate": "run-s generate:proto:*", - "generate:proto:autonat": "protons ./src/autonat/pb/index.proto", - "generate:proto:circuit": "protons ./src/circuit/pb/index.proto", - "generate:proto:fetch": "protons ./src/fetch/pb/proto.proto", - "generate:proto:identify": "protons ./src/identify/pb/message.proto", - "generate:proto:plaintext": "protons ./src/insecure/pb/proto.proto", - "test": "aegir test", - "test:node": "aegir test -t node -f \"./dist/test/**/*.{node,spec}.js\" --cov", - "test:chrome": "aegir test -t browser -f \"./dist/test/**/*.spec.js\" --cov", - "test:chrome-webworker": "aegir test -t webworker -f \"./dist/test/**/*.spec.js\"", - "test:firefox": "aegir test -t browser -f \"./dist/test/**/*.spec.js\" -- --browser firefox", - "test:firefox-webworker": "aegir test -t webworker -f \"./dist/test/**/*.spec.js\" -- --browser firefox", - "test:webkit": "aegir test -t browser -f \"./dist/test/**/*.spec.js\" -- --browser webkit", - "test:examples": "cd examples && npm run test:all", - "test:interop": "aegir test -t node -f dist/test/interop.js" - }, - "dependencies": { - "@achingbrain/nat-port-mapper": "^1.0.3", - "@libp2p/crypto": "^1.0.17", - "@libp2p/interface-address-manager": "^3.0.0", - "@libp2p/interface-connection": "^5.0.0", - "@libp2p/interface-connection-encrypter": "^4.0.0", - "@libp2p/interface-connection-gater": "^3.0.0", - "@libp2p/interface-connection-manager": "^3.0.0", - "@libp2p/interface-content-routing": "^2.1.0", - "@libp2p/interface-keychain": "^2.0.4", - "@libp2p/interface-libp2p": "^3.2.0", - "@libp2p/interface-metrics": "^4.0.0", - "@libp2p/interface-peer-discovery": "^2.0.0", - "@libp2p/interface-peer-id": "^2.0.1", - "@libp2p/interface-peer-info": "^1.0.3", - "@libp2p/interface-peer-routing": "^1.1.0", - "@libp2p/interface-peer-store": "^2.0.3", - "@libp2p/interface-pubsub": "^4.0.0", - "@libp2p/interface-record": "^2.0.6", - "@libp2p/interface-registrar": "^2.0.3", - "@libp2p/interface-stream-muxer": "^4.0.0", - "@libp2p/interface-transport": "^4.0.0", - "@libp2p/interfaces": "^3.2.0", - "@libp2p/keychain": "^2.0.0", - "@libp2p/logger": "^2.1.1", - "@libp2p/multistream-select": "^3.1.8", - "@libp2p/peer-collections": "^3.0.0", - "@libp2p/peer-id": "^2.0.0", - "@libp2p/peer-id-factory": "^2.0.0", - "@libp2p/peer-record": "^5.0.0", - "@libp2p/peer-store": "^8.1.0", - "@libp2p/topology": "^4.0.1", - "@libp2p/tracked-map": "^3.0.0", - "@libp2p/utils": "^3.0.10", - "@multiformats/mafmt": "^12.0.0", - "@multiformats/multiaddr": "^12.0.0", - "abortable-iterator": "^5.0.1", - "any-signal": "^4.1.1", - "datastore-core": "^9.0.0", - "interface-datastore": "^8.0.0", - "it-all": "^3.0.1", - "it-drain": "^3.0.1", - "it-filter": "^3.0.1", - "it-first": "^3.0.1", - "it-handshake": "^4.1.3", - "it-length-prefixed": "^9.0.1", - "it-map": "^3.0.2", - "it-merge": "^3.0.0", - "it-pair": "^2.0.2", - "it-parallel": "^3.0.0", - "it-pb-stream": "^4.0.1", - "it-pipe": "^3.0.1", - "it-stream-types": "^2.0.1", - "merge-options": "^3.0.4", - "multiformats": "^11.0.0", - "p-defer": "^4.0.0", - "p-queue": "^7.3.4", - "p-retry": "^5.0.0", - "private-ip": "^3.0.0", - "protons-runtime": "^5.0.0", - "rate-limiter-flexible": "^2.3.11", - "uint8arraylist": "^2.3.2", - "uint8arrays": "^4.0.2", - "wherearewe": "^2.0.0", - "xsalsa20": "^1.1.0" - }, - "devDependencies": { - "@chainsafe/libp2p-gossipsub": "^8.0.0", - "@chainsafe/libp2p-noise": "^12.0.0", - "@chainsafe/libp2p-yamux": "^4.0.1", - "@libp2p/bootstrap": "^8.0.0", - "@libp2p/daemon-client": "^6.0.2", - "@libp2p/daemon-server": "^5.0.2", - "@libp2p/floodsub": "^7.0.1", - "@libp2p/interface-compliance-tests": "^3.0.6", - "@libp2p/interface-connection-compliance-tests": "^2.0.8", - "@libp2p/interface-connection-encrypter-compliance-tests": "^5.0.0", - "@libp2p/interface-mocks": "^12.0.0", - "@libp2p/interop": "^8.0.0", - "@libp2p/kad-dht": "^9.2.0", - "@libp2p/mdns": "^8.0.0", - "@libp2p/mplex": "^8.0.1", - "@libp2p/pubsub": "^7.0.1", - "@libp2p/tcp": "^7.0.1", - "@libp2p/websockets": "^6.0.1", - "@types/varint": "^6.0.0", - "@types/xsalsa20": "^1.1.0", - "aegir": "^39.0.5", - "cborg": "^1.8.1", - "delay": "^6.0.0", - "execa": "^7.0.0", - "go-libp2p": "^1.0.1", - "it-pushable": "^3.0.0", - "it-to-buffer": "^4.0.1", - "npm-run-all": "^4.1.5", - "p-event": "^5.0.1", - "p-times": "^4.0.0", - "p-wait-for": "^5.0.0", - "protons": "^7.0.2", - "sinon": "^15.0.1", - "sinon-ts": "^1.0.0" - }, - "browser": { - "./dist/src/config/connection-gater.js": "./dist/src/config/connection-gater.browser.js", - "nat-api": false - } + "workspaces": [ + "packages/*" + ] } diff --git a/.aegir.js b/packages/libp2p/.aegir.js similarity index 100% rename from .aegir.js rename to packages/libp2p/.aegir.js diff --git a/CHANGELOG.md b/packages/libp2p/CHANGELOG.md similarity index 100% rename from CHANGELOG.md rename to packages/libp2p/CHANGELOG.md diff --git a/LICENSE b/packages/libp2p/LICENSE similarity index 100% rename from LICENSE rename to packages/libp2p/LICENSE diff --git a/LICENSE-APACHE b/packages/libp2p/LICENSE-APACHE similarity index 100% rename from LICENSE-APACHE rename to packages/libp2p/LICENSE-APACHE diff --git a/LICENSE-MIT b/packages/libp2p/LICENSE-MIT similarity index 100% rename from LICENSE-MIT rename to packages/libp2p/LICENSE-MIT diff --git a/packages/libp2p/README.md b/packages/libp2p/README.md new file mode 100644 index 0000000000..8760b4a07a --- /dev/null +++ b/packages/libp2p/README.md @@ -0,0 +1,212 @@ +

+ libp2p hex logo +

+ +

The JavaScript implementation of the libp2p Networking Stack.

+ +

+ + + + + + + + +

+ +

+ + +
+ + + + +
+

+ +### Project status + +We've come a long way, but this project is still in Alpha, lots of development is happening, API might change, beware of the Dragons 🐉.. + +The documentation in the master branch may contain changes from a pre-release. +If you are looking for the documentation of the latest release, you can view the latest release on [**npm**](https://www.npmjs.com/package/libp2p), or select the tag in github that matches the version you are looking for. + +**Want to get started?** Check our [GETTING_STARTED.md](./doc/GETTING_STARTED.md) guide and [examples folder](/examples). + +**Want to update libp2p in your project?** Check our [migrations folder](./doc/migrations). + +## Table of Contents + +- [Background](#background) +- [Roadmap](#roadmap) +- [Install](#install) +- [Usage](#usage) + - [Configuration](#configuration) + - [Limits](#limits) + - [API Docs](#api-docs) + - [Getting started](#getting-started) + - [Tutorials and Examples](#tutorials-and-examples) +- [Development](#development) + - [Tests](#tests) + - [Run unit tests](#run-unit-tests) + - [Packages](#packages) +- [Used by](#used-by) +- [Contribute](#contribute) +- [License](#license) + - [Contribution](#contribution) + +## Background + +libp2p is the product of a long and arduous quest to understand the evolution of the Internet networking stack. In order to build P2P applications, devs have long had to make custom ad-hoc solutions to fit their needs, sometimes making some hard assumptions about their runtimes and the state of the network at the time of their development. Today, looking back more than 20 years, we see a clear pattern in the types of mechanisms built around the Internet Protocol, IP, which can be found throughout many layers of the OSI layer system, libp2p distils these mechanisms into flat categories and defines clear interfaces that once exposed, enable other protocols and applications to use and swap them, enabling upgradability and adaptability for the runtime, without breaking the API. + +We are in the process of writing better documentation, blog posts, tutorials and a formal specification. Today you can find: + +- [libp2p.io](https://libp2p.io) +- [docs.libp2p.io](https://docs.libp2p.io) +- [Specification (WIP)](https://github.com/libp2p/specs) +- [Discussion Forums](https://discuss.libp2p.io) +- Talks + - [`libp2p <3 ethereum` at DEVCON2](https://archive.devcon.org/archive/watch/2/libp2p-devp2p-ipfs-and-ethereum-networking/) +- Articles + - [The overview of libp2p](https://github.com/libp2p/libp2p#description) + +To sum up, libp2p is a "network stack" -- a protocol suite -- that cleanly separates concerns, and enables sophisticated applications to only use the protocols they absolutely need, without giving up interoperability and upgradeability. libp2p grew out of IPFS, but it is built so that lots of people can use it, for lots of different projects. + +## Roadmap + +The js-libp2p roadmap can be found here: https://github.com/libp2p/js-libp2p/blob/master/ROADMAP.md + +It represents current projects the js-libp2p maintainers are focused on and provides an estimation of completion targets. + +It is complementary to the overarching libp2p project roadmap: https://github.com/libp2p/specs/blob/master/ROADMAP.md + +## Install + +```sh +npm install libp2p +``` + +## Usage + +### Configuration + +For all the information on how you can configure libp2p see [CONFIGURATION.md](./doc/CONFIGURATION.md). + +### Limits + +For help configuring your node to resist malicious network peers, see [LIMITS.md](./doc/LIMITS.md) + +### API Docs + +- + +### Getting started + +If you are starting your journey with `js-libp2p`, read the [GETTING_STARTED.md](./doc/GETTING_STARTED.md) guide. + +### Tutorials and Examples + +You can find multiple examples on the [examples folder](./examples) that will guide you through using libp2p for several scenarios. + +## Development + +**Clone and install dependencies:** + +```sh +> git clone https://github.com/libp2p/js-libp2p.git +> cd js-libp2p +> npm install +> npm run build +``` + +### Tests + +#### Run unit tests + +```sh +# run all the unit tsts +> npm test + +# run just Node.js tests +> npm run test:node + +# run just Browser tests (Chrome) +> npm run test:chrome +``` + +### Packages + +List of packages currently in existence for libp2p + +> This table is generated using the module `package-table` with `package-table --data=package-list.json`. + +| Package | Version | Deps | CI | Coverage | +| ---------|---------|---------|---------|--------- | +| **libp2p** | +| [`libp2p`](//github.com/libp2p/js-libp2p) | [![npm](https://img.shields.io/npm/v/libp2p.svg?maxAge=86400&style=flat-square)](//github.com/libp2p/js-libp2p/releases) | [![Deps](https://img.shields.io/librariesio/release/npm/libp2p?logo=Libraries.io&logoColor=white&style=flat-square)](//libraries.io/npm/libp2p) | [![GitHub CI](https://img.shields.io/github/actions/workflow/status/libp2p/js-libp2p/main.yml?branch=master&label=ci&style=flat-square)](//github.com/libp2p/js-libp2p/actions?query=branch%3Amaster+workflow%3Aci+) | [![codecov](https://codecov.io/gh/libp2p/js-libp2p/branch/master/graph/badge.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p) | +| [`@libp2p/interface-libp2p`](//github.com/libp2p/js-libp2p-interfaces) | [![npm](https://img.shields.io/npm/v/%40libp2p%2Finterface-libp2p.svg?maxAge=86400&style=flat-square)](//github.com/libp2p/js-libp2p-interfaces/releases) | [![Deps](https://img.shields.io/librariesio/release/npm/%40libp2p%2Finterface-libp2p?logo=Libraries.io&logoColor=white&style=flat-square)](//libraries.io/npm/%40libp2p%2Finterface-libp2p) | [![GitHub CI](https://img.shields.io/github/actions/workflow/status/libp2p/js-libp2p-interfaces/js-test-and-release.yml?branch=master&label=ci&style=flat-square)](//github.com/libp2p/js-libp2p-interfaces/actions?query=branch%3Amaster+workflow%3Aci+) | [![codecov](https://codecov.io/gh/libp2p/js-libp2p-interfaces/branch/master/graph/badge.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p-interfaces) | +| **transports** | +| [`@libp2p/tcp`](//github.com/libp2p/js-libp2p-tcp) | [![npm](https://img.shields.io/npm/v/%40libp2p%2Ftcp.svg?maxAge=86400&style=flat-square)](//github.com/libp2p/js-libp2p-tcp/releases) | [![Deps](https://img.shields.io/librariesio/release/npm/%40libp2p%2Ftcp?logo=Libraries.io&logoColor=white&style=flat-square)](//libraries.io/npm/%40libp2p%2Ftcp) | [![GitHub CI](https://img.shields.io/github/actions/workflow/status/libp2p/js-libp2p-tcp/js-test-and-release.yml?branch=master&label=ci&style=flat-square)](//github.com/libp2p/js-libp2p-tcp/actions?query=branch%3Amaster+workflow%3Aci+) | [![codecov](https://codecov.io/gh/libp2p/js-libp2p-tcp/branch/master/graph/badge.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p-tcp) | +| [`@libp2p/webrtc`](//github.com/libp2p/js-libp2p-webrtc) | [![npm](https://img.shields.io/npm/v/%40libp2p%2Fwebrtc.svg?maxAge=86400&style=flat-square)](//github.com/libp2p/js-libp2p-webrtc/releases) | [![Deps](https://img.shields.io/librariesio/release/npm/%40libp2p%2Fwebrtc?logo=Libraries.io&logoColor=white&style=flat-square)](//libraries.io/npm/%40libp2p%2Fwebrtc) | [![GitHub CI](https://img.shields.io/github/actions/workflow/status/libp2p/js-libp2p-webrtc/js-test-and-release.yml?branch=main&label=ci&style=flat-square)](//github.com/libp2p/js-libp2p-webrtc/actions?query=branch%3Amain+workflow%3Aci+) | [![codecov](https://codecov.io/gh/libp2p/js-libp2p-webrtc/branch/master/graph/badge.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p-webrtc) | +| [`@libp2p/websockets`](//github.com/libp2p/js-libp2p-websockets) | [![npm](https://img.shields.io/npm/v/%40libp2p%2Fwebsockets.svg?maxAge=86400&style=flat-square)](//github.com/libp2p/js-libp2p-websockets/releases) | [![Deps](https://img.shields.io/librariesio/release/npm/%40libp2p%2Fwebsockets?logo=Libraries.io&logoColor=white&style=flat-square)](//libraries.io/npm/%40libp2p%2Fwebsockets) | [![GitHub CI](https://img.shields.io/github/actions/workflow/status/libp2p/js-libp2p-websockets/js-test-and-release.yml?branch=master&label=ci&style=flat-square)](//github.com/libp2p/js-libp2p-websockets/actions?query=branch%3Amaster+workflow%3Aci+) | [![codecov](https://codecov.io/gh/libp2p/js-libp2p-websockets/branch/master/graph/badge.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p-websockets) | +| [`@libp2p/webtransport`](//github.com/libp2p/js-libp2p-webtransport) | [![npm](https://img.shields.io/npm/v/%40libp2p%2Fwebtransport.svg?maxAge=86400&style=flat-square)](//github.com/libp2p/js-libp2p-webtransport/releases) | [![Deps](https://img.shields.io/librariesio/release/npm/%40libp2p%2Fwebtransport?logo=Libraries.io&logoColor=white&style=flat-square)](//libraries.io/npm/%40libp2p%2Fwebtransport) | [![GitHub CI](https://img.shields.io/github/actions/workflow/status/libp2p/js-libp2p-webtransport/js-test-and-release.yml?branch=main&label=ci&style=flat-square)](//github.com/libp2p/js-libp2p-webtransport/actions?query=branch%3Amain+workflow%3Aci+) | [![codecov](https://codecov.io/gh/libp2p/js-libp2p-webtransport/branch/master/graph/badge.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p-webtransport) | +| **secure channels** | +| [`@chainsafe/libp2p-noise`](//github.com/ChainSafe/js-libp2p-noise) | [![npm](https://img.shields.io/npm/v/%40chainsafe%2Flibp2p-noise.svg?maxAge=86400&style=flat-square)](//github.com/ChainSafe/js-libp2p-noise/releases) | [![Deps](https://img.shields.io/librariesio/release/npm/%40chainsafe%2Flibp2p-noise?logo=Libraries.io&logoColor=white&style=flat-square)](//libraries.io/npm/%40chainsafe%2Flibp2p-noise) | [![GitHub CI](https://img.shields.io/github/actions/workflow/status/ChainSafe/js-libp2p-noise/js-test-and-release.yml?branch=master&label=ci&style=flat-square)](//github.com/ChainSafe/js-libp2p-noise/actions?query=branch%3Amaster+workflow%3Aci+) | [![codecov](https://codecov.io/gh/ChainSafe/js-libp2p-noise/branch/master/graph/badge.svg?style=flat-square)](https://codecov.io/gh/ChainSafe/js-libp2p-noise) | +| **stream multiplexers** | +| [`@libp2p/mplex`](//github.com/libp2p/js-libp2p-mplex) | [![npm](https://img.shields.io/npm/v/%40libp2p%2Fmplex.svg?maxAge=86400&style=flat-square)](//github.com/libp2p/js-libp2p-mplex/releases) | [![Deps](https://img.shields.io/librariesio/release/npm/%40libp2p%2Fmplex?logo=Libraries.io&logoColor=white&style=flat-square)](//libraries.io/npm/%40libp2p%2Fmplex) | [![GitHub CI](https://img.shields.io/github/actions/workflow/status/libp2p/js-libp2p-mplex/js-test-and-release.yml?branch=master&label=ci&style=flat-square)](//github.com/libp2p/js-libp2p-mplex/actions?query=branch%3Amaster+workflow%3Aci+) | [![codecov](https://codecov.io/gh/libp2p/js-libp2p-mplex/branch/master/graph/badge.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p-mplex) | +| [`@chainsafe/libp2p-yamux`](//github.com/ChainSafe/js-libp2p-yamux) | [![npm](https://img.shields.io/npm/v/%40chainsafe%2Flibp2p-yamux.svg?maxAge=86400&style=flat-square)](//github.com/ChainSafe/js-libp2p-yamux/releases) | [![Deps](https://img.shields.io/librariesio/release/npm/%40chainsafe%2Flibp2p-yamux?logo=Libraries.io&logoColor=white&style=flat-square)](//libraries.io/npm/%40chainsafe%2Flibp2p-yamux) | [![GitHub CI](https://img.shields.io/github/actions/workflow/status/ChainSafe/js-libp2p-yamux/js-test-and-release.yml?branch=master&label=ci&style=flat-square)](//github.com/ChainSafe/js-libp2p-yamux/actions?query=branch%3Amaster+workflow%3Aci+) | [![codecov](https://codecov.io/gh/ChainSafe/js-libp2p-yamux/branch/master/graph/badge.svg?style=flat-square)](https://codecov.io/gh/ChainSafe/js-libp2p-yamux) | +| **peer discovery** | +| [`@libp2p/bootstrap`](//github.com/libp2p/js-libp2p-bootstrap) | [![npm](https://img.shields.io/npm/v/%40libp2p%2Fbootstrap.svg?maxAge=86400&style=flat-square)](//github.com/libp2p/js-libp2p-bootstrap/releases) | [![Deps](https://img.shields.io/librariesio/release/npm/%40libp2p%2Fbootstrap?logo=Libraries.io&logoColor=white&style=flat-square)](//libraries.io/npm/%40libp2p%2Fbootstrap) | [![GitHub CI](https://img.shields.io/github/actions/workflow/status/libp2p/js-libp2p-bootstrap/js-test-and-release.yml?branch=master&label=ci&style=flat-square)](//github.com/libp2p/js-libp2p-bootstrap/actions?query=branch%3Amaster+workflow%3Aci+) | [![codecov](https://codecov.io/gh/libp2p/js-libp2p-bootstrap/branch/master/graph/badge.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p-bootstrap) | +| [`@libp2p/kad-dht`](//github.com/libp2p/js-libp2p-kad-dht) | [![npm](https://img.shields.io/npm/v/%40libp2p%2Fkad-dht.svg?maxAge=86400&style=flat-square)](//github.com/libp2p/js-libp2p-kad-dht/releases) | [![Deps](https://img.shields.io/librariesio/release/npm/%40libp2p%2Fkad-dht?logo=Libraries.io&logoColor=white&style=flat-square)](//libraries.io/npm/%40libp2p%2Fkad-dht) | [![GitHub CI](https://img.shields.io/github/actions/workflow/status/libp2p/js-libp2p-kad-dht/js-test-and-release.yml?branch=master&label=ci&style=flat-square)](//github.com/libp2p/js-libp2p-kad-dht/actions?query=branch%3Amaster+workflow%3Aci+) | [![codecov](https://codecov.io/gh/libp2p/js-libp2p-kad-dht/branch/master/graph/badge.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p-kad-dht) | +| [`@libp2p/mdns`](//github.com/libp2p/js-libp2p-mdns) | [![npm](https://img.shields.io/npm/v/%40libp2p%2Fmdns.svg?maxAge=86400&style=flat-square)](//github.com/libp2p/js-libp2p-mdns/releases) | [![Deps](https://img.shields.io/librariesio/release/npm/%40libp2p%2Fmdns?logo=Libraries.io&logoColor=white&style=flat-square)](//libraries.io/npm/%40libp2p%2Fmdns) | [![GitHub CI](https://img.shields.io/github/actions/workflow/status/libp2p/js-libp2p-mdns/js-test-and-release.yml?branch=master&label=ci&style=flat-square)](//github.com/libp2p/js-libp2p-mdns/actions?query=branch%3Amaster+workflow%3Aci+) | [![codecov](https://codecov.io/gh/libp2p/js-libp2p-mdns/branch/master/graph/badge.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p-mdns) | +| [`@chainsafe/discv5`](//github.com/ChainSafe/discv5) | [![npm](https://img.shields.io/npm/v/%40chainsafe%2Fdiscv5.svg?maxAge=86400&style=flat-square)](//github.com/ChainSafe/discv5/releases) | [![Deps](https://img.shields.io/librariesio/release/npm/%40chainsafe%2Fdiscv5?logo=Libraries.io&logoColor=white&style=flat-square)](//libraries.io/npm/%40chainsafe%2Fdiscv5) | [![GitHub CI](https://img.shields.io/github/actions/workflow/status/ChainSafe/discv5/test_and_release.yml?branch=master&label=ci&style=flat-square)](//github.com/ChainSafe/discv5/actions?query=branch%3Amaster+workflow%3Aci+) | [![codecov](https://codecov.io/gh/ChainSafe/discv5/branch/master/graph/badge.svg?style=flat-square)](https://codecov.io/gh/ChainSafe/discv5) | +| **content routing** | +| [`@libp2p/reframe-content-routing`](//github.com/libp2p/js-reframe-content-routing) | [![npm](https://img.shields.io/npm/v/%40libp2p%2Freframe-content-routing.svg?maxAge=86400&style=flat-square)](//github.com/libp2p/js-reframe-content-routing/releases) | [![Deps](https://img.shields.io/librariesio/release/npm/%40libp2p%2Freframe-content-routing?logo=Libraries.io&logoColor=white&style=flat-square)](//libraries.io/npm/%40libp2p%2Freframe-content-routing) | [![GitHub CI](https://img.shields.io/github/actions/workflow/status/libp2p/js-reframe-content-routing/js-test-and-release.yml?branch=main&label=ci&style=flat-square)](//github.com/libp2p/js-reframe-content-routing/actions?query=branch%3Amain+workflow%3Aci+) | [![codecov](https://codecov.io/gh/libp2p/js-reframe-content-routing/branch/master/graph/badge.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-reframe-content-routing) | +| [`@libp2p/ipni-content-routing`](//github.com/libp2p/js-ipni-content-routing) | [![npm](https://img.shields.io/npm/v/%40libp2p%2Fipni-content-routing.svg?maxAge=86400&style=flat-square)](//github.com/libp2p/js-ipni-content-routing/releases) | [![Deps](https://img.shields.io/librariesio/release/npm/%40libp2p%2Fipni-content-routing?logo=Libraries.io&logoColor=white&style=flat-square)](//libraries.io/npm/%40libp2p%2Fipni-content-routing) | [![GitHub CI](https://img.shields.io/github/actions/workflow/status/libp2p/js-ipni-content-routing/js-test-and-release.yml?branch=main&label=ci&style=flat-square)](//github.com/libp2p/js-ipni-content-routing/actions?query=branch%3Amain+workflow%3Aci+) | [![codecov](https://codecov.io/gh/libp2p/js-ipni-content-routing/branch/master/graph/badge.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-ipni-content-routing) | +| [`@libp2p/delegated-content-routing`](//github.com/libp2p/js-libp2p-delegated-content-routing) | [![npm](https://img.shields.io/npm/v/%40libp2p%2Fdelegated-content-routing.svg?maxAge=86400&style=flat-square)](//github.com/libp2p/js-libp2p-delegated-content-routing/releases) | [![Deps](https://img.shields.io/librariesio/release/npm/%40libp2p%2Fdelegated-content-routing?logo=Libraries.io&logoColor=white&style=flat-square)](//libraries.io/npm/%40libp2p%2Fdelegated-content-routing) | [![GitHub CI](https://img.shields.io/github/actions/workflow/status/libp2p/js-libp2p-delegated-content-routing/js-test-and-release.yml?branch=master&label=ci&style=flat-square)](//github.com/libp2p/js-libp2p-delegated-content-routing/actions?query=branch%3Amaster+workflow%3Aci+) | [![codecov](https://codecov.io/gh/libp2p/js-libp2p-delegated-content-routing/branch/master/graph/badge.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p-delegated-content-routing) | +| [`@libp2p/kad-dht`](//github.com/libp2p/js-libp2p-kad-dht) | [![npm](https://img.shields.io/npm/v/%40libp2p%2Fkad-dht.svg?maxAge=86400&style=flat-square)](//github.com/libp2p/js-libp2p-kad-dht/releases) | [![Deps](https://img.shields.io/librariesio/release/npm/%40libp2p%2Fkad-dht?logo=Libraries.io&logoColor=white&style=flat-square)](//libraries.io/npm/%40libp2p%2Fkad-dht) | [![GitHub CI](https://img.shields.io/github/actions/workflow/status/libp2p/js-libp2p-kad-dht/js-test-and-release.yml?branch=master&label=ci&style=flat-square)](//github.com/libp2p/js-libp2p-kad-dht/actions?query=branch%3Amaster+workflow%3Aci+) | [![codecov](https://codecov.io/gh/libp2p/js-libp2p-kad-dht/branch/master/graph/badge.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p-kad-dht) | +| **peer routing** | +| [`@libp2p/delegated-peer-routing`](//github.com/libp2p/js-libp2p-delegated-peer-routing) | [![npm](https://img.shields.io/npm/v/%40libp2p%2Fdelegated-peer-routing.svg?maxAge=86400&style=flat-square)](//github.com/libp2p/js-libp2p-delegated-peer-routing/releases) | [![Deps](https://img.shields.io/librariesio/release/npm/%40libp2p%2Fdelegated-peer-routing?logo=Libraries.io&logoColor=white&style=flat-square)](//libraries.io/npm/%40libp2p%2Fdelegated-peer-routing) | [![GitHub CI](https://img.shields.io/github/actions/workflow/status/libp2p/js-libp2p-delegated-peer-routing/js-test-and-release.yml?branch=master&label=ci&style=flat-square)](//github.com/libp2p/js-libp2p-delegated-peer-routing/actions?query=branch%3Amaster+workflow%3Aci+) | [![codecov](https://codecov.io/gh/libp2p/js-libp2p-delegated-peer-routing/branch/master/graph/badge.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p-delegated-peer-routing) | +| [`@libp2p/kad-dht`](//github.com/libp2p/js-libp2p-kad-dht) | [![npm](https://img.shields.io/npm/v/%40libp2p%2Fkad-dht.svg?maxAge=86400&style=flat-square)](//github.com/libp2p/js-libp2p-kad-dht/releases) | [![Deps](https://img.shields.io/librariesio/release/npm/%40libp2p%2Fkad-dht?logo=Libraries.io&logoColor=white&style=flat-square)](//libraries.io/npm/%40libp2p%2Fkad-dht) | [![GitHub CI](https://img.shields.io/github/actions/workflow/status/libp2p/js-libp2p-kad-dht/js-test-and-release.yml?branch=master&label=ci&style=flat-square)](//github.com/libp2p/js-libp2p-kad-dht/actions?query=branch%3Amaster+workflow%3Aci+) | [![codecov](https://codecov.io/gh/libp2p/js-libp2p-kad-dht/branch/master/graph/badge.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p-kad-dht) | +| **utilities** | +| [`@libp2p/crypto`](//github.com/libp2p/js-libp2p-crypto) | [![npm](https://img.shields.io/npm/v/%40libp2p%2Fcrypto.svg?maxAge=86400&style=flat-square)](//github.com/libp2p/js-libp2p-crypto/releases) | [![Deps](https://img.shields.io/librariesio/release/npm/%40libp2p%2Fcrypto?logo=Libraries.io&logoColor=white&style=flat-square)](//libraries.io/npm/%40libp2p%2Fcrypto) | [![GitHub CI](https://img.shields.io/github/actions/workflow/status/libp2p/js-libp2p-crypto/js-test-and-release.yml?branch=master&label=ci&style=flat-square)](//github.com/libp2p/js-libp2p-crypto/actions?query=branch%3Amaster+workflow%3Aci+) | [![codecov](https://codecov.io/gh/libp2p/js-libp2p-crypto/branch/master/graph/badge.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p-crypto) | +| **data types** | +| [`@libp2p/peer-id`](//github.com/libp2p/js-libp2p-peer-id) | [![npm](https://img.shields.io/npm/v/%40libp2p%2Fpeer-id.svg?maxAge=86400&style=flat-square)](//github.com/libp2p/js-libp2p-peer-id/releases) | [![Deps](https://img.shields.io/librariesio/release/npm/%40libp2p%2Fpeer-id?logo=Libraries.io&logoColor=white&style=flat-square)](//libraries.io/npm/%40libp2p%2Fpeer-id) | [![GitHub CI](https://img.shields.io/github/actions/workflow/status/libp2p/js-libp2p-peer-id/js-test-and-release.yml?branch=master&label=ci&style=flat-square)](//github.com/libp2p/js-libp2p-peer-id/actions?query=branch%3Amaster+workflow%3Aci+) | [![codecov](https://codecov.io/gh/libp2p/js-libp2p-peer-id/branch/master/graph/badge.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p-peer-id) | +| [`@libp2p/record`](//github.com/libp2p/js-libp2p-record) | [![npm](https://img.shields.io/npm/v/%40libp2p%2Frecord.svg?maxAge=86400&style=flat-square)](//github.com/libp2p/js-libp2p-record/releases) | [![Deps](https://img.shields.io/librariesio/release/npm/%40libp2p%2Frecord?logo=Libraries.io&logoColor=white&style=flat-square)](//libraries.io/npm/%40libp2p%2Frecord) | [![GitHub CI](https://img.shields.io/github/actions/workflow/status/libp2p/js-libp2p-record/js-test-and-release.yml?branch=master&label=ci&style=flat-square)](//github.com/libp2p/js-libp2p-record/actions?query=branch%3Amaster+workflow%3Aci+) | [![codecov](https://codecov.io/gh/libp2p/js-libp2p-record/branch/master/graph/badge.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p-record) | +| [`@libp2p/peer-record`](//github.com/libp2p/js-libp2p-peer-record) | [![npm](https://img.shields.io/npm/v/%40libp2p%2Fpeer-record.svg?maxAge=86400&style=flat-square)](//github.com/libp2p/js-libp2p-peer-record/releases) | [![Deps](https://img.shields.io/librariesio/release/npm/%40libp2p%2Fpeer-record?logo=Libraries.io&logoColor=white&style=flat-square)](//libraries.io/npm/%40libp2p%2Fpeer-record) | [![GitHub CI](https://img.shields.io/github/actions/workflow/status/libp2p/js-libp2p-peer-record/js-test-and-release.yml?branch=master&label=ci&style=flat-square)](//github.com/libp2p/js-libp2p-peer-record/actions?query=branch%3Amaster+workflow%3Aci+) | [![codecov](https://codecov.io/gh/libp2p/js-libp2p-peer-record/branch/master/graph/badge.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p-peer-record) | +| **pubsub** | +| [`@ChainSafe/libp2p-gossipsub`](//github.com/ChainSafe/js-libp2p-gossipsub) | [![npm](https://img.shields.io/npm/v/%40ChainSafe%2Flibp2p-gossipsub.svg?maxAge=86400&style=flat-square)](//github.com/ChainSafe/js-libp2p-gossipsub/releases) | [![Deps](https://img.shields.io/librariesio/release/npm/%40ChainSafe%2Flibp2p-gossipsub?logo=Libraries.io&logoColor=white&style=flat-square)](//libraries.io/npm/%40ChainSafe%2Flibp2p-gossipsub) | [![GitHub CI](https://img.shields.io/github/actions/workflow/status/ChainSafe/js-libp2p-gossipsub/main.yml?branch=master&label=ci&style=flat-square)](//github.com/ChainSafe/js-libp2p-gossipsub/actions?query=branch%3Amaster+workflow%3Aci+) | [![codecov](https://codecov.io/gh/ChainSafe/js-libp2p-gossipsub/branch/master/graph/badge.svg?style=flat-square)](https://codecov.io/gh/ChainSafe/js-libp2p-gossipsub) | +| [`@libp2p/floodsub`](//github.com/libp2p/js-libp2p-floodsub) | [![npm](https://img.shields.io/npm/v/%40libp2p%2Ffloodsub.svg?maxAge=86400&style=flat-square)](//github.com/libp2p/js-libp2p-floodsub/releases) | [![Deps](https://img.shields.io/librariesio/release/npm/%40libp2p%2Ffloodsub?logo=Libraries.io&logoColor=white&style=flat-square)](//libraries.io/npm/%40libp2p%2Ffloodsub) | [![GitHub CI](https://img.shields.io/github/actions/workflow/status/libp2p/js-libp2p-floodsub/js-test-and-release.yml?branch=master&label=ci&style=flat-square)](//github.com/libp2p/js-libp2p-floodsub/actions?query=branch%3Amaster+workflow%3Aci+) | [![codecov](https://codecov.io/gh/libp2p/js-libp2p-floodsub/branch/master/graph/badge.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p-floodsub) | + +## Used by + +
+

+ + HOPR Logo + IPFS in JavaScript logo +

+
+ +And [many others...](https://github.com/libp2p/js-libp2p/network/dependents) + +## Contribute + +The libp2p implementation in JavaScript is a work in progress. As such, there are a few things you can do right now to help out: + + - Go through the modules and **check out existing issues**. This would be especially useful for modules in active development. Some knowledge of IPFS/libp2p may be required, as well as the infrastructure behind it - for instance, you may need to read up on p2p and more complex operations like muxing to be able to help technically. + - **Perform code reviews**. Most of this has been developed by @diasdavid, which means that more eyes will help a) speed the project along b) ensure quality and c) reduce possible future bugs. + - **Add tests**. There can never be enough tests. + +## License + +Licensed under either of + + * Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / http://www.apache.org/licenses/LICENSE-2.0) + * MIT ([LICENSE-MIT](LICENSE-MIT) / http://opensource.org/licenses/MIT) + +### 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. diff --git a/package-list.json b/packages/libp2p/package-list.json similarity index 100% rename from package-list.json rename to packages/libp2p/package-list.json diff --git a/packages/libp2p/package.json b/packages/libp2p/package.json new file mode 100644 index 0000000000..64bd33bbd3 --- /dev/null +++ b/packages/libp2p/package.json @@ -0,0 +1,229 @@ +{ + "name": "libp2p", + "version": "0.45.5", + "description": "JavaScript implementation of libp2p, a modular peer to peer network stack", + "license": "Apache-2.0 OR MIT", + "homepage": "https://github.com/libp2p/js-libp2p#readme", + "repository": { + "type": "git", + "url": "git+https://github.com/libp2p/js-libp2p.git" + }, + "bugs": { + "url": "https://github.com/libp2p/js-libp2p/issues" + }, + "keywords": [ + "IPFS", + "libp2p", + "network", + "p2p", + "peer", + "peer-to-peer" + ], + "engines": { + "node": ">=16.0.0", + "npm": ">=7.0.0" + }, + "type": "module", + "types": "./dist/src/index.d.ts", + "typesVersions": { + "*": { + "*": [ + "*", + "dist/*", + "dist/src/*", + "dist/src/*/index" + ], + "src/*": [ + "*", + "dist/*", + "dist/src/*", + "dist/src/*/index" + ] + } + }, + "files": [ + "src", + "dist", + "!dist/test", + "!**/*.tsbuildinfo" + ], + "exports": { + ".": { + "types": "./dist/src/index.d.ts", + "import": "./dist/src/index.js" + }, + "./autonat": { + "types": "./dist/src/autonat/index.d.ts", + "import": "./dist/src/autonat/index.js" + }, + "./circuit-relay": { + "types": "./dist/src/circuit-relay/index.d.ts", + "import": "./dist/src/circuit-relay/index.js" + }, + "./fetch": { + "types": "./dist/src/fetch/index.d.ts", + "import": "./dist/src/fetch/index.js" + }, + "./identify": { + "types": "./dist/src/identify/index.d.ts", + "import": "./dist/src/identify/index.js" + }, + "./insecure": { + "types": "./dist/src/insecure/index.d.ts", + "import": "./dist/src/insecure/index.js" + }, + "./upnp-nat": { + "types": "./dist/src/upnp-nat/index.d.ts", + "import": "./dist/src/upnp-nat/index.js" + }, + "./ping": { + "types": "./dist/src/ping/index.d.ts", + "import": "./dist/src/ping/index.js" + }, + "./pnet": { + "types": "./dist/src/pnet/index.d.ts", + "import": "./dist/src/pnet/index.js" + } + }, + "eslintConfig": { + "extends": "ipfs", + "parserOptions": { + "sourceType": "module" + }, + "ignorePatterns": [ + "!.aegir.js", + "test/ts-use", + "*.d.ts" + ] + }, + "scripts": { + "clean": "aegir clean", + "lint": "aegir lint", + "dep-check": "aegir dep-check -i protons", + "prepublishOnly": "node scripts/update-version.js && npm run build", + "build": "aegir build", + "generate": "run-s generate:proto:*", + "generate:proto:autonat": "protons ./src/autonat/pb/index.proto", + "generate:proto:circuit": "protons ./src/circuit/pb/index.proto", + "generate:proto:fetch": "protons ./src/fetch/pb/proto.proto", + "generate:proto:identify": "protons ./src/identify/pb/message.proto", + "generate:proto:plaintext": "protons ./src/insecure/pb/proto.proto", + "test": "aegir test", + "test:node": "aegir test -t node -f \"./dist/test/**/*.{node,spec}.js\" --cov", + "test:chrome": "aegir test -t browser -f \"./dist/test/**/*.spec.js\" --cov", + "test:chrome-webworker": "aegir test -t webworker -f \"./dist/test/**/*.spec.js\"", + "test:firefox": "aegir test -t browser -f \"./dist/test/**/*.spec.js\" -- --browser firefox", + "test:firefox-webworker": "aegir test -t webworker -f \"./dist/test/**/*.spec.js\" -- --browser firefox", + "test:webkit": "aegir test -t browser -f \"./dist/test/**/*.spec.js\" -- --browser webkit", + "test:interop": "aegir test -t node -f dist/test/interop.js" + }, + "dependencies": { + "@achingbrain/nat-port-mapper": "^1.0.3", + "@libp2p/crypto": "^1.0.17", + "@libp2p/interface-address-manager": "^3.0.0", + "@libp2p/interface-connection": "^5.0.0", + "@libp2p/interface-connection-encrypter": "^4.0.0", + "@libp2p/interface-connection-gater": "^3.0.0", + "@libp2p/interface-connection-manager": "^3.0.0", + "@libp2p/interface-content-routing": "^2.1.0", + "@libp2p/interface-keychain": "^2.0.4", + "@libp2p/interface-libp2p": "^3.2.0", + "@libp2p/interface-metrics": "^4.0.0", + "@libp2p/interface-peer-discovery": "^2.0.0", + "@libp2p/interface-peer-id": "^2.0.1", + "@libp2p/interface-peer-info": "^1.0.3", + "@libp2p/interface-peer-routing": "^1.1.0", + "@libp2p/interface-peer-store": "^2.0.3", + "@libp2p/interface-pubsub": "^4.0.0", + "@libp2p/interface-record": "^2.0.6", + "@libp2p/interface-registrar": "^2.0.3", + "@libp2p/interface-stream-muxer": "^4.0.0", + "@libp2p/interface-transport": "^4.0.0", + "@libp2p/interfaces": "^3.2.0", + "@libp2p/keychain": "^2.0.0", + "@libp2p/logger": "^2.1.1", + "@libp2p/multistream-select": "^3.1.8", + "@libp2p/peer-collections": "^3.0.0", + "@libp2p/peer-id": "^2.0.0", + "@libp2p/peer-id-factory": "^2.0.0", + "@libp2p/peer-record": "^5.0.0", + "@libp2p/peer-store": "^8.1.0", + "@libp2p/topology": "^4.0.1", + "@libp2p/tracked-map": "^3.0.0", + "@libp2p/utils": "^3.0.10", + "@multiformats/mafmt": "^12.0.0", + "@multiformats/multiaddr": "^12.0.0", + "abortable-iterator": "^5.0.1", + "any-signal": "^4.1.1", + "datastore-core": "^9.0.0", + "interface-datastore": "^8.0.0", + "it-all": "^3.0.1", + "it-drain": "^3.0.1", + "it-filter": "^3.0.1", + "it-first": "^3.0.1", + "it-handshake": "^4.1.3", + "it-length-prefixed": "^9.0.1", + "it-map": "^3.0.2", + "it-merge": "^3.0.0", + "it-pair": "^2.0.2", + "it-parallel": "^3.0.0", + "it-pb-stream": "^4.0.1", + "it-pipe": "^3.0.1", + "it-stream-types": "^2.0.1", + "merge-options": "^3.0.4", + "multiformats": "^11.0.0", + "p-defer": "^4.0.0", + "p-queue": "^7.3.4", + "p-retry": "^5.0.0", + "private-ip": "^3.0.0", + "protons-runtime": "^5.0.0", + "rate-limiter-flexible": "^2.3.11", + "uint8arraylist": "^2.3.2", + "uint8arrays": "^4.0.2", + "wherearewe": "^2.0.0", + "xsalsa20": "^1.1.0" + }, + "devDependencies": { + "@chainsafe/libp2p-gossipsub": "^8.0.0", + "@chainsafe/libp2p-noise": "^12.0.0", + "@chainsafe/libp2p-yamux": "^4.0.1", + "@libp2p/bootstrap": "^8.0.0", + "@libp2p/daemon-client": "^6.0.2", + "@libp2p/daemon-server": "^5.0.2", + "@libp2p/floodsub": "^7.0.1", + "@libp2p/interface-compliance-tests": "^3.0.6", + "@libp2p/interface-connection-compliance-tests": "^2.0.8", + "@libp2p/interface-connection-encrypter-compliance-tests": "^5.0.0", + "@libp2p/interface-mocks": "^12.0.0", + "@libp2p/interop": "^8.0.0", + "@libp2p/kad-dht": "^9.2.0", + "@libp2p/mdns": "^8.0.0", + "@libp2p/mplex": "^8.0.1", + "@libp2p/pubsub": "^7.0.1", + "@libp2p/tcp": "^7.0.1", + "@libp2p/websockets": "^6.0.1", + "@types/varint": "^6.0.0", + "@types/xsalsa20": "^1.1.0", + "aegir": "^39.0.5", + "cborg": "^1.8.1", + "delay": "^6.0.0", + "execa": "^7.0.0", + "go-libp2p": "^1.0.1", + "it-pushable": "^3.0.0", + "it-to-buffer": "^4.0.1", + "npm-run-all": "^4.1.5", + "p-event": "^5.0.1", + "p-times": "^4.0.0", + "p-wait-for": "^5.0.0", + "protons": "^7.0.2", + "sinon": "^15.0.1", + "sinon-ts": "^1.0.0" + }, + "browser": { + "./dist/src/config/connection-gater.js": "./dist/src/config/connection-gater.browser.js", + "nat-api": false + }, + "typedoc": { + "entryPoint": "./src/index.ts" + } +} diff --git a/scripts/update-version.js b/packages/libp2p/scripts/update-version.js similarity index 100% rename from scripts/update-version.js rename to packages/libp2p/scripts/update-version.js diff --git a/src/address-manager/README.md b/packages/libp2p/src/address-manager/README.md similarity index 100% rename from src/address-manager/README.md rename to packages/libp2p/src/address-manager/README.md diff --git a/src/address-manager/index.ts b/packages/libp2p/src/address-manager/index.ts similarity index 100% rename from src/address-manager/index.ts rename to packages/libp2p/src/address-manager/index.ts diff --git a/src/address-manager/utils.ts b/packages/libp2p/src/address-manager/utils.ts similarity index 100% rename from src/address-manager/utils.ts rename to packages/libp2p/src/address-manager/utils.ts diff --git a/src/autonat/constants.ts b/packages/libp2p/src/autonat/constants.ts similarity index 100% rename from src/autonat/constants.ts rename to packages/libp2p/src/autonat/constants.ts diff --git a/src/autonat/index.ts b/packages/libp2p/src/autonat/index.ts similarity index 100% rename from src/autonat/index.ts rename to packages/libp2p/src/autonat/index.ts diff --git a/src/autonat/pb/index.proto b/packages/libp2p/src/autonat/pb/index.proto similarity index 100% rename from src/autonat/pb/index.proto rename to packages/libp2p/src/autonat/pb/index.proto diff --git a/src/autonat/pb/index.ts b/packages/libp2p/src/autonat/pb/index.ts similarity index 100% rename from src/autonat/pb/index.ts rename to packages/libp2p/src/autonat/pb/index.ts diff --git a/src/circuit-relay/constants.ts b/packages/libp2p/src/circuit-relay/constants.ts similarity index 100% rename from src/circuit-relay/constants.ts rename to packages/libp2p/src/circuit-relay/constants.ts diff --git a/src/circuit-relay/index.ts b/packages/libp2p/src/circuit-relay/index.ts similarity index 100% rename from src/circuit-relay/index.ts rename to packages/libp2p/src/circuit-relay/index.ts diff --git a/src/circuit-relay/pb/index.proto b/packages/libp2p/src/circuit-relay/pb/index.proto similarity index 100% rename from src/circuit-relay/pb/index.proto rename to packages/libp2p/src/circuit-relay/pb/index.proto diff --git a/src/circuit-relay/pb/index.ts b/packages/libp2p/src/circuit-relay/pb/index.ts similarity index 100% rename from src/circuit-relay/pb/index.ts rename to packages/libp2p/src/circuit-relay/pb/index.ts diff --git a/src/circuit-relay/server/advert-service.ts b/packages/libp2p/src/circuit-relay/server/advert-service.ts similarity index 100% rename from src/circuit-relay/server/advert-service.ts rename to packages/libp2p/src/circuit-relay/server/advert-service.ts diff --git a/src/circuit-relay/server/index.ts b/packages/libp2p/src/circuit-relay/server/index.ts similarity index 100% rename from src/circuit-relay/server/index.ts rename to packages/libp2p/src/circuit-relay/server/index.ts diff --git a/src/circuit-relay/server/reservation-store.ts b/packages/libp2p/src/circuit-relay/server/reservation-store.ts similarity index 100% rename from src/circuit-relay/server/reservation-store.ts rename to packages/libp2p/src/circuit-relay/server/reservation-store.ts diff --git a/src/circuit-relay/server/reservation-voucher.ts b/packages/libp2p/src/circuit-relay/server/reservation-voucher.ts similarity index 100% rename from src/circuit-relay/server/reservation-voucher.ts rename to packages/libp2p/src/circuit-relay/server/reservation-voucher.ts diff --git a/src/circuit-relay/transport/discovery.ts b/packages/libp2p/src/circuit-relay/transport/discovery.ts similarity index 100% rename from src/circuit-relay/transport/discovery.ts rename to packages/libp2p/src/circuit-relay/transport/discovery.ts diff --git a/src/circuit-relay/transport/index.ts b/packages/libp2p/src/circuit-relay/transport/index.ts similarity index 100% rename from src/circuit-relay/transport/index.ts rename to packages/libp2p/src/circuit-relay/transport/index.ts diff --git a/src/circuit-relay/transport/listener.ts b/packages/libp2p/src/circuit-relay/transport/listener.ts similarity index 100% rename from src/circuit-relay/transport/listener.ts rename to packages/libp2p/src/circuit-relay/transport/listener.ts diff --git a/src/circuit-relay/transport/reservation-store.ts b/packages/libp2p/src/circuit-relay/transport/reservation-store.ts similarity index 100% rename from src/circuit-relay/transport/reservation-store.ts rename to packages/libp2p/src/circuit-relay/transport/reservation-store.ts diff --git a/src/circuit-relay/utils.ts b/packages/libp2p/src/circuit-relay/utils.ts similarity index 100% rename from src/circuit-relay/utils.ts rename to packages/libp2p/src/circuit-relay/utils.ts diff --git a/src/components.ts b/packages/libp2p/src/components.ts similarity index 100% rename from src/components.ts rename to packages/libp2p/src/components.ts diff --git a/src/config.ts b/packages/libp2p/src/config.ts similarity index 100% rename from src/config.ts rename to packages/libp2p/src/config.ts diff --git a/src/config/connection-gater.browser.ts b/packages/libp2p/src/config/connection-gater.browser.ts similarity index 100% rename from src/config/connection-gater.browser.ts rename to packages/libp2p/src/config/connection-gater.browser.ts diff --git a/src/config/connection-gater.ts b/packages/libp2p/src/config/connection-gater.ts similarity index 100% rename from src/config/connection-gater.ts rename to packages/libp2p/src/config/connection-gater.ts diff --git a/src/connection-manager/auto-dial.ts b/packages/libp2p/src/connection-manager/auto-dial.ts similarity index 100% rename from src/connection-manager/auto-dial.ts rename to packages/libp2p/src/connection-manager/auto-dial.ts diff --git a/src/connection-manager/connection-pruner.ts b/packages/libp2p/src/connection-manager/connection-pruner.ts similarity index 100% rename from src/connection-manager/connection-pruner.ts rename to packages/libp2p/src/connection-manager/connection-pruner.ts diff --git a/src/connection-manager/constants.ts b/packages/libp2p/src/connection-manager/constants.ts similarity index 100% rename from src/connection-manager/constants.ts rename to packages/libp2p/src/connection-manager/constants.ts diff --git a/src/connection-manager/dial-queue.ts b/packages/libp2p/src/connection-manager/dial-queue.ts similarity index 100% rename from src/connection-manager/dial-queue.ts rename to packages/libp2p/src/connection-manager/dial-queue.ts diff --git a/src/connection-manager/index.ts b/packages/libp2p/src/connection-manager/index.ts similarity index 100% rename from src/connection-manager/index.ts rename to packages/libp2p/src/connection-manager/index.ts diff --git a/src/connection-manager/utils.ts b/packages/libp2p/src/connection-manager/utils.ts similarity index 100% rename from src/connection-manager/utils.ts rename to packages/libp2p/src/connection-manager/utils.ts diff --git a/src/connection/index.ts b/packages/libp2p/src/connection/index.ts similarity index 100% rename from src/connection/index.ts rename to packages/libp2p/src/connection/index.ts diff --git a/src/content-routing/index.ts b/packages/libp2p/src/content-routing/index.ts similarity index 100% rename from src/content-routing/index.ts rename to packages/libp2p/src/content-routing/index.ts diff --git a/src/content-routing/utils.ts b/packages/libp2p/src/content-routing/utils.ts similarity index 100% rename from src/content-routing/utils.ts rename to packages/libp2p/src/content-routing/utils.ts diff --git a/src/errors.ts b/packages/libp2p/src/errors.ts similarity index 100% rename from src/errors.ts rename to packages/libp2p/src/errors.ts diff --git a/src/fetch/README.md b/packages/libp2p/src/fetch/README.md similarity index 100% rename from src/fetch/README.md rename to packages/libp2p/src/fetch/README.md diff --git a/src/fetch/constants.ts b/packages/libp2p/src/fetch/constants.ts similarity index 100% rename from src/fetch/constants.ts rename to packages/libp2p/src/fetch/constants.ts diff --git a/src/fetch/index.ts b/packages/libp2p/src/fetch/index.ts similarity index 100% rename from src/fetch/index.ts rename to packages/libp2p/src/fetch/index.ts diff --git a/src/fetch/pb/proto.proto b/packages/libp2p/src/fetch/pb/proto.proto similarity index 100% rename from src/fetch/pb/proto.proto rename to packages/libp2p/src/fetch/pb/proto.proto diff --git a/src/fetch/pb/proto.ts b/packages/libp2p/src/fetch/pb/proto.ts similarity index 100% rename from src/fetch/pb/proto.ts rename to packages/libp2p/src/fetch/pb/proto.ts diff --git a/src/get-peer.ts b/packages/libp2p/src/get-peer.ts similarity index 100% rename from src/get-peer.ts rename to packages/libp2p/src/get-peer.ts diff --git a/src/identify/README.md b/packages/libp2p/src/identify/README.md similarity index 100% rename from src/identify/README.md rename to packages/libp2p/src/identify/README.md diff --git a/src/identify/consts.ts b/packages/libp2p/src/identify/consts.ts similarity index 100% rename from src/identify/consts.ts rename to packages/libp2p/src/identify/consts.ts diff --git a/src/identify/identify.ts b/packages/libp2p/src/identify/identify.ts similarity index 100% rename from src/identify/identify.ts rename to packages/libp2p/src/identify/identify.ts diff --git a/src/identify/index.ts b/packages/libp2p/src/identify/index.ts similarity index 100% rename from src/identify/index.ts rename to packages/libp2p/src/identify/index.ts diff --git a/src/identify/pb/message.proto b/packages/libp2p/src/identify/pb/message.proto similarity index 100% rename from src/identify/pb/message.proto rename to packages/libp2p/src/identify/pb/message.proto diff --git a/src/identify/pb/message.ts b/packages/libp2p/src/identify/pb/message.ts similarity index 100% rename from src/identify/pb/message.ts rename to packages/libp2p/src/identify/pb/message.ts diff --git a/src/index.ts b/packages/libp2p/src/index.ts similarity index 100% rename from src/index.ts rename to packages/libp2p/src/index.ts diff --git a/src/insecure/index.ts b/packages/libp2p/src/insecure/index.ts similarity index 100% rename from src/insecure/index.ts rename to packages/libp2p/src/insecure/index.ts diff --git a/src/insecure/pb/proto.proto b/packages/libp2p/src/insecure/pb/proto.proto similarity index 100% rename from src/insecure/pb/proto.proto rename to packages/libp2p/src/insecure/pb/proto.proto diff --git a/src/insecure/pb/proto.ts b/packages/libp2p/src/insecure/pb/proto.ts similarity index 100% rename from src/insecure/pb/proto.ts rename to packages/libp2p/src/insecure/pb/proto.ts diff --git a/src/libp2p.ts b/packages/libp2p/src/libp2p.ts similarity index 100% rename from src/libp2p.ts rename to packages/libp2p/src/libp2p.ts diff --git a/src/peer-routing.ts b/packages/libp2p/src/peer-routing.ts similarity index 100% rename from src/peer-routing.ts rename to packages/libp2p/src/peer-routing.ts diff --git a/src/ping/README.md b/packages/libp2p/src/ping/README.md similarity index 100% rename from src/ping/README.md rename to packages/libp2p/src/ping/README.md diff --git a/src/ping/constants.ts b/packages/libp2p/src/ping/constants.ts similarity index 100% rename from src/ping/constants.ts rename to packages/libp2p/src/ping/constants.ts diff --git a/src/ping/index.ts b/packages/libp2p/src/ping/index.ts similarity index 100% rename from src/ping/index.ts rename to packages/libp2p/src/ping/index.ts diff --git a/src/pnet/README.md b/packages/libp2p/src/pnet/README.md similarity index 100% rename from src/pnet/README.md rename to packages/libp2p/src/pnet/README.md diff --git a/src/pnet/crypto.ts b/packages/libp2p/src/pnet/crypto.ts similarity index 100% rename from src/pnet/crypto.ts rename to packages/libp2p/src/pnet/crypto.ts diff --git a/src/pnet/errors.ts b/packages/libp2p/src/pnet/errors.ts similarity index 100% rename from src/pnet/errors.ts rename to packages/libp2p/src/pnet/errors.ts diff --git a/src/pnet/index.ts b/packages/libp2p/src/pnet/index.ts similarity index 100% rename from src/pnet/index.ts rename to packages/libp2p/src/pnet/index.ts diff --git a/src/pnet/key-generator.ts b/packages/libp2p/src/pnet/key-generator.ts similarity index 100% rename from src/pnet/key-generator.ts rename to packages/libp2p/src/pnet/key-generator.ts diff --git a/src/pubsub/dummy-pubsub.ts b/packages/libp2p/src/pubsub/dummy-pubsub.ts similarity index 100% rename from src/pubsub/dummy-pubsub.ts rename to packages/libp2p/src/pubsub/dummy-pubsub.ts diff --git a/src/registrar.ts b/packages/libp2p/src/registrar.ts similarity index 100% rename from src/registrar.ts rename to packages/libp2p/src/registrar.ts diff --git a/src/transport-manager.ts b/packages/libp2p/src/transport-manager.ts similarity index 100% rename from src/transport-manager.ts rename to packages/libp2p/src/transport-manager.ts diff --git a/src/upgrader.ts b/packages/libp2p/src/upgrader.ts similarity index 100% rename from src/upgrader.ts rename to packages/libp2p/src/upgrader.ts diff --git a/src/upnp-nat/index.ts b/packages/libp2p/src/upnp-nat/index.ts similarity index 100% rename from src/upnp-nat/index.ts rename to packages/libp2p/src/upnp-nat/index.ts diff --git a/src/version.ts b/packages/libp2p/src/version.ts similarity index 100% rename from src/version.ts rename to packages/libp2p/src/version.ts diff --git a/test/addresses/address-manager.spec.ts b/packages/libp2p/test/addresses/address-manager.spec.ts similarity index 100% rename from test/addresses/address-manager.spec.ts rename to packages/libp2p/test/addresses/address-manager.spec.ts diff --git a/test/addresses/addresses.node.ts b/packages/libp2p/test/addresses/addresses.node.ts similarity index 100% rename from test/addresses/addresses.node.ts rename to packages/libp2p/test/addresses/addresses.node.ts diff --git a/test/addresses/utils.ts b/packages/libp2p/test/addresses/utils.ts similarity index 100% rename from test/addresses/utils.ts rename to packages/libp2p/test/addresses/utils.ts diff --git a/test/autonat/index.spec.ts b/packages/libp2p/test/autonat/index.spec.ts similarity index 100% rename from test/autonat/index.spec.ts rename to packages/libp2p/test/autonat/index.spec.ts diff --git a/test/circuit-relay/discovery.node.ts b/packages/libp2p/test/circuit-relay/discovery.node.ts similarity index 100% rename from test/circuit-relay/discovery.node.ts rename to packages/libp2p/test/circuit-relay/discovery.node.ts diff --git a/test/circuit-relay/hop.spec.ts b/packages/libp2p/test/circuit-relay/hop.spec.ts similarity index 100% rename from test/circuit-relay/hop.spec.ts rename to packages/libp2p/test/circuit-relay/hop.spec.ts diff --git a/test/circuit-relay/relay.node.ts b/packages/libp2p/test/circuit-relay/relay.node.ts similarity index 100% rename from test/circuit-relay/relay.node.ts rename to packages/libp2p/test/circuit-relay/relay.node.ts diff --git a/test/circuit-relay/relay.spec.ts b/packages/libp2p/test/circuit-relay/relay.spec.ts similarity index 100% rename from test/circuit-relay/relay.spec.ts rename to packages/libp2p/test/circuit-relay/relay.spec.ts diff --git a/test/circuit-relay/reservation-store.spec.ts b/packages/libp2p/test/circuit-relay/reservation-store.spec.ts similarity index 100% rename from test/circuit-relay/reservation-store.spec.ts rename to packages/libp2p/test/circuit-relay/reservation-store.spec.ts diff --git a/test/circuit-relay/stop.spec.ts b/packages/libp2p/test/circuit-relay/stop.spec.ts similarity index 100% rename from test/circuit-relay/stop.spec.ts rename to packages/libp2p/test/circuit-relay/stop.spec.ts diff --git a/test/circuit-relay/utils.spec.ts b/packages/libp2p/test/circuit-relay/utils.spec.ts similarity index 100% rename from test/circuit-relay/utils.spec.ts rename to packages/libp2p/test/circuit-relay/utils.spec.ts diff --git a/test/circuit-relay/utils.ts b/packages/libp2p/test/circuit-relay/utils.ts similarity index 100% rename from test/circuit-relay/utils.ts rename to packages/libp2p/test/circuit-relay/utils.ts diff --git a/test/configuration/protocol-prefix.node.ts b/packages/libp2p/test/configuration/protocol-prefix.node.ts similarity index 100% rename from test/configuration/protocol-prefix.node.ts rename to packages/libp2p/test/configuration/protocol-prefix.node.ts diff --git a/test/configuration/pubsub.spec.ts b/packages/libp2p/test/configuration/pubsub.spec.ts similarity index 100% rename from test/configuration/pubsub.spec.ts rename to packages/libp2p/test/configuration/pubsub.spec.ts diff --git a/test/configuration/utils.ts b/packages/libp2p/test/configuration/utils.ts similarity index 100% rename from test/configuration/utils.ts rename to packages/libp2p/test/configuration/utils.ts diff --git a/test/connection-manager/auto-dial.spec.ts b/packages/libp2p/test/connection-manager/auto-dial.spec.ts similarity index 100% rename from test/connection-manager/auto-dial.spec.ts rename to packages/libp2p/test/connection-manager/auto-dial.spec.ts diff --git a/test/connection-manager/dial-queue.spec.ts b/packages/libp2p/test/connection-manager/dial-queue.spec.ts similarity index 100% rename from test/connection-manager/dial-queue.spec.ts rename to packages/libp2p/test/connection-manager/dial-queue.spec.ts diff --git a/test/connection-manager/direct.node.ts b/packages/libp2p/test/connection-manager/direct.node.ts similarity index 100% rename from test/connection-manager/direct.node.ts rename to packages/libp2p/test/connection-manager/direct.node.ts diff --git a/test/connection-manager/direct.spec.ts b/packages/libp2p/test/connection-manager/direct.spec.ts similarity index 100% rename from test/connection-manager/direct.spec.ts rename to packages/libp2p/test/connection-manager/direct.spec.ts diff --git a/test/connection-manager/index.node.ts b/packages/libp2p/test/connection-manager/index.node.ts similarity index 100% rename from test/connection-manager/index.node.ts rename to packages/libp2p/test/connection-manager/index.node.ts diff --git a/test/connection-manager/index.spec.ts b/packages/libp2p/test/connection-manager/index.spec.ts similarity index 100% rename from test/connection-manager/index.spec.ts rename to packages/libp2p/test/connection-manager/index.spec.ts diff --git a/test/connection-manager/resolver.spec.ts b/packages/libp2p/test/connection-manager/resolver.spec.ts similarity index 100% rename from test/connection-manager/resolver.spec.ts rename to packages/libp2p/test/connection-manager/resolver.spec.ts diff --git a/test/connection/compliance.spec.ts b/packages/libp2p/test/connection/compliance.spec.ts similarity index 100% rename from test/connection/compliance.spec.ts rename to packages/libp2p/test/connection/compliance.spec.ts diff --git a/test/connection/fixtures/pair.ts b/packages/libp2p/test/connection/fixtures/pair.ts similarity index 100% rename from test/connection/fixtures/pair.ts rename to packages/libp2p/test/connection/fixtures/pair.ts diff --git a/test/connection/index.spec.ts b/packages/libp2p/test/connection/index.spec.ts similarity index 100% rename from test/connection/index.spec.ts rename to packages/libp2p/test/connection/index.spec.ts diff --git a/test/content-routing/content-routing.node.ts b/packages/libp2p/test/content-routing/content-routing.node.ts similarity index 100% rename from test/content-routing/content-routing.node.ts rename to packages/libp2p/test/content-routing/content-routing.node.ts diff --git a/test/content-routing/dht/operation.node.ts b/packages/libp2p/test/content-routing/dht/operation.node.ts similarity index 100% rename from test/content-routing/dht/operation.node.ts rename to packages/libp2p/test/content-routing/dht/operation.node.ts diff --git a/test/content-routing/dht/utils.ts b/packages/libp2p/test/content-routing/dht/utils.ts similarity index 100% rename from test/content-routing/dht/utils.ts rename to packages/libp2p/test/content-routing/dht/utils.ts diff --git a/test/content-routing/utils.ts b/packages/libp2p/test/content-routing/utils.ts similarity index 100% rename from test/content-routing/utils.ts rename to packages/libp2p/test/content-routing/utils.ts diff --git a/test/core/consume-peer-record.spec.ts b/packages/libp2p/test/core/consume-peer-record.spec.ts similarity index 100% rename from test/core/consume-peer-record.spec.ts rename to packages/libp2p/test/core/consume-peer-record.spec.ts diff --git a/test/core/encryption.spec.ts b/packages/libp2p/test/core/encryption.spec.ts similarity index 100% rename from test/core/encryption.spec.ts rename to packages/libp2p/test/core/encryption.spec.ts diff --git a/test/core/events.spec.ts b/packages/libp2p/test/core/events.spec.ts similarity index 100% rename from test/core/events.spec.ts rename to packages/libp2p/test/core/events.spec.ts diff --git a/test/core/get-public-key.spec.ts b/packages/libp2p/test/core/get-public-key.spec.ts similarity index 100% rename from test/core/get-public-key.spec.ts rename to packages/libp2p/test/core/get-public-key.spec.ts diff --git a/test/core/listening.node.ts b/packages/libp2p/test/core/listening.node.ts similarity index 100% rename from test/core/listening.node.ts rename to packages/libp2p/test/core/listening.node.ts diff --git a/test/core/peer-id.spec.ts b/packages/libp2p/test/core/peer-id.spec.ts similarity index 100% rename from test/core/peer-id.spec.ts rename to packages/libp2p/test/core/peer-id.spec.ts diff --git a/test/core/start.spec.ts b/packages/libp2p/test/core/start.spec.ts similarity index 100% rename from test/core/start.spec.ts rename to packages/libp2p/test/core/start.spec.ts diff --git a/test/fetch/fetch.node.ts b/packages/libp2p/test/fetch/fetch.node.ts similarity index 100% rename from test/fetch/fetch.node.ts rename to packages/libp2p/test/fetch/fetch.node.ts diff --git a/test/fetch/index.spec.ts b/packages/libp2p/test/fetch/index.spec.ts similarity index 100% rename from test/fetch/index.spec.ts rename to packages/libp2p/test/fetch/index.spec.ts diff --git a/test/fixtures/match-peer-id.ts b/packages/libp2p/test/fixtures/match-peer-id.ts similarity index 100% rename from test/fixtures/match-peer-id.ts rename to packages/libp2p/test/fixtures/match-peer-id.ts diff --git a/test/fixtures/swarm.key.ts b/packages/libp2p/test/fixtures/swarm.key.ts similarity index 100% rename from test/fixtures/swarm.key.ts rename to packages/libp2p/test/fixtures/swarm.key.ts diff --git a/test/identify/index.spec.ts b/packages/libp2p/test/identify/index.spec.ts similarity index 100% rename from test/identify/index.spec.ts rename to packages/libp2p/test/identify/index.spec.ts diff --git a/test/identify/push.spec.ts b/packages/libp2p/test/identify/push.spec.ts similarity index 100% rename from test/identify/push.spec.ts rename to packages/libp2p/test/identify/push.spec.ts diff --git a/test/identify/service.node.ts b/packages/libp2p/test/identify/service.node.ts similarity index 100% rename from test/identify/service.node.ts rename to packages/libp2p/test/identify/service.node.ts diff --git a/test/identify/service.spec.ts b/packages/libp2p/test/identify/service.spec.ts similarity index 100% rename from test/identify/service.spec.ts rename to packages/libp2p/test/identify/service.spec.ts diff --git a/test/insecure/compliance.spec.ts b/packages/libp2p/test/insecure/compliance.spec.ts similarity index 100% rename from test/insecure/compliance.spec.ts rename to packages/libp2p/test/insecure/compliance.spec.ts diff --git a/test/insecure/plaintext.spec.ts b/packages/libp2p/test/insecure/plaintext.spec.ts similarity index 100% rename from test/insecure/plaintext.spec.ts rename to packages/libp2p/test/insecure/plaintext.spec.ts diff --git a/test/interop.ts b/packages/libp2p/test/interop.ts similarity index 100% rename from test/interop.ts rename to packages/libp2p/test/interop.ts diff --git a/test/peer-discovery/index.node.ts b/packages/libp2p/test/peer-discovery/index.node.ts similarity index 100% rename from test/peer-discovery/index.node.ts rename to packages/libp2p/test/peer-discovery/index.node.ts diff --git a/test/peer-discovery/index.spec.ts b/packages/libp2p/test/peer-discovery/index.spec.ts similarity index 100% rename from test/peer-discovery/index.spec.ts rename to packages/libp2p/test/peer-discovery/index.spec.ts diff --git a/test/peer-routing/peer-routing.node.ts b/packages/libp2p/test/peer-routing/peer-routing.node.ts similarity index 100% rename from test/peer-routing/peer-routing.node.ts rename to packages/libp2p/test/peer-routing/peer-routing.node.ts diff --git a/test/peer-routing/utils.ts b/packages/libp2p/test/peer-routing/utils.ts similarity index 100% rename from test/peer-routing/utils.ts rename to packages/libp2p/test/peer-routing/utils.ts diff --git a/test/ping/index.spec.ts b/packages/libp2p/test/ping/index.spec.ts similarity index 100% rename from test/ping/index.spec.ts rename to packages/libp2p/test/ping/index.spec.ts diff --git a/test/ping/ping.node.ts b/packages/libp2p/test/ping/ping.node.ts similarity index 100% rename from test/ping/ping.node.ts rename to packages/libp2p/test/ping/ping.node.ts diff --git a/test/pnet/index.spec.ts b/packages/libp2p/test/pnet/index.spec.ts similarity index 100% rename from test/pnet/index.spec.ts rename to packages/libp2p/test/pnet/index.spec.ts diff --git a/test/registrar/registrar.spec.ts b/packages/libp2p/test/registrar/registrar.spec.ts similarity index 100% rename from test/registrar/registrar.spec.ts rename to packages/libp2p/test/registrar/registrar.spec.ts diff --git a/test/transports/transport-manager.node.ts b/packages/libp2p/test/transports/transport-manager.node.ts similarity index 100% rename from test/transports/transport-manager.node.ts rename to packages/libp2p/test/transports/transport-manager.node.ts diff --git a/test/transports/transport-manager.spec.ts b/packages/libp2p/test/transports/transport-manager.spec.ts similarity index 100% rename from test/transports/transport-manager.spec.ts rename to packages/libp2p/test/transports/transport-manager.spec.ts diff --git a/test/upgrading/upgrader.spec.ts b/packages/libp2p/test/upgrading/upgrader.spec.ts similarity index 100% rename from test/upgrading/upgrader.spec.ts rename to packages/libp2p/test/upgrading/upgrader.spec.ts diff --git a/test/upnp-nat/upnp-nat.node.ts b/packages/libp2p/test/upnp-nat/upnp-nat.node.ts similarity index 100% rename from test/upnp-nat/upnp-nat.node.ts rename to packages/libp2p/test/upnp-nat/upnp-nat.node.ts diff --git a/test/utils/base-options.browser.ts b/packages/libp2p/test/utils/base-options.browser.ts similarity index 100% rename from test/utils/base-options.browser.ts rename to packages/libp2p/test/utils/base-options.browser.ts diff --git a/test/utils/base-options.ts b/packages/libp2p/test/utils/base-options.ts similarity index 100% rename from test/utils/base-options.ts rename to packages/libp2p/test/utils/base-options.ts diff --git a/test/utils/creators/peer.ts b/packages/libp2p/test/utils/creators/peer.ts similarity index 100% rename from test/utils/creators/peer.ts rename to packages/libp2p/test/utils/creators/peer.ts diff --git a/tsconfig.json b/packages/libp2p/tsconfig.json similarity index 96% rename from tsconfig.json rename to packages/libp2p/tsconfig.json index 21473ad0ec..13a3599639 100644 --- a/tsconfig.json +++ b/packages/libp2p/tsconfig.json @@ -6,5 +6,5 @@ "include": [ "src", "test" - ], + ] } From 32ea8e4521f25b66a537f08e005dad891178e0de Mon Sep 17 00:00:00 2001 From: achingbrain Date: Wed, 14 Jun 2023 10:02:48 +0200 Subject: [PATCH 2/3] chore: add migration template to migrations dir --- doc/migrations/MIGRATION_TEMPLATE.md | 45 ++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 doc/migrations/MIGRATION_TEMPLATE.md diff --git a/doc/migrations/MIGRATION_TEMPLATE.md b/doc/migrations/MIGRATION_TEMPLATE.md new file mode 100644 index 0000000000..406297d34b --- /dev/null +++ b/doc/migrations/MIGRATION_TEMPLATE.md @@ -0,0 +1,45 @@ + +# Migrating to libp2p@__ + +A migration guide for refactoring your application code from libp2p v__ to v__. + +## Table of Contents + +- [API](#api) +- [Module Updates](#module-updates) + +## API + + + +## Module Updates + +With this release you should update the following libp2p modules if you are relying on them: + + + +```json + +``` From 905aa07fb02a496049be7915ff05351262304e2b Mon Sep 17 00:00:00 2001 From: achingbrain Date: Wed, 14 Jun 2023 10:15:05 +0200 Subject: [PATCH 3/3] chore: restore missing file --- packages/libp2p/src/utils/peer-job-queue.ts | 119 ++++++++++++++++++++ 1 file changed, 119 insertions(+) create mode 100644 packages/libp2p/src/utils/peer-job-queue.ts diff --git a/packages/libp2p/src/utils/peer-job-queue.ts b/packages/libp2p/src/utils/peer-job-queue.ts new file mode 100644 index 0000000000..a15effa9aa --- /dev/null +++ b/packages/libp2p/src/utils/peer-job-queue.ts @@ -0,0 +1,119 @@ +/* eslint-disable @typescript-eslint/no-non-null-assertion */ + +import { CodeError } from '@libp2p/interfaces/errors' +import PQueue from 'p-queue' +import { codes } from '../errors.js' +import type { PeerId } from '@libp2p/interface-peer-id' +import type { QueueAddOptions, Options, Queue } from 'p-queue' + +// Port of lower_bound from https://en.cppreference.com/w/cpp/algorithm/lower_bound +// Used to compute insertion index to keep queue sorted after insertion +function lowerBound (array: readonly T[], value: T, comparator: (a: T, b: T) => number): number { + let first = 0 + let count = array.length + + while (count > 0) { + const step = Math.trunc(count / 2) + let it = first + step + + if (comparator(array[it]!, value) <= 0) { + first = ++it + count -= step + 1 + } else { + count = step + } + } + + return first +} + +interface RunFunction { (): Promise } + +export interface PeerPriorityQueueOptions extends QueueAddOptions { + peerId: PeerId +} + +interface PeerJob { + priority: number + peerId: PeerId + run: RunFunction +} + +/** + * Port of https://github.com/sindresorhus/p-queue/blob/main/source/priority-queue.ts + * that adds support for filtering jobs by peer id + */ +class PeerPriorityQueue implements Queue { + readonly #queue: PeerJob[] = [] + + enqueue (run: RunFunction, options?: Partial): void { + const peerId = options?.peerId + const priority = options?.priority ?? 0 + + if (peerId == null) { + throw new CodeError('missing peer id', codes.ERR_INVALID_PARAMETERS) + } + + const element: PeerJob = { + priority, + peerId, + run + } + + if (this.size > 0 && this.#queue[this.size - 1]!.priority >= priority) { + this.#queue.push(element) + return + } + + const index = lowerBound( + this.#queue, element, + (a: Readonly, b: Readonly) => b.priority! - a.priority! + ) + this.#queue.splice(index, 0, element) + } + + dequeue (): RunFunction | undefined { + const item = this.#queue.shift() + return item?.run + } + + filter (options: Readonly>): RunFunction[] { + if (options.peerId != null) { + const peerId = options.peerId + + return this.#queue.filter( + (element: Readonly) => peerId.equals(element.peerId) + ).map((element: Readonly<{ run: RunFunction }>) => element.run) + } + + return this.#queue.filter( + (element: Readonly) => element.priority === options.priority + ).map((element: Readonly<{ run: RunFunction }>) => element.run) + } + + get size (): number { + return this.#queue.length + } +} + +/** + * Extends PQueue to add support for querying queued jobs by peer id + */ +export class PeerJobQueue extends PQueue { + constructor (options: Options = {}) { + super({ + ...options, + queueClass: PeerPriorityQueue + }) + } + + /** + * Returns true if this queue has a job for the passed peer id that has not yet + * started to run + */ + hasJob (peerId: PeerId): boolean { + return this.sizeBy({ + peerId + }) > 0 + } +}