diff --git a/packages/crypto/package.json b/packages/crypto/package.json index f9d7831dec..5dca154ed9 100644 --- a/packages/crypto/package.json +++ b/packages/crypto/package.json @@ -76,7 +76,7 @@ "scripts": { "clean": "aegir clean", "lint": "aegir lint", - "dep-check": "aegir dep-check -i protons", + "dep-check": "aegir dep-check", "build": "aegir build", "test": "aegir test", "test:chrome": "aegir test -t browser", @@ -89,15 +89,14 @@ "generate": "protons ./src/keys/keys.proto" }, "dependencies": { - "@libp2p/interface-keys": "^1.0.0", - "@libp2p/interfaces": "^3.0.0", + "@libp2p/interface": "~0.0.1", "@noble/ed25519": "^1.6.0", "@noble/secp256k1": "^1.5.4", - "multiformats": "^11.0.2", + "multiformats": "^12.0.1", "node-forge": "^1.1.0", "protons-runtime": "^5.0.0", "uint8arraylist": "^2.4.3", - "uint8arrays": "^4.0.3" + "uint8arrays": "^4.0.4" }, "devDependencies": { "@types/mocha": "^10.0.0", diff --git a/packages/crypto/src/aes/cipher-mode.ts b/packages/crypto/src/aes/cipher-mode.ts index b420deed54..95eefd8cf0 100644 --- a/packages/crypto/src/aes/cipher-mode.ts +++ b/packages/crypto/src/aes/cipher-mode.ts @@ -1,4 +1,4 @@ -import { CodeError } from '@libp2p/interfaces/errors' +import { CodeError } from '@libp2p/interface/errors' const CIPHER_MODES = { 16: 'aes-128-ctr', diff --git a/packages/crypto/src/keys/ecdh-browser.ts b/packages/crypto/src/keys/ecdh-browser.ts index c371429f33..e5c8c72edb 100644 --- a/packages/crypto/src/keys/ecdh-browser.ts +++ b/packages/crypto/src/keys/ecdh-browser.ts @@ -1,4 +1,4 @@ -import { CodeError } from '@libp2p/interfaces/errors' +import { CodeError } from '@libp2p/interface/errors' import { concat as uint8ArrayConcat } from 'uint8arrays/concat' import { equals as uint8ArrayEquals } from 'uint8arrays/equals' import { toString as uint8ArrayToString } from 'uint8arrays/to-string' diff --git a/packages/crypto/src/keys/ecdh.ts b/packages/crypto/src/keys/ecdh.ts index 5e139f4e08..d5e52e262d 100644 --- a/packages/crypto/src/keys/ecdh.ts +++ b/packages/crypto/src/keys/ecdh.ts @@ -1,5 +1,5 @@ import crypto from 'crypto' -import { CodeError } from '@libp2p/interfaces/errors' +import { CodeError } from '@libp2p/interface/errors' import type { ECDHKey, ECDHKeyPair } from './interface.js' const curves = { diff --git a/packages/crypto/src/keys/ed25519-class.ts b/packages/crypto/src/keys/ed25519-class.ts index baae1bc188..ef759977ce 100644 --- a/packages/crypto/src/keys/ed25519-class.ts +++ b/packages/crypto/src/keys/ed25519-class.ts @@ -1,4 +1,4 @@ -import { CodeError } from '@libp2p/interfaces/errors' +import { CodeError } from '@libp2p/interface/errors' import { base58btc } from 'multiformats/bases/base58' import { identity } from 'multiformats/hashes/identity' import { sha256 } from 'multiformats/hashes/sha2' diff --git a/packages/crypto/src/keys/index.ts b/packages/crypto/src/keys/index.ts index 7a15d0d480..78be11572c 100644 --- a/packages/crypto/src/keys/index.ts +++ b/packages/crypto/src/keys/index.ts @@ -1,6 +1,6 @@ import 'node-forge/lib/asn1.js' import 'node-forge/lib/pbe.js' -import { CodeError } from '@libp2p/interfaces/errors' +import { CodeError } from '@libp2p/interface/errors' // @ts-expect-error types are missing import forge from 'node-forge/lib/forge.js' import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' @@ -11,7 +11,7 @@ import { keyStretcher } from './key-stretcher.js' import * as keysPBM from './keys.js' import * as RSA from './rsa-class.js' import * as Secp256k1 from './secp256k1-class.js' -import type { PrivateKey, PublicKey } from '@libp2p/interface-keys' +import type { PrivateKey, PublicKey } from '@libp2p/interface/keys' export { keyStretcher } export { generateEphemeralKeyPair } diff --git a/packages/crypto/src/keys/key-stretcher.ts b/packages/crypto/src/keys/key-stretcher.ts index c1feefcf0b..3b04f9c57e 100644 --- a/packages/crypto/src/keys/key-stretcher.ts +++ b/packages/crypto/src/keys/key-stretcher.ts @@ -1,4 +1,4 @@ -import { CodeError } from '@libp2p/interfaces/errors' +import { CodeError } from '@libp2p/interface/errors' import { concat as uint8ArrayConcat } from 'uint8arrays/concat' import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' import * as hmac from '../hmac/index.js' diff --git a/packages/crypto/src/keys/rsa-browser.ts b/packages/crypto/src/keys/rsa-browser.ts index a17eae884c..193913aa9a 100644 --- a/packages/crypto/src/keys/rsa-browser.ts +++ b/packages/crypto/src/keys/rsa-browser.ts @@ -1,4 +1,4 @@ -import { CodeError } from '@libp2p/interfaces/errors' +import { CodeError } from '@libp2p/interface/errors' import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' import { toString as uint8ArrayToString } from 'uint8arrays/to-string' import randomBytes from '../random-bytes.js' diff --git a/packages/crypto/src/keys/rsa-class.ts b/packages/crypto/src/keys/rsa-class.ts index dd25257037..7e9d7d8812 100644 --- a/packages/crypto/src/keys/rsa-class.ts +++ b/packages/crypto/src/keys/rsa-class.ts @@ -1,5 +1,5 @@ -import { CodeError } from '@libp2p/interfaces/errors' +import { CodeError } from '@libp2p/interface/errors' import { sha256 } from 'multiformats/hashes/sha2' // @ts-expect-error types are missing import forge from 'node-forge/lib/forge.js' diff --git a/packages/crypto/src/keys/rsa-utils.ts b/packages/crypto/src/keys/rsa-utils.ts index c818362379..70b97c7401 100644 --- a/packages/crypto/src/keys/rsa-utils.ts +++ b/packages/crypto/src/keys/rsa-utils.ts @@ -1,6 +1,6 @@ import 'node-forge/lib/asn1.js' import 'node-forge/lib/rsa.js' -import { CodeError } from '@libp2p/interfaces/errors' +import { CodeError } from '@libp2p/interface/errors' // @ts-expect-error types are missing import forge from 'node-forge/lib/forge.js' import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' diff --git a/packages/crypto/src/keys/rsa.ts b/packages/crypto/src/keys/rsa.ts index 619874bcd3..a2411ef382 100644 --- a/packages/crypto/src/keys/rsa.ts +++ b/packages/crypto/src/keys/rsa.ts @@ -1,6 +1,6 @@ import crypto from 'crypto' import { promisify } from 'util' -import { CodeError } from '@libp2p/interfaces/errors' +import { CodeError } from '@libp2p/interface/errors' import randomBytes from '../random-bytes.js' import * as utils from './rsa-utils.js' import type { JWKKeyPair } from './interface.js' diff --git a/packages/crypto/src/keys/secp256k1-class.ts b/packages/crypto/src/keys/secp256k1-class.ts index 8df62b487c..bda3da757f 100644 --- a/packages/crypto/src/keys/secp256k1-class.ts +++ b/packages/crypto/src/keys/secp256k1-class.ts @@ -1,4 +1,4 @@ -import { CodeError } from '@libp2p/interfaces/errors' +import { CodeError } from '@libp2p/interface/errors' import { sha256 } from 'multiformats/hashes/sha2' import { equals as uint8ArrayEquals } from 'uint8arrays/equals' import { toString as uint8ArrayToString } from 'uint8arrays/to-string' diff --git a/packages/crypto/src/keys/secp256k1.ts b/packages/crypto/src/keys/secp256k1.ts index a41207a89b..e69f38bb8e 100644 --- a/packages/crypto/src/keys/secp256k1.ts +++ b/packages/crypto/src/keys/secp256k1.ts @@ -1,4 +1,4 @@ -import { CodeError } from '@libp2p/interfaces/errors' +import { CodeError } from '@libp2p/interface/errors' import * as secp from '@noble/secp256k1' import { sha256 } from 'multiformats/hashes/sha2' diff --git a/packages/crypto/src/pbkdf2.ts b/packages/crypto/src/pbkdf2.ts index fe2add7dcc..c7b6a5702f 100644 --- a/packages/crypto/src/pbkdf2.ts +++ b/packages/crypto/src/pbkdf2.ts @@ -1,4 +1,4 @@ -import { CodeError } from '@libp2p/interfaces/errors' +import { CodeError } from '@libp2p/interface/errors' // @ts-expect-error types are missing import forgePbkdf2 from 'node-forge/lib/pbkdf2.js' // @ts-expect-error types are missing diff --git a/packages/crypto/src/random-bytes.ts b/packages/crypto/src/random-bytes.ts index 7352dfe071..ac79f298d2 100644 --- a/packages/crypto/src/random-bytes.ts +++ b/packages/crypto/src/random-bytes.ts @@ -1,4 +1,4 @@ -import { CodeError } from '@libp2p/interfaces/errors' +import { CodeError } from '@libp2p/interface/errors' import { utils } from '@noble/secp256k1' export default function randomBytes (length: number): Uint8Array { diff --git a/packages/crypto/tsconfig.json b/packages/crypto/tsconfig.json index 0051483a8d..4c0bdf7723 100644 --- a/packages/crypto/tsconfig.json +++ b/packages/crypto/tsconfig.json @@ -9,10 +9,7 @@ ], "references": [ { - "path": "../interface-keys" - }, - { - "path": "../interfaces" + "path": "../interface" } ] } diff --git a/packages/interface-address-manager/CHANGELOG.md b/packages/interface-address-manager/CHANGELOG.md deleted file mode 100644 index 6ecab8d4eb..0000000000 --- a/packages/interface-address-manager/CHANGELOG.md +++ /dev/null @@ -1,111 +0,0 @@ -## [@libp2p/interface-address-manager-v3.0.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-address-manager-v3.0.0...@libp2p/interface-address-manager-v3.0.1) (2023-05-04) - - -### Dependencies - -* bump aegir from 38.1.8 to 39.0.5 ([#393](https://github.com/libp2p/js-libp2p-interfaces/issues/393)) ([31f3797](https://github.com/libp2p/js-libp2p-interfaces/commit/31f3797b24f7c23f3f16e9db3a230bd5f7cd5175)) - -## [@libp2p/interface-address-manager-v3.0.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-address-manager-v2.0.5...@libp2p/interface-address-manager-v3.0.0) (2023-04-21) - - -### ⚠ BREAKING CHANGES - -* add libp2p events (#373) - -### Features - -* add libp2p events ([#373](https://github.com/libp2p/js-libp2p-interfaces/issues/373)) ([071c718](https://github.com/libp2p/js-libp2p-interfaces/commit/071c718808902858818ca86167b51b242b67a5a5)) - -## [@libp2p/interface-address-manager-v2.0.5](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-address-manager-v2.0.4...@libp2p/interface-address-manager-v2.0.5) (2023-03-17) - - -### Dependencies - -* update @multiformats/multiaddr to 12.0.0 ([#354](https://github.com/libp2p/js-libp2p-interfaces/issues/354)) ([e0f327b](https://github.com/libp2p/js-libp2p-interfaces/commit/e0f327b5d54e240feabadce21a841629d633ec5e)) - -## [@libp2p/interface-address-manager-v2.0.4](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-address-manager-v2.0.3...@libp2p/interface-address-manager-v2.0.4) (2023-01-18) - - -### Trivial Changes - -* remove lerna ([#330](https://github.com/libp2p/js-libp2p-interfaces/issues/330)) ([6678592](https://github.com/libp2p/js-libp2p-interfaces/commit/6678592dd0cf601a2671852f9d2a0aff5dee2b18)) - - -### Dependencies - -* bump aegir from 37.12.1 to 38.1.0 ([#335](https://github.com/libp2p/js-libp2p-interfaces/issues/335)) ([7368a36](https://github.com/libp2p/js-libp2p-interfaces/commit/7368a363423a08e8fa247dcb76ea13e4cf030d65)) - -## [@libp2p/interface-address-manager-v2.0.3](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-address-manager-v2.0.2...@libp2p/interface-address-manager-v2.0.3) (2022-12-16) - - -### Documentation - -* update project config ([#323](https://github.com/libp2p/js-libp2p-interfaces/issues/323)) ([0fc6a08](https://github.com/libp2p/js-libp2p-interfaces/commit/0fc6a08e9cdcefe361fe325281a3a2a03759ff59)) - -## [@libp2p/interface-address-manager-v2.0.2](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-address-manager-v2.0.1...@libp2p/interface-address-manager-v2.0.2) (2022-12-14) - - -### Bug Fixes - -* generate docs for all packages ([#321](https://github.com/libp2p/js-libp2p-interfaces/issues/321)) ([b6f8b32](https://github.com/libp2p/js-libp2p-interfaces/commit/b6f8b32a920c15a28fe021e6050e31aaae89d518)) - - -### Dependencies - -* update sibling dependencies ([947cedc](https://github.com/libp2p/js-libp2p-interfaces/commit/947cedcc25aa147768ee5b76577d069491db6ef6)) - -## [@libp2p/interface-address-manager-v2.0.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-address-manager-v2.0.0...@libp2p/interface-address-manager-v2.0.1) (2022-11-05) - - -### Bug Fixes - -* update project config ([#311](https://github.com/libp2p/js-libp2p-interfaces/issues/311)) ([27dd0ce](https://github.com/libp2p/js-libp2p-interfaces/commit/27dd0ce3c249892ac69cbb24ddaf0b9f32385e37)) - -## [@libp2p/interface-address-manager-v2.0.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-address-manager-v1.0.3...@libp2p/interface-address-manager-v2.0.0) (2022-10-07) - - -### ⚠ BREAKING CHANGES - -* add observed address methods (#269) - -### Features - -* add observed address methods ([#269](https://github.com/libp2p/js-libp2p-interfaces/issues/269)) ([0b157d5](https://github.com/libp2p/js-libp2p-interfaces/commit/0b157d5666caaaaa8676265cab3e4b010872ee41)) - -## [@libp2p/interface-address-manager-v1.0.3](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-address-manager-v1.0.2...@libp2p/interface-address-manager-v1.0.3) (2022-09-21) - - -### Trivial Changes - -* update project config ([#271](https://github.com/libp2p/js-libp2p-interfaces/issues/271)) ([59c0bf5](https://github.com/libp2p/js-libp2p-interfaces/commit/59c0bf5e0b05496fca2e4902632b61bb41fad9e9)) - - -### Dependencies - -* update @multiformats/multiaddr to 11.0.0 ([#288](https://github.com/libp2p/js-libp2p-interfaces/issues/288)) ([57b2ad8](https://github.com/libp2p/js-libp2p-interfaces/commit/57b2ad88edfc7807311143791bc49270b1a81eaf)) - -## [@libp2p/interface-address-manager-v1.0.2](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-address-manager-v1.0.1...@libp2p/interface-address-manager-v1.0.2) (2022-06-27) - - -### Trivial Changes - -* update deps ([#262](https://github.com/libp2p/js-libp2p-interfaces/issues/262)) ([51edf7d](https://github.com/libp2p/js-libp2p-interfaces/commit/51edf7d9b3765a6f75c915b1483ea345d0133a41)) - -## [@libp2p/interface-address-manager-v1.0.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-address-manager-v1.0.0...@libp2p/interface-address-manager-v1.0.1) (2022-06-14) - - -### Trivial Changes - -* update aegir ([#234](https://github.com/libp2p/js-libp2p-interfaces/issues/234)) ([3e03895](https://github.com/libp2p/js-libp2p-interfaces/commit/3e038959ecab6cfa3585df9ee179c0af7a61eda5)) -* update readmes ([#233](https://github.com/libp2p/js-libp2p-interfaces/issues/233)) ([ee7da38](https://github.com/libp2p/js-libp2p-interfaces/commit/ee7da38dccc08160d26c8436df8739ce7e0b340e)) - -## @libp2p/interface-address-manager-v1.0.0 (2022-06-14) - - -### ⚠ BREAKING CHANGES - -* most modules have been split out of the `@libp2p/interfaces` and `@libp2p/interface-compliance-tests` packages - -### Trivial Changes - -* break modules apart ([#232](https://github.com/libp2p/js-libp2p-interfaces/issues/232)) ([385614e](https://github.com/libp2p/js-libp2p-interfaces/commit/385614e772329052ab17415c8bd421f65b01a61b)), closes [#226](https://github.com/libp2p/js-libp2p-interfaces/issues/226) diff --git a/packages/interface-address-manager/README.md b/packages/interface-address-manager/README.md deleted file mode 100644 index 9e1e6911ff..0000000000 --- a/packages/interface-address-manager/README.md +++ /dev/null @@ -1,43 +0,0 @@ -# @libp2p/interface-address-manager - -[![libp2p.io](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](http://libp2p.io/) -[![Discuss](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg?style=flat-square)](https://discuss.libp2p.io) -[![codecov](https://img.shields.io/codecov/c/github/libp2p/js-libp2p.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p) -[![CI](https://img.shields.io/github/actions/workflow/status/libp2p/js-libp2p/main.yml?branch=master\&style=flat-square)](https://github.com/libp2p/js-libp2p/actions/workflows/main.yml?query=branch%3Amaster) - -> Address Manager interface for libp2p - -## Table of contents - -- [Install](#install) -- [Usage](#usage) -- [API Docs](#api-docs) -- [License](#license) -- [Contribution](#contribution) - -## Install - -```console -$ npm i @libp2p/interface-address-manager -``` - -## Usage - -```js -import type { AddressManager } from '@libp2p/interfaces-address-manager' -``` - -## API Docs - -- - -## License - -Licensed under either of - -- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / ) -- MIT ([LICENSE-MIT](LICENSE-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/packages/interface-address-manager/package.json b/packages/interface-address-manager/package.json deleted file mode 100644 index 7452506c40..0000000000 --- a/packages/interface-address-manager/package.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "name": "@libp2p/interface-address-manager", - "version": "3.0.1", - "description": "Address Manager interface for libp2p", - "license": "Apache-2.0 OR MIT", - "homepage": "https://github.com/libp2p/js-libp2p/tree/master/packages/interface-address-manager#readme", - "repository": { - "type": "git", - "url": "git+https://github.com/libp2p/js-libp2p.git" - }, - "bugs": { - "url": "https://github.com/libp2p/js-libp2p/issues" - }, - "keywords": [ - "interface", - "libp2p" - ], - "type": "module", - "types": "./dist/src/index.d.ts", - "files": [ - "src", - "dist", - "!dist/test", - "!**/*.tsbuildinfo" - ], - "exports": { - ".": { - "types": "./dist/src/index.d.ts", - "import": "./dist/src/index.js" - } - }, - "eslintConfig": { - "extends": "ipfs", - "parserOptions": { - "sourceType": "module" - } - }, - "scripts": { - "clean": "aegir clean", - "lint": "aegir lint", - "dep-check": "aegir dep-check", - "build": "aegir build" - }, - "dependencies": { - "@multiformats/multiaddr": "^12.1.3" - }, - "devDependencies": { - "aegir": "^39.0.10" - }, - "typedoc": { - "entryPoint": "./src/index.ts" - } -} diff --git a/packages/interface-address-manager/tsconfig.json b/packages/interface-address-manager/tsconfig.json deleted file mode 100644 index 5fe8ea40d7..0000000000 --- a/packages/interface-address-manager/tsconfig.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "aegir/src/config/tsconfig.aegir.json", - "compilerOptions": { - "outDir": "dist" - }, - "include": [ - "src" - ] -} diff --git a/packages/interface-compliance-tests/README.md b/packages/interface-compliance-tests/README.md index aab1b18825..906d059731 100644 --- a/packages/interface-compliance-tests/README.md +++ b/packages/interface-compliance-tests/README.md @@ -10,6 +10,7 @@ ## Table of contents - [Install](#install) + - [Browser ` +``` + ## Usage Each [interface](https://npmjs.org/packages/@libp2p/interfaces) has its documentation on how to use the compliance tests and should be used as the source of truth. diff --git a/packages/interface-compliance-tests/package.json b/packages/interface-compliance-tests/package.json index 22123fb6ae..a0a8fabb2b 100644 --- a/packages/interface-compliance-tests/package.json +++ b/packages/interface-compliance-tests/package.json @@ -44,13 +44,37 @@ "types": "./dist/src/index.d.ts", "import": "./dist/src/index.js" }, + "./connection": { + "types": "./dist/src/connection/index.d.ts", + "import": "./dist/src/connection/index.js" + }, + "./connection-encryption": { + "types": "./dist/src/connection-encryption/index.d.ts", + "import": "./dist/src/connection-encryption/index.js" + }, "./is-valid-tick": { "types": "./dist/src/is-valid-tick.d.ts", "import": "./dist/src/is-valid-tick.js" }, + "./mocks": { + "types": "./dist/src/mocks/index.d.ts", + "import": "./dist/src/mocks/index.js" + }, + "./peer-discovery": { + "types": "./dist/src/peer-discovery/index.d.ts", + "import": "./dist/src/peer-discovery/index.js" + }, "./peers": { "types": "./dist/src/peers.d.ts", "import": "./dist/src/peers.js" + }, + "./stream-muxer": { + "types": "./dist/src/stream-muxer/index.d.ts", + "import": "./dist/src/stream-muxer/index.js" + }, + "./transport": { + "types": "./dist/src/transport/index.d.ts", + "import": "./dist/src/transport/index.js" } }, "eslintConfig": { @@ -63,10 +87,47 @@ "clean": "aegir clean", "lint": "aegir lint", "dep-check": "aegir dep-check", - "build": "aegir build" + "build": "aegir build", + "test": "aegir test", + "test:chrome": "aegir test -t browser --cov", + "test:chrome-webworker": "aegir test -t webworker", + "test:firefox": "aegir test -t browser -- --browser firefox", + "test:firefox-webworker": "aegir test -t webworker -- --browser firefox", + "test:node": "aegir test -t node --cov", + "test:electron-main": "aegir test -t electron-main" }, "dependencies": { - "aegir": "^39.0.5" + "@libp2p/interface": "~0.0.1", + "@libp2p/interface-internal": "~0.0.1", + "@libp2p/logger": "^2.0.0", + "@libp2p/multistream-select": "^3.0.0", + "@libp2p/peer-collections": "^3.0.0", + "@libp2p/peer-id": "^2.0.0", + "@libp2p/peer-id-factory": "^2.0.0", + "@multiformats/multiaddr": "^12.1.3", + "abortable-iterator": "^5.0.1", + "any-signal": "^4.1.1", + "delay": "^6.0.0", + "it-all": "^3.0.2", + "it-drain": "^3.0.2", + "it-handshake": "^4.1.3", + "it-map": "^3.0.3", + "it-ndjson": "^1.0.3", + "it-pair": "^2.0.6", + "it-pipe": "^3.0.1", + "it-pushable": "^3.1.3", + "it-stream-types": "^2.0.1", + "merge-options": "^3.0.4", + "p-defer": "^4.0.0", + "p-limit": "^4.0.0", + "p-wait-for": "^5.0.2", + "sinon": "^15.1.2", + "ts-sinon": "^2.0.2", + "uint8arraylist": "^2.4.3", + "uint8arrays": "^4.0.4" + }, + "devDependencies": { + "aegir": "^39.0.10" }, "typedoc": { "entryPoint": "./src/index.ts" diff --git a/packages/interface-connection-encrypter-compliance-tests/src/index.ts b/packages/interface-compliance-tests/src/connection-encryption/index.ts similarity index 89% rename from packages/interface-connection-encrypter-compliance-tests/src/index.ts rename to packages/interface-compliance-tests/src/connection-encryption/index.ts index c622f67add..7eecbf8ef0 100644 --- a/packages/interface-connection-encrypter-compliance-tests/src/index.ts +++ b/packages/interface-compliance-tests/src/connection-encryption/index.ts @@ -1,14 +1,14 @@ -import peers from '@libp2p/interface-compliance-tests/peers' -import { UnexpectedPeerError } from '@libp2p/interface-connection-encrypter/errors' +import { UnexpectedPeerError } from '@libp2p/interface/errors' import * as PeerIdFactory from '@libp2p/peer-id-factory' import { expect } from 'aegir/chai' import all from 'it-all' import { pipe } from 'it-pipe' import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' +import peers from '../peers.js' import { createMaConnPair } from './utils/index.js' -import type { TestSetup } from '@libp2p/interface-compliance-tests' -import type { ConnectionEncrypter } from '@libp2p/interface-connection-encrypter' -import type { PeerId } from '@libp2p/interface-peer-id' +import type { TestSetup } from '../index.js' +import type { ConnectionEncrypter } from '@libp2p/interface/connection-encrypter' +import type { PeerId } from '@libp2p/interface/peer-id' export default (common: TestSetup): void => { describe('interface-connection-encrypter compliance tests', () => { diff --git a/packages/interface-connection-encrypter-compliance-tests/src/utils/index.ts b/packages/interface-compliance-tests/src/connection-encryption/utils/index.ts similarity index 91% rename from packages/interface-connection-encrypter-compliance-tests/src/utils/index.ts rename to packages/interface-compliance-tests/src/connection-encryption/utils/index.ts index 4c50901daf..6543eedc32 100644 --- a/packages/interface-connection-encrypter-compliance-tests/src/utils/index.ts +++ b/packages/interface-compliance-tests/src/connection-encryption/utils/index.ts @@ -1,6 +1,6 @@ import { multiaddr } from '@multiformats/multiaddr' import { duplexPair } from 'it-pair/duplex' -import type { MultiaddrConnection } from '@libp2p/interface-connection' +import type { MultiaddrConnection } from '@libp2p/interface/connection' import type { Duplex, Source } from 'it-stream-types' export function createMaConnPair (): [MultiaddrConnection, MultiaddrConnection] { diff --git a/packages/interface-connection-compliance-tests/src/index.ts b/packages/interface-compliance-tests/src/connection/index.ts similarity index 97% rename from packages/interface-connection-compliance-tests/src/index.ts rename to packages/interface-compliance-tests/src/connection/index.ts index 032c0ea8bb..619595687e 100644 --- a/packages/interface-connection-compliance-tests/src/index.ts +++ b/packages/interface-compliance-tests/src/connection/index.ts @@ -1,8 +1,8 @@ import { expect } from 'aegir/chai' import sinon from 'sinon' import { stubInterface } from 'ts-sinon' -import type { TestSetup } from '@libp2p/interface-compliance-tests' -import type { Connection, Stream } from '@libp2p/interface-connection' +import type { TestSetup } from '../index.js' +import type { Connection, Stream } from '@libp2p/interface/connection' export default (test: TestSetup): void => { describe('connection', () => { diff --git a/packages/interface-mocks/src/connection-encrypter.ts b/packages/interface-compliance-tests/src/mocks/connection-encrypter.ts similarity index 95% rename from packages/interface-mocks/src/connection-encrypter.ts rename to packages/interface-compliance-tests/src/mocks/connection-encrypter.ts index 281756bb06..ec2ac0effc 100644 --- a/packages/interface-mocks/src/connection-encrypter.ts +++ b/packages/interface-compliance-tests/src/mocks/connection-encrypter.ts @@ -1,11 +1,11 @@ -import { UnexpectedPeerError } from '@libp2p/interface-connection-encrypter/errors' +import { UnexpectedPeerError } from '@libp2p/interface/errors' import { peerIdFromBytes } from '@libp2p/peer-id' import { multiaddr } from '@multiformats/multiaddr' import { handshake } from 'it-handshake' import map from 'it-map' import { duplexPair } from 'it-pair/duplex' import { pipe } from 'it-pipe' -import type { ConnectionEncrypter } from '@libp2p/interface-connection-encrypter' +import type { ConnectionEncrypter } from '@libp2p/interface/connection-encrypter' import type { Transform, Source } from 'it-stream-types' // A basic transform that does nothing to the data diff --git a/packages/interface-mocks/src/connection-gater.ts b/packages/interface-compliance-tests/src/mocks/connection-gater.ts similarity index 93% rename from packages/interface-mocks/src/connection-gater.ts rename to packages/interface-compliance-tests/src/mocks/connection-gater.ts index 86b873c74c..3c62e7c30b 100644 --- a/packages/interface-mocks/src/connection-gater.ts +++ b/packages/interface-compliance-tests/src/mocks/connection-gater.ts @@ -1,4 +1,4 @@ -import type { ConnectionGater } from '@libp2p/interface-connection-gater' +import type { ConnectionGater } from '@libp2p/interface/connection-gater' export function mockConnectionGater (): ConnectionGater { return { diff --git a/packages/interface-mocks/src/connection-manager.ts b/packages/interface-compliance-tests/src/mocks/connection-manager.ts similarity index 88% rename from packages/interface-mocks/src/connection-manager.ts rename to packages/interface-compliance-tests/src/mocks/connection-manager.ts index d91f0e738a..6565dbc69a 100644 --- a/packages/interface-mocks/src/connection-manager.ts +++ b/packages/interface-compliance-tests/src/mocks/connection-manager.ts @@ -1,22 +1,20 @@ -import { isPeerId, type PeerId } from '@libp2p/interface-peer-id' -import { CodeError } from '@libp2p/interfaces/errors' +import { CodeError } from '@libp2p/interface/errors' +import { isPeerId, type PeerId } from '@libp2p/interface/peer-id' import { PeerMap } from '@libp2p/peer-collections' import { peerIdFromString } from '@libp2p/peer-id' import { isMultiaddr, type Multiaddr } from '@multiformats/multiaddr' import { connectionPair } from './connection.js' -import type { Connection } from '@libp2p/interface-connection' -import type { ConnectionManager, PendingDial } from '@libp2p/interface-connection-manager' -import type { Libp2pEvents } from '@libp2p/interface-libp2p' -import type { PubSub } from '@libp2p/interface-pubsub' -import type { Registrar } from '@libp2p/interface-registrar' -import type { EventEmitter } from '@libp2p/interfaces/events' -import type { Startable } from '@libp2p/interfaces/startable' +import type { Libp2pEvents } from '@libp2p/interface' +import type { Connection } from '@libp2p/interface/connection' +import type { EventEmitter } from '@libp2p/interface/events' +import type { Startable } from '@libp2p/interface/startable' +import type { ConnectionManager, PendingDial } from '@libp2p/interface-internal/connection-manager' +import type { Registrar } from '@libp2p/interface-internal/registrar' export interface MockNetworkComponents { peerId: PeerId registrar: Registrar connectionManager: ConnectionManager - pubsub?: PubSub events: EventEmitter } @@ -136,7 +134,7 @@ class MockConnectionManager implements ConnectionManager, Startable { for (const protocol of this.components.registrar.getProtocols()) { for (const topology of this.components.registrar.getTopologies(protocol)) { - topology.onConnect(componentsB.peerId, aToB) + topology.onConnect?.(componentsB.peerId, aToB) } } @@ -148,7 +146,7 @@ class MockConnectionManager implements ConnectionManager, Startable { for (const protocol of componentsB.registrar.getProtocols()) { for (const topology of componentsB.registrar.getTopologies(protocol)) { - topology.onConnect(this.components.peerId, bToA) + topology.onConnect?.(this.components.peerId, bToA) } } @@ -172,7 +170,7 @@ class MockConnectionManager implements ConnectionManager, Startable { for (const protocol of this.components.registrar.getProtocols()) { this.components.registrar.getTopologies(protocol).forEach(topology => { - topology.onDisconnect(componentsB.peerId) + topology.onDisconnect?.(componentsB.peerId) }) } diff --git a/packages/interface-mocks/src/connection.ts b/packages/interface-compliance-tests/src/mocks/connection.ts similarity index 94% rename from packages/interface-mocks/src/connection.ts rename to packages/interface-compliance-tests/src/mocks/connection.ts index ad9ab3a9f9..6d5bc14bfb 100644 --- a/packages/interface-mocks/src/connection.ts +++ b/packages/interface-compliance-tests/src/mocks/connection.ts @@ -1,5 +1,5 @@ -import * as STATUS from '@libp2p/interface-connection/status' -import { CodeError } from '@libp2p/interfaces/errors' +import * as STATUS from '@libp2p/interface/connection/status' +import { CodeError } from '@libp2p/interface/errors' import { logger } from '@libp2p/logger' import * as mss from '@libp2p/multistream-select' import { peerIdFromString } from '@libp2p/peer-id' @@ -8,11 +8,11 @@ import { pipe } from 'it-pipe' import { mockMultiaddrConnection } from './multiaddr-connection.js' import { mockMuxer } from './muxer.js' import { mockRegistrar } from './registrar.js' -import type { MultiaddrConnection, Connection, Stream, ConnectionStat, Direction } from '@libp2p/interface-connection' -import type { PeerId } from '@libp2p/interface-peer-id' -import type { Registrar } from '@libp2p/interface-registrar' -import type { StreamMuxer, StreamMuxerFactory } from '@libp2p/interface-stream-muxer' -import type { AbortOptions } from '@libp2p/interfaces' +import type { AbortOptions } from '@libp2p/interface' +import type { MultiaddrConnection, Connection, Stream, ConnectionStat, Direction } from '@libp2p/interface/connection' +import type { PeerId } from '@libp2p/interface/peer-id' +import type { StreamMuxer, StreamMuxerFactory } from '@libp2p/interface/stream-muxer' +import type { Registrar } from '@libp2p/interface-internal/registrar' import type { Multiaddr } from '@multiformats/multiaddr' import type { Duplex, Source } from 'it-stream-types' import type { Uint8ArrayList } from 'uint8arraylist' diff --git a/packages/interface-mocks/src/duplex.ts b/packages/interface-compliance-tests/src/mocks/duplex.ts similarity index 100% rename from packages/interface-mocks/src/duplex.ts rename to packages/interface-compliance-tests/src/mocks/duplex.ts diff --git a/packages/interface-mocks/src/index.ts b/packages/interface-compliance-tests/src/mocks/index.ts similarity index 100% rename from packages/interface-mocks/src/index.ts rename to packages/interface-compliance-tests/src/mocks/index.ts diff --git a/packages/interface-mocks/src/metrics.ts b/packages/interface-compliance-tests/src/mocks/metrics.ts similarity index 97% rename from packages/interface-mocks/src/metrics.ts rename to packages/interface-compliance-tests/src/mocks/metrics.ts index 760ac8fcf1..3129cfecd1 100644 --- a/packages/interface-mocks/src/metrics.ts +++ b/packages/interface-compliance-tests/src/mocks/metrics.ts @@ -1,5 +1,5 @@ -import type { MultiaddrConnection, Stream, Connection } from '@libp2p/interface-connection' -import type { Metric, MetricGroup, StopTimer, Metrics, CalculatedMetricOptions, MetricOptions } from '@libp2p/interface-metrics' +import type { MultiaddrConnection, Stream, Connection } from '@libp2p/interface/connection' +import type { Metric, MetricGroup, StopTimer, Metrics, CalculatedMetricOptions, MetricOptions } from '@libp2p/interface/metrics' class DefaultMetric implements Metric { public value: number = 0 diff --git a/packages/interface-mocks/src/multiaddr-connection.ts b/packages/interface-compliance-tests/src/mocks/multiaddr-connection.ts similarity index 94% rename from packages/interface-mocks/src/multiaddr-connection.ts rename to packages/interface-compliance-tests/src/mocks/multiaddr-connection.ts index 868bbee1af..5bfc94f6ae 100644 --- a/packages/interface-mocks/src/multiaddr-connection.ts +++ b/packages/interface-compliance-tests/src/mocks/multiaddr-connection.ts @@ -1,8 +1,8 @@ import { multiaddr } from '@multiformats/multiaddr' import { abortableSource } from 'abortable-iterator' import { duplexPair } from 'it-pair/duplex' -import type { MultiaddrConnection } from '@libp2p/interface-connection' -import type { PeerId } from '@libp2p/interface-peer-id' +import type { MultiaddrConnection } from '@libp2p/interface/connection' +import type { PeerId } from '@libp2p/interface/peer-id' import type { Multiaddr } from '@multiformats/multiaddr' import type { Duplex } from 'it-stream-types' diff --git a/packages/interface-mocks/src/muxer.ts b/packages/interface-compliance-tests/src/mocks/muxer.ts similarity index 98% rename from packages/interface-mocks/src/muxer.ts rename to packages/interface-compliance-tests/src/mocks/muxer.ts index 00f4370d79..f730e91b67 100644 --- a/packages/interface-mocks/src/muxer.ts +++ b/packages/interface-compliance-tests/src/mocks/muxer.ts @@ -1,4 +1,4 @@ -import { CodeError } from '@libp2p/interfaces/errors' +import { CodeError } from '@libp2p/interface/errors' import { type Logger, logger } from '@libp2p/logger' import { abortableSource } from 'abortable-iterator' import { anySignal } from 'any-signal' @@ -9,8 +9,8 @@ import { type Pushable, pushable } from 'it-pushable' import { Uint8ArrayList } from 'uint8arraylist' import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' import { toString as uint8ArrayToString } from 'uint8arrays/to-string' -import type { Stream } from '@libp2p/interface-connection' -import type { StreamMuxer, StreamMuxerFactory, StreamMuxerInit } from '@libp2p/interface-stream-muxer' +import type { Stream } from '@libp2p/interface/connection' +import type { StreamMuxer, StreamMuxerFactory, StreamMuxerInit } from '@libp2p/interface/stream-muxer' import type { Source } from 'it-stream-types' let muxers = 0 diff --git a/packages/interface-mocks/src/peer-discovery.ts b/packages/interface-compliance-tests/src/mocks/peer-discovery.ts similarity index 86% rename from packages/interface-mocks/src/peer-discovery.ts rename to packages/interface-compliance-tests/src/mocks/peer-discovery.ts index 88a39a8c81..eab17bea6d 100644 --- a/packages/interface-mocks/src/peer-discovery.ts +++ b/packages/interface-compliance-tests/src/mocks/peer-discovery.ts @@ -1,9 +1,9 @@ -import { peerDiscovery } from '@libp2p/interface-peer-discovery' -import { EventEmitter } from '@libp2p/interfaces/events' +import { EventEmitter } from '@libp2p/interface/events' +import { peerDiscovery } from '@libp2p/interface/peer-discovery' import * as PeerIdFactory from '@libp2p/peer-id-factory' import { multiaddr } from '@multiformats/multiaddr' -import type { PeerDiscovery, PeerDiscoveryEvents } from '@libp2p/interface-peer-discovery' -import type { PeerInfo } from '@libp2p/interface-peer-info' +import type { PeerDiscovery, PeerDiscoveryEvents } from '@libp2p/interface/peer-discovery' +import type { PeerInfo } from '@libp2p/interface/peer-info' interface MockDiscoveryInit { discoveryDelay?: number diff --git a/packages/interface-mocks/src/registrar.ts b/packages/interface-compliance-tests/src/mocks/registrar.ts similarity index 86% rename from packages/interface-mocks/src/registrar.ts rename to packages/interface-compliance-tests/src/mocks/registrar.ts index c6c1482533..a130224b2c 100644 --- a/packages/interface-mocks/src/registrar.ts +++ b/packages/interface-compliance-tests/src/mocks/registrar.ts @@ -1,7 +1,8 @@ import merge from 'merge-options' -import type { Connection } from '@libp2p/interface-connection' -import type { PeerId } from '@libp2p/interface-peer-id' -import type { IncomingStreamData, Registrar, StreamHandler, Topology, StreamHandlerOptions, StreamHandlerRecord } from '@libp2p/interface-registrar' +import type { Connection } from '@libp2p/interface/connection' +import type { PeerId } from '@libp2p/interface/peer-id' +import type { Topology } from '@libp2p/interface/topology' +import type { IncomingStreamData, Registrar, StreamHandler, StreamHandlerOptions, StreamHandlerRecord } from '@libp2p/interface-internal/registrar' export class MockRegistrar implements Registrar { private readonly topologies = new Map>() diff --git a/packages/interface-mocks/src/upgrader.ts b/packages/interface-compliance-tests/src/mocks/upgrader.ts similarity index 85% rename from packages/interface-mocks/src/upgrader.ts rename to packages/interface-compliance-tests/src/mocks/upgrader.ts index 7739633495..816b0532bb 100644 --- a/packages/interface-mocks/src/upgrader.ts +++ b/packages/interface-compliance-tests/src/mocks/upgrader.ts @@ -1,9 +1,9 @@ import { mockConnection } from './connection.js' -import type { Connection, MultiaddrConnection } from '@libp2p/interface-connection' -import type { Libp2pEvents } from '@libp2p/interface-libp2p' -import type { Registrar } from '@libp2p/interface-registrar' -import type { Upgrader, UpgraderOptions } from '@libp2p/interface-transport' -import type { EventEmitter } from '@libp2p/interfaces/events' +import type { Libp2pEvents } from '@libp2p/interface' +import type { Connection, MultiaddrConnection } from '@libp2p/interface/connection' +import type { EventEmitter } from '@libp2p/interface/events' +import type { Registrar } from '@libp2p/interface-internal/registrar' +import type { Upgrader, UpgraderOptions } from '@libp2p/interface-internal/upgrader' export interface MockUpgraderInit { registrar?: Registrar diff --git a/packages/interface-peer-discovery-compliance-tests/src/index.ts b/packages/interface-compliance-tests/src/peer-discovery/index.ts similarity index 92% rename from packages/interface-peer-discovery-compliance-tests/src/index.ts rename to packages/interface-compliance-tests/src/peer-discovery/index.ts index 64c751b59c..dbeee5cf87 100644 --- a/packages/interface-peer-discovery-compliance-tests/src/index.ts +++ b/packages/interface-compliance-tests/src/peer-discovery/index.ts @@ -1,10 +1,10 @@ -import { start, stop } from '@libp2p/interfaces/startable' +import { start, stop } from '@libp2p/interface/startable' import { isMultiaddr } from '@multiformats/multiaddr' import { expect } from 'aegir/chai' import delay from 'delay' import pDefer from 'p-defer' -import type { TestSetup } from '@libp2p/interface-compliance-tests' -import type { PeerDiscovery } from '@libp2p/interface-peer-discovery' +import type { TestSetup } from '../index.js' +import type { PeerDiscovery } from '@libp2p/interface/peer-discovery' export default (common: TestSetup): void => { describe('interface-peer-discovery compliance tests', () => { diff --git a/packages/interface-stream-muxer-compliance-tests/src/base-test.ts b/packages/interface-compliance-tests/src/stream-muxer/base-test.ts similarity index 96% rename from packages/interface-stream-muxer-compliance-tests/src/base-test.ts rename to packages/interface-compliance-tests/src/stream-muxer/base-test.ts index 5cda0d5451..bece038b73 100644 --- a/packages/interface-stream-muxer-compliance-tests/src/base-test.ts +++ b/packages/interface-compliance-tests/src/stream-muxer/base-test.ts @@ -1,4 +1,3 @@ -import { isValidTick } from '@libp2p/interface-compliance-tests/is-valid-tick' import { expect } from 'aegir/chai' import all from 'it-all' import drain from 'it-drain' @@ -9,9 +8,10 @@ import defer from 'p-defer' import { Uint8ArrayList } from 'uint8arraylist' import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' import { toString as uint8ArrayToString } from 'uint8arrays/to-string' -import type { TestSetup } from '@libp2p/interface-compliance-tests' -import type { Stream } from '@libp2p/interface-connection' -import type { StreamMuxerFactory } from '@libp2p/interface-stream-muxer' +import { isValidTick } from '../is-valid-tick.js' +import type { TestSetup } from '../index.js' +import type { Stream } from '@libp2p/interface/connection' +import type { StreamMuxerFactory } from '@libp2p/interface/stream-muxer' import type { Source, Duplex } from 'it-stream-types' import type { DeferredPromise } from 'p-defer' diff --git a/packages/interface-stream-muxer-compliance-tests/src/close-test.ts b/packages/interface-compliance-tests/src/stream-muxer/close-test.ts similarity index 98% rename from packages/interface-stream-muxer-compliance-tests/src/close-test.ts rename to packages/interface-compliance-tests/src/stream-muxer/close-test.ts index e75d047e9d..8122ba712c 100644 --- a/packages/interface-stream-muxer-compliance-tests/src/close-test.ts +++ b/packages/interface-compliance-tests/src/stream-muxer/close-test.ts @@ -9,8 +9,8 @@ import { pipe } from 'it-pipe' import pDefer from 'p-defer' import { Uint8ArrayList } from 'uint8arraylist' import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' -import type { TestSetup } from '@libp2p/interface-compliance-tests' -import type { StreamMuxerFactory } from '@libp2p/interface-stream-muxer' +import type { TestSetup } from '../index.js' +import type { StreamMuxerFactory } from '@libp2p/interface/stream-muxer' function randomBuffer (): Uint8Array { return uint8ArrayFromString(Math.random().toString()) diff --git a/packages/interface-stream-muxer-compliance-tests/src/index.ts b/packages/interface-compliance-tests/src/stream-muxer/index.ts similarity index 74% rename from packages/interface-stream-muxer-compliance-tests/src/index.ts rename to packages/interface-compliance-tests/src/stream-muxer/index.ts index 016637421b..570eed96a2 100644 --- a/packages/interface-stream-muxer-compliance-tests/src/index.ts +++ b/packages/interface-compliance-tests/src/stream-muxer/index.ts @@ -2,8 +2,8 @@ import baseTest from './base-test.js' import closeTest from './close-test.js' import megaStressTest from './mega-stress-test.js' import stressTest from './stress-test.js' -import type { TestSetup } from '@libp2p/interface-compliance-tests' -import type { StreamMuxerFactory } from '@libp2p/interface-stream-muxer' +import type { TestSetup } from '../index.js' +import type { StreamMuxerFactory } from '@libp2p/interface/stream-muxer' export default (common: TestSetup): void => { describe('interface-stream-muxer', () => { diff --git a/packages/interface-stream-muxer-compliance-tests/src/mega-stress-test.ts b/packages/interface-compliance-tests/src/stream-muxer/mega-stress-test.ts similarity index 82% rename from packages/interface-stream-muxer-compliance-tests/src/mega-stress-test.ts rename to packages/interface-compliance-tests/src/stream-muxer/mega-stress-test.ts index 1d86075b53..97b8956a6c 100644 --- a/packages/interface-stream-muxer-compliance-tests/src/mega-stress-test.ts +++ b/packages/interface-compliance-tests/src/stream-muxer/mega-stress-test.ts @@ -1,6 +1,6 @@ import spawn from './spawner.js' -import type { TestSetup } from '@libp2p/interface-compliance-tests' -import type { StreamMuxer, StreamMuxerFactory, StreamMuxerInit } from '@libp2p/interface-stream-muxer' +import type { TestSetup } from '../index.js' +import type { StreamMuxer, StreamMuxerFactory, StreamMuxerInit } from '@libp2p/interface/stream-muxer' export default (common: TestSetup): void => { const createMuxer = async (init?: StreamMuxerInit): Promise => { diff --git a/packages/interface-stream-muxer-compliance-tests/src/spawner.ts b/packages/interface-compliance-tests/src/stream-muxer/spawner.ts similarity index 98% rename from packages/interface-stream-muxer-compliance-tests/src/spawner.ts rename to packages/interface-compliance-tests/src/stream-muxer/spawner.ts index da16361867..140ce234c0 100644 --- a/packages/interface-stream-muxer-compliance-tests/src/spawner.ts +++ b/packages/interface-compliance-tests/src/stream-muxer/spawner.ts @@ -6,7 +6,7 @@ import { pipe } from 'it-pipe' import pLimit from 'p-limit' import { Uint8ArrayList } from 'uint8arraylist' import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' -import type { StreamMuxer, StreamMuxerInit } from '@libp2p/interface-stream-muxer' +import type { StreamMuxer, StreamMuxerInit } from '@libp2p/interface/stream-muxer' export default async (createMuxer: (init?: StreamMuxerInit) => Promise, nStreams: number, nMsg: number, limit?: number): Promise => { const [dialerSocket, listenerSocket] = duplexPair() diff --git a/packages/interface-stream-muxer-compliance-tests/src/stress-test.ts b/packages/interface-compliance-tests/src/stream-muxer/stress-test.ts similarity index 92% rename from packages/interface-stream-muxer-compliance-tests/src/stress-test.ts rename to packages/interface-compliance-tests/src/stream-muxer/stress-test.ts index c3b3ca4aa8..cd2f4d4d1c 100644 --- a/packages/interface-stream-muxer-compliance-tests/src/stress-test.ts +++ b/packages/interface-compliance-tests/src/stream-muxer/stress-test.ts @@ -1,6 +1,6 @@ import spawn from './spawner.js' -import type { TestSetup } from '@libp2p/interface-compliance-tests' -import type { StreamMuxerFactory, StreamMuxerInit, StreamMuxer } from '@libp2p/interface-stream-muxer' +import type { TestSetup } from '../index.js' +import type { StreamMuxerFactory, StreamMuxerInit, StreamMuxer } from '@libp2p/interface/stream-muxer' export default (common: TestSetup): void => { const createMuxer = async (init?: StreamMuxerInit): Promise => { diff --git a/packages/interface-transport-compliance-tests/src/dial-test.ts b/packages/interface-compliance-tests/src/transport/dial-test.ts similarity index 88% rename from packages/interface-transport-compliance-tests/src/dial-test.ts rename to packages/interface-compliance-tests/src/transport/dial-test.ts index 855d911f78..b11d4a8b55 100644 --- a/packages/interface-transport-compliance-tests/src/dial-test.ts +++ b/packages/interface-compliance-tests/src/transport/dial-test.ts @@ -1,17 +1,17 @@ -import { isValidTick } from '@libp2p/interface-compliance-tests/is-valid-tick' -import { mockUpgrader, mockRegistrar } from '@libp2p/interface-mocks' -import { AbortError } from '@libp2p/interfaces/errors' -import { EventEmitter } from '@libp2p/interfaces/events' +import { AbortError } from '@libp2p/interface/errors' +import { EventEmitter } from '@libp2p/interface/events' import { expect } from 'aegir/chai' import all from 'it-all' import drain from 'it-drain' import { pipe } from 'it-pipe' import sinon from 'sinon' import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' +import { isValidTick } from '../is-valid-tick.js' +import { mockUpgrader, mockRegistrar } from '../mocks/index.js' import type { TransportTestFixtures, Connector } from './index.js' -import type { TestSetup } from '@libp2p/interface-compliance-tests' -import type { Registrar } from '@libp2p/interface-registrar' -import type { Transport, Listener, Upgrader } from '@libp2p/interface-transport' +import type { TestSetup } from '../index.js' +import type { Listener, Transport, Upgrader } from '@libp2p/interface/transport' +import type { Registrar } from '@libp2p/interface-internal/registrar' import type { Multiaddr } from '@multiformats/multiaddr' export default (common: TestSetup): void => { diff --git a/packages/interface-transport-compliance-tests/src/filter-test.ts b/packages/interface-compliance-tests/src/transport/filter-test.ts similarity index 82% rename from packages/interface-transport-compliance-tests/src/filter-test.ts rename to packages/interface-compliance-tests/src/transport/filter-test.ts index 713f86f00d..787353ad48 100644 --- a/packages/interface-transport-compliance-tests/src/filter-test.ts +++ b/packages/interface-compliance-tests/src/transport/filter-test.ts @@ -1,7 +1,7 @@ import { expect } from 'aegir/chai' import type { TransportTestFixtures } from './index.js' -import type { TestSetup } from '@libp2p/interface-compliance-tests' -import type { Transport } from '@libp2p/interface-transport' +import type { TestSetup } from '../index.js' +import type { Transport } from '@libp2p/interface/transport' import type { Multiaddr } from '@multiformats/multiaddr' export default (common: TestSetup): void => { diff --git a/packages/interface-transport-compliance-tests/src/index.ts b/packages/interface-compliance-tests/src/transport/index.ts similarity index 80% rename from packages/interface-transport-compliance-tests/src/index.ts rename to packages/interface-compliance-tests/src/transport/index.ts index 59ff8b02c1..d2b9525687 100644 --- a/packages/interface-transport-compliance-tests/src/index.ts +++ b/packages/interface-compliance-tests/src/transport/index.ts @@ -1,8 +1,8 @@ import dial from './dial-test.js' import filter from './filter-test.js' import listen from './listen-test.js' -import type { TestSetup } from '@libp2p/interface-compliance-tests' -import type { Transport } from '@libp2p/interface-transport' +import type { TestSetup } from '../index.js' +import type { Transport } from '@libp2p/interface/transport' import type { Multiaddr } from '@multiformats/multiaddr' export interface Connector { diff --git a/packages/interface-transport-compliance-tests/src/listen-test.ts b/packages/interface-compliance-tests/src/transport/listen-test.ts similarity index 91% rename from packages/interface-transport-compliance-tests/src/listen-test.ts rename to packages/interface-compliance-tests/src/transport/listen-test.ts index d507e2ca0d..bb6800c696 100644 --- a/packages/interface-transport-compliance-tests/src/listen-test.ts +++ b/packages/interface-compliance-tests/src/transport/listen-test.ts @@ -1,7 +1,5 @@ /* eslint max-nested-callbacks: ["error", 8] */ -import { isValidTick } from '@libp2p/interface-compliance-tests/is-valid-tick' -import { mockUpgrader, mockRegistrar } from '@libp2p/interface-mocks' -import { CustomEvent, EventEmitter } from '@libp2p/interfaces/events' +import { CustomEvent, EventEmitter } from '@libp2p/interface/events' import { expect } from 'aegir/chai' import drain from 'it-drain' import { pipe } from 'it-pipe' @@ -9,11 +7,13 @@ import defer from 'p-defer' import pWaitFor from 'p-wait-for' import sinon from 'sinon' import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' +import { isValidTick } from '../is-valid-tick.js' +import { mockUpgrader, mockRegistrar } from '../mocks/index.js' import type { TransportTestFixtures } from './index.js' -import type { TestSetup } from '@libp2p/interface-compliance-tests' -import type { Connection } from '@libp2p/interface-connection' -import type { Registrar } from '@libp2p/interface-registrar' -import type { Transport, Upgrader } from '@libp2p/interface-transport' +import type { TestSetup } from '../index.js' +import type { Connection } from '@libp2p/interface/connection' +import type { Transport, Upgrader } from '@libp2p/interface/transport' +import type { Registrar } from '@libp2p/interface-internal/registrar' import type { Multiaddr } from '@multiformats/multiaddr' export default (common: TestSetup): void => { diff --git a/packages/interface-mocks/test/connection-encrypter.spec.ts b/packages/interface-compliance-tests/test/mocks/connection-encrypter.spec.ts similarity index 54% rename from packages/interface-mocks/test/connection-encrypter.spec.ts rename to packages/interface-compliance-tests/test/mocks/connection-encrypter.spec.ts index 73f0ca513e..6911f41af0 100644 --- a/packages/interface-mocks/test/connection-encrypter.spec.ts +++ b/packages/interface-compliance-tests/test/mocks/connection-encrypter.spec.ts @@ -1,5 +1,5 @@ -import tests from '@libp2p/interface-connection-encrypter-compliance-tests' -import { mockConnectionEncrypter } from '../src/connection-encrypter.js' +import tests from '../../src/connection-encryption/index.js' +import { mockConnectionEncrypter } from '../../src/mocks/connection-encrypter.js' describe('mock connection encrypter compliance tests', () => { tests({ diff --git a/packages/interface-mocks/test/connection.spec.ts b/packages/interface-compliance-tests/test/mocks/connection.spec.ts similarity index 77% rename from packages/interface-mocks/test/connection.spec.ts rename to packages/interface-compliance-tests/test/mocks/connection.spec.ts index 901d641fb8..744c0486f6 100644 --- a/packages/interface-mocks/test/connection.spec.ts +++ b/packages/interface-compliance-tests/test/mocks/connection.spec.ts @@ -1,9 +1,9 @@ -import tests from '@libp2p/interface-connection-compliance-tests' import { createEd25519PeerId } from '@libp2p/peer-id-factory' import { pipe } from 'it-pipe' -import { connectionPair } from '../src/connection.js' -import { mockRegistrar } from '../src/registrar.js' -import type { Connection } from '@libp2p/interface-connection' +import tests from '../../src/connection/index.js' +import { connectionPair } from '../../src/mocks/connection.js' +import { mockRegistrar } from '../../src/mocks/registrar.js' +import type { Connection } from '@libp2p/interface/connection' describe('mock connection compliance tests', () => { let connections: Connection[] = [] diff --git a/packages/interface-mocks/test/muxer.spec.ts b/packages/interface-compliance-tests/test/mocks/muxer.spec.ts similarity index 58% rename from packages/interface-mocks/test/muxer.spec.ts rename to packages/interface-compliance-tests/test/mocks/muxer.spec.ts index 4d7f280d67..80418c2c72 100644 --- a/packages/interface-mocks/test/muxer.spec.ts +++ b/packages/interface-compliance-tests/test/mocks/muxer.spec.ts @@ -1,5 +1,5 @@ -import tests from '@libp2p/interface-stream-muxer-compliance-tests' -import { mockMuxer } from '../src/muxer.js' +import { mockMuxer } from '../../src/mocks/muxer.js' +import tests from '../../src/stream-muxer/index.js' describe('mock stream muxer compliance tests', () => { tests({ diff --git a/packages/interface-mocks/test/peer-discovery.spec.ts b/packages/interface-compliance-tests/test/mocks/peer-discovery.spec.ts similarity index 74% rename from packages/interface-mocks/test/peer-discovery.spec.ts rename to packages/interface-compliance-tests/test/mocks/peer-discovery.spec.ts index ad2076499a..33d136ab95 100644 --- a/packages/interface-mocks/test/peer-discovery.spec.ts +++ b/packages/interface-compliance-tests/test/mocks/peer-discovery.spec.ts @@ -1,5 +1,5 @@ -import tests from '@libp2p/interface-peer-discovery-compliance-tests' -import { MockDiscovery } from '../src/peer-discovery.js' +import { MockDiscovery } from '../../src/mocks/peer-discovery.js' +import tests from '../../src/peer-discovery/index.js' describe('mock peer discovery compliance tests', () => { let intervalId: any diff --git a/packages/interface-compliance-tests/tsconfig.json b/packages/interface-compliance-tests/tsconfig.json index 5fe8ea40d7..8251520fe9 100644 --- a/packages/interface-compliance-tests/tsconfig.json +++ b/packages/interface-compliance-tests/tsconfig.json @@ -4,6 +4,30 @@ "outDir": "dist" }, "include": [ - "src" + "src", + "test" + ], + "references": [ + { + "path": "../interface" + }, + { + "path": "../interface-internal" + }, + { + "path": "../logger" + }, + { + "path": "../multistream-select" + }, + { + "path": "../peer-collections" + }, + { + "path": "../peer-id" + }, + { + "path": "../peer-id-factory" + } ] } diff --git a/packages/interface-connection-compliance-tests/CHANGELOG.md b/packages/interface-connection-compliance-tests/CHANGELOG.md deleted file mode 100644 index 8a64b251a8..0000000000 --- a/packages/interface-connection-compliance-tests/CHANGELOG.md +++ /dev/null @@ -1,93 +0,0 @@ -## [@libp2p/interface-connection-compliance-tests-v2.0.9](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-compliance-tests-v2.0.8...@libp2p/interface-connection-compliance-tests-v2.0.9) (2023-05-04) - - -### Dependencies - -* bump aegir from 38.1.8 to 39.0.5 ([#393](https://github.com/libp2p/js-libp2p-interfaces/issues/393)) ([31f3797](https://github.com/libp2p/js-libp2p-interfaces/commit/31f3797b24f7c23f3f16e9db3a230bd5f7cd5175)) - -## [@libp2p/interface-connection-compliance-tests-v2.0.8](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-compliance-tests-v2.0.7...@libp2p/interface-connection-compliance-tests-v2.0.8) (2023-04-18) - - -### Dependencies - -* update sibling dependencies ([2f52a28](https://github.com/libp2p/js-libp2p-interfaces/commit/2f52a284b59c0a88b040f86da1f5d3f044727f2c)) - -## [@libp2p/interface-connection-compliance-tests-v2.0.7](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-compliance-tests-v2.0.6...@libp2p/interface-connection-compliance-tests-v2.0.7) (2023-04-11) - - -### Dependencies - -* update sibling dependencies ([b034810](https://github.com/libp2p/js-libp2p-interfaces/commit/b0348102e41dc18166e70063f4708a2b3544f4b6)) - -## [@libp2p/interface-connection-compliance-tests-v2.0.6](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-compliance-tests-v2.0.5...@libp2p/interface-connection-compliance-tests-v2.0.6) (2023-01-18) - - -### Trivial Changes - -* remove lerna ([#330](https://github.com/libp2p/js-libp2p-interfaces/issues/330)) ([6678592](https://github.com/libp2p/js-libp2p-interfaces/commit/6678592dd0cf601a2671852f9d2a0aff5dee2b18)) - - -### Dependencies - -* bump aegir from 37.12.1 to 38.1.0 ([#335](https://github.com/libp2p/js-libp2p-interfaces/issues/335)) ([7368a36](https://github.com/libp2p/js-libp2p-interfaces/commit/7368a363423a08e8fa247dcb76ea13e4cf030d65)) - -## [@libp2p/interface-connection-compliance-tests-v2.0.5](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-compliance-tests-v2.0.4...@libp2p/interface-connection-compliance-tests-v2.0.5) (2022-12-16) - - -### Documentation - -* update project config ([#323](https://github.com/libp2p/js-libp2p-interfaces/issues/323)) ([0fc6a08](https://github.com/libp2p/js-libp2p-interfaces/commit/0fc6a08e9cdcefe361fe325281a3a2a03759ff59)) - -## [@libp2p/interface-connection-compliance-tests-v2.0.4](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-compliance-tests-v2.0.3...@libp2p/interface-connection-compliance-tests-v2.0.4) (2022-12-14) - - -### Bug Fixes - -* generate docs for all packages ([#321](https://github.com/libp2p/js-libp2p-interfaces/issues/321)) ([b6f8b32](https://github.com/libp2p/js-libp2p-interfaces/commit/b6f8b32a920c15a28fe021e6050e31aaae89d518)) - - -### Dependencies - -* bump sinon from 14.0.2 to 15.0.0 ([#316](https://github.com/libp2p/js-libp2p-interfaces/issues/316)) ([d37721c](https://github.com/libp2p/js-libp2p-interfaces/commit/d37721c9143cd3eeafb5f8249b07d9f2fbce0f54)) - -## [@libp2p/interface-connection-compliance-tests-v2.0.3](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-compliance-tests-v2.0.2...@libp2p/interface-connection-compliance-tests-v2.0.3) (2022-11-05) - - -### Bug Fixes - -* update project config ([#311](https://github.com/libp2p/js-libp2p-interfaces/issues/311)) ([27dd0ce](https://github.com/libp2p/js-libp2p-interfaces/commit/27dd0ce3c249892ac69cbb24ddaf0b9f32385e37)) - -## [@libp2p/interface-connection-compliance-tests-v2.0.2](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-compliance-tests-v2.0.1...@libp2p/interface-connection-compliance-tests-v2.0.2) (2022-08-07) - - -### Trivial Changes - -* update project config ([#271](https://github.com/libp2p/js-libp2p-interfaces/issues/271)) ([59c0bf5](https://github.com/libp2p/js-libp2p-interfaces/commit/59c0bf5e0b05496fca2e4902632b61bb41fad9e9)) - - -### Dependencies - -* update sibling dependencies ([f859920](https://github.com/libp2p/js-libp2p-interfaces/commit/f859920423587ae797ac90ccaa3af8bdf60ae549)) - -## [@libp2p/interface-connection-compliance-tests-v2.0.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-compliance-tests-v2.0.0...@libp2p/interface-connection-compliance-tests-v2.0.1) (2022-06-27) - - -### Trivial Changes - -* update deps ([#262](https://github.com/libp2p/js-libp2p-interfaces/issues/262)) ([51edf7d](https://github.com/libp2p/js-libp2p-interfaces/commit/51edf7d9b3765a6f75c915b1483ea345d0133a41)) - -## [@libp2p/interface-connection-compliance-tests-v2.0.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-compliance-tests-v1.0.0...@libp2p/interface-connection-compliance-tests-v2.0.0) (2022-06-16) - - -### ⚠ BREAKING CHANGES - -* The Connection and Stream APIs have been updated - -### Features - -* store stream data on the stream, track the stream direction ([#245](https://github.com/libp2p/js-libp2p-interfaces/issues/245)) ([6d74d2f](https://github.com/libp2p/js-libp2p-interfaces/commit/6d74d2f9f344fb4d6741ba0d35263ebe351a4c65)) - - -### Trivial Changes - -* update deps ([545264f](https://github.com/libp2p/js-libp2p-interfaces/commit/545264f87a58394d2a7da77e93f3a596e889238f)) diff --git a/packages/interface-connection-compliance-tests/README.md b/packages/interface-connection-compliance-tests/README.md deleted file mode 100644 index b9f58eda83..0000000000 --- a/packages/interface-connection-compliance-tests/README.md +++ /dev/null @@ -1,61 +0,0 @@ -# @libp2p/interface-connection-compliance-tests - -[![libp2p.io](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](http://libp2p.io/) -[![Discuss](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg?style=flat-square)](https://discuss.libp2p.io) -[![codecov](https://img.shields.io/codecov/c/github/libp2p/js-libp2p.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p) -[![CI](https://img.shields.io/github/actions/workflow/status/libp2p/js-libp2p/main.yml?branch=master\&style=flat-square)](https://github.com/libp2p/js-libp2p/actions/workflows/main.yml?query=branch%3Amaster) - -> Compliance tests for implementations of the libp2p Connection interface - -## Table of contents - -- [Install](#install) -- [Usage](#usage) -- [API Docs](#api-docs) -- [License](#license) -- [Contribution](#contribution) - -## Install - -```console -$ npm i @libp2p/interface-connection-compliance-tests -``` - -## Usage - -This is a test suite and interface you can use to implement a connection. The connection interface contains all the metadata associated with it, as well as an array of the streams opened through this connection. In the same way as the connection, a stream contains properties with its metadata, plus an iterable duplex object that offers a mechanism for writing and reading data, with back pressure. This module and test suite were heavily inspired by abstract-blob-store and interface-stream-muxer. - -The primary goal of this module is to enable developers to pick, swap or upgrade their connection without losing the same API expectations and mechanisms such as back pressure and the ability to half close a connection. - -Publishing a test suite as a module lets multiple modules ensure compatibility since they use the same test suite. - -```js -import tests from '@libp2p/interface-connection-compliance-tests' - -describe('your connection', () => { - tests({ - // Options should be passed to your connection - async setup (options) { - return YourConnection - }, - async teardown () { - // cleanup resources created by setup() - } - }) -}) -``` - -## API Docs - -- - -## License - -Licensed under either of - -- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / ) -- MIT ([LICENSE-MIT](LICENSE-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/packages/interface-connection-compliance-tests/package.json b/packages/interface-connection-compliance-tests/package.json deleted file mode 100644 index 4630b98670..0000000000 --- a/packages/interface-connection-compliance-tests/package.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "name": "@libp2p/interface-connection-compliance-tests", - "version": "2.0.9", - "description": "Compliance tests for implementations of the libp2p Connection interface", - "license": "Apache-2.0 OR MIT", - "homepage": "https://github.com/libp2p/js-libp2p/tree/master/packages/interface-connection-compliance-tests#readme", - "repository": { - "type": "git", - "url": "git+https://github.com/libp2p/js-libp2p.git" - }, - "bugs": { - "url": "https://github.com/libp2p/js-libp2p/issues" - }, - "keywords": [ - "interface", - "libp2p" - ], - "type": "module", - "types": "./dist/src/index.d.ts", - "files": [ - "src", - "dist", - "!dist/test", - "!**/*.tsbuildinfo" - ], - "exports": { - ".": { - "types": "./dist/src/index.d.ts", - "import": "./dist/src/index.js" - } - }, - "eslintConfig": { - "extends": "ipfs", - "parserOptions": { - "sourceType": "module" - } - }, - "scripts": { - "clean": "aegir clean", - "lint": "aegir lint", - "dep-check": "aegir dep-check", - "build": "aegir build" - }, - "dependencies": { - "@libp2p/interface-compliance-tests": "^3.0.0", - "@libp2p/interface-connection": "^5.0.0", - "aegir": "^39.0.5", - "sinon": "^15.0.0", - "ts-sinon": "^2.0.2" - }, - "typedoc": { - "entryPoint": "./src/index.ts" - } -} diff --git a/packages/interface-connection-compliance-tests/tsconfig.json b/packages/interface-connection-compliance-tests/tsconfig.json deleted file mode 100644 index 40cf163c08..0000000000 --- a/packages/interface-connection-compliance-tests/tsconfig.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "extends": "aegir/src/config/tsconfig.aegir.json", - "compilerOptions": { - "outDir": "dist" - }, - "include": [ - "src", - "test" - ], - "references": [ - { - "path": "../interface-compliance-tests" - }, - { - "path": "../interface-connection" - } - ] -} diff --git a/packages/interface-connection-encrypter-compliance-tests/CHANGELOG.md b/packages/interface-connection-encrypter-compliance-tests/CHANGELOG.md deleted file mode 100644 index d9442ac70f..0000000000 --- a/packages/interface-connection-encrypter-compliance-tests/CHANGELOG.md +++ /dev/null @@ -1,173 +0,0 @@ -## [@libp2p/interface-connection-encrypter-compliance-tests-v5.0.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-encrypter-compliance-tests-v5.0.0...@libp2p/interface-connection-encrypter-compliance-tests-v5.0.1) (2023-05-04) - - -### Dependencies - -* bump aegir from 38.1.8 to 39.0.5 ([#393](https://github.com/libp2p/js-libp2p-interfaces/issues/393)) ([31f3797](https://github.com/libp2p/js-libp2p-interfaces/commit/31f3797b24f7c23f3f16e9db3a230bd5f7cd5175)) - -## [@libp2p/interface-connection-encrypter-compliance-tests-v5.0.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-encrypter-compliance-tests-v4.0.5...@libp2p/interface-connection-encrypter-compliance-tests-v5.0.0) (2023-04-18) - - -### ⚠ BREAKING CHANGES - -* bump it-stream-types from 1.0.5 to 2.0.1 (#362) - -### Dependencies - -* bump it-stream-types from 1.0.5 to 2.0.1 ([#362](https://github.com/libp2p/js-libp2p-interfaces/issues/362)) ([cdc7747](https://github.com/libp2p/js-libp2p-interfaces/commit/cdc774792beead63e0ded96bd6c23de0335a49e3)) -* update sibling dependencies ([bed9f4c](https://github.com/libp2p/js-libp2p-interfaces/commit/bed9f4c7b7044e974a70678762a51e79e018cf9b)) -* update sibling dependencies ([2f52a28](https://github.com/libp2p/js-libp2p-interfaces/commit/2f52a284b59c0a88b040f86da1f5d3f044727f2c)) - -## [@libp2p/interface-connection-encrypter-compliance-tests-v4.0.5](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-encrypter-compliance-tests-v4.0.4...@libp2p/interface-connection-encrypter-compliance-tests-v4.0.5) (2023-04-13) - - -### Dependencies - -* bump it-all from 2.0.1 to 3.0.1 ([#360](https://github.com/libp2p/js-libp2p-interfaces/issues/360)) ([1b439eb](https://github.com/libp2p/js-libp2p-interfaces/commit/1b439eb7503ed7e31e77f17ce0a685ea78d94442)) - -## [@libp2p/interface-connection-encrypter-compliance-tests-v4.0.4](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-encrypter-compliance-tests-v4.0.3...@libp2p/interface-connection-encrypter-compliance-tests-v4.0.4) (2023-04-11) - - -### Dependencies - -* update sibling dependencies ([b034810](https://github.com/libp2p/js-libp2p-interfaces/commit/b0348102e41dc18166e70063f4708a2b3544f4b6)) - -## [@libp2p/interface-connection-encrypter-compliance-tests-v4.0.3](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-encrypter-compliance-tests-v4.0.2...@libp2p/interface-connection-encrypter-compliance-tests-v4.0.3) (2023-04-04) - - -### Dependencies - -* bump it-pipe from 2.0.5 to 3.0.1 ([#363](https://github.com/libp2p/js-libp2p-interfaces/issues/363)) ([625817b](https://github.com/libp2p/js-libp2p-interfaces/commit/625817b0bbbee276983c40a0604c8810a25abe8f)) - -## [@libp2p/interface-connection-encrypter-compliance-tests-v4.0.2](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-encrypter-compliance-tests-v4.0.1...@libp2p/interface-connection-encrypter-compliance-tests-v4.0.2) (2023-03-17) - - -### Dependencies - -* update @multiformats/multiaddr to 12.0.0 ([#354](https://github.com/libp2p/js-libp2p-interfaces/issues/354)) ([e0f327b](https://github.com/libp2p/js-libp2p-interfaces/commit/e0f327b5d54e240feabadce21a841629d633ec5e)) - -## [@libp2p/interface-connection-encrypter-compliance-tests-v4.0.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-encrypter-compliance-tests-v4.0.0...@libp2p/interface-connection-encrypter-compliance-tests-v4.0.1) (2023-01-18) - - -### Trivial Changes - -* remove lerna ([#330](https://github.com/libp2p/js-libp2p-interfaces/issues/330)) ([6678592](https://github.com/libp2p/js-libp2p-interfaces/commit/6678592dd0cf601a2671852f9d2a0aff5dee2b18)) - - -### Dependencies - -* bump aegir from 37.12.1 to 38.1.0 ([#335](https://github.com/libp2p/js-libp2p-interfaces/issues/335)) ([7368a36](https://github.com/libp2p/js-libp2p-interfaces/commit/7368a363423a08e8fa247dcb76ea13e4cf030d65)) - -## [@libp2p/interface-connection-encrypter-compliance-tests-v4.0.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-encrypter-compliance-tests-v3.0.5...@libp2p/interface-connection-encrypter-compliance-tests-v4.0.0) (2023-01-06) - - -### ⚠ BREAKING CHANGES - -* update peer-id dep to pull in new multiformats (#331) - -### Bug Fixes - -* update peer-id dep to pull in new multiformats ([#331](https://github.com/libp2p/js-libp2p-interfaces/issues/331)) ([fb8b7ba](https://github.com/libp2p/js-libp2p-interfaces/commit/fb8b7ba654a30a08da0652e2833e36dd3bb85e90)) - -## [@libp2p/interface-connection-encrypter-compliance-tests-v3.0.5](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-encrypter-compliance-tests-v3.0.4...@libp2p/interface-connection-encrypter-compliance-tests-v3.0.5) (2023-01-06) - - -### Dependencies - -* update sibling dependencies ([b50e621](https://github.com/libp2p/js-libp2p-interfaces/commit/b50e621d31a8b32affc3fadb9f97c4883d577f93)) - -## [@libp2p/interface-connection-encrypter-compliance-tests-v3.0.4](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-encrypter-compliance-tests-v3.0.3...@libp2p/interface-connection-encrypter-compliance-tests-v3.0.4) (2022-12-16) - - -### Documentation - -* update project config ([#323](https://github.com/libp2p/js-libp2p-interfaces/issues/323)) ([0fc6a08](https://github.com/libp2p/js-libp2p-interfaces/commit/0fc6a08e9cdcefe361fe325281a3a2a03759ff59)) - -## [@libp2p/interface-connection-encrypter-compliance-tests-v3.0.3](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-encrypter-compliance-tests-v3.0.2...@libp2p/interface-connection-encrypter-compliance-tests-v3.0.3) (2022-12-14) - - -### Bug Fixes - -* generate docs for all packages ([#321](https://github.com/libp2p/js-libp2p-interfaces/issues/321)) ([b6f8b32](https://github.com/libp2p/js-libp2p-interfaces/commit/b6f8b32a920c15a28fe021e6050e31aaae89d518)) - -## [@libp2p/interface-connection-encrypter-compliance-tests-v3.0.2](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-encrypter-compliance-tests-v3.0.1...@libp2p/interface-connection-encrypter-compliance-tests-v3.0.2) (2022-11-05) - - -### Bug Fixes - -* update project config ([#311](https://github.com/libp2p/js-libp2p-interfaces/issues/311)) ([27dd0ce](https://github.com/libp2p/js-libp2p-interfaces/commit/27dd0ce3c249892ac69cbb24ddaf0b9f32385e37)) - -## [@libp2p/interface-connection-encrypter-compliance-tests-v3.0.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-encrypter-compliance-tests-v3.0.0...@libp2p/interface-connection-encrypter-compliance-tests-v3.0.1) (2022-10-17) - - -### Dependencies - -* bump it-all from 1.0.6 to 2.0.0 ([#306](https://github.com/libp2p/js-libp2p-interfaces/issues/306)) ([7c7b388](https://github.com/libp2p/js-libp2p-interfaces/commit/7c7b3882e33a064b8e5588d6befd823360347464)) - -## [@libp2p/interface-connection-encrypter-compliance-tests-v3.0.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-encrypter-compliance-tests-v2.0.3...@libp2p/interface-connection-encrypter-compliance-tests-v3.0.0) (2022-10-12) - - -### ⚠ BREAKING CHANGES - -* modules no longer implement `Initializable` instead switching to constructor injection - -### Bug Fixes - -* remove @libp2p/components ([#301](https://github.com/libp2p/js-libp2p-interfaces/issues/301)) ([1d37dc6](https://github.com/libp2p/js-libp2p-interfaces/commit/1d37dc6d3197838a71895d5769ad8bba6eb38fd3)) - -## [@libp2p/interface-connection-encrypter-compliance-tests-v2.0.3](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-encrypter-compliance-tests-v2.0.2...@libp2p/interface-connection-encrypter-compliance-tests-v2.0.3) (2022-10-04) - - -### Dependencies - -* update sibling dependencies ([419f947](https://github.com/libp2p/js-libp2p-interfaces/commit/419f9479e8bba5d0555fe20a6fb9f0cf12a82cf9)) - -## [@libp2p/interface-connection-encrypter-compliance-tests-v2.0.2](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-encrypter-compliance-tests-v2.0.1...@libp2p/interface-connection-encrypter-compliance-tests-v2.0.2) (2022-09-21) - - -### Dependencies - -* update @multiformats/multiaddr to 11.0.0 ([#288](https://github.com/libp2p/js-libp2p-interfaces/issues/288)) ([57b2ad8](https://github.com/libp2p/js-libp2p-interfaces/commit/57b2ad88edfc7807311143791bc49270b1a81eaf)) - -## [@libp2p/interface-connection-encrypter-compliance-tests-v2.0.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-encrypter-compliance-tests-v2.0.0...@libp2p/interface-connection-encrypter-compliance-tests-v2.0.1) (2022-08-10) - - -### Bug Fixes - -* revert connection encryption change to accept Uint8ArrayLists ([#280](https://github.com/libp2p/js-libp2p-interfaces/issues/280)) ([03d763c](https://github.com/libp2p/js-libp2p-interfaces/commit/03d763c1a6b168bba001783a1fb59af3f7d4e205)) - -## [@libp2p/interface-connection-encrypter-compliance-tests-v2.0.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-encrypter-compliance-tests-v1.0.2...@libp2p/interface-connection-encrypter-compliance-tests-v2.0.0) (2022-08-07) - - -### ⚠ BREAKING CHANGES - -* change connection encryption interface to uint8arraylist (#278) - -### Features - -* change connection encryption interface to uint8arraylist ([#278](https://github.com/libp2p/js-libp2p-interfaces/issues/278)) ([1fa580c](https://github.com/libp2p/js-libp2p-interfaces/commit/1fa580c5a45325dc9384738e9a78a238eabb81c3)) - - -### Trivial Changes - -* update project config ([#271](https://github.com/libp2p/js-libp2p-interfaces/issues/271)) ([59c0bf5](https://github.com/libp2p/js-libp2p-interfaces/commit/59c0bf5e0b05496fca2e4902632b61bb41fad9e9)) - - -### Dependencies - -* update sibling dependencies ([f859920](https://github.com/libp2p/js-libp2p-interfaces/commit/f859920423587ae797ac90ccaa3af8bdf60ae549)) -* update sibling dependencies ([93a89b1](https://github.com/libp2p/js-libp2p-interfaces/commit/93a89b1ca6d35fb5f26963ae7bb10026f3f5d45d)) - -## [@libp2p/interface-connection-encrypter-compliance-tests-v1.0.2](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-encrypter-compliance-tests-v1.0.1...@libp2p/interface-connection-encrypter-compliance-tests-v1.0.2) (2022-06-27) - - -### Trivial Changes - -* update deps ([#262](https://github.com/libp2p/js-libp2p-interfaces/issues/262)) ([51edf7d](https://github.com/libp2p/js-libp2p-interfaces/commit/51edf7d9b3765a6f75c915b1483ea345d0133a41)) - -## [@libp2p/interface-connection-encrypter-compliance-tests-v1.0.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-encrypter-compliance-tests-v1.0.0...@libp2p/interface-connection-encrypter-compliance-tests-v1.0.1) (2022-06-16) - - -### Trivial Changes - -* update deps ([545264f](https://github.com/libp2p/js-libp2p-interfaces/commit/545264f87a58394d2a7da77e93f3a596e889238f)) diff --git a/packages/interface-connection-encrypter-compliance-tests/LICENSE b/packages/interface-connection-encrypter-compliance-tests/LICENSE deleted file mode 100644 index 20ce483c86..0000000000 --- a/packages/interface-connection-encrypter-compliance-tests/LICENSE +++ /dev/null @@ -1,4 +0,0 @@ -This project is dual licensed under MIT and Apache-2.0. - -MIT: https://www.opensource.org/licenses/mit -Apache-2.0: https://www.apache.org/licenses/license-2.0 diff --git a/packages/interface-connection-encrypter-compliance-tests/LICENSE-APACHE b/packages/interface-connection-encrypter-compliance-tests/LICENSE-APACHE deleted file mode 100644 index 14478a3b60..0000000000 --- a/packages/interface-connection-encrypter-compliance-tests/LICENSE-APACHE +++ /dev/null @@ -1,5 +0,0 @@ -Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - -http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. diff --git a/packages/interface-connection-encrypter-compliance-tests/LICENSE-MIT b/packages/interface-connection-encrypter-compliance-tests/LICENSE-MIT deleted file mode 100644 index 72dc60d84b..0000000000 --- a/packages/interface-connection-encrypter-compliance-tests/LICENSE-MIT +++ /dev/null @@ -1,19 +0,0 @@ -The MIT License (MIT) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/packages/interface-connection-encrypter-compliance-tests/README.md b/packages/interface-connection-encrypter-compliance-tests/README.md deleted file mode 100644 index 11354482b5..0000000000 --- a/packages/interface-connection-encrypter-compliance-tests/README.md +++ /dev/null @@ -1,54 +0,0 @@ -# @libp2p/interface-connection-encrypter-compliance-tests - -[![libp2p.io](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](http://libp2p.io/) -[![Discuss](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg?style=flat-square)](https://discuss.libp2p.io) -[![codecov](https://img.shields.io/codecov/c/github/libp2p/js-libp2p.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p) -[![CI](https://img.shields.io/github/actions/workflow/status/libp2p/js-libp2p/main.yml?branch=master\&style=flat-square)](https://github.com/libp2p/js-libp2p/actions/workflows/main.yml?query=branch%3Amaster) - -> Compliance tests for implementations of the libp2p Connection Encrypter interface - -## Table of contents - -- [Install](#install) -- [Usage](#usage) -- [API Docs](#api-docs) -- [License](#license) -- [Contribution](#contribution) - -## Install - -```console -$ npm i @libp2p/interface-connection-encrypter-compliance-tests -``` - -## Usage - -```js -import tests from '@libp2p/interface-connection-encrypter-compliance-tests' -import yourCrypto from './your-encrypter' - -tests({ - setup () { - // Set up your crypto if needed, then return it - return yourCrypto - }, - teardown () { - // Clean up your crypto if needed - } -}) -``` - -## API Docs - -- - -## License - -Licensed under either of - -- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / ) -- MIT ([LICENSE-MIT](LICENSE-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/packages/interface-connection-encrypter-compliance-tests/package.json b/packages/interface-connection-encrypter-compliance-tests/package.json deleted file mode 100644 index 2994e30dab..0000000000 --- a/packages/interface-connection-encrypter-compliance-tests/package.json +++ /dev/null @@ -1,61 +0,0 @@ -{ - "name": "@libp2p/interface-connection-encrypter-compliance-tests", - "version": "5.0.1", - "description": "Compliance tests for implementations of the libp2p Connection Encrypter interface", - "license": "Apache-2.0 OR MIT", - "homepage": "https://github.com/libp2p/js-libp2p/tree/master/packages/interface-connection-encrypter-compliance-tests#readme", - "repository": { - "type": "git", - "url": "git+https://github.com/libp2p/js-libp2p.git" - }, - "bugs": { - "url": "https://github.com/libp2p/js-libp2p/issues" - }, - "keywords": [ - "interface", - "libp2p" - ], - "type": "module", - "types": "./dist/src/index.d.ts", - "files": [ - "src", - "dist", - "!dist/test", - "!**/*.tsbuildinfo" - ], - "exports": { - ".": { - "types": "./dist/src/index.d.ts", - "import": "./dist/src/index.js" - } - }, - "eslintConfig": { - "extends": "ipfs", - "parserOptions": { - "sourceType": "module" - } - }, - "scripts": { - "clean": "aegir clean", - "lint": "aegir lint", - "dep-check": "aegir dep-check", - "build": "aegir build" - }, - "dependencies": { - "@libp2p/interface-compliance-tests": "^3.0.0", - "@libp2p/interface-connection": "^5.0.0", - "@libp2p/interface-connection-encrypter": "^4.0.0", - "@libp2p/interface-peer-id": "^2.0.0", - "@libp2p/peer-id-factory": "^2.0.0", - "@multiformats/multiaddr": "^12.1.3", - "aegir": "^39.0.5", - "it-all": "^3.0.2", - "it-pair": "^2.0.2", - "it-pipe": "^3.0.1", - "it-stream-types": "^2.0.1", - "uint8arrays": "^4.0.3" - }, - "typedoc": { - "entryPoint": "./src/index.ts" - } -} diff --git a/packages/interface-connection-encrypter-compliance-tests/tsconfig.json b/packages/interface-connection-encrypter-compliance-tests/tsconfig.json deleted file mode 100644 index e00ae1221b..0000000000 --- a/packages/interface-connection-encrypter-compliance-tests/tsconfig.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "extends": "aegir/src/config/tsconfig.aegir.json", - "compilerOptions": { - "outDir": "dist" - }, - "include": [ - "src", - "test" - ], - "references": [ - { - "path": "../interface-compliance-tests" - }, - { - "path": "../interface-connection" - }, - { - "path": "../interface-connection-encrypter" - }, - { - "path": "../interface-peer-id" - }, - { - "path": "../peer-id-factory" - } - ] -} diff --git a/packages/interface-connection-encrypter/CHANGELOG.md b/packages/interface-connection-encrypter/CHANGELOG.md deleted file mode 100644 index f6826ffa1a..0000000000 --- a/packages/interface-connection-encrypter/CHANGELOG.md +++ /dev/null @@ -1,137 +0,0 @@ -## [@libp2p/interface-connection-encrypter-v4.0.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-encrypter-v4.0.0...@libp2p/interface-connection-encrypter-v4.0.1) (2023-05-04) - - -### Dependencies - -* bump aegir from 38.1.8 to 39.0.5 ([#393](https://github.com/libp2p/js-libp2p-interfaces/issues/393)) ([31f3797](https://github.com/libp2p/js-libp2p-interfaces/commit/31f3797b24f7c23f3f16e9db3a230bd5f7cd5175)) - -## [@libp2p/interface-connection-encrypter-v4.0.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-encrypter-v3.0.6...@libp2p/interface-connection-encrypter-v4.0.0) (2023-04-18) - - -### ⚠ BREAKING CHANGES - -* bump it-stream-types from 1.0.5 to 2.0.1 (#362) - -### Dependencies - -* bump it-stream-types from 1.0.5 to 2.0.1 ([#362](https://github.com/libp2p/js-libp2p-interfaces/issues/362)) ([cdc7747](https://github.com/libp2p/js-libp2p-interfaces/commit/cdc774792beead63e0ded96bd6c23de0335a49e3)) - -## [@libp2p/interface-connection-encrypter-v3.0.6](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-encrypter-v3.0.5...@libp2p/interface-connection-encrypter-v3.0.6) (2023-01-18) - - -### Trivial Changes - -* remove lerna ([#330](https://github.com/libp2p/js-libp2p-interfaces/issues/330)) ([6678592](https://github.com/libp2p/js-libp2p-interfaces/commit/6678592dd0cf601a2671852f9d2a0aff5dee2b18)) - - -### Dependencies - -* bump aegir from 37.12.1 to 38.1.0 ([#335](https://github.com/libp2p/js-libp2p-interfaces/issues/335)) ([7368a36](https://github.com/libp2p/js-libp2p-interfaces/commit/7368a363423a08e8fa247dcb76ea13e4cf030d65)) - -## [@libp2p/interface-connection-encrypter-v3.0.5](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-encrypter-v3.0.4...@libp2p/interface-connection-encrypter-v3.0.5) (2023-01-06) - - -### Dependencies - -* update sibling dependencies ([b50e621](https://github.com/libp2p/js-libp2p-interfaces/commit/b50e621d31a8b32affc3fadb9f97c4883d577f93)) - -## [@libp2p/interface-connection-encrypter-v3.0.4](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-encrypter-v3.0.3...@libp2p/interface-connection-encrypter-v3.0.4) (2022-12-16) - - -### Documentation - -* update project config ([#323](https://github.com/libp2p/js-libp2p-interfaces/issues/323)) ([0fc6a08](https://github.com/libp2p/js-libp2p-interfaces/commit/0fc6a08e9cdcefe361fe325281a3a2a03759ff59)) - -## [@libp2p/interface-connection-encrypter-v3.0.3](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-encrypter-v3.0.2...@libp2p/interface-connection-encrypter-v3.0.3) (2022-12-14) - - -### Bug Fixes - -* generate docs for all packages ([#321](https://github.com/libp2p/js-libp2p-interfaces/issues/321)) ([b6f8b32](https://github.com/libp2p/js-libp2p-interfaces/commit/b6f8b32a920c15a28fe021e6050e31aaae89d518)) - -## [@libp2p/interface-connection-encrypter-v3.0.2](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-encrypter-v3.0.1...@libp2p/interface-connection-encrypter-v3.0.2) (2022-11-05) - - -### Bug Fixes - -* update project config ([#311](https://github.com/libp2p/js-libp2p-interfaces/issues/311)) ([27dd0ce](https://github.com/libp2p/js-libp2p-interfaces/commit/27dd0ce3c249892ac69cbb24ddaf0b9f32385e37)) - -## [@libp2p/interface-connection-encrypter-v3.0.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-encrypter-v3.0.0...@libp2p/interface-connection-encrypter-v3.0.1) (2022-10-04) - - -### Bug Fixes - -* add default extension type ([#296](https://github.com/libp2p/js-libp2p-interfaces/issues/296)) ([ab658bc](https://github.com/libp2p/js-libp2p-interfaces/commit/ab658bc1b11e411e685388acb9da8f65d62ef919)) - -## [@libp2p/interface-connection-encrypter-v3.0.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-encrypter-v2.0.2...@libp2p/interface-connection-encrypter-v3.0.0) (2022-10-04) - - -### ⚠ BREAKING CHANGES - -* Add remoteExtensions to connection-encrypter (#293) - -### Features - -* Add remoteExtensions to connection-encrypter ([#293](https://github.com/libp2p/js-libp2p-interfaces/issues/293)) ([501c684](https://github.com/libp2p/js-libp2p-interfaces/commit/501c684d792cd910de7cb9bfbda349db257ee2ca)) - -## [@libp2p/interface-connection-encrypter-v2.0.2](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-encrypter-v2.0.1...@libp2p/interface-connection-encrypter-v2.0.2) (2022-09-30) - - -### Bug Fixes - -* make outbound peer id optional ([#294](https://github.com/libp2p/js-libp2p-interfaces/issues/294)) ([6724ffe](https://github.com/libp2p/js-libp2p-interfaces/commit/6724ffef0d170dba2d4c9973b46334fc421f8ea8)) - -## [@libp2p/interface-connection-encrypter-v2.0.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-encrypter-v2.0.0...@libp2p/interface-connection-encrypter-v2.0.1) (2022-08-10) - - -### Bug Fixes - -* revert connection encryption change to accept Uint8ArrayLists ([#280](https://github.com/libp2p/js-libp2p-interfaces/issues/280)) ([03d763c](https://github.com/libp2p/js-libp2p-interfaces/commit/03d763c1a6b168bba001783a1fb59af3f7d4e205)) - -## [@libp2p/interface-connection-encrypter-v2.0.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-encrypter-v1.0.3...@libp2p/interface-connection-encrypter-v2.0.0) (2022-08-07) - - -### ⚠ BREAKING CHANGES - -* change connection encryption interface to uint8arraylist (#278) - -### Features - -* change connection encryption interface to uint8arraylist ([#278](https://github.com/libp2p/js-libp2p-interfaces/issues/278)) ([1fa580c](https://github.com/libp2p/js-libp2p-interfaces/commit/1fa580c5a45325dc9384738e9a78a238eabb81c3)) - - -### Trivial Changes - -* update project config ([#271](https://github.com/libp2p/js-libp2p-interfaces/issues/271)) ([59c0bf5](https://github.com/libp2p/js-libp2p-interfaces/commit/59c0bf5e0b05496fca2e4902632b61bb41fad9e9)) - -## [@libp2p/interface-connection-encrypter-v1.0.3](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-encrypter-v1.0.2...@libp2p/interface-connection-encrypter-v1.0.3) (2022-06-27) - - -### Trivial Changes - -* update deps ([#262](https://github.com/libp2p/js-libp2p-interfaces/issues/262)) ([51edf7d](https://github.com/libp2p/js-libp2p-interfaces/commit/51edf7d9b3765a6f75c915b1483ea345d0133a41)) - -## [@libp2p/interface-connection-encrypter-v1.0.2](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-encrypter-v1.0.1...@libp2p/interface-connection-encrypter-v1.0.2) (2022-06-14) - - -### Trivial Changes - -* update aegir ([#234](https://github.com/libp2p/js-libp2p-interfaces/issues/234)) ([3e03895](https://github.com/libp2p/js-libp2p-interfaces/commit/3e038959ecab6cfa3585df9ee179c0af7a61eda5)) - -## [@libp2p/interface-connection-encrypter-v1.0.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-encrypter-v1.0.0...@libp2p/interface-connection-encrypter-v1.0.1) (2022-06-14) - - -### Trivial Changes - -* update readmes ([#233](https://github.com/libp2p/js-libp2p-interfaces/issues/233)) ([ee7da38](https://github.com/libp2p/js-libp2p-interfaces/commit/ee7da38dccc08160d26c8436df8739ce7e0b340e)) - -## @libp2p/interface-connection-encrypter-v1.0.0 (2022-06-14) - - -### ⚠ BREAKING CHANGES - -* most modules have been split out of the `@libp2p/interfaces` and `@libp2p/interface-compliance-tests` packages - -### Trivial Changes - -* break modules apart ([#232](https://github.com/libp2p/js-libp2p-interfaces/issues/232)) ([385614e](https://github.com/libp2p/js-libp2p-interfaces/commit/385614e772329052ab17415c8bd421f65b01a61b)), closes [#226](https://github.com/libp2p/js-libp2p-interfaces/issues/226) diff --git a/packages/interface-connection-encrypter/LICENSE b/packages/interface-connection-encrypter/LICENSE deleted file mode 100644 index 20ce483c86..0000000000 --- a/packages/interface-connection-encrypter/LICENSE +++ /dev/null @@ -1,4 +0,0 @@ -This project is dual licensed under MIT and Apache-2.0. - -MIT: https://www.opensource.org/licenses/mit -Apache-2.0: https://www.apache.org/licenses/license-2.0 diff --git a/packages/interface-connection-encrypter/LICENSE-APACHE b/packages/interface-connection-encrypter/LICENSE-APACHE deleted file mode 100644 index 14478a3b60..0000000000 --- a/packages/interface-connection-encrypter/LICENSE-APACHE +++ /dev/null @@ -1,5 +0,0 @@ -Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - -http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. diff --git a/packages/interface-connection-encrypter/LICENSE-MIT b/packages/interface-connection-encrypter/LICENSE-MIT deleted file mode 100644 index 72dc60d84b..0000000000 --- a/packages/interface-connection-encrypter/LICENSE-MIT +++ /dev/null @@ -1,19 +0,0 @@ -The MIT License (MIT) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/packages/interface-connection-encrypter/README.md b/packages/interface-connection-encrypter/README.md deleted file mode 100644 index e2de3f1e93..0000000000 --- a/packages/interface-connection-encrypter/README.md +++ /dev/null @@ -1,114 +0,0 @@ -# @libp2p/interface-connection-encrypter - -[![libp2p.io](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](http://libp2p.io/) -[![Discuss](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg?style=flat-square)](https://discuss.libp2p.io) -[![codecov](https://img.shields.io/codecov/c/github/libp2p/js-libp2p.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p) -[![CI](https://img.shields.io/github/actions/workflow/status/libp2p/js-libp2p/main.yml?branch=master\&style=flat-square)](https://github.com/libp2p/js-libp2p/actions/workflows/main.yml?query=branch%3Amaster) - -> Connection Encrypter interface for libp2p - -## Table of contents - -- [Install](#install) -- [API](#api) - - [Secure Inbound](#secure-inbound) - - [Secure Outbound](#secure-outbound) -- [Crypto Errors](#crypto-errors) - - [Error Types](#error-types) -- [API Docs](#api-docs) -- [License](#license) -- [Contribution](#contribution) - -## Install - -```console -$ npm i @libp2p/interface-connection-encrypter -``` - -**Modules that implement the interface** - -- [@chainSafe/js-libp2p-noise](https://github.com/ChainSafe/js-libp2p-noise) -- [js-libp2p-secio](https://github.com/NodeFactoryIo/js-libp2p-secio) - -## API - -- `Crypto` - - `protocol`: The protocol id of the crypto module. - - `secureInbound`: Secures inbound connections. - - `secureOutbound`: Secures outbound connections. - -### Secure Inbound - -- `const { conn, remotePeer } = await crypto.secureInbound(localPeer, duplex, [remotePeer])` - -Secures an inbound [streaming iterable duplex][iterable-duplex] connection. It returns an encrypted [streaming iterable duplex][iterable-duplex], as well as the [PeerId][peer-id] of the remote peer. - -**Parameters** - -- `localPeer` is the [PeerId][peer-id] of the receiving peer. -- `duplex` is the [streaming iterable duplex][iterable-duplex] that will be encryption. -- `remotePeer` is the optional [PeerId][peer-id] of the initiating peer, if known. This may only exist during transport upgrades. - -**Return Value** - -- `` - - `conn`: An encrypted [streaming iterable duplex][iterable-duplex]. - - `remotePeer`: The [PeerId][peer-id] of the remote peer. - -### Secure Outbound - -- `const { conn, remotePeer } = await crypto.secureOutbound(localPeer, duplex, remotePeer)` - -Secures an outbound [streaming iterable duplex][iterable-duplex] connection. It returns an encrypted [streaming iterable duplex][iterable-duplex], as well as the [PeerId][peer-id] of the remote peer. - -**Parameters** - -- `localPeer` is the [PeerId][peer-id] of the receiving peer. -- `duplex` is the [streaming iterable duplex][iterable-duplex] that will be encrypted. -- `remotePeer` is the [PeerId][peer-id] of the remote peer. If provided, implementations **should** use this to validate the integrity of the remote peer. - -**Return Value** - -- `` - - `conn`: An encrypted [streaming iterable duplex][iterable-duplex]. - - `remotePeer`: The [PeerId][peer-id] of the remote peer. This **should** match the `remotePeer` parameter, and implementations should enforce this. - -## Crypto Errors - -Common crypto errors come with the interface, and can be imported directly. All Errors take an optional message. - -```js -const { - InvalidCryptoExchangeError, - InvalidCryptoTransmissionError, - UnexpectedPeerError -} = require('libp2p-interfaces/src/crypto/errors') - -const error = new UnexpectedPeerError('a custom error message') -console.log(error.code === UnexpectedPeerError.code) // true -``` - -### Error Types - -- `InvalidCryptoExchangeError` - Should be thrown when a peer provides data that is insufficient to finish the crypto exchange. -- `InvalidCryptoTransmissionError` - Should be thrown when an error occurs during encryption/decryption. -- `UnexpectedPeerError` - Should be thrown when the expected peer id does not match the peer id determined via the crypto exchange. - -## API Docs - -- - -## License - -Licensed under either of - -- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / ) -- MIT ([LICENSE-MIT](LICENSE-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. - -[peer-id]: https://github.com/libp2p/js-peer-id - -[iterable-duplex]: https://gist.github.com/alanshaw/591dc7dd54e4f99338a347ef568d6ee9#duplex-it diff --git a/packages/interface-connection-encrypter/package.json b/packages/interface-connection-encrypter/package.json deleted file mode 100644 index 812ec5e4ed..0000000000 --- a/packages/interface-connection-encrypter/package.json +++ /dev/null @@ -1,74 +0,0 @@ -{ - "name": "@libp2p/interface-connection-encrypter", - "version": "4.0.1", - "description": "Connection Encrypter interface for libp2p", - "license": "Apache-2.0 OR MIT", - "homepage": "https://github.com/libp2p/js-libp2p/tree/master/packages/interface-connection-encrypter#readme", - "repository": { - "type": "git", - "url": "git+https://github.com/libp2p/js-libp2p.git" - }, - "bugs": { - "url": "https://github.com/libp2p/js-libp2p/issues" - }, - "keywords": [ - "interface", - "libp2p" - ], - "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" - }, - "./errors": { - "types": "./dist/src/errors.d.ts", - "import": "./dist/src/errors.js" - } - }, - "eslintConfig": { - "extends": "ipfs", - "parserOptions": { - "sourceType": "module" - } - }, - "scripts": { - "clean": "aegir clean", - "lint": "aegir lint", - "dep-check": "aegir dep-check", - "build": "aegir build" - }, - "dependencies": { - "@libp2p/interface-peer-id": "^2.0.0", - "it-stream-types": "^2.0.1" - }, - "devDependencies": { - "aegir": "^39.0.10" - }, - "typedoc": { - "entryPoint": "./src/index.ts" - } -} diff --git a/packages/interface-connection-encrypter/src/errors.ts b/packages/interface-connection-encrypter/src/errors.ts deleted file mode 100644 index e23304aae3..0000000000 --- a/packages/interface-connection-encrypter/src/errors.ts +++ /dev/null @@ -1,33 +0,0 @@ - -export class UnexpectedPeerError extends Error { - public code: string - - constructor (message = 'Unexpected Peer') { - super(message) - this.code = UnexpectedPeerError.code - } - - static readonly code = 'ERR_UNEXPECTED_PEER' -} - -export class InvalidCryptoExchangeError extends Error { - public code: string - - constructor (message = 'Invalid crypto exchange') { - super(message) - this.code = InvalidCryptoExchangeError.code - } - - static readonly code = 'ERR_INVALID_CRYPTO_EXCHANGE' -} - -export class InvalidCryptoTransmissionError extends Error { - public code: string - - constructor (message = 'Invalid crypto transmission') { - super(message) - this.code = InvalidCryptoTransmissionError.code - } - - static readonly code = 'ERR_INVALID_CRYPTO_TRANSMISSION' -} diff --git a/packages/interface-connection-encrypter/tsconfig.json b/packages/interface-connection-encrypter/tsconfig.json deleted file mode 100644 index d8db0b667f..0000000000 --- a/packages/interface-connection-encrypter/tsconfig.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "extends": "aegir/src/config/tsconfig.aegir.json", - "compilerOptions": { - "outDir": "dist" - }, - "include": [ - "src" - ], - "references": [ - { - "path": "../interface-peer-id" - } - ] -} diff --git a/packages/interface-connection-gater/CHANGELOG.md b/packages/interface-connection-gater/CHANGELOG.md deleted file mode 100644 index c50efe4d71..0000000000 --- a/packages/interface-connection-gater/CHANGELOG.md +++ /dev/null @@ -1,64 +0,0 @@ -## [@libp2p/interface-connection-gater-v3.0.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-gater-v3.0.0...@libp2p/interface-connection-gater-v3.0.1) (2023-05-04) - - -### Dependencies - -* bump aegir from 38.1.8 to 39.0.5 ([#393](https://github.com/libp2p/js-libp2p-interfaces/issues/393)) ([31f3797](https://github.com/libp2p/js-libp2p-interfaces/commit/31f3797b24f7c23f3f16e9db3a230bd5f7cd5175)) - -## [@libp2p/interface-connection-gater-v3.0.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-gater-v2.0.1...@libp2p/interface-connection-gater-v3.0.0) (2023-04-18) - - -### ⚠ BREAKING CHANGES - -* bump it-stream-types from 1.0.5 to 2.0.1 (#362) - -### Dependencies - -* bump it-stream-types from 1.0.5 to 2.0.1 ([#362](https://github.com/libp2p/js-libp2p-interfaces/issues/362)) ([cdc7747](https://github.com/libp2p/js-libp2p-interfaces/commit/cdc774792beead63e0ded96bd6c23de0335a49e3)) -* update sibling dependencies ([2f52a28](https://github.com/libp2p/js-libp2p-interfaces/commit/2f52a284b59c0a88b040f86da1f5d3f044727f2c)) - -## [@libp2p/interface-connection-gater-v2.0.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-gater-v2.0.0...@libp2p/interface-connection-gater-v2.0.1) (2023-04-14) - - -### Bug Fixes - -* make deny dial multiaddr optional ([#370](https://github.com/libp2p/js-libp2p-interfaces/issues/370)) ([6bf7a7e](https://github.com/libp2p/js-libp2p-interfaces/commit/6bf7a7e9fe2a77a43c5ddf114c26c4978c579d46)) - -## [@libp2p/interface-connection-gater-v2.0.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-gater-v1.0.3...@libp2p/interface-connection-gater-v2.0.0) (2023-04-14) - - -### ⚠ BREAKING CHANGES - -* the peer id argument has been removed from the `denyDialMultiaddr` method of the connection gater - -### Bug Fixes - -* remove peer id argument from deny dial multiaddr ([#366](https://github.com/libp2p/js-libp2p-interfaces/issues/366)) ([aa3e000](https://github.com/libp2p/js-libp2p-interfaces/commit/aa3e0008a94d943df961da7756bf4cf6862bd4c1)) - -## [@libp2p/interface-connection-gater-v1.0.3](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-gater-v1.0.2...@libp2p/interface-connection-gater-v1.0.3) (2023-04-11) - - -### Dependencies - -* update sibling dependencies ([b034810](https://github.com/libp2p/js-libp2p-interfaces/commit/b0348102e41dc18166e70063f4708a2b3544f4b6)) - -## [@libp2p/interface-connection-gater-v1.0.2](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-gater-v1.0.1...@libp2p/interface-connection-gater-v1.0.2) (2023-03-17) - - -### Bug Fixes - -* update project settings ([2aa4f95](https://github.com/libp2p/js-libp2p-interfaces/commit/2aa4f9583fb8ff9b53c51ebb6b81f72d69a1748d)) - -## [@libp2p/interface-connection-gater-v1.0.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-gater-v1.0.0...@libp2p/interface-connection-gater-v1.0.1) (2023-03-17) - - -### Dependencies - -* update @multiformats/multiaddr to 12.0.0 ([#354](https://github.com/libp2p/js-libp2p-interfaces/issues/354)) ([e0f327b](https://github.com/libp2p/js-libp2p-interfaces/commit/e0f327b5d54e240feabadce21a841629d633ec5e)) - -## @libp2p/interface-connection-gater-v1.0.0 (2023-03-09) - - -### Features - -* split connection gater out into module ([#347](https://github.com/libp2p/js-libp2p-interfaces/issues/347)) ([1824744](https://github.com/libp2p/js-libp2p-interfaces/commit/18247442aa64c809d9e101ccbd0067ce48bdb80f)) diff --git a/packages/interface-connection-gater/LICENSE b/packages/interface-connection-gater/LICENSE deleted file mode 100644 index 20ce483c86..0000000000 --- a/packages/interface-connection-gater/LICENSE +++ /dev/null @@ -1,4 +0,0 @@ -This project is dual licensed under MIT and Apache-2.0. - -MIT: https://www.opensource.org/licenses/mit -Apache-2.0: https://www.apache.org/licenses/license-2.0 diff --git a/packages/interface-connection-gater/LICENSE-APACHE b/packages/interface-connection-gater/LICENSE-APACHE deleted file mode 100644 index 14478a3b60..0000000000 --- a/packages/interface-connection-gater/LICENSE-APACHE +++ /dev/null @@ -1,5 +0,0 @@ -Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - -http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. diff --git a/packages/interface-connection-gater/LICENSE-MIT b/packages/interface-connection-gater/LICENSE-MIT deleted file mode 100644 index 72dc60d84b..0000000000 --- a/packages/interface-connection-gater/LICENSE-MIT +++ /dev/null @@ -1,19 +0,0 @@ -The MIT License (MIT) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/packages/interface-connection-gater/README.md b/packages/interface-connection-gater/README.md deleted file mode 100644 index 39390efb68..0000000000 --- a/packages/interface-connection-gater/README.md +++ /dev/null @@ -1,36 +0,0 @@ -# @libp2p/interface-connection-gater - -[![libp2p.io](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](http://libp2p.io/) -[![Discuss](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg?style=flat-square)](https://discuss.libp2p.io) -[![codecov](https://img.shields.io/codecov/c/github/libp2p/js-libp2p.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p) -[![CI](https://img.shields.io/github/actions/workflow/status/libp2p/js-libp2p/main.yml?branch=master\&style=flat-square)](https://github.com/libp2p/js-libp2p/actions/workflows/main.yml?query=branch%3Amaster) - -> Connection gater interface for libp2p - -## Table of contents - -- [Install](#install) -- [API Docs](#api-docs) -- [License](#license) -- [Contribution](#contribution) - -## Install - -```console -$ npm i @libp2p/interface-connection-gater -``` - -## API Docs - -- - -## License - -Licensed under either of - -- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / ) -- MIT ([LICENSE-MIT](LICENSE-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/packages/interface-connection-gater/package.json b/packages/interface-connection-gater/package.json deleted file mode 100644 index 28ea0b4003..0000000000 --- a/packages/interface-connection-gater/package.json +++ /dev/null @@ -1,55 +0,0 @@ -{ - "name": "@libp2p/interface-connection-gater", - "version": "3.0.1", - "description": "Connection gater interface for libp2p", - "license": "Apache-2.0 OR MIT", - "homepage": "https://github.com/libp2p/js-libp2p/tree/master/packages/interface-connection-gater#readme", - "repository": { - "type": "git", - "url": "git+https://github.com/libp2p/js-libp2p.git" - }, - "bugs": { - "url": "https://github.com/libp2p/js-libp2p/issues" - }, - "keywords": [ - "interface", - "libp2p" - ], - "type": "module", - "types": "./dist/src/index.d.ts", - "files": [ - "src", - "dist", - "!dist/test", - "!**/*.tsbuildinfo" - ], - "exports": { - ".": { - "types": "./dist/src/index.d.ts", - "import": "./dist/src/index.js" - } - }, - "eslintConfig": { - "extends": "ipfs", - "parserOptions": { - "sourceType": "module" - } - }, - "scripts": { - "clean": "aegir clean", - "lint": "aegir lint", - "dep-check": "aegir dep-check", - "build": "aegir build" - }, - "dependencies": { - "@libp2p/interface-connection": "^5.0.0", - "@libp2p/interface-peer-id": "^2.0.0", - "@multiformats/multiaddr": "^12.1.3" - }, - "devDependencies": { - "aegir": "^39.0.10" - }, - "typedoc": { - "entryPoint": "./src/index.ts" - } -} diff --git a/packages/interface-connection-gater/tsconfig.json b/packages/interface-connection-gater/tsconfig.json deleted file mode 100644 index 16ab3d8b56..0000000000 --- a/packages/interface-connection-gater/tsconfig.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "extends": "aegir/src/config/tsconfig.aegir.json", - "compilerOptions": { - "outDir": "dist" - }, - "include": [ - "src" - ], - "references": [ - { - "path": "../interface-connection" - }, - { - "path": "../interface-peer-id" - } - ] -} diff --git a/packages/interface-connection-manager/CHANGELOG.md b/packages/interface-connection-manager/CHANGELOG.md deleted file mode 100644 index 75dd3e8235..0000000000 --- a/packages/interface-connection-manager/CHANGELOG.md +++ /dev/null @@ -1,179 +0,0 @@ -## [@libp2p/interface-connection-manager-v3.0.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-manager-v3.0.0...@libp2p/interface-connection-manager-v3.0.1) (2023-05-04) - - -### Dependencies - -* bump aegir from 38.1.8 to 39.0.5 ([#393](https://github.com/libp2p/js-libp2p-interfaces/issues/393)) ([31f3797](https://github.com/libp2p/js-libp2p-interfaces/commit/31f3797b24f7c23f3f16e9db3a230bd5f7cd5175)) - -## [@libp2p/interface-connection-manager-v3.0.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-manager-v2.1.1...@libp2p/interface-connection-manager-v3.0.0) (2023-04-21) - - -### ⚠ BREAKING CHANGES - -* add libp2p events (#373) - -### Features - -* add libp2p events ([#373](https://github.com/libp2p/js-libp2p-interfaces/issues/373)) ([071c718](https://github.com/libp2p/js-libp2p-interfaces/commit/071c718808902858818ca86167b51b242b67a5a5)) - -## [@libp2p/interface-connection-manager-v2.1.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-manager-v2.1.0...@libp2p/interface-connection-manager-v2.1.1) (2023-04-18) - - -### Dependencies - -* update sibling dependencies ([2f52a28](https://github.com/libp2p/js-libp2p-interfaces/commit/2f52a284b59c0a88b040f86da1f5d3f044727f2c)) - -## [@libp2p/interface-connection-manager-v2.1.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-manager-v2.0.0...@libp2p/interface-connection-manager-v2.1.0) (2023-04-14) - - -### Features - -* expose get connection map method of connection manager ([#372](https://github.com/libp2p/js-libp2p-interfaces/issues/372)) ([fc7245b](https://github.com/libp2p/js-libp2p-interfaces/commit/fc7245b63764562f5ec66a5a0ba334caea80ed66)) -* expose get dial queue method of connection manager ([#371](https://github.com/libp2p/js-libp2p-interfaces/issues/371)) ([0c407aa](https://github.com/libp2p/js-libp2p-interfaces/commit/0c407aa0772c171bf6650e31fb20a3433df40b6b)) - -## [@libp2p/interface-connection-manager-v2.0.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-manager-v1.5.0...@libp2p/interface-connection-manager-v2.0.0) (2023-04-14) - - -### ⚠ BREAKING CHANGES - -* the Dialer interface has been removed - -### Bug Fixes - -* remove dialer interface from interface connection manager ([#364](https://github.com/libp2p/js-libp2p-interfaces/issues/364)) ([5fb8a34](https://github.com/libp2p/js-libp2p-interfaces/commit/5fb8a342150efbc8c0ac8b1ae76ec53dc9f60ee9)) - -## [@libp2p/interface-connection-manager-v1.5.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-manager-v1.4.1...@libp2p/interface-connection-manager-v1.5.0) (2023-04-11) - - -### Features - -* add peer:prune event to connection manager ([#367](https://github.com/libp2p/js-libp2p-interfaces/issues/367)) ([45680c6](https://github.com/libp2p/js-libp2p-interfaces/commit/45680c614f082e1d02c5258559f3ee3b711e6a87)) - -## [@libp2p/interface-connection-manager-v1.4.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-manager-v1.4.0...@libp2p/interface-connection-manager-v1.4.1) (2023-04-11) - - -### Dependencies - -* update sibling dependencies ([b034810](https://github.com/libp2p/js-libp2p-interfaces/commit/b0348102e41dc18166e70063f4708a2b3544f4b6)) - -## [@libp2p/interface-connection-manager-v1.4.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-manager-v1.3.8...@libp2p/interface-connection-manager-v1.4.0) (2023-04-05) - - -### Features - -* support batch dialling ([#351](https://github.com/libp2p/js-libp2p-interfaces/issues/351)) ([e46b72b](https://github.com/libp2p/js-libp2p-interfaces/commit/e46b72b1731ff935a1f0d755cbaf6f3159060ed3)) - -## [@libp2p/interface-connection-manager-v1.3.8](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-manager-v1.3.7...@libp2p/interface-connection-manager-v1.3.8) (2023-03-17) - - -### Dependencies - -* update @multiformats/multiaddr to 12.0.0 ([#354](https://github.com/libp2p/js-libp2p-interfaces/issues/354)) ([e0f327b](https://github.com/libp2p/js-libp2p-interfaces/commit/e0f327b5d54e240feabadce21a841629d633ec5e)) - -## [@libp2p/interface-connection-manager-v1.3.7](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-manager-v1.3.6...@libp2p/interface-connection-manager-v1.3.7) (2023-01-18) - - -### Dependencies - -* bump aegir from 37.12.1 to 38.1.0 ([#335](https://github.com/libp2p/js-libp2p-interfaces/issues/335)) ([7368a36](https://github.com/libp2p/js-libp2p-interfaces/commit/7368a363423a08e8fa247dcb76ea13e4cf030d65)) - -## [@libp2p/interface-connection-manager-v1.3.6](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-manager-v1.3.5...@libp2p/interface-connection-manager-v1.3.6) (2023-01-14) - - -### Bug Fixes - -* accept multiaddr param when opening connections ([#336](https://github.com/libp2p/js-libp2p-interfaces/issues/336)) ([fef9c26](https://github.com/libp2p/js-libp2p-interfaces/commit/fef9c26847cf63cb95f5fcb51ee40cbc679cc6bf)) - - -### Trivial Changes - -* remove lerna ([#330](https://github.com/libp2p/js-libp2p-interfaces/issues/330)) ([6678592](https://github.com/libp2p/js-libp2p-interfaces/commit/6678592dd0cf601a2671852f9d2a0aff5dee2b18)) - -## [@libp2p/interface-connection-manager-v1.3.5](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-manager-v1.3.4...@libp2p/interface-connection-manager-v1.3.5) (2023-01-06) - - -### Dependencies - -* update sibling dependencies ([b50e621](https://github.com/libp2p/js-libp2p-interfaces/commit/b50e621d31a8b32affc3fadb9f97c4883d577f93)) - -## [@libp2p/interface-connection-manager-v1.3.4](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-manager-v1.3.3...@libp2p/interface-connection-manager-v1.3.4) (2022-12-19) - - -### Documentation - -* add interface docs ([#324](https://github.com/libp2p/js-libp2p-interfaces/issues/324)) ([2789445](https://github.com/libp2p/js-libp2p-interfaces/commit/278944594c24e1a3c4b3624a35680d69166546d7)) - -## [@libp2p/interface-connection-manager-v1.3.3](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-manager-v1.3.2...@libp2p/interface-connection-manager-v1.3.3) (2022-12-16) - - -### Documentation - -* update project config ([#323](https://github.com/libp2p/js-libp2p-interfaces/issues/323)) ([0fc6a08](https://github.com/libp2p/js-libp2p-interfaces/commit/0fc6a08e9cdcefe361fe325281a3a2a03759ff59)) - -## [@libp2p/interface-connection-manager-v1.3.2](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-manager-v1.3.1...@libp2p/interface-connection-manager-v1.3.2) (2022-12-14) - - -### Bug Fixes - -* generate docs for all packages ([#321](https://github.com/libp2p/js-libp2p-interfaces/issues/321)) ([b6f8b32](https://github.com/libp2p/js-libp2p-interfaces/commit/b6f8b32a920c15a28fe021e6050e31aaae89d518)) - -## [@libp2p/interface-connection-manager-v1.3.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-manager-v1.3.0...@libp2p/interface-connection-manager-v1.3.1) (2022-11-05) - - -### Bug Fixes - -* update project config ([#311](https://github.com/libp2p/js-libp2p-interfaces/issues/311)) ([27dd0ce](https://github.com/libp2p/js-libp2p-interfaces/commit/27dd0ce3c249892ac69cbb24ddaf0b9f32385e37)) - -## [@libp2p/interface-connection-manager-v1.3.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-manager-v1.2.0...@libp2p/interface-connection-manager-v1.3.0) (2022-10-11) - - -### Features - -* add afterUpgradeInbound method ([#300](https://github.com/libp2p/js-libp2p-interfaces/issues/300)) ([fbdf5f5](https://github.com/libp2p/js-libp2p-interfaces/commit/fbdf5f54277735a26df0a28099eeae9d57159978)) - -## [@libp2p/interface-connection-manager-v1.2.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-manager-v1.1.1...@libp2p/interface-connection-manager-v1.2.0) (2022-10-04) - - -### Features - -* add acceptIncomingConnection to ConnectionManager ([#295](https://github.com/libp2p/js-libp2p-interfaces/issues/295)) ([5d460e8](https://github.com/libp2p/js-libp2p-interfaces/commit/5d460e8815a8b49915da7ffabccc4a8b96a61acc)) - -## [@libp2p/interface-connection-manager-v1.1.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-manager-v1.1.0...@libp2p/interface-connection-manager-v1.1.1) (2022-09-21) - - -### Dependencies - -* update @multiformats/multiaddr to 11.0.0 ([#288](https://github.com/libp2p/js-libp2p-interfaces/issues/288)) ([57b2ad8](https://github.com/libp2p/js-libp2p-interfaces/commit/57b2ad88edfc7807311143791bc49270b1a81eaf)) - -## [@libp2p/interface-connection-manager-v1.1.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-manager-v1.0.3...@libp2p/interface-connection-manager-v1.1.0) (2022-09-09) - - -### Features - -* add dialer interface ([#285](https://github.com/libp2p/js-libp2p-interfaces/issues/285)) ([1e62df4](https://github.com/libp2p/js-libp2p-interfaces/commit/1e62df4f15b45abe62fe8400dbd88866a2bc13cd)) - -## [@libp2p/interface-connection-manager-v1.0.3](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-manager-v1.0.2...@libp2p/interface-connection-manager-v1.0.3) (2022-08-07) - - -### Trivial Changes - -* update project config ([#271](https://github.com/libp2p/js-libp2p-interfaces/issues/271)) ([59c0bf5](https://github.com/libp2p/js-libp2p-interfaces/commit/59c0bf5e0b05496fca2e4902632b61bb41fad9e9)) - - -### Dependencies - -* update sibling dependencies ([f859920](https://github.com/libp2p/js-libp2p-interfaces/commit/f859920423587ae797ac90ccaa3af8bdf60ae549)) - -## [@libp2p/interface-connection-manager-v1.0.2](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-manager-v1.0.1...@libp2p/interface-connection-manager-v1.0.2) (2022-06-27) - - -### Trivial Changes - -* update deps ([#262](https://github.com/libp2p/js-libp2p-interfaces/issues/262)) ([51edf7d](https://github.com/libp2p/js-libp2p-interfaces/commit/51edf7d9b3765a6f75c915b1483ea345d0133a41)) - -## [@libp2p/interface-connection-manager-v1.0.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-manager-v1.0.0...@libp2p/interface-connection-manager-v1.0.1) (2022-06-16) - - -### Trivial Changes - -* update deps ([545264f](https://github.com/libp2p/js-libp2p-interfaces/commit/545264f87a58394d2a7da77e93f3a596e889238f)) diff --git a/packages/interface-connection-manager/LICENSE b/packages/interface-connection-manager/LICENSE deleted file mode 100644 index 20ce483c86..0000000000 --- a/packages/interface-connection-manager/LICENSE +++ /dev/null @@ -1,4 +0,0 @@ -This project is dual licensed under MIT and Apache-2.0. - -MIT: https://www.opensource.org/licenses/mit -Apache-2.0: https://www.apache.org/licenses/license-2.0 diff --git a/packages/interface-connection-manager/LICENSE-APACHE b/packages/interface-connection-manager/LICENSE-APACHE deleted file mode 100644 index 14478a3b60..0000000000 --- a/packages/interface-connection-manager/LICENSE-APACHE +++ /dev/null @@ -1,5 +0,0 @@ -Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - -http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. diff --git a/packages/interface-connection-manager/LICENSE-MIT b/packages/interface-connection-manager/LICENSE-MIT deleted file mode 100644 index 72dc60d84b..0000000000 --- a/packages/interface-connection-manager/LICENSE-MIT +++ /dev/null @@ -1,19 +0,0 @@ -The MIT License (MIT) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/packages/interface-connection-manager/README.md b/packages/interface-connection-manager/README.md deleted file mode 100644 index da02f4466c..0000000000 --- a/packages/interface-connection-manager/README.md +++ /dev/null @@ -1,43 +0,0 @@ -# @libp2p/interface-connection-manager - -[![libp2p.io](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](http://libp2p.io/) -[![Discuss](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg?style=flat-square)](https://discuss.libp2p.io) -[![codecov](https://img.shields.io/codecov/c/github/libp2p/js-libp2p.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p) -[![CI](https://img.shields.io/github/actions/workflow/status/libp2p/js-libp2p/main.yml?branch=master\&style=flat-square)](https://github.com/libp2p/js-libp2p/actions/workflows/main.yml?query=branch%3Amaster) - -> Connection Manager interface for libp2p - -## Table of contents - -- [Install](#install) -- [Usage](#usage) -- [API Docs](#api-docs) -- [License](#license) -- [Contribution](#contribution) - -## Install - -```console -$ npm i @libp2p/interface-connection-manager -``` - -## Usage - -```js -import type { ConnectionManager } from '@libp2p/interface-connection-manager' -``` - -## API Docs - -- - -## License - -Licensed under either of - -- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / ) -- MIT ([LICENSE-MIT](LICENSE-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/packages/interface-connection-manager/package.json b/packages/interface-connection-manager/package.json deleted file mode 100644 index 1f9076c2f4..0000000000 --- a/packages/interface-connection-manager/package.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "name": "@libp2p/interface-connection-manager", - "version": "3.0.1", - "description": "Connection Manager interface for libp2p", - "license": "Apache-2.0 OR MIT", - "homepage": "https://github.com/libp2p/js-libp2p/tree/master/packages/interface-connection-manager#readme", - "repository": { - "type": "git", - "url": "git+https://github.com/libp2p/js-libp2p.git" - }, - "bugs": { - "url": "https://github.com/libp2p/js-libp2p/issues" - }, - "keywords": [ - "interface", - "libp2p" - ], - "type": "module", - "types": "./dist/src/index.d.ts", - "files": [ - "src", - "dist", - "!dist/test", - "!**/*.tsbuildinfo" - ], - "exports": { - ".": { - "types": "./dist/src/index.d.ts", - "import": "./dist/src/index.js" - } - }, - "eslintConfig": { - "extends": "ipfs", - "parserOptions": { - "sourceType": "module" - } - }, - "scripts": { - "clean": "aegir clean", - "lint": "aegir lint", - "dep-check": "aegir dep-check", - "build": "aegir build" - }, - "dependencies": { - "@libp2p/interface-connection": "^5.0.0", - "@libp2p/interface-peer-id": "^2.0.0", - "@libp2p/interfaces": "^3.0.0", - "@libp2p/peer-collections": "^3.0.0", - "@multiformats/multiaddr": "^12.1.3" - }, - "devDependencies": { - "aegir": "^39.0.10" - }, - "typedoc": { - "entryPoint": "./src/index.ts" - } -} diff --git a/packages/interface-connection-manager/tsconfig.json b/packages/interface-connection-manager/tsconfig.json deleted file mode 100644 index 3e21f519cc..0000000000 --- a/packages/interface-connection-manager/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "extends": "aegir/src/config/tsconfig.aegir.json", - "compilerOptions": { - "outDir": "dist" - }, - "include": [ - "src" - ], - "references": [ - { - "path": "../interface-connection" - }, - { - "path": "../interface-peer-id" - }, - { - "path": "../interfaces" - }, - { - "path": "../peer-collections" - } - ] -} diff --git a/packages/interface-connection/CHANGELOG.md b/packages/interface-connection/CHANGELOG.md deleted file mode 100644 index 4cbc441900..0000000000 --- a/packages/interface-connection/CHANGELOG.md +++ /dev/null @@ -1,188 +0,0 @@ -## [@libp2p/interface-connection-v5.1.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-v5.1.0...@libp2p/interface-connection-v5.1.1) (2023-06-14) - - -### Bug Fixes - -* add maxOutboundStreams option to connection.newStream ([#415](https://github.com/libp2p/js-libp2p-interfaces/issues/415)) ([45ae18f](https://github.com/libp2p/js-libp2p-interfaces/commit/45ae18fe30436dedf418e0fa328f1af9a18a9a98)) - -## [@libp2p/interface-connection-v5.1.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-v5.0.2...@libp2p/interface-connection-v5.1.0) (2023-05-16) - - -### Features - -* add closeRead and closeWrite to stream timeline properties ([#401](https://github.com/libp2p/js-libp2p-interfaces/issues/401)) ([b1de032](https://github.com/libp2p/js-libp2p-interfaces/commit/b1de0327cc6128b52ff1ceabe333481fb8a24bcb)) - -## [@libp2p/interface-connection-v5.0.2](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-v5.0.1...@libp2p/interface-connection-v5.0.2) (2023-05-04) - - -### Dependencies - -* bump aegir from 38.1.8 to 39.0.5 ([#393](https://github.com/libp2p/js-libp2p-interfaces/issues/393)) ([31f3797](https://github.com/libp2p/js-libp2p-interfaces/commit/31f3797b24f7c23f3f16e9db3a230bd5f7cd5175)) - -## [@libp2p/interface-connection-v5.0.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-v5.0.0...@libp2p/interface-connection-v5.0.1) (2023-04-18) - - -### Bug Fixes - -* specify stream sink return type ([#378](https://github.com/libp2p/js-libp2p-interfaces/issues/378)) ([e0641fc](https://github.com/libp2p/js-libp2p-interfaces/commit/e0641fcc2f2a6562e7f7d8e064ebd98c5cc6dccb)) - -## [@libp2p/interface-connection-v5.0.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-v4.0.0...@libp2p/interface-connection-v5.0.0) (2023-04-18) - - -### ⚠ BREAKING CHANGES - -* bump it-stream-types from 1.0.5 to 2.0.1 (#362) - -### Dependencies - -* bump it-stream-types from 1.0.5 to 2.0.1 ([#362](https://github.com/libp2p/js-libp2p-interfaces/issues/362)) ([cdc7747](https://github.com/libp2p/js-libp2p-interfaces/commit/cdc774792beead63e0ded96bd6c23de0335a49e3)) - -## [@libp2p/interface-connection-v4.0.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-v3.1.1...@libp2p/interface-connection-v4.0.0) (2023-04-11) - - -### ⚠ BREAKING CHANGES - -* remove connection gater from interface-connection (#365) - -### Bug Fixes - -* remove connection gater from interface-connection ([#365](https://github.com/libp2p/js-libp2p-interfaces/issues/365)) ([1cc13d3](https://github.com/libp2p/js-libp2p-interfaces/commit/1cc13d3f0cbb9a82cdfca77af2a4deb5e20e8f6a)) - -## [@libp2p/interface-connection-v3.1.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-v3.1.0...@libp2p/interface-connection-v3.1.1) (2023-03-17) - - -### Dependencies - -* update @multiformats/multiaddr to 12.0.0 ([#354](https://github.com/libp2p/js-libp2p-interfaces/issues/354)) ([e0f327b](https://github.com/libp2p/js-libp2p-interfaces/commit/e0f327b5d54e240feabadce21a841629d633ec5e)) - -## [@libp2p/interface-connection-v3.1.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-v3.0.8...@libp2p/interface-connection-v3.1.0) (2023-03-09) - - -### Features - -* split connection gater out into module ([#347](https://github.com/libp2p/js-libp2p-interfaces/issues/347)) ([1824744](https://github.com/libp2p/js-libp2p-interfaces/commit/18247442aa64c809d9e101ccbd0067ce48bdb80f)) - -## [@libp2p/interface-connection-v3.0.8](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-v3.0.7...@libp2p/interface-connection-v3.0.8) (2023-01-18) - - -### Trivial Changes - -* remove lerna ([#330](https://github.com/libp2p/js-libp2p-interfaces/issues/330)) ([6678592](https://github.com/libp2p/js-libp2p-interfaces/commit/6678592dd0cf601a2671852f9d2a0aff5dee2b18)) - - -### Dependencies - -* bump aegir from 37.12.1 to 38.1.0 ([#335](https://github.com/libp2p/js-libp2p-interfaces/issues/335)) ([7368a36](https://github.com/libp2p/js-libp2p-interfaces/commit/7368a363423a08e8fa247dcb76ea13e4cf030d65)) - -## [@libp2p/interface-connection-v3.0.7](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-v3.0.6...@libp2p/interface-connection-v3.0.7) (2023-01-06) - - -### Dependencies - -* update sibling dependencies ([b50e621](https://github.com/libp2p/js-libp2p-interfaces/commit/b50e621d31a8b32affc3fadb9f97c4883d577f93)) - -## [@libp2p/interface-connection-v3.0.6](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-v3.0.5...@libp2p/interface-connection-v3.0.6) (2022-12-19) - - -### Documentation - -* add interface docs ([#324](https://github.com/libp2p/js-libp2p-interfaces/issues/324)) ([2789445](https://github.com/libp2p/js-libp2p-interfaces/commit/278944594c24e1a3c4b3624a35680d69166546d7)) - -## [@libp2p/interface-connection-v3.0.5](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-v3.0.4...@libp2p/interface-connection-v3.0.5) (2022-12-16) - - -### Documentation - -* update project config ([#323](https://github.com/libp2p/js-libp2p-interfaces/issues/323)) ([0fc6a08](https://github.com/libp2p/js-libp2p-interfaces/commit/0fc6a08e9cdcefe361fe325281a3a2a03759ff59)) - -## [@libp2p/interface-connection-v3.0.4](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-v3.0.3...@libp2p/interface-connection-v3.0.4) (2022-12-14) - - -### Bug Fixes - -* generate docs for all packages ([#321](https://github.com/libp2p/js-libp2p-interfaces/issues/321)) ([b6f8b32](https://github.com/libp2p/js-libp2p-interfaces/commit/b6f8b32a920c15a28fe021e6050e31aaae89d518)) - -## [@libp2p/interface-connection-v3.0.3](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-v3.0.2...@libp2p/interface-connection-v3.0.3) (2022-11-05) - - -### Bug Fixes - -* update project config ([#311](https://github.com/libp2p/js-libp2p-interfaces/issues/311)) ([27dd0ce](https://github.com/libp2p/js-libp2p-interfaces/commit/27dd0ce3c249892ac69cbb24ddaf0b9f32385e37)) - -## [@libp2p/interface-connection-v3.0.2](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-v3.0.1...@libp2p/interface-connection-v3.0.2) (2022-09-21) - - -### Dependencies - -* update @multiformats/multiaddr to 11.0.0 ([#288](https://github.com/libp2p/js-libp2p-interfaces/issues/288)) ([57b2ad8](https://github.com/libp2p/js-libp2p-interfaces/commit/57b2ad88edfc7807311143791bc49270b1a81eaf)) - -## [@libp2p/interface-connection-v3.0.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-v3.0.0...@libp2p/interface-connection-v3.0.1) (2022-08-10) - - -### Bug Fixes - -* revert connection encryption change to accept Uint8ArrayLists ([#280](https://github.com/libp2p/js-libp2p-interfaces/issues/280)) ([03d763c](https://github.com/libp2p/js-libp2p-interfaces/commit/03d763c1a6b168bba001783a1fb59af3f7d4e205)) - -## [@libp2p/interface-connection-v3.0.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-v2.1.1...@libp2p/interface-connection-v3.0.0) (2022-08-07) - - -### ⚠ BREAKING CHANGES - -* change stream muxer interface (#279) -* change connection encryption interface to uint8arraylist (#278) - -### Features - -* change connection encryption interface to uint8arraylist ([#278](https://github.com/libp2p/js-libp2p-interfaces/issues/278)) ([1fa580c](https://github.com/libp2p/js-libp2p-interfaces/commit/1fa580c5a45325dc9384738e9a78a238eabb81c3)) -* change stream muxer interface ([#279](https://github.com/libp2p/js-libp2p-interfaces/issues/279)) ([1ebe269](https://github.com/libp2p/js-libp2p-interfaces/commit/1ebe26988b6a286f36a4fc5177f502cfb60368a1)) - - -### Trivial Changes - -* update project config ([#271](https://github.com/libp2p/js-libp2p-interfaces/issues/271)) ([59c0bf5](https://github.com/libp2p/js-libp2p-interfaces/commit/59c0bf5e0b05496fca2e4902632b61bb41fad9e9)) - -## [@libp2p/interface-connection-v2.1.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-v2.1.0...@libp2p/interface-connection-v2.1.1) (2022-06-27) - - -### Trivial Changes - -* update deps ([#262](https://github.com/libp2p/js-libp2p-interfaces/issues/262)) ([51edf7d](https://github.com/libp2p/js-libp2p-interfaces/commit/51edf7d9b3765a6f75c915b1483ea345d0133a41)) - -## [@libp2p/interface-connection-v2.1.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-v2.0.0...@libp2p/interface-connection-v2.1.0) (2022-06-21) - - -### Features - -* add direction to StreamMuxerInit ([#253](https://github.com/libp2p/js-libp2p-interfaces/issues/253)) ([6d34d75](https://github.com/libp2p/js-libp2p-interfaces/commit/6d34d755ff4e798d52945f1f099052bdd6a83f2b)) - -## [@libp2p/interface-connection-v2.0.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-v1.0.1...@libp2p/interface-connection-v2.0.0) (2022-06-16) - - -### ⚠ BREAKING CHANGES - -* The Connection and Stream APIs have been updated - -### Features - -* store stream data on the stream, track the stream direction ([#245](https://github.com/libp2p/js-libp2p-interfaces/issues/245)) ([6d74d2f](https://github.com/libp2p/js-libp2p-interfaces/commit/6d74d2f9f344fb4d6741ba0d35263ebe351a4c65)) - -## [@libp2p/interface-connection-v1.0.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-connection-v1.0.0...@libp2p/interface-connection-v1.0.1) (2022-06-14) - - -### Trivial Changes - -* **release:** 1.0.0 [skip ci] ([0005492](https://github.com/libp2p/js-libp2p-interfaces/commit/0005492cc5958d261017f6db5fe1073b83b46265)), closes [#226](https://github.com/libp2p/js-libp2p-interfaces/issues/226) [#234](https://github.com/libp2p/js-libp2p-interfaces/issues/234) [#233](https://github.com/libp2p/js-libp2p-interfaces/issues/233) - -## @libp2p/interface-connection-v1.0.0 (2022-06-14) - - -### ⚠ BREAKING CHANGES - -* most modules have been split out of the `@libp2p/interfaces` and `@libp2p/interface-compliance-tests` packages - -### Trivial Changes - -* break modules apart ([#232](https://github.com/libp2p/js-libp2p-interfaces/issues/232)) ([385614e](https://github.com/libp2p/js-libp2p-interfaces/commit/385614e772329052ab17415c8bd421f65b01a61b)), closes [#226](https://github.com/libp2p/js-libp2p-interfaces/issues/226) -* release [skip ci] ([357286d](https://github.com/libp2p/js-libp2p-interfaces/commit/357286df899899cf7a94348aeb8dd7387f7acad5)) -* update aegir ([#234](https://github.com/libp2p/js-libp2p-interfaces/issues/234)) ([3e03895](https://github.com/libp2p/js-libp2p-interfaces/commit/3e038959ecab6cfa3585df9ee179c0af7a61eda5)) -* update readmes ([#233](https://github.com/libp2p/js-libp2p-interfaces/issues/233)) ([ee7da38](https://github.com/libp2p/js-libp2p-interfaces/commit/ee7da38dccc08160d26c8436df8739ce7e0b340e)) diff --git a/packages/interface-connection/LICENSE b/packages/interface-connection/LICENSE deleted file mode 100644 index 20ce483c86..0000000000 --- a/packages/interface-connection/LICENSE +++ /dev/null @@ -1,4 +0,0 @@ -This project is dual licensed under MIT and Apache-2.0. - -MIT: https://www.opensource.org/licenses/mit -Apache-2.0: https://www.apache.org/licenses/license-2.0 diff --git a/packages/interface-connection/LICENSE-APACHE b/packages/interface-connection/LICENSE-APACHE deleted file mode 100644 index 14478a3b60..0000000000 --- a/packages/interface-connection/LICENSE-APACHE +++ /dev/null @@ -1,5 +0,0 @@ -Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - -http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. diff --git a/packages/interface-connection/LICENSE-MIT b/packages/interface-connection/LICENSE-MIT deleted file mode 100644 index 72dc60d84b..0000000000 --- a/packages/interface-connection/LICENSE-MIT +++ /dev/null @@ -1,19 +0,0 @@ -The MIT License (MIT) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/packages/interface-connection/README.md b/packages/interface-connection/README.md deleted file mode 100644 index bbcc1a18e1..0000000000 --- a/packages/interface-connection/README.md +++ /dev/null @@ -1,315 +0,0 @@ -# @libp2p/interface-connection - -[![libp2p.io](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](http://libp2p.io/) -[![Discuss](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg?style=flat-square)](https://discuss.libp2p.io) -[![codecov](https://img.shields.io/codecov/c/github/libp2p/js-libp2p.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p) -[![CI](https://img.shields.io/github/actions/workflow/status/libp2p/js-libp2p/main.yml?branch=master\&style=flat-square)](https://github.com/libp2p/js-libp2p/actions/workflows/main.yml?query=branch%3Amaster) - -> Connection interface for libp2p - -## Table of contents - -- [Install](#install) -- [Usage](#usage) -- [Connection](#connection) -- [Test suite](#test-suite) -- [API](#api) - - [Connection](#connection-1) - - [Creating a connection instance](#creating-a-connection-instance) - - [Create a new stream](#create-a-new-stream) - - [Add stream metadata](#add-stream-metadata) - - [Remove a from the registry](#remove-a-from-the-registry) - - [Close connection](#close-connection) - - [Connection identifier](#connection-identifier) - - [Connection streams registry](#connection-streams-registry) - - [Remote peer](#remote-peer) - - [Local peer](#local-peer) - - [Get the connection Streams](#get-the-connection-streams) - - [Remote address](#remote-address) - - [Local address](#local-address) - - [Stat](#stat) - - [Tags](#tags) -- [API Docs](#api-docs) -- [License](#license) -- [Contribution](#contribution) - -## Install - -```console -$ npm i @libp2p/interface-connection -``` - -## Usage - -```js -import type { Connection } from '@libp2p/interface-connection' -``` - -This is a test suite and interface you can use to implement a connection. The connection interface contains all the metadata associated with it, as well as an array of the streams opened through this connection. In the same way as the connection, a stream contains properties with its metadata, plus an iterable duplex object that offers a mechanism for writing and reading data, with back pressure. This module and test suite were heavily inspired by abstract-blob-store and interface-stream-muxer. - -The primary goal of this module is to enable developers to pick, swap or upgrade their connection without losing the same API expectations and mechanisms such as back pressure and the ability to half close a connection. - -Publishing a test suite as a module lets multiple modules ensure compatibility since they use the same test suite. - -## Connection - -Before creating a connection from a transport compatible with `libp2p` it is important to understand some concepts: - -- **socket**: the underlying raw duplex connection between two nodes. It is created by the transports during a dial/listen. -- **[multiaddr connection](https://github.com/libp2p/interface-transport#multiaddrconnection)**: an abstraction over the socket to allow it to work with multiaddr addresses. It is a duplex connection that transports create to wrap the socket before passing to an upgrader that turns it into a standard connection (see below). -- **connection**: a connection between two *peers* that has built in multiplexing and info about the connected peer. It is created from a [multiaddr connection](https://github.com/libp2p/interface-transport#multiaddrconnection) by an upgrader. The upgrader uses multistream-select to add secio and multiplexing and returns this object. -- **stream**: a muxed duplex channel of the `connection`. Each connection may have many streams. - -A connection stands for the libp2p communication duplex layer between two nodes. It is **not** the underlying raw transport duplex layer (socket), such as a TCP socket, but an abstracted layer that sits on top of the raw socket. - -This helps ensuring that the transport is responsible for socket management, while also allowing the application layer to handle the connection management. - -## Test suite - -```js -const tests = require('@libp2p/interface-connection-compliance-tests') -describe('your connection', () => { - tests({ - // Options should be passed to your connection - async setup (options) { - return YourConnection - }, - async teardown () { - // cleanup resources created by setup() - } - }) -}) -``` - -## API - -### Connection - -A valid connection (one that follows this abstraction), must implement the following API: - -- type: `Connection` - -```js -new Connection({ - localAddr, - remoteAddr, - localPeer, - remotePeer, - newStream, - close, - getStreams, - stat: { - direction, - timeline: { - open, - upgraded - }, - multiplexer, - encryption - } -}) -``` - -- ` conn.localAddr` -- ` conn.remoteAddr` -- ` conn.localPeer` -- ` conn.remotePeer` -- ` conn.stat` -- ` conn.registry` -- `Array conn.streams` -- `Promise conn.newStream(Array)` -- ` conn.removeStream(id)` -- ` conn.addStream(stream, protocol, metadata)` -- `Promise<> conn.close()` - -It can be obtained as follows: - -```js -const { Connection } = require('interface-connection') - -const conn = new Connection({ - localAddr: maConn.localAddr, - remoteAddr: maConn.remoteAddr, - localPeer: this._peerId, - remotePeer, - newStream, - close: err => maConn.close(err), - getStreams, - stats: { - direction: 'outbound', - timeline: { - open: maConn.timeline.open, - upgraded: Date.now() - }, - multiplexer, - encryption - } -}) -``` - -#### Creating a connection instance - -- `JavaScript` - `const conn = new Connection({localAddr, remoteAddr, localPeer, remotePeer, newStream, close, getStreams, direction, multiplexer, encryption})` - -Creates a new Connection instance. - -`localAddr` is the optional [multiaddr](https://github.com/multiformats/multiaddr) address used by the local peer to reach the remote. -`remoteAddr` is the optional [multiaddr](https://github.com/multiformats/multiaddr) address used to communicate with the remote peer. -`localPeer` is the [PeerId](https://github.com/libp2p/js-peer-id) of the local peer. -`remotePeer` is the [PeerId](https://github.com/libp2p/js-peer-id) of the remote peer. -`newStream` is the `function` responsible for getting a new muxed+multistream-selected stream. -`close` is the `function` responsible for closing the raw connection. -`getStreams` is the `function` responsible for getting the streams muxed within the connection. -`stats` is an `object` with the metadata of the connection. It contains: - -- `direction` is a `string` indicating whether the connection is `inbound` or `outbound`. -- `timeline` is an `object` with the relevant events timestamps of the connection (`open`, `upgraded` and `closed`; the `closed` will be added when the connection is closed). -- `multiplexer` is a `string` with the connection multiplexing codec (optional). -- `encryption` is a `string` with the connection encryption method identifier (optional). -- `status` is a `string` indicating the overall status of the connection. It is one of \[`'open'`, `'closing'`, `'closed'`] - -#### Create a new stream - -- `JavaScript` - `conn.newStream(protocols)` - -Create a new stream within the connection. - -`protocols` is an array of the intended protocol to use (by order of preference). Example: `[/echo/1.0.0]` - -It returns a `Promise` with an object with the following properties: - -```js -{ - stream, - protocol -} -``` - -The stream property contains the muxed stream, while the protocol contains the protocol codec used by the stream. - -#### Add stream metadata - -- `JavaScript` - `conn.addStream(stream, { protocol, ...metadata })` - -Add a new stream to the connection registry. - -`stream` is a muxed stream. -`protocol` is the string codec for the protocol used by the stream. Example: `/echo/1.0.0` -`metadata` is an object containing any additional, optional, stream metadata that you wish to track (such as its `tags`). - -#### Remove a from the registry - -- `JavaScript` - `conn.removeStream(id)` - -Removes the stream with the given id from the connection registry. - -`id` is the unique id of the stream for this connection. - -#### Close connection - -- `JavaScript` - `conn.close()` - -This method closes the connection to the remote peer, as well as all the streams muxed within the connection. - -It returns a `Promise`. - -#### Connection identifier - -- `JavaScript` - `conn.id` - -This property contains the identifier of the connection. - -#### Connection streams registry - -- `JavaScript` - `conn.registry` - -This property contains a map with the muxed streams indexed by their id. This registry contains the protocol used by the stream, as well as its metadata. - -#### Remote peer - -- `JavaScript` - `conn.remotePeer` - -This property contains the remote `peer-id` of this connection. - -#### Local peer - -- `JavaScript` - `conn.localPeer` - -This property contains the local `peer-id` of this connection. - -#### Get the connection Streams - -- `JavaScript` - `conn.streams` - -This getter returns all the muxed streams within the connection. - -It returns an `Array`. - -#### Remote address - -- `JavaScript` - `conn.remoteAddr` - -This getter returns the `remote` [multiaddr](https://github.com/multiformats/multiaddr) address. - -#### Local address - -- `JavaScript` - `conn.localAddr` - -This getter returns the `local` [multiaddr](https://github.com/multiformats/multiaddr) address. - -#### Stat - -- `JavaScript` - `conn.stat` - -This getter returns an `Object` with the metadata of the connection, as follows: - -- `status`: - -This property contains the status of the connection. It can be either `open`, `closing` or `closed`. Once the connection is created it is in an `open` status. When a `conn.close()` happens, the status will change to `closing` and finally, after all the connection streams are properly closed, the status will be `closed`. These values can also be directly referenced by importing the `status` file: - -```js -const { - OPEN, CLOSING, CLOSED -} = require('libp2p-interfaces/src/connection/status') - -if (connection.stat.status === OPEN) { - // ... -} -``` - -- `timeline`: - -This property contains an object with the `open`, `upgraded` and `close` timestamps of the connection. Note that, the `close` timestamp is `undefined` until the connection is closed. - -- `direction`: - -This property contains the direction of the peer in the connection. It can be `inbound` or `outbound`. - -- `multiplexer`: - -This property contains the `multiplexing` codec being used in the connection. - -- `encryption`: - -This property contains the encryption method being used in the connection. It is `undefined` if the connection is not encrypted. - -#### Tags - -- `JavaScript` - `conn.tags` - -This property contains an array of tags associated with the connection. New tags can be pushed to this array during the connection's lifetime. - -## API Docs - -- - -## License - -Licensed under either of - -- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / ) -- MIT ([LICENSE-MIT](LICENSE-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/packages/interface-connection/img/badge.png b/packages/interface-connection/img/badge.png deleted file mode 100644 index a79ca44967..0000000000 Binary files a/packages/interface-connection/img/badge.png and /dev/null differ diff --git a/packages/interface-connection/img/badge.sketch b/packages/interface-connection/img/badge.sketch deleted file mode 100644 index a4c4a438a2..0000000000 Binary files a/packages/interface-connection/img/badge.sketch and /dev/null differ diff --git a/packages/interface-connection/img/badge.svg b/packages/interface-connection/img/badge.svg deleted file mode 100644 index a240ced76c..0000000000 --- a/packages/interface-connection/img/badge.svg +++ /dev/null @@ -1,19 +0,0 @@ - - - - badge - Created with Sketch. - - - - - - Connectio - n - - - Compatibl - e - - - \ No newline at end of file diff --git a/packages/interface-content-routing/CHANGELOG.md b/packages/interface-content-routing/CHANGELOG.md deleted file mode 100644 index a2a789a7c3..0000000000 --- a/packages/interface-content-routing/CHANGELOG.md +++ /dev/null @@ -1,111 +0,0 @@ -## [@libp2p/interface-content-routing-v2.1.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-content-routing-v2.1.0...@libp2p/interface-content-routing-v2.1.1) (2023-05-04) - - -### Dependencies - -* bump aegir from 38.1.8 to 39.0.5 ([#393](https://github.com/libp2p/js-libp2p-interfaces/issues/393)) ([31f3797](https://github.com/libp2p/js-libp2p-interfaces/commit/31f3797b24f7c23f3f16e9db3a230bd5f7cd5175)) - -## [@libp2p/interface-content-routing-v2.1.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-content-routing-v2.0.2...@libp2p/interface-content-routing-v2.1.0) (2023-04-27) - - -### Features - -* add routing symbols ([#388](https://github.com/libp2p/js-libp2p-interfaces/issues/388)) ([9ee7691](https://github.com/libp2p/js-libp2p-interfaces/commit/9ee76915d2b8298d99557e105c4f71d585e97e7d)) - -## [@libp2p/interface-content-routing-v2.0.2](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-content-routing-v2.0.1...@libp2p/interface-content-routing-v2.0.2) (2023-03-08) - - -### Documentation - -* update content/peer routing interface comments ([#346](https://github.com/libp2p/js-libp2p-interfaces/issues/346)) ([8080944](https://github.com/libp2p/js-libp2p-interfaces/commit/8080944d3c3a81834c6b432843441996cd9e34e5)) - -## [@libp2p/interface-content-routing-v2.0.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-content-routing-v2.0.0...@libp2p/interface-content-routing-v2.0.1) (2023-01-18) - - -### Trivial Changes - -* remove lerna ([#330](https://github.com/libp2p/js-libp2p-interfaces/issues/330)) ([6678592](https://github.com/libp2p/js-libp2p-interfaces/commit/6678592dd0cf601a2671852f9d2a0aff5dee2b18)) - - -### Dependencies - -* bump aegir from 37.12.1 to 38.1.0 ([#335](https://github.com/libp2p/js-libp2p-interfaces/issues/335)) ([7368a36](https://github.com/libp2p/js-libp2p-interfaces/commit/7368a363423a08e8fa247dcb76ea13e4cf030d65)) - -## [@libp2p/interface-content-routing-v2.0.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-content-routing-v1.0.7...@libp2p/interface-content-routing-v2.0.0) (2023-01-06) - - -### ⚠ BREAKING CHANGES - -* bump multiformats from 10.0.3 to 11.0.0 (#329) - -### Dependencies - -* bump multiformats from 10.0.3 to 11.0.0 ([#329](https://github.com/libp2p/js-libp2p-interfaces/issues/329)) ([ba3a98b](https://github.com/libp2p/js-libp2p-interfaces/commit/ba3a98be61e3cf0996fefbd3004e974bb41ad2f0)) - -## [@libp2p/interface-content-routing-v1.0.7](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-content-routing-v1.0.6...@libp2p/interface-content-routing-v1.0.7) (2022-12-19) - - -### Documentation - -* add interface docs ([#324](https://github.com/libp2p/js-libp2p-interfaces/issues/324)) ([2789445](https://github.com/libp2p/js-libp2p-interfaces/commit/278944594c24e1a3c4b3624a35680d69166546d7)) - -## [@libp2p/interface-content-routing-v1.0.6](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-content-routing-v1.0.5...@libp2p/interface-content-routing-v1.0.6) (2022-12-16) - - -### Documentation - -* update project config ([#323](https://github.com/libp2p/js-libp2p-interfaces/issues/323)) ([0fc6a08](https://github.com/libp2p/js-libp2p-interfaces/commit/0fc6a08e9cdcefe361fe325281a3a2a03759ff59)) - -## [@libp2p/interface-content-routing-v1.0.5](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-content-routing-v1.0.4...@libp2p/interface-content-routing-v1.0.5) (2022-12-14) - - -### Bug Fixes - -* generate docs for all packages ([#321](https://github.com/libp2p/js-libp2p-interfaces/issues/321)) ([b6f8b32](https://github.com/libp2p/js-libp2p-interfaces/commit/b6f8b32a920c15a28fe021e6050e31aaae89d518)) - -## [@libp2p/interface-content-routing-v1.0.4](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-content-routing-v1.0.3...@libp2p/interface-content-routing-v1.0.4) (2022-11-05) - - -### Bug Fixes - -* update project config ([#311](https://github.com/libp2p/js-libp2p-interfaces/issues/311)) ([27dd0ce](https://github.com/libp2p/js-libp2p-interfaces/commit/27dd0ce3c249892ac69cbb24ddaf0b9f32385e37)) - -## [@libp2p/interface-content-routing-v1.0.3](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-content-routing-v1.0.2...@libp2p/interface-content-routing-v1.0.3) (2022-10-12) - - -### Trivial Changes - -* update project config ([#271](https://github.com/libp2p/js-libp2p-interfaces/issues/271)) ([59c0bf5](https://github.com/libp2p/js-libp2p-interfaces/commit/59c0bf5e0b05496fca2e4902632b61bb41fad9e9)) - - -### Dependencies - -* bump multiformats from 9.9.0 to 10.0.0 ([#302](https://github.com/libp2p/js-libp2p-interfaces/issues/302)) ([fe11d69](https://github.com/libp2p/js-libp2p-interfaces/commit/fe11d69b6aca3dd6ef6053bec27b534ec9908aa1)) - -## [@libp2p/interface-content-routing-v1.0.2](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-content-routing-v1.0.1...@libp2p/interface-content-routing-v1.0.2) (2022-06-27) - - -### Trivial Changes - -* update deps ([#262](https://github.com/libp2p/js-libp2p-interfaces/issues/262)) ([51edf7d](https://github.com/libp2p/js-libp2p-interfaces/commit/51edf7d9b3765a6f75c915b1483ea345d0133a41)) - -## [@libp2p/interface-content-routing-v1.0.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-content-routing-v1.0.0...@libp2p/interface-content-routing-v1.0.1) (2022-06-14) - - -### Trivial Changes - -* **release:** 1.0.0 [skip ci] ([1211753](https://github.com/libp2p/js-libp2p-interfaces/commit/121175364dc47cd683bee7bc40b645f193f33528)), closes [#226](https://github.com/libp2p/js-libp2p-interfaces/issues/226) [#234](https://github.com/libp2p/js-libp2p-interfaces/issues/234) [#233](https://github.com/libp2p/js-libp2p-interfaces/issues/233) - -## @libp2p/interface-content-routing-v1.0.0 (2022-06-14) - - -### ⚠ BREAKING CHANGES - -* most modules have been split out of the `@libp2p/interfaces` and `@libp2p/interface-compliance-tests` packages - -### Trivial Changes - -* break modules apart ([#232](https://github.com/libp2p/js-libp2p-interfaces/issues/232)) ([385614e](https://github.com/libp2p/js-libp2p-interfaces/commit/385614e772329052ab17415c8bd421f65b01a61b)), closes [#226](https://github.com/libp2p/js-libp2p-interfaces/issues/226) -* release [skip ci] ([357286d](https://github.com/libp2p/js-libp2p-interfaces/commit/357286df899899cf7a94348aeb8dd7387f7acad5)) -* update aegir ([#234](https://github.com/libp2p/js-libp2p-interfaces/issues/234)) ([3e03895](https://github.com/libp2p/js-libp2p-interfaces/commit/3e038959ecab6cfa3585df9ee179c0af7a61eda5)) -* update readmes ([#233](https://github.com/libp2p/js-libp2p-interfaces/issues/233)) ([ee7da38](https://github.com/libp2p/js-libp2p-interfaces/commit/ee7da38dccc08160d26c8436df8739ce7e0b340e)) diff --git a/packages/interface-content-routing/LICENSE b/packages/interface-content-routing/LICENSE deleted file mode 100644 index 20ce483c86..0000000000 --- a/packages/interface-content-routing/LICENSE +++ /dev/null @@ -1,4 +0,0 @@ -This project is dual licensed under MIT and Apache-2.0. - -MIT: https://www.opensource.org/licenses/mit -Apache-2.0: https://www.apache.org/licenses/license-2.0 diff --git a/packages/interface-content-routing/LICENSE-APACHE b/packages/interface-content-routing/LICENSE-APACHE deleted file mode 100644 index 14478a3b60..0000000000 --- a/packages/interface-content-routing/LICENSE-APACHE +++ /dev/null @@ -1,5 +0,0 @@ -Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - -http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. diff --git a/packages/interface-content-routing/LICENSE-MIT b/packages/interface-content-routing/LICENSE-MIT deleted file mode 100644 index 72dc60d84b..0000000000 --- a/packages/interface-content-routing/LICENSE-MIT +++ /dev/null @@ -1,19 +0,0 @@ -The MIT License (MIT) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/packages/interface-content-routing/README.md b/packages/interface-content-routing/README.md deleted file mode 100644 index 14c32cd694..0000000000 --- a/packages/interface-content-routing/README.md +++ /dev/null @@ -1,100 +0,0 @@ -# @libp2p/interface-content-routing - -[![libp2p.io](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](http://libp2p.io/) -[![Discuss](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg?style=flat-square)](https://discuss.libp2p.io) -[![codecov](https://img.shields.io/codecov/c/github/libp2p/js-libp2p.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p) -[![CI](https://img.shields.io/github/actions/workflow/status/libp2p/js-libp2p/main.yml?branch=master\&style=flat-square)](https://github.com/libp2p/js-libp2p/actions/workflows/main.yml?query=branch%3Amaster) - -> Content routing interface for libp2p - -## Table of contents - -- - [Install](#install) -- [Modules that implement the interface](#modules-that-implement-the-interface) -- [Badge](#badge) -- [How to use the battery of tests](#how-to-use-the-battery-of-tests) - - [Node.js](#nodejs) -- [API](#api) - - - [findProviders](#findproviders) - - [provide](#provide) - - [API Docs](#api-docs) - - [License](#license) - - [Contribution](#contribution) - -## Install - -```console -$ npm i @libp2p/interface-content-routing -``` - -The primary goal of this module is to enable developers to pick and swap their Content Routing module as they see fit for their libp2p installation, without having to go through shims or compatibility issues. This module and test suite were heavily inspired by abstract-blob-store and interface-stream-muxer. - -Publishing a test suite as a module lets multiple modules all ensure compatibility since they use the same test suite. - -# Modules that implement the interface - -- [JavaScript libp2p-kad-dht](https://github.com/libp2p/js-libp2p-kad-dht) -- [JavaScript libp2p-delegated-content-routing](https://github.com/libp2p/js-libp2p-delegated-content-routing) - -# Badge - -Include this badge in your readme if you make a module that is compatible with the interface-content-routing API. You can validate this by running the tests. - -![](img/badge.png) - -# How to use the battery of tests - -## Node.js - -TBD - -# API - -A valid (read: that follows this abstraction) Content Routing module must implement the following API. - -### findProviders - -- `findProviders(cid)` - -Find peers in the network that can provide a specific value, given a key. - -**Parameters** - -- [CID](https://github.com/multiformats/js-cid) - -**Returns** - -It returns an `AsyncIterable` containing the identification and addresses of the peers providing the given key, as follows: - -`AsyncIterable<{ id: PeerId, multiaddrs: Multiaddr[] }>` - -### provide - -- `provide(cid)` - -Announce to the network that we are providing the given value. - -**Parameters** - -- [CID](https://github.com/multiformats/js-cid) - -**Returns** - -It returns a promise that is resolved on the success of the operation. - -`Promise` - -## API Docs - -- - -## License - -Licensed under either of - -- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / ) -- MIT ([LICENSE-MIT](LICENSE-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/packages/interface-content-routing/img/badge.png b/packages/interface-content-routing/img/badge.png deleted file mode 100644 index 07f73279b5..0000000000 Binary files a/packages/interface-content-routing/img/badge.png and /dev/null differ diff --git a/packages/interface-content-routing/img/badge.sketch b/packages/interface-content-routing/img/badge.sketch deleted file mode 100644 index 985a835db6..0000000000 Binary files a/packages/interface-content-routing/img/badge.sketch and /dev/null differ diff --git a/packages/interface-content-routing/img/badge.svg b/packages/interface-content-routing/img/badge.svg deleted file mode 100644 index 43b16d1579..0000000000 --- a/packages/interface-content-routing/img/badge.svg +++ /dev/null @@ -1,25 +0,0 @@ - - - - badge - Created with Sketch. - - - - - - - - - - Content Routin - g - - - Compatibl - e - - - - - \ No newline at end of file diff --git a/packages/interface-content-routing/package.json b/packages/interface-content-routing/package.json deleted file mode 100644 index e63a95f976..0000000000 --- a/packages/interface-content-routing/package.json +++ /dev/null @@ -1,55 +0,0 @@ -{ - "name": "@libp2p/interface-content-routing", - "version": "2.1.1", - "description": "Content routing interface for libp2p", - "license": "Apache-2.0 OR MIT", - "homepage": "https://github.com/libp2p/js-libp2p/tree/master/packages/interface-content-routing#readme", - "repository": { - "type": "git", - "url": "git+https://github.com/libp2p/js-libp2p.git" - }, - "bugs": { - "url": "https://github.com/libp2p/js-libp2p/issues" - }, - "keywords": [ - "interface", - "libp2p" - ], - "type": "module", - "types": "./dist/src/index.d.ts", - "files": [ - "src", - "dist", - "!dist/test", - "!**/*.tsbuildinfo" - ], - "exports": { - ".": { - "types": "./dist/src/index.d.ts", - "import": "./dist/src/index.js" - } - }, - "eslintConfig": { - "extends": "ipfs", - "parserOptions": { - "sourceType": "module" - } - }, - "scripts": { - "clean": "aegir clean", - "lint": "aegir lint", - "dep-check": "aegir dep-check", - "build": "aegir build" - }, - "dependencies": { - "@libp2p/interface-peer-info": "^1.0.0", - "@libp2p/interfaces": "^3.0.0", - "multiformats": "^11.0.2" - }, - "devDependencies": { - "aegir": "^39.0.10" - }, - "typedoc": { - "entryPoint": "./src/index.ts" - } -} diff --git a/packages/interface-content-routing/tsconfig.json b/packages/interface-content-routing/tsconfig.json deleted file mode 100644 index 84bbd0ffe3..0000000000 --- a/packages/interface-content-routing/tsconfig.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "extends": "aegir/src/config/tsconfig.aegir.json", - "compilerOptions": { - "outDir": "dist" - }, - "include": [ - "src" - ], - "references": [ - { - "path": "../interface-peer-info" - }, - { - "path": "../interfaces" - } - ] -} diff --git a/packages/interface-dht/CHANGELOG.md b/packages/interface-dht/CHANGELOG.md deleted file mode 100644 index 71d1f444e1..0000000000 --- a/packages/interface-dht/CHANGELOG.md +++ /dev/null @@ -1,77 +0,0 @@ -## [@libp2p/interface-dht-v2.0.3](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-dht-v2.0.2...@libp2p/interface-dht-v2.0.3) (2023-05-04) - - -### Dependencies - -* update sibling dependencies ([45cf513](https://github.com/libp2p/js-libp2p-interfaces/commit/45cf513090d2a069bb6752ad2e231df65c76df36)) - -## [@libp2p/interface-dht-v2.0.2](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-dht-v2.0.1...@libp2p/interface-dht-v2.0.2) (2023-05-04) - - -### Dependencies - -* bump aegir from 38.1.8 to 39.0.5 ([#393](https://github.com/libp2p/js-libp2p-interfaces/issues/393)) ([31f3797](https://github.com/libp2p/js-libp2p-interfaces/commit/31f3797b24f7c23f3f16e9db3a230bd5f7cd5175)) - -## [@libp2p/interface-dht-v2.0.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-dht-v2.0.0...@libp2p/interface-dht-v2.0.1) (2023-01-18) - - -### Trivial Changes - -* remove lerna ([#330](https://github.com/libp2p/js-libp2p-interfaces/issues/330)) ([6678592](https://github.com/libp2p/js-libp2p-interfaces/commit/6678592dd0cf601a2671852f9d2a0aff5dee2b18)) - - -### Dependencies - -* bump aegir from 37.12.1 to 38.1.0 ([#335](https://github.com/libp2p/js-libp2p-interfaces/issues/335)) ([7368a36](https://github.com/libp2p/js-libp2p-interfaces/commit/7368a363423a08e8fa247dcb76ea13e4cf030d65)) - -## [@libp2p/interface-dht-v2.0.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-dht-v1.0.5...@libp2p/interface-dht-v2.0.0) (2023-01-06) - - -### ⚠ BREAKING CHANGES - -* bump multiformats from 10.0.3 to 11.0.0 (#329) - -### Dependencies - -* bump multiformats from 10.0.3 to 11.0.0 ([#329](https://github.com/libp2p/js-libp2p-interfaces/issues/329)) ([ba3a98b](https://github.com/libp2p/js-libp2p-interfaces/commit/ba3a98be61e3cf0996fefbd3004e974bb41ad2f0)) -* update sibling dependencies ([b50e621](https://github.com/libp2p/js-libp2p-interfaces/commit/b50e621d31a8b32affc3fadb9f97c4883d577f93)) - -## [@libp2p/interface-dht-v1.0.5](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-dht-v1.0.4...@libp2p/interface-dht-v1.0.5) (2022-12-16) - - -### Documentation - -* update project config ([#323](https://github.com/libp2p/js-libp2p-interfaces/issues/323)) ([0fc6a08](https://github.com/libp2p/js-libp2p-interfaces/commit/0fc6a08e9cdcefe361fe325281a3a2a03759ff59)) - -## [@libp2p/interface-dht-v1.0.4](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-dht-v1.0.3...@libp2p/interface-dht-v1.0.4) (2022-12-14) - - -### Bug Fixes - -* generate docs for all packages ([#321](https://github.com/libp2p/js-libp2p-interfaces/issues/321)) ([b6f8b32](https://github.com/libp2p/js-libp2p-interfaces/commit/b6f8b32a920c15a28fe021e6050e31aaae89d518)) - -## [@libp2p/interface-dht-v1.0.3](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-dht-v1.0.2...@libp2p/interface-dht-v1.0.3) (2022-11-05) - - -### Bug Fixes - -* update project config ([#311](https://github.com/libp2p/js-libp2p-interfaces/issues/311)) ([27dd0ce](https://github.com/libp2p/js-libp2p-interfaces/commit/27dd0ce3c249892ac69cbb24ddaf0b9f32385e37)) - -## [@libp2p/interface-dht-v1.0.2](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-dht-v1.0.1...@libp2p/interface-dht-v1.0.2) (2022-10-12) - - -### Trivial Changes - -* update project config ([#271](https://github.com/libp2p/js-libp2p-interfaces/issues/271)) ([59c0bf5](https://github.com/libp2p/js-libp2p-interfaces/commit/59c0bf5e0b05496fca2e4902632b61bb41fad9e9)) - - -### Dependencies - -* bump multiformats from 9.9.0 to 10.0.0 ([#302](https://github.com/libp2p/js-libp2p-interfaces/issues/302)) ([fe11d69](https://github.com/libp2p/js-libp2p-interfaces/commit/fe11d69b6aca3dd6ef6053bec27b534ec9908aa1)) - -## [@libp2p/interface-dht-v1.0.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-dht-v1.0.0...@libp2p/interface-dht-v1.0.1) (2022-06-27) - - -### Trivial Changes - -* update deps ([#262](https://github.com/libp2p/js-libp2p-interfaces/issues/262)) ([51edf7d](https://github.com/libp2p/js-libp2p-interfaces/commit/51edf7d9b3765a6f75c915b1483ea345d0133a41)) diff --git a/packages/interface-dht/LICENSE b/packages/interface-dht/LICENSE deleted file mode 100644 index 20ce483c86..0000000000 --- a/packages/interface-dht/LICENSE +++ /dev/null @@ -1,4 +0,0 @@ -This project is dual licensed under MIT and Apache-2.0. - -MIT: https://www.opensource.org/licenses/mit -Apache-2.0: https://www.apache.org/licenses/license-2.0 diff --git a/packages/interface-dht/LICENSE-APACHE b/packages/interface-dht/LICENSE-APACHE deleted file mode 100644 index 14478a3b60..0000000000 --- a/packages/interface-dht/LICENSE-APACHE +++ /dev/null @@ -1,5 +0,0 @@ -Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - -http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. diff --git a/packages/interface-dht/LICENSE-MIT b/packages/interface-dht/LICENSE-MIT deleted file mode 100644 index 72dc60d84b..0000000000 --- a/packages/interface-dht/LICENSE-MIT +++ /dev/null @@ -1,19 +0,0 @@ -The MIT License (MIT) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/packages/interface-dht/README.md b/packages/interface-dht/README.md deleted file mode 100644 index 9e8bc3c24f..0000000000 --- a/packages/interface-dht/README.md +++ /dev/null @@ -1,36 +0,0 @@ -# @libp2p/interface-dht - -[![libp2p.io](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](http://libp2p.io/) -[![Discuss](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg?style=flat-square)](https://discuss.libp2p.io) -[![codecov](https://img.shields.io/codecov/c/github/libp2p/js-libp2p.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p) -[![CI](https://img.shields.io/github/actions/workflow/status/libp2p/js-libp2p/main.yml?branch=master\&style=flat-square)](https://github.com/libp2p/js-libp2p/actions/workflows/main.yml?query=branch%3Amaster) - -> DHT interface for libp2p - -## Table of contents - -- [Install](#install) -- [API Docs](#api-docs) -- [License](#license) -- [Contribution](#contribution) - -## Install - -```console -$ npm i @libp2p/interface-dht -``` - -## API Docs - -- - -## License - -Licensed under either of - -- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / ) -- MIT ([LICENSE-MIT](LICENSE-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/packages/interface-dht/package.json b/packages/interface-dht/package.json deleted file mode 100644 index 46ac76cde9..0000000000 --- a/packages/interface-dht/package.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "name": "@libp2p/interface-dht", - "version": "2.0.3", - "description": "DHT interface for libp2p", - "license": "Apache-2.0 OR MIT", - "homepage": "https://github.com/libp2p/js-libp2p/tree/master/packages/interface-dht#readme", - "repository": { - "type": "git", - "url": "git+https://github.com/libp2p/js-libp2p.git" - }, - "bugs": { - "url": "https://github.com/libp2p/js-libp2p/issues" - }, - "keywords": [ - "interface", - "libp2p" - ], - "type": "module", - "types": "./dist/src/index.d.ts", - "files": [ - "src", - "dist", - "!dist/test", - "!**/*.tsbuildinfo" - ], - "exports": { - ".": { - "types": "./dist/src/index.d.ts", - "import": "./dist/src/index.js" - } - }, - "eslintConfig": { - "extends": "ipfs", - "parserOptions": { - "sourceType": "module" - } - }, - "scripts": { - "clean": "aegir clean", - "lint": "aegir lint", - "dep-check": "aegir dep-check", - "build": "aegir build" - }, - "dependencies": { - "@libp2p/interface-peer-discovery": "^2.0.0", - "@libp2p/interface-peer-id": "^2.0.0", - "@libp2p/interface-peer-info": "^1.0.0", - "@libp2p/interfaces": "^3.0.0", - "multiformats": "^11.0.2" - }, - "devDependencies": { - "aegir": "^39.0.10" - }, - "typedoc": { - "entryPoint": "./src/index.ts" - } -} diff --git a/packages/interface-dht/src/index.ts b/packages/interface-dht/src/index.ts deleted file mode 100644 index 25f46a7d79..0000000000 --- a/packages/interface-dht/src/index.ts +++ /dev/null @@ -1,211 +0,0 @@ -import type { PeerDiscovery } from '@libp2p/interface-peer-discovery' -import type { PeerId } from '@libp2p/interface-peer-id' -import type { PeerInfo } from '@libp2p/interface-peer-info' -import type { AbortOptions } from '@libp2p/interfaces' -import type { CID } from 'multiformats/cid' - -/** - * The types of events emitted during DHT queries - */ -export enum EventTypes { - SENDING_QUERY = 0, - PEER_RESPONSE, - FINAL_PEER, - QUERY_ERROR, - PROVIDER, - VALUE, - ADDING_PEER, - DIALING_PEER -} - -/** - * The types of messages sent to peers during DHT queries - */ -export enum MessageType { - PUT_VALUE = 0, - GET_VALUE, - ADD_PROVIDER, - GET_PROVIDERS, - FIND_NODE, - PING -} - -export type MessageName = keyof typeof MessageType - -export interface DHTRecord { - key: Uint8Array - value: Uint8Array - timeReceived?: Date -} - -export interface QueryOptions extends AbortOptions { - queryFuncTimeout?: number -} - -/** - * Emitted when sending queries to remote peers - */ -export interface SendingQueryEvent { - to: PeerId - type: EventTypes.SENDING_QUERY - name: 'SENDING_QUERY' - messageName: keyof typeof MessageType - messageType: MessageType -} - -/** - * Emitted when query responses are received form remote peers. Depending on the query - * these events may be followed by a `FinalPeerEvent`, a `ValueEvent` or a `ProviderEvent`. - */ -export interface PeerResponseEvent { - from: PeerId - type: EventTypes.PEER_RESPONSE - name: 'PEER_RESPONSE' - messageName: keyof typeof MessageType - messageType: MessageType - closer: PeerInfo[] - providers: PeerInfo[] - record?: DHTRecord -} - -/** - * Emitted at the end of a `findPeer` query - */ -export interface FinalPeerEvent { - from: PeerId - peer: PeerInfo - type: EventTypes.FINAL_PEER - name: 'FINAL_PEER' -} - -/** - * Something went wrong with the query - */ -export interface QueryErrorEvent { - from: PeerId - type: EventTypes.QUERY_ERROR - name: 'QUERY_ERROR' - error: Error -} - -/** - * Emitted when providers are found - */ -export interface ProviderEvent { - from: PeerId - type: EventTypes.PROVIDER - name: 'PROVIDER' - providers: PeerInfo[] -} - -/** - * Emitted when values are found - */ -export interface ValueEvent { - from: PeerId - type: EventTypes.VALUE - name: 'VALUE' - value: Uint8Array -} - -/** - * Emitted when peers are added to a query - */ -export interface AddingPeerEvent { - type: EventTypes.ADDING_PEER - name: 'ADDING_PEER' - peer: PeerId -} - -/** - * Emitted when peers are dialled as part of a query - */ -export interface DialingPeerEvent { - peer: PeerId - type: EventTypes.DIALING_PEER - name: 'DIALING_PEER' -} - -export type QueryEvent = SendingQueryEvent | PeerResponseEvent | FinalPeerEvent | QueryErrorEvent | ProviderEvent | ValueEvent | AddingPeerEvent | DialingPeerEvent - -export interface RoutingTable { - size: number -} - -export interface DHT extends PeerDiscovery { - /** - * Get a value from the DHT, the final ValueEvent will be the best value - */ - get: (key: Uint8Array, options?: QueryOptions) => AsyncIterable - - /** - * Find providers of a given CID - */ - findProviders: (key: CID, options?: QueryOptions) => AsyncIterable - - /** - * Find a peer on the DHT - */ - findPeer: (id: PeerId, options?: QueryOptions) => AsyncIterable - - /** - * Find the closest peers to the passed key - */ - getClosestPeers: (key: Uint8Array, options?: QueryOptions) => AsyncIterable - - /** - * Store provider records for the passed CID on the DHT pointing to us - */ - provide: (key: CID, options?: QueryOptions) => AsyncIterable - - /** - * Store the passed value under the passed key on the DHT - */ - put: (key: Uint8Array, value: Uint8Array, options?: QueryOptions) => AsyncIterable - - /** - * Returns the mode this node is in - */ - getMode: () => Promise<'client' | 'server'> - - /** - * If 'server' this node will respond to DHT queries, if 'client' this node will not - */ - setMode: (mode: 'client' | 'server') => Promise - - /** - * Force a routing table refresh - */ - refreshRoutingTable: () => Promise -} - -export interface SingleDHT extends DHT { - routingTable: RoutingTable -} - -export interface DualDHT extends DHT { - wan: SingleDHT - lan: SingleDHT -} - -/** - * A selector function takes a DHT key and a list of records and returns the - * index of the best record in the list - */ -export interface SelectFn { (key: Uint8Array, records: Uint8Array[]): number } - -/** - * A validator function takes a DHT key and the value of the record for that key - * and throws if the record is invalid - */ -export interface ValidateFn { (key: Uint8Array, value: Uint8Array): Promise } - -/** - * Selectors are a map of key prefixes to selector functions - */ -export type Selectors = Record - -/** - * Validators are a map of key prefixes to validator functions - */ -export type Validators = Record diff --git a/packages/interface-dht/tsconfig.json b/packages/interface-dht/tsconfig.json deleted file mode 100644 index 29f2945683..0000000000 --- a/packages/interface-dht/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "extends": "aegir/src/config/tsconfig.aegir.json", - "compilerOptions": { - "outDir": "dist" - }, - "include": [ - "src" - ], - "references": [ - { - "path": "../interface-peer-discovery" - }, - { - "path": "../interface-peer-id" - }, - { - "path": "../interface-peer-info" - }, - { - "path": "../interfaces" - } - ] -} diff --git a/packages/interface-address-manager/LICENSE b/packages/interface-internal/LICENSE similarity index 100% rename from packages/interface-address-manager/LICENSE rename to packages/interface-internal/LICENSE diff --git a/packages/interface-address-manager/LICENSE-APACHE b/packages/interface-internal/LICENSE-APACHE similarity index 100% rename from packages/interface-address-manager/LICENSE-APACHE rename to packages/interface-internal/LICENSE-APACHE diff --git a/packages/interface-address-manager/LICENSE-MIT b/packages/interface-internal/LICENSE-MIT similarity index 100% rename from packages/interface-address-manager/LICENSE-MIT rename to packages/interface-internal/LICENSE-MIT diff --git a/packages/interface-libp2p/README.md b/packages/interface-internal/README.md similarity index 89% rename from packages/interface-libp2p/README.md rename to packages/interface-internal/README.md index 632bc4b306..4d6b738f26 100644 --- a/packages/interface-libp2p/README.md +++ b/packages/interface-internal/README.md @@ -1,11 +1,11 @@ -# @libp2p/interface-libp2p +# @libp2p/interface-internal [![libp2p.io](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](http://libp2p.io/) [![Discuss](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg?style=flat-square)](https://discuss.libp2p.io) [![codecov](https://img.shields.io/codecov/c/github/libp2p/js-libp2p.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p) [![CI](https://img.shields.io/github/actions/workflow/status/libp2p/js-libp2p/main.yml?branch=master\&style=flat-square)](https://github.com/libp2p/js-libp2p/actions/workflows/main.yml?query=branch%3Amaster) -> The interface implemented by a libp2p node +> Interfaces implemented by internal libp2p components ## Table of contents @@ -17,12 +17,12 @@ ## Install ```console -$ npm i @libp2p/interface-libp2p +$ npm i @libp2p/interface-internal ``` ## API Docs -- +- ## License diff --git a/packages/interface-connection/package.json b/packages/interface-internal/package.json similarity index 54% rename from packages/interface-connection/package.json rename to packages/interface-internal/package.json index 9bde521b06..be3ca71a41 100644 --- a/packages/interface-connection/package.json +++ b/packages/interface-internal/package.json @@ -1,9 +1,9 @@ { - "name": "@libp2p/interface-connection", - "version": "5.1.1", - "description": "Connection interface for libp2p", + "name": "@libp2p/interface-internal", + "version": "0.0.1", + "description": "Interfaces implemented by internal libp2p components", "license": "Apache-2.0 OR MIT", - "homepage": "https://github.com/libp2p/js-libp2p/tree/master/packages/interface-connection#readme", + "homepage": "https://github.com/libp2p/js-libp2p/tree/master/packages/interface-internal#readme", "repository": { "type": "git", "url": "git+https://github.com/libp2p/js-libp2p.git" @@ -44,9 +44,29 @@ "types": "./dist/src/index.d.ts", "import": "./dist/src/index.js" }, - "./status": { - "types": "./dist/src/status.d.ts", - "import": "./dist/src/status.js" + "./address-manager": { + "types": "./dist/src/address-manager/index.d.ts", + "import": "./dist/src/address-manager/index.js" + }, + "./connection-manager": { + "types": "./dist/src/connection-manager/index.d.ts", + "import": "./dist/src/connection-manager/index.js" + }, + "./record": { + "types": "./dist/src/record/index.d.ts", + "import": "./dist/src/record/index.js" + }, + "./registrar": { + "types": "./dist/src/registrar/index.d.ts", + "import": "./dist/src/registrar/index.js" + }, + "./transport": { + "types": "./dist/src/transport/index.d.ts", + "import": "./dist/src/transport/index.js" + }, + "./transport-manager": { + "types": "./dist/src/transport-manager/index.d.ts", + "import": "./dist/src/transport-manager/index.js" } }, "eslintConfig": { @@ -62,10 +82,9 @@ "build": "aegir build" }, "dependencies": { - "@libp2p/interface-peer-id": "^2.0.0", - "@libp2p/interfaces": "^3.0.0", + "@libp2p/interface": "~0.0.1", + "@libp2p/peer-collections": "^3.0.0", "@multiformats/multiaddr": "^12.1.3", - "it-stream-types": "^2.0.1", "uint8arraylist": "^2.4.3" }, "devDependencies": { diff --git a/packages/interface-address-manager/src/index.ts b/packages/interface-internal/src/address-manager/index.ts similarity index 100% rename from packages/interface-address-manager/src/index.ts rename to packages/interface-internal/src/address-manager/index.ts diff --git a/packages/interface-connection-manager/src/index.ts b/packages/interface-internal/src/connection-manager/index.ts similarity index 93% rename from packages/interface-connection-manager/src/index.ts rename to packages/interface-internal/src/connection-manager/index.ts index ca9bebc2d2..a03569c237 100644 --- a/packages/interface-connection-manager/src/index.ts +++ b/packages/interface-internal/src/connection-manager/index.ts @@ -1,6 +1,6 @@ -import type { Connection, MultiaddrConnection } from '@libp2p/interface-connection' -import type { PeerId } from '@libp2p/interface-peer-id' -import type { AbortOptions } from '@libp2p/interfaces' +import type { AbortOptions } from '@libp2p/interface' +import type { Connection, MultiaddrConnection } from '@libp2p/interface/connection' +import type { PeerId } from '@libp2p/interface/peer-id' import type { PeerMap } from '@libp2p/peer-collections' import type { Multiaddr } from '@multiformats/multiaddr' diff --git a/packages/interface-libp2p/src/index.ts b/packages/interface-internal/src/index.ts similarity index 93% rename from packages/interface-libp2p/src/index.ts rename to packages/interface-internal/src/index.ts index 3e0a606cae..68753a6328 100644 --- a/packages/interface-libp2p/src/index.ts +++ b/packages/interface-internal/src/index.ts @@ -6,7 +6,7 @@ * @example * * ```typescript - * import type { Libp2p } from '@libp2p/interface-libp2p' + * import type { Libp2p } from '@libp2p/interface' * * function doSomethingWithLibp2p (node: Libp2p) { * // ... @@ -14,19 +14,20 @@ * ``` */ -import type { Connection, Stream } from '@libp2p/interface-connection' -import type { ContentRouting } from '@libp2p/interface-content-routing' -import type { KeyChain } from '@libp2p/interface-keychain' -import type { Metrics } from '@libp2p/interface-metrics' -import type { PeerId } from '@libp2p/interface-peer-id' -import type { PeerInfo } from '@libp2p/interface-peer-info' -import type { PeerRouting } from '@libp2p/interface-peer-routing' -import type { Address, Peer, PeerStore } from '@libp2p/interface-peer-store' -import type { StreamHandler, StreamHandlerOptions, Topology } from '@libp2p/interface-registrar' -import type { Listener } from '@libp2p/interface-transport' -import type { AbortOptions } from '@libp2p/interfaces' -import type { EventEmitter } from '@libp2p/interfaces/events' -import type { Startable } from '@libp2p/interfaces/startable' +import type { StreamHandler, StreamHandlerOptions } from './registrar/index.js' +import type { AbortOptions } from '@libp2p/interface' +import type { Connection, Stream } from '@libp2p/interface/connection' +import type { ContentRouting } from '@libp2p/interface/content-routing' +import type { EventEmitter } from '@libp2p/interface/events' +import type { KeyChain } from '@libp2p/interface/keychain' +import type { Metrics } from '@libp2p/interface/metrics' +import type { PeerId } from '@libp2p/interface/peer-id' +import type { PeerInfo } from '@libp2p/interface/peer-info' +import type { PeerRouting } from '@libp2p/interface/peer-routing' +import type { Address, Peer, PeerStore } from '@libp2p/interface/peer-store' +import type { Startable } from '@libp2p/interface/startable' +import type { Topology } from '@libp2p/interface/topology' +import type { Listener } from '@libp2p/interface/transport' import type { Multiaddr } from '@multiformats/multiaddr' /** @@ -557,16 +558,14 @@ export interface Libp2p extends Startable, Ev * @example * * ```js - * import { createTopology } from '@libp2p/topology' - * - * const id = await libp2p.register('/echo/1.0.0', createTopology({ + * const id = await libp2p.register('/echo/1.0.0', { * onConnect: (peer, connection) => { * // handle connect * }, * onDisconnect: (peer, connection) => { * // handle disconnect * } - * })) + * }) * ``` */ register: (protocol: string, topology: Topology) => Promise diff --git a/packages/interface-record/src/index.ts b/packages/interface-internal/src/record/index.ts similarity index 93% rename from packages/interface-record/src/index.ts rename to packages/interface-internal/src/record/index.ts index 6903f50588..1005ba0d02 100644 --- a/packages/interface-record/src/index.ts +++ b/packages/interface-internal/src/record/index.ts @@ -1,4 +1,4 @@ -import type { PeerId } from '@libp2p/interface-peer-id' +import type { PeerId } from '@libp2p/interface/peer-id' import type { Uint8ArrayList } from 'uint8arraylist' /** diff --git a/packages/interface-registrar/src/index.ts b/packages/interface-internal/src/registrar/index.ts similarity index 60% rename from packages/interface-registrar/src/index.ts rename to packages/interface-internal/src/registrar/index.ts index bac9a91c1b..2c3712d04e 100644 --- a/packages/interface-registrar/src/index.ts +++ b/packages/interface-internal/src/registrar/index.ts @@ -1,5 +1,5 @@ -import type { Connection, Stream } from '@libp2p/interface-connection' -import type { PeerId } from '@libp2p/interface-peer-id' +import type { Connection, Stream } from '@libp2p/interface/connection' +import type { Topology } from '@libp2p/interface/topology' export interface IncomingStreamData { stream: Stream @@ -69,50 +69,3 @@ export interface Registrar { */ getTopologies: (protocol: string) => Topology[] } - -export interface onConnectHandler { - (peerId: PeerId, conn: Connection): void -} - -export interface onDisconnectHandler { - (peerId: PeerId, conn?: Connection): void -} - -export interface TopologyInit { - /** - * minimum needed connections - */ - min?: number - - /** - * maximum needed connections - */ - max?: number - - /** - * Invoked when a new peer is connects that supports the configured - * protocol - */ - onConnect?: onConnectHandler - - /** - * Invoked when a peer that supports the configured protocol disconnects - */ - onDisconnect?: onDisconnectHandler -} - -export interface Topology { - min: number - max: number - peers: Set - - onConnect: (peerId: PeerId, conn: Connection) => void - onDisconnect: (peerId: PeerId) => void - setRegistrar: (registrar: Registrar) => Promise -} - -export const topologySymbol = Symbol.for('@libp2p/topology') - -export function isTopology (other: any): other is Topology { - return other != null && Boolean(other[topologySymbol]) -} diff --git a/packages/interface-internal/src/transport-manager/index.ts b/packages/interface-internal/src/transport-manager/index.ts new file mode 100644 index 0000000000..b649969be2 --- /dev/null +++ b/packages/interface-internal/src/transport-manager/index.ts @@ -0,0 +1,15 @@ +import type { Connection } from '@libp2p/interface/connection' +import type { Listener, Transport } from '@libp2p/interface/transport' +import type { Multiaddr } from '@multiformats/multiaddr' + +export interface TransportManager { + add: (transport: Transport) => void + dial: (ma: Multiaddr, options?: any) => Promise + getAddrs: () => Multiaddr[] + getTransports: () => Transport[] + getListeners: () => Listener[] + transportForMultiaddr: (ma: Multiaddr) => Transport | undefined + listen: (addrs: Multiaddr[]) => Promise + remove: (key: string) => Promise + removeAll: () => Promise +} diff --git a/packages/interface-internal/src/upgrader/index.ts b/packages/interface-internal/src/upgrader/index.ts new file mode 100644 index 0000000000..3f7c49436f --- /dev/null +++ b/packages/interface-internal/src/upgrader/index.ts @@ -0,0 +1,20 @@ +import type { Connection, MultiaddrConnection } from '@libp2p/interface/connection' +import type { StreamMuxerFactory } from '@libp2p/interface/stream-muxer' + +export interface UpgraderOptions { + skipEncryption?: boolean + skipProtection?: boolean + muxerFactory?: StreamMuxerFactory +} + +export interface Upgrader { + /** + * Upgrades an outbound connection on `transport.dial`. + */ + upgradeOutbound: (maConn: MultiaddrConnection, opts?: UpgraderOptions) => Promise + + /** + * Upgrades an inbound connection on transport listener. + */ + upgradeInbound: (maConn: MultiaddrConnection, opts?: UpgraderOptions) => Promise +} diff --git a/packages/interface-connection/tsconfig.json b/packages/interface-internal/tsconfig.json similarity index 73% rename from packages/interface-connection/tsconfig.json rename to packages/interface-internal/tsconfig.json index 22a45bf0b5..67dca032e3 100644 --- a/packages/interface-connection/tsconfig.json +++ b/packages/interface-internal/tsconfig.json @@ -8,10 +8,10 @@ ], "references": [ { - "path": "../interface-peer-id" + "path": "../interface" }, { - "path": "../interfaces" + "path": "../peer-collections" } ] } diff --git a/packages/interface-keychain/CHANGELOG.md b/packages/interface-keychain/CHANGELOG.md deleted file mode 100644 index f94cdbd62f..0000000000 --- a/packages/interface-keychain/CHANGELOG.md +++ /dev/null @@ -1,122 +0,0 @@ -## [@libp2p/interface-keychain-v2.0.5](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-keychain-v2.0.4...@libp2p/interface-keychain-v2.0.5) (2023-05-04) - - -### Dependencies - -* bump aegir from 38.1.8 to 39.0.5 ([#393](https://github.com/libp2p/js-libp2p-interfaces/issues/393)) ([31f3797](https://github.com/libp2p/js-libp2p-interfaces/commit/31f3797b24f7c23f3f16e9db3a230bd5f7cd5175)) - -## [@libp2p/interface-keychain-v2.0.4](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-keychain-v2.0.3...@libp2p/interface-keychain-v2.0.4) (2023-01-27) - - -### Bug Fixes - -* add missing method to keychain interface to rotate password ([#340](https://github.com/libp2p/js-libp2p-interfaces/issues/340)) ([db60895](https://github.com/libp2p/js-libp2p-interfaces/commit/db60895f9b86f627b1cb5c1bcabff69398e34b93)) - -## [@libp2p/interface-keychain-v2.0.3](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-keychain-v2.0.2...@libp2p/interface-keychain-v2.0.3) (2023-01-18) - - -### Dependencies - -* bump aegir from 37.12.1 to 38.1.0 ([#335](https://github.com/libp2p/js-libp2p-interfaces/issues/335)) ([7368a36](https://github.com/libp2p/js-libp2p-interfaces/commit/7368a363423a08e8fa247dcb76ea13e4cf030d65)) - -## [@libp2p/interface-keychain-v2.0.2](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-keychain-v2.0.1...@libp2p/interface-keychain-v2.0.2) (2023-01-18) - - -### Bug Fixes - -* add exportPeer method to keychain interface ([#337](https://github.com/libp2p/js-libp2p-interfaces/issues/337)) ([a970939](https://github.com/libp2p/js-libp2p-interfaces/commit/a970939ee685c1fd8ba2121e04f8a7cff5b953ca)) - -## [@libp2p/interface-keychain-v2.0.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-keychain-v2.0.0...@libp2p/interface-keychain-v2.0.1) (2023-01-07) - - -### Bug Fixes - -* add importPeer method to keychain interface ([#333](https://github.com/libp2p/js-libp2p-interfaces/issues/333)) ([51de73c](https://github.com/libp2p/js-libp2p-interfaces/commit/51de73c85f72151d1b9e5f3248d757512d40659b)) - - -### Trivial Changes - -* remove lerna ([#330](https://github.com/libp2p/js-libp2p-interfaces/issues/330)) ([6678592](https://github.com/libp2p/js-libp2p-interfaces/commit/6678592dd0cf601a2671852f9d2a0aff5dee2b18)) - -## [@libp2p/interface-keychain-v2.0.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-keychain-v1.0.8...@libp2p/interface-keychain-v2.0.0) (2023-01-06) - - -### ⚠ BREAKING CHANGES - -* bump multiformats from 10.0.3 to 11.0.0 (#329) - -### Dependencies - -* bump multiformats from 10.0.3 to 11.0.0 ([#329](https://github.com/libp2p/js-libp2p-interfaces/issues/329)) ([ba3a98b](https://github.com/libp2p/js-libp2p-interfaces/commit/ba3a98be61e3cf0996fefbd3004e974bb41ad2f0)) - -## [@libp2p/interface-keychain-v1.0.8](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-keychain-v1.0.7...@libp2p/interface-keychain-v1.0.8) (2022-12-19) - - -### Documentation - -* add interface docs ([#324](https://github.com/libp2p/js-libp2p-interfaces/issues/324)) ([2789445](https://github.com/libp2p/js-libp2p-interfaces/commit/278944594c24e1a3c4b3624a35680d69166546d7)) - -## [@libp2p/interface-keychain-v1.0.7](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-keychain-v1.0.6...@libp2p/interface-keychain-v1.0.7) (2022-12-16) - - -### Documentation - -* update project config ([#323](https://github.com/libp2p/js-libp2p-interfaces/issues/323)) ([0fc6a08](https://github.com/libp2p/js-libp2p-interfaces/commit/0fc6a08e9cdcefe361fe325281a3a2a03759ff59)) - -## [@libp2p/interface-keychain-v1.0.6](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-keychain-v1.0.5...@libp2p/interface-keychain-v1.0.6) (2022-12-14) - - -### Bug Fixes - -* generate docs for all packages ([#321](https://github.com/libp2p/js-libp2p-interfaces/issues/321)) ([b6f8b32](https://github.com/libp2p/js-libp2p-interfaces/commit/b6f8b32a920c15a28fe021e6050e31aaae89d518)) - -## [@libp2p/interface-keychain-v1.0.5](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-keychain-v1.0.4...@libp2p/interface-keychain-v1.0.5) (2022-11-05) - - -### Bug Fixes - -* update project config ([#311](https://github.com/libp2p/js-libp2p-interfaces/issues/311)) ([27dd0ce](https://github.com/libp2p/js-libp2p-interfaces/commit/27dd0ce3c249892ac69cbb24ddaf0b9f32385e37)) - -## [@libp2p/interface-keychain-v1.0.4](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-keychain-v1.0.3...@libp2p/interface-keychain-v1.0.4) (2022-10-12) - - -### Trivial Changes - -* update project config ([#271](https://github.com/libp2p/js-libp2p-interfaces/issues/271)) ([59c0bf5](https://github.com/libp2p/js-libp2p-interfaces/commit/59c0bf5e0b05496fca2e4902632b61bb41fad9e9)) - - -### Dependencies - -* bump multiformats from 9.9.0 to 10.0.0 ([#302](https://github.com/libp2p/js-libp2p-interfaces/issues/302)) ([fe11d69](https://github.com/libp2p/js-libp2p-interfaces/commit/fe11d69b6aca3dd6ef6053bec27b534ec9908aa1)) - -## [@libp2p/interface-keychain-v1.0.3](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-keychain-v1.0.2...@libp2p/interface-keychain-v1.0.3) (2022-06-27) - - -### Trivial Changes - -* update deps ([#262](https://github.com/libp2p/js-libp2p-interfaces/issues/262)) ([51edf7d](https://github.com/libp2p/js-libp2p-interfaces/commit/51edf7d9b3765a6f75c915b1483ea345d0133a41)) - -## [@libp2p/interface-keychain-v1.0.2](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-keychain-v1.0.1...@libp2p/interface-keychain-v1.0.2) (2022-06-14) - - -### Trivial Changes - -* update aegir ([#234](https://github.com/libp2p/js-libp2p-interfaces/issues/234)) ([3e03895](https://github.com/libp2p/js-libp2p-interfaces/commit/3e038959ecab6cfa3585df9ee179c0af7a61eda5)) - -## [@libp2p/interface-keychain-v1.0.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-keychain-v1.0.0...@libp2p/interface-keychain-v1.0.1) (2022-06-14) - - -### Trivial Changes - -* update readmes ([#233](https://github.com/libp2p/js-libp2p-interfaces/issues/233)) ([ee7da38](https://github.com/libp2p/js-libp2p-interfaces/commit/ee7da38dccc08160d26c8436df8739ce7e0b340e)) - -## @libp2p/interface-keychain-v1.0.0 (2022-06-14) - - -### ⚠ BREAKING CHANGES - -* most modules have been split out of the `@libp2p/interfaces` and `@libp2p/interface-compliance-tests` packages - -### Trivial Changes - -* break modules apart ([#232](https://github.com/libp2p/js-libp2p-interfaces/issues/232)) ([385614e](https://github.com/libp2p/js-libp2p-interfaces/commit/385614e772329052ab17415c8bd421f65b01a61b)), closes [#226](https://github.com/libp2p/js-libp2p-interfaces/issues/226) diff --git a/packages/interface-keychain/LICENSE b/packages/interface-keychain/LICENSE deleted file mode 100644 index 20ce483c86..0000000000 --- a/packages/interface-keychain/LICENSE +++ /dev/null @@ -1,4 +0,0 @@ -This project is dual licensed under MIT and Apache-2.0. - -MIT: https://www.opensource.org/licenses/mit -Apache-2.0: https://www.apache.org/licenses/license-2.0 diff --git a/packages/interface-keychain/LICENSE-APACHE b/packages/interface-keychain/LICENSE-APACHE deleted file mode 100644 index 14478a3b60..0000000000 --- a/packages/interface-keychain/LICENSE-APACHE +++ /dev/null @@ -1,5 +0,0 @@ -Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - -http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. diff --git a/packages/interface-keychain/LICENSE-MIT b/packages/interface-keychain/LICENSE-MIT deleted file mode 100644 index 72dc60d84b..0000000000 --- a/packages/interface-keychain/LICENSE-MIT +++ /dev/null @@ -1,19 +0,0 @@ -The MIT License (MIT) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/packages/interface-keychain/README.md b/packages/interface-keychain/README.md deleted file mode 100644 index 377bd6e4e5..0000000000 --- a/packages/interface-keychain/README.md +++ /dev/null @@ -1,100 +0,0 @@ -# @libp2p/interface-keychain - -[![libp2p.io](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](http://libp2p.io/) -[![Discuss](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg?style=flat-square)](https://discuss.libp2p.io) -[![codecov](https://img.shields.io/codecov/c/github/libp2p/js-libp2p.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p) -[![CI](https://img.shields.io/github/actions/workflow/status/libp2p/js-libp2p/main.yml?branch=master\&style=flat-square)](https://github.com/libp2p/js-libp2p/actions/workflows/main.yml?query=branch%3Amaster) - -> Keychain interface for libp2p - -## Table of contents - -- - [Install](#install) -- [Modules that implement the interface](#modules-that-implement-the-interface) -- [Badge](#badge) -- [How to use the battery of tests](#how-to-use-the-battery-of-tests) - - [Node.js](#nodejs) -- [API](#api) - - - [findProviders](#findproviders) - - [provide](#provide) - - [API Docs](#api-docs) - - [License](#license) - - [Contribution](#contribution) - -## Install - -```console -$ npm i @libp2p/interface-keychain -``` - -The primary goal of this module is to enable developers to pick and swap their Content Routing module as they see fit for their libp2p installation, without having to go through shims or compatibility issues. This module and test suite were heavily inspired by abstract-blob-store and interface-stream-muxer. - -Publishing a test suite as a module lets multiple modules all ensure compatibility since they use the same test suite. - -# Modules that implement the interface - -- [JavaScript libp2p-kad-dht](https://github.com/libp2p/js-libp2p-kad-dht) -- [JavaScript libp2p-delegated-content-routing](https://github.com/libp2p/js-libp2p-delegated-content-routing) - -# Badge - -Include this badge in your readme if you make a module that is compatible with the interface-content-routing API. You can validate this by running the tests. - -![](img/badge.png) - -# How to use the battery of tests - -## Node.js - -TBD - -# API - -A valid (read: that follows this abstraction) Content Routing module must implement the following API. - -### findProviders - -- `findProviders(cid)` - -Find peers in the network that can provide a specific value, given a key. - -**Parameters** - -- [CID](https://github.com/multiformats/js-cid) - -**Returns** - -It returns an `AsyncIterable` containing the identification and addresses of the peers providing the given key, as follows: - -`AsyncIterable<{ id: PeerId, multiaddrs: Multiaddr[] }>` - -### provide - -- `provide(cid)` - -Announce to the network that we are providing the given value. - -**Parameters** - -- [CID](https://github.com/multiformats/js-cid) - -**Returns** - -It returns a promise that is resolved on the success of the operation. - -`Promise` - -## API Docs - -- - -## License - -Licensed under either of - -- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / ) -- MIT ([LICENSE-MIT](LICENSE-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/packages/interface-keychain/package.json b/packages/interface-keychain/package.json deleted file mode 100644 index 8facba1250..0000000000 --- a/packages/interface-keychain/package.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "name": "@libp2p/interface-keychain", - "version": "2.0.5", - "description": "Keychain interface for libp2p", - "license": "Apache-2.0 OR MIT", - "homepage": "https://github.com/libp2p/js-libp2p/tree/master/packages/interface-keychain#readme", - "repository": { - "type": "git", - "url": "git+https://github.com/libp2p/js-libp2p.git" - }, - "bugs": { - "url": "https://github.com/libp2p/js-libp2p/issues" - }, - "keywords": [ - "interface", - "libp2p" - ], - "type": "module", - "types": "./dist/src/index.d.ts", - "files": [ - "src", - "dist", - "!dist/test", - "!**/*.tsbuildinfo" - ], - "exports": { - ".": { - "types": "./dist/src/index.d.ts", - "import": "./dist/src/index.js" - } - }, - "eslintConfig": { - "extends": "ipfs", - "parserOptions": { - "sourceType": "module" - } - }, - "scripts": { - "clean": "aegir clean", - "lint": "aegir lint", - "dep-check": "aegir dep-check", - "build": "aegir build" - }, - "dependencies": { - "@libp2p/interface-peer-id": "^2.0.0", - "multiformats": "^11.0.2" - }, - "devDependencies": { - "aegir": "^39.0.10" - }, - "typedoc": { - "entryPoint": "./src/index.ts" - } -} diff --git a/packages/interface-keychain/tsconfig.json b/packages/interface-keychain/tsconfig.json deleted file mode 100644 index d8db0b667f..0000000000 --- a/packages/interface-keychain/tsconfig.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "extends": "aegir/src/config/tsconfig.aegir.json", - "compilerOptions": { - "outDir": "dist" - }, - "include": [ - "src" - ], - "references": [ - { - "path": "../interface-peer-id" - } - ] -} diff --git a/packages/interface-keys/CHANGELOG.md b/packages/interface-keys/CHANGELOG.md deleted file mode 100644 index f2f84f5302..0000000000 --- a/packages/interface-keys/CHANGELOG.md +++ /dev/null @@ -1,76 +0,0 @@ -## [@libp2p/interface-keys-v1.0.8](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-keys-v1.0.7...@libp2p/interface-keys-v1.0.8) (2023-05-04) - - -### Dependencies - -* bump aegir from 38.1.8 to 39.0.5 ([#393](https://github.com/libp2p/js-libp2p-interfaces/issues/393)) ([31f3797](https://github.com/libp2p/js-libp2p-interfaces/commit/31f3797b24f7c23f3f16e9db3a230bd5f7cd5175)) - -## [@libp2p/interface-keys-v1.0.7](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-keys-v1.0.6...@libp2p/interface-keys-v1.0.7) (2023-01-18) - - -### Trivial Changes - -* remove lerna ([#330](https://github.com/libp2p/js-libp2p-interfaces/issues/330)) ([6678592](https://github.com/libp2p/js-libp2p-interfaces/commit/6678592dd0cf601a2671852f9d2a0aff5dee2b18)) - - -### Dependencies - -* bump aegir from 37.12.1 to 38.1.0 ([#335](https://github.com/libp2p/js-libp2p-interfaces/issues/335)) ([7368a36](https://github.com/libp2p/js-libp2p-interfaces/commit/7368a363423a08e8fa247dcb76ea13e4cf030d65)) - -## [@libp2p/interface-keys-v1.0.6](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-keys-v1.0.5...@libp2p/interface-keys-v1.0.6) (2022-12-16) - - -### Documentation - -* update project config ([#323](https://github.com/libp2p/js-libp2p-interfaces/issues/323)) ([0fc6a08](https://github.com/libp2p/js-libp2p-interfaces/commit/0fc6a08e9cdcefe361fe325281a3a2a03759ff59)) - -## [@libp2p/interface-keys-v1.0.5](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-keys-v1.0.4...@libp2p/interface-keys-v1.0.5) (2022-12-14) - - -### Bug Fixes - -* generate docs for all packages ([#321](https://github.com/libp2p/js-libp2p-interfaces/issues/321)) ([b6f8b32](https://github.com/libp2p/js-libp2p-interfaces/commit/b6f8b32a920c15a28fe021e6050e31aaae89d518)) - -## [@libp2p/interface-keys-v1.0.4](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-keys-v1.0.3...@libp2p/interface-keys-v1.0.4) (2022-11-05) - - -### Bug Fixes - -* update project config ([#311](https://github.com/libp2p/js-libp2p-interfaces/issues/311)) ([27dd0ce](https://github.com/libp2p/js-libp2p-interfaces/commit/27dd0ce3c249892ac69cbb24ddaf0b9f32385e37)) - - -### Trivial Changes - -* update project config ([#271](https://github.com/libp2p/js-libp2p-interfaces/issues/271)) ([59c0bf5](https://github.com/libp2p/js-libp2p-interfaces/commit/59c0bf5e0b05496fca2e4902632b61bb41fad9e9)) - -## [@libp2p/interface-keys-v1.0.3](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-keys-v1.0.2...@libp2p/interface-keys-v1.0.3) (2022-06-27) - - -### Trivial Changes - -* update deps ([#262](https://github.com/libp2p/js-libp2p-interfaces/issues/262)) ([51edf7d](https://github.com/libp2p/js-libp2p-interfaces/commit/51edf7d9b3765a6f75c915b1483ea345d0133a41)) - -## [@libp2p/interface-keys-v1.0.2](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-keys-v1.0.1...@libp2p/interface-keys-v1.0.2) (2022-06-14) - - -### Trivial Changes - -* update aegir ([#234](https://github.com/libp2p/js-libp2p-interfaces/issues/234)) ([3e03895](https://github.com/libp2p/js-libp2p-interfaces/commit/3e038959ecab6cfa3585df9ee179c0af7a61eda5)) - -## [@libp2p/interface-keys-v1.0.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-keys-v1.0.0...@libp2p/interface-keys-v1.0.1) (2022-06-14) - - -### Trivial Changes - -* update readmes ([#233](https://github.com/libp2p/js-libp2p-interfaces/issues/233)) ([ee7da38](https://github.com/libp2p/js-libp2p-interfaces/commit/ee7da38dccc08160d26c8436df8739ce7e0b340e)) - -## @libp2p/interface-keys-v1.0.0 (2022-06-14) - - -### ⚠ BREAKING CHANGES - -* most modules have been split out of the `@libp2p/interfaces` and `@libp2p/interface-compliance-tests` packages - -### Trivial Changes - -* break modules apart ([#232](https://github.com/libp2p/js-libp2p-interfaces/issues/232)) ([385614e](https://github.com/libp2p/js-libp2p-interfaces/commit/385614e772329052ab17415c8bd421f65b01a61b)), closes [#226](https://github.com/libp2p/js-libp2p-interfaces/issues/226) diff --git a/packages/interface-keys/LICENSE b/packages/interface-keys/LICENSE deleted file mode 100644 index 20ce483c86..0000000000 --- a/packages/interface-keys/LICENSE +++ /dev/null @@ -1,4 +0,0 @@ -This project is dual licensed under MIT and Apache-2.0. - -MIT: https://www.opensource.org/licenses/mit -Apache-2.0: https://www.apache.org/licenses/license-2.0 diff --git a/packages/interface-keys/LICENSE-APACHE b/packages/interface-keys/LICENSE-APACHE deleted file mode 100644 index 14478a3b60..0000000000 --- a/packages/interface-keys/LICENSE-APACHE +++ /dev/null @@ -1,5 +0,0 @@ -Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - -http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. diff --git a/packages/interface-keys/LICENSE-MIT b/packages/interface-keys/LICENSE-MIT deleted file mode 100644 index 72dc60d84b..0000000000 --- a/packages/interface-keys/LICENSE-MIT +++ /dev/null @@ -1,19 +0,0 @@ -The MIT License (MIT) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/packages/interface-keys/README.md b/packages/interface-keys/README.md deleted file mode 100644 index 53f51c0e71..0000000000 --- a/packages/interface-keys/README.md +++ /dev/null @@ -1,56 +0,0 @@ -# @libp2p/interface-keys - -[![libp2p.io](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](http://libp2p.io/) -[![Discuss](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg?style=flat-square)](https://discuss.libp2p.io) -[![codecov](https://img.shields.io/codecov/c/github/libp2p/js-libp2p.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p) -[![CI](https://img.shields.io/github/actions/workflow/status/libp2p/js-libp2p/main.yml?branch=master\&style=flat-square)](https://github.com/libp2p/js-libp2p/actions/workflows/main.yml?query=branch%3Amaster) - -> Keys interface for libp2p - -## Table of contents - -- [Install](#install) -- [Using the Test Suite](#using-the-test-suite) -- [API Docs](#api-docs) -- [License](#license) -- [Contribution](#contribution) - -## Install - -```console -$ npm i @libp2p/interface-keys -``` - -## Using the Test Suite - -You can also check out the [internal test suite](../../test/crypto/compliance.spec.js) to see the setup in action. - -```js -const tests = require('libp2p-interfaces-compliance-tests/keys') -const yourKeys = require('./your-keys') - -tests({ - setup () { - // Set up your keys if needed, then return it - return yourKeys - }, - teardown () { - // Clean up your keys if needed - } -}) -``` - -## API Docs - -- - -## License - -Licensed under either of - -- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / ) -- MIT ([LICENSE-MIT](LICENSE-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/packages/interface-keys/package.json b/packages/interface-keys/package.json deleted file mode 100644 index 8cc349bfe5..0000000000 --- a/packages/interface-keys/package.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "name": "@libp2p/interface-keys", - "version": "1.0.8", - "description": "Keys interface for libp2p", - "license": "Apache-2.0 OR MIT", - "homepage": "https://github.com/libp2p/js-libp2p/tree/master/packages/interface-keys#readme", - "repository": { - "type": "git", - "url": "git+https://github.com/libp2p/js-libp2p.git" - }, - "bugs": { - "url": "https://github.com/libp2p/js-libp2p/issues" - }, - "keywords": [ - "interface", - "libp2p" - ], - "type": "module", - "types": "./dist/src/index.d.ts", - "files": [ - "src", - "dist", - "!dist/test", - "!**/*.tsbuildinfo" - ], - "exports": { - ".": { - "types": "./dist/src/index.d.ts", - "import": "./dist/src/index.js" - } - }, - "eslintConfig": { - "extends": "ipfs", - "parserOptions": { - "sourceType": "module" - } - }, - "scripts": { - "clean": "aegir clean", - "lint": "aegir lint", - "dep-check": "aegir dep-check", - "build": "aegir build" - }, - "devDependencies": { - "aegir": "^39.0.10" - }, - "typedoc": { - "entryPoint": "./src/index.ts" - } -} diff --git a/packages/interface-libp2p/LICENSE b/packages/interface-libp2p/LICENSE deleted file mode 100644 index 20ce483c86..0000000000 --- a/packages/interface-libp2p/LICENSE +++ /dev/null @@ -1,4 +0,0 @@ -This project is dual licensed under MIT and Apache-2.0. - -MIT: https://www.opensource.org/licenses/mit -Apache-2.0: https://www.apache.org/licenses/license-2.0 diff --git a/packages/interface-libp2p/LICENSE-APACHE b/packages/interface-libp2p/LICENSE-APACHE deleted file mode 100644 index 14478a3b60..0000000000 --- a/packages/interface-libp2p/LICENSE-APACHE +++ /dev/null @@ -1,5 +0,0 @@ -Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - -http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. diff --git a/packages/interface-libp2p/LICENSE-MIT b/packages/interface-libp2p/LICENSE-MIT deleted file mode 100644 index 72dc60d84b..0000000000 --- a/packages/interface-libp2p/LICENSE-MIT +++ /dev/null @@ -1,19 +0,0 @@ -The MIT License (MIT) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/packages/interface-libp2p/package.json b/packages/interface-libp2p/package.json deleted file mode 100644 index 1a97324de2..0000000000 --- a/packages/interface-libp2p/package.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "name": "@libp2p/interface-libp2p", - "version": "3.2.0", - "description": "The interface implemented by a libp2p node", - "license": "Apache-2.0 OR MIT", - "homepage": "https://github.com/libp2p/js-libp2p/tree/master/packages/interface-libp2p#readme", - "repository": { - "type": "git", - "url": "git+https://github.com/libp2p/js-libp2p.git" - }, - "bugs": { - "url": "https://github.com/libp2p/js-libp2p/issues" - }, - "keywords": [ - "interface", - "libp2p" - ], - "type": "module", - "types": "./dist/src/index.d.ts", - "files": [ - "src", - "dist", - "!dist/test", - "!**/*.tsbuildinfo" - ], - "exports": { - ".": { - "types": "./dist/src/index.d.ts", - "import": "./dist/src/index.js" - } - }, - "eslintConfig": { - "extends": "ipfs", - "parserOptions": { - "sourceType": "module" - } - }, - "scripts": { - "clean": "aegir clean", - "lint": "aegir lint", - "dep-check": "aegir dep-check", - "build": "aegir build" - }, - "dependencies": { - "@libp2p/interface-connection": "^5.0.0", - "@libp2p/interface-content-routing": "^2.0.0", - "@libp2p/interface-keychain": "^2.0.0", - "@libp2p/interface-metrics": "^4.0.0", - "@libp2p/interface-peer-id": "^2.0.0", - "@libp2p/interface-peer-info": "^1.0.0", - "@libp2p/interface-peer-routing": "^1.0.0", - "@libp2p/interface-peer-store": "^2.0.0", - "@libp2p/interface-registrar": "^2.0.0", - "@libp2p/interface-transport": "^4.0.0", - "@libp2p/interfaces": "^3.0.0", - "@multiformats/multiaddr": "^12.1.3" - }, - "devDependencies": { - "aegir": "^39.0.10" - }, - "typedoc": { - "entryPoint": "./src/index.ts" - } -} diff --git a/packages/interface-libp2p/tsconfig.json b/packages/interface-libp2p/tsconfig.json deleted file mode 100644 index 141be663e3..0000000000 --- a/packages/interface-libp2p/tsconfig.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "extends": "aegir/src/config/tsconfig.aegir.json", - "compilerOptions": { - "outDir": "dist" - }, - "include": [ - "src" - ], - "references": [ - { - "path": "../interface-connection" - }, - { - "path": "../interface-content-routing" - }, - { - "path": "../interface-keychain" - }, - { - "path": "../interface-metrics" - }, - { - "path": "../interface-peer-id" - }, - { - "path": "../interface-peer-info" - }, - { - "path": "../interface-peer-routing" - }, - { - "path": "../interface-peer-store" - }, - { - "path": "../interface-registrar" - }, - { - "path": "../interface-transport" - }, - { - "path": "../interfaces" - } - ] -} diff --git a/packages/interface-metrics/CHANGELOG.md b/packages/interface-metrics/CHANGELOG.md deleted file mode 100644 index 387c1c4b68..0000000000 --- a/packages/interface-metrics/CHANGELOG.md +++ /dev/null @@ -1,130 +0,0 @@ -## [@libp2p/interface-metrics-v4.0.8](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-metrics-v4.0.7...@libp2p/interface-metrics-v4.0.8) (2023-05-04) - - -### Dependencies - -* bump aegir from 38.1.8 to 39.0.5 ([#393](https://github.com/libp2p/js-libp2p-interfaces/issues/393)) ([31f3797](https://github.com/libp2p/js-libp2p-interfaces/commit/31f3797b24f7c23f3f16e9db3a230bd5f7cd5175)) - -## [@libp2p/interface-metrics-v4.0.7](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-metrics-v4.0.6...@libp2p/interface-metrics-v4.0.7) (2023-04-18) - - -### Dependencies - -* update sibling dependencies ([2f52a28](https://github.com/libp2p/js-libp2p-interfaces/commit/2f52a284b59c0a88b040f86da1f5d3f044727f2c)) - -## [@libp2p/interface-metrics-v4.0.6](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-metrics-v4.0.5...@libp2p/interface-metrics-v4.0.6) (2023-04-11) - - -### Dependencies - -* update sibling dependencies ([b034810](https://github.com/libp2p/js-libp2p-interfaces/commit/b0348102e41dc18166e70063f4708a2b3544f4b6)) - -## [@libp2p/interface-metrics-v4.0.5](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-metrics-v4.0.4...@libp2p/interface-metrics-v4.0.5) (2023-01-18) - - -### Trivial Changes - -* remove lerna ([#330](https://github.com/libp2p/js-libp2p-interfaces/issues/330)) ([6678592](https://github.com/libp2p/js-libp2p-interfaces/commit/6678592dd0cf601a2671852f9d2a0aff5dee2b18)) - - -### Dependencies - -* bump aegir from 37.12.1 to 38.1.0 ([#335](https://github.com/libp2p/js-libp2p-interfaces/issues/335)) ([7368a36](https://github.com/libp2p/js-libp2p-interfaces/commit/7368a363423a08e8fa247dcb76ea13e4cf030d65)) - -## [@libp2p/interface-metrics-v4.0.4](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-metrics-v4.0.3...@libp2p/interface-metrics-v4.0.4) (2022-12-16) - - -### Documentation - -* update project config ([#323](https://github.com/libp2p/js-libp2p-interfaces/issues/323)) ([0fc6a08](https://github.com/libp2p/js-libp2p-interfaces/commit/0fc6a08e9cdcefe361fe325281a3a2a03759ff59)) - -## [@libp2p/interface-metrics-v4.0.3](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-metrics-v4.0.2...@libp2p/interface-metrics-v4.0.3) (2022-12-14) - - -### Bug Fixes - -* generate docs for all packages ([#321](https://github.com/libp2p/js-libp2p-interfaces/issues/321)) ([b6f8b32](https://github.com/libp2p/js-libp2p-interfaces/commit/b6f8b32a920c15a28fe021e6050e31aaae89d518)) - -## [@libp2p/interface-metrics-v4.0.2](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-metrics-v4.0.1...@libp2p/interface-metrics-v4.0.2) (2022-11-05) - - -### Bug Fixes - -* metrics only need numbers ([#312](https://github.com/libp2p/js-libp2p-interfaces/issues/312)) ([0076c1f](https://github.com/libp2p/js-libp2p-interfaces/commit/0076c1f354ebc1106b6ac42d48688c0209866084)) - -## [@libp2p/interface-metrics-v4.0.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-metrics-v4.0.0...@libp2p/interface-metrics-v4.0.1) (2022-11-05) - - -### Bug Fixes - -* update project config ([#311](https://github.com/libp2p/js-libp2p-interfaces/issues/311)) ([27dd0ce](https://github.com/libp2p/js-libp2p-interfaces/commit/27dd0ce3c249892ac69cbb24ddaf0b9f32385e37)) - -## [@libp2p/interface-metrics-v4.0.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-metrics-v3.0.0...@libp2p/interface-metrics-v4.0.0) (2022-11-05) - - -### ⚠ BREAKING CHANGES - -* the global/per-peer moving average tracking has been removed from the interface as it's expensive and requires lots of timers - this functionality can be replicated by implementations if it's desirable. It's better to have simple counters instead and let an external system like Prometheus or Graphana calculate the values over time - -### Features - -* return metrics objects from register instead of updating with an options object ([#310](https://github.com/libp2p/js-libp2p-interfaces/issues/310)) ([3b106ce](https://github.com/libp2p/js-libp2p-interfaces/commit/3b106ce799b5d84a82a66238995e09970ed8116c)) - -## [@libp2p/interface-metrics-v3.0.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-metrics-v2.0.0...@libp2p/interface-metrics-v3.0.0) (2022-08-07) - - -### ⚠ BREAKING CHANGES - -* change stream muxer interface (#279) - -### Features - -* change stream muxer interface ([#279](https://github.com/libp2p/js-libp2p-interfaces/issues/279)) ([1ebe269](https://github.com/libp2p/js-libp2p-interfaces/commit/1ebe26988b6a286f36a4fc5177f502cfb60368a1)) - - -### Trivial Changes - -* update project config ([#271](https://github.com/libp2p/js-libp2p-interfaces/issues/271)) ([59c0bf5](https://github.com/libp2p/js-libp2p-interfaces/commit/59c0bf5e0b05496fca2e4902632b61bb41fad9e9)) - -## [@libp2p/interface-metrics-v2.0.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-metrics-v1.0.3...@libp2p/interface-metrics-v2.0.0) (2022-07-01) - - -### ⚠ BREAKING CHANGES - -* the return type of `metrics.getComponentMetrics` has been changed to include optional labels/help text and also is now a function that returns a single or group value - -### Features - -* add metrics groups ([#267](https://github.com/libp2p/js-libp2p-interfaces/issues/267)) ([b9d898a](https://github.com/libp2p/js-libp2p-interfaces/commit/b9d898abdb551ebe2e0e961ec325d5e6abcf4fab)), closes [#257](https://github.com/libp2p/js-libp2p-interfaces/issues/257) [#258](https://github.com/libp2p/js-libp2p-interfaces/issues/258) - -## [@libp2p/interface-metrics-v1.0.3](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-metrics-v1.0.2...@libp2p/interface-metrics-v1.0.3) (2022-06-27) - - -### Trivial Changes - -* update deps ([#262](https://github.com/libp2p/js-libp2p-interfaces/issues/262)) ([51edf7d](https://github.com/libp2p/js-libp2p-interfaces/commit/51edf7d9b3765a6f75c915b1483ea345d0133a41)) - -## [@libp2p/interface-metrics-v1.0.2](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-metrics-v1.0.1...@libp2p/interface-metrics-v1.0.2) (2022-06-14) - - -### Trivial Changes - -* update aegir ([#234](https://github.com/libp2p/js-libp2p-interfaces/issues/234)) ([3e03895](https://github.com/libp2p/js-libp2p-interfaces/commit/3e038959ecab6cfa3585df9ee179c0af7a61eda5)) - -## [@libp2p/interface-metrics-v1.0.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-metrics-v1.0.0...@libp2p/interface-metrics-v1.0.1) (2022-06-14) - - -### Trivial Changes - -* update readmes ([#233](https://github.com/libp2p/js-libp2p-interfaces/issues/233)) ([ee7da38](https://github.com/libp2p/js-libp2p-interfaces/commit/ee7da38dccc08160d26c8436df8739ce7e0b340e)) - -## @libp2p/interface-metrics-v1.0.0 (2022-06-14) - - -### ⚠ BREAKING CHANGES - -* most modules have been split out of the `@libp2p/interfaces` and `@libp2p/interface-compliance-tests` packages - -### Trivial Changes - -* break modules apart ([#232](https://github.com/libp2p/js-libp2p-interfaces/issues/232)) ([385614e](https://github.com/libp2p/js-libp2p-interfaces/commit/385614e772329052ab17415c8bd421f65b01a61b)), closes [#226](https://github.com/libp2p/js-libp2p-interfaces/issues/226) diff --git a/packages/interface-metrics/LICENSE b/packages/interface-metrics/LICENSE deleted file mode 100644 index 20ce483c86..0000000000 --- a/packages/interface-metrics/LICENSE +++ /dev/null @@ -1,4 +0,0 @@ -This project is dual licensed under MIT and Apache-2.0. - -MIT: https://www.opensource.org/licenses/mit -Apache-2.0: https://www.apache.org/licenses/license-2.0 diff --git a/packages/interface-metrics/LICENSE-APACHE b/packages/interface-metrics/LICENSE-APACHE deleted file mode 100644 index 14478a3b60..0000000000 --- a/packages/interface-metrics/LICENSE-APACHE +++ /dev/null @@ -1,5 +0,0 @@ -Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - -http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. diff --git a/packages/interface-metrics/LICENSE-MIT b/packages/interface-metrics/LICENSE-MIT deleted file mode 100644 index 72dc60d84b..0000000000 --- a/packages/interface-metrics/LICENSE-MIT +++ /dev/null @@ -1,19 +0,0 @@ -The MIT License (MIT) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/packages/interface-metrics/README.md b/packages/interface-metrics/README.md deleted file mode 100644 index 4c69efd10f..0000000000 --- a/packages/interface-metrics/README.md +++ /dev/null @@ -1,41 +0,0 @@ -# @libp2p/interface-metrics - -[![libp2p.io](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](http://libp2p.io/) -[![Discuss](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg?style=flat-square)](https://discuss.libp2p.io) -[![codecov](https://img.shields.io/codecov/c/github/libp2p/js-libp2p.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p) -[![CI](https://img.shields.io/github/actions/workflow/status/libp2p/js-libp2p/main.yml?branch=master\&style=flat-square)](https://github.com/libp2p/js-libp2p/actions/workflows/main.yml?query=branch%3Amaster) - -> Metrics interface for libp2p - -## Table of contents - -- [Install](#install) -- [Implementations](#implementations) -- [API Docs](#api-docs) -- [License](#license) -- [Contribution](#contribution) - -## Install - -```console -$ npm i @libp2p/interface-metrics -``` - -## Implementations - -- [@libp2p/prometheus-metrics](https://github.com/libp2p/js-libp2p-prometheus-metrics) - -## API Docs - -- - -## License - -Licensed under either of - -- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / ) -- MIT ([LICENSE-MIT](LICENSE-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/packages/interface-metrics/package.json b/packages/interface-metrics/package.json deleted file mode 100644 index 4d253595bd..0000000000 --- a/packages/interface-metrics/package.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "name": "@libp2p/interface-metrics", - "version": "4.0.8", - "description": "Metrics interface for libp2p", - "license": "Apache-2.0 OR MIT", - "homepage": "https://github.com/libp2p/js-libp2p/tree/master/packages/interface-metrics#readme", - "repository": { - "type": "git", - "url": "git+https://github.com/libp2p/js-libp2p.git" - }, - "bugs": { - "url": "https://github.com/libp2p/js-libp2p/issues" - }, - "keywords": [ - "interface", - "libp2p" - ], - "type": "module", - "types": "./dist/src/index.d.ts", - "files": [ - "src", - "dist", - "!dist/test", - "!**/*.tsbuildinfo" - ], - "exports": { - ".": { - "types": "./dist/src/index.d.ts", - "import": "./dist/src/index.js" - } - }, - "eslintConfig": { - "extends": "ipfs", - "parserOptions": { - "sourceType": "module" - } - }, - "scripts": { - "clean": "aegir clean", - "lint": "aegir lint", - "dep-check": "aegir dep-check", - "build": "aegir build" - }, - "dependencies": { - "@libp2p/interface-connection": "^5.0.0" - }, - "devDependencies": { - "aegir": "^39.0.10" - }, - "typedoc": { - "entryPoint": "./src/index.ts" - } -} diff --git a/packages/interface-metrics/tsconfig.json b/packages/interface-metrics/tsconfig.json deleted file mode 100644 index 01ca33094c..0000000000 --- a/packages/interface-metrics/tsconfig.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "extends": "aegir/src/config/tsconfig.aegir.json", - "compilerOptions": { - "outDir": "dist" - }, - "include": [ - "src" - ], - "references": [ - { - "path": "../interface-connection" - } - ] -} diff --git a/packages/interface-mocks/CHANGELOG.md b/packages/interface-mocks/CHANGELOG.md deleted file mode 100644 index 5a66070f58..0000000000 --- a/packages/interface-mocks/CHANGELOG.md +++ /dev/null @@ -1,1013 +0,0 @@ -## [@libp2p/interface-mocks-v12.0.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-mocks-v12.0.0...@libp2p/interface-mocks-v12.0.1) (2023-05-10) - - -### Bug Fixes - -* emit peer:connect events from mock connection manager ([#399](https://github.com/libp2p/js-libp2p-interfaces/issues/399)) ([836dcf3](https://github.com/libp2p/js-libp2p-interfaces/commit/836dcf3d0fbdd00686f662260940c5600db25c09)) - -## [@libp2p/interface-mocks-v12.0.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-mocks-v11.0.3...@libp2p/interface-mocks-v12.0.0) (2023-05-04) - - -### ⚠ BREAKING CHANGES - -* the `symbol` export is now named `peerDiscovery` and the getter with that name should return an instance of `PeerDiscovery` - -### Features - -* rename peer discovery symbol to peerDiscovery ([#394](https://github.com/libp2p/js-libp2p-interfaces/issues/394)) ([5957c77](https://github.com/libp2p/js-libp2p-interfaces/commit/5957c77718df6e6336ca22386d8c03a045fd1d89)) - - -### Dependencies - -* update sibling dependencies ([45cf513](https://github.com/libp2p/js-libp2p-interfaces/commit/45cf513090d2a069bb6752ad2e231df65c76df36)) - -## [@libp2p/interface-mocks-v11.0.3](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-mocks-v11.0.2...@libp2p/interface-mocks-v11.0.3) (2023-05-04) - - -### Dependencies - -* bump aegir from 38.1.8 to 39.0.5 ([#393](https://github.com/libp2p/js-libp2p-interfaces/issues/393)) ([31f3797](https://github.com/libp2p/js-libp2p-interfaces/commit/31f3797b24f7c23f3f16e9db3a230bd5f7cd5175)) - -## [@libp2p/interface-mocks-v11.0.2](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-mocks-v11.0.1...@libp2p/interface-mocks-v11.0.2) (2023-04-27) - - -### Dependencies - -* update sibling dependencies ([6aa5ee8](https://github.com/libp2p/js-libp2p-interfaces/commit/6aa5ee87f9e431cabd4081cf8bc76b8f5180f344)) - -## [@libp2p/interface-mocks-v11.0.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-mocks-v11.0.0...@libp2p/interface-mocks-v11.0.1) (2023-04-24) - - -### Bug Fixes - -* make events optional in mock upgrader ([#385](https://github.com/libp2p/js-libp2p-interfaces/issues/385)) ([51f4aae](https://github.com/libp2p/js-libp2p-interfaces/commit/51f4aaea6ab216a1f60b899ecc25b7a325de988d)) - -## [@libp2p/interface-mocks-v11.0.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-mocks-v10.0.3...@libp2p/interface-mocks-v11.0.0) (2023-04-21) - - -### ⚠ BREAKING CHANGES - -* add libp2p events (#373) - -### Features - -* add libp2p events ([#373](https://github.com/libp2p/js-libp2p-interfaces/issues/373)) ([071c718](https://github.com/libp2p/js-libp2p-interfaces/commit/071c718808902858818ca86167b51b242b67a5a5)) - - -### Dependencies - -* update sibling dependencies ([a1b72f9](https://github.com/libp2p/js-libp2p-interfaces/commit/a1b72f90414536308befd07df2a003985951ceb7)) -* update sibling dependencies ([17ed429](https://github.com/libp2p/js-libp2p-interfaces/commit/17ed429d57e83cb38484ac52a0e0975a7d8af963)) -* update sibling dependencies ([6c18790](https://github.com/libp2p/js-libp2p-interfaces/commit/6c18790f6178053c69a8cd6bd289fd749d4e9633)) - -## [@libp2p/interface-mocks-v10.0.3](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-mocks-v10.0.2...@libp2p/interface-mocks-v10.0.3) (2023-04-19) - - -### Bug Fixes - -* update mock duplex type ([#380](https://github.com/libp2p/js-libp2p-interfaces/issues/380)) ([5260314](https://github.com/libp2p/js-libp2p-interfaces/commit/52603142bc91aaeb192ebf9b3a7559e8a270b7bf)) - -## [@libp2p/interface-mocks-v10.0.2](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-mocks-v10.0.1...@libp2p/interface-mocks-v10.0.2) (2023-04-18) - - -### Dependencies - -* update abortable iterator to 5.x.x ([#379](https://github.com/libp2p/js-libp2p-interfaces/issues/379)) ([d405e5b](https://github.com/libp2p/js-libp2p-interfaces/commit/d405e5b5db624d97f47588ef55c379debccfd160)) - -## [@libp2p/interface-mocks-v10.0.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-mocks-v10.0.0...@libp2p/interface-mocks-v10.0.1) (2023-04-18) - - -### Bug Fixes - -* specify stream sink return type ([#378](https://github.com/libp2p/js-libp2p-interfaces/issues/378)) ([e0641fc](https://github.com/libp2p/js-libp2p-interfaces/commit/e0641fcc2f2a6562e7f7d8e064ebd98c5cc6dccb)) - -## [@libp2p/interface-mocks-v10.0.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-mocks-v9.4.0...@libp2p/interface-mocks-v10.0.0) (2023-04-18) - - -### ⚠ BREAKING CHANGES - -* bump it-stream-types from 1.0.5 to 2.0.1 (#362) - -### Dependencies - -* bump it-stream-types from 1.0.5 to 2.0.1 ([#362](https://github.com/libp2p/js-libp2p-interfaces/issues/362)) ([cdc7747](https://github.com/libp2p/js-libp2p-interfaces/commit/cdc774792beead63e0ded96bd6c23de0335a49e3)) -* update sibling dependencies ([4972cc6](https://github.com/libp2p/js-libp2p-interfaces/commit/4972cc6c4c43319730305b58f329d6cf4591517a)) -* update sibling dependencies ([a5b7b33](https://github.com/libp2p/js-libp2p-interfaces/commit/a5b7b33dccee52d03fce788d2876a398d6fd6d99)) -* update sibling dependencies ([99a862b](https://github.com/libp2p/js-libp2p-interfaces/commit/99a862baed66d4e83ba006a70c33561855c9682e)) -* update sibling dependencies ([e95dcc2](https://github.com/libp2p/js-libp2p-interfaces/commit/e95dcc28f0a8b42457a44155eb0dfb3d813b03c8)) -* update sibling dependencies ([3d23367](https://github.com/libp2p/js-libp2p-interfaces/commit/3d233676a17299bfa1b59d309543598176826523)) -* update sibling dependencies ([2b9ddda](https://github.com/libp2p/js-libp2p-interfaces/commit/2b9ddda88d2655d389bf5142f7131f333ab9f780)) -* update sibling dependencies ([bed9f4c](https://github.com/libp2p/js-libp2p-interfaces/commit/bed9f4c7b7044e974a70678762a51e79e018cf9b)) -* update sibling dependencies ([2f52a28](https://github.com/libp2p/js-libp2p-interfaces/commit/2f52a284b59c0a88b040f86da1f5d3f044727f2c)) - -## [@libp2p/interface-mocks-v9.4.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-mocks-v9.3.4...@libp2p/interface-mocks-v9.4.0) (2023-04-14) - - -### Features - -* expose get connection map method of connection manager ([#372](https://github.com/libp2p/js-libp2p-interfaces/issues/372)) ([fc7245b](https://github.com/libp2p/js-libp2p-interfaces/commit/fc7245b63764562f5ec66a5a0ba334caea80ed66)) -* expose get dial queue method of connection manager ([#371](https://github.com/libp2p/js-libp2p-interfaces/issues/371)) ([0c407aa](https://github.com/libp2p/js-libp2p-interfaces/commit/0c407aa0772c171bf6650e31fb20a3433df40b6b)) - -## [@libp2p/interface-mocks-v9.3.4](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-mocks-v9.3.3...@libp2p/interface-mocks-v9.3.4) (2023-04-14) - - -### Dependencies - -* update sibling dependencies ([34b1627](https://github.com/libp2p/js-libp2p-interfaces/commit/34b1627458b2ada5e94e00cf4bcba41a77232090)) - -## [@libp2p/interface-mocks-v9.3.3](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-mocks-v9.3.2...@libp2p/interface-mocks-v9.3.3) (2023-04-14) - - -### Dependencies - -* update sibling dependencies ([3e743bb](https://github.com/libp2p/js-libp2p-interfaces/commit/3e743bba3d8ebd081907e74f02728a1e8476a147)) - -## [@libp2p/interface-mocks-v9.3.2](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-mocks-v9.3.1...@libp2p/interface-mocks-v9.3.2) (2023-04-13) - - -### Dependencies - -* update any-signal to 4.x.x ([#369](https://github.com/libp2p/js-libp2p-interfaces/issues/369)) ([72be911](https://github.com/libp2p/js-libp2p-interfaces/commit/72be91176509f619e5d621463cb4ecc014fde0b7)) - -## [@libp2p/interface-mocks-v9.3.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-mocks-v9.3.0...@libp2p/interface-mocks-v9.3.1) (2023-04-13) - - -### Dependencies - -* bump it-map from 2.0.1 to 3.0.2 ([#361](https://github.com/libp2p/js-libp2p-interfaces/issues/361)) ([c016269](https://github.com/libp2p/js-libp2p-interfaces/commit/c01626912eae85969bf2b1027b68a5242a4ae4d4)) - -## [@libp2p/interface-mocks-v9.3.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-mocks-v9.2.4...@libp2p/interface-mocks-v9.3.0) (2023-04-11) - - -### Features - -* support batch dialling ([#351](https://github.com/libp2p/js-libp2p-interfaces/issues/351)) ([e46b72b](https://github.com/libp2p/js-libp2p-interfaces/commit/e46b72b1731ff935a1f0d755cbaf6f3159060ed3)) - - -### Dependencies - -* update sibling dependencies ([b034810](https://github.com/libp2p/js-libp2p-interfaces/commit/b0348102e41dc18166e70063f4708a2b3544f4b6)) - -## [@libp2p/interface-mocks-v9.2.4](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-mocks-v9.2.3...@libp2p/interface-mocks-v9.2.4) (2023-04-04) - - -### Dependencies - -* bump it-pipe from 2.0.5 to 3.0.1 ([#363](https://github.com/libp2p/js-libp2p-interfaces/issues/363)) ([625817b](https://github.com/libp2p/js-libp2p-interfaces/commit/625817b0bbbee276983c40a0604c8810a25abe8f)) - -## [@libp2p/interface-mocks-v9.2.3](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-mocks-v9.2.2...@libp2p/interface-mocks-v9.2.3) (2023-03-17) - - -### Bug Fixes - -* update project settings ([2aa4f95](https://github.com/libp2p/js-libp2p-interfaces/commit/2aa4f9583fb8ff9b53c51ebb6b81f72d69a1748d)) - -## [@libp2p/interface-mocks-v9.2.2](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-mocks-v9.2.1...@libp2p/interface-mocks-v9.2.2) (2023-03-17) - - -### Dependencies - -* update @multiformats/multiaddr to 12.0.0 ([#354](https://github.com/libp2p/js-libp2p-interfaces/issues/354)) ([e0f327b](https://github.com/libp2p/js-libp2p-interfaces/commit/e0f327b5d54e240feabadce21a841629d633ec5e)) - -## [@libp2p/interface-mocks-v9.2.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-mocks-v9.2.0...@libp2p/interface-mocks-v9.2.1) (2023-03-10) - - -### Bug Fixes - -* filter closed connections properly ([#349](https://github.com/libp2p/js-libp2p-interfaces/issues/349)) ([21021c3](https://github.com/libp2p/js-libp2p-interfaces/commit/21021c366579db5b45b93ea4446118f32aca0428)) - -## [@libp2p/interface-mocks-v9.2.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-mocks-v9.1.3...@libp2p/interface-mocks-v9.2.0) (2023-03-09) - - -### Features - -* split connection gater out into module ([#347](https://github.com/libp2p/js-libp2p-interfaces/issues/347)) ([1824744](https://github.com/libp2p/js-libp2p-interfaces/commit/18247442aa64c809d9e101ccbd0067ce48bdb80f)) - - -### Bug Fixes - -* update @libp2p/interface-connection-gater depdendency ([e53cf8b](https://github.com/libp2p/js-libp2p-interfaces/commit/e53cf8b26b83dcca553b934f171d07d817df15ca)) - - -### Dependencies - -* update sibling dependencies ([e72292f](https://github.com/libp2p/js-libp2p-interfaces/commit/e72292fe1e37ac55b041a09058365fb74de0e629)) - -## [@libp2p/interface-mocks-v9.1.3](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-mocks-v9.1.2...@libp2p/interface-mocks-v9.1.3) (2023-03-07) - - -### Bug Fixes - -* dispatch connection event from mock upgrader ([#345](https://github.com/libp2p/js-libp2p-interfaces/issues/345)) ([b691b1f](https://github.com/libp2p/js-libp2p-interfaces/commit/b691b1fa28e23b549c32e89d6b7c98d6a50c7b8f)) - -## [@libp2p/interface-mocks-v9.1.2](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-mocks-v9.1.1...@libp2p/interface-mocks-v9.1.2) (2023-02-22) - - -### Bug Fixes - -* replace err-code with CodeError ([#334](https://github.com/libp2p/js-libp2p-interfaces/issues/334)) ([a909d41](https://github.com/libp2p/js-libp2p-interfaces/commit/a909d418ce1128c771b682dc78bb48789d4b319a)), closes [js-libp2p#1269](https://github.com/libp2p/js-libp2p/issues/1269) - -## [@libp2p/interface-mocks-v9.1.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-mocks-v9.1.0...@libp2p/interface-mocks-v9.1.1) (2023-01-18) - - -### Dependencies - -* bump aegir from 37.12.1 to 38.1.0 ([#335](https://github.com/libp2p/js-libp2p-interfaces/issues/335)) ([7368a36](https://github.com/libp2p/js-libp2p-interfaces/commit/7368a363423a08e8fa247dcb76ea13e4cf030d65)) - -## [@libp2p/interface-mocks-v9.1.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-mocks-v9.0.1...@libp2p/interface-mocks-v9.1.0) (2023-01-17) - - -### Features - -* safe dispatch event ([#319](https://github.com/libp2p/js-libp2p-interfaces/issues/319)) ([8caeee8](https://github.com/libp2p/js-libp2p-interfaces/commit/8caeee8221e78c2412d8aeb9a7db7cc43abfdf1b)), closes [#317](https://github.com/libp2p/js-libp2p-interfaces/issues/317) - -## [@libp2p/interface-mocks-v9.0.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-mocks-v9.0.0...@libp2p/interface-mocks-v9.0.1) (2023-01-14) - - -### Bug Fixes - -* accept multiaddr param when opening connections ([#336](https://github.com/libp2p/js-libp2p-interfaces/issues/336)) ([fef9c26](https://github.com/libp2p/js-libp2p-interfaces/commit/fef9c26847cf63cb95f5fcb51ee40cbc679cc6bf)) - - -### Trivial Changes - -* remove lerna ([#330](https://github.com/libp2p/js-libp2p-interfaces/issues/330)) ([6678592](https://github.com/libp2p/js-libp2p-interfaces/commit/6678592dd0cf601a2671852f9d2a0aff5dee2b18)) - -## [@libp2p/interface-mocks-v9.0.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-mocks-v8.0.5...@libp2p/interface-mocks-v9.0.0) (2023-01-06) - - -### ⚠ BREAKING CHANGES - -* update peer-id dep to pull in new multiformats (#331) - -### Bug Fixes - -* update peer-id dep to pull in new multiformats ([#331](https://github.com/libp2p/js-libp2p-interfaces/issues/331)) ([fb8b7ba](https://github.com/libp2p/js-libp2p-interfaces/commit/fb8b7ba654a30a08da0652e2833e36dd3bb85e90)) - - -### Dependencies - -* update sibling dependencies ([667082f](https://github.com/libp2p/js-libp2p-interfaces/commit/667082f7070ec28a2f19c356fe44fd7499958f2e)) - -## [@libp2p/interface-mocks-v8.0.5](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-mocks-v8.0.4...@libp2p/interface-mocks-v8.0.5) (2023-01-06) - - -### Dependencies - -* update sibling dependencies ([b50e621](https://github.com/libp2p/js-libp2p-interfaces/commit/b50e621d31a8b32affc3fadb9f97c4883d577f93)) - -## [@libp2p/interface-mocks-v8.0.4](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-mocks-v8.0.3...@libp2p/interface-mocks-v8.0.4) (2022-12-16) - - -### Documentation - -* update project config ([#323](https://github.com/libp2p/js-libp2p-interfaces/issues/323)) ([0fc6a08](https://github.com/libp2p/js-libp2p-interfaces/commit/0fc6a08e9cdcefe361fe325281a3a2a03759ff59)) - -## [@libp2p/interface-mocks-v8.0.3](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-mocks-v8.0.2...@libp2p/interface-mocks-v8.0.3) (2022-12-14) - - -### Bug Fixes - -* generate docs for all packages ([#321](https://github.com/libp2p/js-libp2p-interfaces/issues/321)) ([b6f8b32](https://github.com/libp2p/js-libp2p-interfaces/commit/b6f8b32a920c15a28fe021e6050e31aaae89d518)) - -## [@libp2p/interface-mocks-v8.0.2](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-mocks-v8.0.1...@libp2p/interface-mocks-v8.0.2) (2022-12-07) - - -### Bug Fixes - -* add missing dependency ([e2168e8](https://github.com/libp2p/js-libp2p-interfaces/commit/e2168e8f863d6a488e4117800b5143dce1122b0b)) - -## [@libp2p/interface-mocks-v8.0.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-mocks-v8.0.0...@libp2p/interface-mocks-v8.0.1) (2022-11-05) - - -### Bug Fixes - -* metrics only need numbers ([#312](https://github.com/libp2p/js-libp2p-interfaces/issues/312)) ([0076c1f](https://github.com/libp2p/js-libp2p-interfaces/commit/0076c1f354ebc1106b6ac42d48688c0209866084)) - -## [@libp2p/interface-mocks-v8.0.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-mocks-v7.1.0...@libp2p/interface-mocks-v8.0.0) (2022-11-05) - - -### ⚠ BREAKING CHANGES - -* the global/per-peer moving average tracking has been removed from the interface as it's expensive and requires lots of timers - this functionality can be replicated by implementations if it's desirable. It's better to have simple counters instead and let an external system like Prometheus or Graphana calculate the values over time - -### Features - -* return metrics objects from register instead of updating with an options object ([#310](https://github.com/libp2p/js-libp2p-interfaces/issues/310)) ([3b106ce](https://github.com/libp2p/js-libp2p-interfaces/commit/3b106ce799b5d84a82a66238995e09970ed8116c)) - - -### Bug Fixes - -* update project config ([#311](https://github.com/libp2p/js-libp2p-interfaces/issues/311)) ([27dd0ce](https://github.com/libp2p/js-libp2p-interfaces/commit/27dd0ce3c249892ac69cbb24ddaf0b9f32385e37)) - - -### Dependencies - -* update sibling dependencies ([6f41152](https://github.com/libp2p/js-libp2p-interfaces/commit/6f41152cc10e9babd338fe0c0d3c9bfff6eee960)) - -## [@libp2p/interface-mocks-v7.1.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-mocks-v7.0.3...@libp2p/interface-mocks-v7.1.0) (2022-11-05) - - -### Features - -* allow passing muxer factory to mock upgrader ([#309](https://github.com/libp2p/js-libp2p-interfaces/issues/309)) ([b2a4d92](https://github.com/libp2p/js-libp2p-interfaces/commit/b2a4d9231580e4cfc7b662e4cdae72f43e1c1011)) - -## [@libp2p/interface-mocks-v7.0.3](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-mocks-v7.0.2...@libp2p/interface-mocks-v7.0.3) (2022-10-18) - - -### Dependencies - -* bump it-ndjson from 0.1.1 to 1.0.0 ([#308](https://github.com/libp2p/js-libp2p-interfaces/issues/308)) ([54db8a4](https://github.com/libp2p/js-libp2p-interfaces/commit/54db8a45c8e533b832c0b7b0f6847c28d7185676)) - -## [@libp2p/interface-mocks-v7.0.2](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-mocks-v7.0.1...@libp2p/interface-mocks-v7.0.2) (2022-10-17) - - -### Dependencies - -* bump it-map from 1.0.6 to 2.0.0 ([#304](https://github.com/libp2p/js-libp2p-interfaces/issues/304)) ([8a1f7f4](https://github.com/libp2p/js-libp2p-interfaces/commit/8a1f7f4241d3acf250ee81a2265a00f58e80e6ed)) - -## [@libp2p/interface-mocks-v7.0.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-mocks-v7.0.0...@libp2p/interface-mocks-v7.0.1) (2022-10-12) - - -### Bug Fixes - -* export network components type ([79a5d8f](https://github.com/libp2p/js-libp2p-interfaces/commit/79a5d8fc57ae47274ff9ad9c3969c5898f07eb1d)) -* update mock network components use ([c760e95](https://github.com/libp2p/js-libp2p-interfaces/commit/c760e95f07b6199f08adb20c1e3a4265649fdda0)) - - -### Trivial Changes - -* fix linting ([a8ab192](https://github.com/libp2p/js-libp2p-interfaces/commit/a8ab19295452c388d6556ea7847c490035455c99)) - -## [@libp2p/interface-mocks-v7.0.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-mocks-v6.1.0...@libp2p/interface-mocks-v7.0.0) (2022-10-12) - - -### ⚠ BREAKING CHANGES - -* modules no longer implement `Initializable` instead switching to constructor injection - -### Bug Fixes - -* remove @libp2p/components ([#301](https://github.com/libp2p/js-libp2p-interfaces/issues/301)) ([1d37dc6](https://github.com/libp2p/js-libp2p-interfaces/commit/1d37dc6d3197838a71895d5769ad8bba6eb38fd3)) - - -### Dependencies - -* update sibling dependencies ([99330b2](https://github.com/libp2p/js-libp2p-interfaces/commit/99330b20842b2aff7530d1b9d373e8dce1ec3699)) -* update sibling dependencies ([6f26d1b](https://github.com/libp2p/js-libp2p-interfaces/commit/6f26d1b0343f4b41c064fab3ef87f308fc0c652d)) -* update sibling dependencies ([2ad1fa3](https://github.com/libp2p/js-libp2p-interfaces/commit/2ad1fa37c46b4c472570d79a592e798f20ed0cc8)) - -## [@libp2p/interface-mocks-v6.1.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-mocks-v6.0.1...@libp2p/interface-mocks-v6.1.0) (2022-10-11) - - -### Features - -* add afterUpgradeInbound method ([#300](https://github.com/libp2p/js-libp2p-interfaces/issues/300)) ([fbdf5f5](https://github.com/libp2p/js-libp2p-interfaces/commit/fbdf5f54277735a26df0a28099eeae9d57159978)) - -## [@libp2p/interface-mocks-v6.0.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-mocks-v6.0.0...@libp2p/interface-mocks-v6.0.1) (2022-10-07) - - -### Dependencies - -* bump @libp2p/components from 2.1.1 to 3.0.0 ([#299](https://github.com/libp2p/js-libp2p-interfaces/issues/299)) ([b3f493c](https://github.com/libp2p/js-libp2p-interfaces/commit/b3f493c5e260f697f66de54b56379d036ca3db59)) - -## [@libp2p/interface-mocks-v6.0.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-mocks-v5.1.0...@libp2p/interface-mocks-v6.0.0) (2022-10-06) - - -### ⚠ BREAKING CHANGES - -* the return type of StreamMuxer.newStream can now return a promise - -Co-authored-by: Marco Munizaga - -### Features - -* add upgrader options ([#290](https://github.com/libp2p/js-libp2p-interfaces/issues/290)) ([c502b66](https://github.com/libp2p/js-libp2p-interfaces/commit/c502b66d87020eb8e2768c49be17392c55503f69)) - - -### Dependencies - -* update sibling dependencies ([0fae3ee](https://github.com/libp2p/js-libp2p-interfaces/commit/0fae3ee43fab43293fb290654a927b5c5c5759fc)) -* update sibling dependencies ([8a89a05](https://github.com/libp2p/js-libp2p-interfaces/commit/8a89a054e95827dd8cccc033669e17ae58059fbc)) -* update sibling dependencies ([66b4993](https://github.com/libp2p/js-libp2p-interfaces/commit/66b49938a09eeb12bf8ec8d78938d5cffd6ec134)) - -## [@libp2p/interface-mocks-v5.1.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-mocks-v5.0.0...@libp2p/interface-mocks-v5.1.0) (2022-10-04) - - -### Features - -* add acceptIncomingConnection to ConnectionManager ([#295](https://github.com/libp2p/js-libp2p-interfaces/issues/295)) ([5d460e8](https://github.com/libp2p/js-libp2p-interfaces/commit/5d460e8815a8b49915da7ffabccc4a8b96a61acc)) - -## [@libp2p/interface-mocks-v5.0.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-mocks-v4.0.3...@libp2p/interface-mocks-v5.0.0) (2022-10-04) - - -### ⚠ BREAKING CHANGES - -* Add remoteExtensions to connection-encrypter (#293) - -### Features - -* Add remoteExtensions to connection-encrypter ([#293](https://github.com/libp2p/js-libp2p-interfaces/issues/293)) ([501c684](https://github.com/libp2p/js-libp2p-interfaces/commit/501c684d792cd910de7cb9bfbda349db257ee2ca)) - - -### Dependencies - -* update sibling dependencies ([419f947](https://github.com/libp2p/js-libp2p-interfaces/commit/419f9479e8bba5d0555fe20a6fb9f0cf12a82cf9)) - -## [@libp2p/interface-mocks-v4.0.3](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-mocks-v4.0.2...@libp2p/interface-mocks-v4.0.3) (2022-09-21) - - -### Dependencies - -* update @multiformats/multiaddr to 11.0.0 ([#288](https://github.com/libp2p/js-libp2p-interfaces/issues/288)) ([57b2ad8](https://github.com/libp2p/js-libp2p-interfaces/commit/57b2ad88edfc7807311143791bc49270b1a81eaf)) - -## [@libp2p/interface-mocks-v4.0.2](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-mocks-v4.0.1...@libp2p/interface-mocks-v4.0.2) (2022-08-11) - - -### Bug Fixes - -* update marshal type ([#282](https://github.com/libp2p/js-libp2p-interfaces/issues/282)) ([2c04ff9](https://github.com/libp2p/js-libp2p-interfaces/commit/2c04ff98097ba33dc64878b788c6b9318d2ea98b)) - -## [@libp2p/interface-mocks-v4.0.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-mocks-v4.0.0...@libp2p/interface-mocks-v4.0.1) (2022-08-10) - - -### Bug Fixes - -* revert connection encryption change to accept Uint8ArrayLists ([#280](https://github.com/libp2p/js-libp2p-interfaces/issues/280)) ([03d763c](https://github.com/libp2p/js-libp2p-interfaces/commit/03d763c1a6b168bba001783a1fb59af3f7d4e205)) - -## [@libp2p/interface-mocks-v4.0.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-mocks-v3.0.3...@libp2p/interface-mocks-v4.0.0) (2022-08-07) - - -### ⚠ BREAKING CHANGES - -* change stream muxer interface (#279) -* change connection encryption interface to uint8arraylist (#278) - -### Features - -* change connection encryption interface to uint8arraylist ([#278](https://github.com/libp2p/js-libp2p-interfaces/issues/278)) ([1fa580c](https://github.com/libp2p/js-libp2p-interfaces/commit/1fa580c5a45325dc9384738e9a78a238eabb81c3)) -* change stream muxer interface ([#279](https://github.com/libp2p/js-libp2p-interfaces/issues/279)) ([1ebe269](https://github.com/libp2p/js-libp2p-interfaces/commit/1ebe26988b6a286f36a4fc5177f502cfb60368a1)) - - -### Dependencies - -* update sibling dependencies ([f75e927](https://github.com/libp2p/js-libp2p-interfaces/commit/f75e9271345910e812ad600f936f4f774028e3fe)) -* update sibling dependencies ([d98a5ea](https://github.com/libp2p/js-libp2p-interfaces/commit/d98a5ea604c817cf6da47d9e86eea1e981b48711)) -* update sibling dependencies ([f859920](https://github.com/libp2p/js-libp2p-interfaces/commit/f859920423587ae797ac90ccaa3af8bdf60ae549)) -* update sibling dependencies ([93a89b1](https://github.com/libp2p/js-libp2p-interfaces/commit/93a89b1ca6d35fb5f26963ae7bb10026f3f5d45d)) - -## [@libp2p/interface-mocks-v3.0.3](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-mocks-v3.0.2...@libp2p/interface-mocks-v3.0.3) (2022-07-31) - - -### Dependencies - -* update uint8arraylist and p-wait-for deps ([#274](https://github.com/libp2p/js-libp2p-interfaces/issues/274)) ([c55f12e](https://github.com/libp2p/js-libp2p-interfaces/commit/c55f12e47be0a10e41709b0d6a60dd8bc1209ee5)) - -## [@libp2p/interface-mocks-v3.0.2](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-mocks-v3.0.1...@libp2p/interface-mocks-v3.0.2) (2022-07-31) - - -### Bug Fixes - -* mock connection manager close reciprocal connection ([#268](https://github.com/libp2p/js-libp2p-interfaces/issues/268)) ([f16dd7b](https://github.com/libp2p/js-libp2p-interfaces/commit/f16dd7bed2735e3a27e8febfe48bac75d4ff009f)) - - -### Trivial Changes - -* update project config ([#271](https://github.com/libp2p/js-libp2p-interfaces/issues/271)) ([59c0bf5](https://github.com/libp2p/js-libp2p-interfaces/commit/59c0bf5e0b05496fca2e4902632b61bb41fad9e9)) - -## [@libp2p/interface-mocks-v3.0.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-mocks-v3.0.0...@libp2p/interface-mocks-v3.0.1) (2022-06-27) - - -### Trivial Changes - -* update deps ([#262](https://github.com/libp2p/js-libp2p-interfaces/issues/262)) ([51edf7d](https://github.com/libp2p/js-libp2p-interfaces/commit/51edf7d9b3765a6f75c915b1483ea345d0133a41)) - -## [@libp2p/interface-mocks-v3.0.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-mocks-v2.1.0...@libp2p/interface-mocks-v3.0.0) (2022-06-24) - - -### ⚠ BREAKING CHANGES - -* StreamMuxer now has a `close` method - -### Features - -* add stream muxer close ([#254](https://github.com/libp2p/js-libp2p-interfaces/issues/254)) ([d1f511e](https://github.com/libp2p/js-libp2p-interfaces/commit/d1f511e4b5857769c4eddf902288dc69fcb667b4)) - - -### Trivial Changes - -* update sibling dependencies [skip ci] ([7f7fb67](https://github.com/libp2p/js-libp2p-interfaces/commit/7f7fb67b054688bfbc0cc68b9f2892bee8b41f13)) -* update sibling dependencies [skip ci] ([c522241](https://github.com/libp2p/js-libp2p-interfaces/commit/c522241b08cfef3995efb5415104f46521dcd3b7)) - -## [@libp2p/interface-mocks-v2.1.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-mocks-v2.0.1...@libp2p/interface-mocks-v2.1.0) (2022-06-21) - - -### Features - -* add direction to StreamMuxerInit ([#253](https://github.com/libp2p/js-libp2p-interfaces/issues/253)) ([6d34d75](https://github.com/libp2p/js-libp2p-interfaces/commit/6d34d755ff4e798d52945f1f099052bdd6a83f2b)) - -## [@libp2p/interface-mocks-v2.0.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-mocks-v2.0.0...@libp2p/interface-mocks-v2.0.1) (2022-06-17) - - -### Bug Fixes - -* update stream handler args ([#247](https://github.com/libp2p/js-libp2p-interfaces/issues/247)) ([d29e134](https://github.com/libp2p/js-libp2p-interfaces/commit/d29e134bd70295c725bfd627d5887954d1a278ae)) - -## [@libp2p/interface-mocks-v2.0.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-mocks-v1.1.0...@libp2p/interface-mocks-v2.0.0) (2022-06-16) - - -### ⚠ BREAKING CHANGES - -* The Connection and Stream APIs have been updated - -### Features - -* store stream data on the stream, track the stream direction ([#245](https://github.com/libp2p/js-libp2p-interfaces/issues/245)) ([6d74d2f](https://github.com/libp2p/js-libp2p-interfaces/commit/6d74d2f9f344fb4d6741ba0d35263ebe351a4c65)) - - -### Trivial Changes - -* update deps ([970a940](https://github.com/libp2p/js-libp2p-interfaces/commit/970a940a2f65b946936a53febdc52527baefbd34)) -* update deps ([219e60e](https://github.com/libp2p/js-libp2p-interfaces/commit/219e60ec6f886b95803457fe48dfcdb4ed57e34c)) -* update deps ([545264f](https://github.com/libp2p/js-libp2p-interfaces/commit/545264f87a58394d2a7da77e93f3a596e889238f)) - -## [@libp2p/interface-mocks-v1.1.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-mocks-v1.0.1...@libp2p/interface-mocks-v1.1.0) (2022-06-16) - - -### Features - -* define stream limits as input/output ([#240](https://github.com/libp2p/js-libp2p-interfaces/issues/240)) ([554fe95](https://github.com/libp2p/js-libp2p-interfaces/commit/554fe95865c4851fcef3b311d80d44f82a613969)) - -## [@libp2p/interface-mocks-v1.0.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-mocks-v1.0.0...@libp2p/interface-mocks-v1.0.1) (2022-06-14) - - -### Bug Fixes - -* remove components from muxer factory function ([#238](https://github.com/libp2p/js-libp2p-interfaces/issues/238)) ([e4dab30](https://github.com/libp2p/js-libp2p-interfaces/commit/e4dab306d9bf406b9bb3cb92644e28cf81f7bda6)) - - -### Trivial Changes - -* update components module ([#235](https://github.com/libp2p/js-libp2p-interfaces/issues/235)) ([5844207](https://github.com/libp2p/js-libp2p-interfaces/commit/58442070af59aa852c83ec3aecdbd1d2c646b018)) -* update it-pushable dep ([#237](https://github.com/libp2p/js-libp2p-interfaces/issues/237)) ([2e16465](https://github.com/libp2p/js-libp2p-interfaces/commit/2e164658df344b5ec475be2a571df5d6f20ee086)) - -## [@libp2p/interface-compliance-tests-v2.0.3](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-compliance-tests-v2.0.2...@libp2p/interface-compliance-tests-v2.0.3) (2022-05-24) - - -### Bug Fixes - -* only close muxed stream for reading ([#220](https://github.com/libp2p/js-libp2p-interfaces/issues/220)) ([f2f7141](https://github.com/libp2p/js-libp2p-interfaces/commit/f2f7141f01af715e600201ac9e7e52fbbb5c7e1b)) - -## [@libp2p/interface-compliance-tests-v2.0.2](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-compliance-tests-v2.0.1...@libp2p/interface-compliance-tests-v2.0.2) (2022-05-24) - - -### Bug Fixes - -* accept abort options in connection.newStream ([#219](https://github.com/libp2p/js-libp2p-interfaces/issues/219)) ([8bfcbc9](https://github.com/libp2p/js-libp2p-interfaces/commit/8bfcbc9ee883336f213cdfc83e477549ca368df5)) -* chunk data in mock muxer ([#218](https://github.com/libp2p/js-libp2p-interfaces/issues/218)) ([14604f6](https://github.com/libp2p/js-libp2p-interfaces/commit/14604f69a858bf8c16ce118420c5e49f3f5331ea)) - -## [@libp2p/interface-compliance-tests-v2.0.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-compliance-tests-v2.0.0...@libp2p/interface-compliance-tests-v2.0.1) (2022-05-23) - - -### Bug Fixes - -* make stream return types synchronous ([#217](https://github.com/libp2p/js-libp2p-interfaces/issues/217)) ([2fe61b7](https://github.com/libp2p/js-libp2p-interfaces/commit/2fe61b7fbeda2e549edf095a927d623aa8eb476b)) - -## [@libp2p/interface-compliance-tests-v2.0.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-compliance-tests-v1.1.34...@libp2p/interface-compliance-tests-v2.0.0) (2022-05-20) - - -### ⚠ BREAKING CHANGES - -* This adds closeWrite and closeRead checks in the tests, which will cause test failures for muxers that don't implement those - -### Bug Fixes - -* close streams when connection is closed ([#214](https://github.com/libp2p/js-libp2p-interfaces/issues/214)) ([88fcd58](https://github.com/libp2p/js-libp2p-interfaces/commit/88fcd586276e03dd740c7095f05e21754ac1f3b5)), closes [#90](https://github.com/libp2p/js-libp2p-interfaces/issues/90) -* update interfaces ([#215](https://github.com/libp2p/js-libp2p-interfaces/issues/215)) ([72e6890](https://github.com/libp2p/js-libp2p-interfaces/commit/72e6890826dadbd6e7cbba5536bde350ca4286e6)) - -## [@libp2p/interface-compliance-tests-v1.1.34](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-compliance-tests-v1.1.33...@libp2p/interface-compliance-tests-v1.1.34) (2022-05-10) - - -### Trivial Changes - -* **deps:** bump sinon from 13.0.2 to 14.0.0 ([#211](https://github.com/libp2p/js-libp2p-interfaces/issues/211)) ([8859f70](https://github.com/libp2p/js-libp2p-interfaces/commit/8859f70943c0bcdb210f54a338ae901739e5e6f2)) - -## [@libp2p/interface-compliance-tests-v1.1.33](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-compliance-tests-v1.1.32...@libp2p/interface-compliance-tests-v1.1.33) (2022-05-06) - - -### Bug Fixes - -* add tag to peer discovery interface ([#210](https://github.com/libp2p/js-libp2p-interfaces/issues/210)) ([f99c833](https://github.com/libp2p/js-libp2p-interfaces/commit/f99c833c8436f8434f380d890ec5d267279312d7)) - -## [@libp2p/interface-compliance-tests-v1.1.32](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-compliance-tests-v1.1.31...@libp2p/interface-compliance-tests-v1.1.32) (2022-05-04) - - -### Bug Fixes - -* move startable and events interfaces ([#209](https://github.com/libp2p/js-libp2p-interfaces/issues/209)) ([8ce8a08](https://github.com/libp2p/js-libp2p-interfaces/commit/8ce8a08c94b0738aa32da516558977b195ddd8ed)) - -## [@libp2p/interface-compliance-tests-v1.1.31](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-compliance-tests-v1.1.30...@libp2p/interface-compliance-tests-v1.1.31) (2022-05-03) - - -### Bug Fixes - -* only send handled protocols ([#207](https://github.com/libp2p/js-libp2p-interfaces/issues/207)) ([1f7afc2](https://github.com/libp2p/js-libp2p-interfaces/commit/1f7afc29d72fde708064ec6479011dbc0a225962)) - -## [@libp2p/interface-compliance-tests-v1.1.30](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-compliance-tests-v1.1.29...@libp2p/interface-compliance-tests-v1.1.30) (2022-05-01) - - -### Bug Fixes - -* move connection manager mock to connection manager module ([#205](https://github.com/libp2p/js-libp2p-interfaces/issues/205)) ([a367375](https://github.com/libp2p/js-libp2p-interfaces/commit/a367375accc690d7b4608c9a3313f91df700efd8)) - -## [@libp2p/interface-compliance-tests-v1.1.29](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-compliance-tests-v1.1.28...@libp2p/interface-compliance-tests-v1.1.29) (2022-04-28) - - -### Bug Fixes - -* pubsub should not be startable ([#204](https://github.com/libp2p/js-libp2p-interfaces/issues/204)) ([59bd924](https://github.com/libp2p/js-libp2p-interfaces/commit/59bd9245a207268525bdd26a05c5306fe436fcc4)) - -## [@libp2p/interface-compliance-tests-v1.1.28](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-compliance-tests-v1.1.27...@libp2p/interface-compliance-tests-v1.1.28) (2022-04-28) - - -### Bug Fixes - -* pubsub and dht are always set ([#203](https://github.com/libp2p/js-libp2p-interfaces/issues/203)) ([86860c1](https://github.com/libp2p/js-libp2p-interfaces/commit/86860c1836a2464b2ad380b09542e3f3271ae287)) - -## [@libp2p/interface-compliance-tests-v1.1.27](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-compliance-tests-v1.1.26...@libp2p/interface-compliance-tests-v1.1.27) (2022-04-26) - - -### Bug Fixes - -* add delays for gossipsub ([#202](https://github.com/libp2p/js-libp2p-interfaces/issues/202)) ([cf85799](https://github.com/libp2p/js-libp2p-interfaces/commit/cf85799fdd0d4848ad2187bbbb0dd6ac5e8cb254)) - -## [@libp2p/interface-compliance-tests-v1.1.26](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-compliance-tests-v1.1.25...@libp2p/interface-compliance-tests-v1.1.26) (2022-04-25) - - -### Bug Fixes - -* stop pubsub after test ([#200](https://github.com/libp2p/js-libp2p-interfaces/issues/200)) ([2d2650c](https://github.com/libp2p/js-libp2p-interfaces/commit/2d2650cb8cabce137665aafd55a2fb14cbd5dacd)) - -## [@libp2p/interface-compliance-tests-v1.1.25](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-compliance-tests-v1.1.24...@libp2p/interface-compliance-tests-v1.1.25) (2022-04-22) - - -### Bug Fixes - -* update pubsub interface in line with gossipsub ([#199](https://github.com/libp2p/js-libp2p-interfaces/issues/199)) ([3f55596](https://github.com/libp2p/js-libp2p-interfaces/commit/3f555965cddea3ef03e7217b755c82aa4107e093)) - -## [@libp2p/interface-compliance-tests-v1.1.24](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-compliance-tests-v1.1.23...@libp2p/interface-compliance-tests-v1.1.24) (2022-04-21) - - -### Bug Fixes - -* test PubSub interface and not PubSubBaseProtocol ([#198](https://github.com/libp2p/js-libp2p-interfaces/issues/198)) ([96c15c9](https://github.com/libp2p/js-libp2p-interfaces/commit/96c15c9780821a3cb763e48854d64377bf562692)) - -## [@libp2p/interface-compliance-tests-v1.1.23](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-compliance-tests-v1.1.22...@libp2p/interface-compliance-tests-v1.1.23) (2022-04-20) - - -### Bug Fixes - -* emit pubsub messages using 'message' event ([#197](https://github.com/libp2p/js-libp2p-interfaces/issues/197)) ([df9b685](https://github.com/libp2p/js-libp2p-interfaces/commit/df9b685cea30653109f2fa2cb5583a3bca7b09bb)) - -## [@libp2p/interface-compliance-tests-v1.1.22](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-compliance-tests-v1.1.21...@libp2p/interface-compliance-tests-v1.1.22) (2022-04-19) - - -### Bug Fixes - -* move dev deps to prod ([#195](https://github.com/libp2p/js-libp2p-interfaces/issues/195)) ([3e1ffc7](https://github.com/libp2p/js-libp2p-interfaces/commit/3e1ffc7b174e74be483943ad4e5fcab823ae3f6d)) - -## [@libp2p/interface-compliance-tests-v1.1.21](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-compliance-tests-v1.1.20...@libp2p/interface-compliance-tests-v1.1.21) (2022-04-08) - - -### Bug Fixes - -* swap protobufjs for protons ([#191](https://github.com/libp2p/js-libp2p-interfaces/issues/191)) ([d72b30c](https://github.com/libp2p/js-libp2p-interfaces/commit/d72b30cfca4b9145e0b31db28e8fa3329a180e83)) - - -### Trivial Changes - -* update aegir ([#192](https://github.com/libp2p/js-libp2p-interfaces/issues/192)) ([41c1494](https://github.com/libp2p/js-libp2p-interfaces/commit/41c14941e8b67d6601a90b4d48a2776573d55e60)) - -## [@libp2p/interface-compliance-tests-v1.1.20](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-compliance-tests-v1.1.19...@libp2p/interface-compliance-tests-v1.1.20) (2022-03-24) - - -### Bug Fixes - -* rename peer data to peer info ([#187](https://github.com/libp2p/js-libp2p-interfaces/issues/187)) ([dfea342](https://github.com/libp2p/js-libp2p-interfaces/commit/dfea3429bad57abde040397e4e7a58539829e9c2)) - -## [@libp2p/interface-compliance-tests-v1.1.19](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-compliance-tests-v1.1.18...@libp2p/interface-compliance-tests-v1.1.19) (2022-03-22) - - -### Bug Fixes - -* add method for startable lifecyle ([#186](https://github.com/libp2p/js-libp2p-interfaces/issues/186)) ([2730e29](https://github.com/libp2p/js-libp2p-interfaces/commit/2730e2947bbd231db3f7f82951b51ee534733ab2)) - -## [@libp2p/interface-compliance-tests-v1.1.18](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-compliance-tests-v1.1.17...@libp2p/interface-compliance-tests-v1.1.18) (2022-03-20) - - -### Bug Fixes - -* update pubsub types ([#183](https://github.com/libp2p/js-libp2p-interfaces/issues/183)) ([7ef4baa](https://github.com/libp2p/js-libp2p-interfaces/commit/7ef4baad0fe30f783f3eecd5199ef92af08b7f57)) - -## [@libp2p/interface-compliance-tests-v1.1.17](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-compliance-tests-v1.1.16...@libp2p/interface-compliance-tests-v1.1.17) (2022-03-15) - - -### Bug Fixes - -* use custom event instead of error event ([#181](https://github.com/libp2p/js-libp2p-interfaces/issues/181)) ([71ab242](https://github.com/libp2p/js-libp2p-interfaces/commit/71ab2424dfbf6337111d6d9d994f27c7967c20f1)) - -## [@libp2p/interface-compliance-tests-v1.1.16](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-compliance-tests-v1.1.15...@libp2p/interface-compliance-tests-v1.1.16) (2022-03-15) - - -### Bug Fixes - -* simplify transport interface, update interfaces for use with libp2p ([#180](https://github.com/libp2p/js-libp2p-interfaces/issues/180)) ([ec81622](https://github.com/libp2p/js-libp2p-interfaces/commit/ec81622e5b7c6d256e0f8aed6d3695642473293b)) - -## [@libp2p/interface-compliance-tests-v1.1.15](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-compliance-tests-v1.1.14...@libp2p/interface-compliance-tests-v1.1.15) (2022-02-27) - - -### Bug Fixes - -* rename crypto to connection-encrypter ([#179](https://github.com/libp2p/js-libp2p-interfaces/issues/179)) ([d197f55](https://github.com/libp2p/js-libp2p-interfaces/commit/d197f554d7cdadb3b05ed2d6c69fda2c4362b1eb)) - -## [@libp2p/interface-compliance-tests-v1.1.14](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-compliance-tests-v1.1.13...@libp2p/interface-compliance-tests-v1.1.14) (2022-02-27) - - -### Bug Fixes - -* update package config and add connection gater interface ([#178](https://github.com/libp2p/js-libp2p-interfaces/issues/178)) ([c6079a6](https://github.com/libp2p/js-libp2p-interfaces/commit/c6079a6367f004788062df3e30ad2e26330d947b)) - -## [@libp2p/interface-compliance-tests-v1.1.13](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-compliance-tests-v1.1.12...@libp2p/interface-compliance-tests-v1.1.13) (2022-02-21) - - -### Bug Fixes - -* increase stream test timeout ([#175](https://github.com/libp2p/js-libp2p-interfaces/issues/175)) ([568aefb](https://github.com/libp2p/js-libp2p-interfaces/commit/568aefb5c099ba0161ffecf86bda238b92d396b0)) - -## [@libp2p/interface-compliance-tests-v1.1.12](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-compliance-tests-v1.1.11...@libp2p/interface-compliance-tests-v1.1.12) (2022-02-21) - - -### Bug Fixes - -* update muxer to pass transport tests ([#174](https://github.com/libp2p/js-libp2p-interfaces/issues/174)) ([466ed53](https://github.com/libp2p/js-libp2p-interfaces/commit/466ed53192aa196ac2dbdb83df3c8db9cd5b1e07)) - -## [@libp2p/interface-compliance-tests-v1.1.11](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-compliance-tests-v1.1.10...@libp2p/interface-compliance-tests-v1.1.11) (2022-02-18) - - -### Bug Fixes - -* remove delays from pubsub tests ([#173](https://github.com/libp2p/js-libp2p-interfaces/issues/173)) ([5c8fe09](https://github.com/libp2p/js-libp2p-interfaces/commit/5c8fe09294f0cbd8add1406a61fa7dbc5b4e788b)) - -## [@libp2p/interface-compliance-tests-v1.1.10](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-compliance-tests-v1.1.9...@libp2p/interface-compliance-tests-v1.1.10) (2022-02-18) - - -### Bug Fixes - -* simpler pubsub ([#172](https://github.com/libp2p/js-libp2p-interfaces/issues/172)) ([98715ed](https://github.com/libp2p/js-libp2p-interfaces/commit/98715ed73183b32e4fda3d878a462389548358d9)) - -## [@libp2p/interface-compliance-tests-v1.1.9](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-compliance-tests-v1.1.8...@libp2p/interface-compliance-tests-v1.1.9) (2022-02-17) - - -### Bug Fixes - -* update deps ([#171](https://github.com/libp2p/js-libp2p-interfaces/issues/171)) ([d0d2564](https://github.com/libp2p/js-libp2p-interfaces/commit/d0d2564a84a0722ab587a3aa6ec01e222442b100)) - -## [@libp2p/interface-compliance-tests-v1.1.8](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-compliance-tests-v1.1.7...@libp2p/interface-compliance-tests-v1.1.8) (2022-02-17) - - -### Bug Fixes - -* add multistream-select and update pubsub types ([#170](https://github.com/libp2p/js-libp2p-interfaces/issues/170)) ([b9ecb2b](https://github.com/libp2p/js-libp2p-interfaces/commit/b9ecb2bee8f2abc0c41bfcf7bf2025894e37ddc2)) - -## [@libp2p/interface-compliance-tests-v1.1.7](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-compliance-tests-v1.1.6...@libp2p/interface-compliance-tests-v1.1.7) (2022-02-16) - - -### Bug Fixes - -* test muxer ([#169](https://github.com/libp2p/js-libp2p-interfaces/issues/169)) ([574723d](https://github.com/libp2p/js-libp2p-interfaces/commit/574723d11007e875e7adfa5c32819445f9b8def7)) - -## [@libp2p/interface-compliance-tests-v1.1.6](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-compliance-tests-v1.1.5...@libp2p/interface-compliance-tests-v1.1.6) (2022-02-12) - - -### Bug Fixes - -* return registered topologies in mock ([#168](https://github.com/libp2p/js-libp2p-interfaces/issues/168)) ([1583019](https://github.com/libp2p/js-libp2p-interfaces/commit/158301982384a694ac3fb8f9df67c71b7b776b47)) - -## [@libp2p/interface-compliance-tests-v1.1.5](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-compliance-tests-v1.1.4...@libp2p/interface-compliance-tests-v1.1.5) (2022-02-12) - - -### Bug Fixes - -* hide implementations behind factory methods ([#167](https://github.com/libp2p/js-libp2p-interfaces/issues/167)) ([2fba080](https://github.com/libp2p/js-libp2p-interfaces/commit/2fba0800c9896af6dcc49da4fa904bb4a3e3e40d)) - -## [@libp2p/interface-compliance-tests-v1.1.4](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-compliance-tests-v1.1.3...@libp2p/interface-compliance-tests-v1.1.4) (2022-02-11) - - -### Bug Fixes - -* simpler topologies ([#164](https://github.com/libp2p/js-libp2p-interfaces/issues/164)) ([45fcaa1](https://github.com/libp2p/js-libp2p-interfaces/commit/45fcaa10a6a3215089340ff2eff117d7fd1100e7)) - -## [@libp2p/interface-compliance-tests-v1.1.3](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-compliance-tests-v1.1.2...@libp2p/interface-compliance-tests-v1.1.3) (2022-02-10) - - -### Bug Fixes - -* make registrar simpler ([#163](https://github.com/libp2p/js-libp2p-interfaces/issues/163)) ([d122f3d](https://github.com/libp2p/js-libp2p-interfaces/commit/d122f3daaccc04039d90814960da92b513265644)) - -## [@libp2p/interface-compliance-tests-v1.1.2](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-compliance-tests-v1.1.1...@libp2p/interface-compliance-tests-v1.1.2) (2022-02-10) - - -### Bug Fixes - -* remove args from listener events ([#162](https://github.com/libp2p/js-libp2p-interfaces/issues/162)) ([011ac89](https://github.com/libp2p/js-libp2p-interfaces/commit/011ac891ec7d44625cb4342f068bcd9f241a5b45)) - -## [@libp2p/interface-compliance-tests-v1.1.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-compliance-tests-v1.1.0...@libp2p/interface-compliance-tests-v1.1.1) (2022-02-10) - - -### Bug Fixes - -* remove node event emitters ([#161](https://github.com/libp2p/js-libp2p-interfaces/issues/161)) ([221fb6a](https://github.com/libp2p/js-libp2p-interfaces/commit/221fb6a024430dc56288d73d8b8ce1aa88427701)) - -## [@libp2p/interface-compliance-tests-v1.1.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-compliance-tests-v1.0.8...@libp2p/interface-compliance-tests-v1.1.0) (2022-02-09) - - -### Features - -* add peer store/records, and streams are just streams ([#160](https://github.com/libp2p/js-libp2p-interfaces/issues/160)) ([8860a0c](https://github.com/libp2p/js-libp2p-interfaces/commit/8860a0cd46b359a5648402d83870f7ff957222fe)) - -## [@libp2p/interface-compliance-tests-v1.0.8](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-compliance-tests-v1.0.7...@libp2p/interface-compliance-tests-v1.0.8) (2022-02-05) - - -### Bug Fixes - -* fix muxer tests ([#157](https://github.com/libp2p/js-libp2p-interfaces/issues/157)) ([7233c44](https://github.com/libp2p/js-libp2p-interfaces/commit/7233c4438479dff56a682f45209ef7a938d63857)) - -## [@libp2p/interface-compliance-tests-v1.0.7](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-compliance-tests-v1.0.6...@libp2p/interface-compliance-tests-v1.0.7) (2022-01-31) - - -### Trivial Changes - -* **deps:** bump sinon from 12.0.1 to 13.0.0 ([#154](https://github.com/libp2p/js-libp2p-interfaces/issues/154)) ([3fc8812](https://github.com/libp2p/js-libp2p-interfaces/commit/3fc8812897fa197e7b62f77614abaea4a5563404)) - -## [@libp2p/interface-compliance-tests-v1.0.6](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-compliance-tests-v1.0.5...@libp2p/interface-compliance-tests-v1.0.6) (2022-01-29) - - -### Bug Fixes - -* remove extra fields ([#153](https://github.com/libp2p/js-libp2p-interfaces/issues/153)) ([ccd7cf3](https://github.com/libp2p/js-libp2p-interfaces/commit/ccd7cf3f5ac71337baf516d3b0f6fc724ee0d3b4)) - -## [@libp2p/interface-compliance-tests-v1.0.5](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-compliance-tests-v1.0.4...@libp2p/interface-compliance-tests-v1.0.5) (2022-01-15) - - -### Bug Fixes - -* remove abort controller dep ([#151](https://github.com/libp2p/js-libp2p-interfaces/issues/151)) ([518bce1](https://github.com/libp2p/js-libp2p-interfaces/commit/518bce1f9bd1f8b2922338e0c65c9934af7da3af)) - -## [@libp2p/interface-compliance-tests-v1.0.4](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-compliance-tests-v1.0.3...@libp2p/interface-compliance-tests-v1.0.4) (2022-01-15) - - -### Trivial Changes - -* update project config ([#149](https://github.com/libp2p/js-libp2p-interfaces/issues/149)) ([6eb8556](https://github.com/libp2p/js-libp2p-interfaces/commit/6eb85562c0da167d222808da10a7914daf12970b)) - -## [@libp2p/interface-compliance-tests-v1.0.3](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-compliance-tests-v1.0.2...@libp2p/interface-compliance-tests-v1.0.3) (2022-01-14) - - -### Bug Fixes - -* update it-* deps to ts versions ([#148](https://github.com/libp2p/js-libp2p-interfaces/issues/148)) ([7a6fdd7](https://github.com/libp2p/js-libp2p-interfaces/commit/7a6fdd7622ce2870b89dbb849ab421d0dd714b43)) - -## [@libp2p/interface-compliance-tests-v1.0.2](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-compliance-tests-v1.0.1...@libp2p/interface-compliance-tests-v1.0.2) (2022-01-08) - - -### Trivial Changes - -* add semantic release config ([#141](https://github.com/libp2p/js-libp2p-interfaces/issues/141)) ([5f0de59](https://github.com/libp2p/js-libp2p-interfaces/commit/5f0de59136b6343d2411abb2d6a4dd2cd0b7efe4)) -* update package versions ([#140](https://github.com/libp2p/js-libp2p-interfaces/issues/140)) ([cd844f6](https://github.com/libp2p/js-libp2p-interfaces/commit/cd844f6e39f4ee50d006e86eac8dadf696900eb5)) - -# Change Log - -All notable changes to this project will be documented in this file. -See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -# 0.2.0 (2022-01-04) - - -### Features - -* add auto-publish ([7aede5d](https://github.com/libp2p/js-libp2p-interfaces/commit/7aede5df39ea6b5f243348ec9a212b3e33c16a81)) -* update package names ([#133](https://github.com/libp2p/js-libp2p-interfaces/issues/133)) ([337adc9](https://github.com/libp2p/js-libp2p-interfaces/commit/337adc9a9bc0278bdae8cbce9c57d07a83c8b5c2)) - - - - - -## [3.1.1](https://github.com/libp2p/js-libp2p-interfaces/compare/libp2p-interfaces-compliance-tests@3.1.0...libp2p-interfaces-compliance-tests@3.1.1) (2022-01-02) - - -### Bug Fixes - -* move errors ([#132](https://github.com/libp2p/js-libp2p-interfaces/issues/132)) ([21d282a](https://github.com/libp2p/js-libp2p-interfaces/commit/21d282a6d77bd7d1a12daa1cc8b3a3fed8635dad)) - - - - - -# [3.1.0](https://github.com/libp2p/js-libp2p-interfaces/compare/libp2p-interfaces-compliance-tests@3.0.0...libp2p-interfaces-compliance-tests@3.1.0) (2022-01-02) - - -### Bug Fixes - -* update dialer tests ([#116](https://github.com/libp2p/js-libp2p-interfaces/issues/116)) ([c679729](https://github.com/libp2p/js-libp2p-interfaces/commit/c679729113feb963ff27815fcafd7af51f722df7)) - - -### Features - -* simpler peer id ([#117](https://github.com/libp2p/js-libp2p-interfaces/issues/117)) ([fa2c4f5](https://github.com/libp2p/js-libp2p-interfaces/commit/fa2c4f5be74a5cfc11489771881e57b4e53bf174)) - - - - - -# [3.0.0](https://github.com/libp2p/js-libp2p-interfaces/compare/libp2p-interfaces-compliance-tests@2.0.0...libp2p-interfaces-compliance-tests@3.0.0) (2021-12-02) - - -### chore - -* update libp2p-crypto and peer-id ([c711e8b](https://github.com/libp2p/js-libp2p-interfaces/commit/c711e8bd4d606f6974b13fad2eeb723f93cebb87)) - - -### BREAKING CHANGES - -* requires node 15+ - - - - - -# [2.0.0](https://github.com/libp2p/js-libp2p-interfaces/compare/libp2p-interfaces-compliance-tests@1.1.2...libp2p-interfaces-compliance-tests@2.0.0) (2021-11-22) - - -### Features - -* split out code, convert to typescript ([#111](https://github.com/libp2p/js-libp2p-interfaces/issues/111)) ([e174bba](https://github.com/libp2p/js-libp2p-interfaces/commit/e174bba889388269b806643c79a6b53c8d6a0f8c)), closes [#110](https://github.com/libp2p/js-libp2p-interfaces/issues/110) [#101](https://github.com/libp2p/js-libp2p-interfaces/issues/101) - - -### BREAKING CHANGES - -* not all fields from concrete classes have been added to the interfaces, some adjustment may be necessary as this gets rolled out - - - - - -## [1.1.2](https://github.com/libp2p/js-libp2p-interfaces/compare/libp2p-interfaces-compliance-tests@1.1.1...libp2p-interfaces-compliance-tests@1.1.2) (2021-10-18) - -**Note:** Version bump only for package libp2p-interfaces-compliance-tests - - - - - -## [1.1.1](https://github.com/libp2p/js-libp2p-interfaces/compare/libp2p-interfaces-compliance-tests@1.1.0...libp2p-interfaces-compliance-tests@1.1.1) (2021-09-20) - -**Note:** Version bump only for package libp2p-interfaces-compliance-tests - - - - - -# [1.1.0](https://github.com/libp2p/js-libp2p-interfaces/compare/libp2p-interfaces-compliance-tests@1.0.1...libp2p-interfaces-compliance-tests@1.1.0) (2021-08-20) - - -### Features - -* update uint8arrays ([#105](https://github.com/libp2p/js-libp2p-interfaces/issues/105)) ([9297a9c](https://github.com/libp2p/js-libp2p-interfaces/commit/9297a9c379276d03c8da849af6108b38e581b4a6)) - - - - - -## [1.0.1](https://github.com/libp2p/js-libp2p-interfaces/compare/libp2p-interfaces-compliance-tests@1.0.0...libp2p-interfaces-compliance-tests@1.0.1) (2021-07-08) - - -### Bug Fixes - -* make tests more reliable ([#103](https://github.com/libp2p/js-libp2p-interfaces/issues/103)) ([cd4c409](https://github.com/libp2p/js-libp2p-interfaces/commit/cd4c40908efe2e9ffc14aa61aace5176a43fd70a)) -* remove timeouts ([#104](https://github.com/libp2p/js-libp2p-interfaces/issues/104)) ([3699c17](https://github.com/libp2p/js-libp2p-interfaces/commit/3699c17f022da40a87ab24adc3b2081df7a0ddcd)) - - - - - -# 1.0.0 (2021-07-07) - - -### chore - -* monorepo separating interfaces and compliance tests ([#97](https://github.com/libp2p/js-libp2p-interfaces/issues/97)) ([946348f](https://github.com/libp2p/js-libp2p-interfaces/commit/946348f7f8acc1ff7bc9cd0ab4c2602d41106f76)) - - -### BREAKING CHANGES - -* the tests now live in the libp2p-interfaces-compliance-tests module diff --git a/packages/interface-mocks/LICENSE b/packages/interface-mocks/LICENSE deleted file mode 100644 index 20ce483c86..0000000000 --- a/packages/interface-mocks/LICENSE +++ /dev/null @@ -1,4 +0,0 @@ -This project is dual licensed under MIT and Apache-2.0. - -MIT: https://www.opensource.org/licenses/mit -Apache-2.0: https://www.apache.org/licenses/license-2.0 diff --git a/packages/interface-mocks/LICENSE-APACHE b/packages/interface-mocks/LICENSE-APACHE deleted file mode 100644 index 14478a3b60..0000000000 --- a/packages/interface-mocks/LICENSE-APACHE +++ /dev/null @@ -1,5 +0,0 @@ -Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - -http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. diff --git a/packages/interface-mocks/LICENSE-MIT b/packages/interface-mocks/LICENSE-MIT deleted file mode 100644 index 72dc60d84b..0000000000 --- a/packages/interface-mocks/LICENSE-MIT +++ /dev/null @@ -1,19 +0,0 @@ -The MIT License (MIT) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/packages/interface-mocks/README.md b/packages/interface-mocks/README.md deleted file mode 100644 index cc10c20cb2..0000000000 --- a/packages/interface-mocks/README.md +++ /dev/null @@ -1,50 +0,0 @@ -# @libp2p/interface-mocks - -[![libp2p.io](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](http://libp2p.io/) -[![Discuss](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg?style=flat-square)](https://discuss.libp2p.io) -[![codecov](https://img.shields.io/codecov/c/github/libp2p/js-libp2p.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p) -[![CI](https://img.shields.io/github/actions/workflow/status/libp2p/js-libp2p/main.yml?branch=master\&style=flat-square)](https://github.com/libp2p/js-libp2p/actions/workflows/main.yml?query=branch%3Amaster) - -> Mock implementations of several libp2p interfaces - -## Table of contents - -- [Install](#install) - - [Browser ` -``` - -## Usage - -Each [interface](../interfaces) has its documentation on how to use the compliance tests and should be used as the source of truth. - -## API Docs - -- - -## License - -Licensed under either of - -- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / ) -- MIT ([LICENSE-MIT](LICENSE-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/packages/interface-mocks/package.json b/packages/interface-mocks/package.json deleted file mode 100644 index 5a19d0d066..0000000000 --- a/packages/interface-mocks/package.json +++ /dev/null @@ -1,95 +0,0 @@ -{ - "name": "@libp2p/interface-mocks", - "version": "12.0.1", - "description": "Mock implementations of several libp2p interfaces", - "license": "Apache-2.0 OR MIT", - "homepage": "https://github.com/libp2p/js-libp2p/tree/master/packages/interface-mocks#readme", - "repository": { - "type": "git", - "url": "git+https://github.com/libp2p/js-libp2p.git" - }, - "bugs": { - "url": "https://github.com/libp2p/js-libp2p/issues" - }, - "keywords": [ - "interface", - "libp2p" - ], - "type": "module", - "types": "./dist/src/index.d.ts", - "files": [ - "src", - "dist", - "!dist/test", - "!**/*.tsbuildinfo" - ], - "exports": { - ".": { - "types": "./dist/src/index.d.ts", - "import": "./dist/src/index.js" - } - }, - "eslintConfig": { - "extends": "ipfs", - "parserOptions": { - "sourceType": "module" - } - }, - "scripts": { - "clean": "aegir clean", - "lint": "aegir lint", - "dep-check": "aegir dep-check", - "build": "aegir build", - "test": "aegir test", - "test:chrome": "aegir test -t browser --cov", - "test:chrome-webworker": "aegir test -t webworker", - "test:firefox": "aegir test -t browser -- --browser firefox", - "test:firefox-webworker": "aegir test -t webworker -- --browser firefox", - "test:node": "aegir test -t node --cov", - "test:electron-main": "aegir test -t electron-main" - }, - "dependencies": { - "@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-libp2p": "^3.0.0", - "@libp2p/interface-metrics": "^4.0.0", - "@libp2p/interface-peer-discovery": "^2.0.0", - "@libp2p/interface-peer-id": "^2.0.0", - "@libp2p/interface-peer-info": "^1.0.0", - "@libp2p/interface-pubsub": "^4.0.0", - "@libp2p/interface-registrar": "^2.0.0", - "@libp2p/interface-stream-muxer": "^4.0.0", - "@libp2p/interface-transport": "^4.0.0", - "@libp2p/interfaces": "^3.0.0", - "@libp2p/logger": "^2.0.0", - "@libp2p/multistream-select": "^3.0.0", - "@libp2p/peer-collections": "^3.0.0", - "@libp2p/peer-id": "^2.0.0", - "@libp2p/peer-id-factory": "^2.0.0", - "@multiformats/multiaddr": "^12.1.3", - "abortable-iterator": "^5.0.1", - "any-signal": "^4.1.1", - "it-handshake": "^4.1.3", - "it-map": "^3.0.2", - "it-ndjson": "^1.0.0", - "it-pair": "^2.0.2", - "it-pipe": "^3.0.1", - "it-pushable": "^3.1.3", - "it-stream-types": "^2.0.1", - "merge-options": "^3.0.4", - "uint8arraylist": "^2.4.3", - "uint8arrays": "^4.0.3" - }, - "devDependencies": { - "@libp2p/interface-connection-compliance-tests": "^2.0.0", - "@libp2p/interface-connection-encrypter-compliance-tests": "^5.0.0", - "@libp2p/interface-peer-discovery-compliance-tests": "^2.0.0", - "@libp2p/interface-stream-muxer-compliance-tests": "^7.0.0", - "aegir": "^39.0.10" - }, - "typedoc": { - "entryPoint": "./src/index.ts" - } -} diff --git a/packages/interface-mocks/tsconfig.json b/packages/interface-mocks/tsconfig.json deleted file mode 100644 index 19360077a1..0000000000 --- a/packages/interface-mocks/tsconfig.json +++ /dev/null @@ -1,81 +0,0 @@ -{ - "extends": "aegir/src/config/tsconfig.aegir.json", - "compilerOptions": { - "outDir": "dist" - }, - "include": [ - "src", - "test" - ], - "references": [ - { - "path": "../interface-connection" - }, - { - "path": "../interface-connection-compliance-tests" - }, - { - "path": "../interface-connection-encrypter" - }, - { - "path": "../interface-connection-encrypter-compliance-tests" - }, - { - "path": "../interface-connection-gater" - }, - { - "path": "../interface-connection-manager" - }, - { - "path": "../interface-libp2p" - }, - { - "path": "../interface-metrics" - }, - { - "path": "../interface-peer-discovery" - }, - { - "path": "../interface-peer-discovery-compliance-tests" - }, - { - "path": "../interface-peer-id" - }, - { - "path": "../interface-peer-info" - }, - { - "path": "../interface-pubsub" - }, - { - "path": "../interface-registrar" - }, - { - "path": "../interface-stream-muxer" - }, - { - "path": "../interface-stream-muxer-compliance-tests" - }, - { - "path": "../interface-transport" - }, - { - "path": "../interfaces" - }, - { - "path": "../logger" - }, - { - "path": "../multistream-select" - }, - { - "path": "../peer-collections" - }, - { - "path": "../peer-id" - }, - { - "path": "../peer-id-factory" - } - ] -} diff --git a/packages/interface-peer-discovery-compliance-tests/CHANGELOG.md b/packages/interface-peer-discovery-compliance-tests/CHANGELOG.md deleted file mode 100644 index 3095d8070c..0000000000 --- a/packages/interface-peer-discovery-compliance-tests/CHANGELOG.md +++ /dev/null @@ -1,90 +0,0 @@ -## [@libp2p/interface-peer-discovery-compliance-tests-v2.0.8](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-peer-discovery-compliance-tests-v2.0.7...@libp2p/interface-peer-discovery-compliance-tests-v2.0.8) (2023-05-04) - - -### Dependencies - -* update sibling dependencies ([45cf513](https://github.com/libp2p/js-libp2p-interfaces/commit/45cf513090d2a069bb6752ad2e231df65c76df36)) - -## [@libp2p/interface-peer-discovery-compliance-tests-v2.0.7](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-peer-discovery-compliance-tests-v2.0.6...@libp2p/interface-peer-discovery-compliance-tests-v2.0.7) (2023-05-04) - - -### Dependencies - -* bump aegir from 38.1.8 to 39.0.5 ([#393](https://github.com/libp2p/js-libp2p-interfaces/issues/393)) ([31f3797](https://github.com/libp2p/js-libp2p-interfaces/commit/31f3797b24f7c23f3f16e9db3a230bd5f7cd5175)) - -## [@libp2p/interface-peer-discovery-compliance-tests-v2.0.6](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-peer-discovery-compliance-tests-v2.0.5...@libp2p/interface-peer-discovery-compliance-tests-v2.0.6) (2023-03-17) - - -### Dependencies - -* update @multiformats/multiaddr to 12.0.0 ([#354](https://github.com/libp2p/js-libp2p-interfaces/issues/354)) ([e0f327b](https://github.com/libp2p/js-libp2p-interfaces/commit/e0f327b5d54e240feabadce21a841629d633ec5e)) - -## [@libp2p/interface-peer-discovery-compliance-tests-v2.0.5](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-peer-discovery-compliance-tests-v2.0.4...@libp2p/interface-peer-discovery-compliance-tests-v2.0.5) (2023-01-18) - - -### Trivial Changes - -* remove lerna ([#330](https://github.com/libp2p/js-libp2p-interfaces/issues/330)) ([6678592](https://github.com/libp2p/js-libp2p-interfaces/commit/6678592dd0cf601a2671852f9d2a0aff5dee2b18)) - - -### Dependencies - -* bump aegir from 37.12.1 to 38.1.0 ([#335](https://github.com/libp2p/js-libp2p-interfaces/issues/335)) ([7368a36](https://github.com/libp2p/js-libp2p-interfaces/commit/7368a363423a08e8fa247dcb76ea13e4cf030d65)) - -## [@libp2p/interface-peer-discovery-compliance-tests-v2.0.4](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-peer-discovery-compliance-tests-v2.0.3...@libp2p/interface-peer-discovery-compliance-tests-v2.0.4) (2023-01-03) - - -### Bug Fixes - -* refactor peer discovery compliance test ([#328](https://github.com/libp2p/js-libp2p-interfaces/issues/328)) ([87b4608](https://github.com/libp2p/js-libp2p-interfaces/commit/87b4608ae4c373c8dd59b1b68a63293fe9e15d69)) - -## [@libp2p/interface-peer-discovery-compliance-tests-v2.0.3](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-peer-discovery-compliance-tests-v2.0.2...@libp2p/interface-peer-discovery-compliance-tests-v2.0.3) (2022-12-16) - - -### Documentation - -* update project config ([#323](https://github.com/libp2p/js-libp2p-interfaces/issues/323)) ([0fc6a08](https://github.com/libp2p/js-libp2p-interfaces/commit/0fc6a08e9cdcefe361fe325281a3a2a03759ff59)) - -## [@libp2p/interface-peer-discovery-compliance-tests-v2.0.2](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-peer-discovery-compliance-tests-v2.0.1...@libp2p/interface-peer-discovery-compliance-tests-v2.0.2) (2022-12-14) - - -### Bug Fixes - -* generate docs for all packages ([#321](https://github.com/libp2p/js-libp2p-interfaces/issues/321)) ([b6f8b32](https://github.com/libp2p/js-libp2p-interfaces/commit/b6f8b32a920c15a28fe021e6050e31aaae89d518)) - -## [@libp2p/interface-peer-discovery-compliance-tests-v2.0.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-peer-discovery-compliance-tests-v2.0.0...@libp2p/interface-peer-discovery-compliance-tests-v2.0.1) (2022-11-05) - - -### Bug Fixes - -* update project config ([#311](https://github.com/libp2p/js-libp2p-interfaces/issues/311)) ([27dd0ce](https://github.com/libp2p/js-libp2p-interfaces/commit/27dd0ce3c249892ac69cbb24ddaf0b9f32385e37)) - -## [@libp2p/interface-peer-discovery-compliance-tests-v2.0.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-peer-discovery-compliance-tests-v1.0.2...@libp2p/interface-peer-discovery-compliance-tests-v2.0.0) (2022-10-12) - - -### ⚠ BREAKING CHANGES - -* modules no longer implement `Initializable` instead switching to constructor injection - -### Bug Fixes - -* remove @libp2p/components ([#301](https://github.com/libp2p/js-libp2p-interfaces/issues/301)) ([1d37dc6](https://github.com/libp2p/js-libp2p-interfaces/commit/1d37dc6d3197838a71895d5769ad8bba6eb38fd3)) - -## [@libp2p/interface-peer-discovery-compliance-tests-v1.0.2](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-peer-discovery-compliance-tests-v1.0.1...@libp2p/interface-peer-discovery-compliance-tests-v1.0.2) (2022-09-21) - - -### Trivial Changes - -* update project config ([#271](https://github.com/libp2p/js-libp2p-interfaces/issues/271)) ([59c0bf5](https://github.com/libp2p/js-libp2p-interfaces/commit/59c0bf5e0b05496fca2e4902632b61bb41fad9e9)) - - -### Dependencies - -* update @multiformats/multiaddr to 11.0.0 ([#288](https://github.com/libp2p/js-libp2p-interfaces/issues/288)) ([57b2ad8](https://github.com/libp2p/js-libp2p-interfaces/commit/57b2ad88edfc7807311143791bc49270b1a81eaf)) - -## [@libp2p/interface-peer-discovery-compliance-tests-v1.0.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-peer-discovery-compliance-tests-v1.0.0...@libp2p/interface-peer-discovery-compliance-tests-v1.0.1) (2022-06-27) - - -### Trivial Changes - -* update deps ([#262](https://github.com/libp2p/js-libp2p-interfaces/issues/262)) ([51edf7d](https://github.com/libp2p/js-libp2p-interfaces/commit/51edf7d9b3765a6f75c915b1483ea345d0133a41)) diff --git a/packages/interface-peer-discovery-compliance-tests/LICENSE b/packages/interface-peer-discovery-compliance-tests/LICENSE deleted file mode 100644 index 20ce483c86..0000000000 --- a/packages/interface-peer-discovery-compliance-tests/LICENSE +++ /dev/null @@ -1,4 +0,0 @@ -This project is dual licensed under MIT and Apache-2.0. - -MIT: https://www.opensource.org/licenses/mit -Apache-2.0: https://www.apache.org/licenses/license-2.0 diff --git a/packages/interface-peer-discovery-compliance-tests/LICENSE-APACHE b/packages/interface-peer-discovery-compliance-tests/LICENSE-APACHE deleted file mode 100644 index 14478a3b60..0000000000 --- a/packages/interface-peer-discovery-compliance-tests/LICENSE-APACHE +++ /dev/null @@ -1,5 +0,0 @@ -Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - -http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. diff --git a/packages/interface-peer-discovery-compliance-tests/LICENSE-MIT b/packages/interface-peer-discovery-compliance-tests/LICENSE-MIT deleted file mode 100644 index 72dc60d84b..0000000000 --- a/packages/interface-peer-discovery-compliance-tests/LICENSE-MIT +++ /dev/null @@ -1,19 +0,0 @@ -The MIT License (MIT) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/packages/interface-peer-discovery-compliance-tests/README.md b/packages/interface-peer-discovery-compliance-tests/README.md deleted file mode 100644 index f83d5b6252..0000000000 --- a/packages/interface-peer-discovery-compliance-tests/README.md +++ /dev/null @@ -1,55 +0,0 @@ -# @libp2p/interface-peer-discovery-compliance-tests - -[![libp2p.io](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](http://libp2p.io/) -[![Discuss](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg?style=flat-square)](https://discuss.libp2p.io) -[![codecov](https://img.shields.io/codecov/c/github/libp2p/js-libp2p.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p) -[![CI](https://img.shields.io/github/actions/workflow/status/libp2p/js-libp2p/main.yml?branch=master\&style=flat-square)](https://github.com/libp2p/js-libp2p/actions/workflows/main.yml?query=branch%3Amaster) - -> Compliance tests for implementations of the libp2p Peer Discovery interface - -## Table of contents - -- [Install](#install) -- [Usage](#usage) -- [API Docs](#api-docs) -- [License](#license) -- [Contribution](#contribution) - -## Install - -```console -$ npm i @libp2p/interface-peer-discovery-compliance-tests -``` - -## Usage - -```js -import tests from '@libp2p/interface-peer-discovery-compliance-tests' - -describe('your peer discovery implementation', () => { - tests({ - // Options should be passed to your implementation - async setup (options) { - return new YourImplementation() - }, - async teardown () { - // cleanup resources created by setup() - } - }) -}) -``` - -## API Docs - -- - -## License - -Licensed under either of - -- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / ) -- MIT ([LICENSE-MIT](LICENSE-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/packages/interface-peer-discovery-compliance-tests/package.json b/packages/interface-peer-discovery-compliance-tests/package.json deleted file mode 100644 index 5c541d6e09..0000000000 --- a/packages/interface-peer-discovery-compliance-tests/package.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "name": "@libp2p/interface-peer-discovery-compliance-tests", - "version": "2.0.8", - "description": "Compliance tests for implementations of the libp2p Peer Discovery interface", - "license": "Apache-2.0 OR MIT", - "homepage": "https://github.com/libp2p/js-libp2p/tree/master/packages/interface-peer-discovery-compliance-tests#readme", - "repository": { - "type": "git", - "url": "git+https://github.com/libp2p/js-libp2p.git" - }, - "bugs": { - "url": "https://github.com/libp2p/js-libp2p/issues" - }, - "keywords": [ - "interface", - "libp2p" - ], - "type": "module", - "types": "./dist/src/index.d.ts", - "files": [ - "src", - "dist", - "!dist/test", - "!**/*.tsbuildinfo" - ], - "exports": { - ".": { - "types": "./dist/src/index.d.ts", - "import": "./dist/src/index.js" - } - }, - "eslintConfig": { - "extends": "ipfs", - "parserOptions": { - "sourceType": "module" - } - }, - "scripts": { - "clean": "aegir clean", - "lint": "aegir lint", - "dep-check": "aegir dep-check", - "build": "aegir build" - }, - "dependencies": { - "@libp2p/interface-compliance-tests": "^3.0.0", - "@libp2p/interface-peer-discovery": "^2.0.0", - "@libp2p/interfaces": "^3.0.0", - "@multiformats/multiaddr": "^12.1.3", - "aegir": "^39.0.5", - "delay": "^6.0.0", - "p-defer": "^4.0.0" - }, - "typedoc": { - "entryPoint": "./src/index.ts" - } -} diff --git a/packages/interface-peer-discovery-compliance-tests/tsconfig.json b/packages/interface-peer-discovery-compliance-tests/tsconfig.json deleted file mode 100644 index faf685538c..0000000000 --- a/packages/interface-peer-discovery-compliance-tests/tsconfig.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "extends": "aegir/src/config/tsconfig.aegir.json", - "compilerOptions": { - "outDir": "dist" - }, - "include": [ - "src", - "test" - ], - "references": [ - { - "path": "../interface-compliance-tests" - }, - { - "path": "../interface-peer-discovery" - }, - { - "path": "../interfaces" - } - ] -} diff --git a/packages/interface-peer-discovery/CHANGELOG.md b/packages/interface-peer-discovery/CHANGELOG.md deleted file mode 100644 index 778f7bfde4..0000000000 --- a/packages/interface-peer-discovery/CHANGELOG.md +++ /dev/null @@ -1,69 +0,0 @@ -## [@libp2p/interface-peer-discovery-v2.0.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-peer-discovery-v1.1.1...@libp2p/interface-peer-discovery-v2.0.0) (2023-05-04) - - -### ⚠ BREAKING CHANGES - -* the `symbol` export is now named `peerDiscovery` and the getter with that name should return an instance of `PeerDiscovery` - -### Features - -* rename peer discovery symbol to peerDiscovery ([#394](https://github.com/libp2p/js-libp2p-interfaces/issues/394)) ([5957c77](https://github.com/libp2p/js-libp2p-interfaces/commit/5957c77718df6e6336ca22386d8c03a045fd1d89)) - -## [@libp2p/interface-peer-discovery-v1.1.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-peer-discovery-v1.1.0...@libp2p/interface-peer-discovery-v1.1.1) (2023-05-04) - - -### Dependencies - -* bump aegir from 38.1.8 to 39.0.5 ([#393](https://github.com/libp2p/js-libp2p-interfaces/issues/393)) ([31f3797](https://github.com/libp2p/js-libp2p-interfaces/commit/31f3797b24f7c23f3f16e9db3a230bd5f7cd5175)) - -## [@libp2p/interface-peer-discovery-v1.1.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-peer-discovery-v1.0.5...@libp2p/interface-peer-discovery-v1.1.0) (2023-04-27) - - -### Features - -* add routing symbols ([#388](https://github.com/libp2p/js-libp2p-interfaces/issues/388)) ([9ee7691](https://github.com/libp2p/js-libp2p-interfaces/commit/9ee76915d2b8298d99557e105c4f71d585e97e7d)) - -## [@libp2p/interface-peer-discovery-v1.0.5](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-peer-discovery-v1.0.4...@libp2p/interface-peer-discovery-v1.0.5) (2023-01-18) - - -### Trivial Changes - -* remove lerna ([#330](https://github.com/libp2p/js-libp2p-interfaces/issues/330)) ([6678592](https://github.com/libp2p/js-libp2p-interfaces/commit/6678592dd0cf601a2671852f9d2a0aff5dee2b18)) - - -### Dependencies - -* bump aegir from 37.12.1 to 38.1.0 ([#335](https://github.com/libp2p/js-libp2p-interfaces/issues/335)) ([7368a36](https://github.com/libp2p/js-libp2p-interfaces/commit/7368a363423a08e8fa247dcb76ea13e4cf030d65)) - -## [@libp2p/interface-peer-discovery-v1.0.4](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-peer-discovery-v1.0.3...@libp2p/interface-peer-discovery-v1.0.4) (2022-12-16) - - -### Documentation - -* update project config ([#323](https://github.com/libp2p/js-libp2p-interfaces/issues/323)) ([0fc6a08](https://github.com/libp2p/js-libp2p-interfaces/commit/0fc6a08e9cdcefe361fe325281a3a2a03759ff59)) - -## [@libp2p/interface-peer-discovery-v1.0.3](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-peer-discovery-v1.0.2...@libp2p/interface-peer-discovery-v1.0.3) (2022-12-14) - - -### Bug Fixes - -* generate docs for all packages ([#321](https://github.com/libp2p/js-libp2p-interfaces/issues/321)) ([b6f8b32](https://github.com/libp2p/js-libp2p-interfaces/commit/b6f8b32a920c15a28fe021e6050e31aaae89d518)) - -## [@libp2p/interface-peer-discovery-v1.0.2](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-peer-discovery-v1.0.1...@libp2p/interface-peer-discovery-v1.0.2) (2022-11-05) - - -### Bug Fixes - -* update project config ([#311](https://github.com/libp2p/js-libp2p-interfaces/issues/311)) ([27dd0ce](https://github.com/libp2p/js-libp2p-interfaces/commit/27dd0ce3c249892ac69cbb24ddaf0b9f32385e37)) - - -### Trivial Changes - -* update project config ([#271](https://github.com/libp2p/js-libp2p-interfaces/issues/271)) ([59c0bf5](https://github.com/libp2p/js-libp2p-interfaces/commit/59c0bf5e0b05496fca2e4902632b61bb41fad9e9)) - -## [@libp2p/interface-peer-discovery-v1.0.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-peer-discovery-v1.0.0...@libp2p/interface-peer-discovery-v1.0.1) (2022-06-27) - - -### Trivial Changes - -* update deps ([#262](https://github.com/libp2p/js-libp2p-interfaces/issues/262)) ([51edf7d](https://github.com/libp2p/js-libp2p-interfaces/commit/51edf7d9b3765a6f75c915b1483ea345d0133a41)) diff --git a/packages/interface-peer-discovery/LICENSE b/packages/interface-peer-discovery/LICENSE deleted file mode 100644 index 20ce483c86..0000000000 --- a/packages/interface-peer-discovery/LICENSE +++ /dev/null @@ -1,4 +0,0 @@ -This project is dual licensed under MIT and Apache-2.0. - -MIT: https://www.opensource.org/licenses/mit -Apache-2.0: https://www.apache.org/licenses/license-2.0 diff --git a/packages/interface-peer-discovery/LICENSE-APACHE b/packages/interface-peer-discovery/LICENSE-APACHE deleted file mode 100644 index 14478a3b60..0000000000 --- a/packages/interface-peer-discovery/LICENSE-APACHE +++ /dev/null @@ -1,5 +0,0 @@ -Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - -http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. diff --git a/packages/interface-peer-discovery/LICENSE-MIT b/packages/interface-peer-discovery/LICENSE-MIT deleted file mode 100644 index 72dc60d84b..0000000000 --- a/packages/interface-peer-discovery/LICENSE-MIT +++ /dev/null @@ -1,19 +0,0 @@ -The MIT License (MIT) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/packages/interface-peer-discovery/README.md b/packages/interface-peer-discovery/README.md deleted file mode 100644 index 81f38ac7fd..0000000000 --- a/packages/interface-peer-discovery/README.md +++ /dev/null @@ -1,118 +0,0 @@ -# @libp2p/interface-peer-discovery - -[![libp2p.io](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](http://libp2p.io/) -[![Discuss](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg?style=flat-square)](https://discuss.libp2p.io) -[![codecov](https://img.shields.io/codecov/c/github/libp2p/js-libp2p.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p) -[![CI](https://img.shields.io/github/actions/workflow/status/libp2p/js-libp2p/main.yml?branch=master\&style=flat-square)](https://github.com/libp2p/js-libp2p/actions/workflows/main.yml?query=branch%3Amaster) - -> Peer Discovery interface for libp2p - -## Table of contents - -- [Install](#install) -- [Modules that implement the interface](#modules-that-implement-the-interface) -- [Badge](#badge) -- [Usage](#usage) - - [Node.js](#nodejs) -- [API](#api) - - [`start` the service](#start-the-service) - - [`stop` the service](#stop-the-service) - - [discovering peers](#discovering-peers) -- [API Docs](#api-docs) -- [License](#license) -- [Contribution](#contribution) - -## Install - -```console -$ npm i @libp2p/interface-peer-discovery -``` - -The primary goal of this module is to enable developers to pick and/or swap their Peer Discovery modules as they see fit for their application, without having to go through shims or compatibility issues. This module and test suite was heavily inspired by [abstract-blob-store](https://github.com/maxogden/abstract-blob-store). - -Publishing a test suite as a module lets multiple modules all ensure compatibility since they use the same test suite. - -The API is presented with both Node.js and Go primitives, however, there is not actual limitations for it to be extended for any other language, pushing forward the cross compatibility and interop through different stacks. - -## Modules that implement the interface - -- [JavaScript libp2p-mdns](https://github.com/libp2p/js-libp2p-mdns) -- [JavaScript libp2p-bootstrap](https://github.com/libp2p/js-libp2p-bootstrap) -- [JavaScript libp2p-kad-dht](https://github.com/libp2p/js-libp2p-kad-dht) -- [JavaScript libp2p-webrtc-star](https://github.com/libp2p/js-libp2p-webrtc-star) -- [JavaScript libp2p-websocket-star](https://github.com/libp2p/js-libp2p-websocket-star) -- [TypeScript discv5](https://github.com/chainsafe/discv5) - -Send a PR to add a new one if you happen to find or write one. - -## Badge - -Include this badge in your readme if you make a new module that uses interface-peer-discovery API. - -![](img/badge.png) - -## Usage - -### Node.js - -Install `interface-discovery` as one of the dependencies of your project and as a test file. Then, using `mocha` (for JavaScript) or a test runner with compatible API, do: - -```js -const tests = require('libp2p-interfaces-compliance-tests/peer-discovery') - -describe('your discovery', () => { - // use all of the test suits - tests({ - setup () { - return YourDiscovery - }, - teardown () { - // Clean up any resources created by setup() - } - }) -}) -``` - -## API - -A valid (read: that follows this abstraction) Peer Discovery module must implement the following API: - -### `start` the service - -- `await discovery.start()` - -Start the discovery service. - -It returns a `Promise` - -### `stop` the service - -- `await discovery.stop()` - -Stop the discovery service. - -It returns a `Promise` - -### discovering peers - -- `discovery.on('peer', (peerData) => {})` - -Every time a peer is discovered by a discovery service, it emits a `peer` event with the discovered peer's information, which must contain the following properties: - -- `<`[`PeerId`](https://github.com/libp2p/js-peer-id)`>` `peerData.id` -- `>` `peerData.multiaddrs` - -## API Docs - -- - -## License - -Licensed under either of - -- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / ) -- MIT ([LICENSE-MIT](LICENSE-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/packages/interface-peer-discovery/img/badge.png b/packages/interface-peer-discovery/img/badge.png deleted file mode 100644 index 785abc493c..0000000000 Binary files a/packages/interface-peer-discovery/img/badge.png and /dev/null differ diff --git a/packages/interface-peer-discovery/img/badge.sketch b/packages/interface-peer-discovery/img/badge.sketch deleted file mode 100644 index 51a982d06d..0000000000 Binary files a/packages/interface-peer-discovery/img/badge.sketch and /dev/null differ diff --git a/packages/interface-peer-discovery/img/badge.svg b/packages/interface-peer-discovery/img/badge.svg deleted file mode 100644 index 8ecfc6dee3..0000000000 --- a/packages/interface-peer-discovery/img/badge.svg +++ /dev/null @@ -1,39 +0,0 @@ - - - - badge - Created with Sketch. - - - - - - - - - - - - Peer Discovery - - - Compatibl - e - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/packages/interface-peer-discovery/package.json b/packages/interface-peer-discovery/package.json deleted file mode 100644 index 28f2e12c49..0000000000 --- a/packages/interface-peer-discovery/package.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "name": "@libp2p/interface-peer-discovery", - "version": "2.0.0", - "description": "Peer Discovery interface for libp2p", - "license": "Apache-2.0 OR MIT", - "homepage": "https://github.com/libp2p/js-libp2p/tree/master/packages/interface-peer-discovery#readme", - "repository": { - "type": "git", - "url": "git+https://github.com/libp2p/js-libp2p.git" - }, - "bugs": { - "url": "https://github.com/libp2p/js-libp2p/issues" - }, - "keywords": [ - "interface", - "libp2p" - ], - "type": "module", - "types": "./dist/src/index.d.ts", - "files": [ - "src", - "dist", - "!dist/test", - "!**/*.tsbuildinfo" - ], - "exports": { - ".": { - "types": "./dist/src/index.d.ts", - "import": "./dist/src/index.js" - } - }, - "eslintConfig": { - "extends": "ipfs", - "parserOptions": { - "sourceType": "module" - } - }, - "scripts": { - "clean": "aegir clean", - "lint": "aegir lint", - "dep-check": "aegir dep-check", - "build": "aegir build" - }, - "dependencies": { - "@libp2p/interface-peer-info": "^1.0.0", - "@libp2p/interfaces": "^3.0.0" - }, - "devDependencies": { - "aegir": "^39.0.10" - }, - "typedoc": { - "entryPoint": "./src/index.ts" - } -} diff --git a/packages/interface-peer-discovery/tsconfig.json b/packages/interface-peer-discovery/tsconfig.json deleted file mode 100644 index 84bbd0ffe3..0000000000 --- a/packages/interface-peer-discovery/tsconfig.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "extends": "aegir/src/config/tsconfig.aegir.json", - "compilerOptions": { - "outDir": "dist" - }, - "include": [ - "src" - ], - "references": [ - { - "path": "../interface-peer-info" - }, - { - "path": "../interfaces" - } - ] -} diff --git a/packages/interface-peer-id/CHANGELOG.md b/packages/interface-peer-id/CHANGELOG.md deleted file mode 100644 index 268e8ca277..0000000000 --- a/packages/interface-peer-id/CHANGELOG.md +++ /dev/null @@ -1,108 +0,0 @@ -## [@libp2p/interface-peer-id-v2.0.2](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-peer-id-v2.0.1...@libp2p/interface-peer-id-v2.0.2) (2023-05-04) - - -### Dependencies - -* bump aegir from 38.1.8 to 39.0.5 ([#393](https://github.com/libp2p/js-libp2p-interfaces/issues/393)) ([31f3797](https://github.com/libp2p/js-libp2p-interfaces/commit/31f3797b24f7c23f3f16e9db3a230bd5f7cd5175)) - -## [@libp2p/interface-peer-id-v2.0.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-peer-id-v2.0.0...@libp2p/interface-peer-id-v2.0.1) (2023-01-18) - - -### Trivial Changes - -* remove lerna ([#330](https://github.com/libp2p/js-libp2p-interfaces/issues/330)) ([6678592](https://github.com/libp2p/js-libp2p-interfaces/commit/6678592dd0cf601a2671852f9d2a0aff5dee2b18)) - - -### Dependencies - -* bump aegir from 37.12.1 to 38.1.0 ([#335](https://github.com/libp2p/js-libp2p-interfaces/issues/335)) ([7368a36](https://github.com/libp2p/js-libp2p-interfaces/commit/7368a363423a08e8fa247dcb76ea13e4cf030d65)) - -## [@libp2p/interface-peer-id-v2.0.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-peer-id-v1.1.2...@libp2p/interface-peer-id-v2.0.0) (2023-01-06) - - -### ⚠ BREAKING CHANGES - -* bump multiformats from 10.0.3 to 11.0.0 (#329) - -### Dependencies - -* bump multiformats from 10.0.3 to 11.0.0 ([#329](https://github.com/libp2p/js-libp2p-interfaces/issues/329)) ([ba3a98b](https://github.com/libp2p/js-libp2p-interfaces/commit/ba3a98be61e3cf0996fefbd3004e974bb41ad2f0)) - -## [@libp2p/interface-peer-id-v1.1.2](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-peer-id-v1.1.1...@libp2p/interface-peer-id-v1.1.2) (2022-12-16) - - -### Documentation - -* update project config ([#323](https://github.com/libp2p/js-libp2p-interfaces/issues/323)) ([0fc6a08](https://github.com/libp2p/js-libp2p-interfaces/commit/0fc6a08e9cdcefe361fe325281a3a2a03759ff59)) - -## [@libp2p/interface-peer-id-v1.1.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-peer-id-v1.1.0...@libp2p/interface-peer-id-v1.1.1) (2022-12-14) - - -### Bug Fixes - -* generate docs for all packages ([#321](https://github.com/libp2p/js-libp2p-interfaces/issues/321)) ([b6f8b32](https://github.com/libp2p/js-libp2p-interfaces/commit/b6f8b32a920c15a28fe021e6050e31aaae89d518)) - -## [@libp2p/interface-peer-id-v1.1.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-peer-id-v1.0.6...@libp2p/interface-peer-id-v1.1.0) (2022-12-07) - - -### Features - -* expose supported peer id types ([#318](https://github.com/libp2p/js-libp2p-interfaces/issues/318)) ([1197484](https://github.com/libp2p/js-libp2p-interfaces/commit/11974843445a7f4792192340c0697d40bf87fddc)) - -## [@libp2p/interface-peer-id-v1.0.6](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-peer-id-v1.0.5...@libp2p/interface-peer-id-v1.0.6) (2022-11-05) - - -### Bug Fixes - -* update project config ([#311](https://github.com/libp2p/js-libp2p-interfaces/issues/311)) ([27dd0ce](https://github.com/libp2p/js-libp2p-interfaces/commit/27dd0ce3c249892ac69cbb24ddaf0b9f32385e37)) - -## [@libp2p/interface-peer-id-v1.0.5](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-peer-id-v1.0.4...@libp2p/interface-peer-id-v1.0.5) (2022-10-12) - - -### Trivial Changes - -* update project config ([#271](https://github.com/libp2p/js-libp2p-interfaces/issues/271)) ([59c0bf5](https://github.com/libp2p/js-libp2p-interfaces/commit/59c0bf5e0b05496fca2e4902632b61bb41fad9e9)) - - -### Dependencies - -* bump multiformats from 9.9.0 to 10.0.0 ([#302](https://github.com/libp2p/js-libp2p-interfaces/issues/302)) ([fe11d69](https://github.com/libp2p/js-libp2p-interfaces/commit/fe11d69b6aca3dd6ef6053bec27b534ec9908aa1)) - -## [@libp2p/interface-peer-id-v1.0.4](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-peer-id-v1.0.3...@libp2p/interface-peer-id-v1.0.4) (2022-06-27) - - -### Trivial Changes - -* update `peer-id` link to new implementation ([#261](https://github.com/libp2p/js-libp2p-interfaces/issues/261)) ([a2dda7d](https://github.com/libp2p/js-libp2p-interfaces/commit/a2dda7d0cfa33737ebc6bb4ae56de5b55e951c63)) - -## [@libp2p/interface-peer-id-v1.0.3](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-peer-id-v1.0.2...@libp2p/interface-peer-id-v1.0.3) (2022-06-27) - - -### Trivial Changes - -* update deps ([#262](https://github.com/libp2p/js-libp2p-interfaces/issues/262)) ([51edf7d](https://github.com/libp2p/js-libp2p-interfaces/commit/51edf7d9b3765a6f75c915b1483ea345d0133a41)) - -## [@libp2p/interface-peer-id-v1.0.2](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-peer-id-v1.0.1...@libp2p/interface-peer-id-v1.0.2) (2022-06-14) - - -### Trivial Changes - -* update aegir ([#234](https://github.com/libp2p/js-libp2p-interfaces/issues/234)) ([3e03895](https://github.com/libp2p/js-libp2p-interfaces/commit/3e038959ecab6cfa3585df9ee179c0af7a61eda5)) - -## [@libp2p/interface-peer-id-v1.0.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-peer-id-v1.0.0...@libp2p/interface-peer-id-v1.0.1) (2022-06-14) - - -### Trivial Changes - -* update readmes ([#233](https://github.com/libp2p/js-libp2p-interfaces/issues/233)) ([ee7da38](https://github.com/libp2p/js-libp2p-interfaces/commit/ee7da38dccc08160d26c8436df8739ce7e0b340e)) - -## @libp2p/interface-peer-id-v1.0.0 (2022-06-14) - - -### ⚠ BREAKING CHANGES - -* most modules have been split out of the `@libp2p/interfaces` and `@libp2p/interface-compliance-tests` packages - -### Trivial Changes - -* break modules apart ([#232](https://github.com/libp2p/js-libp2p-interfaces/issues/232)) ([385614e](https://github.com/libp2p/js-libp2p-interfaces/commit/385614e772329052ab17415c8bd421f65b01a61b)), closes [#226](https://github.com/libp2p/js-libp2p-interfaces/issues/226) diff --git a/packages/interface-peer-id/LICENSE b/packages/interface-peer-id/LICENSE deleted file mode 100644 index 20ce483c86..0000000000 --- a/packages/interface-peer-id/LICENSE +++ /dev/null @@ -1,4 +0,0 @@ -This project is dual licensed under MIT and Apache-2.0. - -MIT: https://www.opensource.org/licenses/mit -Apache-2.0: https://www.apache.org/licenses/license-2.0 diff --git a/packages/interface-peer-id/LICENSE-APACHE b/packages/interface-peer-id/LICENSE-APACHE deleted file mode 100644 index 14478a3b60..0000000000 --- a/packages/interface-peer-id/LICENSE-APACHE +++ /dev/null @@ -1,5 +0,0 @@ -Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - -http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. diff --git a/packages/interface-peer-id/LICENSE-MIT b/packages/interface-peer-id/LICENSE-MIT deleted file mode 100644 index 72dc60d84b..0000000000 --- a/packages/interface-peer-id/LICENSE-MIT +++ /dev/null @@ -1,19 +0,0 @@ -The MIT License (MIT) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/packages/interface-peer-id/README.md b/packages/interface-peer-id/README.md deleted file mode 100644 index 0904e02cc4..0000000000 --- a/packages/interface-peer-id/README.md +++ /dev/null @@ -1,80 +0,0 @@ -# @libp2p/interface-peer-id - -[![libp2p.io](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](http://libp2p.io/) -[![Discuss](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg?style=flat-square)](https://discuss.libp2p.io) -[![codecov](https://img.shields.io/codecov/c/github/libp2p/js-libp2p.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p) -[![CI](https://img.shields.io/github/actions/workflow/status/libp2p/js-libp2p/main.yml?branch=master\&style=flat-square)](https://github.com/libp2p/js-libp2p/actions/workflows/main.yml?query=branch%3Amaster) - -> Peer Identifier interface for libp2p - -## Table of contents - -- [Install](#install) -- [Modules that implement the interface](#modules-that-implement-the-interface) -- [Badge](#badge) -- [Usage](#usage) - - [Node.js](#nodejs) -- [API Docs](#api-docs) -- [License](#license) -- [Contribution](#contribution) - -## Install - -```console -$ npm i @libp2p/interface-peer-id -``` - -The primary goal of this module is to enable developers to implement PeerId modules. This module and test suite was heavily inspired by earlier implementation of [PeerId](https://github.com/libp2p/js-peer-id). - -Publishing a test suite as a module lets multiple modules all ensure compatibility since they use the same test suite. - -The API is presented with both Node.js and Go primitives, however, there is not actual limitations for it to be extended for any other language, pushing forward the cross compatibility and interop through different stacks. - -## Modules that implement the interface - -- [JavaScript libp2p-peer-id](https://github.com/libp2p/js-libp2p-peer-id) - -Send a PR to add a new one if you happen to find or write one. - -## Badge - -Include this badge in your readme if you make a new module that uses interface-peer-id API. - -![](/img/badge.png) - -## Usage - -### Node.js - -Install `libp2p-interfaces-compliance-tests` as one of the development dependencies of your project and as a test file. Then, using `mocha` (for JavaScript) or a test runner with compatible API, do: - -```js -const tests = require('libp2p-interfaces-compliance-tests/peer-id') - -describe('your peer id', () => { - // use all of the test suits - tests({ - setup () { - return YourPeerIdFactory - }, - teardown () { - // Clean up any resources created by setup() - } - }) -}) -``` - -## API Docs - -- - -## License - -Licensed under either of - -- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / ) -- MIT ([LICENSE-MIT](LICENSE-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/packages/interface-peer-id/package.json b/packages/interface-peer-id/package.json deleted file mode 100644 index 748a8c67c1..0000000000 --- a/packages/interface-peer-id/package.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "name": "@libp2p/interface-peer-id", - "version": "2.0.2", - "description": "Peer Identifier interface for libp2p", - "license": "Apache-2.0 OR MIT", - "homepage": "https://github.com/libp2p/js-libp2p/tree/master/packages/interface-peer-id#readme", - "repository": { - "type": "git", - "url": "git+https://github.com/libp2p/js-libp2p.git" - }, - "bugs": { - "url": "https://github.com/libp2p/js-libp2p/issues" - }, - "keywords": [ - "interface", - "libp2p" - ], - "type": "module", - "types": "./dist/src/index.d.ts", - "files": [ - "src", - "dist", - "!dist/test", - "!**/*.tsbuildinfo" - ], - "exports": { - ".": { - "types": "./dist/src/index.d.ts", - "import": "./dist/src/index.js" - } - }, - "eslintConfig": { - "extends": "ipfs", - "parserOptions": { - "sourceType": "module" - } - }, - "scripts": { - "clean": "aegir clean", - "lint": "aegir lint", - "dep-check": "aegir dep-check", - "build": "aegir build" - }, - "dependencies": { - "multiformats": "^11.0.2" - }, - "devDependencies": { - "aegir": "^39.0.10" - }, - "typedoc": { - "entryPoint": "./src/index.ts" - } -} diff --git a/packages/interface-peer-id/tsconfig.json b/packages/interface-peer-id/tsconfig.json deleted file mode 100644 index 5fe8ea40d7..0000000000 --- a/packages/interface-peer-id/tsconfig.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "aegir/src/config/tsconfig.aegir.json", - "compilerOptions": { - "outDir": "dist" - }, - "include": [ - "src" - ] -} diff --git a/packages/interface-peer-info/CHANGELOG.md b/packages/interface-peer-info/CHANGELOG.md deleted file mode 100644 index e4ac0e783d..0000000000 --- a/packages/interface-peer-info/CHANGELOG.md +++ /dev/null @@ -1,91 +0,0 @@ -## [@libp2p/interface-peer-info-v1.0.10](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-peer-info-v1.0.9...@libp2p/interface-peer-info-v1.0.10) (2023-05-04) - - -### Dependencies - -* bump aegir from 38.1.8 to 39.0.5 ([#393](https://github.com/libp2p/js-libp2p-interfaces/issues/393)) ([31f3797](https://github.com/libp2p/js-libp2p-interfaces/commit/31f3797b24f7c23f3f16e9db3a230bd5f7cd5175)) - -## [@libp2p/interface-peer-info-v1.0.9](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-peer-info-v1.0.8...@libp2p/interface-peer-info-v1.0.9) (2023-03-17) - - -### Dependencies - -* update @multiformats/multiaddr to 12.0.0 ([#354](https://github.com/libp2p/js-libp2p-interfaces/issues/354)) ([e0f327b](https://github.com/libp2p/js-libp2p-interfaces/commit/e0f327b5d54e240feabadce21a841629d633ec5e)) - -## [@libp2p/interface-peer-info-v1.0.8](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-peer-info-v1.0.7...@libp2p/interface-peer-info-v1.0.8) (2023-01-18) - - -### Trivial Changes - -* remove lerna ([#330](https://github.com/libp2p/js-libp2p-interfaces/issues/330)) ([6678592](https://github.com/libp2p/js-libp2p-interfaces/commit/6678592dd0cf601a2671852f9d2a0aff5dee2b18)) - - -### Dependencies - -* bump aegir from 37.12.1 to 38.1.0 ([#335](https://github.com/libp2p/js-libp2p-interfaces/issues/335)) ([7368a36](https://github.com/libp2p/js-libp2p-interfaces/commit/7368a363423a08e8fa247dcb76ea13e4cf030d65)) - -## [@libp2p/interface-peer-info-v1.0.7](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-peer-info-v1.0.6...@libp2p/interface-peer-info-v1.0.7) (2023-01-06) - - -### Dependencies - -* update sibling dependencies ([b50e621](https://github.com/libp2p/js-libp2p-interfaces/commit/b50e621d31a8b32affc3fadb9f97c4883d577f93)) - -## [@libp2p/interface-peer-info-v1.0.6](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-peer-info-v1.0.5...@libp2p/interface-peer-info-v1.0.6) (2022-12-16) - - -### Documentation - -* update project config ([#323](https://github.com/libp2p/js-libp2p-interfaces/issues/323)) ([0fc6a08](https://github.com/libp2p/js-libp2p-interfaces/commit/0fc6a08e9cdcefe361fe325281a3a2a03759ff59)) - -## [@libp2p/interface-peer-info-v1.0.5](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-peer-info-v1.0.4...@libp2p/interface-peer-info-v1.0.5) (2022-12-14) - - -### Bug Fixes - -* generate docs for all packages ([#321](https://github.com/libp2p/js-libp2p-interfaces/issues/321)) ([b6f8b32](https://github.com/libp2p/js-libp2p-interfaces/commit/b6f8b32a920c15a28fe021e6050e31aaae89d518)) - -## [@libp2p/interface-peer-info-v1.0.4](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-peer-info-v1.0.3...@libp2p/interface-peer-info-v1.0.4) (2022-11-05) - - -### Bug Fixes - -* update project config ([#311](https://github.com/libp2p/js-libp2p-interfaces/issues/311)) ([27dd0ce](https://github.com/libp2p/js-libp2p-interfaces/commit/27dd0ce3c249892ac69cbb24ddaf0b9f32385e37)) - -## [@libp2p/interface-peer-info-v1.0.3](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-peer-info-v1.0.2...@libp2p/interface-peer-info-v1.0.3) (2022-09-21) - - -### Trivial Changes - -* update project config ([#271](https://github.com/libp2p/js-libp2p-interfaces/issues/271)) ([59c0bf5](https://github.com/libp2p/js-libp2p-interfaces/commit/59c0bf5e0b05496fca2e4902632b61bb41fad9e9)) - - -### Dependencies - -* update @multiformats/multiaddr to 11.0.0 ([#288](https://github.com/libp2p/js-libp2p-interfaces/issues/288)) ([57b2ad8](https://github.com/libp2p/js-libp2p-interfaces/commit/57b2ad88edfc7807311143791bc49270b1a81eaf)) - -## [@libp2p/interface-peer-info-v1.0.2](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-peer-info-v1.0.1...@libp2p/interface-peer-info-v1.0.2) (2022-06-27) - - -### Trivial Changes - -* update deps ([#262](https://github.com/libp2p/js-libp2p-interfaces/issues/262)) ([51edf7d](https://github.com/libp2p/js-libp2p-interfaces/commit/51edf7d9b3765a6f75c915b1483ea345d0133a41)) - -## [@libp2p/interface-peer-info-v1.0.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-peer-info-v1.0.0...@libp2p/interface-peer-info-v1.0.1) (2022-06-14) - - -### Trivial Changes - -* update aegir ([#234](https://github.com/libp2p/js-libp2p-interfaces/issues/234)) ([3e03895](https://github.com/libp2p/js-libp2p-interfaces/commit/3e038959ecab6cfa3585df9ee179c0af7a61eda5)) -* update readmes ([#233](https://github.com/libp2p/js-libp2p-interfaces/issues/233)) ([ee7da38](https://github.com/libp2p/js-libp2p-interfaces/commit/ee7da38dccc08160d26c8436df8739ce7e0b340e)) - -## @libp2p/interface-peer-info-v1.0.0 (2022-06-14) - - -### ⚠ BREAKING CHANGES - -* most modules have been split out of the `@libp2p/interfaces` and `@libp2p/interface-compliance-tests` packages - -### Trivial Changes - -* break modules apart ([#232](https://github.com/libp2p/js-libp2p-interfaces/issues/232)) ([385614e](https://github.com/libp2p/js-libp2p-interfaces/commit/385614e772329052ab17415c8bd421f65b01a61b)), closes [#226](https://github.com/libp2p/js-libp2p-interfaces/issues/226) diff --git a/packages/interface-peer-info/LICENSE b/packages/interface-peer-info/LICENSE deleted file mode 100644 index 20ce483c86..0000000000 --- a/packages/interface-peer-info/LICENSE +++ /dev/null @@ -1,4 +0,0 @@ -This project is dual licensed under MIT and Apache-2.0. - -MIT: https://www.opensource.org/licenses/mit -Apache-2.0: https://www.apache.org/licenses/license-2.0 diff --git a/packages/interface-peer-info/LICENSE-APACHE b/packages/interface-peer-info/LICENSE-APACHE deleted file mode 100644 index 14478a3b60..0000000000 --- a/packages/interface-peer-info/LICENSE-APACHE +++ /dev/null @@ -1,5 +0,0 @@ -Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - -http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. diff --git a/packages/interface-peer-info/LICENSE-MIT b/packages/interface-peer-info/LICENSE-MIT deleted file mode 100644 index 72dc60d84b..0000000000 --- a/packages/interface-peer-info/LICENSE-MIT +++ /dev/null @@ -1,19 +0,0 @@ -The MIT License (MIT) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/packages/interface-peer-info/README.md b/packages/interface-peer-info/README.md deleted file mode 100644 index b4590de1c0..0000000000 --- a/packages/interface-peer-info/README.md +++ /dev/null @@ -1,36 +0,0 @@ -# @libp2p/interface-peer-info - -[![libp2p.io](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](http://libp2p.io/) -[![Discuss](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg?style=flat-square)](https://discuss.libp2p.io) -[![codecov](https://img.shields.io/codecov/c/github/libp2p/js-libp2p.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p) -[![CI](https://img.shields.io/github/actions/workflow/status/libp2p/js-libp2p/main.yml?branch=master\&style=flat-square)](https://github.com/libp2p/js-libp2p/actions/workflows/main.yml?query=branch%3Amaster) - -> Peer Info interface for libp2p - -## Table of contents - -- [Install](#install) -- [API Docs](#api-docs) -- [License](#license) -- [Contribution](#contribution) - -## Install - -```console -$ npm i @libp2p/interface-peer-info -``` - -## API Docs - -- - -## License - -Licensed under either of - -- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / ) -- MIT ([LICENSE-MIT](LICENSE-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/packages/interface-peer-info/package.json b/packages/interface-peer-info/package.json deleted file mode 100644 index fcdd888d93..0000000000 --- a/packages/interface-peer-info/package.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "name": "@libp2p/interface-peer-info", - "version": "1.0.10", - "description": "Peer Info interface for libp2p", - "license": "Apache-2.0 OR MIT", - "homepage": "https://github.com/libp2p/js-libp2p/tree/master/packages/interface-peer-info#readme", - "repository": { - "type": "git", - "url": "git+https://github.com/libp2p/js-libp2p.git" - }, - "bugs": { - "url": "https://github.com/libp2p/js-libp2p/issues" - }, - "keywords": [ - "interface", - "libp2p" - ], - "type": "module", - "types": "./dist/src/index.d.ts", - "files": [ - "src", - "dist", - "!dist/test", - "!**/*.tsbuildinfo" - ], - "exports": { - ".": { - "types": "./dist/src/index.d.ts", - "import": "./dist/src/index.js" - } - }, - "eslintConfig": { - "extends": "ipfs", - "parserOptions": { - "sourceType": "module" - } - }, - "scripts": { - "clean": "aegir clean", - "lint": "aegir lint", - "dep-check": "aegir dep-check", - "build": "aegir build" - }, - "dependencies": { - "@libp2p/interface-peer-id": "^2.0.0", - "@multiformats/multiaddr": "^12.1.3" - }, - "devDependencies": { - "aegir": "^39.0.10" - }, - "typedoc": { - "entryPoint": "./src/index.ts" - } -} diff --git a/packages/interface-peer-info/tsconfig.json b/packages/interface-peer-info/tsconfig.json deleted file mode 100644 index d8db0b667f..0000000000 --- a/packages/interface-peer-info/tsconfig.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "extends": "aegir/src/config/tsconfig.aegir.json", - "compilerOptions": { - "outDir": "dist" - }, - "include": [ - "src" - ], - "references": [ - { - "path": "../interface-peer-id" - } - ] -} diff --git a/packages/interface-peer-routing/CHANGELOG.md b/packages/interface-peer-routing/CHANGELOG.md deleted file mode 100644 index a6d8da477d..0000000000 --- a/packages/interface-peer-routing/CHANGELOG.md +++ /dev/null @@ -1,79 +0,0 @@ -## [@libp2p/interface-peer-routing-v1.1.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-peer-routing-v1.1.0...@libp2p/interface-peer-routing-v1.1.1) (2023-05-04) - - -### Dependencies - -* bump aegir from 38.1.8 to 39.0.5 ([#393](https://github.com/libp2p/js-libp2p-interfaces/issues/393)) ([31f3797](https://github.com/libp2p/js-libp2p-interfaces/commit/31f3797b24f7c23f3f16e9db3a230bd5f7cd5175)) - -## [@libp2p/interface-peer-routing-v1.1.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-peer-routing-v1.0.8...@libp2p/interface-peer-routing-v1.1.0) (2023-04-27) - - -### Features - -* add routing symbols ([#388](https://github.com/libp2p/js-libp2p-interfaces/issues/388)) ([9ee7691](https://github.com/libp2p/js-libp2p-interfaces/commit/9ee76915d2b8298d99557e105c4f71d585e97e7d)) - -## [@libp2p/interface-peer-routing-v1.0.8](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-peer-routing-v1.0.7...@libp2p/interface-peer-routing-v1.0.8) (2023-03-09) - - -### Documentation - -* update content/peer routing interface comments ([#346](https://github.com/libp2p/js-libp2p-interfaces/issues/346)) ([8080944](https://github.com/libp2p/js-libp2p-interfaces/commit/8080944d3c3a81834c6b432843441996cd9e34e5)) - -## [@libp2p/interface-peer-routing-v1.0.7](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-peer-routing-v1.0.6...@libp2p/interface-peer-routing-v1.0.7) (2023-01-18) - - -### Trivial Changes - -* remove lerna ([#330](https://github.com/libp2p/js-libp2p-interfaces/issues/330)) ([6678592](https://github.com/libp2p/js-libp2p-interfaces/commit/6678592dd0cf601a2671852f9d2a0aff5dee2b18)) - - -### Dependencies - -* bump aegir from 37.12.1 to 38.1.0 ([#335](https://github.com/libp2p/js-libp2p-interfaces/issues/335)) ([7368a36](https://github.com/libp2p/js-libp2p-interfaces/commit/7368a363423a08e8fa247dcb76ea13e4cf030d65)) - -## [@libp2p/interface-peer-routing-v1.0.6](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-peer-routing-v1.0.5...@libp2p/interface-peer-routing-v1.0.6) (2023-01-06) - - -### Dependencies - -* update sibling dependencies ([b50e621](https://github.com/libp2p/js-libp2p-interfaces/commit/b50e621d31a8b32affc3fadb9f97c4883d577f93)) - -## [@libp2p/interface-peer-routing-v1.0.5](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-peer-routing-v1.0.4...@libp2p/interface-peer-routing-v1.0.5) (2022-12-19) - - -### Documentation - -* add interface docs ([#324](https://github.com/libp2p/js-libp2p-interfaces/issues/324)) ([2789445](https://github.com/libp2p/js-libp2p-interfaces/commit/278944594c24e1a3c4b3624a35680d69166546d7)) - -## [@libp2p/interface-peer-routing-v1.0.4](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-peer-routing-v1.0.3...@libp2p/interface-peer-routing-v1.0.4) (2022-12-16) - - -### Documentation - -* update project config ([#323](https://github.com/libp2p/js-libp2p-interfaces/issues/323)) ([0fc6a08](https://github.com/libp2p/js-libp2p-interfaces/commit/0fc6a08e9cdcefe361fe325281a3a2a03759ff59)) - -## [@libp2p/interface-peer-routing-v1.0.3](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-peer-routing-v1.0.2...@libp2p/interface-peer-routing-v1.0.3) (2022-12-14) - - -### Bug Fixes - -* generate docs for all packages ([#321](https://github.com/libp2p/js-libp2p-interfaces/issues/321)) ([b6f8b32](https://github.com/libp2p/js-libp2p-interfaces/commit/b6f8b32a920c15a28fe021e6050e31aaae89d518)) - -## [@libp2p/interface-peer-routing-v1.0.2](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-peer-routing-v1.0.1...@libp2p/interface-peer-routing-v1.0.2) (2022-11-05) - - -### Bug Fixes - -* update project config ([#311](https://github.com/libp2p/js-libp2p-interfaces/issues/311)) ([27dd0ce](https://github.com/libp2p/js-libp2p-interfaces/commit/27dd0ce3c249892ac69cbb24ddaf0b9f32385e37)) - - -### Trivial Changes - -* update project config ([#271](https://github.com/libp2p/js-libp2p-interfaces/issues/271)) ([59c0bf5](https://github.com/libp2p/js-libp2p-interfaces/commit/59c0bf5e0b05496fca2e4902632b61bb41fad9e9)) - -## [@libp2p/interface-peer-routing-v1.0.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-peer-routing-v1.0.0...@libp2p/interface-peer-routing-v1.0.1) (2022-06-27) - - -### Trivial Changes - -* update deps ([#262](https://github.com/libp2p/js-libp2p-interfaces/issues/262)) ([51edf7d](https://github.com/libp2p/js-libp2p-interfaces/commit/51edf7d9b3765a6f75c915b1483ea345d0133a41)) diff --git a/packages/interface-peer-routing/LICENSE b/packages/interface-peer-routing/LICENSE deleted file mode 100644 index 20ce483c86..0000000000 --- a/packages/interface-peer-routing/LICENSE +++ /dev/null @@ -1,4 +0,0 @@ -This project is dual licensed under MIT and Apache-2.0. - -MIT: https://www.opensource.org/licenses/mit -Apache-2.0: https://www.apache.org/licenses/license-2.0 diff --git a/packages/interface-peer-routing/LICENSE-APACHE b/packages/interface-peer-routing/LICENSE-APACHE deleted file mode 100644 index 14478a3b60..0000000000 --- a/packages/interface-peer-routing/LICENSE-APACHE +++ /dev/null @@ -1,5 +0,0 @@ -Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - -http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. diff --git a/packages/interface-peer-routing/LICENSE-MIT b/packages/interface-peer-routing/LICENSE-MIT deleted file mode 100644 index 72dc60d84b..0000000000 --- a/packages/interface-peer-routing/LICENSE-MIT +++ /dev/null @@ -1,19 +0,0 @@ -The MIT License (MIT) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/packages/interface-peer-routing/README.md b/packages/interface-peer-routing/README.md deleted file mode 100644 index 29c71520d3..0000000000 --- a/packages/interface-peer-routing/README.md +++ /dev/null @@ -1,83 +0,0 @@ -# @libp2p/interface-peer-routing - -[![libp2p.io](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](http://libp2p.io/) -[![Discuss](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg?style=flat-square)](https://discuss.libp2p.io) -[![codecov](https://img.shields.io/codecov/c/github/libp2p/js-libp2p.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p) -[![CI](https://img.shields.io/github/actions/workflow/status/libp2p/js-libp2p/main.yml?branch=master\&style=flat-square)](https://github.com/libp2p/js-libp2p/actions/workflows/main.yml?query=branch%3Amaster) - -> Peer Routing interface for libp2p - -## Table of contents - -- - [Install](#install) -- [Modules that implement the interface](#modules-that-implement-the-interface) -- [Badge](#badge) -- [How to use the battery of tests](#how-to-use-the-battery-of-tests) - - [Node.js](#nodejs) -- [API](#api) - - - [findPeer](#findpeer) - - [API Docs](#api-docs) - - [License](#license) - - [Contribution](#contribution) - -## Install - -```console -$ npm i @libp2p/interface-peer-routing -``` - -The primary goal of this module is to enable developers to pick and swap their Peer Routing module as they see fit for their libp2p installation, without having to go through shims or compatibility issues. This module and test suite were heavily inspired by abstract-blob-store and interface-stream-muxer. - -Publishing a test suite as a module lets multiple modules all ensure compatibility since they use the same test suite. - -# Modules that implement the interface - -- [JavaScript libp2p-kad-dht](https://github.com/libp2p/js-libp2p-kad-dht) -- [JavaScript libp2p-delegated-peer-routing](https://github.com/libp2p/js-libp2p-delegated-peer-routing) - -# Badge - -Include this badge in your readme if you make a module that is compatible with the interface-record-store API. You can validate this by running the tests. - -![](img/badge.png) - -# How to use the battery of tests - -## Node.js - -TBD - -# API - -A valid (read: that follows this abstraction) Peer Routing module must implement the following API. - -### findPeer - -- `findPeer(peerId)` - -Query the network for all multiaddresses associated with a `PeerId`. - -**Parameters** - -- [peerId](https://github.com/libp2p/js-peer-id). - -**Returns** - -It returns the [peerId](https://github.com/libp2p/js-peer-id) together with the known peers [multiaddrs](https://github.com/multiformats/js-multiaddr), as follows: - -`Promise<{ id: PeerId, multiaddrs: Multiaddr[] }>` - -## API Docs - -- - -## License - -Licensed under either of - -- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / ) -- MIT ([LICENSE-MIT](LICENSE-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/packages/interface-peer-routing/img/badge.png b/packages/interface-peer-routing/img/badge.png deleted file mode 100644 index 44127db9ee..0000000000 Binary files a/packages/interface-peer-routing/img/badge.png and /dev/null differ diff --git a/packages/interface-peer-routing/img/badge.sketch b/packages/interface-peer-routing/img/badge.sketch deleted file mode 100644 index 614a374496..0000000000 Binary files a/packages/interface-peer-routing/img/badge.sketch and /dev/null differ diff --git a/packages/interface-peer-routing/img/badge.svg b/packages/interface-peer-routing/img/badge.svg deleted file mode 100644 index f3c41b0470..0000000000 --- a/packages/interface-peer-routing/img/badge.svg +++ /dev/null @@ -1,19 +0,0 @@ - - - - badge - Created with Sketch. - - - - - Peer Routin - g - - - Compatibl - e - - - - \ No newline at end of file diff --git a/packages/interface-peer-routing/package.json b/packages/interface-peer-routing/package.json deleted file mode 100644 index 5bb055b234..0000000000 --- a/packages/interface-peer-routing/package.json +++ /dev/null @@ -1,55 +0,0 @@ -{ - "name": "@libp2p/interface-peer-routing", - "version": "1.1.1", - "description": "Peer Routing interface for libp2p", - "license": "Apache-2.0 OR MIT", - "homepage": "https://github.com/libp2p/js-libp2p/tree/master/packages/interface-peer-routing#readme", - "repository": { - "type": "git", - "url": "git+https://github.com/libp2p/js-libp2p.git" - }, - "bugs": { - "url": "https://github.com/libp2p/js-libp2p/issues" - }, - "keywords": [ - "interface", - "libp2p" - ], - "type": "module", - "types": "./dist/src/index.d.ts", - "files": [ - "src", - "dist", - "!dist/test", - "!**/*.tsbuildinfo" - ], - "exports": { - ".": { - "types": "./dist/src/index.d.ts", - "import": "./dist/src/index.js" - } - }, - "eslintConfig": { - "extends": "ipfs", - "parserOptions": { - "sourceType": "module" - } - }, - "scripts": { - "clean": "aegir clean", - "lint": "aegir lint", - "dep-check": "aegir dep-check", - "build": "aegir build" - }, - "dependencies": { - "@libp2p/interface-peer-id": "^2.0.0", - "@libp2p/interface-peer-info": "^1.0.0", - "@libp2p/interfaces": "^3.0.0" - }, - "devDependencies": { - "aegir": "^39.0.10" - }, - "typedoc": { - "entryPoint": "./src/index.ts" - } -} diff --git a/packages/interface-peer-routing/tsconfig.json b/packages/interface-peer-routing/tsconfig.json deleted file mode 100644 index 02d375dbd5..0000000000 --- a/packages/interface-peer-routing/tsconfig.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "extends": "aegir/src/config/tsconfig.aegir.json", - "compilerOptions": { - "outDir": "dist" - }, - "include": [ - "src" - ], - "references": [ - { - "path": "../interface-peer-id" - }, - { - "path": "../interface-peer-info" - }, - { - "path": "../interfaces" - } - ] -} diff --git a/packages/interface-peer-store/CHANGELOG.md b/packages/interface-peer-store/CHANGELOG.md deleted file mode 100644 index d9858e5e11..0000000000 --- a/packages/interface-peer-store/CHANGELOG.md +++ /dev/null @@ -1,136 +0,0 @@ -## [@libp2p/interface-peer-store-v2.0.4](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-peer-store-v2.0.3...@libp2p/interface-peer-store-v2.0.4) (2023-06-11) - - -### Bug Fixes - -* add peer store query interfaces ([#412](https://github.com/libp2p/js-libp2p-interfaces/issues/412)) ([0247215](https://github.com/libp2p/js-libp2p-interfaces/commit/0247215b8132096884af22499d8a6828281861d0)) - -## [@libp2p/interface-peer-store-v2.0.3](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-peer-store-v2.0.2...@libp2p/interface-peer-store-v2.0.3) (2023-05-10) - - -### Bug Fixes - -* expose peerstore consume peer record method ([#398](https://github.com/libp2p/js-libp2p-interfaces/issues/398)) ([80222b8](https://github.com/libp2p/js-libp2p-interfaces/commit/80222b8474396aaa070fb44d859965ab14080f48)) - - -### Trivial Changes - -* correct the peerStore.save doc ([#397](https://github.com/libp2p/js-libp2p-interfaces/issues/397)) ([6998722](https://github.com/libp2p/js-libp2p-interfaces/commit/69987220a1038318d3798260af517873a30c838f)) - -## [@libp2p/interface-peer-store-v2.0.2](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-peer-store-v2.0.1...@libp2p/interface-peer-store-v2.0.2) (2023-05-04) - - -### Dependencies - -* bump aegir from 38.1.8 to 39.0.5 ([#393](https://github.com/libp2p/js-libp2p-interfaces/issues/393)) ([31f3797](https://github.com/libp2p/js-libp2p-interfaces/commit/31f3797b24f7c23f3f16e9db3a230bd5f7cd5175)) - -## [@libp2p/interface-peer-store-v2.0.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-peer-store-v2.0.0...@libp2p/interface-peer-store-v2.0.1) (2023-04-24) - - -### Bug Fixes - -* allow deleting tags/metadata with undefined fields ([#384](https://github.com/libp2p/js-libp2p-interfaces/issues/384)) ([64598ec](https://github.com/libp2p/js-libp2p-interfaces/commit/64598ec27495d4de5c05b573fd2f3f902166b596)) - -## [@libp2p/interface-peer-store-v2.0.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-peer-store-v1.2.9...@libp2p/interface-peer-store-v2.0.0) (2023-04-21) - - -### ⚠ BREAKING CHANGES - -* make peer store methods atomic (#368) - -### Bug Fixes - -* make peer store methods atomic ([#368](https://github.com/libp2p/js-libp2p-interfaces/issues/368)) ([47c8b78](https://github.com/libp2p/js-libp2p-interfaces/commit/47c8b78e72fbbf9548d88a5fe0df965444254708)) - -## [@libp2p/interface-peer-store-v1.2.9](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-peer-store-v1.2.8...@libp2p/interface-peer-store-v1.2.9) (2023-03-17) - - -### Dependencies - -* update @multiformats/multiaddr to 12.0.0 ([#354](https://github.com/libp2p/js-libp2p-interfaces/issues/354)) ([e0f327b](https://github.com/libp2p/js-libp2p-interfaces/commit/e0f327b5d54e240feabadce21a841629d633ec5e)) - -## [@libp2p/interface-peer-store-v1.2.8](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-peer-store-v1.2.7...@libp2p/interface-peer-store-v1.2.8) (2023-01-18) - - -### Trivial Changes - -* remove lerna ([#330](https://github.com/libp2p/js-libp2p-interfaces/issues/330)) ([6678592](https://github.com/libp2p/js-libp2p-interfaces/commit/6678592dd0cf601a2671852f9d2a0aff5dee2b18)) - - -### Dependencies - -* bump aegir from 37.12.1 to 38.1.0 ([#335](https://github.com/libp2p/js-libp2p-interfaces/issues/335)) ([7368a36](https://github.com/libp2p/js-libp2p-interfaces/commit/7368a363423a08e8fa247dcb76ea13e4cf030d65)) - -## [@libp2p/interface-peer-store-v1.2.7](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-peer-store-v1.2.6...@libp2p/interface-peer-store-v1.2.7) (2023-01-06) - - -### Dependencies - -* update sibling dependencies ([b50e621](https://github.com/libp2p/js-libp2p-interfaces/commit/b50e621d31a8b32affc3fadb9f97c4883d577f93)) - -## [@libp2p/interface-peer-store-v1.2.6](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-peer-store-v1.2.5...@libp2p/interface-peer-store-v1.2.6) (2022-12-19) - - -### Documentation - -* add interface docs ([#324](https://github.com/libp2p/js-libp2p-interfaces/issues/324)) ([2789445](https://github.com/libp2p/js-libp2p-interfaces/commit/278944594c24e1a3c4b3624a35680d69166546d7)) - -## [@libp2p/interface-peer-store-v1.2.5](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-peer-store-v1.2.4...@libp2p/interface-peer-store-v1.2.5) (2022-12-16) - - -### Documentation - -* update project config ([#323](https://github.com/libp2p/js-libp2p-interfaces/issues/323)) ([0fc6a08](https://github.com/libp2p/js-libp2p-interfaces/commit/0fc6a08e9cdcefe361fe325281a3a2a03759ff59)) - -## [@libp2p/interface-peer-store-v1.2.4](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-peer-store-v1.2.3...@libp2p/interface-peer-store-v1.2.4) (2022-12-14) - - -### Bug Fixes - -* generate docs for all packages ([#321](https://github.com/libp2p/js-libp2p-interfaces/issues/321)) ([b6f8b32](https://github.com/libp2p/js-libp2p-interfaces/commit/b6f8b32a920c15a28fe021e6050e31aaae89d518)) - -## [@libp2p/interface-peer-store-v1.2.3](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-peer-store-v1.2.2...@libp2p/interface-peer-store-v1.2.3) (2022-11-05) - - -### Bug Fixes - -* update project config ([#311](https://github.com/libp2p/js-libp2p-interfaces/issues/311)) ([27dd0ce](https://github.com/libp2p/js-libp2p-interfaces/commit/27dd0ce3c249892ac69cbb24ddaf0b9f32385e37)) - -## [@libp2p/interface-peer-store-v1.2.2](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-peer-store-v1.2.1...@libp2p/interface-peer-store-v1.2.2) (2022-09-21) - - -### Dependencies - -* update @multiformats/multiaddr to 11.0.0 ([#289](https://github.com/libp2p/js-libp2p-interfaces/issues/289)) ([81daf98](https://github.com/libp2p/js-libp2p-interfaces/commit/81daf9803a952cc8241c0956272b7f5625088636)) - -## [@libp2p/interface-peer-store-v1.2.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-peer-store-v1.2.0...@libp2p/interface-peer-store-v1.2.1) (2022-08-03) - - -### Bug Fixes - -* update peer store interface deps ([#277](https://github.com/libp2p/js-libp2p-interfaces/issues/277)) ([9945e16](https://github.com/libp2p/js-libp2p-interfaces/commit/9945e16f1653f22ad190be19fc6038378ae6d0d2)) - - -### Trivial Changes - -* update project config ([#271](https://github.com/libp2p/js-libp2p-interfaces/issues/271)) ([59c0bf5](https://github.com/libp2p/js-libp2p-interfaces/commit/59c0bf5e0b05496fca2e4902632b61bb41fad9e9)) -* update sibling dependencies [skip ci] ([39eed35](https://github.com/libp2p/js-libp2p-interfaces/commit/39eed35c17920032ef821eede4d09fe14f8b30ab)) - -## [@libp2p/interface-peer-store-v1.2.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-peer-store-v1.1.0...@libp2p/interface-peer-store-v1.2.0) (2022-06-27) - - -### Features - -* export common tags ([#263](https://github.com/libp2p/js-libp2p-interfaces/issues/263)) ([8ca626e](https://github.com/libp2p/js-libp2p-interfaces/commit/8ca626e0b39f943244bb5ba005b84e2155d471fd)) - -## [@libp2p/interface-peer-store-v1.1.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-peer-store-v1.0.0...@libp2p/interface-peer-store-v1.1.0) (2022-06-24) - - -### Features - -* add peer tagging ([#255](https://github.com/libp2p/js-libp2p-interfaces/issues/255)) ([80dadd9](https://github.com/libp2p/js-libp2p-interfaces/commit/80dadd99dc593ce43141a0072a4697339d01b222)) - - -### Trivial Changes - -* update aegir ([b0bcff9](https://github.com/libp2p/js-libp2p-interfaces/commit/b0bcff92f59aed4bb61dd4b67facc9a077de9ea6)) diff --git a/packages/interface-peer-store/LICENSE b/packages/interface-peer-store/LICENSE deleted file mode 100644 index 20ce483c86..0000000000 --- a/packages/interface-peer-store/LICENSE +++ /dev/null @@ -1,4 +0,0 @@ -This project is dual licensed under MIT and Apache-2.0. - -MIT: https://www.opensource.org/licenses/mit -Apache-2.0: https://www.apache.org/licenses/license-2.0 diff --git a/packages/interface-peer-store/LICENSE-APACHE b/packages/interface-peer-store/LICENSE-APACHE deleted file mode 100644 index 14478a3b60..0000000000 --- a/packages/interface-peer-store/LICENSE-APACHE +++ /dev/null @@ -1,5 +0,0 @@ -Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - -http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. diff --git a/packages/interface-peer-store/LICENSE-MIT b/packages/interface-peer-store/LICENSE-MIT deleted file mode 100644 index 72dc60d84b..0000000000 --- a/packages/interface-peer-store/LICENSE-MIT +++ /dev/null @@ -1,19 +0,0 @@ -The MIT License (MIT) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/packages/interface-peer-store/README.md b/packages/interface-peer-store/README.md deleted file mode 100644 index 177c1b57db..0000000000 --- a/packages/interface-peer-store/README.md +++ /dev/null @@ -1,50 +0,0 @@ -# @libp2p/interface-peer-store - -[![libp2p.io](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](http://libp2p.io/) -[![Discuss](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg?style=flat-square)](https://discuss.libp2p.io) -[![codecov](https://img.shields.io/codecov/c/github/libp2p/js-libp2p.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p) -[![CI](https://img.shields.io/github/actions/workflow/status/libp2p/js-libp2p/main.yml?branch=master\&style=flat-square)](https://github.com/libp2p/js-libp2p/actions/workflows/main.yml?query=branch%3Amaster) - -> Peer Store interface for libp2p - -## Table of contents - -- [Install](#install) -- [Usage](#usage) - - [Tags](#tags) -- [API Docs](#api-docs) -- [License](#license) -- [Contribution](#contribution) - -## Install - -```console -$ npm i @libp2p/interface-peer-store -``` - -## Usage - -### Tags - -Common tags can be imported from the `@libp2p/interface-peer-store/tag` module: - -```js -import { KEEP_ALIVE } from '@libp2p/interface-peer-store/tags' - -await peerStore.tagPeer(peerId, KEEP_ALIVE) -``` - -## API Docs - -- - -## License - -Licensed under either of - -- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / ) -- MIT ([LICENSE-MIT](LICENSE-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/packages/interface-peer-store/package.json b/packages/interface-peer-store/package.json deleted file mode 100644 index d548cfffee..0000000000 --- a/packages/interface-peer-store/package.json +++ /dev/null @@ -1,74 +0,0 @@ -{ - "name": "@libp2p/interface-peer-store", - "version": "2.0.4", - "description": "Peer Store interface for libp2p", - "license": "Apache-2.0 OR MIT", - "homepage": "https://github.com/libp2p/js-libp2p/tree/master/packages/interface-peer-store#readme", - "repository": { - "type": "git", - "url": "git+https://github.com/libp2p/js-libp2p.git" - }, - "bugs": { - "url": "https://github.com/libp2p/js-libp2p/issues" - }, - "keywords": [ - "interface", - "libp2p" - ], - "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" - }, - "./tags": { - "types": "./dist/src/tags.d.ts", - "import": "./dist/src/tags.js" - } - }, - "eslintConfig": { - "extends": "ipfs", - "parserOptions": { - "sourceType": "module" - } - }, - "scripts": { - "clean": "aegir clean", - "lint": "aegir lint", - "dep-check": "aegir dep-check", - "build": "aegir build" - }, - "dependencies": { - "@libp2p/interface-peer-id": "^2.0.0", - "@multiformats/multiaddr": "^12.1.3" - }, - "devDependencies": { - "aegir": "^39.0.10" - }, - "typedoc": { - "entryPoint": "./src/index.ts" - } -} diff --git a/packages/interface-peer-store/tsconfig.json b/packages/interface-peer-store/tsconfig.json deleted file mode 100644 index d8db0b667f..0000000000 --- a/packages/interface-peer-store/tsconfig.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "extends": "aegir/src/config/tsconfig.aegir.json", - "compilerOptions": { - "outDir": "dist" - }, - "include": [ - "src" - ], - "references": [ - { - "path": "../interface-peer-id" - } - ] -} diff --git a/packages/interface-pubsub-compliance-tests/CHANGELOG.md b/packages/interface-pubsub-compliance-tests/CHANGELOG.md deleted file mode 100644 index 7b3fea4d5f..0000000000 --- a/packages/interface-pubsub-compliance-tests/CHANGELOG.md +++ /dev/null @@ -1,232 +0,0 @@ -## [@libp2p/interface-pubsub-compliance-tests-v5.0.7](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-pubsub-compliance-tests-v5.0.6...@libp2p/interface-pubsub-compliance-tests-v5.0.7) (2023-05-04) - - -### Dependencies - -* update sibling dependencies ([eae5fe0](https://github.com/libp2p/js-libp2p-interfaces/commit/eae5fe02ea11c2930242a8d91ee4bc22f9bebc5c)) - -### [5.0.8](https://www.github.com/libp2p/js-libp2p/compare/interface-pubsub-compliance-tests-v5.0.7...interface-pubsub-compliance-tests-v5.0.8) (2023-06-15) - - -### Bug Fixes - -* add events bus to pubsub compliance tests ([#1824](https://www.github.com/libp2p/js-libp2p/issues/1824)) ([883082c](https://www.github.com/libp2p/js-libp2p/commit/883082ca284b346cd5c232236356773d97b78d8b)) - -## [@libp2p/interface-pubsub-compliance-tests-v5.0.6](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-pubsub-compliance-tests-v5.0.5...@libp2p/interface-pubsub-compliance-tests-v5.0.6) (2023-05-04) - - -### Dependencies - -* bump aegir from 38.1.8 to 39.0.5 ([#393](https://github.com/libp2p/js-libp2p-interfaces/issues/393)) ([31f3797](https://github.com/libp2p/js-libp2p-interfaces/commit/31f3797b24f7c23f3f16e9db3a230bd5f7cd5175)) - -## [@libp2p/interface-pubsub-compliance-tests-v5.0.5](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-pubsub-compliance-tests-v5.0.4...@libp2p/interface-pubsub-compliance-tests-v5.0.5) (2023-04-21) - - -### Dependencies - -* update sibling dependencies ([74f82d5](https://github.com/libp2p/js-libp2p-interfaces/commit/74f82d53fc89740f4bafa22721a59ab70c3c92a8)) -* update sibling dependencies ([6c18790](https://github.com/libp2p/js-libp2p-interfaces/commit/6c18790f6178053c69a8cd6bd289fd749d4e9633)) - -## [@libp2p/interface-pubsub-compliance-tests-v5.0.4](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-pubsub-compliance-tests-v5.0.3...@libp2p/interface-pubsub-compliance-tests-v5.0.4) (2023-04-18) - - -### Dependencies - -* update sibling dependencies ([294d970](https://github.com/libp2p/js-libp2p-interfaces/commit/294d970d6e4fbbf6a3f0944394c4c8dea06d1265)) -* update sibling dependencies ([3d23367](https://github.com/libp2p/js-libp2p-interfaces/commit/3d233676a17299bfa1b59d309543598176826523)) - -## [@libp2p/interface-pubsub-compliance-tests-v5.0.3](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-pubsub-compliance-tests-v5.0.2...@libp2p/interface-pubsub-compliance-tests-v5.0.3) (2023-04-14) - - -### Dependencies - -* update sibling dependencies ([34b1627](https://github.com/libp2p/js-libp2p-interfaces/commit/34b1627458b2ada5e94e00cf4bcba41a77232090)) - -## [@libp2p/interface-pubsub-compliance-tests-v5.0.2](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-pubsub-compliance-tests-v5.0.1...@libp2p/interface-pubsub-compliance-tests-v5.0.2) (2023-03-10) - - -### Bug Fixes - -* reject promise with error not string ([#350](https://github.com/libp2p/js-libp2p-interfaces/issues/350)) ([9435da9](https://github.com/libp2p/js-libp2p-interfaces/commit/9435da9a4015757b7945fdd55d142c4bd1950c59)) - -## [@libp2p/interface-pubsub-compliance-tests-v5.0.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-pubsub-compliance-tests-v5.0.0...@libp2p/interface-pubsub-compliance-tests-v5.0.1) (2023-01-18) - - -### Trivial Changes - -* remove lerna ([#330](https://github.com/libp2p/js-libp2p-interfaces/issues/330)) ([6678592](https://github.com/libp2p/js-libp2p-interfaces/commit/6678592dd0cf601a2671852f9d2a0aff5dee2b18)) - - -### Dependencies - -* bump aegir from 37.12.1 to 38.1.0 ([#335](https://github.com/libp2p/js-libp2p-interfaces/issues/335)) ([7368a36](https://github.com/libp2p/js-libp2p-interfaces/commit/7368a363423a08e8fa247dcb76ea13e4cf030d65)) - -## [@libp2p/interface-pubsub-compliance-tests-v5.0.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-pubsub-compliance-tests-v4.0.4...@libp2p/interface-pubsub-compliance-tests-v5.0.0) (2023-01-06) - - -### ⚠ BREAKING CHANGES - -* update peer-id dep to pull in new multiformats (#331) - -### Bug Fixes - -* update peer-id dep to pull in new multiformats ([#331](https://github.com/libp2p/js-libp2p-interfaces/issues/331)) ([fb8b7ba](https://github.com/libp2p/js-libp2p-interfaces/commit/fb8b7ba654a30a08da0652e2833e36dd3bb85e90)) - - -### Dependencies - -* update sibling dependencies ([1442ad3](https://github.com/libp2p/js-libp2p-interfaces/commit/1442ad37e44f886a423e7a09e53e0b1796327fde)) - -## [@libp2p/interface-pubsub-compliance-tests-v4.0.4](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-pubsub-compliance-tests-v4.0.3...@libp2p/interface-pubsub-compliance-tests-v4.0.4) (2023-01-06) - - -### Dependencies - -* update sibling dependencies ([b50e621](https://github.com/libp2p/js-libp2p-interfaces/commit/b50e621d31a8b32affc3fadb9f97c4883d577f93)) - -## [@libp2p/interface-pubsub-compliance-tests-v4.0.3](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-pubsub-compliance-tests-v4.0.2...@libp2p/interface-pubsub-compliance-tests-v4.0.3) (2022-12-16) - - -### Documentation - -* update project config ([#323](https://github.com/libp2p/js-libp2p-interfaces/issues/323)) ([0fc6a08](https://github.com/libp2p/js-libp2p-interfaces/commit/0fc6a08e9cdcefe361fe325281a3a2a03759ff59)) - -## [@libp2p/interface-pubsub-compliance-tests-v4.0.2](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-pubsub-compliance-tests-v4.0.1...@libp2p/interface-pubsub-compliance-tests-v4.0.2) (2022-12-14) - - -### Bug Fixes - -* generate docs for all packages ([#321](https://github.com/libp2p/js-libp2p-interfaces/issues/321)) ([b6f8b32](https://github.com/libp2p/js-libp2p-interfaces/commit/b6f8b32a920c15a28fe021e6050e31aaae89d518)) - - -### Dependencies - -* bump sinon from 14.0.2 to 15.0.0 ([#316](https://github.com/libp2p/js-libp2p-interfaces/issues/316)) ([d37721c](https://github.com/libp2p/js-libp2p-interfaces/commit/d37721c9143cd3eeafb5f8249b07d9f2fbce0f54)) - -## [@libp2p/interface-pubsub-compliance-tests-v4.0.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-pubsub-compliance-tests-v4.0.0...@libp2p/interface-pubsub-compliance-tests-v4.0.1) (2022-11-05) - - -### Bug Fixes - -* update project config ([#311](https://github.com/libp2p/js-libp2p-interfaces/issues/311)) ([27dd0ce](https://github.com/libp2p/js-libp2p-interfaces/commit/27dd0ce3c249892ac69cbb24ddaf0b9f32385e37)) - - -### Dependencies - -* update sibling dependencies ([45af2ca](https://github.com/libp2p/js-libp2p-interfaces/commit/45af2cadd55ad58d0c5ee2d11a0b8a39f6300454)) - -## [@libp2p/interface-pubsub-compliance-tests-v4.0.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-pubsub-compliance-tests-v3.0.0...@libp2p/interface-pubsub-compliance-tests-v4.0.0) (2022-10-12) - - -### ⚠ BREAKING CHANGES - -* modules no longer implement `Initializable` instead switching to constructor injection - -### Bug Fixes - -* export network components type ([79a5d8f](https://github.com/libp2p/js-libp2p-interfaces/commit/79a5d8fc57ae47274ff9ad9c3969c5898f07eb1d)) -* remove @libp2p/components ([#301](https://github.com/libp2p/js-libp2p-interfaces/issues/301)) ([1d37dc6](https://github.com/libp2p/js-libp2p-interfaces/commit/1d37dc6d3197838a71895d5769ad8bba6eb38fd3)) -* update mock network components use ([c760e95](https://github.com/libp2p/js-libp2p-interfaces/commit/c760e95f07b6199f08adb20c1e3a4265649fdda0)) - - -### Dependencies - -* update sibling dependencies ([d3226f7](https://github.com/libp2p/js-libp2p-interfaces/commit/d3226f7383de85cae2b4771c22eea22c4bb5bbeb)) - -## [@libp2p/interface-pubsub-compliance-tests-v3.0.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-pubsub-compliance-tests-v2.0.5...@libp2p/interface-pubsub-compliance-tests-v3.0.0) (2022-10-11) - - -### ⚠ BREAKING CHANGES - -* add topicValidators to pubsub interface (#298) - -### Bug Fixes - -* add topicValidators to pubsub interface ([#298](https://github.com/libp2p/js-libp2p-interfaces/issues/298)) ([e5ff819](https://github.com/libp2p/js-libp2p-interfaces/commit/e5ff819c6dd235b2ea9ea5133457b384c4411cf3)) - - -### Dependencies - -* update sibling dependencies ([8f3680e](https://github.com/libp2p/js-libp2p-interfaces/commit/8f3680e2d87e424936dfe7128b859795f0327d9a)) - -## [@libp2p/interface-pubsub-compliance-tests-v2.0.5](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-pubsub-compliance-tests-v2.0.4...@libp2p/interface-pubsub-compliance-tests-v2.0.5) (2022-10-07) - - -### Dependencies - -* bump @libp2p/components from 2.1.1 to 3.0.0 ([#299](https://github.com/libp2p/js-libp2p-interfaces/issues/299)) ([b3f493c](https://github.com/libp2p/js-libp2p-interfaces/commit/b3f493c5e260f697f66de54b56379d036ca3db59)) - -## [@libp2p/interface-pubsub-compliance-tests-v2.0.4](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-pubsub-compliance-tests-v2.0.3...@libp2p/interface-pubsub-compliance-tests-v2.0.4) (2022-10-06) - - -### Dependencies - -* update sibling dependencies ([2f46d7f](https://github.com/libp2p/js-libp2p-interfaces/commit/2f46d7ff4189c29a63bac93b0b5b73de0a75922f)) - -## [@libp2p/interface-pubsub-compliance-tests-v2.0.3](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-pubsub-compliance-tests-v2.0.2...@libp2p/interface-pubsub-compliance-tests-v2.0.3) (2022-10-04) - - -### Dependencies - -* update sibling dependencies ([1b11e8e](https://github.com/libp2p/js-libp2p-interfaces/commit/1b11e8e9cc2ea1d4d26233f9c11a57e185ea23ed)) - -## [@libp2p/interface-pubsub-compliance-tests-v2.0.2](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-pubsub-compliance-tests-v2.0.1...@libp2p/interface-pubsub-compliance-tests-v2.0.2) (2022-08-10) - - -### Dependencies - -* update sibling dependencies ([fc4c49c](https://github.com/libp2p/js-libp2p-interfaces/commit/fc4c49c22334b9f2059b08e13ba94f3e8938482e)) - -## [@libp2p/interface-pubsub-compliance-tests-v2.0.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-pubsub-compliance-tests-v2.0.0...@libp2p/interface-pubsub-compliance-tests-v2.0.1) (2022-07-31) - - -### Dependencies - -* update uint8arraylist and p-wait-for deps ([#274](https://github.com/libp2p/js-libp2p-interfaces/issues/274)) ([c55f12e](https://github.com/libp2p/js-libp2p-interfaces/commit/c55f12e47be0a10e41709b0d6a60dd8bc1209ee5)) - -## [@libp2p/interface-pubsub-compliance-tests-v2.0.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-pubsub-compliance-tests-v1.0.4...@libp2p/interface-pubsub-compliance-tests-v2.0.0) (2022-07-31) - - -### ⚠ BREAKING CHANGES - -* The `Message` type is now either a `SignedMessage` -or a `UnsignedMessage` - -### Features - -* pubsub Message types for signature policies ([#266](https://github.com/libp2p/js-libp2p-interfaces/issues/266)) ([9eb710b](https://github.com/libp2p/js-libp2p-interfaces/commit/9eb710bcbdb0aef95c7a8613e00065a3b7c7f887)) - - -### Trivial Changes - -* update project config ([#271](https://github.com/libp2p/js-libp2p-interfaces/issues/271)) ([59c0bf5](https://github.com/libp2p/js-libp2p-interfaces/commit/59c0bf5e0b05496fca2e4902632b61bb41fad9e9)) -* update sibling dependencies [skip ci] ([fbd5281](https://github.com/libp2p/js-libp2p-interfaces/commit/fbd52811b1d074df0755a3ee10c33a99ccc86842)) - -## [@libp2p/interface-pubsub-compliance-tests-v1.0.4](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-pubsub-compliance-tests-v1.0.3...@libp2p/interface-pubsub-compliance-tests-v1.0.4) (2022-06-27) - - -### Trivial Changes - -* update deps ([#262](https://github.com/libp2p/js-libp2p-interfaces/issues/262)) ([51edf7d](https://github.com/libp2p/js-libp2p-interfaces/commit/51edf7d9b3765a6f75c915b1483ea345d0133a41)) - -## [@libp2p/interface-pubsub-compliance-tests-v1.0.3](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-pubsub-compliance-tests-v1.0.2...@libp2p/interface-pubsub-compliance-tests-v1.0.3) (2022-06-24) - - -### Trivial Changes - -* update sibling dependencies [skip ci] ([c5c41c5](https://github.com/libp2p/js-libp2p-interfaces/commit/c5c41c521cf970addc1840d8519cdaa542a0db16)) - -## [@libp2p/interface-pubsub-compliance-tests-v1.0.2](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-pubsub-compliance-tests-v1.0.1...@libp2p/interface-pubsub-compliance-tests-v1.0.2) (2022-06-16) - - -### Trivial Changes - -* update deps ([54fbb37](https://github.com/libp2p/js-libp2p-interfaces/commit/54fbb37c8644a3fd6833c12550a57bf1a9292902)) -* update deps ([970a940](https://github.com/libp2p/js-libp2p-interfaces/commit/970a940a2f65b946936a53febdc52527baefbd34)) - -## [@libp2p/interface-pubsub-compliance-tests-v1.0.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-pubsub-compliance-tests-v1.0.0...@libp2p/interface-pubsub-compliance-tests-v1.0.1) (2022-06-14) - - -### Trivial Changes - -* update components module ([#235](https://github.com/libp2p/js-libp2p-interfaces/issues/235)) ([5844207](https://github.com/libp2p/js-libp2p-interfaces/commit/58442070af59aa852c83ec3aecdbd1d2c646b018)) diff --git a/packages/interface-pubsub-compliance-tests/LICENSE b/packages/interface-pubsub-compliance-tests/LICENSE deleted file mode 100644 index 20ce483c86..0000000000 --- a/packages/interface-pubsub-compliance-tests/LICENSE +++ /dev/null @@ -1,4 +0,0 @@ -This project is dual licensed under MIT and Apache-2.0. - -MIT: https://www.opensource.org/licenses/mit -Apache-2.0: https://www.apache.org/licenses/license-2.0 diff --git a/packages/interface-pubsub-compliance-tests/LICENSE-APACHE b/packages/interface-pubsub-compliance-tests/LICENSE-APACHE deleted file mode 100644 index 14478a3b60..0000000000 --- a/packages/interface-pubsub-compliance-tests/LICENSE-APACHE +++ /dev/null @@ -1,5 +0,0 @@ -Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - -http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. diff --git a/packages/interface-pubsub-compliance-tests/LICENSE-MIT b/packages/interface-pubsub-compliance-tests/LICENSE-MIT deleted file mode 100644 index 72dc60d84b..0000000000 --- a/packages/interface-pubsub-compliance-tests/LICENSE-MIT +++ /dev/null @@ -1,19 +0,0 @@ -The MIT License (MIT) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/packages/interface-pubsub-compliance-tests/README.md b/packages/interface-pubsub-compliance-tests/README.md deleted file mode 100644 index b9e1177a04..0000000000 --- a/packages/interface-pubsub-compliance-tests/README.md +++ /dev/null @@ -1,55 +0,0 @@ -# @libp2p/interface-pubsub-compliance-tests - -[![libp2p.io](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](http://libp2p.io/) -[![Discuss](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg?style=flat-square)](https://discuss.libp2p.io) -[![codecov](https://img.shields.io/codecov/c/github/libp2p/js-libp2p.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p) -[![CI](https://img.shields.io/github/actions/workflow/status/libp2p/js-libp2p/main.yml?branch=master\&style=flat-square)](https://github.com/libp2p/js-libp2p/actions/workflows/main.yml?query=branch%3Amaster) - -> Compliance tests for implementations of the libp2p PubSub interface - -## Table of contents - -- [Install](#install) -- [Usage](#usage) -- [API Docs](#api-docs) -- [License](#license) -- [Contribution](#contribution) - -## Install - -```console -$ npm i @libp2p/interface-pubsub-compliance-tests -``` - -## Usage - -```js -import tests from '@libp2p/interface-pubsub-compliance-tests' - -describe('your pubsub implementation', () => { - tests({ - // Options should be passed to your implementation - async setup (options) { - return new YourImplementation() - }, - async teardown () { - // cleanup resources created by setup() - } - }) -}) -``` - -## API Docs - -- - -## License - -Licensed under either of - -- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / ) -- MIT ([LICENSE-MIT](LICENSE-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/packages/interface-pubsub-compliance-tests/package.json b/packages/interface-pubsub-compliance-tests/package.json deleted file mode 100644 index 5fb951a1a3..0000000000 --- a/packages/interface-pubsub-compliance-tests/package.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "name": "@libp2p/interface-pubsub-compliance-tests", - "version": "5.0.9", - "description": "Compliance tests for implementations of the libp2p PubSub interface", - "license": "Apache-2.0 OR MIT", - "homepage": "https://github.com/libp2p/js-libp2p/tree/master/packages/interface-pubsub-compliance-tests#readme", - "repository": { - "type": "git", - "url": "git+https://github.com/libp2p/js-libp2p.git" - }, - "bugs": { - "url": "https://github.com/libp2p/js-libp2p/issues" - }, - "keywords": [ - "interface", - "libp2p" - ], - "type": "module", - "types": "./dist/src/index.d.ts", - "files": [ - "src", - "dist", - "!dist/test", - "!**/*.tsbuildinfo" - ], - "exports": { - ".": { - "types": "./dist/src/index.d.ts", - "import": "./dist/src/index.js" - } - }, - "eslintConfig": { - "extends": "ipfs", - "parserOptions": { - "sourceType": "module" - } - }, - "scripts": { - "clean": "aegir clean", - "lint": "aegir lint", - "dep-check": "aegir dep-check", - "build": "aegir build" - }, - "dependencies": { - "@libp2p/interface-compliance-tests": "^3.0.0", - "@libp2p/interface-connection-manager": "^3.0.0", - "@libp2p/interface-mocks": "^12.0.0", - "@libp2p/interface-peer-id": "^2.0.0", - "@libp2p/interface-pubsub": "^4.0.0", - "@libp2p/interface-registrar": "^2.0.0", - "@libp2p/interfaces": "^3.0.0", - "@libp2p/peer-id-factory": "^2.0.0", - "aegir": "^39.0.5", - "delay": "^6.0.0", - "p-defer": "^4.0.0", - "p-event": "^6.0.0", - "p-wait-for": "^5.0.0", - "sinon": "^15.0.0", - "uint8arrays": "^4.0.3" - }, - "typedoc": { - "entryPoint": "./src/index.ts" - } -} diff --git a/packages/interface-pubsub-compliance-tests/src/api.ts b/packages/interface-pubsub-compliance-tests/src/api.ts deleted file mode 100644 index 00b180f1c0..0000000000 --- a/packages/interface-pubsub-compliance-tests/src/api.ts +++ /dev/null @@ -1,114 +0,0 @@ -import { mockNetwork } from '@libp2p/interface-mocks' -import { isStartable, start, stop } from '@libp2p/interfaces/startable' -import { expect } from 'aegir/chai' -import delay from 'delay' -import pDefer from 'p-defer' -import pWaitFor from 'p-wait-for' -import sinon from 'sinon' -import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' -import { createComponents } from './utils.js' -import type { PubSubArgs, PubSubComponents } from './index.js' -import type { TestSetup } from '@libp2p/interface-compliance-tests' -import type { PubSub } from '@libp2p/interface-pubsub' - -const topic = 'foo' -const data = uint8ArrayFromString('bar') - -export default (common: TestSetup): void => { - describe('pubsub api', () => { - let pubsub: PubSub - let components: PubSubComponents - - // Create pubsub router - beforeEach(async () => { - mockNetwork.reset() - components = await createComponents() - - pubsub = components.pubsub = await common.setup({ - components, - init: { - emitSelf: true - } - }) - }) - - afterEach(async () => { - sinon.restore() - await stop(...Object.values(components)) - await common.teardown() - mockNetwork.reset() - }) - - it('can start correctly', async () => { - if (!isStartable(pubsub)) { - return - } - - sinon.spy(components.registrar, 'register') - - await start(...Object.values(components)) - - expect(pubsub.isStarted()).to.equal(true) - expect(components.registrar.register).to.have.property('callCount', 1) - }) - - it('can stop correctly', async () => { - if (!isStartable(pubsub)) { - return - } - - sinon.spy(components.registrar, 'unregister') - - await start(...Object.values(components)) - await stop(...Object.values(components)) - - expect(pubsub.isStarted()).to.equal(false) - expect(components.registrar.unregister).to.have.property('callCount', 1) - }) - - it('can subscribe and unsubscribe correctly', async () => { - const handler = (): void => { - throw new Error('a message should not be received') - } - - await start(...Object.values(components)) - pubsub.subscribe(topic) - pubsub.addEventListener('message', handler) - - await pWaitFor(() => { - const topics = pubsub.getTopics() - return topics.length === 1 && topics[0] === topic - }) - - pubsub.removeEventListener('message', handler) - pubsub.unsubscribe(topic) - - await pWaitFor(() => pubsub.getTopics().length === 0) - - // Publish to guarantee the handler is not called - await pubsub.publish(topic, data) - - // handlers are called async - await delay(100) - - await stop(...Object.values(components)) - }) - - it('can subscribe and publish correctly', async () => { - const defer = pDefer() - - await start(...Object.values(components)) - - pubsub.subscribe(topic) - pubsub.addEventListener('message', (evt) => { - expect(evt).to.have.nested.property('detail.topic', topic) - expect(evt).to.have.deep.nested.property('detail.data', data) - defer.resolve() - }) - await pubsub.publish(topic, data) - await defer.promise - - await stop(...Object.values(components)) - }) - }) -} diff --git a/packages/interface-pubsub-compliance-tests/src/connection-handlers.ts b/packages/interface-pubsub-compliance-tests/src/connection-handlers.ts deleted file mode 100644 index 24656a0c7f..0000000000 --- a/packages/interface-pubsub-compliance-tests/src/connection-handlers.ts +++ /dev/null @@ -1,413 +0,0 @@ -import { mockNetwork } from '@libp2p/interface-mocks' -import { start, stop } from '@libp2p/interfaces/startable' -import { expect } from 'aegir/chai' -import pDefer from 'p-defer' -import { pEvent } from 'p-event' -import pWaitFor from 'p-wait-for' -import sinon from 'sinon' -import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' -import { toString as uint8ArrayToString } from 'uint8arrays/to-string' -import { createComponents } from './utils.js' -import type { PubSubArgs } from './index.js' -import type { TestSetup } from '@libp2p/interface-compliance-tests' -import type { MockNetworkComponents } from '@libp2p/interface-mocks' -import type { Message, PubSub } from '@libp2p/interface-pubsub' - -export default (common: TestSetup): void => { - describe('pubsub connection handlers', () => { - let psA: PubSub - let psB: PubSub - let componentsA: MockNetworkComponents - let componentsB: MockNetworkComponents - - describe('nodes send state on connection', () => { - // Create pubsub nodes and connect them - beforeEach(async () => { - mockNetwork.reset() - - componentsA = await createComponents() - componentsB = await createComponents() - - psA = componentsA.pubsub = await common.setup({ - components: componentsA, - init: {} - }) - - psB = componentsB.pubsub = await common.setup({ - components: componentsB, - init: {} - }) - - // Start pubsub - await start(...Object.values(componentsA), ...Object.values(componentsB)) - - expect(psA.getPeers()).to.be.empty() - expect(psB.getPeers()).to.be.empty() - - // Make subscriptions prior to nodes connected - psA.subscribe('Za') - psB.subscribe('Zb') - - expect(psA.getPeers()).to.be.empty() - expect(psA.getTopics()).to.deep.equal(['Za']) - expect(psB.getPeers()).to.be.empty() - expect(psB.getTopics()).to.deep.equal(['Zb']) - }) - - afterEach(async () => { - sinon.restore() - await stop(...Object.values(componentsA), ...Object.values(componentsB)) - await common.teardown() - mockNetwork.reset() - }) - - it('existing subscriptions are sent upon peer connection', async function () { - const subscriptionsChanged = Promise.all([ - pEvent(psA, 'subscription-change'), - pEvent(psB, 'subscription-change') - ]) - - await componentsA.connectionManager.openConnection(componentsB.peerId) - - await subscriptionsChanged - - expect(psA.getPeers()).to.have.lengthOf(1) - expect(psB.getPeers()).to.have.lengthOf(1) - - expect(psA.getTopics()).to.deep.equal(['Za']) - expect(psB.getTopics()).to.deep.equal(['Zb']) - - expect(psA.getSubscribers('Zb').map(p => p.toString())).to.deep.equal([componentsB.peerId.toString()]) - expect(psB.getSubscribers('Za').map(p => p.toString())).to.deep.equal([componentsA.peerId.toString()]) - }) - }) - - describe('pubsub started before connect', () => { - let psA: PubSub - let psB: PubSub - let componentsA: MockNetworkComponents - let componentsB: MockNetworkComponents - - // Create pubsub nodes and start them - beforeEach(async () => { - mockNetwork.reset() - componentsA = await createComponents() - componentsB = await createComponents() - - psA = componentsA.pubsub = await common.setup({ - components: componentsA, - init: {} - }) - psB = componentsB.pubsub = await common.setup({ - components: componentsB, - init: {} - }) - - await start(...Object.values(componentsA), ...Object.values(componentsB)) - }) - - afterEach(async () => { - sinon.restore() - await stop(...Object.values(componentsA), ...Object.values(componentsB)) - await common.teardown() - mockNetwork.reset() - }) - - it('should get notified of connected peers on dial', async () => { - await componentsA.connectionManager.openConnection(componentsB.peerId) - - return Promise.all([ - pWaitFor(() => psA.getPeers().length === 1), - pWaitFor(() => psB.getPeers().length === 1) - ]) - }) - - it('should receive pubsub messages', async () => { - const defer = pDefer() - const topic = 'test-topic' - const data = uint8ArrayFromString('hey!') - - await componentsA.connectionManager.openConnection(componentsB.peerId) - - let subscribedTopics = psA.getTopics() - expect(subscribedTopics).to.not.include(topic) - - psA.subscribe(topic) - psA.addEventListener('message', (evt) => { - if (evt.detail.topic === topic) { - const msg = evt.detail - expect(msg.data).to.equalBytes(data) - defer.resolve() - } - }) - psA.subscribe(topic) - - subscribedTopics = psA.getTopics() - expect(subscribedTopics).to.include(topic) - - // wait for psB to know about psA subscription - await pWaitFor(() => { - const subscribedPeers = psB.getSubscribers(topic) - return subscribedPeers.map(p => p.toString()).includes(componentsA.peerId.toString()) // eslint-disable-line max-nested-callbacks - }) - await psB.publish(topic, data) - - await defer.promise - }) - }) - - describe('pubsub started after connect', () => { - let psA: PubSub - let psB: PubSub - let componentsA: MockNetworkComponents - let componentsB: MockNetworkComponents - - // Create pubsub nodes - beforeEach(async () => { - mockNetwork.reset() - componentsA = await createComponents() - componentsB = await createComponents() - - psA = componentsA.pubsub = await common.setup({ - components: componentsA, - init: {} - }) - psB = componentsB.pubsub = await common.setup({ - components: componentsB, - init: {} - }) - }) - - afterEach(async () => { - sinon.restore() - await stop(...Object.values(componentsA), ...Object.values(componentsB)) - await common.teardown() - mockNetwork.reset() - }) - - it('should get notified of connected peers after starting', async () => { - await start(...Object.values(componentsA), ...Object.values(componentsB)) - - await componentsA.connectionManager.openConnection(componentsB.peerId) - - return Promise.all([ - pWaitFor(() => psA.getPeers().length === 1), - pWaitFor(() => psB.getPeers().length === 1) - ]) - }) - - it('should receive pubsub messages', async () => { - const defer = pDefer() - const topic = 'test-topic' - const data = uint8ArrayFromString('hey!') - - await start(...Object.values(componentsA), ...Object.values(componentsB)) - - await componentsA.connectionManager.openConnection(componentsB.peerId) - - await Promise.all([ - pWaitFor(() => psA.getPeers().length === 1), - pWaitFor(() => psB.getPeers().length === 1) - ]) - - let subscribedTopics = psA.getTopics() - expect(subscribedTopics).to.not.include(topic) - - psA.subscribe(topic) - psA.addEventListener('message', (evt) => { - if (evt.detail.topic === topic) { - const msg = evt.detail - expect(msg.data).to.equalBytes(data) - defer.resolve() - } - }) - psA.subscribe(topic) - - subscribedTopics = psA.getTopics() - expect(subscribedTopics).to.include(topic) - - // wait for psB to know about psA subscription - await pWaitFor(() => { - const subscribedPeers = psB.getSubscribers(topic) - return subscribedPeers.map(p => p.toString()).includes(componentsA.peerId.toString()) // eslint-disable-line max-nested-callbacks - }) - await psB.publish(topic, data) - - await defer.promise - }) - }) - - describe('pubsub with intermittent connections', () => { - let psA: PubSub - let psB: PubSub - let componentsA: MockNetworkComponents - let componentsB: MockNetworkComponents - - // Create pubsub nodes and start them - beforeEach(async () => { - mockNetwork.reset() - componentsA = await createComponents() - componentsB = await createComponents() - - psA = componentsA.pubsub = await common.setup({ - components: componentsA, - init: {} - }) - psB = componentsB.pubsub = await common.setup({ - components: componentsB, - init: {} - }) - - await start(...Object.values(componentsA), ...Object.values(componentsB)) - }) - - afterEach(async () => { - sinon.restore() - await stop(...Object.values(componentsA), ...Object.values(componentsB)) - await common.teardown() - mockNetwork.reset() - }) - - it.skip('should receive pubsub messages after a node restart', async function () { - const topic = 'test-topic' - const data = uint8ArrayFromString('hey!') - - let counter = 0 - const defer1 = pDefer() - const defer2 = pDefer() - - await componentsA.connectionManager.openConnection(componentsB.peerId) - - let subscribedTopics = psA.getTopics() - expect(subscribedTopics).to.not.include(topic) - - psA.subscribe(topic) - psA.addEventListener('message', (evt) => { - if (evt.detail.topic === topic) { - const msg = evt.detail - expect(msg.data).to.equalBytes(data) - counter++ - counter === 1 ? defer1.resolve() : defer2.resolve() - } - }) - psA.subscribe(topic) - - subscribedTopics = psA.getTopics() - expect(subscribedTopics).to.include(topic) - - // wait for psB to know about psA subscription - await pWaitFor(() => { - const subscribedPeers = psB.getSubscribers(topic) - return subscribedPeers.map(p => p.toString()).includes(componentsA.peerId.toString()) // eslint-disable-line max-nested-callbacks - }) - await psB.publish(topic, data) - - await defer1.promise - - await stop(psB) - await pWaitFor(() => { - // @ts-expect-error protected fields - const aHasConnectionToB = psA._libp2p.connectionManager.get(psB.peerId) - // @ts-expect-error protected fields - const bHasConnectionToA = psB._libp2p.connectionManager.get(psA.peerId) - - return aHasConnectionToB != null && bHasConnectionToA != null - }) - await start(psB) - - await componentsA.connectionManager.openConnection(componentsB.peerId) - - // wait for remoteLibp2p to know about libp2p subscription - await pWaitFor(() => { - const subscribedPeers = psB.getSubscribers(topic) - return subscribedPeers.toString().includes(componentsA.peerId.toString()) - }) - - await psB.publish(topic, data) - - await defer2.promise - }) - - it.skip('should handle quick reconnects with a delayed disconnect', async () => { - // Subscribe on both - let aReceivedFirstMessageFromB = false - let aReceivedSecondMessageFromB = false - let bReceivedFirstMessageFromA = false - let bReceivedSecondMessageFromA = false - const topic = 'reconnect-channel' - - const handlerSpyA = (evt: CustomEvent): void => { - if (evt.detail.topic !== topic) { - return - } - - const message = evt.detail - const data = uint8ArrayToString(message.data) - - if (data === 'message-from-b-1') { - aReceivedFirstMessageFromB = true - } - - if (data === 'message-from-b-2') { - aReceivedSecondMessageFromB = true - } - } - const handlerSpyB = (evt: CustomEvent): void => { - if (evt.detail.topic !== topic) { - return - } - - const message = evt.detail - const data = uint8ArrayToString(message.data) - - if (data === 'message-from-a-1') { - bReceivedFirstMessageFromA = true - } - - if (data === 'message-from-a-2') { - bReceivedSecondMessageFromA = true - } - } - - psA.addEventListener('message', handlerSpyA) - psB.addEventListener('message', handlerSpyB) - psA.subscribe(topic) - psB.subscribe(topic) - - // Create two connections to the remote peer - // @ts-expect-error protected fields - const originalConnection = await psA._libp2p.dialer.connectToPeer(psB.peerId) - - // second connection - await componentsA.connectionManager.openConnection(componentsB.peerId) - - // Wait for subscriptions to occur - await pWaitFor(() => { - return psA.getSubscribers(topic).map(p => p.toString()).includes(componentsB.peerId.toString()) && - psB.getSubscribers(topic).map(p => p.toString()).includes(componentsA.peerId.toString()) - }) - - // Verify messages go both ways - await psA.publish(topic, uint8ArrayFromString('message-from-a-1')) - await psB.publish(topic, uint8ArrayFromString('message-from-b-1')) - await pWaitFor(() => { - return aReceivedFirstMessageFromB && bReceivedFirstMessageFromA - }) - - // Disconnect the first connection (this acts as a delayed reconnect) - // @ts-expect-error protected fields - const psAConnUpdateSpy = sinon.spy(psA._libp2p.connectionManager.connections, 'set') - - await originalConnection.close() - await pWaitFor(() => psAConnUpdateSpy.callCount === 1) - - // Verify messages go both ways after the disconnect - await psA.publish(topic, uint8ArrayFromString('message-from-a-2')) - await psB.publish(topic, uint8ArrayFromString('message-from-b-2')) - await pWaitFor(() => { - return aReceivedSecondMessageFromB && bReceivedSecondMessageFromA - }) - }) - }) - }) -} diff --git a/packages/interface-pubsub-compliance-tests/src/emit-self.ts b/packages/interface-pubsub-compliance-tests/src/emit-self.ts deleted file mode 100644 index 956a1f2143..0000000000 --- a/packages/interface-pubsub-compliance-tests/src/emit-self.ts +++ /dev/null @@ -1,99 +0,0 @@ -import { mockNetwork } from '@libp2p/interface-mocks' -import { start, stop } from '@libp2p/interfaces/startable' -import { expect } from 'aegir/chai' -import sinon from 'sinon' -import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' -import { createComponents } from './utils.js' -import type { PubSubArgs, PubSubComponents } from './index.js' -import type { TestSetup } from '@libp2p/interface-compliance-tests' -import type { PubSub } from '@libp2p/interface-pubsub' - -const topic = 'foo' -const data = uint8ArrayFromString('bar') -const shouldNotHappen = (): void => expect.fail() - -export default (common: TestSetup): void => { - describe('emit self', () => { - describe('enabled', () => { - let pubsub: PubSub - let components: PubSubComponents - - before(async () => { - mockNetwork.reset() - components = await createComponents() - - pubsub = components.pubsub = await common.setup({ - components, - init: { - emitSelf: true - } - }) - - await start(...Object.values(components)) - pubsub.subscribe(topic) - }) - - after(async () => { - sinon.restore() - await stop(...Object.values(components)) - await common.teardown() - mockNetwork.reset() - }) - - it('should emit to self on publish', async () => { - const promise = new Promise((resolve) => { - pubsub.addEventListener('message', (evt) => { - if (evt.detail.topic === topic) { - resolve() - } - }, { - once: true - }) - }) - - const result = await pubsub.publish(topic, data) - - await promise - - expect(result).to.have.property('recipients').with.lengthOf(1) - }) - }) - - describe('disabled', () => { - let pubsub: PubSub - let components: PubSubComponents - - before(async () => { - mockNetwork.reset() - components = await createComponents() - pubsub = components.pubsub = await common.setup({ - components, - init: { - emitSelf: false - } - }) - - await start(...Object.values(components)) - pubsub.subscribe(topic) - }) - - after(async () => { - sinon.restore() - await stop(...Object.values(components)) - await common.teardown() - mockNetwork.reset() - }) - - it('should not emit to self on publish', async () => { - pubsub.addEventListener('message', shouldNotHappen, { - once: true - }) - - await pubsub.publish(topic, data) - - // Wait 1 second to guarantee that self is not noticed - await new Promise((resolve) => setTimeout(resolve, 1000)) - }) - }) - }) -} diff --git a/packages/interface-pubsub-compliance-tests/src/index.ts b/packages/interface-pubsub-compliance-tests/src/index.ts deleted file mode 100644 index 7cf2d45fc5..0000000000 --- a/packages/interface-pubsub-compliance-tests/src/index.ts +++ /dev/null @@ -1,34 +0,0 @@ -import apiTest from './api.js' -import connectionHandlersTest from './connection-handlers.js' -import emitSelfTest from './emit-self.js' -import messagesTest from './messages.js' -import multipleNodesTest from './multiple-nodes.js' -import twoNodesTest from './two-nodes.js' -import type { TestSetup } from '@libp2p/interface-compliance-tests' -import type { ConnectionManager } from '@libp2p/interface-connection-manager' -import type { PeerId } from '@libp2p/interface-peer-id' -import type { PubSub, PubSubInit } from '@libp2p/interface-pubsub' -import type { Registrar } from '@libp2p/interface-registrar' - -export interface PubSubComponents { - peerId: PeerId - registrar: Registrar - connectionManager: ConnectionManager - pubsub?: PubSub -} - -export interface PubSubArgs { - components: PubSubComponents - init: PubSubInit -} - -export default (common: TestSetup): void => { - describe('interface-pubsub compliance tests', () => { - apiTest(common) - emitSelfTest(common) - messagesTest(common) - connectionHandlersTest(common) - twoNodesTest(common) - multipleNodesTest(common) - }) -} diff --git a/packages/interface-pubsub-compliance-tests/src/messages.ts b/packages/interface-pubsub-compliance-tests/src/messages.ts deleted file mode 100644 index ddbd9d59c6..0000000000 --- a/packages/interface-pubsub-compliance-tests/src/messages.ts +++ /dev/null @@ -1,59 +0,0 @@ -import { mockNetwork } from '@libp2p/interface-mocks' -import { start, stop } from '@libp2p/interfaces/startable' -import { expect } from 'aegir/chai' -import { pEvent } from 'p-event' -import sinon from 'sinon' -import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' -import { createComponents } from './utils.js' -import type { PubSubArgs, PubSubComponents } from './index.js' -import type { TestSetup } from '@libp2p/interface-compliance-tests' -import type { Message, PubSub } from '@libp2p/interface-pubsub' - -const topic = 'foo' -const data = uint8ArrayFromString('bar') - -export default (common: TestSetup): void => { - describe('messages', () => { - let pubsub: PubSub - let components: PubSubComponents - - // Create pubsub router - beforeEach(async () => { - mockNetwork.reset() - components = await createComponents() - - pubsub = components.pubsub = await common.setup({ - components, - init: { - emitSelf: true - } - }) - await start(...Object.values(components)) - }) - - afterEach(async () => { - sinon.restore() - await stop(...Object.values(components)) - await common.teardown() - mockNetwork.reset() - }) - - it('should emit normalized signed messages on publish', async () => { - const eventPromise = pEvent<'message', CustomEvent>(pubsub, 'message') - - pubsub.globalSignaturePolicy = 'StrictSign' - pubsub.subscribe(topic) - await pubsub.publish(topic, data) - - const event = await eventPromise - const message = event.detail - - if (message.type === 'signed') { - expect(message.from.toString()).to.equal(components.peerId.toString()) - expect(message.sequenceNumber).to.not.eql(undefined) - expect(message.key).to.not.eql(undefined) - expect(message.signature).to.not.eql(undefined) - } - }) - }) -} diff --git a/packages/interface-pubsub-compliance-tests/src/multiple-nodes.ts b/packages/interface-pubsub-compliance-tests/src/multiple-nodes.ts deleted file mode 100644 index d5c4c58545..0000000000 --- a/packages/interface-pubsub-compliance-tests/src/multiple-nodes.ts +++ /dev/null @@ -1,440 +0,0 @@ -/* eslint max-nested-callbacks: ["error", 6] */ -import { mockNetwork } from '@libp2p/interface-mocks' -import { start, stop } from '@libp2p/interfaces/startable' -import { expect } from 'aegir/chai' -import delay from 'delay' -import pDefer from 'p-defer' -import pWaitFor from 'p-wait-for' -import sinon from 'sinon' -import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' -import { toString as uint8ArrayToString } from 'uint8arrays/to-string' -import { createComponents, waitForSubscriptionUpdate } from './utils.js' -import type { PubSubArgs, PubSubComponents } from './index.js' -import type { TestSetup } from '@libp2p/interface-compliance-tests' -import type { Message, PubSub } from '@libp2p/interface-pubsub' - -export default (common: TestSetup): void => { - describe('pubsub with multiple nodes', function () { - describe('every peer subscribes to the topic', () => { - describe('line', () => { - // line - // ◉────◉────◉ - // a b c - let psA: PubSub - let psB: PubSub - let psC: PubSub - let componentsA: PubSubComponents - let componentsB: PubSubComponents - let componentsC: PubSubComponents - - // Create and start pubsub nodes - beforeEach(async () => { - mockNetwork.reset() - - componentsA = await createComponents() - componentsB = await createComponents() - componentsC = await createComponents() - - psA = componentsA.pubsub = await common.setup({ - components: componentsA, - init: { - emitSelf: true - } - }) - psB = componentsB.pubsub = await common.setup({ - components: componentsB, - init: { - emitSelf: true - } - }) - psC = componentsC.pubsub = await common.setup({ - components: componentsC, - init: { - emitSelf: true - } - }) - - // Start pubsub modes - await start(...Object.values(componentsA), ...Object.values(componentsB), ...Object.values(componentsC)) - - // Connect nodes - await componentsA.connectionManager.openConnection(componentsB.peerId) - await componentsB.connectionManager.openConnection(componentsC.peerId) - - // Wait for peers to be ready in pubsub - await pWaitFor(() => - psA.getPeers().length === 1 && - psC.getPeers().length === 1 && - psA.getPeers().length === 1 - ) - }) - - afterEach(async () => { - sinon.restore() - await stop(...Object.values(componentsA), ...Object.values(componentsB), ...Object.values(componentsC)) - await common.teardown() - mockNetwork.reset() - }) - - it('subscribe to the topic on node a', async () => { - const topic = 'Z' - - psA.subscribe(topic) - expect(psA.getTopics()).to.deep.equal([topic]) - - await waitForSubscriptionUpdate(psB, componentsA.peerId) - - expect(psB.getPeers().length).to.equal(2) - expect(psB.getSubscribers(topic).map(p => p.toString())).to.deep.equal([componentsA.peerId.toString()]) - - expect(psC.getPeers().length).to.equal(1) - expect(psC.getSubscribers(topic)).to.be.empty() - }) - - it('subscribe to the topic on node b', async () => { - const topic = 'Z' - psB.subscribe(topic) - expect(psB.getTopics()).to.deep.equal([topic]) - - await Promise.all([ - waitForSubscriptionUpdate(psA, componentsB.peerId), - waitForSubscriptionUpdate(psC, componentsB.peerId) - ]) - - expect(psA.getPeers().length).to.equal(1) - expect(psA.getSubscribers(topic).map(p => p.toString())).to.deep.equal([componentsB.peerId.toString()]) - - expect(psC.getPeers().length).to.equal(1) - expect(psC.getSubscribers(topic).map(p => p.toString())).to.deep.equal([componentsB.peerId.toString()]) - }) - - it('subscribe to the topic on node c', async () => { - const topic = 'Z' - const defer = pDefer() - - psC.subscribe(topic) - expect(psC.getTopics()).to.deep.equal([topic]) - - psB.addEventListener('subscription-change', () => { - expect(psA.getPeers().length).to.equal(1) - expect(psB.getPeers().length).to.equal(2) - expect(psB.getSubscribers(topic).map(p => p.toString())).to.deep.equal([componentsC.peerId.toString()]) - - defer.resolve() - }, { - once: true - }) - - return defer.promise - }) - - it('publish on node a', async () => { - const topic = 'Z' - const defer = pDefer() - - psA.subscribe(topic) - psB.subscribe(topic) - psC.subscribe(topic) - - await Promise.all([ - waitForSubscriptionUpdate(psA, componentsB.peerId), - waitForSubscriptionUpdate(psB, componentsA.peerId), - waitForSubscriptionUpdate(psC, componentsB.peerId) - ]) - - // GossipSub needs time to build the mesh overlay - await delay(1000) - - let counter = 0 - - psA.addEventListener('message', incMsg) - psB.addEventListener('message', incMsg) - psC.addEventListener('message', incMsg) - - const result = await psA.publish(topic, uint8ArrayFromString('hey')) - - expect(result).to.have.property('recipients').with.property('length').greaterThanOrEqual(1) - - function incMsg (evt: CustomEvent): void { - const msg = evt.detail - - if (msg.topic !== topic) { - return - } - - expect(uint8ArrayToString(msg.data)).to.equal('hey') - check() - } - - function check (): void { - if (++counter === 3) { - psA.removeEventListener('message', incMsg) - psB.removeEventListener('message', incMsg) - psC.removeEventListener('message', incMsg) - defer.resolve() - } - } - - return defer.promise - }) - - // since the topology is the same, just the publish - // gets sent by other peer, we reused the same peers - describe('1 level tree', () => { - // 1 level tree - // ┌◉┐ - // │b│ - // ◉─┘ └─◉ - // a c - - it('publish on node b', async () => { - const topic = 'Z' - const defer = pDefer() - let counter = 0 - - psA.subscribe(topic) - psB.subscribe(topic) - psC.subscribe(topic) - - await Promise.all([ - waitForSubscriptionUpdate(psA, componentsB.peerId), - waitForSubscriptionUpdate(psB, componentsA.peerId), - waitForSubscriptionUpdate(psC, componentsB.peerId) - ]) - - // GossipSub needs time to build the mesh overlay - await delay(1000) - - psA.addEventListener('message', incMsg) - psB.addEventListener('message', incMsg) - psC.addEventListener('message', incMsg) - - await psB.publish(topic, uint8ArrayFromString('hey')) - - function incMsg (evt: CustomEvent): void { - const msg = evt.detail - - if (msg.topic !== topic) { - return - } - - expect(uint8ArrayToString(msg.data)).to.equal('hey') - check() - } - - function check (): void { - if (++counter === 3) { - psA.removeEventListener('message', incMsg) - psB.removeEventListener('message', incMsg) - psC.removeEventListener('message', incMsg) - defer.resolve() - } - } - - return defer.promise - }) - }) - }) - - describe('2 level tree', () => { - // 2 levels tree - // ┌◉┐ - // │c│ - // ┌◉─┘ └─◉┐ - // │b d│ - // ◉─┘ └─◉ - // a - let psA: PubSub - let psB: PubSub - let psC: PubSub - let psD: PubSub - let psE: PubSub - let componentsA: PubSubComponents - let componentsB: PubSubComponents - let componentsC: PubSubComponents - let componentsD: PubSubComponents - let componentsE: PubSubComponents - - // Create and start pubsub nodes - beforeEach(async () => { - mockNetwork.reset() - - componentsA = await createComponents() - componentsB = await createComponents() - componentsC = await createComponents() - componentsD = await createComponents() - componentsE = await createComponents() - - psA = componentsA.pubsub = await common.setup({ - components: componentsA, - init: { - emitSelf: true - } - }) - psB = componentsB.pubsub = await common.setup({ - components: componentsB, - init: { - emitSelf: true - } - }) - psC = componentsC.pubsub = await common.setup({ - components: componentsC, - init: { - emitSelf: true - } - }) - psD = componentsD.pubsub = await common.setup({ - components: componentsD, - init: { - emitSelf: true - } - }) - psE = componentsE.pubsub = await common.setup({ - components: componentsE, - init: { - emitSelf: true - } - }) - - // Start pubsub nodes - await start( - ...Object.values(componentsA), - ...Object.values(componentsB), - ...Object.values(componentsC), - ...Object.values(componentsD), - ...Object.values(componentsE) - ) - - // connect nodes - await componentsA.connectionManager.openConnection(componentsB.peerId) - await componentsB.connectionManager.openConnection(componentsC.peerId) - await componentsC.connectionManager.openConnection(componentsD.peerId) - await componentsD.connectionManager.openConnection(componentsE.peerId) - - // Wait for peers to be ready in pubsub - await pWaitFor(() => - psA.getPeers().length === 1 && - psB.getPeers().length === 2 && - psC.getPeers().length === 2 && - psD.getPeers().length === 2 && - psE.getPeers().length === 1 - ) - }) - - afterEach(async () => { - await stop( - ...Object.values(componentsA), - ...Object.values(componentsB), - ...Object.values(componentsC), - ...Object.values(componentsD), - ...Object.values(componentsE) - ) - await common.teardown() - mockNetwork.reset() - }) - - it('subscribes', () => { - psA.subscribe('Z') - expect(psA.getTopics()).to.deep.equal(['Z']) - psB.subscribe('Z') - expect(psB.getTopics()).to.deep.equal(['Z']) - psC.subscribe('Z') - expect(psC.getTopics()).to.deep.equal(['Z']) - psD.subscribe('Z') - expect(psD.getTopics()).to.deep.equal(['Z']) - psE.subscribe('Z') - expect(psE.getTopics()).to.deep.equal(['Z']) - }) - - it('publishes from c', async function () { - const defer = pDefer() - let counter = 0 - const topic = 'Z' - - psA.subscribe(topic) - psA.addEventListener('message', incMsg) - psB.subscribe(topic) - psB.addEventListener('message', incMsg) - psC.subscribe(topic) - psC.addEventListener('message', incMsg) - psD.subscribe(topic) - psD.addEventListener('message', incMsg) - psE.subscribe(topic) - psE.addEventListener('message', incMsg) - - await Promise.all([ - waitForSubscriptionUpdate(psA, componentsB.peerId), - waitForSubscriptionUpdate(psB, componentsA.peerId), - waitForSubscriptionUpdate(psC, componentsB.peerId), - waitForSubscriptionUpdate(psD, componentsC.peerId), - waitForSubscriptionUpdate(psE, componentsD.peerId) - ]) - - // GossipSub needs time to build the mesh overlay - await delay(1000) - - await psC.publish('Z', uint8ArrayFromString('hey from c')) - - function incMsg (evt: CustomEvent): void { - const msg = evt.detail - - if (msg.topic !== topic) { - return - } - - expect(uint8ArrayToString(msg.data)).to.equal('hey from c') - check() - } - - function check (): void { - if (++counter === 5) { - psA.unsubscribe('Z') - psB.unsubscribe('Z') - psC.unsubscribe('Z') - psD.unsubscribe('Z') - psE.unsubscribe('Z') - defer.resolve() - } - } - - return defer.promise - }) - }) - }) - - describe('only some nodes subscribe the networks', () => { - describe('line', () => { - // line - // ◉────◎────◉ - // a b c - - before(() => { }) - after(() => { }) - }) - - describe('1 level tree', () => { - // 1 level tree - // ┌◉┐ - // │b│ - // ◎─┘ └─◉ - // a c - - before(() => { }) - after(() => { }) - }) - - describe('2 level tree', () => { - // 2 levels tree - // ┌◉┐ - // │c│ - // ┌◎─┘ └─◉┐ - // │b d│ - // ◉─┘ └─◎ - // a e - - before(() => { }) - after(() => { }) - }) - }) - }) -} diff --git a/packages/interface-pubsub-compliance-tests/src/two-nodes.ts b/packages/interface-pubsub-compliance-tests/src/two-nodes.ts deleted file mode 100644 index 77862601d5..0000000000 --- a/packages/interface-pubsub-compliance-tests/src/two-nodes.ts +++ /dev/null @@ -1,273 +0,0 @@ -/* eslint max-nested-callbacks: ["error", 6] */ -import { mockNetwork } from '@libp2p/interface-mocks' -import { TopicValidatorResult } from '@libp2p/interface-pubsub' -import { start, stop } from '@libp2p/interfaces/startable' -import { expect } from 'aegir/chai' -import pDefer from 'p-defer' -import pWaitFor from 'p-wait-for' -import sinon from 'sinon' -import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' -import { toString as uint8ArrayToString } from 'uint8arrays/to-string' -import { createComponents, waitForSubscriptionUpdate } from './utils.js' -import type { PubSubArgs, PubSubComponents } from './index.js' -import type { TestSetup } from '@libp2p/interface-compliance-tests' -import type { Message, PubSub } from '@libp2p/interface-pubsub' - -const topic = 'foo' - -function shouldNotHappen (): void { - expect.fail() -} - -export default (common: TestSetup): void => { - describe('pubsub with two nodes', () => { - let psA: PubSub - let psB: PubSub - let componentsA: PubSubComponents - let componentsB: PubSubComponents - - // Create pubsub nodes and connect them - beforeEach(async () => { - mockNetwork.reset() - - componentsA = await createComponents() - componentsB = await createComponents() - - psA = componentsA.pubsub = await common.setup({ - components: componentsA, - init: { - emitSelf: true - } - }) - psB = componentsB.pubsub = await common.setup({ - components: componentsB, - init: { - emitSelf: false - } - }) - - // Start pubsub and connect nodes - await start(...Object.values(componentsA), ...Object.values(componentsB)) - - expect(psA.getPeers()).to.be.empty() - expect(psB.getPeers()).to.be.empty() - - await componentsA.connectionManager.openConnection(componentsB.peerId) - - // Wait for peers to be ready in pubsub - await pWaitFor(() => psA.getPeers().length === 1 && psB.getPeers().length === 1) - }) - - afterEach(async () => { - sinon.restore() - await stop(...Object.values(componentsA), ...Object.values(componentsB)) - await common.teardown() - mockNetwork.reset() - }) - - it('Subscribe to a topic in nodeA', async () => { - const defer = pDefer() - - psB.addEventListener('subscription-change', (evt) => { - const { peerId: changedPeerId, subscriptions: changedSubs } = evt.detail - expect(psA.getTopics()).to.deep.equal([topic]) - expect(psB.getPeers()).to.have.lengthOf(1) - expect(psB.getSubscribers(topic).map(p => p.toString())).to.deep.equal([componentsA.peerId.toString()]) - expect(changedPeerId).to.deep.equal(psB.getPeers()[0]) - expect(changedSubs).to.have.lengthOf(1) - expect(changedSubs[0].topic).to.equal(topic) - expect(changedSubs[0].subscribe).to.equal(true) - defer.resolve() - }, { - once: true - }) - psA.subscribe(topic) - - return defer.promise - }) - - it('Publish to a topic in nodeA', async () => { - const defer = pDefer() - - psA.addEventListener('message', (evt) => { - if (evt.detail.topic === topic) { - const msg = evt.detail - expect(uint8ArrayToString(msg.data)).to.equal('hey') - psB.removeEventListener('message', shouldNotHappen) - defer.resolve() - } - }, { - once: true - }) - - psA.subscribe(topic) - psB.subscribe(topic) - - await Promise.all([ - waitForSubscriptionUpdate(psA, componentsB.peerId), - waitForSubscriptionUpdate(psB, componentsA.peerId) - ]) - - await psA.publish(topic, uint8ArrayFromString('hey')) - - return defer.promise - }) - - it('Publish to a topic in nodeB', async () => { - const defer = pDefer() - - psA.addEventListener('message', (evt) => { - if (evt.detail.topic !== topic) { - return - } - - const msg = evt.detail - psA.addEventListener('message', (evt) => { - if (evt.detail.topic === topic) { - shouldNotHappen() - } - }, { - once: true - }) - expect(uint8ArrayToString(msg.data)).to.equal('banana') - - setTimeout(() => { - psA.removeEventListener('message') - psB.removeEventListener('message') - - defer.resolve() - }, 100) - }, { - once: true - }) - - psB.addEventListener('message', shouldNotHappen) - - psA.subscribe(topic) - psB.subscribe(topic) - - await Promise.all([ - waitForSubscriptionUpdate(psA, componentsB.peerId), - waitForSubscriptionUpdate(psB, componentsA.peerId) - ]) - - await psB.publish(topic, uint8ArrayFromString('banana')) - - return defer.promise - }) - - it('validate topic message', async () => { - const defer = pDefer() - - psA.subscribe(topic) - - psB.topicValidators.set(topic, (peer, message) => { - if (!peer.equals(componentsA.peerId)) { - defer.reject(new Error('Invalid peer id in topic validator fn')) - return TopicValidatorResult.Reject - } - - if (uint8ArrayToString(message.data) !== 'hey') { - defer.reject(new Error('Invalid message in topic validator fn')) - return TopicValidatorResult.Reject - } - - defer.resolve() - return TopicValidatorResult.Accept - }) - psB.subscribe(topic) - - await Promise.all([ - waitForSubscriptionUpdate(psA, componentsB.peerId), - waitForSubscriptionUpdate(psB, componentsA.peerId) - ]) - - await psA.publish(topic, uint8ArrayFromString('hey')) - - return defer.promise - }) - - it('Publish 10 msg to a topic in nodeB', async () => { - const defer = pDefer() - let counter = 0 - - psB.addEventListener('message', shouldNotHappen) - psA.addEventListener('message', receivedMsg) - - function receivedMsg (evt: CustomEvent): void { - const msg = evt.detail - if (msg.type === 'unsigned') { - expect(uint8ArrayToString(msg.data)).to.equal('banana') - expect(msg.topic).to.be.equal(topic) - } else { - expect(uint8ArrayToString(msg.data)).to.equal('banana') - expect(msg.from.toString()).to.equal(componentsB.peerId.toString()) - expect(msg.sequenceNumber).to.be.a('BigInt') - expect(msg.topic).to.be.equal(topic) - } - - if (++counter === 10) { - psA.removeEventListener('message', receivedMsg) - psB.removeEventListener('message', shouldNotHappen) - - defer.resolve() - } - } - - psA.subscribe(topic) - psB.subscribe(topic) - - await Promise.all([ - waitForSubscriptionUpdate(psA, componentsB.peerId), - waitForSubscriptionUpdate(psB, componentsA.peerId) - ]) - - await Promise.all( - Array.from({ length: 10 }, async (_, i) => { - await psB.publish(topic, uint8ArrayFromString('banana')) - }) - ) - - return defer.promise - }) - - it('Unsubscribe from topic in nodeA', async () => { - const defer = pDefer() - let callCount = 0 - - psB.addEventListener('subscription-change', (evt) => { - callCount++ - - if (callCount === 1) { - // notice subscribe - const { peerId: changedPeerId, subscriptions: changedSubs } = evt.detail - expect(psB.getPeers()).to.have.lengthOf(1) - expect(psB.getTopics()).to.be.empty() - expect(changedPeerId).to.deep.equal(psB.getPeers()[0]) - expect(changedSubs).to.have.lengthOf(1) - expect(changedSubs[0].topic).to.equal(topic) - expect(changedSubs[0].subscribe).to.equal(true) - } else { - // notice unsubscribe - const { peerId: changedPeerId, subscriptions: changedSubs } = evt.detail - expect(psB.getPeers()).to.have.lengthOf(1) - expect(psB.getTopics()).to.be.empty() - expect(changedPeerId).to.deep.equal(psB.getPeers()[0]) - expect(changedSubs).to.have.lengthOf(1) - expect(changedSubs[0].topic).to.equal(topic) - expect(changedSubs[0].subscribe).to.equal(false) - - defer.resolve() - } - }) - - psA.subscribe(topic) - expect(psA.getTopics()).to.not.be.empty() - - psA.unsubscribe(topic) - expect(psA.getTopics()).to.be.empty() - - return defer.promise - }) - }) -} diff --git a/packages/interface-pubsub-compliance-tests/src/utils.ts b/packages/interface-pubsub-compliance-tests/src/utils.ts deleted file mode 100644 index 9ad4c78969..0000000000 --- a/packages/interface-pubsub-compliance-tests/src/utils.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { mockConnectionManager, mockRegistrar, mockNetwork } from '@libp2p/interface-mocks' -import { EventEmitter } from '@libp2p/interfaces/events' -import { createEd25519PeerId } from '@libp2p/peer-id-factory' -import { pEvent } from 'p-event' -import pWaitFor from 'p-wait-for' -import type { MockNetworkComponents } from '@libp2p/interface-mocks' -import type { PeerId } from '@libp2p/interface-peer-id' -import type { PubSub, SubscriptionChangeData } from '@libp2p/interface-pubsub' - -export async function waitForSubscriptionUpdate (a: PubSub, b: PeerId): Promise { - await pWaitFor(async () => { - const event = await pEvent<'subscription-change', CustomEvent>(a, 'subscription-change') - - return event.detail.peerId.equals(b) - }) -} - -export async function createComponents (): Promise { - const components: any = { - peerId: await createEd25519PeerId(), - registrar: mockRegistrar(), - events: new EventEmitter() - } - components.connectionManager = mockConnectionManager(components) - - mockNetwork.addNode(components) - - return components -} diff --git a/packages/interface-pubsub-compliance-tests/tsconfig.json b/packages/interface-pubsub-compliance-tests/tsconfig.json deleted file mode 100644 index 1a1ed83a7b..0000000000 --- a/packages/interface-pubsub-compliance-tests/tsconfig.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "extends": "aegir/src/config/tsconfig.aegir.json", - "compilerOptions": { - "outDir": "dist" - }, - "include": [ - "src", - "test" - ], - "references": [ - { - "path": "../interface-compliance-tests" - }, - { - "path": "../interface-connection-manager" - }, - { - "path": "../interface-mocks" - }, - { - "path": "../interface-peer-id" - }, - { - "path": "../interface-pubsub" - }, - { - "path": "../interface-registrar" - }, - { - "path": "../interfaces" - }, - { - "path": "../peer-id-factory" - } - ] -} diff --git a/packages/interface-pubsub/CHANGELOG.md b/packages/interface-pubsub/CHANGELOG.md deleted file mode 100644 index 97617fba67..0000000000 --- a/packages/interface-pubsub/CHANGELOG.md +++ /dev/null @@ -1,148 +0,0 @@ -## [@libp2p/interface-pubsub-v4.0.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-pubsub-v4.0.0...@libp2p/interface-pubsub-v4.0.1) (2023-05-04) - - -### Dependencies - -* bump aegir from 38.1.8 to 39.0.5 ([#393](https://github.com/libp2p/js-libp2p-interfaces/issues/393)) ([31f3797](https://github.com/libp2p/js-libp2p-interfaces/commit/31f3797b24f7c23f3f16e9db3a230bd5f7cd5175)) - -## [@libp2p/interface-pubsub-v4.0.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-pubsub-v3.0.7...@libp2p/interface-pubsub-v4.0.0) (2023-04-18) - - -### ⚠ BREAKING CHANGES - -* bump it-stream-types from 1.0.5 to 2.0.1 (#362) - -### Dependencies - -* bump it-stream-types from 1.0.5 to 2.0.1 ([#362](https://github.com/libp2p/js-libp2p-interfaces/issues/362)) ([cdc7747](https://github.com/libp2p/js-libp2p-interfaces/commit/cdc774792beead63e0ded96bd6c23de0335a49e3)) -* update sibling dependencies ([2f52a28](https://github.com/libp2p/js-libp2p-interfaces/commit/2f52a284b59c0a88b040f86da1f5d3f044727f2c)) - -## [@libp2p/interface-pubsub-v3.0.7](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-pubsub-v3.0.6...@libp2p/interface-pubsub-v3.0.7) (2023-04-11) - - -### Dependencies - -* update sibling dependencies ([b034810](https://github.com/libp2p/js-libp2p-interfaces/commit/b0348102e41dc18166e70063f4708a2b3544f4b6)) - -## [@libp2p/interface-pubsub-v3.0.6](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-pubsub-v3.0.5...@libp2p/interface-pubsub-v3.0.6) (2023-01-18) - - -### Trivial Changes - -* remove lerna ([#330](https://github.com/libp2p/js-libp2p-interfaces/issues/330)) ([6678592](https://github.com/libp2p/js-libp2p-interfaces/commit/6678592dd0cf601a2671852f9d2a0aff5dee2b18)) - - -### Dependencies - -* bump aegir from 37.12.1 to 38.1.0 ([#335](https://github.com/libp2p/js-libp2p-interfaces/issues/335)) ([7368a36](https://github.com/libp2p/js-libp2p-interfaces/commit/7368a363423a08e8fa247dcb76ea13e4cf030d65)) - -## [@libp2p/interface-pubsub-v3.0.5](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-pubsub-v3.0.4...@libp2p/interface-pubsub-v3.0.5) (2023-01-06) - - -### Dependencies - -* update sibling dependencies ([b50e621](https://github.com/libp2p/js-libp2p-interfaces/commit/b50e621d31a8b32affc3fadb9f97c4883d577f93)) - -## [@libp2p/interface-pubsub-v3.0.4](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-pubsub-v3.0.3...@libp2p/interface-pubsub-v3.0.4) (2022-12-19) - - -### Documentation - -* add interface docs ([#324](https://github.com/libp2p/js-libp2p-interfaces/issues/324)) ([2789445](https://github.com/libp2p/js-libp2p-interfaces/commit/278944594c24e1a3c4b3624a35680d69166546d7)) - -## [@libp2p/interface-pubsub-v3.0.3](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-pubsub-v3.0.2...@libp2p/interface-pubsub-v3.0.3) (2022-12-16) - - -### Documentation - -* update project config ([#323](https://github.com/libp2p/js-libp2p-interfaces/issues/323)) ([0fc6a08](https://github.com/libp2p/js-libp2p-interfaces/commit/0fc6a08e9cdcefe361fe325281a3a2a03759ff59)) - -## [@libp2p/interface-pubsub-v3.0.2](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-pubsub-v3.0.1...@libp2p/interface-pubsub-v3.0.2) (2022-12-14) - - -### Bug Fixes - -* generate docs for all packages ([#321](https://github.com/libp2p/js-libp2p-interfaces/issues/321)) ([b6f8b32](https://github.com/libp2p/js-libp2p-interfaces/commit/b6f8b32a920c15a28fe021e6050e31aaae89d518)) - -## [@libp2p/interface-pubsub-v3.0.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-pubsub-v3.0.0...@libp2p/interface-pubsub-v3.0.1) (2022-11-05) - - -### Bug Fixes - -* update project config ([#311](https://github.com/libp2p/js-libp2p-interfaces/issues/311)) ([27dd0ce](https://github.com/libp2p/js-libp2p-interfaces/commit/27dd0ce3c249892ac69cbb24ddaf0b9f32385e37)) - -## [@libp2p/interface-pubsub-v3.0.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-pubsub-v2.1.0...@libp2p/interface-pubsub-v3.0.0) (2022-10-11) - - -### ⚠ BREAKING CHANGES - -* add topicValidators to pubsub interface (#298) - -### Bug Fixes - -* add topicValidators to pubsub interface ([#298](https://github.com/libp2p/js-libp2p-interfaces/issues/298)) ([e5ff819](https://github.com/libp2p/js-libp2p-interfaces/commit/e5ff819c6dd235b2ea9ea5133457b384c4411cf3)) - -## [@libp2p/interface-pubsub-v2.1.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-pubsub-v2.0.1...@libp2p/interface-pubsub-v2.1.0) (2022-09-09) - - -### Features - -* add dialer interface ([#285](https://github.com/libp2p/js-libp2p-interfaces/issues/285)) ([1e62df4](https://github.com/libp2p/js-libp2p-interfaces/commit/1e62df4f15b45abe62fe8400dbd88866a2bc13cd)) - -## [@libp2p/interface-pubsub-v2.0.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-pubsub-v2.0.0...@libp2p/interface-pubsub-v2.0.1) (2022-08-07) - - -### Dependencies - -* update sibling dependencies ([f859920](https://github.com/libp2p/js-libp2p-interfaces/commit/f859920423587ae797ac90ccaa3af8bdf60ae549)) - -## [@libp2p/interface-pubsub-v2.0.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-pubsub-v1.0.4...@libp2p/interface-pubsub-v2.0.0) (2022-07-31) - - -### ⚠ BREAKING CHANGES - -* The `Message` type is now either a `SignedMessage` -or a `UnsignedMessage` -* the inbound/outbound stream types have changed - -### Features - -* pubsub Message types for signature policies ([#266](https://github.com/libp2p/js-libp2p-interfaces/issues/266)) ([9eb710b](https://github.com/libp2p/js-libp2p-interfaces/commit/9eb710bcbdb0aef95c7a8613e00065a3b7c7f887)) - - -### Bug Fixes - -* make stream types Uint8ArrayLists ([#272](https://github.com/libp2p/js-libp2p-interfaces/issues/272)) ([ace7e0c](https://github.com/libp2p/js-libp2p-interfaces/commit/ace7e0cdb81dd241a8e96a44e841d38b2b80e031)) - - -### Trivial Changes - -* update project config ([#271](https://github.com/libp2p/js-libp2p-interfaces/issues/271)) ([59c0bf5](https://github.com/libp2p/js-libp2p-interfaces/commit/59c0bf5e0b05496fca2e4902632b61bb41fad9e9)) - -## [@libp2p/interface-pubsub-v1.0.4](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-pubsub-v1.0.3...@libp2p/interface-pubsub-v1.0.4) (2022-06-27) - - -### Trivial Changes - -* update deps ([#262](https://github.com/libp2p/js-libp2p-interfaces/issues/262)) ([51edf7d](https://github.com/libp2p/js-libp2p-interfaces/commit/51edf7d9b3765a6f75c915b1483ea345d0133a41)) - -## [@libp2p/interface-pubsub-v1.0.3](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-pubsub-v1.0.2...@libp2p/interface-pubsub-v1.0.3) (2022-06-17) - - -### Bug Fixes - -* add stream control for pubsub ([#248](https://github.com/libp2p/js-libp2p-interfaces/issues/248)) ([e687895](https://github.com/libp2p/js-libp2p-interfaces/commit/e687895267d98fcd99d6d0d849527ab9eed69695)) - -## [@libp2p/interface-pubsub-v1.0.2](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-pubsub-v1.0.1...@libp2p/interface-pubsub-v1.0.2) (2022-06-16) - - -### Trivial Changes - -* update deps ([545264f](https://github.com/libp2p/js-libp2p-interfaces/commit/545264f87a58394d2a7da77e93f3a596e889238f)) - -## [@libp2p/interface-pubsub-v1.0.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-pubsub-v1.0.0...@libp2p/interface-pubsub-v1.0.1) (2022-06-14) - - -### Trivial Changes - -* update it-pushable dep ([#237](https://github.com/libp2p/js-libp2p-interfaces/issues/237)) ([2e16465](https://github.com/libp2p/js-libp2p-interfaces/commit/2e164658df344b5ec475be2a571df5d6f20ee086)) diff --git a/packages/interface-pubsub/LICENSE b/packages/interface-pubsub/LICENSE deleted file mode 100644 index 20ce483c86..0000000000 --- a/packages/interface-pubsub/LICENSE +++ /dev/null @@ -1,4 +0,0 @@ -This project is dual licensed under MIT and Apache-2.0. - -MIT: https://www.opensource.org/licenses/mit -Apache-2.0: https://www.apache.org/licenses/license-2.0 diff --git a/packages/interface-pubsub/LICENSE-APACHE b/packages/interface-pubsub/LICENSE-APACHE deleted file mode 100644 index 14478a3b60..0000000000 --- a/packages/interface-pubsub/LICENSE-APACHE +++ /dev/null @@ -1,5 +0,0 @@ -Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - -http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. diff --git a/packages/interface-pubsub/LICENSE-MIT b/packages/interface-pubsub/LICENSE-MIT deleted file mode 100644 index 72dc60d84b..0000000000 --- a/packages/interface-pubsub/LICENSE-MIT +++ /dev/null @@ -1,19 +0,0 @@ -The MIT License (MIT) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/packages/interface-pubsub/README.md b/packages/interface-pubsub/README.md deleted file mode 100644 index d39ea2a69c..0000000000 --- a/packages/interface-pubsub/README.md +++ /dev/null @@ -1,323 +0,0 @@ -# @libp2p/interface-pubsub - -[![libp2p.io](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](http://libp2p.io/) -[![Discuss](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg?style=flat-square)](https://discuss.libp2p.io) -[![codecov](https://img.shields.io/codecov/c/github/libp2p/js-libp2p.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p) -[![CI](https://img.shields.io/github/actions/workflow/status/libp2p/js-libp2p/main.yml?branch=master\&style=flat-square)](https://github.com/libp2p/js-libp2p/actions/workflows/main.yml?query=branch%3Amaster) - -> PubSub interface for libp2p - -## Table of contents - -- - [Install](#install) -- [Table of Contents ](#table-of-contents----omit-in-toc---) - - [Implementations using this interface](#implementations-using-this-interface) - - [Interface usage](#interface-usage) - - [Extend interface](#extend-interface) - - [Example](#example) - - [API](#api) - - [Constructor](#constructor) - - [`new Pubsub({options})`](#new-pubsuboptions) - - [Parameters](#parameters) - - [Start](#start) - - [`pubsub.start()`](#pubsubstart) - - [Stop](#stop) - - [`pubsub.stop()`](#pubsubstop) - - [Publish](#publish) - - [`pubsub.publish(topic, message)`](#pubsubpublishtopic-message) - - [Parameters](#parameters-1) - - [Returns](#returns) - - [Subscribe](#subscribe) - - [`pubsub.subscribe(topic)`](#pubsubsubscribetopic) - - [Parameters](#parameters-2) - - [Unsubscribe](#unsubscribe) - - [`pubsub.unsubscribe(topic)`](#pubsubunsubscribetopic) - - [Parameters](#parameters-3) - - [Get Topics](#get-topics) - - [`pubsub.getTopics()`](#pubsubgettopics) - - [Returns](#returns-1) - - [Get Peers Subscribed to a topic](#get-peers-subscribed-to-a-topic) - - [`pubsub.getSubscribers(topic)`](#pubsubgetsubscriberstopic) - - [Parameters](#parameters-4) - - [Returns](#returns-2) - - [Validate](#validate) - - [`pubsub.validate(message)`](#pubsubvalidatemessage) - - [Parameters](#parameters-5) - - [Returns](#returns-3) - - [Test suite usage](#test-suite-usage) - - [API Docs](#api-docs) - - [License](#license) - - [Contribution](#contribution) - -## Install - -```console -$ npm i @libp2p/interface-pubsub -``` - -The `interface-pubsub` contains the base implementation for a libp2p pubsub router implementation. This interface should be used to implement a pubsub router compatible with libp2p. It includes a test suite that pubsub routers should run, in order to ensure compatibility with libp2p. - -# Table of Contents - -- [Implementations using this interface](#implementations-using-this-interface) -- [Interface usage](#interface-usage) - - [Extend interface](#extend-interface) - - [Example](#example) -- [API](#api) - - [Constructor](#constructor) - - [`new Pubsub({options})`](#new-pubsuboptions) - - [Parameters](#parameters) - - [Start](#start) - - [`pubsub.start()`](#pubsubstart) - - [Stop](#stop) - - [`pubsub.stop()`](#pubsubstop) - - [Publish](#publish) - - [`pubsub.publish(topic, message)`](#pubsubpublishtopic-message) - - [Parameters](#parameters-1) - - [Returns](#returns) - - [Subscribe](#subscribe) - - [`pubsub.subscribe(topic)`](#pubsubsubscribetopic) - - [Parameters](#parameters-2) - - [Unsubscribe](#unsubscribe) - - [`pubsub.unsubscribe(topic)`](#pubsubunsubscribetopic) - - [Parameters](#parameters-3) - - [Get Topics](#get-topics) - - [`pubsub.getTopics()`](#pubsubgettopics) - - [Returns](#returns-1) - - [Get Peers Subscribed to a topic](#get-peers-subscribed-to-a-topic) - - [`pubsub.getSubscribers(topic)`](#pubsubgetsubscriberstopic) - - [Parameters](#parameters-4) - - [Returns](#returns-2) - - [Validate](#validate) - - [`pubsub.validate(message)`](#pubsubvalidatemessage) - - [Parameters](#parameters-5) - - [Returns](#returns-3) -- [Test suite usage](#test-suite-usage) -- [License](#license) - - [Contribution](#contribution) - -## Implementations using this interface - -You can check the following implementations as examples for building your own pubsub router. - -- [libp2p/js-libp2p-floodsub](https://github.com/libp2p/js-libp2p-floodsub) -- [ChainSafe/js-libp2p-gossipsub](https://github.com/ChainSafe/js-libp2p-gossipsub) - -## Interface usage - -`interface-pubsub` abstracts the implementation protocol registration within `libp2p` and takes care of all the protocol connections and streams, as well as the subscription management and the features describe in the libp2p [pubsub specs](https://github.com/libp2p/specs/tree/master/pubsub). This way, a pubsub implementation can focus on its message routing algorithm, instead of also needing to create the setup for it. - -### Extend interface - -A pubsub router implementation should start by extending the `interface-pubsub` class and **MUST** override the `_publish` function, according to the router algorithms. This function is responsible for forwarding publish messages to other peers, as well as forwarding received messages if the router provides the `canRelayMessage` option to the base implementation. - -Other functions, such as `start`, `stop`, `subscribe`, `unsubscribe`, `_encodeRpc`, `_decodeRpc`, `_processRpcMessage`, `_addPeer` and `_removePeer` may be overwritten if the pubsub implementation needs to customize their logic. Implementations overriding these functions **MUST** call `super`. - -The `start` and `stop` functions are responsible for the registration of the pubsub protocol with libp2p. The `stop` function also guarantees that the open streams in the protocol are properly closed. - -The `subscribe` and `unsubscribe` functions take care of the subscription management and its inherent message propagation. - -When using a custom protobuf definition for message marshalling, you should override `_encodeRpc` and `_decodeRpc` to use the new protobuf instead of the default one. - -`_processRpcMessage` is responsible for handling messages received from other peers. This should be extended if further operations/validations are needed by the router. - -The `_addPeer` and `_removePeer` functions are called when new peers running the pubsub router protocol establish a connection with the peer. They are used for tracking the open streams between the peers. - -All the remaining functions **MUST NOT** be overwritten. - -### Example - -The following example aims to show how to create your pubsub implementation extending this base protocol. The pubsub implementation will handle the subscriptions logic. - -```JavaScript -const Pubsub = require('libp2p-interfaces/src/pubsub') - -class PubsubImplementation extends Pubsub { - constructor({ libp2p, options }) - super({ - debugName: 'libp2p:pubsub', - multicodecs: '/pubsub-implementation/1.0.0', - libp2p, - globalSigningPolicy: options.globalSigningPolicy - }) - } - - _publish (message) { - // Required to be implemented by the subclass - // Routing logic for the message - } -} -``` - -## API - -The interface aims to specify a common interface that all pubsub router implementation should follow. A pubsub router implementation should extend the [EventEmitter](https://nodejs.org/api/events.html#events_class_eventemitter). When peers receive pubsub messages, these messages will be emitted by the event emitter where the `eventName` will be the `topic` associated with the message. - -### Constructor - -The base class constructor configures the pubsub instance for use with a libp2p instance. It includes settings for logging, signature policies, etc. - -#### `new Pubsub({options})` - -##### Parameters - -| Name | Type | Description | Default | -| ----------------------------- | -------------------------------- | ----------------------------------------------- | -------------------- | -| options.libp2p | `Libp2p` | libp2p instance | required, no default | -| options.debugName | `string` | log namespace | required, no default | -| options.multicodecs | `string \| Array` | protocol identifier(s) | required, no default | -| options.globalSignaturePolicy | `'StrictSign' \| 'StrictNoSign'` | signature policy to be globally applied | `'StrictSign'` | -| options.canRelayMessage | `boolean` | if can relay messages if not subscribed | `false` | -| options.emitSelf | `boolean` | if `publish` should emit to self, if subscribed | `false` | - -### Start - -Starts the pubsub subsystem. The protocol will be registered to `libp2p`, which will result in pubsub being notified when peers who support the protocol connect/disconnect to `libp2p`. - -#### `pubsub.start()` - -### Stop - -Stops the pubsub subsystem. The protocol will be unregistered from `libp2p`, which will remove all listeners for the protocol and the established connections will be closed. - -#### `pubsub.stop()` - -### Publish - -Publish data message to pubsub topics. - -#### `pubsub.publish(topic, message)` - -##### Parameters - -| Name | Type | Description | -| ------- | ------------ | ------------------ | -| topic | `string` | pubsub topic | -| message | `Uint8Array` | message to publish | - -##### Returns - -| Type | Description | -| --------------- | ----------------------------------------------------- | -| `Promise` | resolves once the message is published to the network | - -### Subscribe - -Subscribe to the given topic. - -#### `pubsub.subscribe(topic)` - -##### Parameters - -| Name | Type | Description | -| ----- | -------- | ------------ | -| topic | `string` | pubsub topic | - -### Unsubscribe - -Unsubscribe from the given topic. - -#### `pubsub.unsubscribe(topic)` - -##### Parameters - -| Name | Type | Description | -| ----- | -------- | ------------ | -| topic | `string` | pubsub topic | - -### Get Topics - -Get the list of topics which the peer is subscribed to. - -#### `pubsub.getTopics()` - -##### Returns - -| Type | Description | -| --------------- | -------------------------- | -| `Array` | Array of subscribed topics | - -### Get Peers Subscribed to a topic - -Get a list of the [PeerId](https://github.com/libp2p/js-peer-id) strings that are subscribed to one topic. - -#### `pubsub.getSubscribers(topic)` - -##### Parameters - -| Name | Type | Description | -| ----- | -------- | ------------ | -| topic | `string` | pubsub topic | - -##### Returns - -| Type | Description | -| --------------- | ------------------------- | -| `Array` | Array of base-58 PeerId's | - -### Validate - -Validates a message according to the signature policy and topic-specific validation function. - -#### `pubsub.validate(message)` - -##### Parameters - -| Name | Type | Description | -| ------- | --------- | ---------------- | -| message | `Message` | a pubsub message | - -#### Returns - -| Type | Description | -| --------------- | -------------------------------- | -| `Promise` | resolves if the message is valid | - -## Test suite usage - -```js -'use strict' - -const tests = require('libp2p-interfaces-compliance-tests/pubsub') -const YourPubsubRouter = require('../src') - -describe('compliance', () => { - let peers - let pubsubNodes = [] - - tests({ - async setup (number = 1, options = {}) { - // Create number pubsub nodes with libp2p - peers = await createPeers({ number }) - - peers.forEach((peer) => { - const ps = new YourPubsubRouter(peer, options) - - pubsubNodes.push(ps) - }) - - return pubsubNodes - }, - async teardown () { - // Clean up any resources created by setup() - await Promise.all(pubsubNodes.map(ps => ps.stop())) - peers.length && await Promise.all(peers.map(peer => peer.stop())) - } - }) -}) -``` - -## API Docs - -- - -## License - -Licensed under either of - -- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / ) -- MIT ([LICENSE-MIT](LICENSE-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/packages/interface-pubsub/package.json b/packages/interface-pubsub/package.json deleted file mode 100644 index 264136f0e5..0000000000 --- a/packages/interface-pubsub/package.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "name": "@libp2p/interface-pubsub", - "version": "4.0.1", - "description": "PubSub interface for libp2p", - "license": "Apache-2.0 OR MIT", - "homepage": "https://github.com/libp2p/js-libp2p/tree/master/packages/interface-pubsub#readme", - "repository": { - "type": "git", - "url": "git+https://github.com/libp2p/js-libp2p.git" - }, - "bugs": { - "url": "https://github.com/libp2p/js-libp2p/issues" - }, - "keywords": [ - "interface", - "libp2p" - ], - "type": "module", - "types": "./dist/src/index.d.ts", - "files": [ - "src", - "dist", - "!dist/test", - "!**/*.tsbuildinfo" - ], - "exports": { - ".": { - "types": "./dist/src/index.d.ts", - "import": "./dist/src/index.js" - } - }, - "eslintConfig": { - "extends": "ipfs", - "parserOptions": { - "sourceType": "module" - } - }, - "scripts": { - "clean": "aegir clean", - "lint": "aegir lint", - "dep-check": "aegir dep-check", - "build": "aegir build" - }, - "dependencies": { - "@libp2p/interface-connection": "^5.0.0", - "@libp2p/interface-peer-id": "^2.0.0", - "@libp2p/interfaces": "^3.0.0", - "it-pushable": "^3.1.3", - "uint8arraylist": "^2.4.3" - }, - "devDependencies": { - "aegir": "^39.0.10" - }, - "typedoc": { - "entryPoint": "./src/index.ts" - } -} diff --git a/packages/interface-pubsub/src/index.ts b/packages/interface-pubsub/src/index.ts deleted file mode 100644 index 575bebfb47..0000000000 --- a/packages/interface-pubsub/src/index.ts +++ /dev/null @@ -1,269 +0,0 @@ -import type { Stream } from '@libp2p/interface-connection' -import type { PeerId } from '@libp2p/interface-peer-id' -import type { EventEmitter } from '@libp2p/interfaces/events' -import type { Pushable } from 'it-pushable' -import type { Uint8ArrayList } from 'uint8arraylist' - -/** - * On the producing side: - * * Build messages with the signature, key (from may be enough for certain inlineable public key types), from and seqno fields. - * - * On the consuming side: - * * Enforce the fields to be present, reject otherwise. - * * Propagate only if the fields are valid and signature can be verified, reject otherwise. - */ -export const StrictSign = 'StrictSign' - -/** - * On the producing side: - * * Build messages without the signature, key, from and seqno fields. - * * The corresponding protobuf key-value pairs are absent from the marshalled message, not just empty. - * - * On the consuming side: - * * Enforce the fields to be absent, reject otherwise. - * * Propagate only if the fields are absent, reject otherwise. - * * A message_id function will not be able to use the above fields, and should instead rely on the data field. A commonplace strategy is to calculate a hash. - */ -export const StrictNoSign = 'StrictNoSign' - -export type SignaturePolicy = typeof StrictSign | typeof StrictNoSign - -export interface SignedMessage { - type: 'signed' - from: PeerId - topic: string - data: Uint8Array - sequenceNumber: bigint - signature: Uint8Array - key: Uint8Array -} - -export interface UnsignedMessage { - type: 'unsigned' - topic: string - data: Uint8Array -} - -export type Message = SignedMessage | UnsignedMessage - -export interface PubSubRPCMessage { - from?: Uint8Array - topic?: string - data?: Uint8Array - sequenceNumber?: Uint8Array - signature?: Uint8Array - key?: Uint8Array -} - -export interface PubSubRPCSubscription { - subscribe?: boolean - topic?: string -} - -export interface PubSubRPC { - subscriptions: PubSubRPCSubscription[] - messages: PubSubRPCMessage[] -} - -export interface PeerStreams extends EventEmitter { - id: PeerId - protocol: string - outboundStream?: Pushable - inboundStream?: AsyncIterable - isWritable: boolean - - close: () => void - write: (buf: Uint8Array | Uint8ArrayList) => void - attachInboundStream: (stream: Stream) => AsyncIterable - attachOutboundStream: (stream: Stream) => Promise> -} - -export interface PubSubInit { - enabled?: boolean - - multicodecs?: string[] - - /** - * defines how signatures should be handled - */ - globalSignaturePolicy?: SignaturePolicy - - /** - * if can relay messages not subscribed - */ - canRelayMessage?: boolean - - /** - * if publish should emit to self, if subscribed - */ - emitSelf?: boolean - - /** - * handle this many incoming pubsub messages concurrently - */ - messageProcessingConcurrency?: number - - /** - * How many parallel incoming streams to allow on the pubsub protocol per-connection - */ - maxInboundStreams?: number - - /** - * How many parallel outgoing streams to allow on the pubsub protocol per-connection - */ - maxOutboundStreams?: number -} - -interface Subscription { - topic: string - subscribe: boolean -} - -export interface SubscriptionChangeData { - peerId: PeerId - subscriptions: Subscription[] -} - -export interface PubSubEvents { - 'subscription-change': CustomEvent - 'message': CustomEvent -} - -export interface PublishResult { - recipients: PeerId[] -} - -export enum TopicValidatorResult { - /** - * The message is considered valid, and it should be delivered and forwarded to the network - */ - Accept = 'accept', - /** - * The message is neither delivered nor forwarded to the network - */ - Ignore = 'ignore', - /** - * The message is considered invalid, and it should be rejected - */ - Reject = 'reject' -} - -export interface TopicValidatorFn { - (peer: PeerId, message: Message): TopicValidatorResult | Promise -} - -export interface PubSub = PubSubEvents> extends EventEmitter { - /** - * The global signature policy controls whether or not we sill send and receive - * signed or unsigned messages. - * - * Signed messages prevent spoofing message senders and should be preferred to - * using unsigned messages. - */ - globalSignaturePolicy: typeof StrictSign | typeof StrictNoSign - - /** - * A list of multicodecs that contain the pubsub protocol name. - */ - multicodecs: string[] - - /** - * Pubsub routers support message validators per topic, which will validate the message - * before its propagations. They are stored in a map where keys are the topic name and - * values are the validators. - * - * @example - * - * ```js - * const topic = 'topic' - * const validateMessage = (msgTopic, msg) => { - * const input = uint8ArrayToString(msg.data) - * const validInputs = ['a', 'b', 'c'] - * - * if (!validInputs.includes(input)) { - * throw new Error('no valid input received') - * } - * } - * libp2p.pubsub.topicValidators.set(topic, validateMessage) - * ``` - */ - topicValidators: Map - - getPeers: () => PeerId[] - - /** - * Gets a list of topics the node is subscribed to. - * - * ```js - * const topics = libp2p.pubsub.getTopics() - * ``` - */ - getTopics: () => string[] - - /** - * Subscribes to a pubsub topic. - * - * @example - * - * ```js - * const topic = 'topic' - * const handler = (msg) => { - * if (msg.topic === topic) { - * // msg.data - pubsub data received - * } - * } - * - * libp2p.pubsub.addEventListener('message', handler) - * libp2p.pubsub.subscribe(topic) - * ``` - */ - subscribe: (topic: string) => void - - /** - * Unsubscribes from a pubsub topic. - * - * @example - * - * ```js - * const topic = 'topic' - * const handler = (msg) => { - * // msg.data - pubsub data received - * } - * - * libp2p.pubsub.removeEventListener(topic handler) - * libp2p.pubsub.unsubscribe(topic) - * ``` - */ - unsubscribe: (topic: string) => void - - /** - * Gets a list of the PeerIds that are subscribed to one topic. - * - * @example - * - * ```js - * const peerIds = libp2p.pubsub.getSubscribers(topic) - * ``` - */ - getSubscribers: (topic: string) => PeerId[] - - /** - * Publishes messages to the given topic. - * - * @example - * - * ```js - * const topic = 'topic' - * const data = uint8ArrayFromString('data') - * - * await libp2p.pubsub.publish(topic, data) - * ``` - */ - publish: (topic: string, data: Uint8Array) => Promise -} - -export interface PeerStreamEvents { - 'stream:inbound': CustomEvent - 'stream:outbound': CustomEvent - 'close': CustomEvent -} diff --git a/packages/interface-pubsub/tsconfig.json b/packages/interface-pubsub/tsconfig.json deleted file mode 100644 index cbde3d05cb..0000000000 --- a/packages/interface-pubsub/tsconfig.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "extends": "aegir/src/config/tsconfig.aegir.json", - "compilerOptions": { - "outDir": "dist" - }, - "include": [ - "src" - ], - "references": [ - { - "path": "../interface-connection" - }, - { - "path": "../interface-peer-id" - }, - { - "path": "../interfaces" - } - ] -} diff --git a/packages/interface-record-compliance-tests/CHANGELOG.md b/packages/interface-record-compliance-tests/CHANGELOG.md deleted file mode 100644 index 930998e607..0000000000 --- a/packages/interface-record-compliance-tests/CHANGELOG.md +++ /dev/null @@ -1,63 +0,0 @@ -## [@libp2p/interface-record-compliance-tests-v2.0.5](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-record-compliance-tests-v2.0.4...@libp2p/interface-record-compliance-tests-v2.0.5) (2023-05-04) - - -### Dependencies - -* bump aegir from 38.1.8 to 39.0.5 ([#393](https://github.com/libp2p/js-libp2p-interfaces/issues/393)) ([31f3797](https://github.com/libp2p/js-libp2p-interfaces/commit/31f3797b24f7c23f3f16e9db3a230bd5f7cd5175)) - -## [@libp2p/interface-record-compliance-tests-v2.0.4](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-record-compliance-tests-v2.0.3...@libp2p/interface-record-compliance-tests-v2.0.4) (2023-01-18) - - -### Trivial Changes - -* remove lerna ([#330](https://github.com/libp2p/js-libp2p-interfaces/issues/330)) ([6678592](https://github.com/libp2p/js-libp2p-interfaces/commit/6678592dd0cf601a2671852f9d2a0aff5dee2b18)) - - -### Dependencies - -* bump aegir from 37.12.1 to 38.1.0 ([#335](https://github.com/libp2p/js-libp2p-interfaces/issues/335)) ([7368a36](https://github.com/libp2p/js-libp2p-interfaces/commit/7368a363423a08e8fa247dcb76ea13e4cf030d65)) - -## [@libp2p/interface-record-compliance-tests-v2.0.3](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-record-compliance-tests-v2.0.2...@libp2p/interface-record-compliance-tests-v2.0.3) (2022-12-16) - - -### Documentation - -* update project config ([#323](https://github.com/libp2p/js-libp2p-interfaces/issues/323)) ([0fc6a08](https://github.com/libp2p/js-libp2p-interfaces/commit/0fc6a08e9cdcefe361fe325281a3a2a03759ff59)) - -## [@libp2p/interface-record-compliance-tests-v2.0.2](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-record-compliance-tests-v2.0.1...@libp2p/interface-record-compliance-tests-v2.0.2) (2022-12-14) - - -### Bug Fixes - -* generate docs for all packages ([#321](https://github.com/libp2p/js-libp2p-interfaces/issues/321)) ([b6f8b32](https://github.com/libp2p/js-libp2p-interfaces/commit/b6f8b32a920c15a28fe021e6050e31aaae89d518)) - -## [@libp2p/interface-record-compliance-tests-v2.0.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-record-compliance-tests-v2.0.0...@libp2p/interface-record-compliance-tests-v2.0.1) (2022-11-05) - - -### Bug Fixes - -* update project config ([#311](https://github.com/libp2p/js-libp2p-interfaces/issues/311)) ([27dd0ce](https://github.com/libp2p/js-libp2p-interfaces/commit/27dd0ce3c249892ac69cbb24ddaf0b9f32385e37)) - -## [@libp2p/interface-record-compliance-tests-v2.0.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-record-compliance-tests-v1.0.1...@libp2p/interface-record-compliance-tests-v2.0.0) (2022-08-03) - - -### ⚠ BREAKING CHANGES - -* return type of .marshal method and several properties have changed - -### Bug Fixes - -* make record property and return types lists ([#276](https://github.com/libp2p/js-libp2p-interfaces/issues/276)) ([4df31d0](https://github.com/libp2p/js-libp2p-interfaces/commit/4df31d0a1da48dcffd3644e817b0641dca7bd111)) - - -### Trivial Changes - -* update project config ([#271](https://github.com/libp2p/js-libp2p-interfaces/issues/271)) ([59c0bf5](https://github.com/libp2p/js-libp2p-interfaces/commit/59c0bf5e0b05496fca2e4902632b61bb41fad9e9)) -* update sibling dependencies [skip ci] ([39eed35](https://github.com/libp2p/js-libp2p-interfaces/commit/39eed35c17920032ef821eede4d09fe14f8b30ab)) - -## [@libp2p/interface-record-compliance-tests-v1.0.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-record-compliance-tests-v1.0.0...@libp2p/interface-record-compliance-tests-v1.0.1) (2022-06-27) - - -### Trivial Changes - -* update deps ([#262](https://github.com/libp2p/js-libp2p-interfaces/issues/262)) ([51edf7d](https://github.com/libp2p/js-libp2p-interfaces/commit/51edf7d9b3765a6f75c915b1483ea345d0133a41)) diff --git a/packages/interface-record-compliance-tests/LICENSE b/packages/interface-record-compliance-tests/LICENSE deleted file mode 100644 index 20ce483c86..0000000000 --- a/packages/interface-record-compliance-tests/LICENSE +++ /dev/null @@ -1,4 +0,0 @@ -This project is dual licensed under MIT and Apache-2.0. - -MIT: https://www.opensource.org/licenses/mit -Apache-2.0: https://www.apache.org/licenses/license-2.0 diff --git a/packages/interface-record-compliance-tests/LICENSE-APACHE b/packages/interface-record-compliance-tests/LICENSE-APACHE deleted file mode 100644 index 14478a3b60..0000000000 --- a/packages/interface-record-compliance-tests/LICENSE-APACHE +++ /dev/null @@ -1,5 +0,0 @@ -Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - -http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. diff --git a/packages/interface-record-compliance-tests/LICENSE-MIT b/packages/interface-record-compliance-tests/LICENSE-MIT deleted file mode 100644 index 72dc60d84b..0000000000 --- a/packages/interface-record-compliance-tests/LICENSE-MIT +++ /dev/null @@ -1,19 +0,0 @@ -The MIT License (MIT) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/packages/interface-record-compliance-tests/README.md b/packages/interface-record-compliance-tests/README.md deleted file mode 100644 index 6998d8e790..0000000000 --- a/packages/interface-record-compliance-tests/README.md +++ /dev/null @@ -1,55 +0,0 @@ -# @libp2p/interface-record-compliance-tests - -[![libp2p.io](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](http://libp2p.io/) -[![Discuss](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg?style=flat-square)](https://discuss.libp2p.io) -[![codecov](https://img.shields.io/codecov/c/github/libp2p/js-libp2p.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p) -[![CI](https://img.shields.io/github/actions/workflow/status/libp2p/js-libp2p/main.yml?branch=master\&style=flat-square)](https://github.com/libp2p/js-libp2p/actions/workflows/main.yml?query=branch%3Amaster) - -> Compliance tests for implementations of the libp2p Record interface - -## Table of contents - -- [Install](#install) -- [Usage](#usage) -- [API Docs](#api-docs) -- [License](#license) -- [Contribution](#contribution) - -## Install - -```console -$ npm i @libp2p/interface-record-compliance-tests -``` - -## Usage - -```js -import tests from '@libp2p/interface-record-tests' - -describe('your record implementation', () => { - tests({ - // Options should be passed to your implementation - async setup (options) { - return new YourImplementation() - }, - async teardown () { - // cleanup resources created by setup() - } - }) -}) -``` - -## API Docs - -- - -## License - -Licensed under either of - -- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / ) -- MIT ([LICENSE-MIT](LICENSE-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/packages/interface-record-compliance-tests/package.json b/packages/interface-record-compliance-tests/package.json deleted file mode 100644 index 0e73648f1b..0000000000 --- a/packages/interface-record-compliance-tests/package.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - "name": "@libp2p/interface-record-compliance-tests", - "version": "2.0.5", - "description": "Compliance tests for implementations of the libp2p Record interface", - "license": "Apache-2.0 OR MIT", - "homepage": "https://github.com/libp2p/js-libp2p/tree/master/packages/interface-record-compliance-tests#readme", - "repository": { - "type": "git", - "url": "git+https://github.com/libp2p/js-libp2p.git" - }, - "bugs": { - "url": "https://github.com/libp2p/js-libp2p/issues" - }, - "keywords": [ - "interface", - "libp2p" - ], - "type": "module", - "types": "./dist/src/index.d.ts", - "files": [ - "src", - "dist", - "!dist/test", - "!**/*.tsbuildinfo" - ], - "exports": { - ".": { - "types": "./dist/src/index.d.ts", - "import": "./dist/src/index.js" - } - }, - "eslintConfig": { - "extends": "ipfs", - "parserOptions": { - "sourceType": "module" - } - }, - "scripts": { - "clean": "aegir clean", - "lint": "aegir lint", - "dep-check": "aegir dep-check", - "build": "aegir build" - }, - "dependencies": { - "@libp2p/interface-compliance-tests": "^3.0.0", - "@libp2p/interface-record": "^2.0.0", - "aegir": "^39.0.5" - }, - "typedoc": { - "entryPoint": "./src/index.ts" - } -} diff --git a/packages/interface-record-compliance-tests/src/index.ts b/packages/interface-record-compliance-tests/src/index.ts deleted file mode 100644 index a4d9e436c4..0000000000 --- a/packages/interface-record-compliance-tests/src/index.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { expect } from 'aegir/chai' -import type { TestSetup } from '@libp2p/interface-compliance-tests' -import type { Record } from '@libp2p/interface-record' - -export default (test: TestSetup): void => { - describe('record', () => { - let record: Record - - beforeEach(async () => { - record = await test.setup() - }) - - afterEach(async () => { - await test.teardown() - }) - - it('has domain and codec', () => { - expect(record.domain).to.exist() - expect(record.codec).to.exist() - }) - - it('is able to marshal', () => { - const rawData = record.marshal() - expect(rawData).to.have.property('byteLength') - }) - - it('is able to compare two records', () => { - const equals = record.equals(record) - expect(equals).to.eql(true) - }) - }) -} diff --git a/packages/interface-record-compliance-tests/tsconfig.json b/packages/interface-record-compliance-tests/tsconfig.json deleted file mode 100644 index 6ca17f6cde..0000000000 --- a/packages/interface-record-compliance-tests/tsconfig.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "extends": "aegir/src/config/tsconfig.aegir.json", - "compilerOptions": { - "outDir": "dist" - }, - "include": [ - "src", - "test" - ], - "references": [ - { - "path": "../interface-compliance-tests" - }, - { - "path": "../interface-record" - } - ] -} diff --git a/packages/interface-record/CHANGELOG.md b/packages/interface-record/CHANGELOG.md deleted file mode 100644 index eab614002e..0000000000 --- a/packages/interface-record/CHANGELOG.md +++ /dev/null @@ -1,95 +0,0 @@ -## [@libp2p/interface-record-v2.0.7](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-record-v2.0.6...@libp2p/interface-record-v2.0.7) (2023-05-04) - - -### Dependencies - -* bump aegir from 38.1.8 to 39.0.5 ([#393](https://github.com/libp2p/js-libp2p-interfaces/issues/393)) ([31f3797](https://github.com/libp2p/js-libp2p-interfaces/commit/31f3797b24f7c23f3f16e9db3a230bd5f7cd5175)) - -## [@libp2p/interface-record-v2.0.6](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-record-v2.0.5...@libp2p/interface-record-v2.0.6) (2023-01-18) - - -### Trivial Changes - -* remove lerna ([#330](https://github.com/libp2p/js-libp2p-interfaces/issues/330)) ([6678592](https://github.com/libp2p/js-libp2p-interfaces/commit/6678592dd0cf601a2671852f9d2a0aff5dee2b18)) - - -### Dependencies - -* bump aegir from 37.12.1 to 38.1.0 ([#335](https://github.com/libp2p/js-libp2p-interfaces/issues/335)) ([7368a36](https://github.com/libp2p/js-libp2p-interfaces/commit/7368a363423a08e8fa247dcb76ea13e4cf030d65)) - -## [@libp2p/interface-record-v2.0.5](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-record-v2.0.4...@libp2p/interface-record-v2.0.5) (2023-01-06) - - -### Dependencies - -* update sibling dependencies ([b50e621](https://github.com/libp2p/js-libp2p-interfaces/commit/b50e621d31a8b32affc3fadb9f97c4883d577f93)) - -## [@libp2p/interface-record-v2.0.4](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-record-v2.0.3...@libp2p/interface-record-v2.0.4) (2022-12-16) - - -### Documentation - -* update project config ([#323](https://github.com/libp2p/js-libp2p-interfaces/issues/323)) ([0fc6a08](https://github.com/libp2p/js-libp2p-interfaces/commit/0fc6a08e9cdcefe361fe325281a3a2a03759ff59)) - -## [@libp2p/interface-record-v2.0.3](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-record-v2.0.2...@libp2p/interface-record-v2.0.3) (2022-12-14) - - -### Bug Fixes - -* generate docs for all packages ([#321](https://github.com/libp2p/js-libp2p-interfaces/issues/321)) ([b6f8b32](https://github.com/libp2p/js-libp2p-interfaces/commit/b6f8b32a920c15a28fe021e6050e31aaae89d518)) - -## [@libp2p/interface-record-v2.0.2](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-record-v2.0.1...@libp2p/interface-record-v2.0.2) (2022-11-05) - - -### Bug Fixes - -* update project config ([#311](https://github.com/libp2p/js-libp2p-interfaces/issues/311)) ([27dd0ce](https://github.com/libp2p/js-libp2p-interfaces/commit/27dd0ce3c249892ac69cbb24ddaf0b9f32385e37)) - -## [@libp2p/interface-record-v2.0.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-record-v2.0.0...@libp2p/interface-record-v2.0.1) (2022-08-11) - - -### Bug Fixes - -* update marshal type ([#282](https://github.com/libp2p/js-libp2p-interfaces/issues/282)) ([2c04ff9](https://github.com/libp2p/js-libp2p-interfaces/commit/2c04ff98097ba33dc64878b788c6b9318d2ea98b)) - -## [@libp2p/interface-record-v2.0.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-record-v1.0.2...@libp2p/interface-record-v2.0.0) (2022-08-03) - - -### ⚠ BREAKING CHANGES - -* return type of .marshal method and several properties have changed - -### Bug Fixes - -* make record property and return types lists ([#276](https://github.com/libp2p/js-libp2p-interfaces/issues/276)) ([4df31d0](https://github.com/libp2p/js-libp2p-interfaces/commit/4df31d0a1da48dcffd3644e817b0641dca7bd111)) - - -### Trivial Changes - -* update project config ([#271](https://github.com/libp2p/js-libp2p-interfaces/issues/271)) ([59c0bf5](https://github.com/libp2p/js-libp2p-interfaces/commit/59c0bf5e0b05496fca2e4902632b61bb41fad9e9)) - -## [@libp2p/interface-record-v1.0.2](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-record-v1.0.1...@libp2p/interface-record-v1.0.2) (2022-06-27) - - -### Trivial Changes - -* update deps ([#262](https://github.com/libp2p/js-libp2p-interfaces/issues/262)) ([51edf7d](https://github.com/libp2p/js-libp2p-interfaces/commit/51edf7d9b3765a6f75c915b1483ea345d0133a41)) - -## [@libp2p/interface-record-v1.0.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-record-v1.0.0...@libp2p/interface-record-v1.0.1) (2022-06-14) - - -### Trivial Changes - -* update aegir ([#234](https://github.com/libp2p/js-libp2p-interfaces/issues/234)) ([3e03895](https://github.com/libp2p/js-libp2p-interfaces/commit/3e038959ecab6cfa3585df9ee179c0af7a61eda5)) -* update readmes ([#233](https://github.com/libp2p/js-libp2p-interfaces/issues/233)) ([ee7da38](https://github.com/libp2p/js-libp2p-interfaces/commit/ee7da38dccc08160d26c8436df8739ce7e0b340e)) - -## @libp2p/interface-record-v1.0.0 (2022-06-14) - - -### ⚠ BREAKING CHANGES - -* most modules have been split out of the `@libp2p/interfaces` and `@libp2p/interface-compliance-tests` packages - -### Trivial Changes - -* break modules apart ([#232](https://github.com/libp2p/js-libp2p-interfaces/issues/232)) ([385614e](https://github.com/libp2p/js-libp2p-interfaces/commit/385614e772329052ab17415c8bd421f65b01a61b)), closes [#226](https://github.com/libp2p/js-libp2p-interfaces/issues/226) diff --git a/packages/interface-record/LICENSE b/packages/interface-record/LICENSE deleted file mode 100644 index 20ce483c86..0000000000 --- a/packages/interface-record/LICENSE +++ /dev/null @@ -1,4 +0,0 @@ -This project is dual licensed under MIT and Apache-2.0. - -MIT: https://www.opensource.org/licenses/mit -Apache-2.0: https://www.apache.org/licenses/license-2.0 diff --git a/packages/interface-record/LICENSE-APACHE b/packages/interface-record/LICENSE-APACHE deleted file mode 100644 index 14478a3b60..0000000000 --- a/packages/interface-record/LICENSE-APACHE +++ /dev/null @@ -1,5 +0,0 @@ -Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - -http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. diff --git a/packages/interface-record/LICENSE-MIT b/packages/interface-record/LICENSE-MIT deleted file mode 100644 index 72dc60d84b..0000000000 --- a/packages/interface-record/LICENSE-MIT +++ /dev/null @@ -1,19 +0,0 @@ -The MIT License (MIT) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/packages/interface-record/README.md b/packages/interface-record/README.md deleted file mode 100644 index 11afe16bf6..0000000000 --- a/packages/interface-record/README.md +++ /dev/null @@ -1,132 +0,0 @@ -# @libp2p/interface-record - -[![libp2p.io](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](http://libp2p.io/) -[![Discuss](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg?style=flat-square)](https://discuss.libp2p.io) -[![codecov](https://img.shields.io/codecov/c/github/libp2p/js-libp2p.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p) -[![CI](https://img.shields.io/github/actions/workflow/status/libp2p/js-libp2p/main.yml?branch=master\&style=flat-square)](https://github.com/libp2p/js-libp2p/actions/workflows/main.yml?query=branch%3Amaster) - -> Record interface for libp2p - -## Table of contents - -- [Install](#install) -- [Usage](#usage) -- [Create Record](#create-record) -- [API](#api) - - [marshal](#marshal) - - [equals](#equals) -- [API Docs](#api-docs) -- [License](#license) -- [Contribution](#contribution) - -## Install - -```console -$ npm i @libp2p/interface-record -``` - -A libp2p node needs to store data in a public location (e.g. a DHT), or rely on potentially untrustworthy intermediaries to relay information. Libp2p provides an all-purpose data container called **envelope**, which includes a signature of the data, so that it its authenticity can be verified. - -The record represents the data that will be stored inside the **envelope** when distributing records across the network. The `interface-record` aims to guarantee that any type of record created is compliant with the libp2p **envelope**. - -Taking into account that a record might be used in different contexts, an **envelope** signature made for a specific purpose **must not** be considered valid for a different purpose. Accordingly, each record has a short and descriptive string representing the record use case, known as **domain**. The data to be signed will be prepended with the domain string, in order to create a domain signature. - -A record can also contain a Uint8Array codec (ideally registered as a [multicodec](https://github.com/multiformats/multicodec)). This codec will prefix the record data in the **envelope** , so that it can be deserialized deterministically. - -## Usage - -```js -const tests = require('libp2p-interfaces-compliance-tests/record') -describe('your record', () => { - tests({ - async setup () { - return YourRecord - }, - async teardown () { - // cleanup resources created by setup() - } - }) -}) -``` - -## Create Record - -```js -const multicodec = require('multicodec') -const Record = require('libp2p-interfaces/src/record') -const { fromString } = require('uint8arrays/from-string') -// const Protobuf = require('./record.proto') - -const ENVELOPE_DOMAIN_PEER_RECORD = 'libp2p-peer-record' -const ENVELOPE_PAYLOAD_TYPE_PEER_RECORD = fromString('0301', 'hex') - -/** - * @implements {import('libp2p-interfaces/src/record/types').Record} - */ -class PeerRecord { - constructor (peerId, multiaddrs, seqNumber) { - this.domain = ENVELOPE_DOMAIN_PEER_RECORD - this.codec = ENVELOPE_PAYLOAD_TYPE_PEER_RECORD - } - - /** - * Marshal a record to be used in an envelope. - * - * @returns {Uint8Array} - */ - marshal () { - // Implement and return using Protobuf - } - - /** - * Returns true if `this` record equals the `other`. - * - * @param {PeerRecord} other - * @returns {other is Record} - */ - equals (other) { - // Verify - } -} -``` - -## API - -### marshal - -- `record.marshal()` - -Marshal a record to be used in a libp2p envelope. - -**Returns** - -It returns a `Protobuf` containing the record data. - -### equals - -- `record.equals(other)` - -Verifies if the other Record is identical to this one. - -**Parameters** - -- other is a `Record` to compare with the current instance. - -**Returns** - -- `other is Record` - -## API Docs - -- - -## License - -Licensed under either of - -- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / ) -- MIT ([LICENSE-MIT](LICENSE-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/packages/interface-record/package.json b/packages/interface-record/package.json deleted file mode 100644 index 7df588efd1..0000000000 --- a/packages/interface-record/package.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "name": "@libp2p/interface-record", - "version": "2.0.7", - "description": "Record interface for libp2p", - "license": "Apache-2.0 OR MIT", - "homepage": "https://github.com/libp2p/js-libp2p/tree/master/packages/interface-record#readme", - "repository": { - "type": "git", - "url": "git+https://github.com/libp2p/js-libp2p.git" - }, - "bugs": { - "url": "https://github.com/libp2p/js-libp2p/issues" - }, - "keywords": [ - "interface", - "libp2p" - ], - "type": "module", - "types": "./dist/src/index.d.ts", - "files": [ - "src", - "dist", - "!dist/test", - "!**/*.tsbuildinfo" - ], - "exports": { - ".": { - "types": "./dist/src/index.d.ts", - "import": "./dist/src/index.js" - } - }, - "eslintConfig": { - "extends": "ipfs", - "parserOptions": { - "sourceType": "module" - } - }, - "scripts": { - "clean": "aegir clean", - "lint": "aegir lint", - "dep-check": "aegir dep-check", - "build": "aegir build" - }, - "dependencies": { - "@libp2p/interface-peer-id": "^2.0.0", - "uint8arraylist": "^2.4.3" - }, - "devDependencies": { - "aegir": "^39.0.10" - }, - "typedoc": { - "entryPoint": "./src/index.ts" - } -} diff --git a/packages/interface-record/tsconfig.json b/packages/interface-record/tsconfig.json deleted file mode 100644 index 9da008198f..0000000000 --- a/packages/interface-record/tsconfig.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "extends": "aegir/src/config/tsconfig.aegir.json", - "compilerOptions": { - "outDir": "dist" - }, - "include": [ - "src", - "test" - ], - "references": [ - { - "path": "../interface-peer-id" - } - ] -} diff --git a/packages/interface-registrar/CHANGELOG.md b/packages/interface-registrar/CHANGELOG.md deleted file mode 100644 index 164110e7c7..0000000000 --- a/packages/interface-registrar/CHANGELOG.md +++ /dev/null @@ -1,116 +0,0 @@ -## [@libp2p/interface-registrar-v2.0.12](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-registrar-v2.0.11...@libp2p/interface-registrar-v2.0.12) (2023-05-04) - - -### Dependencies - -* bump aegir from 38.1.8 to 39.0.5 ([#393](https://github.com/libp2p/js-libp2p-interfaces/issues/393)) ([31f3797](https://github.com/libp2p/js-libp2p-interfaces/commit/31f3797b24f7c23f3f16e9db3a230bd5f7cd5175)) - -## [@libp2p/interface-registrar-v2.0.11](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-registrar-v2.0.10...@libp2p/interface-registrar-v2.0.11) (2023-04-18) - - -### Dependencies - -* update sibling dependencies ([2f52a28](https://github.com/libp2p/js-libp2p-interfaces/commit/2f52a284b59c0a88b040f86da1f5d3f044727f2c)) - -## [@libp2p/interface-registrar-v2.0.10](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-registrar-v2.0.9...@libp2p/interface-registrar-v2.0.10) (2023-04-11) - - -### Dependencies - -* update sibling dependencies ([b034810](https://github.com/libp2p/js-libp2p-interfaces/commit/b0348102e41dc18166e70063f4708a2b3544f4b6)) - -## [@libp2p/interface-registrar-v2.0.9](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-registrar-v2.0.8...@libp2p/interface-registrar-v2.0.9) (2023-03-09) - - -### Documentation - -* update comments on registrar interface ([#348](https://github.com/libp2p/js-libp2p-interfaces/issues/348)) ([54e3af9](https://github.com/libp2p/js-libp2p-interfaces/commit/54e3af9cfbdfd27d1c3797b957a97931153337c6)) - -## [@libp2p/interface-registrar-v2.0.8](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-registrar-v2.0.7...@libp2p/interface-registrar-v2.0.8) (2023-01-18) - - -### Trivial Changes - -* remove lerna ([#330](https://github.com/libp2p/js-libp2p-interfaces/issues/330)) ([6678592](https://github.com/libp2p/js-libp2p-interfaces/commit/6678592dd0cf601a2671852f9d2a0aff5dee2b18)) - - -### Dependencies - -* bump aegir from 37.12.1 to 38.1.0 ([#335](https://github.com/libp2p/js-libp2p-interfaces/issues/335)) ([7368a36](https://github.com/libp2p/js-libp2p-interfaces/commit/7368a363423a08e8fa247dcb76ea13e4cf030d65)) - -## [@libp2p/interface-registrar-v2.0.7](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-registrar-v2.0.6...@libp2p/interface-registrar-v2.0.7) (2023-01-06) - - -### Dependencies - -* update sibling dependencies ([b50e621](https://github.com/libp2p/js-libp2p-interfaces/commit/b50e621d31a8b32affc3fadb9f97c4883d577f93)) - -## [@libp2p/interface-registrar-v2.0.6](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-registrar-v2.0.5...@libp2p/interface-registrar-v2.0.6) (2022-12-16) - - -### Documentation - -* update project config ([#323](https://github.com/libp2p/js-libp2p-interfaces/issues/323)) ([0fc6a08](https://github.com/libp2p/js-libp2p-interfaces/commit/0fc6a08e9cdcefe361fe325281a3a2a03759ff59)) - -## [@libp2p/interface-registrar-v2.0.5](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-registrar-v2.0.4...@libp2p/interface-registrar-v2.0.5) (2022-12-14) - - -### Bug Fixes - -* generate docs for all packages ([#321](https://github.com/libp2p/js-libp2p-interfaces/issues/321)) ([b6f8b32](https://github.com/libp2p/js-libp2p-interfaces/commit/b6f8b32a920c15a28fe021e6050e31aaae89d518)) - -## [@libp2p/interface-registrar-v2.0.4](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-registrar-v2.0.3...@libp2p/interface-registrar-v2.0.4) (2022-11-05) - - -### Bug Fixes - -* update project config ([#311](https://github.com/libp2p/js-libp2p-interfaces/issues/311)) ([27dd0ce](https://github.com/libp2p/js-libp2p-interfaces/commit/27dd0ce3c249892ac69cbb24ddaf0b9f32385e37)) - -## [@libp2p/interface-registrar-v2.0.3](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-registrar-v2.0.2...@libp2p/interface-registrar-v2.0.3) (2022-08-07) - - -### Trivial Changes - -* update project config ([#271](https://github.com/libp2p/js-libp2p-interfaces/issues/271)) ([59c0bf5](https://github.com/libp2p/js-libp2p-interfaces/commit/59c0bf5e0b05496fca2e4902632b61bb41fad9e9)) - - -### Dependencies - -* update sibling dependencies ([f859920](https://github.com/libp2p/js-libp2p-interfaces/commit/f859920423587ae797ac90ccaa3af8bdf60ae549)) - -## [@libp2p/interface-registrar-v2.0.2](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-registrar-v2.0.1...@libp2p/interface-registrar-v2.0.2) (2022-06-27) - - -### Trivial Changes - -* update deps ([#262](https://github.com/libp2p/js-libp2p-interfaces/issues/262)) ([51edf7d](https://github.com/libp2p/js-libp2p-interfaces/commit/51edf7d9b3765a6f75c915b1483ea345d0133a41)) - -## [@libp2p/interface-registrar-v2.0.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-registrar-v2.0.0...@libp2p/interface-registrar-v2.0.1) (2022-06-17) - - -### Bug Fixes - -* update stream handler args ([#247](https://github.com/libp2p/js-libp2p-interfaces/issues/247)) ([d29e134](https://github.com/libp2p/js-libp2p-interfaces/commit/d29e134bd70295c725bfd627d5887954d1a278ae)) - -## [@libp2p/interface-registrar-v2.0.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-registrar-v1.1.0...@libp2p/interface-registrar-v2.0.0) (2022-06-16) - - -### ⚠ BREAKING CHANGES - -* The Connection and Stream APIs have been updated - -### Features - -* store stream data on the stream, track the stream direction ([#245](https://github.com/libp2p/js-libp2p-interfaces/issues/245)) ([6d74d2f](https://github.com/libp2p/js-libp2p-interfaces/commit/6d74d2f9f344fb4d6741ba0d35263ebe351a4c65)) - - -### Trivial Changes - -* update deps ([545264f](https://github.com/libp2p/js-libp2p-interfaces/commit/545264f87a58394d2a7da77e93f3a596e889238f)) - -## [@libp2p/interface-registrar-v1.1.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-registrar-v1.0.0...@libp2p/interface-registrar-v1.1.0) (2022-06-16) - - -### Features - -* define stream limits as input/output ([#240](https://github.com/libp2p/js-libp2p-interfaces/issues/240)) ([554fe95](https://github.com/libp2p/js-libp2p-interfaces/commit/554fe95865c4851fcef3b311d80d44f82a613969)) diff --git a/packages/interface-registrar/LICENSE b/packages/interface-registrar/LICENSE deleted file mode 100644 index 20ce483c86..0000000000 --- a/packages/interface-registrar/LICENSE +++ /dev/null @@ -1,4 +0,0 @@ -This project is dual licensed under MIT and Apache-2.0. - -MIT: https://www.opensource.org/licenses/mit -Apache-2.0: https://www.apache.org/licenses/license-2.0 diff --git a/packages/interface-registrar/LICENSE-APACHE b/packages/interface-registrar/LICENSE-APACHE deleted file mode 100644 index 14478a3b60..0000000000 --- a/packages/interface-registrar/LICENSE-APACHE +++ /dev/null @@ -1,5 +0,0 @@ -Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - -http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. diff --git a/packages/interface-registrar/LICENSE-MIT b/packages/interface-registrar/LICENSE-MIT deleted file mode 100644 index 72dc60d84b..0000000000 --- a/packages/interface-registrar/LICENSE-MIT +++ /dev/null @@ -1,19 +0,0 @@ -The MIT License (MIT) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/packages/interface-registrar/README.md b/packages/interface-registrar/README.md deleted file mode 100644 index 8611ce6f23..0000000000 --- a/packages/interface-registrar/README.md +++ /dev/null @@ -1,36 +0,0 @@ -# @libp2p/interface-registrar - -[![libp2p.io](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](http://libp2p.io/) -[![Discuss](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg?style=flat-square)](https://discuss.libp2p.io) -[![codecov](https://img.shields.io/codecov/c/github/libp2p/js-libp2p.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p) -[![CI](https://img.shields.io/github/actions/workflow/status/libp2p/js-libp2p/main.yml?branch=master\&style=flat-square)](https://github.com/libp2p/js-libp2p/actions/workflows/main.yml?query=branch%3Amaster) - -> Registrar interface for libp2p - -## Table of contents - -- [Install](#install) -- [API Docs](#api-docs) -- [License](#license) -- [Contribution](#contribution) - -## Install - -```console -$ npm i @libp2p/interface-registrar -``` - -## API Docs - -- - -## License - -Licensed under either of - -- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / ) -- MIT ([LICENSE-MIT](LICENSE-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/packages/interface-registrar/package.json b/packages/interface-registrar/package.json deleted file mode 100644 index eda94ddd25..0000000000 --- a/packages/interface-registrar/package.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "name": "@libp2p/interface-registrar", - "version": "2.0.12", - "description": "Registrar interface for libp2p", - "license": "Apache-2.0 OR MIT", - "homepage": "https://github.com/libp2p/js-libp2p/tree/master/packages/interface-registrar#readme", - "repository": { - "type": "git", - "url": "git+https://github.com/libp2p/js-libp2p.git" - }, - "bugs": { - "url": "https://github.com/libp2p/js-libp2p/issues" - }, - "keywords": [ - "interface", - "libp2p" - ], - "type": "module", - "types": "./dist/src/index.d.ts", - "files": [ - "src", - "dist", - "!dist/test", - "!**/*.tsbuildinfo" - ], - "exports": { - ".": { - "types": "./dist/src/index.d.ts", - "import": "./dist/src/index.js" - } - }, - "eslintConfig": { - "extends": "ipfs", - "parserOptions": { - "sourceType": "module" - } - }, - "scripts": { - "clean": "aegir clean", - "lint": "aegir lint", - "dep-check": "aegir dep-check", - "build": "aegir build" - }, - "dependencies": { - "@libp2p/interface-connection": "^5.0.0", - "@libp2p/interface-peer-id": "^2.0.0" - }, - "devDependencies": { - "aegir": "^39.0.10" - }, - "typedoc": { - "entryPoint": "./src/index.ts" - } -} diff --git a/packages/interface-registrar/tsconfig.json b/packages/interface-registrar/tsconfig.json deleted file mode 100644 index 92a8421e08..0000000000 --- a/packages/interface-registrar/tsconfig.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "extends": "aegir/src/config/tsconfig.aegir.json", - "compilerOptions": { - "outDir": "dist" - }, - "include": [ - "src", - "test" - ], - "references": [ - { - "path": "../interface-connection" - }, - { - "path": "../interface-peer-id" - } - ] -} diff --git a/packages/interface-stream-muxer-compliance-tests/CHANGELOG.md b/packages/interface-stream-muxer-compliance-tests/CHANGELOG.md deleted file mode 100644 index 926e438243..0000000000 --- a/packages/interface-stream-muxer-compliance-tests/CHANGELOG.md +++ /dev/null @@ -1,239 +0,0 @@ -## [@libp2p/interface-stream-muxer-compliance-tests-v7.0.3](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-stream-muxer-compliance-tests-v7.0.2...@libp2p/interface-stream-muxer-compliance-tests-v7.0.3) (2023-05-17) - - -### Bug Fixes - -* handle thrown errors ([#405](https://github.com/libp2p/js-libp2p-interfaces/issues/405)) ([57dfaec](https://github.com/libp2p/js-libp2p-interfaces/commit/57dfaec4c98f13a09fcfa2541c21b163a30c11d2)) - -## [@libp2p/interface-stream-muxer-compliance-tests-v7.0.2](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-stream-muxer-compliance-tests-v7.0.1...@libp2p/interface-stream-muxer-compliance-tests-v7.0.2) (2023-05-04) - - -### Dependencies - -* bump aegir from 38.1.8 to 39.0.5 ([#393](https://github.com/libp2p/js-libp2p-interfaces/issues/393)) ([31f3797](https://github.com/libp2p/js-libp2p-interfaces/commit/31f3797b24f7c23f3f16e9db3a230bd5f7cd5175)) - -## [@libp2p/interface-stream-muxer-compliance-tests-v7.0.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-stream-muxer-compliance-tests-v7.0.0...@libp2p/interface-stream-muxer-compliance-tests-v7.0.1) (2023-04-18) - - -### Dependencies - -* update abortable iterator to 5.x.x ([#379](https://github.com/libp2p/js-libp2p-interfaces/issues/379)) ([d405e5b](https://github.com/libp2p/js-libp2p-interfaces/commit/d405e5b5db624d97f47588ef55c379debccfd160)) - -## [@libp2p/interface-stream-muxer-compliance-tests-v7.0.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-stream-muxer-compliance-tests-v6.0.12...@libp2p/interface-stream-muxer-compliance-tests-v7.0.0) (2023-04-18) - - -### ⚠ BREAKING CHANGES - -* bump it-stream-types from 1.0.5 to 2.0.1 (#362) - -### Dependencies - -* bump it-stream-types from 1.0.5 to 2.0.1 ([#362](https://github.com/libp2p/js-libp2p-interfaces/issues/362)) ([cdc7747](https://github.com/libp2p/js-libp2p-interfaces/commit/cdc774792beead63e0ded96bd6c23de0335a49e3)) -* update sibling dependencies ([e95dcc2](https://github.com/libp2p/js-libp2p-interfaces/commit/e95dcc28f0a8b42457a44155eb0dfb3d813b03c8)) -* update sibling dependencies ([2f52a28](https://github.com/libp2p/js-libp2p-interfaces/commit/2f52a284b59c0a88b040f86da1f5d3f044727f2c)) - -## [@libp2p/interface-stream-muxer-compliance-tests-v6.0.12](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-stream-muxer-compliance-tests-v6.0.11...@libp2p/interface-stream-muxer-compliance-tests-v6.0.12) (2023-04-14) - - -### Dependencies - -* bump it-drain from 2.0.1 to 3.0.1 ([#358](https://github.com/libp2p/js-libp2p-interfaces/issues/358)) ([ec050fa](https://github.com/libp2p/js-libp2p-interfaces/commit/ec050fa215a2ee845366c95d763ff009b247e986)) - -## [@libp2p/interface-stream-muxer-compliance-tests-v6.0.11](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-stream-muxer-compliance-tests-v6.0.10...@libp2p/interface-stream-muxer-compliance-tests-v6.0.11) (2023-04-13) - - -### Dependencies - -* bump it-all from 2.0.1 to 3.0.1 ([#360](https://github.com/libp2p/js-libp2p-interfaces/issues/360)) ([1b439eb](https://github.com/libp2p/js-libp2p-interfaces/commit/1b439eb7503ed7e31e77f17ce0a685ea78d94442)) -* bump it-map from 2.0.1 to 3.0.2 ([#361](https://github.com/libp2p/js-libp2p-interfaces/issues/361)) ([c016269](https://github.com/libp2p/js-libp2p-interfaces/commit/c01626912eae85969bf2b1027b68a5242a4ae4d4)) - -## [@libp2p/interface-stream-muxer-compliance-tests-v6.0.10](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-stream-muxer-compliance-tests-v6.0.9...@libp2p/interface-stream-muxer-compliance-tests-v6.0.10) (2023-04-11) - - -### Dependencies - -* update sibling dependencies ([b034810](https://github.com/libp2p/js-libp2p-interfaces/commit/b0348102e41dc18166e70063f4708a2b3544f4b6)) - -## [@libp2p/interface-stream-muxer-compliance-tests-v6.0.9](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-stream-muxer-compliance-tests-v6.0.8...@libp2p/interface-stream-muxer-compliance-tests-v6.0.9) (2023-04-04) - - -### Dependencies - -* bump it-pipe from 2.0.5 to 3.0.1 ([#363](https://github.com/libp2p/js-libp2p-interfaces/issues/363)) ([625817b](https://github.com/libp2p/js-libp2p-interfaces/commit/625817b0bbbee276983c40a0604c8810a25abe8f)) - -## [@libp2p/interface-stream-muxer-compliance-tests-v6.0.8](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-stream-muxer-compliance-tests-v6.0.7...@libp2p/interface-stream-muxer-compliance-tests-v6.0.8) (2023-03-07) - - -### Bug Fixes - -* dispatch connection event from mock upgrader ([#345](https://github.com/libp2p/js-libp2p-interfaces/issues/345)) ([b691b1f](https://github.com/libp2p/js-libp2p-interfaces/commit/b691b1fa28e23b549c32e89d6b7c98d6a50c7b8f)) - -## [@libp2p/interface-stream-muxer-compliance-tests-v6.0.7](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-stream-muxer-compliance-tests-v6.0.6...@libp2p/interface-stream-muxer-compliance-tests-v6.0.7) (2023-01-18) - - -### Trivial Changes - -* remove lerna ([#330](https://github.com/libp2p/js-libp2p-interfaces/issues/330)) ([6678592](https://github.com/libp2p/js-libp2p-interfaces/commit/6678592dd0cf601a2671852f9d2a0aff5dee2b18)) - - -### Dependencies - -* bump aegir from 37.12.1 to 38.1.0 ([#335](https://github.com/libp2p/js-libp2p-interfaces/issues/335)) ([7368a36](https://github.com/libp2p/js-libp2p-interfaces/commit/7368a363423a08e8fa247dcb76ea13e4cf030d65)) - -## [@libp2p/interface-stream-muxer-compliance-tests-v6.0.6](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-stream-muxer-compliance-tests-v6.0.5...@libp2p/interface-stream-muxer-compliance-tests-v6.0.6) (2022-12-16) - - -### Documentation - -* update project config ([#323](https://github.com/libp2p/js-libp2p-interfaces/issues/323)) ([0fc6a08](https://github.com/libp2p/js-libp2p-interfaces/commit/0fc6a08e9cdcefe361fe325281a3a2a03759ff59)) - -## [@libp2p/interface-stream-muxer-compliance-tests-v6.0.5](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-stream-muxer-compliance-tests-v6.0.4...@libp2p/interface-stream-muxer-compliance-tests-v6.0.5) (2022-12-14) - - -### Bug Fixes - -* generate docs for all packages ([#321](https://github.com/libp2p/js-libp2p-interfaces/issues/321)) ([b6f8b32](https://github.com/libp2p/js-libp2p-interfaces/commit/b6f8b32a920c15a28fe021e6050e31aaae89d518)) - -## [@libp2p/interface-stream-muxer-compliance-tests-v6.0.4](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-stream-muxer-compliance-tests-v6.0.3...@libp2p/interface-stream-muxer-compliance-tests-v6.0.4) (2022-11-05) - - -### Bug Fixes - -* update project config ([#311](https://github.com/libp2p/js-libp2p-interfaces/issues/311)) ([27dd0ce](https://github.com/libp2p/js-libp2p-interfaces/commit/27dd0ce3c249892ac69cbb24ddaf0b9f32385e37)) - -## [@libp2p/interface-stream-muxer-compliance-tests-v6.0.3](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-stream-muxer-compliance-tests-v6.0.2...@libp2p/interface-stream-muxer-compliance-tests-v6.0.3) (2022-10-18) - - -### Dependencies - -* bump lerna from 5.6.2 to 6.0.1 ([#307](https://github.com/libp2p/js-libp2p-interfaces/issues/307)) ([d203019](https://github.com/libp2p/js-libp2p-interfaces/commit/d2030195b9689c504c148a722027d93af4fdc26d)) - -## [@libp2p/interface-stream-muxer-compliance-tests-v6.0.2](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-stream-muxer-compliance-tests-v6.0.1...@libp2p/interface-stream-muxer-compliance-tests-v6.0.2) (2022-10-17) - - -### Dependencies - -* bump it-drain from 1.0.5 to 2.0.0 ([#305](https://github.com/libp2p/js-libp2p-interfaces/issues/305)) ([67e418c](https://github.com/libp2p/js-libp2p-interfaces/commit/67e418c2abeccfc06e715c1373485f012df06fdb)) - -## [@libp2p/interface-stream-muxer-compliance-tests-v6.0.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-stream-muxer-compliance-tests-v6.0.0...@libp2p/interface-stream-muxer-compliance-tests-v6.0.1) (2022-10-17) - - -### Dependencies - -* bump it-all from 1.0.6 to 2.0.0 ([#306](https://github.com/libp2p/js-libp2p-interfaces/issues/306)) ([7c7b388](https://github.com/libp2p/js-libp2p-interfaces/commit/7c7b3882e33a064b8e5588d6befd823360347464)) -* bump it-map from 1.0.6 to 2.0.0 ([#304](https://github.com/libp2p/js-libp2p-interfaces/issues/304)) ([8a1f7f4](https://github.com/libp2p/js-libp2p-interfaces/commit/8a1f7f4241d3acf250ee81a2265a00f58e80e6ed)) - -## [@libp2p/interface-stream-muxer-compliance-tests-v6.0.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-stream-muxer-compliance-tests-v5.0.0...@libp2p/interface-stream-muxer-compliance-tests-v6.0.0) (2022-10-12) - - -### ⚠ BREAKING CHANGES - -* modules no longer implement `Initializable` instead switching to constructor injection - -### Bug Fixes - -* remove @libp2p/components ([#301](https://github.com/libp2p/js-libp2p-interfaces/issues/301)) ([1d37dc6](https://github.com/libp2p/js-libp2p-interfaces/commit/1d37dc6d3197838a71895d5769ad8bba6eb38fd3)) - -## [@libp2p/interface-stream-muxer-compliance-tests-v5.0.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-stream-muxer-compliance-tests-v4.0.0...@libp2p/interface-stream-muxer-compliance-tests-v5.0.0) (2022-10-06) - - -### ⚠ BREAKING CHANGES - -* the return type of StreamMuxer.newStream can now return a promise - -Co-authored-by: Marco Munizaga - -### Features - -* add upgrader options ([#290](https://github.com/libp2p/js-libp2p-interfaces/issues/290)) ([c502b66](https://github.com/libp2p/js-libp2p-interfaces/commit/c502b66d87020eb8e2768c49be17392c55503f69)) - - -### Dependencies - -* update sibling dependencies ([66b4993](https://github.com/libp2p/js-libp2p-interfaces/commit/66b49938a09eeb12bf8ec8d78938d5cffd6ec134)) - -## [@libp2p/interface-stream-muxer-compliance-tests-v4.0.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-stream-muxer-compliance-tests-v3.0.1...@libp2p/interface-stream-muxer-compliance-tests-v4.0.0) (2022-08-07) - - -### ⚠ BREAKING CHANGES - -* change stream muxer interface (#279) - -### Features - -* change stream muxer interface ([#279](https://github.com/libp2p/js-libp2p-interfaces/issues/279)) ([1ebe269](https://github.com/libp2p/js-libp2p-interfaces/commit/1ebe26988b6a286f36a4fc5177f502cfb60368a1)) - - -### Trivial Changes - -* update project config ([#271](https://github.com/libp2p/js-libp2p-interfaces/issues/271)) ([59c0bf5](https://github.com/libp2p/js-libp2p-interfaces/commit/59c0bf5e0b05496fca2e4902632b61bb41fad9e9)) - - -### Dependencies - -* update sibling dependencies ([f859920](https://github.com/libp2p/js-libp2p-interfaces/commit/f859920423587ae797ac90ccaa3af8bdf60ae549)) - -## [@libp2p/interface-stream-muxer-compliance-tests-v3.0.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-stream-muxer-compliance-tests-v3.0.0...@libp2p/interface-stream-muxer-compliance-tests-v3.0.1) (2022-06-27) - - -### Trivial Changes - -* update deps ([#262](https://github.com/libp2p/js-libp2p-interfaces/issues/262)) ([51edf7d](https://github.com/libp2p/js-libp2p-interfaces/commit/51edf7d9b3765a6f75c915b1483ea345d0133a41)) - -## [@libp2p/interface-stream-muxer-compliance-tests-v3.0.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-stream-muxer-compliance-tests-v2.1.0...@libp2p/interface-stream-muxer-compliance-tests-v3.0.0) (2022-06-24) - - -### ⚠ BREAKING CHANGES - -* StreamMuxer now has a `close` method - -### Features - -* add stream muxer close ([#254](https://github.com/libp2p/js-libp2p-interfaces/issues/254)) ([d1f511e](https://github.com/libp2p/js-libp2p-interfaces/commit/d1f511e4b5857769c4eddf902288dc69fcb667b4)) - - -### Trivial Changes - -* update sibling dependencies [skip ci] ([c522241](https://github.com/libp2p/js-libp2p-interfaces/commit/c522241b08cfef3995efb5415104f46521dcd3b7)) - -## [@libp2p/interface-stream-muxer-compliance-tests-v2.1.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-stream-muxer-compliance-tests-v2.0.0...@libp2p/interface-stream-muxer-compliance-tests-v2.1.0) (2022-06-21) - - -### Features - -* add direction to StreamMuxerInit ([#253](https://github.com/libp2p/js-libp2p-interfaces/issues/253)) ([6d34d75](https://github.com/libp2p/js-libp2p-interfaces/commit/6d34d755ff4e798d52945f1f099052bdd6a83f2b)) - -## [@libp2p/interface-stream-muxer-compliance-tests-v2.0.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-stream-muxer-compliance-tests-v1.0.2...@libp2p/interface-stream-muxer-compliance-tests-v2.0.0) (2022-06-16) - - -### ⚠ BREAKING CHANGES - -* The Connection and Stream APIs have been updated - -### Features - -* store stream data on the stream, track the stream direction ([#245](https://github.com/libp2p/js-libp2p-interfaces/issues/245)) ([6d74d2f](https://github.com/libp2p/js-libp2p-interfaces/commit/6d74d2f9f344fb4d6741ba0d35263ebe351a4c65)) - - -### Trivial Changes - -* update deps ([545264f](https://github.com/libp2p/js-libp2p-interfaces/commit/545264f87a58394d2a7da77e93f3a596e889238f)) - -## [@libp2p/interface-stream-muxer-compliance-tests-v1.0.2](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-stream-muxer-compliance-tests-v1.0.1...@libp2p/interface-stream-muxer-compliance-tests-v1.0.2) (2022-06-15) - - -### Bug Fixes - -* increase timeout for firefox ([#239](https://github.com/libp2p/js-libp2p-interfaces/issues/239)) ([e7a62b4](https://github.com/libp2p/js-libp2p-interfaces/commit/e7a62b4457ff96788ef4c445ed1549ce5d832b4e)) - -## [@libp2p/interface-stream-muxer-compliance-tests-v1.0.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-stream-muxer-compliance-tests-v1.0.0...@libp2p/interface-stream-muxer-compliance-tests-v1.0.1) (2022-06-14) - - -### Bug Fixes - -* remove components from muxer factory function ([#238](https://github.com/libp2p/js-libp2p-interfaces/issues/238)) ([e4dab30](https://github.com/libp2p/js-libp2p-interfaces/commit/e4dab306d9bf406b9bb3cb92644e28cf81f7bda6)) - - -### Trivial Changes - -* update components module ([#235](https://github.com/libp2p/js-libp2p-interfaces/issues/235)) ([5844207](https://github.com/libp2p/js-libp2p-interfaces/commit/58442070af59aa852c83ec3aecdbd1d2c646b018)) diff --git a/packages/interface-stream-muxer-compliance-tests/LICENSE b/packages/interface-stream-muxer-compliance-tests/LICENSE deleted file mode 100644 index 20ce483c86..0000000000 --- a/packages/interface-stream-muxer-compliance-tests/LICENSE +++ /dev/null @@ -1,4 +0,0 @@ -This project is dual licensed under MIT and Apache-2.0. - -MIT: https://www.opensource.org/licenses/mit -Apache-2.0: https://www.apache.org/licenses/license-2.0 diff --git a/packages/interface-stream-muxer-compliance-tests/LICENSE-APACHE b/packages/interface-stream-muxer-compliance-tests/LICENSE-APACHE deleted file mode 100644 index 14478a3b60..0000000000 --- a/packages/interface-stream-muxer-compliance-tests/LICENSE-APACHE +++ /dev/null @@ -1,5 +0,0 @@ -Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - -http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. diff --git a/packages/interface-stream-muxer-compliance-tests/LICENSE-MIT b/packages/interface-stream-muxer-compliance-tests/LICENSE-MIT deleted file mode 100644 index 72dc60d84b..0000000000 --- a/packages/interface-stream-muxer-compliance-tests/LICENSE-MIT +++ /dev/null @@ -1,19 +0,0 @@ -The MIT License (MIT) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/packages/interface-stream-muxer-compliance-tests/README.md b/packages/interface-stream-muxer-compliance-tests/README.md deleted file mode 100644 index 2c4421b830..0000000000 --- a/packages/interface-stream-muxer-compliance-tests/README.md +++ /dev/null @@ -1,55 +0,0 @@ -# @libp2p/interface-stream-muxer-compliance-tests - -[![libp2p.io](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](http://libp2p.io/) -[![Discuss](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg?style=flat-square)](https://discuss.libp2p.io) -[![codecov](https://img.shields.io/codecov/c/github/libp2p/js-libp2p.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p) -[![CI](https://img.shields.io/github/actions/workflow/status/libp2p/js-libp2p/main.yml?branch=master\&style=flat-square)](https://github.com/libp2p/js-libp2p/actions/workflows/main.yml?query=branch%3Amaster) - -> Compliance tests for implementations of the libp2p Stream Muxer interface - -## Table of contents - -- [Install](#install) -- [Usage](#usage) -- [API Docs](#api-docs) -- [License](#license) -- [Contribution](#contribution) - -## Install - -```console -$ npm i @libp2p/interface-stream-muxer-compliance-tests -``` - -## Usage - -```js -import tests from '@libp2p/interface-stream-muxer-compliance-tests' - -describe('your stream muxer implementation', () => { - tests({ - // Options should be passed to your implementation - async setup (options) { - return new YourImplementation() - }, - async teardown () { - // cleanup resources created by setup() - } - }) -}) -``` - -## API Docs - -- - -## License - -Licensed under either of - -- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / ) -- MIT ([LICENSE-MIT](LICENSE-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/packages/interface-stream-muxer-compliance-tests/package.json b/packages/interface-stream-muxer-compliance-tests/package.json deleted file mode 100644 index ed4b33eac7..0000000000 --- a/packages/interface-stream-muxer-compliance-tests/package.json +++ /dev/null @@ -1,65 +0,0 @@ -{ - "name": "@libp2p/interface-stream-muxer-compliance-tests", - "version": "7.0.3", - "description": "Compliance tests for implementations of the libp2p Stream Muxer interface", - "license": "Apache-2.0 OR MIT", - "homepage": "https://github.com/libp2p/js-libp2p/tree/master/packages/interface-stream-muxer-compliance-tests#readme", - "repository": { - "type": "git", - "url": "git+https://github.com/libp2p/js-libp2p.git" - }, - "bugs": { - "url": "https://github.com/libp2p/js-libp2p/issues" - }, - "keywords": [ - "interface", - "libp2p" - ], - "type": "module", - "types": "./dist/src/index.d.ts", - "files": [ - "src", - "dist", - "!dist/test", - "!**/*.tsbuildinfo" - ], - "exports": { - ".": { - "types": "./dist/src/index.d.ts", - "import": "./dist/src/index.js" - } - }, - "eslintConfig": { - "extends": "ipfs", - "parserOptions": { - "sourceType": "module" - } - }, - "scripts": { - "clean": "aegir clean", - "lint": "aegir lint", - "dep-check": "aegir dep-check", - "build": "aegir build" - }, - "dependencies": { - "@libp2p/interface-compliance-tests": "^3.0.0", - "@libp2p/interface-connection": "^5.0.0", - "@libp2p/interface-stream-muxer": "^4.0.0", - "abortable-iterator": "^5.0.1", - "aegir": "^39.0.5", - "delay": "^6.0.0", - "it-all": "^3.0.2", - "it-drain": "^3.0.1", - "it-map": "^3.0.2", - "it-pair": "^2.0.2", - "it-pipe": "^3.0.1", - "it-stream-types": "^2.0.1", - "p-defer": "^4.0.0", - "p-limit": "^4.0.0", - "uint8arraylist": "^2.4.3", - "uint8arrays": "^4.0.3" - }, - "typedoc": { - "entryPoint": "./src/index.ts" - } -} diff --git a/packages/interface-stream-muxer-compliance-tests/tsconfig.json b/packages/interface-stream-muxer-compliance-tests/tsconfig.json deleted file mode 100644 index 467d95314b..0000000000 --- a/packages/interface-stream-muxer-compliance-tests/tsconfig.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "extends": "aegir/src/config/tsconfig.aegir.json", - "compilerOptions": { - "outDir": "dist" - }, - "include": [ - "src", - "test" - ], - "references": [ - { - "path": "../interface-compliance-tests" - }, - { - "path": "../interface-connection" - }, - { - "path": "../interface-stream-muxer" - } - ] -} diff --git a/packages/interface-stream-muxer/CHANGELOG.md b/packages/interface-stream-muxer/CHANGELOG.md deleted file mode 100644 index d6f777d84a..0000000000 --- a/packages/interface-stream-muxer/CHANGELOG.md +++ /dev/null @@ -1,155 +0,0 @@ -## [@libp2p/interface-stream-muxer-v4.1.2](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-stream-muxer-v4.1.1...@libp2p/interface-stream-muxer-v4.1.2) (2023-05-17) - - -### Bug Fixes - -* allow stream methods to be async ([#404](https://github.com/libp2p/js-libp2p-interfaces/issues/404)) ([cfcd6d7](https://github.com/libp2p/js-libp2p-interfaces/commit/cfcd6d751990990746ee7ae7c199b938667df4d8)) - -## [@libp2p/interface-stream-muxer-v4.1.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-stream-muxer-v4.1.0...@libp2p/interface-stream-muxer-v4.1.1) (2023-05-17) - - -### Bug Fixes - -* update interface stream muxer config ([#403](https://github.com/libp2p/js-libp2p-interfaces/issues/403)) ([12633e2](https://github.com/libp2p/js-libp2p-interfaces/commit/12633e28eae8e9e26429c29e6d0ecb8df8933a25)) - -## [@libp2p/interface-stream-muxer-v4.1.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-stream-muxer-v4.0.1...@libp2p/interface-stream-muxer-v4.1.0) (2023-05-16) - - -### Features - -* add abstract stream class ([#402](https://github.com/libp2p/js-libp2p-interfaces/issues/402)) ([920aa9e](https://github.com/libp2p/js-libp2p-interfaces/commit/920aa9ec2e44ce0bafbfa1f61864079313837020)) - -## [@libp2p/interface-stream-muxer-v4.0.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-stream-muxer-v4.0.0...@libp2p/interface-stream-muxer-v4.0.1) (2023-05-04) - - -### Dependencies - -* bump aegir from 38.1.8 to 39.0.5 ([#393](https://github.com/libp2p/js-libp2p-interfaces/issues/393)) ([31f3797](https://github.com/libp2p/js-libp2p-interfaces/commit/31f3797b24f7c23f3f16e9db3a230bd5f7cd5175)) - -## [@libp2p/interface-stream-muxer-v4.0.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-stream-muxer-v3.0.6...@libp2p/interface-stream-muxer-v4.0.0) (2023-04-18) - - -### ⚠ BREAKING CHANGES - -* bump it-stream-types from 1.0.5 to 2.0.1 (#362) - -### Dependencies - -* bump it-stream-types from 1.0.5 to 2.0.1 ([#362](https://github.com/libp2p/js-libp2p-interfaces/issues/362)) ([cdc7747](https://github.com/libp2p/js-libp2p-interfaces/commit/cdc774792beead63e0ded96bd6c23de0335a49e3)) -* update sibling dependencies ([2f52a28](https://github.com/libp2p/js-libp2p-interfaces/commit/2f52a284b59c0a88b040f86da1f5d3f044727f2c)) - -## [@libp2p/interface-stream-muxer-v3.0.6](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-stream-muxer-v3.0.5...@libp2p/interface-stream-muxer-v3.0.6) (2023-04-11) - - -### Dependencies - -* update sibling dependencies ([b034810](https://github.com/libp2p/js-libp2p-interfaces/commit/b0348102e41dc18166e70063f4708a2b3544f4b6)) - -## [@libp2p/interface-stream-muxer-v3.0.5](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-stream-muxer-v3.0.4...@libp2p/interface-stream-muxer-v3.0.5) (2023-01-18) - - -### Trivial Changes - -* remove lerna ([#330](https://github.com/libp2p/js-libp2p-interfaces/issues/330)) ([6678592](https://github.com/libp2p/js-libp2p-interfaces/commit/6678592dd0cf601a2671852f9d2a0aff5dee2b18)) - - -### Dependencies - -* bump aegir from 37.12.1 to 38.1.0 ([#335](https://github.com/libp2p/js-libp2p-interfaces/issues/335)) ([7368a36](https://github.com/libp2p/js-libp2p-interfaces/commit/7368a363423a08e8fa247dcb76ea13e4cf030d65)) - -## [@libp2p/interface-stream-muxer-v3.0.4](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-stream-muxer-v3.0.3...@libp2p/interface-stream-muxer-v3.0.4) (2022-12-19) - - -### Documentation - -* add interface docs ([#324](https://github.com/libp2p/js-libp2p-interfaces/issues/324)) ([2789445](https://github.com/libp2p/js-libp2p-interfaces/commit/278944594c24e1a3c4b3624a35680d69166546d7)) - -## [@libp2p/interface-stream-muxer-v3.0.3](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-stream-muxer-v3.0.2...@libp2p/interface-stream-muxer-v3.0.3) (2022-12-16) - - -### Documentation - -* update project config ([#323](https://github.com/libp2p/js-libp2p-interfaces/issues/323)) ([0fc6a08](https://github.com/libp2p/js-libp2p-interfaces/commit/0fc6a08e9cdcefe361fe325281a3a2a03759ff59)) - -## [@libp2p/interface-stream-muxer-v3.0.2](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-stream-muxer-v3.0.1...@libp2p/interface-stream-muxer-v3.0.2) (2022-12-14) - - -### Bug Fixes - -* generate docs for all packages ([#321](https://github.com/libp2p/js-libp2p-interfaces/issues/321)) ([b6f8b32](https://github.com/libp2p/js-libp2p-interfaces/commit/b6f8b32a920c15a28fe021e6050e31aaae89d518)) - -## [@libp2p/interface-stream-muxer-v3.0.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-stream-muxer-v3.0.0...@libp2p/interface-stream-muxer-v3.0.1) (2022-11-05) - - -### Bug Fixes - -* update project config ([#311](https://github.com/libp2p/js-libp2p-interfaces/issues/311)) ([27dd0ce](https://github.com/libp2p/js-libp2p-interfaces/commit/27dd0ce3c249892ac69cbb24ddaf0b9f32385e37)) - -## [@libp2p/interface-stream-muxer-v3.0.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-stream-muxer-v2.0.2...@libp2p/interface-stream-muxer-v3.0.0) (2022-10-06) - - -### ⚠ BREAKING CHANGES - -* the return type of StreamMuxer.newStream can now return a promise - -Co-authored-by: Marco Munizaga - -### Features - -* add upgrader options ([#290](https://github.com/libp2p/js-libp2p-interfaces/issues/290)) ([c502b66](https://github.com/libp2p/js-libp2p-interfaces/commit/c502b66d87020eb8e2768c49be17392c55503f69)) - -## [@libp2p/interface-stream-muxer-v2.0.2](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-stream-muxer-v2.0.1...@libp2p/interface-stream-muxer-v2.0.2) (2022-08-07) - - -### Trivial Changes - -* update project config ([#271](https://github.com/libp2p/js-libp2p-interfaces/issues/271)) ([59c0bf5](https://github.com/libp2p/js-libp2p-interfaces/commit/59c0bf5e0b05496fca2e4902632b61bb41fad9e9)) - - -### Dependencies - -* update sibling dependencies ([f859920](https://github.com/libp2p/js-libp2p-interfaces/commit/f859920423587ae797ac90ccaa3af8bdf60ae549)) - -## [@libp2p/interface-stream-muxer-v2.0.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-stream-muxer-v2.0.0...@libp2p/interface-stream-muxer-v2.0.1) (2022-06-27) - - -### Trivial Changes - -* update deps ([#262](https://github.com/libp2p/js-libp2p-interfaces/issues/262)) ([51edf7d](https://github.com/libp2p/js-libp2p-interfaces/commit/51edf7d9b3765a6f75c915b1483ea345d0133a41)) - -## [@libp2p/interface-stream-muxer-v2.0.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-stream-muxer-v1.1.0...@libp2p/interface-stream-muxer-v2.0.0) (2022-06-22) - - -### ⚠ BREAKING CHANGES - -* StreamMuxer now has a `close` method - -### Features - -* add stream muxer close ([#254](https://github.com/libp2p/js-libp2p-interfaces/issues/254)) ([d1f511e](https://github.com/libp2p/js-libp2p-interfaces/commit/d1f511e4b5857769c4eddf902288dc69fcb667b4)) - -## [@libp2p/interface-stream-muxer-v1.1.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-stream-muxer-v1.0.2...@libp2p/interface-stream-muxer-v1.1.0) (2022-06-21) - - -### Features - -* add direction to StreamMuxerInit ([#253](https://github.com/libp2p/js-libp2p-interfaces/issues/253)) ([6d34d75](https://github.com/libp2p/js-libp2p-interfaces/commit/6d34d755ff4e798d52945f1f099052bdd6a83f2b)) - -## [@libp2p/interface-stream-muxer-v1.0.2](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-stream-muxer-v1.0.1...@libp2p/interface-stream-muxer-v1.0.2) (2022-06-16) - - -### Trivial Changes - -* update deps ([545264f](https://github.com/libp2p/js-libp2p-interfaces/commit/545264f87a58394d2a7da77e93f3a596e889238f)) - -## [@libp2p/interface-stream-muxer-v1.0.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-stream-muxer-v1.0.0...@libp2p/interface-stream-muxer-v1.0.1) (2022-06-14) - - -### Bug Fixes - -* remove components from muxer factory function ([#238](https://github.com/libp2p/js-libp2p-interfaces/issues/238)) ([e4dab30](https://github.com/libp2p/js-libp2p-interfaces/commit/e4dab306d9bf406b9bb3cb92644e28cf81f7bda6)) - - -### Trivial Changes - -* update components module ([#235](https://github.com/libp2p/js-libp2p-interfaces/issues/235)) ([5844207](https://github.com/libp2p/js-libp2p-interfaces/commit/58442070af59aa852c83ec3aecdbd1d2c646b018)) diff --git a/packages/interface-stream-muxer/LICENSE b/packages/interface-stream-muxer/LICENSE deleted file mode 100644 index 20ce483c86..0000000000 --- a/packages/interface-stream-muxer/LICENSE +++ /dev/null @@ -1,4 +0,0 @@ -This project is dual licensed under MIT and Apache-2.0. - -MIT: https://www.opensource.org/licenses/mit -Apache-2.0: https://www.apache.org/licenses/license-2.0 diff --git a/packages/interface-stream-muxer/LICENSE-APACHE b/packages/interface-stream-muxer/LICENSE-APACHE deleted file mode 100644 index 14478a3b60..0000000000 --- a/packages/interface-stream-muxer/LICENSE-APACHE +++ /dev/null @@ -1,5 +0,0 @@ -Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - -http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. diff --git a/packages/interface-stream-muxer/LICENSE-MIT b/packages/interface-stream-muxer/LICENSE-MIT deleted file mode 100644 index 72dc60d84b..0000000000 --- a/packages/interface-stream-muxer/LICENSE-MIT +++ /dev/null @@ -1,19 +0,0 @@ -The MIT License (MIT) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/packages/interface-stream-muxer/README.md b/packages/interface-stream-muxer/README.md deleted file mode 100644 index a530b8dca4..0000000000 --- a/packages/interface-stream-muxer/README.md +++ /dev/null @@ -1,191 +0,0 @@ -# @libp2p/interface-stream-muxer - -[![libp2p.io](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](http://libp2p.io/) -[![Discuss](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg?style=flat-square)](https://discuss.libp2p.io) -[![codecov](https://img.shields.io/codecov/c/github/libp2p/js-libp2p.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p) -[![CI](https://img.shields.io/github/actions/workflow/status/libp2p/js-libp2p/main.yml?branch=master\&style=flat-square)](https://github.com/libp2p/js-libp2p/actions/workflows/main.yml?query=branch%3Amaster) - -> Stream Muxer interface for libp2p - -## Table of contents - -- [Install](#install) -- [Modules that implement the interface](#modules-that-implement-the-interface) -- [Badge](#badge) -- [Usage](#usage) -- [API](#api) - - [`const muxer = new Muxer([options])`](#const-muxer--new-muxeroptions) - - [`muxer.onStream`](#muxeronstream) - - [`muxer.onStreamEnd`](#muxeronstreamend) - - [`const stream = await muxer.newStream([options])`](#const-stream--await-muxernewstreamoptions) - - [`const streams = muxer.streams`](#const-streams--muxerstreams) -- [API Docs](#api-docs) -- [License](#license) -- [Contribution](#contribution) - -## Install - -```console -$ npm i @libp2p/interface-stream-muxer -``` - -The primary goal of this module is to enable developers to pick and swap their stream muxing module as they see fit for their application, without having to go through shims or compatibility issues. This module and test suite was heavily inspired by [abstract-blob-store](https://github.com/maxogden/abstract-blob-store). - -Publishing a test suite as a module lets multiple modules all ensure compatibility since they use the same test suite. - -The API is presented with both Node.js and Go primitives, however, there is no actual limitations for it to be extended for any other language, pushing forward the cross compatibility and interop through different stacks. - -## Modules that implement the interface - -- [js-libp2p-spdy](https://github.com/libp2p/js-libp2p-spdy) -- [js-libp2p-mplex](https://github.com/libp2p/js-libp2p-mplex) - -Send a PR to add a new one if you happen to find or write one. - -## Badge - -Include this badge in your readme if you make a new module that uses interface-stream-muxer API. - -![](img/badge.png) - -## Usage - -Install `interface-stream-muxer` as one of the dependencies of your project and as a test file. Then, using `mocha` (for JavaScript) or a test runner with compatible API, do: - -```js -const test = require('libp2p-interfaces-compliance-tests/stream-muxer') - -const common = { - async setup () { - return yourMuxer - }, - async teardown () { - // cleanup - } -} - -// use all of the test suits -test(common) -``` - -## API - -A valid (one that follows this abstraction) stream muxer, must implement the following API: - -### `const muxer = new Muxer([options])` - -Create a new *duplex* stream that can be piped together with a connection in order to allow multiplexed communications. - -e.g. - -```js -const Muxer = require('your-muxer-module') -import { pipe } from 'it-pipe' - -// Create a duplex muxer -const muxer = new Muxer() - -// Use the muxer in a pipeline -pipe(conn, muxer, conn) // conn is duplex connection to another peer -``` - -`options` is an optional `Object` that may have the following properties: - -- `onStream` - A function called when receiving a new stream from the remote. e.g. - ```js - // Receive a new stream on the muxed connection - const onStream = stream => { - // Read from this stream and write back to it (echo server) - pipe( - stream, - source => (async function * () { - for await (const data of source) yield data - })() - stream - ) - } - const muxer = new Muxer({ onStream }) - // ... - ``` - **Note:** The `onStream` function can be passed in place of the `options` object. i.e. - ```js - new Mplex(stream => { /* ... */ }) - ``` -- `onStreamEnd` - A function called when a stream ends. - ```js - // Get notified when a stream has ended - const onStreamEnd = stream => { - // Manage any tracking changes, etc - } - const muxer = new Muxer({ onStreamEnd, ... }) - ``` -- `signal` - An [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) which can be used to abort the muxer, *including* all of it's multiplexed connections. e.g. - ```js - const controller = new AbortController() - const muxer = new Muxer({ signal: controller.signal }) - - pipe(conn, muxer, conn) - - controller.abort() - ``` -- `maxMsgSize` - The maximum size in bytes the data field of multiplexed messages may contain (default 1MB) - -### `muxer.onStream` - -Use this property as an alternative to passing `onStream` as an option to the `Muxer` constructor. - -```js -const muxer = new Muxer() -// ...later -muxer.onStream = stream => { /* ... */ } -``` - -### `muxer.onStreamEnd` - -Use this property as an alternative to passing `onStreamEnd` as an option to the `Muxer` constructor. - -```js -const muxer = new Muxer() -// ...later -muxer.onStreamEnd = stream => { /* ... */ } -``` - -### `const stream = await muxer.newStream([options])` - -Initiate a new stream with the remote. Returns a [duplex stream](https://gist.github.com/alanshaw/591dc7dd54e4f99338a347ef568d6ee9#duplex-it). - -e.g. - -```js -// Create a new stream on the muxed connection -const stream = await muxer.newStream() - -// Use this new stream like any other duplex stream: -pipe([1, 2, 3], stream, consume) -``` - -### `const streams = muxer.streams` - -The streams property returns an array of streams the muxer currently has open. Closed streams will not be returned. - -```js -muxer.streams.map(stream => { - // Log out the stream's id - console.log(stream.id) -}) -``` - -## API Docs - -- - -## License - -Licensed under either of - -- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / ) -- MIT ([LICENSE-MIT](LICENSE-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/packages/interface-stream-muxer/img/badge.png b/packages/interface-stream-muxer/img/badge.png deleted file mode 100644 index 738bcf4a2f..0000000000 Binary files a/packages/interface-stream-muxer/img/badge.png and /dev/null differ diff --git a/packages/interface-stream-muxer/img/badge.sketch b/packages/interface-stream-muxer/img/badge.sketch deleted file mode 100644 index 990ad1c5bf..0000000000 Binary files a/packages/interface-stream-muxer/img/badge.sketch and /dev/null differ diff --git a/packages/interface-stream-muxer/img/badge.svg b/packages/interface-stream-muxer/img/badge.svg deleted file mode 100644 index d7215962df..0000000000 --- a/packages/interface-stream-muxer/img/badge.svg +++ /dev/null @@ -1,18 +0,0 @@ - - - - badge - Created with Sketch. - - - - - - Stream Muxer - - - Compatibl - e - - - \ No newline at end of file diff --git a/packages/interface-stream-muxer/package.json b/packages/interface-stream-muxer/package.json deleted file mode 100644 index e238d958c2..0000000000 --- a/packages/interface-stream-muxer/package.json +++ /dev/null @@ -1,80 +0,0 @@ -{ - "name": "@libp2p/interface-stream-muxer", - "version": "4.1.2", - "description": "Stream Muxer interface for libp2p", - "license": "Apache-2.0 OR MIT", - "homepage": "https://github.com/libp2p/js-libp2p/tree/master/packages/interface-stream-muxer#readme", - "repository": { - "type": "git", - "url": "git+https://github.com/libp2p/js-libp2p.git" - }, - "bugs": { - "url": "https://github.com/libp2p/js-libp2p/issues" - }, - "keywords": [ - "interface", - "libp2p" - ], - "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" - }, - "./stream": { - "types": "./dist/src/stream.d.ts", - "import": "./dist/src/stream.js" - } - }, - "eslintConfig": { - "extends": "ipfs", - "parserOptions": { - "sourceType": "module" - } - }, - "scripts": { - "clean": "aegir clean", - "lint": "aegir lint", - "dep-check": "aegir dep-check", - "build": "aegir build" - }, - "dependencies": { - "@libp2p/interface-connection": "^5.0.0", - "@libp2p/interfaces": "^3.0.0", - "@libp2p/logger": "^2.0.0", - "abortable-iterator": "^5.0.1", - "any-signal": "^4.1.1", - "it-pushable": "^3.1.3", - "it-stream-types": "^2.0.1", - "uint8arraylist": "^2.4.3" - }, - "devDependencies": { - "aegir": "^39.0.10" - }, - "typedoc": { - "entryPoint": "./src/index.ts" - } -} diff --git a/packages/interface-stream-muxer/tsconfig.json b/packages/interface-stream-muxer/tsconfig.json deleted file mode 100644 index 30fd079a69..0000000000 --- a/packages/interface-stream-muxer/tsconfig.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "extends": "aegir/src/config/tsconfig.aegir.json", - "compilerOptions": { - "outDir": "dist" - }, - "include": [ - "src", - "test" - ], - "references": [ - { - "path": "../interface-connection" - }, - { - "path": "../interfaces" - }, - { - "path": "../logger" - } - ] -} diff --git a/packages/interface-transport-compliance-tests/CHANGELOG.md b/packages/interface-transport-compliance-tests/CHANGELOG.md deleted file mode 100644 index ae8cbd794f..0000000000 --- a/packages/interface-transport-compliance-tests/CHANGELOG.md +++ /dev/null @@ -1,235 +0,0 @@ -## [@libp2p/interface-transport-compliance-tests-v4.0.2](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-transport-compliance-tests-v4.0.1...@libp2p/interface-transport-compliance-tests-v4.0.2) (2023-05-04) - - -### Dependencies - -* update sibling dependencies ([eae5fe0](https://github.com/libp2p/js-libp2p-interfaces/commit/eae5fe02ea11c2930242a8d91ee4bc22f9bebc5c)) - -## [@libp2p/interface-transport-compliance-tests-v4.0.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-transport-compliance-tests-v4.0.0...@libp2p/interface-transport-compliance-tests-v4.0.1) (2023-05-04) - - -### Dependencies - -* bump aegir from 38.1.8 to 39.0.5 ([#393](https://github.com/libp2p/js-libp2p-interfaces/issues/393)) ([31f3797](https://github.com/libp2p/js-libp2p-interfaces/commit/31f3797b24f7c23f3f16e9db3a230bd5f7cd5175)) - -## [@libp2p/interface-transport-compliance-tests-v4.0.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-transport-compliance-tests-v3.0.13...@libp2p/interface-transport-compliance-tests-v4.0.0) (2023-04-21) - - -### ⚠ BREAKING CHANGES - -* add libp2p events (#373) - -### Features - -* add libp2p events ([#373](https://github.com/libp2p/js-libp2p-interfaces/issues/373)) ([071c718](https://github.com/libp2p/js-libp2p-interfaces/commit/071c718808902858818ca86167b51b242b67a5a5)) - - -### Dependencies - -* update sibling dependencies ([74f82d5](https://github.com/libp2p/js-libp2p-interfaces/commit/74f82d53fc89740f4bafa22721a59ab70c3c92a8)) -* update sibling dependencies ([17ed429](https://github.com/libp2p/js-libp2p-interfaces/commit/17ed429d57e83cb38484ac52a0e0975a7d8af963)) - -## [@libp2p/interface-transport-compliance-tests-v3.0.13](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-transport-compliance-tests-v3.0.12...@libp2p/interface-transport-compliance-tests-v3.0.13) (2023-04-18) - - -### Dependencies - -* update sibling dependencies ([294d970](https://github.com/libp2p/js-libp2p-interfaces/commit/294d970d6e4fbbf6a3f0944394c4c8dea06d1265)) -* update sibling dependencies ([99a862b](https://github.com/libp2p/js-libp2p-interfaces/commit/99a862baed66d4e83ba006a70c33561855c9682e)) -* update sibling dependencies ([2f52a28](https://github.com/libp2p/js-libp2p-interfaces/commit/2f52a284b59c0a88b040f86da1f5d3f044727f2c)) - -## [@libp2p/interface-transport-compliance-tests-v3.0.12](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-transport-compliance-tests-v3.0.11...@libp2p/interface-transport-compliance-tests-v3.0.12) (2023-04-14) - - -### Dependencies - -* bump it-drain from 2.0.1 to 3.0.1 ([#358](https://github.com/libp2p/js-libp2p-interfaces/issues/358)) ([ec050fa](https://github.com/libp2p/js-libp2p-interfaces/commit/ec050fa215a2ee845366c95d763ff009b247e986)) - -## [@libp2p/interface-transport-compliance-tests-v3.0.11](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-transport-compliance-tests-v3.0.10...@libp2p/interface-transport-compliance-tests-v3.0.11) (2023-04-13) - - -### Dependencies - -* bump it-all from 2.0.1 to 3.0.1 ([#360](https://github.com/libp2p/js-libp2p-interfaces/issues/360)) ([1b439eb](https://github.com/libp2p/js-libp2p-interfaces/commit/1b439eb7503ed7e31e77f17ce0a685ea78d94442)) - -## [@libp2p/interface-transport-compliance-tests-v3.0.10](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-transport-compliance-tests-v3.0.9...@libp2p/interface-transport-compliance-tests-v3.0.10) (2023-04-11) - - -### Dependencies - -* update sibling dependencies ([b034810](https://github.com/libp2p/js-libp2p-interfaces/commit/b0348102e41dc18166e70063f4708a2b3544f4b6)) - -## [@libp2p/interface-transport-compliance-tests-v3.0.9](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-transport-compliance-tests-v3.0.8...@libp2p/interface-transport-compliance-tests-v3.0.9) (2023-04-04) - - -### Dependencies - -* bump it-pipe from 2.0.5 to 3.0.1 ([#363](https://github.com/libp2p/js-libp2p-interfaces/issues/363)) ([625817b](https://github.com/libp2p/js-libp2p-interfaces/commit/625817b0bbbee276983c40a0604c8810a25abe8f)) - -## [@libp2p/interface-transport-compliance-tests-v3.0.8](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-transport-compliance-tests-v3.0.7...@libp2p/interface-transport-compliance-tests-v3.0.8) (2023-03-17) - - -### Dependencies - -* update @multiformats/multiaddr to 12.0.0 ([#354](https://github.com/libp2p/js-libp2p-interfaces/issues/354)) ([e0f327b](https://github.com/libp2p/js-libp2p-interfaces/commit/e0f327b5d54e240feabadce21a841629d633ec5e)) - -## [@libp2p/interface-transport-compliance-tests-v3.0.7](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-transport-compliance-tests-v3.0.6...@libp2p/interface-transport-compliance-tests-v3.0.7) (2023-01-18) - - -### Trivial Changes - -* remove lerna ([#330](https://github.com/libp2p/js-libp2p-interfaces/issues/330)) ([6678592](https://github.com/libp2p/js-libp2p-interfaces/commit/6678592dd0cf601a2671852f9d2a0aff5dee2b18)) - - -### Dependencies - -* bump aegir from 37.12.1 to 38.1.0 ([#335](https://github.com/libp2p/js-libp2p-interfaces/issues/335)) ([7368a36](https://github.com/libp2p/js-libp2p-interfaces/commit/7368a363423a08e8fa247dcb76ea13e4cf030d65)) - -## [@libp2p/interface-transport-compliance-tests-v3.0.6](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-transport-compliance-tests-v3.0.5...@libp2p/interface-transport-compliance-tests-v3.0.6) (2023-01-06) - - -### Dependencies - -* update sibling dependencies ([1442ad3](https://github.com/libp2p/js-libp2p-interfaces/commit/1442ad37e44f886a423e7a09e53e0b1796327fde)) - -## [@libp2p/interface-transport-compliance-tests-v3.0.5](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-transport-compliance-tests-v3.0.4...@libp2p/interface-transport-compliance-tests-v3.0.5) (2022-12-16) - - -### Documentation - -* update project config ([#323](https://github.com/libp2p/js-libp2p-interfaces/issues/323)) ([0fc6a08](https://github.com/libp2p/js-libp2p-interfaces/commit/0fc6a08e9cdcefe361fe325281a3a2a03759ff59)) - -## [@libp2p/interface-transport-compliance-tests-v3.0.4](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-transport-compliance-tests-v3.0.3...@libp2p/interface-transport-compliance-tests-v3.0.4) (2022-12-14) - - -### Bug Fixes - -* generate docs for all packages ([#321](https://github.com/libp2p/js-libp2p-interfaces/issues/321)) ([b6f8b32](https://github.com/libp2p/js-libp2p-interfaces/commit/b6f8b32a920c15a28fe021e6050e31aaae89d518)) - - -### Dependencies - -* bump sinon from 14.0.2 to 15.0.0 ([#316](https://github.com/libp2p/js-libp2p-interfaces/issues/316)) ([d37721c](https://github.com/libp2p/js-libp2p-interfaces/commit/d37721c9143cd3eeafb5f8249b07d9f2fbce0f54)) - -## [@libp2p/interface-transport-compliance-tests-v3.0.3](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-transport-compliance-tests-v3.0.2...@libp2p/interface-transport-compliance-tests-v3.0.3) (2022-11-05) - - -### Bug Fixes - -* update project config ([#311](https://github.com/libp2p/js-libp2p-interfaces/issues/311)) ([27dd0ce](https://github.com/libp2p/js-libp2p-interfaces/commit/27dd0ce3c249892ac69cbb24ddaf0b9f32385e37)) - - -### Dependencies - -* update sibling dependencies ([45af2ca](https://github.com/libp2p/js-libp2p-interfaces/commit/45af2cadd55ad58d0c5ee2d11a0b8a39f6300454)) - -## [@libp2p/interface-transport-compliance-tests-v3.0.2](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-transport-compliance-tests-v3.0.1...@libp2p/interface-transport-compliance-tests-v3.0.2) (2022-10-17) - - -### Dependencies - -* bump it-drain from 1.0.5 to 2.0.0 ([#305](https://github.com/libp2p/js-libp2p-interfaces/issues/305)) ([67e418c](https://github.com/libp2p/js-libp2p-interfaces/commit/67e418c2abeccfc06e715c1373485f012df06fdb)) - -## [@libp2p/interface-transport-compliance-tests-v3.0.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-transport-compliance-tests-v3.0.0...@libp2p/interface-transport-compliance-tests-v3.0.1) (2022-10-17) - - -### Dependencies - -* bump it-all from 1.0.6 to 2.0.0 ([#306](https://github.com/libp2p/js-libp2p-interfaces/issues/306)) ([7c7b388](https://github.com/libp2p/js-libp2p-interfaces/commit/7c7b3882e33a064b8e5588d6befd823360347464)) - -## [@libp2p/interface-transport-compliance-tests-v3.0.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-transport-compliance-tests-v2.0.8...@libp2p/interface-transport-compliance-tests-v3.0.0) (2022-10-12) - - -### ⚠ BREAKING CHANGES - -* modules no longer implement `Initializable` instead switching to constructor injection - -### Bug Fixes - -* remove @libp2p/components ([#301](https://github.com/libp2p/js-libp2p-interfaces/issues/301)) ([1d37dc6](https://github.com/libp2p/js-libp2p-interfaces/commit/1d37dc6d3197838a71895d5769ad8bba6eb38fd3)) - - -### Dependencies - -* update sibling dependencies ([d3226f7](https://github.com/libp2p/js-libp2p-interfaces/commit/d3226f7383de85cae2b4771c22eea22c4bb5bbeb)) - -## [@libp2p/interface-transport-compliance-tests-v2.0.8](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-transport-compliance-tests-v2.0.7...@libp2p/interface-transport-compliance-tests-v2.0.8) (2022-10-06) - - -### Dependencies - -* update sibling dependencies ([2f46d7f](https://github.com/libp2p/js-libp2p-interfaces/commit/2f46d7ff4189c29a63bac93b0b5b73de0a75922f)) -* update sibling dependencies ([0fae3ee](https://github.com/libp2p/js-libp2p-interfaces/commit/0fae3ee43fab43293fb290654a927b5c5c5759fc)) - -## [@libp2p/interface-transport-compliance-tests-v2.0.7](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-transport-compliance-tests-v2.0.6...@libp2p/interface-transport-compliance-tests-v2.0.7) (2022-10-04) - - -### Dependencies - -* update sibling dependencies ([1b11e8e](https://github.com/libp2p/js-libp2p-interfaces/commit/1b11e8e9cc2ea1d4d26233f9c11a57e185ea23ed)) - -## [@libp2p/interface-transport-compliance-tests-v2.0.6](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-transport-compliance-tests-v2.0.5...@libp2p/interface-transport-compliance-tests-v2.0.6) (2022-09-21) - - -### Dependencies - -* update @multiformats/multiaddr to 11.0.0 ([#288](https://github.com/libp2p/js-libp2p-interfaces/issues/288)) ([57b2ad8](https://github.com/libp2p/js-libp2p-interfaces/commit/57b2ad88edfc7807311143791bc49270b1a81eaf)) - -## [@libp2p/interface-transport-compliance-tests-v2.0.5](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-transport-compliance-tests-v2.0.4...@libp2p/interface-transport-compliance-tests-v2.0.5) (2022-08-10) - - -### Bug Fixes - -* compare bytes in transport test ([#281](https://github.com/libp2p/js-libp2p-interfaces/issues/281)) ([b7d9ef6](https://github.com/libp2p/js-libp2p-interfaces/commit/b7d9ef6f5a43b569997bf9e7c908beb2b861d01d)) - -## [@libp2p/interface-transport-compliance-tests-v2.0.4](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-transport-compliance-tests-v2.0.3...@libp2p/interface-transport-compliance-tests-v2.0.4) (2022-08-10) - - -### Dependencies - -* update sibling dependencies ([fc4c49c](https://github.com/libp2p/js-libp2p-interfaces/commit/fc4c49c22334b9f2059b08e13ba94f3e8938482e)) -* update sibling dependencies ([f859920](https://github.com/libp2p/js-libp2p-interfaces/commit/f859920423587ae797ac90ccaa3af8bdf60ae549)) - -## [@libp2p/interface-transport-compliance-tests-v2.0.3](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-transport-compliance-tests-v2.0.2...@libp2p/interface-transport-compliance-tests-v2.0.3) (2022-07-31) - - -### Trivial Changes - -* update project config ([#271](https://github.com/libp2p/js-libp2p-interfaces/issues/271)) ([59c0bf5](https://github.com/libp2p/js-libp2p-interfaces/commit/59c0bf5e0b05496fca2e4902632b61bb41fad9e9)) - - -### Dependencies - -* update uint8arraylist and p-wait-for deps ([#274](https://github.com/libp2p/js-libp2p-interfaces/issues/274)) ([c55f12e](https://github.com/libp2p/js-libp2p-interfaces/commit/c55f12e47be0a10e41709b0d6a60dd8bc1209ee5)) - -## [@libp2p/interface-transport-compliance-tests-v2.0.2](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-transport-compliance-tests-v2.0.1...@libp2p/interface-transport-compliance-tests-v2.0.2) (2022-06-27) - - -### Trivial Changes - -* update deps ([#262](https://github.com/libp2p/js-libp2p-interfaces/issues/262)) ([51edf7d](https://github.com/libp2p/js-libp2p-interfaces/commit/51edf7d9b3765a6f75c915b1483ea345d0133a41)) - -## [@libp2p/interface-transport-compliance-tests-v2.0.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-transport-compliance-tests-v2.0.0...@libp2p/interface-transport-compliance-tests-v2.0.1) (2022-06-24) - - -### Trivial Changes - -* update sibling dependencies [skip ci] ([c5c41c5](https://github.com/libp2p/js-libp2p-interfaces/commit/c5c41c521cf970addc1840d8519cdaa542a0db16)) - -## [@libp2p/interface-transport-compliance-tests-v2.0.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-transport-compliance-tests-v1.0.0...@libp2p/interface-transport-compliance-tests-v2.0.0) (2022-06-16) - - -### ⚠ BREAKING CHANGES - -* The Connection and Stream APIs have been updated - -### Features - -* store stream data on the stream, track the stream direction ([#245](https://github.com/libp2p/js-libp2p-interfaces/issues/245)) ([6d74d2f](https://github.com/libp2p/js-libp2p-interfaces/commit/6d74d2f9f344fb4d6741ba0d35263ebe351a4c65)) - - -### Trivial Changes - -* update deps ([54fbb37](https://github.com/libp2p/js-libp2p-interfaces/commit/54fbb37c8644a3fd6833c12550a57bf1a9292902)) -* update deps ([219e60e](https://github.com/libp2p/js-libp2p-interfaces/commit/219e60ec6f886b95803457fe48dfcdb4ed57e34c)) -* update deps ([545264f](https://github.com/libp2p/js-libp2p-interfaces/commit/545264f87a58394d2a7da77e93f3a596e889238f)) diff --git a/packages/interface-transport-compliance-tests/LICENSE b/packages/interface-transport-compliance-tests/LICENSE deleted file mode 100644 index 20ce483c86..0000000000 --- a/packages/interface-transport-compliance-tests/LICENSE +++ /dev/null @@ -1,4 +0,0 @@ -This project is dual licensed under MIT and Apache-2.0. - -MIT: https://www.opensource.org/licenses/mit -Apache-2.0: https://www.apache.org/licenses/license-2.0 diff --git a/packages/interface-transport-compliance-tests/LICENSE-APACHE b/packages/interface-transport-compliance-tests/LICENSE-APACHE deleted file mode 100644 index 14478a3b60..0000000000 --- a/packages/interface-transport-compliance-tests/LICENSE-APACHE +++ /dev/null @@ -1,5 +0,0 @@ -Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - -http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. diff --git a/packages/interface-transport-compliance-tests/LICENSE-MIT b/packages/interface-transport-compliance-tests/LICENSE-MIT deleted file mode 100644 index 72dc60d84b..0000000000 --- a/packages/interface-transport-compliance-tests/LICENSE-MIT +++ /dev/null @@ -1,19 +0,0 @@ -The MIT License (MIT) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/packages/interface-transport-compliance-tests/README.md b/packages/interface-transport-compliance-tests/README.md deleted file mode 100644 index fe79e805b4..0000000000 --- a/packages/interface-transport-compliance-tests/README.md +++ /dev/null @@ -1,55 +0,0 @@ -# @libp2p/interface-transport-compliance-tests - -[![libp2p.io](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](http://libp2p.io/) -[![Discuss](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg?style=flat-square)](https://discuss.libp2p.io) -[![codecov](https://img.shields.io/codecov/c/github/libp2p/js-libp2p.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p) -[![CI](https://img.shields.io/github/actions/workflow/status/libp2p/js-libp2p/main.yml?branch=master\&style=flat-square)](https://github.com/libp2p/js-libp2p/actions/workflows/main.yml?query=branch%3Amaster) - -> Compliance tests for implementations of the libp2p Transport interface - -## Table of contents - -- [Install](#install) -- [Usage](#usage) -- [API Docs](#api-docs) -- [License](#license) -- [Contribution](#contribution) - -## Install - -```console -$ npm i @libp2p/interface-transport-compliance-tests -``` - -## Usage - -```js -import tests from '@libp2p/interface-transport-compliance-tests' - -describe('your transport implementation', () => { - tests({ - // Options should be passed to your implementation - async setup (options) { - return new YourImplementation() - }, - async teardown () { - // cleanup resources created by setup() - } - }) -}) -``` - -## API Docs - -- - -## License - -Licensed under either of - -- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / ) -- MIT ([LICENSE-MIT](LICENSE-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/packages/interface-transport-compliance-tests/package.json b/packages/interface-transport-compliance-tests/package.json deleted file mode 100644 index 7e25d123d8..0000000000 --- a/packages/interface-transport-compliance-tests/package.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "name": "@libp2p/interface-transport-compliance-tests", - "version": "4.0.2", - "description": "Compliance tests for implementations of the libp2p Transport interface", - "license": "Apache-2.0 OR MIT", - "homepage": "https://github.com/libp2p/js-libp2p/tree/master/packages/interface-transport-compliance-tests#readme", - "repository": { - "type": "git", - "url": "git+https://github.com/libp2p/js-libp2p.git" - }, - "bugs": { - "url": "https://github.com/libp2p/js-libp2p/issues" - }, - "keywords": [ - "interface", - "libp2p" - ], - "type": "module", - "types": "./dist/src/index.d.ts", - "files": [ - "src", - "dist", - "!dist/test", - "!**/*.tsbuildinfo" - ], - "exports": { - ".": { - "types": "./dist/src/index.d.ts", - "import": "./dist/src/index.js" - } - }, - "eslintConfig": { - "extends": "ipfs", - "parserOptions": { - "sourceType": "module" - } - }, - "scripts": { - "clean": "aegir clean", - "lint": "aegir lint", - "dep-check": "aegir dep-check", - "build": "aegir build" - }, - "dependencies": { - "@libp2p/interface-compliance-tests": "^3.0.0", - "@libp2p/interface-connection": "^5.0.0", - "@libp2p/interface-mocks": "^12.0.0", - "@libp2p/interface-registrar": "^2.0.0", - "@libp2p/interface-transport": "^4.0.0", - "@libp2p/interfaces": "^3.0.0", - "@multiformats/multiaddr": "^12.1.3", - "aegir": "^39.0.5", - "it-all": "^3.0.2", - "it-drain": "^3.0.1", - "it-pipe": "^3.0.1", - "p-defer": "^4.0.0", - "p-wait-for": "^5.0.0", - "sinon": "^15.0.0", - "uint8arrays": "^4.0.3" - }, - "typedoc": { - "entryPoint": "./src/index.ts" - } -} diff --git a/packages/interface-transport-compliance-tests/tsconfig.json b/packages/interface-transport-compliance-tests/tsconfig.json deleted file mode 100644 index 0ac9c08543..0000000000 --- a/packages/interface-transport-compliance-tests/tsconfig.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "extends": "aegir/src/config/tsconfig.aegir.json", - "compilerOptions": { - "outDir": "dist" - }, - "include": [ - "src", - "test" - ], - "references": [ - { - "path": "../interface-compliance-tests" - }, - { - "path": "../interface-connection" - }, - { - "path": "../interface-mocks" - }, - { - "path": "../interface-registrar" - }, - { - "path": "../interface-transport" - }, - { - "path": "../interfaces" - } - ] -} diff --git a/packages/interface-transport/CHANGELOG.md b/packages/interface-transport/CHANGELOG.md deleted file mode 100644 index 2b1562a774..0000000000 --- a/packages/interface-transport/CHANGELOG.md +++ /dev/null @@ -1,150 +0,0 @@ -## [@libp2p/interface-transport-v4.0.3](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-transport-v4.0.2...@libp2p/interface-transport-v4.0.3) (2023-05-15) - - -### Bug Fixes - -* expose getListeners method from the transport manager ([#400](https://github.com/libp2p/js-libp2p-interfaces/issues/400)) ([94dc4ed](https://github.com/libp2p/js-libp2p-interfaces/commit/94dc4ed0320473b160618d19dddc6e038f5050e6)) - -## [@libp2p/interface-transport-v4.0.2](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-transport-v4.0.1...@libp2p/interface-transport-v4.0.2) (2023-05-04) - - -### Dependencies - -* bump aegir from 38.1.8 to 39.0.5 ([#393](https://github.com/libp2p/js-libp2p-interfaces/issues/393)) ([31f3797](https://github.com/libp2p/js-libp2p-interfaces/commit/31f3797b24f7c23f3f16e9db3a230bd5f7cd5175)) - -## [@libp2p/interface-transport-v4.0.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-transport-v4.0.0...@libp2p/interface-transport-v4.0.1) (2023-04-25) - - -### Documentation - -* fix typos in docs ([#386](https://github.com/libp2p/js-libp2p-interfaces/issues/386)) ([8ec2cdc](https://github.com/libp2p/js-libp2p-interfaces/commit/8ec2cdcc5deed76e0c673a75c27bf7a2e931eea1)) - -## [@libp2p/interface-transport-v4.0.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-transport-v3.0.0...@libp2p/interface-transport-v4.0.0) (2023-04-21) - - -### ⚠ BREAKING CHANGES - -* add libp2p events (#373) - -### Features - -* add libp2p events ([#373](https://github.com/libp2p/js-libp2p-interfaces/issues/373)) ([071c718](https://github.com/libp2p/js-libp2p-interfaces/commit/071c718808902858818ca86167b51b242b67a5a5)) - -## [@libp2p/interface-transport-v3.0.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-transport-v2.1.3...@libp2p/interface-transport-v3.0.0) (2023-04-18) - - -### ⚠ BREAKING CHANGES - -* bump it-stream-types from 1.0.5 to 2.0.1 (#362) - -### Dependencies - -* bump it-stream-types from 1.0.5 to 2.0.1 ([#362](https://github.com/libp2p/js-libp2p-interfaces/issues/362)) ([cdc7747](https://github.com/libp2p/js-libp2p-interfaces/commit/cdc774792beead63e0ded96bd6c23de0335a49e3)) -* update sibling dependencies ([e95dcc2](https://github.com/libp2p/js-libp2p-interfaces/commit/e95dcc28f0a8b42457a44155eb0dfb3d813b03c8)) -* update sibling dependencies ([2f52a28](https://github.com/libp2p/js-libp2p-interfaces/commit/2f52a284b59c0a88b040f86da1f5d3f044727f2c)) - -## [@libp2p/interface-transport-v2.1.3](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-transport-v2.1.2...@libp2p/interface-transport-v2.1.3) (2023-04-11) - - -### Dependencies - -* update sibling dependencies ([b034810](https://github.com/libp2p/js-libp2p-interfaces/commit/b0348102e41dc18166e70063f4708a2b3544f4b6)) - -## [@libp2p/interface-transport-v2.1.2](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-transport-v2.1.1...@libp2p/interface-transport-v2.1.2) (2023-03-17) - - -### Dependencies - -* update @multiformats/multiaddr to 12.0.0 ([#354](https://github.com/libp2p/js-libp2p-interfaces/issues/354)) ([e0f327b](https://github.com/libp2p/js-libp2p-interfaces/commit/e0f327b5d54e240feabadce21a841629d633ec5e)) - -## [@libp2p/interface-transport-v2.1.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-transport-v2.1.0...@libp2p/interface-transport-v2.1.1) (2023-01-18) - - -### Trivial Changes - -* remove lerna ([#330](https://github.com/libp2p/js-libp2p-interfaces/issues/330)) ([6678592](https://github.com/libp2p/js-libp2p-interfaces/commit/6678592dd0cf601a2671852f9d2a0aff5dee2b18)) - - -### Dependencies - -* bump aegir from 37.12.1 to 38.1.0 ([#335](https://github.com/libp2p/js-libp2p-interfaces/issues/335)) ([7368a36](https://github.com/libp2p/js-libp2p-interfaces/commit/7368a363423a08e8fa247dcb76ea13e4cf030d65)) - -## [@libp2p/interface-transport-v2.1.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-transport-v2.0.3...@libp2p/interface-transport-v2.1.0) (2022-12-21) - - -### Features - -* add fault tolerance enum ([#327](https://github.com/libp2p/js-libp2p-interfaces/issues/327)) ([85f8d60](https://github.com/libp2p/js-libp2p-interfaces/commit/85f8d60b147e1f0af61179137fbcdab500933e70)) - -## [@libp2p/interface-transport-v2.0.3](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-transport-v2.0.2...@libp2p/interface-transport-v2.0.3) (2022-12-16) - - -### Documentation - -* update project config ([#323](https://github.com/libp2p/js-libp2p-interfaces/issues/323)) ([0fc6a08](https://github.com/libp2p/js-libp2p-interfaces/commit/0fc6a08e9cdcefe361fe325281a3a2a03759ff59)) - -## [@libp2p/interface-transport-v2.0.2](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-transport-v2.0.1...@libp2p/interface-transport-v2.0.2) (2022-12-14) - - -### Bug Fixes - -* generate docs for all packages ([#321](https://github.com/libp2p/js-libp2p-interfaces/issues/321)) ([b6f8b32](https://github.com/libp2p/js-libp2p-interfaces/commit/b6f8b32a920c15a28fe021e6050e31aaae89d518)) - -## [@libp2p/interface-transport-v2.0.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-transport-v2.0.0...@libp2p/interface-transport-v2.0.1) (2022-11-05) - - -### Bug Fixes - -* update project config ([#311](https://github.com/libp2p/js-libp2p-interfaces/issues/311)) ([27dd0ce](https://github.com/libp2p/js-libp2p-interfaces/commit/27dd0ce3c249892ac69cbb24ddaf0b9f32385e37)) - -## [@libp2p/interface-transport-v2.0.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-transport-v1.0.4...@libp2p/interface-transport-v2.0.0) (2022-10-06) - - -### ⚠ BREAKING CHANGES - -* the return type of StreamMuxer.newStream can now return a promise - -Co-authored-by: Marco Munizaga - -### Features - -* add upgrader options ([#290](https://github.com/libp2p/js-libp2p-interfaces/issues/290)) ([c502b66](https://github.com/libp2p/js-libp2p-interfaces/commit/c502b66d87020eb8e2768c49be17392c55503f69)) - - -### Dependencies - -* update sibling dependencies ([66b4993](https://github.com/libp2p/js-libp2p-interfaces/commit/66b49938a09eeb12bf8ec8d78938d5cffd6ec134)) -* update sibling dependencies ([5de9728](https://github.com/libp2p/js-libp2p-interfaces/commit/5de97284827de6c63182b704c1be12c5f8cf7af5)) - -## [@libp2p/interface-transport-v1.0.4](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-transport-v1.0.3...@libp2p/interface-transport-v1.0.4) (2022-09-21) - - -### Dependencies - -* update @multiformats/multiaddr to 11.0.0 ([#288](https://github.com/libp2p/js-libp2p-interfaces/issues/288)) ([57b2ad8](https://github.com/libp2p/js-libp2p-interfaces/commit/57b2ad88edfc7807311143791bc49270b1a81eaf)) - -## [@libp2p/interface-transport-v1.0.3](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-transport-v1.0.2...@libp2p/interface-transport-v1.0.3) (2022-08-07) - - -### Trivial Changes - -* update project config ([#271](https://github.com/libp2p/js-libp2p-interfaces/issues/271)) ([59c0bf5](https://github.com/libp2p/js-libp2p-interfaces/commit/59c0bf5e0b05496fca2e4902632b61bb41fad9e9)) - - -### Dependencies - -* update sibling dependencies ([f859920](https://github.com/libp2p/js-libp2p-interfaces/commit/f859920423587ae797ac90ccaa3af8bdf60ae549)) - -## [@libp2p/interface-transport-v1.0.2](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-transport-v1.0.1...@libp2p/interface-transport-v1.0.2) (2022-06-27) - - -### Trivial Changes - -* update deps ([#262](https://github.com/libp2p/js-libp2p-interfaces/issues/262)) ([51edf7d](https://github.com/libp2p/js-libp2p-interfaces/commit/51edf7d9b3765a6f75c915b1483ea345d0133a41)) - -## [@libp2p/interface-transport-v1.0.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-transport-v1.0.0...@libp2p/interface-transport-v1.0.1) (2022-06-16) - - -### Trivial Changes - -* update deps ([545264f](https://github.com/libp2p/js-libp2p-interfaces/commit/545264f87a58394d2a7da77e93f3a596e889238f)) diff --git a/packages/interface-transport/LICENSE b/packages/interface-transport/LICENSE deleted file mode 100644 index 20ce483c86..0000000000 --- a/packages/interface-transport/LICENSE +++ /dev/null @@ -1,4 +0,0 @@ -This project is dual licensed under MIT and Apache-2.0. - -MIT: https://www.opensource.org/licenses/mit -Apache-2.0: https://www.apache.org/licenses/license-2.0 diff --git a/packages/interface-transport/LICENSE-APACHE b/packages/interface-transport/LICENSE-APACHE deleted file mode 100644 index 14478a3b60..0000000000 --- a/packages/interface-transport/LICENSE-APACHE +++ /dev/null @@ -1,5 +0,0 @@ -Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - -http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. diff --git a/packages/interface-transport/LICENSE-MIT b/packages/interface-transport/LICENSE-MIT deleted file mode 100644 index 72dc60d84b..0000000000 --- a/packages/interface-transport/LICENSE-MIT +++ /dev/null @@ -1,19 +0,0 @@ -The MIT License (MIT) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/packages/interface-transport/README.md b/packages/interface-transport/README.md deleted file mode 100644 index bf331ff573..0000000000 --- a/packages/interface-transport/README.md +++ /dev/null @@ -1,264 +0,0 @@ -# @libp2p/interface-transport - -[![libp2p.io](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](http://libp2p.io/) -[![Discuss](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg?style=flat-square)](https://discuss.libp2p.io) -[![codecov](https://img.shields.io/codecov/c/github/libp2p/js-libp2p.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p) -[![CI](https://img.shields.io/github/actions/workflow/status/libp2p/js-libp2p/main.yml?branch=master\&style=flat-square)](https://github.com/libp2p/js-libp2p/actions/workflows/main.yml?query=branch%3Amaster) - -> Transport interface for libp2p - -## Table of contents - -- [Install](#install) -- [Modules that implement the interface](#modules-that-implement-the-interface) -- [Badge](#badge) -- [How to use the battery of tests](#how-to-use-the-battery-of-tests) -- [Node.js](#nodejs) -- [API](#api) - - [Types](#types) - - [Upgrader](#upgrader) - - [MultiaddrConnection](#multiaddrconnection) - - [Creating a transport instance](#creating-a-transport-instance) - - [Dial to another peer](#dial-to-another-peer) - - [Canceling a dial](#canceling-a-dial) - - [Filtering Addresses](#filtering-addresses) - - [Create a listener](#create-a-listener) - - [Start a listener](#start-a-listener) - - [Get listener addrs](#get-listener-addrs) - - [Stop a listener](#stop-a-listener) -- [API Docs](#api-docs) -- [License](#license) -- [Contribution](#contribution) - -## Install - -```console -$ npm i @libp2p/interface-transport -``` - -The primary goal of this module is to enable developers to pick and swap their transport module as they see fit for their libp2p installation, without having to go through shims or compatibility issues. This module and test suite were heavily inspired by abstract-blob-store, interface-stream-muxer and others. - -Publishing a test suite as a module lets multiple modules all ensure compatibility since they use the same test suite. - -The purpose of this interface is not to reinvent any wheels when it comes to dialing and listening to transports. Instead, it tries to provide a uniform API for several transports through a shimmed interface. - -## Modules that implement the interface - -- [js-libp2p-tcp](https://github.com/libp2p/js-libp2p-tcp) -- [js-libp2p-webrtc-star](https://github.com/libp2p/js-libp2p-webrtc-star) -- [js-libp2p-webrtc-direct](https://github.com/libp2p/js-libp2p-webrtc-direct) -- [js-libp2p-websocket-star](https://github.com/libp2p/js-libp2p-websocket-star) -- [js-libp2p-websockets](https://github.com/libp2p/js-libp2p-websockets) -- [js-libp2p-utp](https://github.com/libp2p/js-libp2p-utp) -- [webrtc-explorer](https://github.com/diasdavid/webrtc-explorer) - -## Badge - -Include this badge in your readme if you make a module that is compatible with the interface-transport API. You can validate this by running the tests. - -![](img/badge.png) - -## How to use the battery of tests - -## Node.js - -```js -/* eslint-env mocha */ -'use strict' - -const tests = require('libp2p-interfaces-compliance-tests/transport') -const multiaddr = require('@multiformats/multiaddr') -const YourTransport = require('../src') - -describe('compliance', () => { - tests({ - setup (init) { - let transport = new YourTransport(init) - - const addrs = [ - multiaddr('valid-multiaddr-for-your-transport'), - multiaddr('valid-multiaddr2-for-your-transport') - ] - - const network = require('my-network-lib') - const connect = network.connect - const connector = { - delay (delayMs) { - // Add a delay in the connection mechanism for the transport - // (this is used by the dial tests) - network.connect = (...args) => setTimeout(() => connect(...args), delayMs) - }, - restore () { - // Restore the connection mechanism to normal - network.connect = connect - } - } - - return { transport, addrs, connector } - }, - teardown () { - // Clean up any resources created by setup() - } - }) -}) -``` - -## API - -A valid transport (one that follows the interface defined) must implement the following API: - -**Table of contents:** - -- type: `Transport` - - `new Transport({ upgrader, ...[options] })` - - ` transport.dial(multiaddr, [options])` - - ` transport.filter(multiaddrs)` - - `transport.createListener([options], handlerFunction)` - - type: `transport.Listener` - - event: 'listening' - - event: 'close' - - event: 'connection' - - event: 'error' - - ` listener.listen(multiaddr)` - - `listener.getAddrs()` - - ` listener.close([options])` - -### Types - -#### Upgrader - -Upgraders have 2 methods: `upgradeOutbound` and `upgradeInbound`. - -- `upgradeOutbound` must be called and returned by `transport.dial`. -- `upgradeInbound` must be called and the results must be passed to the `createListener` `handlerFunction` and the `connection` event handler, any time a new connection is created. - -```js -const connection = await upgrader.upgradeOutbound(multiaddrConnection) -const connection = await upgrader.upgradeInbound(multiaddrConnection) -``` - -The `Upgrader` methods take a [MultiaddrConnection](#multiaddrconnection) and will return an `interface-connection` instance. - -#### MultiaddrConnection - -- `MultiaddrConnection` - - `sink`: A [streaming iterable sink](https://gist.github.com/alanshaw/591dc7dd54e4f99338a347ef568d6ee9#sink-it) - - `source`: A [streaming iterable source](https://gist.github.com/alanshaw/591dc7dd54e4f99338a347ef568d6ee9#source-it) - - `close`: A method for closing the connection - - `conn`: The raw connection of the transport, such as a TCP socket. - - `remoteAddr`: The remote `Multiaddr` of the connection. - - `[localAddr]`: An optional local `Multiaddr` of the connection. - - `timeline`: A hash map of connection time events - - `open`: The time in ticks the connection was opened - - `close`: The time in ticks the connection was closed - -### Creating a transport instance - -- `const transport = new Transport({ upgrader, ...[options] })` - -Creates a new Transport instance. `options` is an JavaScript object that should include the necessary parameters for the transport instance. Options **MUST** include an `Upgrader` instance, as Transports will use this to return `interface-connection` instances from `transport.dial` and the listener `handlerFunction`. - -**Note: Why is it important to instantiate a transport -** Some transports have state that can be shared between the dialing and listening parts. For example with libp2p-webrtc-star, in order to dial a peer, the peer must be part of some signaling network that is shared with the listener. - -### Dial to another peer - -- `const connection = await transport.dial(multiaddr, [options])` - -This method uses a transport to dial a Peer listening on `multiaddr`. - -`multiaddr` must be of the type [`multiaddr`](https://www.npmjs.com/multiaddr). - -`[options]` the options that may be passed to the dial. Must support the `signal` option (see below) - -Dial **MUST** call and return `upgrader.upgradeOutbound(multiaddrConnection)`. The upgrader will return an [interface-connection](../connection) instance. - -The dial may throw an `Error` instance if there was a problem connecting to the `multiaddr`. - -### Canceling a dial - -Dials may be cancelled using an `AbortController`: - -```Javascript -const { AbortError } = require('libp2p-interfaces/src/transport/errors') -const controller = new AbortController() -try { - const conn = await mytransport.dial(ma, { signal: controller.signal }) - // Do stuff with conn here ... -} catch (err: any) { - if(err.code === AbortError.code) { - // Dial was aborted, just bail out - return - } - throw err -} - -// ---- -// In some other part of the code: - controller.abort() -// ---- -``` - -### Filtering Addresses - -- `const supportedAddrs = await transport.filter(multiaddrs)` - -When using a transport its important to be able to filter out `multiaddr`s that the transport doesn't support. A transport instance provides a filter method to return only the valid addresses it supports. - -`multiaddrs` must be an array of type [`multiaddr`](https://www.npmjs.com/multiaddr). -Filter returns an array of `multiaddr`. - -### Create a listener - -- `const listener = transport.createListener([options], handlerFunction)` - -This method creates a listener on the transport. Implementations **MUST** call `upgrader.upgradeInbound(multiaddrConnection)` and pass its results to the `handlerFunction` and any emitted `connection` events. - -`options` is an optional object that contains the properties the listener must have, in order to properly listen on a given transport/socket. - -`handlerFunction` is a function called each time a new connection is received. It must follow the following signature: `function (conn) {}`, where `conn` is a connection that follows the [`interface-connection`](../connection). - -The listener object created may emit the following events: - -- `listening` - when the listener is ready for incoming connections -- `close` - when the listener is closed -- `connection` - (`conn`) each time an incoming connection is received -- `error` - (`err`) each time there is an error on the connection - -### Start a listener - -- `await listener.listen(multiaddr)` - -This method puts the listener in `listening` mode, waiting for incoming connections. - -`multiaddr` is the address that the listener should bind to. - -### Get listener addrs - -- `listener.getAddrs()` - -This method returns the addresses on which this listener is listening. Useful when listening on port 0 or any interface (0.0.0.0). - -### Stop a listener - -- `await listener.close([options])` - -This method closes the listener so that no more connections can be opened on this transport instance. - -`options` is an optional object that may contain the following properties: - -- `timeout` - A timeout value (in ms) after which all connections on this transport will be destroyed if the transport is not able to close gracefully. (e.g `{ timeout: 1000 }`) - -## API Docs - -- - -## License - -Licensed under either of - -- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / ) -- MIT ([LICENSE-MIT](LICENSE-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/packages/interface-transport/img/badge.png b/packages/interface-transport/img/badge.png deleted file mode 100644 index 1c8fe6972b..0000000000 Binary files a/packages/interface-transport/img/badge.png and /dev/null differ diff --git a/packages/interface-transport/img/badge.sketch b/packages/interface-transport/img/badge.sketch deleted file mode 100644 index d36e0af1fe..0000000000 Binary files a/packages/interface-transport/img/badge.sketch and /dev/null differ diff --git a/packages/interface-transport/img/badge.svg b/packages/interface-transport/img/badge.svg deleted file mode 100644 index aa56dacd5e..0000000000 --- a/packages/interface-transport/img/badge.svg +++ /dev/null @@ -1,19 +0,0 @@ - - - - badge - Created with Sketch. - - - - - - Transpor - t - - - Compatibl - e - - - \ No newline at end of file diff --git a/packages/interface-transport/package.json b/packages/interface-transport/package.json deleted file mode 100644 index 96e5e13b0f..0000000000 --- a/packages/interface-transport/package.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "name": "@libp2p/interface-transport", - "version": "4.0.3", - "description": "Transport interface for libp2p", - "license": "Apache-2.0 OR MIT", - "homepage": "https://github.com/libp2p/js-libp2p/tree/master/packages/interface-transport#readme", - "repository": { - "type": "git", - "url": "git+https://github.com/libp2p/js-libp2p.git" - }, - "bugs": { - "url": "https://github.com/libp2p/js-libp2p/issues" - }, - "keywords": [ - "interface", - "libp2p" - ], - "type": "module", - "types": "./dist/src/index.d.ts", - "files": [ - "src", - "dist", - "!dist/test", - "!**/*.tsbuildinfo" - ], - "exports": { - ".": { - "types": "./dist/src/index.d.ts", - "import": "./dist/src/index.js" - } - }, - "eslintConfig": { - "extends": "ipfs", - "parserOptions": { - "sourceType": "module" - } - }, - "scripts": { - "clean": "aegir clean", - "lint": "aegir lint", - "dep-check": "aegir dep-check", - "build": "aegir build" - }, - "dependencies": { - "@libp2p/interface-connection": "^5.0.0", - "@libp2p/interface-stream-muxer": "^4.0.0", - "@libp2p/interfaces": "^3.0.0", - "@multiformats/multiaddr": "^12.1.3", - "it-stream-types": "^2.0.1" - }, - "devDependencies": { - "aegir": "^39.0.10" - }, - "typedoc": { - "entryPoint": "./src/index.ts" - } -} diff --git a/packages/interface-transport/tsconfig.json b/packages/interface-transport/tsconfig.json deleted file mode 100644 index 28ed110a13..0000000000 --- a/packages/interface-transport/tsconfig.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "extends": "aegir/src/config/tsconfig.aegir.json", - "compilerOptions": { - "outDir": "dist" - }, - "include": [ - "src", - "test" - ], - "references": [ - { - "path": "../interface-connection" - }, - { - "path": "../interface-stream-muxer" - }, - { - "path": "../interfaces" - } - ] -} diff --git a/packages/interface-libp2p/CHANGELOG.md b/packages/interface/CHANGELOG.md similarity index 80% rename from packages/interface-libp2p/CHANGELOG.md rename to packages/interface/CHANGELOG.md index 1c294f09b8..b8e2e0e2cf 100644 --- a/packages/interface-libp2p/CHANGELOG.md +++ b/packages/interface/CHANGELOG.md @@ -1,25 +1,25 @@ -## [@libp2p/interface-libp2p-v3.2.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-libp2p-v3.1.0...@libp2p/interface-libp2p-v3.2.0) (2023-05-19) +## [@libp2p/interface-v3.2.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-v3.1.0...@libp2p/interface-v3.2.0) (2023-05-19) ### Features * add start/stop events to libp2p interface ([#407](https://github.com/libp2p/js-libp2p-interfaces/issues/407)) ([016c1e8](https://github.com/libp2p/js-libp2p-interfaces/commit/016c1e82b060c93c80546cd8c493ec6e6c97cbec)) -## [@libp2p/interface-libp2p-v3.1.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-libp2p-v3.0.1...@libp2p/interface-libp2p-v3.1.0) (2023-05-05) +## [@libp2p/interface-v3.1.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-v3.0.1...@libp2p/interface-v3.1.0) (2023-05-05) ### Features * add peer:identify event to libp2p ([#395](https://github.com/libp2p/js-libp2p-interfaces/issues/395)) ([6aee82a](https://github.com/libp2p/js-libp2p-interfaces/commit/6aee82ad81a752f204ec27838ccd6de4908aeb0e)) -## [@libp2p/interface-libp2p-v3.0.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-libp2p-v3.0.0...@libp2p/interface-libp2p-v3.0.1) (2023-05-04) +## [@libp2p/interface-v3.0.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-v3.0.0...@libp2p/interface-v3.0.1) (2023-05-04) ### Dependencies * bump aegir from 38.1.8 to 39.0.5 ([#393](https://github.com/libp2p/js-libp2p-interfaces/issues/393)) ([31f3797](https://github.com/libp2p/js-libp2p-interfaces/commit/31f3797b24f7c23f3f16e9db3a230bd5f7cd5175)) -## [@libp2p/interface-libp2p-v3.0.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-libp2p-v2.0.0...@libp2p/interface-libp2p-v3.0.0) (2023-04-27) +## [@libp2p/interface-v3.0.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-v2.0.0...@libp2p/interface-v3.0.0) (2023-04-27) ### ⚠ BREAKING CHANGES @@ -35,7 +35,7 @@ * fix typos in docs ([#386](https://github.com/libp2p/js-libp2p-interfaces/issues/386)) ([8ec2cdc](https://github.com/libp2p/js-libp2p-interfaces/commit/8ec2cdcc5deed76e0c673a75c27bf7a2e931eea1)) -## [@libp2p/interface-libp2p-v2.0.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-libp2p-v1.3.2...@libp2p/interface-libp2p-v2.0.0) (2023-04-21) +## [@libp2p/interface-v2.0.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-v1.3.2...@libp2p/interface-v2.0.0) (2023-04-21) ### ⚠ BREAKING CHANGES @@ -52,14 +52,14 @@ * update sibling dependencies ([17ed429](https://github.com/libp2p/js-libp2p-interfaces/commit/17ed429d57e83cb38484ac52a0e0975a7d8af963)) * update sibling dependencies ([4421374](https://github.com/libp2p/js-libp2p-interfaces/commit/4421374d85ac7d4e9cf0b1a4c5072e881e091b31)) -## [@libp2p/interface-libp2p-v1.3.2](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-libp2p-v1.3.1...@libp2p/interface-libp2p-v1.3.2) (2023-04-21) +## [@libp2p/interface-v1.3.2](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-v1.3.1...@libp2p/interface-v1.3.2) (2023-04-21) ### Dependencies * update sibling dependencies ([bc1588c](https://github.com/libp2p/js-libp2p-interfaces/commit/bc1588c70ffa35c1ba9c954090a7ac8087a22b0c)) -## [@libp2p/interface-libp2p-v1.3.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-libp2p-v1.3.0...@libp2p/interface-libp2p-v1.3.1) (2023-04-18) +## [@libp2p/interface-v1.3.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-v1.3.0...@libp2p/interface-v1.3.1) (2023-04-18) ### Dependencies @@ -67,14 +67,14 @@ * update sibling dependencies ([3d23367](https://github.com/libp2p/js-libp2p-interfaces/commit/3d233676a17299bfa1b59d309543598176826523)) * update sibling dependencies ([2f52a28](https://github.com/libp2p/js-libp2p-interfaces/commit/2f52a284b59c0a88b040f86da1f5d3f044727f2c)) -## [@libp2p/interface-libp2p-v1.3.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-libp2p-v1.2.0...@libp2p/interface-libp2p-v1.3.0) (2023-04-17) +## [@libp2p/interface-v1.3.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-v1.2.0...@libp2p/interface-v1.3.0) (2023-04-17) ### Features * expose dial queue inspection method ([#374](https://github.com/libp2p/js-libp2p-interfaces/issues/374)) ([973263f](https://github.com/libp2p/js-libp2p-interfaces/commit/973263f582d39a5b727c9fd90abeea7ed72a9aff)) -## [@libp2p/interface-libp2p-v1.2.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-libp2p-v1.1.2...@libp2p/interface-libp2p-v1.2.0) (2023-04-11) +## [@libp2p/interface-v1.2.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-v1.1.2...@libp2p/interface-v1.2.0) (2023-04-11) ### Features @@ -86,21 +86,21 @@ * update sibling dependencies ([b034810](https://github.com/libp2p/js-libp2p-interfaces/commit/b0348102e41dc18166e70063f4708a2b3544f4b6)) -## [@libp2p/interface-libp2p-v1.1.2](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-libp2p-v1.1.1...@libp2p/interface-libp2p-v1.1.2) (2023-03-17) +## [@libp2p/interface-v1.1.2](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-v1.1.1...@libp2p/interface-v1.1.2) (2023-03-17) ### Dependencies * update @multiformats/multiaddr to 12.0.0 ([#354](https://github.com/libp2p/js-libp2p-interfaces/issues/354)) ([e0f327b](https://github.com/libp2p/js-libp2p-interfaces/commit/e0f327b5d54e240feabadce21a841629d633ec5e)) -## [@libp2p/interface-libp2p-v1.1.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-libp2p-v1.1.0...@libp2p/interface-libp2p-v1.1.1) (2023-01-18) +## [@libp2p/interface-v1.1.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-v1.1.0...@libp2p/interface-v1.1.1) (2023-01-18) ### Dependencies * bump aegir from 37.12.1 to 38.1.0 ([#335](https://github.com/libp2p/js-libp2p-interfaces/issues/335)) ([7368a36](https://github.com/libp2p/js-libp2p-interfaces/commit/7368a363423a08e8fa247dcb76ea13e4cf030d65)) -## [@libp2p/interface-libp2p-v1.1.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-libp2p-v1.0.2...@libp2p/interface-libp2p-v1.1.0) (2023-01-07) +## [@libp2p/interface-v1.1.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-v1.0.2...@libp2p/interface-v1.1.0) (2023-01-07) ### Features @@ -112,7 +112,7 @@ * remove lerna ([#330](https://github.com/libp2p/js-libp2p-interfaces/issues/330)) ([6678592](https://github.com/libp2p/js-libp2p-interfaces/commit/6678592dd0cf601a2671852f9d2a0aff5dee2b18)) -## [@libp2p/interface-libp2p-v1.0.2](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-libp2p-v1.0.1...@libp2p/interface-libp2p-v1.0.2) (2023-01-06) +## [@libp2p/interface-v1.0.2](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-v1.0.1...@libp2p/interface-v1.0.2) (2023-01-06) ### Dependencies @@ -122,14 +122,14 @@ * update sibling dependencies ([b599221](https://github.com/libp2p/js-libp2p-interfaces/commit/b599221d9044a0c573bac40c57e70a842930b253)) * update sibling dependencies ([b50e621](https://github.com/libp2p/js-libp2p-interfaces/commit/b50e621d31a8b32affc3fadb9f97c4883d577f93)) -## [@libp2p/interface-libp2p-v1.0.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-libp2p-v1.0.0...@libp2p/interface-libp2p-v1.0.1) (2022-12-21) +## [@libp2p/interface-v1.0.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interface-v1.0.0...@libp2p/interface-v1.0.1) (2022-12-21) ### Bug Fixes * add getProtocols method, events, and identify service ([#326](https://github.com/libp2p/js-libp2p-interfaces/issues/326)) ([b036505](https://github.com/libp2p/js-libp2p-interfaces/commit/b036505100d32742065190e47d1803cbd8f61f4a)) -## @libp2p/interface-libp2p-v1.0.0 (2022-12-19) +## @libp2p/interface-v1.0.0 (2022-12-19) ### Features diff --git a/packages/interface-connection-compliance-tests/LICENSE b/packages/interface/LICENSE similarity index 100% rename from packages/interface-connection-compliance-tests/LICENSE rename to packages/interface/LICENSE diff --git a/packages/interface-connection-compliance-tests/LICENSE-APACHE b/packages/interface/LICENSE-APACHE similarity index 100% rename from packages/interface-connection-compliance-tests/LICENSE-APACHE rename to packages/interface/LICENSE-APACHE diff --git a/packages/interface-connection-compliance-tests/LICENSE-MIT b/packages/interface/LICENSE-MIT similarity index 100% rename from packages/interface-connection-compliance-tests/LICENSE-MIT rename to packages/interface/LICENSE-MIT diff --git a/packages/record/README.md b/packages/interface/README.md similarity index 76% rename from packages/record/README.md rename to packages/interface/README.md index 1f95184c88..384bcb1b91 100644 --- a/packages/record/README.md +++ b/packages/interface/README.md @@ -1,17 +1,16 @@ -# @libp2p/record +# @libp2p/interface [![libp2p.io](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](http://libp2p.io/) [![Discuss](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg?style=flat-square)](https://discuss.libp2p.io) [![codecov](https://img.shields.io/codecov/c/github/libp2p/js-libp2p.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p) [![CI](https://img.shields.io/github/actions/workflow/status/libp2p/js-libp2p/main.yml?branch=master\&style=flat-square)](https://github.com/libp2p/js-libp2p/actions/workflows/main.yml?query=branch%3Amaster) -> libp2p record implementation +> The interface implemented by a libp2p node ## Table of contents - [Install](#install) - [Browser ` + ``` -## Description - -Implementation of [go-libp2p-record](https://github.com/libp2p/go-libp2p-record) in JavaScript. - ## API Docs -- +- ## License diff --git a/packages/interface/package.json b/packages/interface/package.json new file mode 100644 index 0000000000..8eb07daf71 --- /dev/null +++ b/packages/interface/package.json @@ -0,0 +1,177 @@ +{ + "name": "@libp2p/interface", + "version": "0.0.1", + "description": "The interface implemented by a libp2p node", + "license": "Apache-2.0 OR MIT", + "homepage": "https://github.com/libp2p/js-libp2p/tree/master/packages/interface#readme", + "repository": { + "type": "git", + "url": "git+https://github.com/libp2p/js-libp2p.git" + }, + "bugs": { + "url": "https://github.com/libp2p/js-libp2p/issues" + }, + "keywords": [ + "interface", + "libp2p" + ], + "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" + }, + "./connection": { + "types": "./dist/src/connection/index.d.ts", + "import": "./dist/src/connection/index.js" + }, + "./connection-encrypter": { + "types": "./dist/src/connection-encrypter/index.d.ts", + "import": "./dist/src/connection-encrypter/index.js" + }, + "./connection-gater": { + "types": "./dist/src/connection-gater/index.d.ts", + "import": "./dist/src/connection-gater/index.js" + }, + "./connection/status": { + "types": "./dist/src/connection/status.d.ts", + "import": "./dist/src/connection/status.js" + }, + "./content-routing": { + "types": "./dist/src/content-routing/index.d.ts", + "import": "./dist/src/content-routing/index.js" + }, + "./errors": { + "types": "./dist/src/errors.d.ts", + "import": "./dist/src/errors.js" + }, + "./events": { + "types": "./dist/src/events.d.ts", + "import": "./dist/src/events.js" + }, + "./keychain": { + "types": "./dist/src/keychain/index.d.ts", + "import": "./dist/src/keychain/index.js" + }, + "./keys": { + "types": "./dist/src/keys/index.d.ts", + "import": "./dist/src/keys/index.js" + }, + "./metrics": { + "types": "./dist/src/metrics/index.d.ts", + "import": "./dist/src/metrics/index.js" + }, + "./metrics/tracked-map": { + "types": "./dist/src/metrics/tracked-map.d.ts", + "import": "./dist/src/metrics/tracked-map.js" + }, + "./peer-discovery": { + "types": "./dist/src/peer-discovery/index.d.ts", + "import": "./dist/src/peer-discovery/index.js" + }, + "./peer-id": { + "types": "./dist/src/peer-id/index.d.ts", + "import": "./dist/src/peer-id/index.js" + }, + "./peer-info": { + "types": "./dist/src/peer-info/index.d.ts", + "import": "./dist/src/peer-info/index.js" + }, + "./peer-routing": { + "types": "./dist/src/peer-routing/index.d.ts", + "import": "./dist/src/peer-routing/index.js" + }, + "./peer-store": { + "types": "./dist/src/peer-store/index.d.ts", + "import": "./dist/src/peer-store/index.js" + }, + "./peer-store/tags": { + "types": "./dist/src/peer-store/tags.d.ts", + "import": "./dist/src/peer-store/tags.js" + }, + "./record": { + "types": "./dist/src/record/index.d.ts", + "import": "./dist/src/record/index.js" + }, + "./startable": { + "types": "./dist/src/startable.d.ts", + "import": "./dist/src/startable.js" + }, + "./stream-handler": { + "types": "./dist/src/stream-handler/index.d.ts", + "import": "./dist/src/stream-handler/index.js" + }, + "./stream-muxer": { + "types": "./dist/src/stream-muxer/index.d.ts", + "import": "./dist/src/stream-muxer/index.js" + }, + "./stream-muxer/stream": { + "types": "./dist/src/stream-muxer/stream.d.ts", + "import": "./dist/src/stream-muxer/stream.js" + }, + "./transport": { + "types": "./dist/src/transport/index.d.ts", + "import": "./dist/src/transport/index.js" + } + }, + "eslintConfig": { + "extends": "ipfs", + "parserOptions": { + "sourceType": "module" + } + }, + "scripts": { + "clean": "aegir clean", + "lint": "aegir lint", + "dep-check": "aegir dep-check", + "build": "aegir build", + "test": "aegir test", + "test:chrome": "aegir test -t browser --cov", + "test:chrome-webworker": "aegir test -t webworker", + "test:firefox": "aegir test -t browser -- --browser firefox", + "test:firefox-webworker": "aegir test -t webworker -- --browser firefox", + "test:node": "aegir test -t node --cov", + "test:electron-main": "aegir test -t electron-main" + }, + "dependencies": { + "@multiformats/multiaddr": "^12.1.3", + "abortable-iterator": "^5.0.1", + "any-signal": "^4.1.1", + "it-pushable": "^3.1.3", + "it-stream-types": "^2.0.1", + "multiformats": "^12.0.1", + "uint8arraylist": "^2.4.3" + }, + "devDependencies": { + "@types/sinon": "^10.0.15", + "aegir": "^39.0.10", + "sinon": "^15.1.2", + "sinon-ts": "^1.0.0" + }, + "typedoc": { + "entryPoint": "./src/index.ts" + } +} diff --git a/packages/interface-connection-encrypter/src/index.ts b/packages/interface/src/connection-encrypter/index.ts similarity index 95% rename from packages/interface-connection-encrypter/src/index.ts rename to packages/interface/src/connection-encrypter/index.ts index d8bcddd2e8..0a4245db33 100644 --- a/packages/interface-connection-encrypter/src/index.ts +++ b/packages/interface/src/connection-encrypter/index.ts @@ -1,4 +1,4 @@ -import type { PeerId } from '@libp2p/interface-peer-id' +import type { PeerId } from '../peer-id/index.js' import type { Duplex, Source } from 'it-stream-types' /** diff --git a/packages/interface-connection-gater/src/index.ts b/packages/interface/src/connection-gater/index.ts similarity index 97% rename from packages/interface-connection-gater/src/index.ts rename to packages/interface/src/connection-gater/index.ts index 923449ca5d..4d85f5806a 100644 --- a/packages/interface-connection-gater/src/index.ts +++ b/packages/interface/src/connection-gater/index.ts @@ -1,5 +1,5 @@ -import type { MultiaddrConnection } from '@libp2p/interface-connection' -import type { PeerId } from '@libp2p/interface-peer-id' +import type { MultiaddrConnection } from '../connection/index.js' +import type { PeerId } from '../peer-id/index.js' import type { Multiaddr } from '@multiformats/multiaddr' export interface ConnectionGater { diff --git a/packages/interface-connection/src/index.ts b/packages/interface/src/connection/index.ts similarity index 98% rename from packages/interface-connection/src/index.ts rename to packages/interface/src/connection/index.ts index ea5d9296d0..e143ae4926 100644 --- a/packages/interface-connection/src/index.ts +++ b/packages/interface/src/connection/index.ts @@ -1,6 +1,6 @@ import type * as Status from './status.js' -import type { PeerId } from '@libp2p/interface-peer-id' -import type { AbortOptions } from '@libp2p/interfaces' +import type { AbortOptions } from '../index.js' +import type { PeerId } from '../peer-id/index.js' import type { Multiaddr } from '@multiformats/multiaddr' import type { Duplex, Source } from 'it-stream-types' import type { Uint8ArrayList } from 'uint8arraylist' diff --git a/packages/interface-connection/src/status.ts b/packages/interface/src/connection/status.ts similarity index 100% rename from packages/interface-connection/src/status.ts rename to packages/interface/src/connection/status.ts diff --git a/packages/interface-content-routing/src/index.ts b/packages/interface/src/content-routing/index.ts similarity index 94% rename from packages/interface-content-routing/src/index.ts rename to packages/interface/src/content-routing/index.ts index c22bd19edb..126de5b069 100644 --- a/packages/interface-content-routing/src/index.ts +++ b/packages/interface/src/content-routing/index.ts @@ -1,5 +1,5 @@ -import type { PeerInfo } from '@libp2p/interface-peer-info' -import type { AbortOptions } from '@libp2p/interfaces' +import type { AbortOptions } from '../index.js' +import type { PeerInfo } from '../peer-info/index.js' import type { CID } from 'multiformats/cid' /** diff --git a/packages/interfaces/src/errors.ts b/packages/interface/src/errors.ts similarity index 52% rename from packages/interfaces/src/errors.ts rename to packages/interface/src/errors.ts index a25be515db..2913d2a488 100644 --- a/packages/interfaces/src/errors.ts +++ b/packages/interface/src/errors.ts @@ -33,3 +33,36 @@ export class CodeError = Record> ex this.props = props ?? {} as T // eslint-disable-line @typescript-eslint/consistent-type-assertions } } + +export class UnexpectedPeerError extends Error { + public code: string + + constructor (message = 'Unexpected Peer') { + super(message) + this.code = UnexpectedPeerError.code + } + + static readonly code = 'ERR_UNEXPECTED_PEER' +} + +export class InvalidCryptoExchangeError extends Error { + public code: string + + constructor (message = 'Invalid crypto exchange') { + super(message) + this.code = InvalidCryptoExchangeError.code + } + + static readonly code = 'ERR_INVALID_CRYPTO_EXCHANGE' +} + +export class InvalidCryptoTransmissionError extends Error { + public code: string + + constructor (message = 'Invalid crypto transmission') { + super(message) + this.code = InvalidCryptoTransmissionError.code + } + + static readonly code = 'ERR_INVALID_CRYPTO_TRANSMISSION' +} diff --git a/packages/interfaces/src/events.ts b/packages/interface/src/events.ts similarity index 99% rename from packages/interfaces/src/events.ts rename to packages/interface/src/events.ts index b92e51879e..4fff7e8f91 100644 --- a/packages/interfaces/src/events.ts +++ b/packages/interface/src/events.ts @@ -1,4 +1,3 @@ - export interface EventCallback { (evt: EventType): void } export interface EventObject { handleEvent: EventCallback } export type EventHandler = EventCallback | EventObject diff --git a/packages/interface/src/index.ts b/packages/interface/src/index.ts new file mode 100644 index 0000000000..d530e5e764 --- /dev/null +++ b/packages/interface/src/index.ts @@ -0,0 +1,627 @@ +/** + * @packageDocumentation + * + * Exports a `Libp2p` type for modules to use as a type argument. + * + * @example + * + * ```typescript + * import type { Libp2p } from '@libp2p/interface' + * + * function doSomethingWithLibp2p (node: Libp2p) { + * // ... + * } + * ``` + */ + +import type { Connection, Stream } from './connection/index.js' +import type { ContentRouting } from './content-routing/index.js' +import type { EventEmitter } from './events.js' +import type { KeyChain } from './keychain/index.js' +import type { Metrics } from './metrics/index.js' +import type { PeerId } from './peer-id/index.js' +import type { PeerInfo } from './peer-info/index.js' +import type { PeerRouting } from './peer-routing/index.js' +import type { Address, Peer, PeerStore } from './peer-store/index.js' +import type { Startable } from './startable.js' +import type { StreamHandler, StreamHandlerOptions } from './stream-handler/index.js' +import type { Topology } from './topology/index.js' +import type { Listener } from './transport/index.js' +import type { Multiaddr } from '@multiformats/multiaddr' + +/** + * Used by the connection manager to sort addresses into order before dialling + */ +export interface AddressSorter { + (a: Address, b: Address): -1 | 0 | 1 +} + +/** + * Event detail emitted when peer data changes + */ +export interface PeerUpdate { + peer: Peer + previous?: Peer +} + +/** + * Peer data signed by the remote Peer's public key + */ +export interface SignedPeerRecord { + addresses: Multiaddr[] + seq: bigint +} + +/** + * Data returned from a successful identify response + */ +export interface IdentifyResult { + /** + * The remote Peer's PeerId + */ + peerId: PeerId + + /** + * The unsigned addresses they are listening on. Note - any multiaddrs present + * in the signed peer record should be preferred to the value here. + */ + listenAddrs: Multiaddr[] + + /** + * The protocols the remote peer supports + */ + protocols: string[] + + /** + * The remote protocol version + */ + protocolVersion?: string + + /** + * The remote agent version + */ + agentVersion?: string + + /** + * The public key part of the remote PeerId - this is only useful for older + * RSA-based PeerIds, the more modern Ed25519 and secp256k1 types have the + * public key embedded in them + */ + publicKey?: Uint8Array + + /** + * If set this is the address that the remote peer saw the identify request + * originate from + */ + observedAddr?: Multiaddr + + /** + * If sent by the remote peer this is the deserialized signed peer record + */ + signedPeerRecord?: SignedPeerRecord +} + +/** + * Once you have a libp2p instance, you can listen to several events it emits, + * so that you can be notified of relevant network events. + * + * Event names are `noun:verb` so the first part is the name of the object + * being acted on and the second is the action. + */ +export interface Libp2pEvents { + /** + * This event is dispatched when a new network peer is discovered. + * + * @example + * + * ```js + * libp2p.addEventListener('peer:discovery', (event) => { + * const peerInfo = event.detail + * // ... + * }) + * ``` + */ + 'peer:discovery': CustomEvent + + /** + * This event will be triggered any time a new peer connects. + * + * @example + * + * ```js + * libp2p.addEventListener('peer:connect', (event) => { + * const peerId = event.detail + * // ... + * }) + * ``` + */ + 'peer:connect': CustomEvent + + /** + * This event will be triggered any time we are disconnected from another peer, regardless of + * the circumstances of that disconnection. If we happen to have multiple connections to a + * peer, this event will **only** be triggered when the last connection is closed. + * + * @example + * + * ```js + * libp2p.addEventListener('peer:disconnect', (event) => { + * const peerId = event.detail + * // ... + * }) + * ``` + */ + 'peer:disconnect': CustomEvent + + /** + * This event is dispatched after a remote peer has successfully responded to the identify + * protocol. Note that for this to be emitted, both peers must have an identify service + * configured. + * + * @example + * + * ```js + * libp2p.addEventListener('peer:identify', (event) => { + * const identifyResult = event.detail + * // ... + * }) + * ``` + */ + 'peer:identify': CustomEvent + + /** + * This event is dispatched when the peer store data for a peer has been + * updated - e.g. their multiaddrs, protocols etc have changed. + * + * If they were previously known to this node, the old peer data will be + * set in the `previous` field. + * + * This may be in response to the identify protocol running, a manual + * update or some other event. + */ + 'peer:update': CustomEvent + + /** + * This event is dispatched when the current node's peer record changes - + * for example a transport started listening on a new address or a new + * protocol handler was registered. + * + * @example + * + * ```js + * libp2p.addEventListener('self:peer:update', (event) => { + * const { peer } = event.detail + * // ... + * }) + * ``` + */ + 'self:peer:update': CustomEvent + + /** + * This event is dispatched when a transport begins listening on a new address + */ + 'transport:listening': CustomEvent + + /** + * This event is dispatched when a transport stops listening on an address + */ + 'transport:close': CustomEvent + + /** + * This event is dispatched when the connection manager has more than the + * configured allowable max connections and has closed some connections to + * bring the node back under the limit. + */ + 'connection:prune': CustomEvent + + /** + * This event notifies listeners when new incoming or outgoing connections + * are opened. + */ + 'connection:open': CustomEvent + + /** + * This event notifies listeners when incoming or outgoing connections are + * closed. + */ + 'connection:close': CustomEvent + + /** + * This event notifies listeners that the node has started + * + * ```js + * libp2p.addEventListener('start', (event) => { + * console.info(libp2p.isStarted()) // true + * }) + * ``` + */ + 'start': CustomEvent> + + /** + * This event notifies listeners that the node has stopped + * + * ```js + * libp2p.addEventListener('stop', (event) => { + * console.info(libp2p.isStarted()) // false + * }) + * ``` + */ + 'stop': CustomEvent> +} + +/** + * A map of user defined services available on the libp2p node via the + * `services` key + * + * @example + * + * ```js + * const node = await createLibp2p({ + * // ...other options + * services: { + * myService: myService({ + * // ...service options + * }) + * } + * }) + * + * // invoke methods on the service + * node.services.myService.anOperation() + * ``` + */ +export type ServiceMap = Record + +export type PendingDialStatus = 'queued' | 'active' | 'error' | 'success' + +/** + * An item in the dial queue + */ +export interface PendingDial { + /** + * A unique identifier for this dial + */ + id: string + + /** + * The current status of the dial + */ + status: PendingDialStatus + + /** + * If known, this is the peer id that libp2p expects to be dialling + */ + peerId?: PeerId + + /** + * The list of multiaddrs that will be dialled. The returned connection will + * use the first address that succeeds, all other dials part of this pending + * dial will be cancelled. + */ + multiaddrs: Multiaddr[] +} + +/** + * Libp2p nodes implement this interface. + */ +export interface Libp2p extends Startable, EventEmitter> { + /** + * The PeerId is a unique identifier for a node on the network. + * + * It is the hash of an RSA public key or, for Ed25519 or secp256k1 keys, + * the key itself. + * + * @example + * + * ```js + * console.info(libp2p.peerId) + * // PeerId(12D3Foo...) + * ```` + */ + peerId: PeerId + + /** + * The peer store holds information we know about other peers on the network. + * - multiaddrs, supported protocols, etc. + * + * @example + * + * ```js + * const peer = await libp2p.peerStore.get(peerId) + * console.info(peer) + * // { id: PeerId(12D3Foo...), addresses: [] ... } + * ``` + */ + peerStore: PeerStore + + /** + * The peer routing subsystem allows the user to find peers on the network + * or to find peers close to binary keys. + * + * @example + * + * ```js + * const peerInfo = await libp2p.peerRouting.findPeer(peerId) + * console.info(peerInfo) + * // { id: PeerId(12D3Foo...), multiaddrs: [] ... } + * ``` + * + * @example + * + * ```js + * for await (const peerInfo of libp2p.peerRouting.getClosestPeers(key)) { + * console.info(peerInfo) + * // { id: PeerId(12D3Foo...), multiaddrs: [] ... } + * } + * ``` + */ + peerRouting: PeerRouting + + /** + * The content routing subsystem allows the user to find providers for content, + * let the network know they are providers for content, and get/put values to + * the DHT. + * + * @example + * + * ```js + * for await (const peerInfo of libp2p.contentRouting.findProviders(cid)) { + * console.info(peerInfo) + * // { id: PeerId(12D3Foo...), multiaddrs: [] ... } + * } + * ``` + */ + contentRouting: ContentRouting + + /** + * The keychain contains the keys used by the current node, and can create new + * keys, export them, import them, etc. + * + * @example + * + * ```js + * const keyInfo = await libp2p.keychain.createKey('new key') + * console.info(keyInfo) + * // { id: '...', name: 'new key' } + * ``` + */ + keychain: KeyChain + + /** + * The metrics subsystem allows recording values to assess the health/performance + * of the running node. + * + * @example + * + * ```js + * const metric = libp2p.metrics.registerMetric({ + * 'my-metric' + * }) + * + * // later + * metric.update(5) + * ``` + */ + metrics?: Metrics + + /** + * Get a deduplicated list of peer advertising multiaddrs by concatenating + * the listen addresses used by transports with any configured + * announce addresses as well as observed addresses reported by peers. + * + * If Announce addrs are specified, configured listen addresses will be + * ignored though observed addresses will still be included. + * + * @example + * + * ```js + * const listenMa = libp2p.getMultiaddrs() + * // [ ] + * ``` + */ + getMultiaddrs: () => Multiaddr[] + + /** + * Returns a list of supported protocols + * + * @example + * + * ```js + * const protocols = libp2p.getProtocols() + * // [ '/ipfs/ping/1.0.0', '/ipfs/id/1.0.0' ] + * ``` + */ + getProtocols: () => string[] + + /** + * Return a list of all connections this node has open, optionally filtering + * by a PeerId + * + * @example + * + * ```js + * for (const connection of libp2p.getConnections()) { + * console.log(peerId, connection.remoteAddr.toString()) + * // Logs the PeerId string and the observed remote multiaddr of each Connection + * } + * ``` + */ + getConnections: (peerId?: PeerId) => Connection[] + + /** + * Return the list of dials currently in progress or queued to start + * + * @example + * + * ```js + * for (const pendingDial of libp2p.getDialQueue()) { + * console.log(pendingDial) + * } + * ``` + */ + getDialQueue: () => PendingDial[] + + /** + * Return a list of all peers we currently have a connection open to + */ + getPeers: () => PeerId[] + + /** + * Dials to the provided peer. If successful, the known metadata of the + * peer will be added to the nodes `peerStore`. + * + * If a PeerId is passed as the first argument, the peer will need to have known multiaddrs for it in the PeerStore. + * + * @example + * + * ```js + * const conn = await libp2p.dial(remotePeerId) + * + * // create a new stream within the connection + * const { stream, protocol } = await conn.newStream(['/echo/1.1.0', '/echo/1.0.0']) + * + * // protocol negotiated: 'echo/1.0.0' means that the other party only supports the older version + * + * // ... + * await conn.close() + * ``` + */ + dial: (peer: PeerId | Multiaddr | Multiaddr[], options?: AbortOptions) => Promise + + /** + * Dials to the provided peer and tries to handshake with the given protocols in order. + * If successful, the known metadata of the peer will be added to the nodes `peerStore`, + * and the `MuxedStream` will be returned together with the successful negotiated protocol. + * + * @example + * + * ```js + * import { pipe } from 'it-pipe' + * + * const { stream, protocol } = await libp2p.dialProtocol(remotePeerId, protocols) + * + * // Use this new stream like any other duplex stream + * pipe([1, 2, 3], stream, consume) + * ``` + */ + dialProtocol: (peer: PeerId | Multiaddr | Multiaddr[], protocols: string | string[], options?: AbortOptions) => Promise + + /** + * Attempts to gracefully close an open connection to the given peer. If the connection is not closed in the grace period, it will be forcefully closed. + * + * @example + * + * ```js + * await libp2p.hangUp(remotePeerId) + * ``` + */ + hangUp: (peer: PeerId | Multiaddr) => Promise + + /** + * Sets up [multistream-select routing](https://github.com/multiformats/multistream-select) of protocols to their application handlers. Whenever a stream is opened on one of the provided protocols, the handler will be called. `handle` must be called in order to register a handler and support for a given protocol. This also informs other peers of the protocols you support. + * + * `libp2p.handle(protocols, handler, options)` + * + * In the event of a new handler for the same protocol being added, the first one is discarded. + * + * @example + * + * ```js + * const handler = ({ connection, stream, protocol }) => { + * // use stream or connection according to the needs + * } + * + * libp2p.handle('/echo/1.0.0', handler, { + * maxInboundStreams: 5, + * maxOutboundStreams: 5 + * }) + * ``` + */ + handle: (protocol: string | string[], handler: StreamHandler, options?: StreamHandlerOptions) => Promise + + /** + * Removes the handler for each protocol. The protocol + * will no longer be supported on streams. + * + * @example + * + * ```js + * libp2p.unhandle(['/echo/1.0.0']) + * ``` + */ + unhandle: (protocols: string[] | string) => Promise + + /** + * Register a topology to be informed when peers are encountered that + * support the specified protocol + * + * @example + * + * ```js + * const id = await libp2p.register('/echo/1.0.0', { + * onConnect: (peer, connection) => { + * // handle connect + * }, + * onDisconnect: (peer, connection) => { + * // handle disconnect + * } + * }) + * ``` + */ + register: (protocol: string, topology: Topology) => Promise + + /** + * Unregister topology to no longer be informed when peers connect or + * disconnect. + * + * @example + * + * ```js + * const id = await libp2p.register(...) + * + * libp2p.unregister(id) + * ``` + */ + unregister: (id: string) => void + + /** + * Returns the public key for the passed PeerId. If the PeerId is of the 'RSA' type + * this may mean searching the DHT if the key is not present in the KeyStore. + * A set of user defined services + */ + getPublicKey: (peer: PeerId, options?: AbortOptions) => Promise + + /** + * A set of user defined services + */ + services: T +} + +/** + * An object that contains an AbortSignal as + * the optional `signal` property. + * + * @example + * + * ```js + * const controller = new AbortController() + * + * aLongRunningOperation({ + * signal: controller.signal + * }) + * + * // later + * + * controller.abort() + */ +export interface AbortOptions { + signal?: AbortSignal +} + +/** + * Returns a new type with all fields marked optional. + * + * Borrowed from the tsdef module. + */ +export type RecursivePartial = { + [P in keyof T]?: T[P] extends Array ? Array> : T[P] extends (...args: any[]) => any ? T[P] : RecursivePartial +} diff --git a/packages/interface-keychain/src/index.ts b/packages/interface/src/keychain/index.ts similarity index 97% rename from packages/interface-keychain/src/index.ts rename to packages/interface/src/keychain/index.ts index 1c71ea5b0b..7632041dab 100644 --- a/packages/interface-keychain/src/index.ts +++ b/packages/interface/src/keychain/index.ts @@ -20,7 +20,8 @@ * ``` */ -import type { PeerId } from '@libp2p/interface-peer-id' +import type { KeyType } from '../keys/index.js' +import type { PeerId } from '../peer-id/index.js' import type { Multibase } from 'multiformats/bases/interface' export interface KeyInfo { @@ -35,8 +36,6 @@ export interface KeyInfo { name: string } -export type KeyType = 'RSA' | 'Ed25519' | 'secp256k1' - export interface KeyChain { /** * Export an existing key as a PEM encrypted PKCS #8 string. diff --git a/packages/interface-keys/src/index.ts b/packages/interface/src/keys/index.ts similarity index 100% rename from packages/interface-keys/src/index.ts rename to packages/interface/src/keys/index.ts diff --git a/packages/interface-metrics/src/index.ts b/packages/interface/src/metrics/index.ts similarity index 98% rename from packages/interface-metrics/src/index.ts rename to packages/interface/src/metrics/index.ts index eaa89ca775..2d08189d30 100644 --- a/packages/interface-metrics/src/index.ts +++ b/packages/interface/src/metrics/index.ts @@ -1,4 +1,4 @@ -import type { MultiaddrConnection, Stream, Connection } from '@libp2p/interface-connection' +import type { MultiaddrConnection, Stream, Connection } from '../connection/index.js' /** * Create tracked metrics with these options. Loosely based on the diff --git a/packages/tracked-map/src/index.ts b/packages/interface/src/metrics/tracked-map.ts similarity index 94% rename from packages/tracked-map/src/index.ts rename to packages/interface/src/metrics/tracked-map.ts index 6cf3fa322c..82959e33e0 100644 --- a/packages/tracked-map/src/index.ts +++ b/packages/interface/src/metrics/tracked-map.ts @@ -1,4 +1,4 @@ -import type { Metric, Metrics } from '@libp2p/interface-metrics' +import type { Metric, Metrics } from './index.js' export interface TrackedMapInit { name: string diff --git a/packages/interface-peer-discovery/src/index.ts b/packages/interface/src/peer-discovery/index.ts similarity index 84% rename from packages/interface-peer-discovery/src/index.ts rename to packages/interface/src/peer-discovery/index.ts index b0840503d6..4b8aa9c258 100644 --- a/packages/interface-peer-discovery/src/index.ts +++ b/packages/interface/src/peer-discovery/index.ts @@ -1,5 +1,5 @@ -import type { PeerInfo } from '@libp2p/interface-peer-info' -import type { EventEmitter } from '@libp2p/interfaces/events' +import type { EventEmitter } from '../events.js' +import type { PeerInfo } from '../peer-info/index.js' /** * Any object that implements this Symbol as a property should return a diff --git a/packages/interface-peer-id/src/index.ts b/packages/interface/src/peer-id/index.ts similarity index 100% rename from packages/interface-peer-id/src/index.ts rename to packages/interface/src/peer-id/index.ts diff --git a/packages/interface-peer-info/src/index.ts b/packages/interface/src/peer-info/index.ts similarity index 72% rename from packages/interface-peer-info/src/index.ts rename to packages/interface/src/peer-info/index.ts index 59ae2b5d33..25dbd9f208 100644 --- a/packages/interface-peer-info/src/index.ts +++ b/packages/interface/src/peer-info/index.ts @@ -1,4 +1,4 @@ -import type { PeerId } from '@libp2p/interface-peer-id' +import type { PeerId } from '../peer-id/index.js' import type { Multiaddr } from '@multiformats/multiaddr' export interface PeerInfo { diff --git a/packages/interface-peer-routing/src/index.ts b/packages/interface/src/peer-routing/index.ts similarity index 88% rename from packages/interface-peer-routing/src/index.ts rename to packages/interface/src/peer-routing/index.ts index d4bbef25c8..bfdded212d 100644 --- a/packages/interface-peer-routing/src/index.ts +++ b/packages/interface/src/peer-routing/index.ts @@ -1,6 +1,6 @@ -import type { PeerId } from '@libp2p/interface-peer-id' -import type { PeerInfo } from '@libp2p/interface-peer-info' -import type { AbortOptions } from '@libp2p/interfaces' +import type { AbortOptions } from '../index.js' +import type { PeerId } from '../peer-id/index.js' +import type { PeerInfo } from '../peer-info/index.js' /** * Any object that implements this Symbol as a property should return a diff --git a/packages/interface-peer-store/src/index.ts b/packages/interface/src/peer-store/index.ts similarity index 99% rename from packages/interface-peer-store/src/index.ts rename to packages/interface/src/peer-store/index.ts index 7350ccc448..93ad16e103 100644 --- a/packages/interface-peer-store/src/index.ts +++ b/packages/interface/src/peer-store/index.ts @@ -1,4 +1,4 @@ -import type { PeerId } from '@libp2p/interface-peer-id' +import type { PeerId } from '../peer-id/index.js' import type { Multiaddr } from '@multiformats/multiaddr' /** diff --git a/packages/interface-peer-store/src/tags.ts b/packages/interface/src/peer-store/tags.ts similarity index 100% rename from packages/interface-peer-store/src/tags.ts rename to packages/interface/src/peer-store/tags.ts diff --git a/packages/interface/src/record/index.ts b/packages/interface/src/record/index.ts new file mode 100644 index 0000000000..cb68e14206 --- /dev/null +++ b/packages/interface/src/record/index.ts @@ -0,0 +1,35 @@ +import type { PeerId } from '../peer-id/index.js' +import type { Uint8ArrayList } from 'uint8arraylist' + +/** + * Record is the base implementation of a record that can be used as the payload of a libp2p envelope. + */ +export interface Record { + /** + * signature domain. + */ + domain: string + /** + * identifier of the type of record + */ + codec: Uint8Array + /** + * Marshal a record to be used in an envelope. + */ + marshal: () => Uint8Array + /** + * Verifies if the other provided Record is identical to this one. + */ + equals: (other: Record) => boolean +} + +export interface Envelope { + peerId: PeerId + payloadType: Uint8Array | Uint8ArrayList + payload: Uint8Array + signature: Uint8Array | Uint8ArrayList + + marshal: () => Uint8Array + validate: (domain: string) => Promise + equals: (other: Envelope) => boolean +} diff --git a/packages/interfaces/src/startable.ts b/packages/interface/src/startable.ts similarity index 100% rename from packages/interfaces/src/startable.ts rename to packages/interface/src/startable.ts diff --git a/packages/interface/src/stream-handler/index.ts b/packages/interface/src/stream-handler/index.ts new file mode 100644 index 0000000000..f5ab77038a --- /dev/null +++ b/packages/interface/src/stream-handler/index.ts @@ -0,0 +1,27 @@ +import type { Connection, Stream } from '../connection/index.js' + +export interface IncomingStreamData { + stream: Stream + connection: Connection +} + +export interface StreamHandler { + (data: IncomingStreamData): void +} + +export interface StreamHandlerOptions { + /** + * How many incoming streams can be open for this protocol at the same time on each connection (default: 32) + */ + maxInboundStreams?: number + + /** + * How many outgoing streams can be open for this protocol at the same time on each connection (default: 64) + */ + maxOutboundStreams?: number +} + +export interface StreamHandlerRecord { + handler: StreamHandler + options: StreamHandlerOptions +} diff --git a/packages/interface-stream-muxer/src/index.ts b/packages/interface/src/stream-muxer/index.ts similarity index 92% rename from packages/interface-stream-muxer/src/index.ts rename to packages/interface/src/stream-muxer/index.ts index da782d5314..c4861fceb5 100644 --- a/packages/interface-stream-muxer/src/index.ts +++ b/packages/interface/src/stream-muxer/index.ts @@ -1,5 +1,5 @@ -import type { Direction, Stream } from '@libp2p/interface-connection' -import type { AbortOptions } from '@libp2p/interfaces' +import type { Direction, Stream } from '../connection/index.js' +import type { AbortOptions } from '../index.js' import type { Duplex, Source } from 'it-stream-types' import type { Uint8ArrayList } from 'uint8arraylist' diff --git a/packages/interface-stream-muxer/src/stream.ts b/packages/interface/src/stream-muxer/stream.ts similarity index 97% rename from packages/interface-stream-muxer/src/stream.ts rename to packages/interface/src/stream-muxer/stream.ts index 08d08ed517..43d630000d 100644 --- a/packages/interface-stream-muxer/src/stream.ts +++ b/packages/interface/src/stream-muxer/stream.ts @@ -1,13 +1,17 @@ -import { CodeError } from '@libp2p/interfaces/errors' -import { logger } from '@libp2p/logger' +// import { logger } from '@libp2p/logger' import { abortableSource } from 'abortable-iterator' import { anySignal } from 'any-signal' import { type Pushable, pushable } from 'it-pushable' import { Uint8ArrayList } from 'uint8arraylist' -import type { Direction, Stream, StreamStat } from '@libp2p/interface-connection' +import { CodeError } from '../errors.js' +import type { Direction, Stream, StreamStat } from '../connection/index.js' import type { Source } from 'it-stream-types' -const log = logger('libp2p:stream') +// const log = logger('libp2p:stream') + +const log: any = () => {} +log.trace = () => {} +log.error = () => {} const ERR_STREAM_RESET = 'ERR_STREAM_RESET' const ERR_STREAM_ABORT = 'ERR_STREAM_ABORT' diff --git a/packages/interface/src/topology/index.ts b/packages/interface/src/topology/index.ts new file mode 100644 index 0000000000..697c598494 --- /dev/null +++ b/packages/interface/src/topology/index.ts @@ -0,0 +1,10 @@ +import type { Connection } from '../connection/index.js' +import type { PeerId } from '../peer-id/index.js' + +export interface Topology { + min?: number + max?: number + + onConnect?: (peerId: PeerId, conn: Connection) => void + onDisconnect?: (peerId: PeerId) => void +} diff --git a/packages/interface-transport/src/index.ts b/packages/interface/src/transport/index.ts similarity index 74% rename from packages/interface-transport/src/index.ts rename to packages/interface/src/transport/index.ts index 4b14bd2d3e..5b84a60e1d 100644 --- a/packages/interface-transport/src/index.ts +++ b/packages/interface/src/transport/index.ts @@ -1,9 +1,32 @@ -import type { Connection, MultiaddrConnection } from '@libp2p/interface-connection' -import type { StreamMuxerFactory } from '@libp2p/interface-stream-muxer' -import type { AbortOptions } from '@libp2p/interfaces' -import type { EventEmitter } from '@libp2p/interfaces/events' +import type { Connection, MultiaddrConnection } from '../connection/index.js' +import type { EventEmitter } from '../events.js' +import type { AbortOptions } from '../index.js' +import type { StreamMuxerFactory } from '../stream-muxer/index.js' import type { Multiaddr } from '@multiformats/multiaddr' -import type { Duplex } from 'it-stream-types' + +export interface ListenerEvents { + 'connection': CustomEvent + 'listening': CustomEvent + 'error': CustomEvent + 'close': CustomEvent +} + +export interface Listener extends EventEmitter { + /** + * Start a listener + */ + listen: (multiaddr: Multiaddr) => Promise + /** + * Get listen addresses + */ + getAddrs: () => Multiaddr[] + /** + * Close listener + * + * @returns {Promise} + */ + close: () => Promise +} export const symbol = Symbol.for('@libp2p/transport') @@ -50,28 +73,23 @@ export interface Transport { filter: MultiaddrFilter } -export interface ListenerEvents { - 'connection': CustomEvent - 'listening': CustomEvent - 'error': CustomEvent - 'close': CustomEvent +export function isTransport (other: any): other is Transport { + return other != null && Boolean(other[symbol]) } -export interface Listener extends EventEmitter { - /** - * Start a listener - */ - listen: (multiaddr: Multiaddr) => Promise +/** + * Enum Transport Manager Fault Tolerance values + */ +export enum FaultTolerance { /** - * Get listen addresses + * should be used for failing in any listen circumstance */ - getAddrs: () => Multiaddr[] + FATAL_ALL = 0, + /** - * Close listener - * - * @returns {Promise} + * should be used for not failing when not listening */ - close: () => Promise + NO_FATAL } export interface UpgraderOptions { @@ -91,38 +109,3 @@ export interface Upgrader { */ upgradeInbound: (maConn: MultiaddrConnection, opts?: UpgraderOptions) => Promise } - -export interface ProtocolHandler { - (stream: Duplex, connection: Connection): void -} - -export function isTransport (other: any): other is Transport { - return other != null && Boolean(other[symbol]) -} - -export interface TransportManager { - add: (transport: Transport) => void - dial: (ma: Multiaddr, options?: any) => Promise - getAddrs: () => Multiaddr[] - getTransports: () => Transport[] - getListeners: () => Listener[] - transportForMultiaddr: (ma: Multiaddr) => Transport | undefined - listen: (addrs: Multiaddr[]) => Promise - remove: (key: string) => Promise - removeAll: () => Promise -} - -/** - * Enum Transport Manager Fault Tolerance values - */ -export enum FaultTolerance { - /** - * should be used for failing in any listen circumstance - */ - FATAL_ALL = 0, - - /** - * should be used for not failing when not listening - */ - NO_FATAL -} diff --git a/packages/tracked-map/test/index.spec.ts b/packages/interface/test/metrics/tracked-map.spec.ts similarity index 94% rename from packages/tracked-map/test/index.spec.ts rename to packages/interface/test/metrics/tracked-map.spec.ts index 4450f41df8..a24d6a0c9b 100644 --- a/packages/tracked-map/test/index.spec.ts +++ b/packages/interface/test/metrics/tracked-map.spec.ts @@ -1,7 +1,7 @@ import { expect } from 'aegir/chai' import { stubInterface } from 'sinon-ts' -import { trackedMap } from '../src/index.js' -import type { Metric, Metrics } from '@libp2p/interface-metrics' +import { trackedMap } from '../../src/metrics/tracked-map.js' +import type { Metric, Metrics } from '../../src/metrics/index.js' import type { SinonStubbedInstance } from 'sinon' describe('tracked-map', () => { diff --git a/packages/interface-keys/tsconfig.json b/packages/interface/tsconfig.json similarity index 85% rename from packages/interface-keys/tsconfig.json rename to packages/interface/tsconfig.json index 5fe8ea40d7..13a3599639 100644 --- a/packages/interface-keys/tsconfig.json +++ b/packages/interface/tsconfig.json @@ -4,6 +4,7 @@ "outDir": "dist" }, "include": [ - "src" + "src", + "test" ] } diff --git a/packages/interfaces/CHANGELOG.md b/packages/interfaces/CHANGELOG.md deleted file mode 100644 index c9960901e2..0000000000 --- a/packages/interfaces/CHANGELOG.md +++ /dev/null @@ -1,1120 +0,0 @@ -## [@libp2p/interfaces-v3.3.2](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interfaces-v3.3.1...@libp2p/interfaces-v3.3.2) (2023-05-04) - - -### Dependencies - -* bump aegir from 38.1.8 to 39.0.5 ([#393](https://github.com/libp2p/js-libp2p-interfaces/issues/393)) ([31f3797](https://github.com/libp2p/js-libp2p-interfaces/commit/31f3797b24f7c23f3f16e9db3a230bd5f7cd5175)) - -## [@libp2p/interfaces-v3.3.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interfaces-v3.3.0...@libp2p/interfaces-v3.3.1) (2023-01-18) - - -### Dependencies - -* bump aegir from 37.12.1 to 38.1.0 ([#335](https://github.com/libp2p/js-libp2p-interfaces/issues/335)) ([7368a36](https://github.com/libp2p/js-libp2p-interfaces/commit/7368a363423a08e8fa247dcb76ea13e4cf030d65)) - -## [@libp2p/interfaces-v3.3.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interfaces-v3.2.0...@libp2p/interfaces-v3.3.0) (2023-01-17) - - -### Features - -* safe dispatch event ([#319](https://github.com/libp2p/js-libp2p-interfaces/issues/319)) ([8caeee8](https://github.com/libp2p/js-libp2p-interfaces/commit/8caeee8221e78c2412d8aeb9a7db7cc43abfdf1b)), closes [#317](https://github.com/libp2p/js-libp2p-interfaces/issues/317) - - -### Trivial Changes - -* remove lerna ([#330](https://github.com/libp2p/js-libp2p-interfaces/issues/330)) ([6678592](https://github.com/libp2p/js-libp2p-interfaces/commit/6678592dd0cf601a2671852f9d2a0aff5dee2b18)) - -## [@libp2p/interfaces-v3.2.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interfaces-v3.1.0...@libp2p/interfaces-v3.2.0) (2023-01-03) - - -### Features - -* add CodeError ([#314](https://github.com/libp2p/js-libp2p-interfaces/issues/314)) ([59aa8f7](https://github.com/libp2p/js-libp2p-interfaces/commit/59aa8f7fd2a8e80fc28e76fef320c531884e7e00)), closes [/github.com/libp2p/js-libp2p-crypto/pull/284#issuecomment-1324005434](https://github.com/libp2p//github.com/libp2p/js-libp2p-crypto/pull/284/issues/issuecomment-1324005434) - -## [@libp2p/interfaces-v3.1.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interfaces-v3.0.6...@libp2p/interfaces-v3.1.0) (2022-12-19) - - -### Features - -* add libp2p interface ([#325](https://github.com/libp2p/js-libp2p-interfaces/issues/325)) ([79a474d](https://github.com/libp2p/js-libp2p-interfaces/commit/79a474d8eda95ad3ff3bcdb2a15bfcf778f51772)) - -## [@libp2p/interfaces-v3.0.6](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interfaces-v3.0.5...@libp2p/interfaces-v3.0.6) (2022-12-16) - - -### Documentation - -* update project config ([#323](https://github.com/libp2p/js-libp2p-interfaces/issues/323)) ([0fc6a08](https://github.com/libp2p/js-libp2p-interfaces/commit/0fc6a08e9cdcefe361fe325281a3a2a03759ff59)) - -## [@libp2p/interfaces-v3.0.5](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interfaces-v3.0.4...@libp2p/interfaces-v3.0.5) (2022-12-14) - - -### Bug Fixes - -* generate docs for all packages ([#321](https://github.com/libp2p/js-libp2p-interfaces/issues/321)) ([b6f8b32](https://github.com/libp2p/js-libp2p-interfaces/commit/b6f8b32a920c15a28fe021e6050e31aaae89d518)) - -## [@libp2p/interfaces-v3.0.4](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interfaces-v3.0.3...@libp2p/interfaces-v3.0.4) (2022-11-05) - - -### Bug Fixes - -* update project config ([#311](https://github.com/libp2p/js-libp2p-interfaces/issues/311)) ([27dd0ce](https://github.com/libp2p/js-libp2p-interfaces/commit/27dd0ce3c249892ac69cbb24ddaf0b9f32385e37)) - - -### Trivial Changes - -* update project config ([#271](https://github.com/libp2p/js-libp2p-interfaces/issues/271)) ([59c0bf5](https://github.com/libp2p/js-libp2p-interfaces/commit/59c0bf5e0b05496fca2e4902632b61bb41fad9e9)) - -## [@libp2p/interfaces-v3.0.3](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interfaces-v3.0.2...@libp2p/interfaces-v3.0.3) (2022-06-27) - - -### Trivial Changes - -* update deps ([#262](https://github.com/libp2p/js-libp2p-interfaces/issues/262)) ([51edf7d](https://github.com/libp2p/js-libp2p-interfaces/commit/51edf7d9b3765a6f75c915b1483ea345d0133a41)) - -## [@libp2p/interfaces-v3.0.2](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interfaces-v3.0.1...@libp2p/interfaces-v3.0.2) (2022-06-14) - - -### Trivial Changes - -* update aegir ([#234](https://github.com/libp2p/js-libp2p-interfaces/issues/234)) ([3e03895](https://github.com/libp2p/js-libp2p-interfaces/commit/3e038959ecab6cfa3585df9ee179c0af7a61eda5)) - -## [@libp2p/interfaces-v3.0.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interfaces-v3.0.0...@libp2p/interfaces-v3.0.1) (2022-06-14) - - -### Trivial Changes - -* update readmes ([#233](https://github.com/libp2p/js-libp2p-interfaces/issues/233)) ([ee7da38](https://github.com/libp2p/js-libp2p-interfaces/commit/ee7da38dccc08160d26c8436df8739ce7e0b340e)) - -## [@libp2p/interfaces-v3.0.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interfaces-v2.0.4...@libp2p/interfaces-v3.0.0) (2022-06-14) - - -### ⚠ BREAKING CHANGES - -* most modules have been split out of the `@libp2p/interfaces` and `@libp2p/interface-compliance-tests` packages - -### Trivial Changes - -* break modules apart ([#232](https://github.com/libp2p/js-libp2p-interfaces/issues/232)) ([385614e](https://github.com/libp2p/js-libp2p-interfaces/commit/385614e772329052ab17415c8bd421f65b01a61b)), closes [#226](https://github.com/libp2p/js-libp2p-interfaces/issues/226) - -## [@libp2p/interfaces-v2.0.4](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interfaces-v2.0.3...@libp2p/interfaces-v2.0.4) (2022-06-14) - - -### Bug Fixes - -* event emitter types ([#230](https://github.com/libp2p/js-libp2p-interfaces/issues/230)) ([f16f74f](https://github.com/libp2p/js-libp2p-interfaces/commit/f16f74fc972e537698884c1910854e9630058c36)), closes [#227](https://github.com/libp2p/js-libp2p-interfaces/issues/227) - - -### Trivial Changes - -* add missing deps ([#229](https://github.com/libp2p/js-libp2p-interfaces/issues/229)) ([cc3cece](https://github.com/libp2p/js-libp2p-interfaces/commit/cc3cece290108302fb84501e2500fb18cd99f90f)) - -## [@libp2p/interfaces-v2.0.3](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interfaces-v2.0.2...@libp2p/interfaces-v2.0.3) (2022-05-31) - - -### Bug Fixes - -* dead badge ([#221](https://github.com/libp2p/js-libp2p-interfaces/issues/221)) ([2b7fa07](https://github.com/libp2p/js-libp2p-interfaces/commit/2b7fa07935f800b2438b054b9678e9b16694bf45)) - -## [@libp2p/interfaces-v2.0.2](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interfaces-v2.0.1...@libp2p/interfaces-v2.0.2) (2022-05-24) - - -### Bug Fixes - -* accept abort options in connection.newStream ([#219](https://github.com/libp2p/js-libp2p-interfaces/issues/219)) ([8bfcbc9](https://github.com/libp2p/js-libp2p-interfaces/commit/8bfcbc9ee883336f213cdfc83e477549ca368df5)) - -## [@libp2p/interfaces-v2.0.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interfaces-v2.0.0...@libp2p/interfaces-v2.0.1) (2022-05-23) - - -### Bug Fixes - -* make stream return types synchronous ([#217](https://github.com/libp2p/js-libp2p-interfaces/issues/217)) ([2fe61b7](https://github.com/libp2p/js-libp2p-interfaces/commit/2fe61b7fbeda2e549edf095a927d623aa8eb476b)) - -## [@libp2p/interfaces-v2.0.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interfaces-v1.3.32...@libp2p/interfaces-v2.0.0) (2022-05-20) - - -### ⚠ BREAKING CHANGES - -* This adds closeWrite and closeRead checks in the tests, which will cause test failures for muxers that don't implement those - -### Bug Fixes - -* close streams when connection is closed ([#214](https://github.com/libp2p/js-libp2p-interfaces/issues/214)) ([88fcd58](https://github.com/libp2p/js-libp2p-interfaces/commit/88fcd586276e03dd740c7095f05e21754ac1f3b5)), closes [#90](https://github.com/libp2p/js-libp2p-interfaces/issues/90) - -## [@libp2p/interfaces-v1.3.32](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interfaces-v1.3.31...@libp2p/interfaces-v1.3.32) (2022-05-06) - - -### Bug Fixes - -* add tag to peer discovery interface ([#210](https://github.com/libp2p/js-libp2p-interfaces/issues/210)) ([f99c833](https://github.com/libp2p/js-libp2p-interfaces/commit/f99c833c8436f8434f380d890ec5d267279312d7)) - -## [@libp2p/interfaces-v1.3.31](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interfaces-v1.3.30...@libp2p/interfaces-v1.3.31) (2022-05-04) - - -### Bug Fixes - -* move startable and events interfaces ([#209](https://github.com/libp2p/js-libp2p-interfaces/issues/209)) ([8ce8a08](https://github.com/libp2p/js-libp2p-interfaces/commit/8ce8a08c94b0738aa32da516558977b195ddd8ed)) - -## [@libp2p/interfaces-v1.3.30](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interfaces-v1.3.29...@libp2p/interfaces-v1.3.30) (2022-05-04) - - -### Bug Fixes - -* remove connection manager options ([#208](https://github.com/libp2p/js-libp2p-interfaces/issues/208)) ([b93d051](https://github.com/libp2p/js-libp2p-interfaces/commit/b93d051cb889b175f324f589546033d6723b1298)) - -## [@libp2p/interfaces-v1.3.29](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interfaces-v1.3.28...@libp2p/interfaces-v1.3.29) (2022-05-03) - - -### Bug Fixes - -* only send handled protocols ([#207](https://github.com/libp2p/js-libp2p-interfaces/issues/207)) ([1f7afc2](https://github.com/libp2p/js-libp2p-interfaces/commit/1f7afc29d72fde708064ec6479011dbc0a225962)) - -## [@libp2p/interfaces-v1.3.28](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interfaces-v1.3.27...@libp2p/interfaces-v1.3.28) (2022-05-01) - - -### Bug Fixes - -* add abort options to open connection ([#206](https://github.com/libp2p/js-libp2p-interfaces/issues/206)) ([b32234f](https://github.com/libp2p/js-libp2p-interfaces/commit/b32234f97b6e5cf93ea103b9650bea2119ce6025)) - -## [@libp2p/interfaces-v1.3.27](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interfaces-v1.3.26...@libp2p/interfaces-v1.3.27) (2022-05-01) - - -### Bug Fixes - -* move connection manager mock to connection manager module ([#205](https://github.com/libp2p/js-libp2p-interfaces/issues/205)) ([a367375](https://github.com/libp2p/js-libp2p-interfaces/commit/a367375accc690d7b4608c9a3313f91df700efd8)) - -## [@libp2p/interfaces-v1.3.26](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interfaces-v1.3.25...@libp2p/interfaces-v1.3.26) (2022-04-28) - - -### Bug Fixes - -* pubsub should not be startable ([#204](https://github.com/libp2p/js-libp2p-interfaces/issues/204)) ([59bd924](https://github.com/libp2p/js-libp2p-interfaces/commit/59bd9245a207268525bdd26a05c5306fe436fcc4)) - -## [@libp2p/interfaces-v1.3.25](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interfaces-v1.3.24...@libp2p/interfaces-v1.3.25) (2022-04-28) - - -### Bug Fixes - -* pubsub and dht are always set ([#203](https://github.com/libp2p/js-libp2p-interfaces/issues/203)) ([86860c1](https://github.com/libp2p/js-libp2p-interfaces/commit/86860c1836a2464b2ad380b09542e3f3271ae287)) - -## [@libp2p/interfaces-v1.3.24](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interfaces-v1.3.23...@libp2p/interfaces-v1.3.24) (2022-04-22) - - -### Bug Fixes - -* update pubsub interface in line with gossipsub ([#199](https://github.com/libp2p/js-libp2p-interfaces/issues/199)) ([3f55596](https://github.com/libp2p/js-libp2p-interfaces/commit/3f555965cddea3ef03e7217b755c82aa4107e093)) - -## [@libp2p/interfaces-v1.3.23](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interfaces-v1.3.22...@libp2p/interfaces-v1.3.23) (2022-04-21) - - -### Bug Fixes - -* test PubSub interface and not PubSubBaseProtocol ([#198](https://github.com/libp2p/js-libp2p-interfaces/issues/198)) ([96c15c9](https://github.com/libp2p/js-libp2p-interfaces/commit/96c15c9780821a3cb763e48854d64377bf562692)) - -## [@libp2p/interfaces-v1.3.22](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interfaces-v1.3.21...@libp2p/interfaces-v1.3.22) (2022-04-20) - - -### Bug Fixes - -* emit pubsub messages using 'message' event ([#197](https://github.com/libp2p/js-libp2p-interfaces/issues/197)) ([df9b685](https://github.com/libp2p/js-libp2p-interfaces/commit/df9b685cea30653109f2fa2cb5583a3bca7b09bb)) - -## [@libp2p/interfaces-v1.3.21](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interfaces-v1.3.20...@libp2p/interfaces-v1.3.21) (2022-04-13) - - -### Bug Fixes - -* add keychain types, fix bigint types ([#193](https://github.com/libp2p/js-libp2p-interfaces/issues/193)) ([9ceadf9](https://github.com/libp2p/js-libp2p-interfaces/commit/9ceadf9d5c42a12d88d74ddd9140e34f7fa63537)) - -## [@libp2p/interfaces-v1.3.20](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interfaces-v1.3.19...@libp2p/interfaces-v1.3.20) (2022-04-08) - - -### Trivial Changes - -* update aegir ([#192](https://github.com/libp2p/js-libp2p-interfaces/issues/192)) ([41c1494](https://github.com/libp2p/js-libp2p-interfaces/commit/41c14941e8b67d6601a90b4d48a2776573d55e60)) - -## [@libp2p/interfaces-v1.3.19](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interfaces-v1.3.18...@libp2p/interfaces-v1.3.19) (2022-04-08) - - -### Bug Fixes - -* swap protobufjs for protons ([#191](https://github.com/libp2p/js-libp2p-interfaces/issues/191)) ([d72b30c](https://github.com/libp2p/js-libp2p-interfaces/commit/d72b30cfca4b9145e0b31db28e8fa3329a180e83)) - -## [@libp2p/interfaces-v1.3.18](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interfaces-v1.3.17...@libp2p/interfaces-v1.3.18) (2022-03-24) - - -### Bug Fixes - -* rename peer data to peer info ([#187](https://github.com/libp2p/js-libp2p-interfaces/issues/187)) ([dfea342](https://github.com/libp2p/js-libp2p-interfaces/commit/dfea3429bad57abde040397e4e7a58539829e9c2)) - -## [@libp2p/interfaces-v1.3.17](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interfaces-v1.3.16...@libp2p/interfaces-v1.3.17) (2022-03-21) - - -### Bug Fixes - -* expand startable interface ([#184](https://github.com/libp2p/js-libp2p-interfaces/issues/184)) ([b8e1a0c](https://github.com/libp2p/js-libp2p-interfaces/commit/b8e1a0c77316265cc08eaaf9fcab6cfa05d59ae1)) - -## [@libp2p/interfaces-v1.3.16](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interfaces-v1.3.15...@libp2p/interfaces-v1.3.16) (2022-03-20) - - -### Bug Fixes - -* update pubsub types ([#183](https://github.com/libp2p/js-libp2p-interfaces/issues/183)) ([7ef4baa](https://github.com/libp2p/js-libp2p-interfaces/commit/7ef4baad0fe30f783f3eecd5199ef92af08b7f57)) - -## [@libp2p/interfaces-v1.3.15](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interfaces-v1.3.14...@libp2p/interfaces-v1.3.15) (2022-03-16) - - -### Bug Fixes - -* update content routing get return type ([#182](https://github.com/libp2p/js-libp2p-interfaces/issues/182)) ([49da9d5](https://github.com/libp2p/js-libp2p-interfaces/commit/49da9d5883618a672d64542eee13972e603a5b3d)) - -## [@libp2p/interfaces-v1.3.14](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interfaces-v1.3.13...@libp2p/interfaces-v1.3.14) (2022-03-15) - - -### Bug Fixes - -* simplify transport interface, update interfaces for use with libp2p ([#180](https://github.com/libp2p/js-libp2p-interfaces/issues/180)) ([ec81622](https://github.com/libp2p/js-libp2p-interfaces/commit/ec81622e5b7c6d256e0f8aed6d3695642473293b)) - -## [@libp2p/interfaces-v1.3.13](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interfaces-v1.3.12...@libp2p/interfaces-v1.3.13) (2022-02-27) - - -### Bug Fixes - -* rename crypto to connection-encrypter ([#179](https://github.com/libp2p/js-libp2p-interfaces/issues/179)) ([d197f55](https://github.com/libp2p/js-libp2p-interfaces/commit/d197f554d7cdadb3b05ed2d6c69fda2c4362b1eb)) - -## [@libp2p/interfaces-v1.3.12](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interfaces-v1.3.11...@libp2p/interfaces-v1.3.12) (2022-02-27) - - -### Bug Fixes - -* update package config and add connection gater interface ([#178](https://github.com/libp2p/js-libp2p-interfaces/issues/178)) ([c6079a6](https://github.com/libp2p/js-libp2p-interfaces/commit/c6079a6367f004788062df3e30ad2e26330d947b)) - -## [@libp2p/interfaces-v1.3.11](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interfaces-v1.3.10...@libp2p/interfaces-v1.3.11) (2022-02-21) - - -### Bug Fixes - -* remove unused dht query option ([#176](https://github.com/libp2p/js-libp2p-interfaces/issues/176)) ([e0ce46d](https://github.com/libp2p/js-libp2p-interfaces/commit/e0ce46d371a92a7063f02e7a1729a39def80e15e)) - -## [@libp2p/interfaces-v1.3.10](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interfaces-v1.3.9...@libp2p/interfaces-v1.3.10) (2022-02-21) - - -### Bug Fixes - -* update muxer to pass transport tests ([#174](https://github.com/libp2p/js-libp2p-interfaces/issues/174)) ([466ed53](https://github.com/libp2p/js-libp2p-interfaces/commit/466ed53192aa196ac2dbdb83df3c8db9cd5b1e07)) - -## [@libp2p/interfaces-v1.3.9](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interfaces-v1.3.8...@libp2p/interfaces-v1.3.9) (2022-02-18) - - -### Bug Fixes - -* remove delays from pubsub tests ([#173](https://github.com/libp2p/js-libp2p-interfaces/issues/173)) ([5c8fe09](https://github.com/libp2p/js-libp2p-interfaces/commit/5c8fe09294f0cbd8add1406a61fa7dbc5b4e788b)) - -## [@libp2p/interfaces-v1.3.8](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interfaces-v1.3.7...@libp2p/interfaces-v1.3.8) (2022-02-18) - - -### Bug Fixes - -* simpler pubsub ([#172](https://github.com/libp2p/js-libp2p-interfaces/issues/172)) ([98715ed](https://github.com/libp2p/js-libp2p-interfaces/commit/98715ed73183b32e4fda3d878a462389548358d9)) - -## [@libp2p/interfaces-v1.3.7](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interfaces-v1.3.6...@libp2p/interfaces-v1.3.7) (2022-02-17) - - -### Bug Fixes - -* add multistream-select and update pubsub types ([#170](https://github.com/libp2p/js-libp2p-interfaces/issues/170)) ([b9ecb2b](https://github.com/libp2p/js-libp2p-interfaces/commit/b9ecb2bee8f2abc0c41bfcf7bf2025894e37ddc2)) - -## [@libp2p/interfaces-v1.3.6](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interfaces-v1.3.5...@libp2p/interfaces-v1.3.6) (2022-02-12) - - -### Bug Fixes - -* hide implementations behind factory methods ([#167](https://github.com/libp2p/js-libp2p-interfaces/issues/167)) ([2fba080](https://github.com/libp2p/js-libp2p-interfaces/commit/2fba0800c9896af6dcc49da4fa904bb4a3e3e40d)) - -## [@libp2p/interfaces-v1.3.5](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interfaces-v1.3.4...@libp2p/interfaces-v1.3.5) (2022-02-11) - - -### Bug Fixes - -* add .js to import paths ([#166](https://github.com/libp2p/js-libp2p-interfaces/issues/166)) ([dbf6688](https://github.com/libp2p/js-libp2p-interfaces/commit/dbf6688cc7295c821b473b05d211239616ad2ae1)) - -## [@libp2p/interfaces-v1.3.4](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interfaces-v1.3.3...@libp2p/interfaces-v1.3.4) (2022-02-11) - - -### Bug Fixes - -* simpler topologies ([#164](https://github.com/libp2p/js-libp2p-interfaces/issues/164)) ([45fcaa1](https://github.com/libp2p/js-libp2p-interfaces/commit/45fcaa10a6a3215089340ff2eff117d7fd1100e7)) - -## [@libp2p/interfaces-v1.3.3](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interfaces-v1.3.2...@libp2p/interfaces-v1.3.3) (2022-02-10) - - -### Bug Fixes - -* make registrar simpler ([#163](https://github.com/libp2p/js-libp2p-interfaces/issues/163)) ([d122f3d](https://github.com/libp2p/js-libp2p-interfaces/commit/d122f3daaccc04039d90814960da92b513265644)) - -## [@libp2p/interfaces-v1.3.2](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interfaces-v1.3.1...@libp2p/interfaces-v1.3.2) (2022-02-10) - - -### Bug Fixes - -* remove args from listener events ([#162](https://github.com/libp2p/js-libp2p-interfaces/issues/162)) ([011ac89](https://github.com/libp2p/js-libp2p-interfaces/commit/011ac891ec7d44625cb4342f068bcd9f241a5b45)) - -## [@libp2p/interfaces-v1.3.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interfaces-v1.3.0...@libp2p/interfaces-v1.3.1) (2022-02-10) - - -### Bug Fixes - -* remove node event emitters ([#161](https://github.com/libp2p/js-libp2p-interfaces/issues/161)) ([221fb6a](https://github.com/libp2p/js-libp2p-interfaces/commit/221fb6a024430dc56288d73d8b8ce1aa88427701)) - -## [@libp2p/interfaces-v1.3.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interfaces-v1.2.0...@libp2p/interfaces-v1.3.0) (2022-02-09) - - -### Features - -* add peer store/records, and streams are just streams ([#160](https://github.com/libp2p/js-libp2p-interfaces/issues/160)) ([8860a0c](https://github.com/libp2p/js-libp2p-interfaces/commit/8860a0cd46b359a5648402d83870f7ff957222fe)) - -## [@libp2p/interfaces-v1.2.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interfaces-v1.1.1...@libp2p/interfaces-v1.2.0) (2022-02-07) - - -### Features - -* add logger package ([#158](https://github.com/libp2p/js-libp2p-interfaces/issues/158)) ([f327cd2](https://github.com/libp2p/js-libp2p-interfaces/commit/f327cd24825d9ce2f45a02fdb9b47c9735c847e0)) - -## [@libp2p/interfaces-v1.1.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interfaces-v1.1.0...@libp2p/interfaces-v1.1.1) (2022-02-05) - - -### Bug Fixes - -* fix muxer tests ([#157](https://github.com/libp2p/js-libp2p-interfaces/issues/157)) ([7233c44](https://github.com/libp2p/js-libp2p-interfaces/commit/7233c4438479dff56a682f45209ef7a938d63857)) - -## [@libp2p/interfaces-v1.1.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interfaces-v1.0.6...@libp2p/interfaces-v1.1.0) (2022-02-05) - - -### Features - -* add tracked-map ([#156](https://github.com/libp2p/js-libp2p-interfaces/issues/156)) ([c17730f](https://github.com/libp2p/js-libp2p-interfaces/commit/c17730f8bca172db85507740eaba81b3cf514d04)) - -## [@libp2p/interfaces-v1.0.6](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interfaces-v1.0.5...@libp2p/interfaces-v1.0.6) (2022-02-02) - - -### Bug Fixes - -* make discovery startable ([#155](https://github.com/libp2p/js-libp2p-interfaces/issues/155)) ([c7db291](https://github.com/libp2p/js-libp2p-interfaces/commit/c7db2918f5c4e00b45bcbd69541224403e5451e1)) - -## [@libp2p/interfaces-v1.0.5](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interfaces-v1.0.4...@libp2p/interfaces-v1.0.5) (2022-01-29) - - -### Bug Fixes - -* remove extra fields ([#153](https://github.com/libp2p/js-libp2p-interfaces/issues/153)) ([ccd7cf3](https://github.com/libp2p/js-libp2p-interfaces/commit/ccd7cf3f5ac71337baf516d3b0f6fc724ee0d3b4)) - -## [@libp2p/interfaces-v1.0.4](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interfaces-v1.0.3...@libp2p/interfaces-v1.0.4) (2022-01-15) - - -### Bug Fixes - -* remove abort controller dep ([#151](https://github.com/libp2p/js-libp2p-interfaces/issues/151)) ([518bce1](https://github.com/libp2p/js-libp2p-interfaces/commit/518bce1f9bd1f8b2922338e0c65c9934af7da3af)) - -## [@libp2p/interfaces-v1.0.3](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interfaces-v1.0.2...@libp2p/interfaces-v1.0.3) (2022-01-15) - - -### Trivial Changes - -* update project config ([#149](https://github.com/libp2p/js-libp2p-interfaces/issues/149)) ([6eb8556](https://github.com/libp2p/js-libp2p-interfaces/commit/6eb85562c0da167d222808da10a7914daf12970b)) - -## [@libp2p/interfaces-v1.0.2](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interfaces-v1.0.1...@libp2p/interfaces-v1.0.2) (2022-01-14) - - -### Bug Fixes - -* update it-* deps to ts versions ([#148](https://github.com/libp2p/js-libp2p-interfaces/issues/148)) ([7a6fdd7](https://github.com/libp2p/js-libp2p-interfaces/commit/7a6fdd7622ce2870b89dbb849ab421d0dd714b43)) - -## [@libp2p/interfaces-v1.0.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/interfaces-v1.0.0...@libp2p/interfaces-v1.0.1) (2022-01-08) - - -### Trivial Changes - -* add semantic release config ([#141](https://github.com/libp2p/js-libp2p-interfaces/issues/141)) ([5f0de59](https://github.com/libp2p/js-libp2p-interfaces/commit/5f0de59136b6343d2411abb2d6a4dd2cd0b7efe4)) -* update package versions ([#140](https://github.com/libp2p/js-libp2p-interfaces/issues/140)) ([cd844f6](https://github.com/libp2p/js-libp2p-interfaces/commit/cd844f6e39f4ee50d006e86eac8dadf696900eb5)) - -# Change Log - -All notable changes to this project will be documented in this file. -See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -# 0.2.0 (2022-01-04) - - -### Bug Fixes - -* make connection upgrade and encryption abortable ([#121](https://github.com/libp2p/js-libp2p-interfaces/issues/121)) ([d31583d](https://github.com/libp2p/js-libp2p-interfaces/commit/d31583d204c5fa07df0479f37bd0d4a925cc812b)) -* move errors ([#132](https://github.com/libp2p/js-libp2p-interfaces/issues/132)) ([21d282a](https://github.com/libp2p/js-libp2p-interfaces/commit/21d282a6d77bd7d1a12daa1cc8b3a3fed8635dad)) -* update dialer tests ([#116](https://github.com/libp2p/js-libp2p-interfaces/issues/116)) ([c679729](https://github.com/libp2p/js-libp2p-interfaces/commit/c679729113feb963ff27815fcafd7af51f722df7)) - - -### Features - -* add auto-publish ([7aede5d](https://github.com/libp2p/js-libp2p-interfaces/commit/7aede5df39ea6b5f243348ec9a212b3e33c16a81)) -* remove getPublicKey method from dht ([603c818](https://github.com/libp2p/js-libp2p-interfaces/commit/603c818d0694652346bc552525f2379b1dfa0107)) -* simpler peer id ([#117](https://github.com/libp2p/js-libp2p-interfaces/issues/117)) ([fa2c4f5](https://github.com/libp2p/js-libp2p-interfaces/commit/fa2c4f5be74a5cfc11489771881e57b4e53bf174)) -* split out code, convert to typescript ([#111](https://github.com/libp2p/js-libp2p-interfaces/issues/111)) ([e174bba](https://github.com/libp2p/js-libp2p-interfaces/commit/e174bba889388269b806643c79a6b53c8d6a0f8c)), closes [#110](https://github.com/libp2p/js-libp2p-interfaces/issues/110) [#101](https://github.com/libp2p/js-libp2p-interfaces/issues/101) -* update package names ([#133](https://github.com/libp2p/js-libp2p-interfaces/issues/133)) ([337adc9](https://github.com/libp2p/js-libp2p-interfaces/commit/337adc9a9bc0278bdae8cbce9c57d07a83c8b5c2)) - - -### BREAKING CHANGES - -* the dht.getPublicKey method has been removed -* not all fields from concrete classes have been added to the interfaces, some adjustment may be necessary as this gets rolled out - - - - - -## [3.1.1](https://github.com/libp2p/js-libp2p-interfaces/compare/libp2p-interfaces@3.1.0...libp2p-interfaces@3.1.1) (2022-01-02) - - -### Bug Fixes - -* move errors ([#132](https://github.com/libp2p/js-libp2p-interfaces/issues/132)) ([21d282a](https://github.com/libp2p/js-libp2p-interfaces/commit/21d282a6d77bd7d1a12daa1cc8b3a3fed8635dad)) - - - - - -# [3.1.0](https://github.com/libp2p/js-libp2p-interfaces/compare/libp2p-interfaces@3.0.0...libp2p-interfaces@3.1.0) (2022-01-02) - - -### Bug Fixes - -* make connection upgrade and encryption abortable ([#121](https://github.com/libp2p/js-libp2p-interfaces/issues/121)) ([d31583d](https://github.com/libp2p/js-libp2p-interfaces/commit/d31583d204c5fa07df0479f37bd0d4a925cc812b)) -* update dialer tests ([#116](https://github.com/libp2p/js-libp2p-interfaces/issues/116)) ([c679729](https://github.com/libp2p/js-libp2p-interfaces/commit/c679729113feb963ff27815fcafd7af51f722df7)) - - -### Features - -* simpler peer id ([#117](https://github.com/libp2p/js-libp2p-interfaces/issues/117)) ([fa2c4f5](https://github.com/libp2p/js-libp2p-interfaces/commit/fa2c4f5be74a5cfc11489771881e57b4e53bf174)) - - - - - -# [3.0.0](https://github.com/libp2p/js-libp2p-interfaces/compare/libp2p-interfaces@2.0.0...libp2p-interfaces@3.0.0) (2021-12-02) - - -### Features - -* remove getPublicKey method from dht ([603c818](https://github.com/libp2p/js-libp2p-interfaces/commit/603c818d0694652346bc552525f2379b1dfa0107)) - - -### BREAKING CHANGES - -* the dht.getPublicKey method has been removed - - - - - -# [2.0.0](https://github.com/libp2p/js-libp2p-interfaces/compare/libp2p-interfaces@1.2.0...libp2p-interfaces@2.0.0) (2021-11-22) - - -### Features - -* split out code, convert to typescript ([#111](https://github.com/libp2p/js-libp2p-interfaces/issues/111)) ([e174bba](https://github.com/libp2p/js-libp2p-interfaces/commit/e174bba889388269b806643c79a6b53c8d6a0f8c)), closes [#110](https://github.com/libp2p/js-libp2p-interfaces/issues/110) [#101](https://github.com/libp2p/js-libp2p-interfaces/issues/101) - - -### BREAKING CHANGES - -* not all fields from concrete classes have been added to the interfaces, some adjustment may be necessary as this gets rolled out - - - - - -# [1.2.0](https://github.com/libp2p/js-interfaces/compare/libp2p-interfaces@1.1.1...libp2p-interfaces@1.2.0) (2021-10-18) - - -### Features - -* add ValueStore interface ([#108](https://github.com/libp2p/js-interfaces/issues/108)) ([09c6e10](https://github.com/libp2p/js-interfaces/commit/09c6e10353c1d8842a5522d28d5cd38ae47d892f)) - - - - - -## [1.1.1](https://github.com/libp2p/js-interfaces/compare/libp2p-interfaces@1.1.0...libp2p-interfaces@1.1.1) (2021-09-20) - - -### Bug Fixes - -* allow pubsub rpc to be processed concurrently ([#106](https://github.com/libp2p/js-interfaces/issues/106)) ([52f96b3](https://github.com/libp2p/js-interfaces/commit/52f96b3eb867b844a9c4a0d1fd632baa300052a2)) - - - - - -# [1.1.0](https://github.com/libp2p/js-interfaces/compare/libp2p-interfaces@1.0.1...libp2p-interfaces@1.1.0) (2021-08-20) - - -### Features - -* update uint8arrays ([#105](https://github.com/libp2p/js-interfaces/issues/105)) ([9297a9c](https://github.com/libp2p/js-interfaces/commit/9297a9c379276d03c8da849af6108b38e581b4a6)) - - - - - -## [1.0.1](https://github.com/libp2p/js-interfaces/compare/libp2p-interfaces@1.0.0...libp2p-interfaces@1.0.1) (2021-07-08) - - -### Bug Fixes - -* make tests more reliable ([#103](https://github.com/libp2p/js-interfaces/issues/103)) ([cd4c409](https://github.com/libp2p/js-interfaces/commit/cd4c40908efe2e9ffc14aa61aace5176a43fd70a)) -* remove timeouts ([#104](https://github.com/libp2p/js-interfaces/issues/104)) ([3699c17](https://github.com/libp2p/js-interfaces/commit/3699c17f022da40a87ab24adc3b2081df7a0ddcd)) - - - - - -# 1.0.0 (2021-07-07) - - -### chore - -* monorepo separating interfaces and compliance tests ([#97](https://github.com/libp2p/js-interfaces/issues/97)) ([946348f](https://github.com/libp2p/js-interfaces/commit/946348f7f8acc1ff7bc9cd0ab4c2602d41106f76)) - - -### BREAKING CHANGES - -* the tests now live in the libp2p-interfaces-compliance-tests module - - - - - -## [0.12.1](https://github.com/libp2p/js-interfaces/compare/v0.12.0...v0.12.1) (2021-07-07) - - - -# [0.12.0](https://github.com/libp2p/js-interfaces/compare/v0.11.0...v0.12.0) (2021-07-06) - - -### chore - -* update to new multiformats ([#98](https://github.com/libp2p/js-interfaces/issues/98)) ([242027c](https://github.com/libp2p/js-interfaces/commit/242027cdfd08004f20d0148f4905381d34942dc6)) - - -### BREAKING CHANGES - -* uses the CID class from the new multiformats module and pubsub.getMsgId became async - -Co-authored-by: Vasco Santos - - - -# [0.11.0](https://github.com/libp2p/js-interfaces/compare/v0.10.4...v0.11.0) (2021-05-27) - - - -## [0.10.4](https://github.com/libp2p/js-interfaces/compare/v0.10.3...v0.10.4) (2021-04-30) - - -### Bug Fixes - -* event emitter and discovery and routing interfaces ([#95](https://github.com/libp2p/js-interfaces/issues/95)) ([93ddaa4](https://github.com/libp2p/js-interfaces/commit/93ddaa4860ff743b312268b6a859b5e6365fff74)) - - - -## [0.10.3](https://github.com/libp2p/js-interfaces/compare/v0.10.2...v0.10.3) (2021-04-22) - - - -## [0.10.2](https://github.com/libp2p/js-interfaces/compare/v0.10.1...v0.10.2) (2021-04-20) - - -### Bug Fixes - -* specify pbjs root ([#93](https://github.com/libp2p/js-interfaces/issues/93)) ([70ae573](https://github.com/libp2p/js-interfaces/commit/70ae573a4ea2ac074f7cda2a732ed5be283e48c4)) - - - -## [0.10.1](https://github.com/libp2p/js-interfaces/compare/v0.10.0...v0.10.1) (2021-04-19) - - -### Features - -* export type for new stream muxer function ([#91](https://github.com/libp2p/js-interfaces/issues/91)) ([6467fdd](https://github.com/libp2p/js-interfaces/commit/6467fdd6ce1d13cfa3b34e3aaa73a64a669d2033)) - - - -# [0.10.0](https://github.com/libp2p/js-interfaces/compare/v0.9.0...v0.10.0) (2021-04-12) - - - -# [0.9.0](https://github.com/libp2p/js-interfaces/compare/v0.8.4...v0.9.0) (2021-04-07) - - - -## [0.8.4](https://github.com/libp2p/js-interfaces/compare/v0.8.3...v0.8.4) (2021-03-22) - - -### Bug Fixes - -* specify connection direction ([#86](https://github.com/libp2p/js-interfaces/issues/86)) ([3b960d5](https://github.com/libp2p/js-interfaces/commit/3b960d516f70f7e198574a736cb09000ddd7a94c)) - - - -## [0.8.3](https://github.com/libp2p/js-interfaces/compare/v0.8.2...v0.8.3) (2021-01-26) - - - -## [0.8.2](https://github.com/libp2p/js-interfaces/compare/v0.8.1...v0.8.2) (2021-01-20) - - -### Bug Fixes - -* event emitter types with local types ([#80](https://github.com/libp2p/js-interfaces/issues/80)) ([ca52077](https://github.com/libp2p/js-interfaces/commit/ca520775eb26f5ed501375fdb24ba698c9a8c8c8)) - - - -## [0.8.1](https://github.com/libp2p/js-interfaces/compare/v0.8.0...v0.8.1) (2020-12-11) - - -### Bug Fixes - -* pubsub publish message should be uint8array ([#77](https://github.com/libp2p/js-interfaces/issues/77)) ([5b99e6b](https://github.com/libp2p/js-interfaces/commit/5b99e6b56b10439a82ee88fb4e31fb95c182264f)) - - - -# [0.8.0](https://github.com/libp2p/js-interfaces/compare/v0.7.2...v0.8.0) (2020-12-10) - - -### Features - -* add types ([#74](https://github.com/libp2p/js-interfaces/issues/74)) ([e2419ea](https://github.com/libp2p/js-interfaces/commit/e2419ea308b5db38966850ba6349602c93ce3b0e)) - - - - -## [0.7.2](https://github.com/libp2p/js-interfaces/compare/v0.7.1...v0.7.2) (2020-11-11) - - - - -## [0.7.1](https://github.com/libp2p/js-interfaces/compare/v0.7.0...v0.7.1) (2020-11-03) - - -### Bug Fixes - -* typescript types ([#69](https://github.com/libp2p/js-interfaces/issues/69)) ([269a6f5](https://github.com/libp2p/js-interfaces/commit/269a6f5)) - - - - -# [0.7.0](https://github.com/libp2p/js-interfaces/compare/v0.5.2...v0.7.0) (2020-11-03) - - -### Features - -* pubsub: add global signature policy ([#66](https://github.com/libp2p/js-interfaces/issues/66)) ([946b046](https://github.com/libp2p/js-interfaces/commit/946b046)) -* update pubsub getMsgId return type to Uint8Array ([#65](https://github.com/libp2p/js-interfaces/issues/65)) ([e148443](https://github.com/libp2p/js-interfaces/commit/e148443)) - - -### BREAKING CHANGES - -* `signMessages` and `strictSigning` pubsub configuration options replaced -with a `globalSignaturePolicy` option -* new getMsgId return type is not backwards compatible with prior `string` -return type. - - - - -# [0.6.0](https://github.com/libp2p/js-interfaces/compare/v0.5.2...v0.6.0) (2020-10-05) - - -### Features - -* update pubsub getMsgId return type to Uint8Array ([#65](https://github.com/libp2p/js-interfaces/issues/65)) ([e148443](https://github.com/libp2p/js-interfaces/commit/e148443)) - - -### BREAKING CHANGES - -* new getMsgId return type is not backwards compatible with prior `string` -return type. - - - - -## [0.5.2](https://github.com/libp2p/js-interfaces/compare/v0.3.1...v0.5.2) (2020-09-30) - - -### Bug Fixes - -* replace remaining Buffer usage with Uint8Array ([#62](https://github.com/libp2p/js-interfaces/issues/62)) ([4130e7f](https://github.com/libp2p/js-interfaces/commit/4130e7f)) - - -### Chores - -* update deps ([#57](https://github.com/libp2p/js-interfaces/issues/57)) ([75f6777](https://github.com/libp2p/js-interfaces/commit/75f6777)) - - -### Features - -* interface pubsub ([#60](https://github.com/libp2p/js-interfaces/issues/60)) ([ba15a48](https://github.com/libp2p/js-interfaces/commit/ba15a48)) -* record interface ([#52](https://github.com/libp2p/js-interfaces/issues/52)) ([1cc943e](https://github.com/libp2p/js-interfaces/commit/1cc943e)) - - -### BREAKING CHANGES - -* records now marshal as Uint8Array instead of Buffer - -* fix: refactor remaining Buffer usage to Uint8Array -* - The peer id dep of this module has replaced node Buffers with Uint8Arrays - -* chore: update gh deps - - - - -## [0.5.1](https://github.com/libp2p/js-interfaces/compare/v0.5.0...v0.5.1) (2020-08-25) - - -### Features - -* interface pubsub ([#60](https://github.com/libp2p/js-interfaces/issues/60)) ([ba15a48](https://github.com/libp2p/js-interfaces/commit/ba15a48)) - - - - -# [0.5.0](https://github.com/libp2p/js-interfaces/compare/v0.4.1...v0.5.0) (2020-08-24) - - -### Bug Fixes - -* replace remaining Buffer usage with Uint8Array ([#62](https://github.com/libp2p/js-interfaces/issues/62)) ([4130e7f](https://github.com/libp2p/js-interfaces/commit/4130e7f)) - - -### BREAKING CHANGES - -* records now marshal as Uint8Array instead of Buffer - -* fix: refactor remaining Buffer usage to Uint8Array - - - - -## [0.4.1](https://github.com/libp2p/js-interfaces/compare/v0.4.0...v0.4.1) (2020-08-11) - - - - -# [0.4.0](https://github.com/libp2p/js-interfaces/compare/v0.3.2...v0.4.0) (2020-08-10) - - -### Chores - -* update deps ([#57](https://github.com/libp2p/js-interfaces/issues/57)) ([75f6777](https://github.com/libp2p/js-interfaces/commit/75f6777)) - - -### BREAKING CHANGES - -* - The peer id dep of this module has replaced node Buffers with Uint8Arrays - -* chore: update gh deps - - - - -## [0.3.2](https://github.com/libp2p/js-interfaces/compare/v0.3.1...v0.3.2) (2020-07-15) - - -### Features - -* record interface ([#52](https://github.com/libp2p/js-interfaces/issues/52)) ([1cc943e](https://github.com/libp2p/js-interfaces/commit/1cc943e)) - - - - -## [0.3.1](https://github.com/libp2p/js-interfaces/compare/v0.2.8...v0.3.1) (2020-07-03) - - -### Bug Fixes - -* content and peer routing multiaddrs property ([#49](https://github.com/libp2p/js-interfaces/issues/49)) ([9fbf9d0](https://github.com/libp2p/js-interfaces/commit/9fbf9d0)) -* peer-routing typo ([#47](https://github.com/libp2p/js-interfaces/issues/47)) ([9a8f375](https://github.com/libp2p/js-interfaces/commit/9a8f375)) -* reconnect should trigger topology on connect if protocol stored ([#54](https://github.com/libp2p/js-interfaces/issues/54)) ([e10a154](https://github.com/libp2p/js-interfaces/commit/e10a154)) - - -### Chores - -* remove peer-info usage on topology ([#42](https://github.com/libp2p/js-interfaces/issues/42)) ([a55c7c4](https://github.com/libp2p/js-interfaces/commit/a55c7c4)) -* update content and peer routing interfaces removing peer-info ([#43](https://github.com/libp2p/js-interfaces/issues/43)) ([87e2e89](https://github.com/libp2p/js-interfaces/commit/87e2e89)) - - -### Features - -* peer-discovery not using peer-info ([bdd2502](https://github.com/libp2p/js-interfaces/commit/bdd2502)) - - -### BREAKING CHANGES - -* topology api now uses peer-id instead of peer-info -* content-routing and peer-routing APIs return an object with relevant properties instead of peer-info -* peer-discovery emits object with id and multiaddrs properties - - - - -# [0.3.0](https://github.com/libp2p/js-interfaces/compare/v0.2.8...v0.3.0) (2020-04-21) - - -### Chores - -* remove peer-info usage on topology ([#42](https://github.com/libp2p/js-interfaces/issues/42)) ([79a7843](https://github.com/libp2p/js-interfaces/commit/79a7843)) -* update content and peer routing interfaces removing peer-info ([#43](https://github.com/libp2p/js-interfaces/issues/43)) ([d2032e6](https://github.com/libp2p/js-interfaces/commit/d2032e6)) - - -### Features - -* peer-discovery not using peer-info ([5792b13](https://github.com/libp2p/js-interfaces/commit/5792b13)) - - -### BREAKING CHANGES - -* topology api now uses peer-id instead of peer-info -* content-routing and peer-routing APIs return an object with relevant properties instead of peer-info -* peer-discovery emits object with id and multiaddrs properties - - - - -## [0.2.8](https://github.com/libp2p/js-interfaces/compare/v0.2.7...v0.2.8) (2020-04-21) - - - - -## [0.2.7](https://github.com/libp2p/js-interfaces/compare/v0.2.6...v0.2.7) (2020-03-20) - - -### Bug Fixes - -* add buffer ([#39](https://github.com/libp2p/js-interfaces/issues/39)) ([78e015c](https://github.com/libp2p/js-interfaces/commit/78e015c)) - - - - -## [0.2.6](https://github.com/libp2p/js-interfaces/compare/v0.2.5...v0.2.6) (2020-02-17) - - -### Bug Fixes - -* remove use of assert module ([#34](https://github.com/libp2p/js-interfaces/issues/34)) ([c77d8de](https://github.com/libp2p/js-interfaces/commit/c77d8de)) - - - - -## [0.2.5](https://github.com/libp2p/js-interfaces/compare/v0.2.4...v0.2.5) (2020-02-04) - - -### Bug Fixes - -* **connection:** tracks streams properly ([#25](https://github.com/libp2p/js-interfaces/issues/25)) ([5c88d77](https://github.com/libp2p/js-interfaces/commit/5c88d77)) - - - - -## [0.2.4](https://github.com/libp2p/js-interfaces/compare/v0.2.3...v0.2.4) (2020-02-04) - - -### Bug Fixes - -* dependencies for tests should not be needed by who requires the tests ([#18](https://github.com/libp2p/js-interfaces/issues/18)) ([c5b724a](https://github.com/libp2p/js-interfaces/commit/c5b724a)) - - - - -## [0.2.3](https://github.com/libp2p/js-interfaces/compare/v0.2.2...v0.2.3) (2020-01-21) - - -### Bug Fixes - -* **transport:** make close listener test more resilient ([#21](https://github.com/libp2p/js-interfaces/issues/21)) ([2de533e](https://github.com/libp2p/js-interfaces/commit/2de533e)) - - - - -## [0.2.2](https://github.com/libp2p/js-interfaces/compare/v0.2.1...v0.2.2) (2020-01-17) - - -### Bug Fixes - -* **connection:** dont require remoteAddr on creation ([#20](https://github.com/libp2p/js-interfaces/issues/20)) ([5967834](https://github.com/libp2p/js-interfaces/commit/5967834)) - - - - -## [0.2.1](https://github.com/libp2p/js-interfaces/compare/v0.2.0...v0.2.1) (2019-12-28) - - -### Features - -* add crypto transmission error ([#17](https://github.com/libp2p/js-interfaces/issues/17)) ([d98bb23](https://github.com/libp2p/js-interfaces/commit/d98bb23)) - - - - -# [0.2.0](https://github.com/libp2p/js-interfaces/compare/v0.1.7...v0.2.0) (2019-12-20) - - -### Bug Fixes - -* transport should not handle connection if upgradeInbound throws ([#16](https://github.com/libp2p/js-interfaces/issues/16)) ([ff03137](https://github.com/libp2p/js-interfaces/commit/ff03137)) - - - - -## [0.1.7](https://github.com/libp2p/js-interfaces/compare/v0.1.6...v0.1.7) (2019-12-15) - - -### Features - -* export connection status' ([#15](https://github.com/libp2p/js-interfaces/issues/15)) ([bdbd58e](https://github.com/libp2p/js-interfaces/commit/bdbd58e)) - - - - -## [0.1.6](https://github.com/libp2p/js-interfaces/compare/v0.1.5...v0.1.6) (2019-12-02) - - -### Bug Fixes - -* multicodec topology disconnect with peer param ([#12](https://github.com/libp2p/js-interfaces/issues/12)) ([d5dd256](https://github.com/libp2p/js-interfaces/commit/d5dd256)) - - - - -## [0.1.5](https://github.com/libp2p/js-interfaces/compare/v0.1.4...v0.1.5) (2019-11-15) - - -### Bug Fixes - -* multicodec topology update peers with multicodec ([#10](https://github.com/libp2p/js-interfaces/issues/10)) ([21d8ae6](https://github.com/libp2p/js-interfaces/commit/21d8ae6)) - - -### Features - -* add class-is to topology ([#11](https://github.com/libp2p/js-interfaces/issues/11)) ([a67abcc](https://github.com/libp2p/js-interfaces/commit/a67abcc)) - - - - -## [0.1.4](https://github.com/libp2p/js-interfaces/compare/v0.1.3...v0.1.4) (2019-11-14) - - -### Features - -* add topology interfaces ([#7](https://github.com/libp2p/js-interfaces/issues/7)) ([8bee747](https://github.com/libp2p/js-interfaces/commit/8bee747)) - - - - -## [0.1.3](https://github.com/libp2p/js-interfaces/compare/v0.1.2...v0.1.3) (2019-10-30) - - -### Bug Fixes - -* localAddr should be optional ([#6](https://github.com/libp2p/js-interfaces/issues/6)) ([749a8d0](https://github.com/libp2p/js-interfaces/commit/749a8d0)) - - - - -## [0.1.2](https://github.com/libp2p/js-interfaces/compare/v0.1.1...v0.1.2) (2019-10-29) - - -### Features - -* crypto errors ([#4](https://github.com/libp2p/js-interfaces/issues/4)) ([d2fe2d1](https://github.com/libp2p/js-interfaces/commit/d2fe2d1)) - - - - -## [0.1.1](https://github.com/libp2p/js-interfaces/compare/v0.1.0...v0.1.1) (2019-10-21) - - -### Features - -* crypto interface ([#2](https://github.com/libp2p/js-interfaces/issues/2)) ([5a5c44a](https://github.com/libp2p/js-interfaces/commit/5a5c44a)) - - - - -# 0.1.0 (2019-10-20) - - -### Bug Fixes - -* add async support to setup ([#11](https://github.com/libp2p/js-interfaces/issues/11)) ([2814c76](https://github.com/libp2p/js-interfaces/commit/2814c76)) -* **test:** close with timeout ([#54](https://github.com/libp2p/js-interfaces/issues/54)) ([583f02d](https://github.com/libp2p/js-interfaces/commit/583f02d)) -* avoid making webpacky funky by not trying to inject tcp ([6695b80](https://github.com/libp2p/js-interfaces/commit/6695b80)) -* improve the close test ([d9c8681](https://github.com/libp2p/js-interfaces/commit/d9c8681)) -* move dirty-chai to dependencies ([#52](https://github.com/libp2p/js-interfaces/issues/52)) ([f9a7908](https://github.com/libp2p/js-interfaces/commit/f9a7908)) -* some fixes for incorrect tests ([23a75d1](https://github.com/libp2p/js-interfaces/commit/23a75d1)) -* when things are in the same process, there is a order to them :) ([1635977](https://github.com/libp2p/js-interfaces/commit/1635977)) -* wrong main path in package.json ([54b83a7](https://github.com/libp2p/js-interfaces/commit/54b83a7)) -* **deps:** fix package.json ([e0f7db3](https://github.com/libp2p/js-interfaces/commit/e0f7db3)) -* **dial-test:** ensure goodbye works over tcp ([e1346da](https://github.com/libp2p/js-interfaces/commit/e1346da)) -* **package.json:** point to right main ([ace6150](https://github.com/libp2p/js-interfaces/commit/ace6150)) -* **package.json:** point to right main ([84cd2ca](https://github.com/libp2p/js-interfaces/commit/84cd2ca)) -* **tests:** add place holder test script for releases ([8e9f7cf](https://github.com/libp2p/js-interfaces/commit/8e9f7cf)) - - -### Code Refactoring - -* API changes and switch to async await ([#55](https://github.com/libp2p/js-interfaces/issues/55)) ([dd837ba](https://github.com/libp2p/js-interfaces/commit/dd837ba)) -* API changes and switch to async iterators ([#29](https://github.com/libp2p/js-interfaces/issues/29)) ([bf5c646](https://github.com/libp2p/js-interfaces/commit/bf5c646)) - - -### Features - -* add onStreamEnd, muxer.streams and timeline ([#56](https://github.com/libp2p/js-interfaces/issues/56)) ([0f60832](https://github.com/libp2p/js-interfaces/commit/0f60832)) -* add support for timeline proxying ([#31](https://github.com/libp2p/js-interfaces/issues/31)) ([541bf83](https://github.com/libp2p/js-interfaces/commit/541bf83)) -* add type to AbortError ([#45](https://github.com/libp2p/js-interfaces/issues/45)) ([4fd37bb](https://github.com/libp2p/js-interfaces/commit/4fd37bb)) -* add upgrader support to transports ([#53](https://github.com/libp2p/js-interfaces/issues/53)) ([a5ad120](https://github.com/libp2p/js-interfaces/commit/a5ad120)) -* async crypto + sauce labs + aegir 9 ([b40114c](https://github.com/libp2p/js-interfaces/commit/b40114c)) -* callbacks -> async / await ([#44](https://github.com/libp2p/js-interfaces/issues/44)) ([b30ee5f](https://github.com/libp2p/js-interfaces/commit/b30ee5f)) -* initial commit ([584a69b](https://github.com/libp2p/js-interfaces/commit/584a69b)) -* make listen take an array of addrs ([#46](https://github.com/libp2p/js-interfaces/issues/46)) ([1dc5baa](https://github.com/libp2p/js-interfaces/commit/1dc5baa)) -* move to next aegir ([11980ac](https://github.com/libp2p/js-interfaces/commit/11980ac)) -* timeline and close checking ([#55](https://github.com/libp2p/js-interfaces/issues/55)) ([993ca1c](https://github.com/libp2p/js-interfaces/commit/993ca1c)) -* **api:** update the interface usage from dial to dialer and listen to listener ([5069679](https://github.com/libp2p/js-interfaces/commit/5069679)) -* **connection:** migrate to pull-streams ([ed5727a](https://github.com/libp2p/js-interfaces/commit/ed5727a)) -* **dialer:** remove conn from on connect callback ([1bd20d9](https://github.com/libp2p/js-interfaces/commit/1bd20d9)) -* **pull:** migration to pull streams. Upgrade tests to use mocha as ([cc3130f](https://github.com/libp2p/js-interfaces/commit/cc3130f)) -* **spec:** update the dial interface to cope with new pull additions ([2e12166](https://github.com/libp2p/js-interfaces/commit/2e12166)) -* **tests:** add closing tests, make sure errors are propagated ([c06da3b](https://github.com/libp2p/js-interfaces/commit/c06da3b)) -* **tests:** add dial and listen tests ([d50224d](https://github.com/libp2p/js-interfaces/commit/d50224d)) -* **tests:** stub test for aegir to verify ([949faf0](https://github.com/libp2p/js-interfaces/commit/949faf0)) - - -### Reverts - -* "feat: make listen take an array of addrs ([#46](https://github.com/libp2p/js-interfaces/issues/46))" ([#51](https://github.com/libp2p/js-interfaces/issues/51)) ([030195e](https://github.com/libp2p/js-interfaces/commit/030195e)) - - -### BREAKING CHANGES - -* all the callbacks in the provided API were removed and each function uses async/await. Additionally, pull-streams are no longer being used. See the README for new usage. -* This adds new validations to the stream muxer, which will cause existing tests to fail. -* the API is now async / await. See https://github.com/libp2p/interface-stream-muxer/pull/55#issue-275014779 for a summary of the changes. -* Transports must now be passed and use an `Upgrader` instance. See the Readme for usage. Compliance test suites will now need to pass `options` from `common.setup(options)` to their Transport constructor. - -* docs: update readme to include upgrader - -* docs: update readme to include MultiaddrConnection ref - -* feat: add upgrader spy to test suite - -* test: validate returned value of spy -* All places in the API that used callbacks are now replaced with async/await - -* test: add tests for canceling dials - -* feat: Adapter class diff --git a/packages/interfaces/LICENSE b/packages/interfaces/LICENSE deleted file mode 100644 index 20ce483c86..0000000000 --- a/packages/interfaces/LICENSE +++ /dev/null @@ -1,4 +0,0 @@ -This project is dual licensed under MIT and Apache-2.0. - -MIT: https://www.opensource.org/licenses/mit -Apache-2.0: https://www.apache.org/licenses/license-2.0 diff --git a/packages/interfaces/LICENSE-APACHE b/packages/interfaces/LICENSE-APACHE deleted file mode 100644 index 14478a3b60..0000000000 --- a/packages/interfaces/LICENSE-APACHE +++ /dev/null @@ -1,5 +0,0 @@ -Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - -http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. diff --git a/packages/interfaces/LICENSE-MIT b/packages/interfaces/LICENSE-MIT deleted file mode 100644 index 72dc60d84b..0000000000 --- a/packages/interfaces/LICENSE-MIT +++ /dev/null @@ -1,19 +0,0 @@ -The MIT License (MIT) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/packages/interfaces/README.md b/packages/interfaces/README.md deleted file mode 100644 index 13d38e3b4e..0000000000 --- a/packages/interfaces/README.md +++ /dev/null @@ -1,101 +0,0 @@ -# @libp2p/interfaces - -[![libp2p.io](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](http://libp2p.io/) -[![Discuss](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg?style=flat-square)](https://discuss.libp2p.io) -[![codecov](https://img.shields.io/codecov/c/github/libp2p/js-libp2p.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p) -[![CI](https://img.shields.io/github/actions/workflow/status/libp2p/js-libp2p/main.yml?branch=master\&style=flat-square)](https://github.com/libp2p/js-libp2p/actions/workflows/main.yml?query=branch%3Amaster) - -> Common code shared by the various libp2p interfaces - -## Table of contents - -- [Install](#install) -- [Usage](#usage) - - [AbortError](#aborterror) - - [Events](#events) - - [AbortOptions](#abortoptions) - - [Startable](#startable) -- [API Docs](#api-docs) -- [License](#license) -- [Contribution](#contribution) - -## Install - -```console -$ npm i @libp2p/interfaces -``` - -## Usage - -### AbortError - -Throw an error with a `.code` property of `'ABORT_ERR'`: - -```js -import { AbortError } from '@libp2p/interfaces/errors' - -throw new AbortError() -``` - -### Events - -Typed events: - -```js -import { EventEmitter, CustomEvent } from '@libp2p/interfaces/events' - -export interface MyEmitterEvents { - 'some-event': CustomEvent; -} - -class MyEmitter extends EventEmitter { - -} - -// later -const myEmitter = new MyEmitter() -myEmitter.addEventListener('some-event', (evt) => { - const num = evt.detail // <-- inferred as number -}) -``` - -### AbortOptions - -```js -import type { AbortOptions } from '@libp2p/interfaces' -``` - -### Startable - -Lifecycles for components - -```js -import { start, stop, isStartable } from '@libp2p/interfaces/startable' -import type { Startable } from '@libp2p/interfaces/startable' - -class MyStartable implements Startable { - // .. implementation methods -} - -const myStartable = new MyStartable() - -isStartable(myStartable) // returns true - -await start(myStartable) -await stop(myStartable) -``` - -## API Docs - -- - -## License - -Licensed under either of - -- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / ) -- MIT ([LICENSE-MIT](LICENSE-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/packages/interfaces/package.json b/packages/interfaces/package.json deleted file mode 100644 index 6f01645347..0000000000 --- a/packages/interfaces/package.json +++ /dev/null @@ -1,78 +0,0 @@ -{ - "name": "@libp2p/interfaces", - "version": "3.3.2", - "description": "Common code shared by the various libp2p interfaces", - "license": "Apache-2.0 OR MIT", - "homepage": "https://github.com/libp2p/js-libp2p/tree/master/packages/interfaces#readme", - "repository": { - "type": "git", - "url": "git+https://github.com/libp2p/js-libp2p.git" - }, - "bugs": { - "url": "https://github.com/libp2p/js-libp2p/issues" - }, - "keywords": [ - "interface", - "libp2p" - ], - "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" - }, - "./errors": { - "types": "./dist/src/errors.d.ts", - "import": "./dist/src/errors.js" - }, - "./events": { - "types": "./dist/src/events.d.ts", - "import": "./dist/src/events.js" - }, - "./startable": { - "types": "./dist/src/startable.d.ts", - "import": "./dist/src/startable.js" - } - }, - "eslintConfig": { - "extends": "ipfs", - "parserOptions": { - "sourceType": "module" - } - }, - "scripts": { - "clean": "aegir clean", - "lint": "aegir lint", - "dep-check": "aegir dep-check", - "build": "aegir build" - }, - "devDependencies": { - "aegir": "^39.0.10" - }, - "typedoc": { - "entryPoint": "./src/index.ts" - } -} diff --git a/packages/interfaces/src/index.ts b/packages/interfaces/src/index.ts deleted file mode 100644 index 170a6ca762..0000000000 --- a/packages/interfaces/src/index.ts +++ /dev/null @@ -1,30 +0,0 @@ - -/** - * An object that contains an AbortSignal as - * the optional `signal` property. - * - * @example - * - * ```js - * const controller = new AbortController() - * - * aLongRunningOperation({ - * signal: controller.signal - * }) - * - * // later - * - * controller.abort() - */ -export interface AbortOptions { - signal?: AbortSignal -} - -/** - * Returns a new type with all fields marked optional. - * - * Borrowed from the tsdef module. - */ -export type RecursivePartial = { - [P in keyof T]?: T[P] extends Array ? Array> : T[P] extends (...args: any[]) => any ? T[P] : RecursivePartial -} diff --git a/packages/interfaces/tsconfig.json b/packages/interfaces/tsconfig.json deleted file mode 100644 index 5fe8ea40d7..0000000000 --- a/packages/interfaces/tsconfig.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "aegir/src/config/tsconfig.aegir.json", - "compilerOptions": { - "outDir": "dist" - }, - "include": [ - "src" - ] -} diff --git a/packages/kad-dht/CHANGELOG.md b/packages/kad-dht/CHANGELOG.md index 04d3b10bc3..a1660bd03c 100644 --- a/packages/kad-dht/CHANGELOG.md +++ b/packages/kad-dht/CHANGELOG.md @@ -79,7 +79,7 @@ ### Dependencies -* **dev:** bump @libp2p/interface-libp2p from 2.0.0 to 3.0.0 ([#466](https://github.com/libp2p/js-libp2p-kad-dht/issues/466)) ([d8f8e5a](https://github.com/libp2p/js-libp2p-kad-dht/commit/d8f8e5a3b2d5c57fc89129c2cf8ed2ed7c52d171)) +* **dev:** bump @libp2p/interface from 2.0.0 to 3.0.0 ([#466](https://github.com/libp2p/js-libp2p-kad-dht/issues/466)) ([d8f8e5a](https://github.com/libp2p/js-libp2p-kad-dht/commit/d8f8e5a3b2d5c57fc89129c2cf8ed2ed7c52d171)) ## [9.1.2](https://github.com/libp2p/js-libp2p-kad-dht/compare/v9.1.1...v9.1.2) (2023-05-04) @@ -146,7 +146,7 @@ ### Dependencies -* bump @libp2p/interface-connection-manager from 1.5.0 to 2.0.0 ([#455](https://github.com/libp2p/js-libp2p-kad-dht/issues/455)) ([e4ed616](https://github.com/libp2p/js-libp2p-kad-dht/commit/e4ed6168add1653400853c5c2bc416790b0699a2)) +* bump @libp2p/interface-internal/connection-manager from 1.5.0 to 2.0.0 ([#455](https://github.com/libp2p/js-libp2p-kad-dht/issues/455)) ([e4ed616](https://github.com/libp2p/js-libp2p-kad-dht/commit/e4ed6168add1653400853c5c2bc416790b0699a2)) ## [8.0.7](https://github.com/libp2p/js-libp2p-kad-dht/compare/v8.0.6...v8.0.7) (2023-04-13) diff --git a/packages/kad-dht/package.json b/packages/kad-dht/package.json index d4feddee61..1f4bbce183 100644 --- a/packages/kad-dht/package.json +++ b/packages/kad-dht/package.json @@ -48,27 +48,15 @@ "test:chrome-webworker": "aegir test -t webworker", "test:firefox": "aegir test -t browser -- --browser firefox", "test:firefox-webworker": "aegir test -t webworker -- --browser firefox", - "dep-check": "aegir dep-check -i protons -i events" + "dep-check": "aegir dep-check -i events" }, "dependencies": { "@libp2p/crypto": "^1.0.0", - "@libp2p/interface-address-manager": "^3.0.0", - "@libp2p/interface-connection": "^5.0.0", - "@libp2p/interface-connection-manager": "^3.0.0", - "@libp2p/interface-content-routing": "^2.0.0", - "@libp2p/interface-metrics": "^4.0.0", - "@libp2p/interface-peer-discovery": "^2.0.0", - "@libp2p/interface-peer-id": "^2.0.0", - "@libp2p/interface-peer-info": "^1.0.0", - "@libp2p/interface-peer-routing": "^1.0.0", - "@libp2p/interface-peer-store": "^2.0.0", - "@libp2p/interface-registrar": "^2.0.0", - "@libp2p/interfaces": "^3.0.0", + "@libp2p/interface": "~0.0.1", + "@libp2p/interface-internal": "~0.0.1", "@libp2p/logger": "^2.0.0", "@libp2p/peer-collections": "^3.0.0", "@libp2p/peer-id": "^2.0.0", - "@libp2p/record": "^3.0.0", - "@libp2p/topology": "^4.0.0", "@multiformats/multiaddr": "^12.1.3", "@types/sinon": "^10.0.15", "abortable-iterator": "^5.0.1", @@ -78,17 +66,17 @@ "hashlru": "^2.3.0", "interface-datastore": "^8.2.0", "it-all": "^3.0.2", - "it-drain": "^3.0.1", + "it-drain": "^3.0.2", "it-first": "^3.0.1", "it-length": "^3.0.1", "it-length-prefixed": "^9.0.1", - "it-map": "^3.0.2", + "it-map": "^3.0.3", "it-merge": "^3.0.0", "it-parallel": "^3.0.0", "it-pipe": "^3.0.1", "it-stream-types": "^2.0.1", "it-take": "^3.0.1", - "multiformats": "^11.0.2", + "multiformats": "^12.0.1", "p-defer": "^4.0.0", "p-event": "^6.0.0", "p-queue": "^7.3.4", @@ -96,12 +84,11 @@ "progress-events": "^1.0.0", "protons-runtime": "^5.0.0", "uint8arraylist": "^2.4.3", - "uint8arrays": "^4.0.3", + "uint8arrays": "^4.0.4", "varint": "^6.0.0" }, "devDependencies": { - "@libp2p/interface-libp2p": "^3.0.0", - "@libp2p/interface-mocks": "^12.0.0", + "@libp2p/interface-compliance-tests": "^3.0.0", "@libp2p/peer-id-factory": "^2.0.0", "@libp2p/peer-store": "^8.0.0", "@types/lodash.random": "^3.2.6", @@ -119,7 +106,7 @@ "p-retry": "^5.0.0", "p-wait-for": "^5.0.0", "protons": "^7.0.2", - "sinon": "^15.1.0", + "sinon": "^15.1.2", "ts-sinon": "^2.0.2", "which": "^3.0.0" }, diff --git a/packages/kad-dht/src/content-fetching/index.ts b/packages/kad-dht/src/content-fetching/index.ts index 67c86dbde1..0dd38c6484 100644 --- a/packages/kad-dht/src/content-fetching/index.ts +++ b/packages/kad-dht/src/content-fetching/index.ts @@ -1,8 +1,5 @@ -import { CodeError } from '@libp2p/interfaces/errors' +import { CodeError } from '@libp2p/interface/errors' import { logger } from '@libp2p/logger' -import { Libp2pRecord } from '@libp2p/record' -import { bestRecord } from '@libp2p/record/selectors' -import { verifyRecord } from '@libp2p/record/validators' import map from 'it-map' import parallel from 'it-parallel' import { pipe } from 'it-pipe' @@ -15,13 +12,16 @@ import { valueEvent, queryErrorEvent } from '../query/events.js' +import { Libp2pRecord } from '../record/index.js' +import { bestRecord } from '../record/selectors.js' +import { verifyRecord } from '../record/validators.js' import { createPutRecord, bufferToRecordKey } from '../utils.js' import type { KadDHTComponents, Validators, Selectors, ValueEvent, QueryOptions, QueryEvent } from '../index.js' import type { Network } from '../network.js' import type { PeerRouting } from '../peer-routing/index.js' import type { QueryManager } from '../query/manager.js' import type { QueryFunc } from '../query/types.js' -import type { AbortOptions } from '@libp2p/interfaces' +import type { AbortOptions } from '@libp2p/interface' import type { Logger } from '@libp2p/logger' export interface ContentFetchingInit { diff --git a/packages/kad-dht/src/content-routing/index.ts b/packages/kad-dht/src/content-routing/index.ts index 5e4a8e0d72..2ca2033cd4 100644 --- a/packages/kad-dht/src/content-routing/index.ts +++ b/packages/kad-dht/src/content-routing/index.ts @@ -16,7 +16,7 @@ import type { Providers } from '../providers.js' import type { QueryManager } from '../query/manager.js' import type { QueryFunc } from '../query/types.js' import type { RoutingTable } from '../routing-table/index.js' -import type { PeerInfo } from '@libp2p/interface-peer-info' +import type { PeerInfo } from '@libp2p/interface/peer-info' import type { Logger } from '@libp2p/logger' import type { Multiaddr } from '@multiformats/multiaddr' import type { CID } from 'multiformats/cid' diff --git a/packages/kad-dht/src/dual-kad-dht.ts b/packages/kad-dht/src/dual-kad-dht.ts index 32a9f71d10..efc93ab936 100644 --- a/packages/kad-dht/src/dual-kad-dht.ts +++ b/packages/kad-dht/src/dual-kad-dht.ts @@ -1,8 +1,8 @@ -import { type ContentRouting, contentRouting } from '@libp2p/interface-content-routing' -import { type PeerDiscovery, peerDiscovery, type PeerDiscoveryEvents } from '@libp2p/interface-peer-discovery' -import { type PeerRouting, peerRouting } from '@libp2p/interface-peer-routing' -import { CodeError } from '@libp2p/interfaces/errors' -import { EventEmitter, CustomEvent } from '@libp2p/interfaces/events' +import { type ContentRouting, contentRouting } from '@libp2p/interface/content-routing' +import { CodeError } from '@libp2p/interface/errors' +import { EventEmitter, CustomEvent } from '@libp2p/interface/events' +import { type PeerDiscovery, peerDiscovery, type PeerDiscoveryEvents } from '@libp2p/interface/peer-discovery' +import { type PeerRouting, peerRouting } from '@libp2p/interface/peer-routing' import { logger } from '@libp2p/logger' import drain from 'it-drain' import merge from 'it-merge' @@ -10,8 +10,8 @@ import isPrivate from 'private-ip' import { DefaultKadDHT } from './kad-dht.js' import { queryErrorEvent } from './query/events.js' import type { DualKadDHT, KadDHT, KadDHTComponents, KadDHTInit, QueryEvent, QueryOptions } from './index.js' -import type { PeerId } from '@libp2p/interface-peer-id' -import type { PeerInfo } from '@libp2p/interface-peer-info' +import type { PeerId } from '@libp2p/interface/peer-id' +import type { PeerInfo } from '@libp2p/interface/peer-info' import type { Multiaddr } from '@multiformats/multiaddr' import type { CID } from 'multiformats/cid' diff --git a/packages/kad-dht/src/index.ts b/packages/kad-dht/src/index.ts index 81ea30d402..2c2230ac90 100644 --- a/packages/kad-dht/src/index.ts +++ b/packages/kad-dht/src/index.ts @@ -1,15 +1,14 @@ import { DefaultDualKadDHT } from './dual-kad-dht.js' import type { ProvidersInit } from './providers.js' -import type { AddressManager } from '@libp2p/interface-address-manager' -import type { ConnectionManager } from '@libp2p/interface-connection-manager' -import type { Libp2pEvents } from '@libp2p/interface-libp2p' -import type { Metrics } from '@libp2p/interface-metrics' -import type { PeerId } from '@libp2p/interface-peer-id' -import type { PeerInfo } from '@libp2p/interface-peer-info' -import type { PeerStore } from '@libp2p/interface-peer-store' -import type { Registrar } from '@libp2p/interface-registrar' -import type { AbortOptions } from '@libp2p/interfaces' -import type { EventEmitter } from '@libp2p/interfaces/events' +import type { Libp2pEvents, AbortOptions } from '@libp2p/interface' +import type { EventEmitter } from '@libp2p/interface/events' +import type { Metrics } from '@libp2p/interface/metrics' +import type { PeerId } from '@libp2p/interface/peer-id' +import type { PeerInfo } from '@libp2p/interface/peer-info' +import type { PeerStore } from '@libp2p/interface/peer-store' +import type { AddressManager } from '@libp2p/interface-internal/address-manager' +import type { ConnectionManager } from '@libp2p/interface-internal/connection-manager' +import type { Registrar } from '@libp2p/interface-internal/registrar' import type { Datastore } from 'interface-datastore' import type { CID } from 'multiformats/cid' import type { ProgressOptions, ProgressEvent } from 'progress-events' diff --git a/packages/kad-dht/src/kad-dht.ts b/packages/kad-dht/src/kad-dht.ts index b0e40154f0..f9f260452c 100644 --- a/packages/kad-dht/src/kad-dht.ts +++ b/packages/kad-dht/src/kad-dht.ts @@ -1,7 +1,5 @@ -import { CustomEvent, EventEmitter } from '@libp2p/interfaces/events' +import { CustomEvent, EventEmitter } from '@libp2p/interface/events' import { type Logger, logger } from '@libp2p/logger' -import { selectors as recordSelectors } from '@libp2p/record/selectors' -import { validators as recordValidators } from '@libp2p/record/validators' import pDefer from 'p-defer' import { PROTOCOL_DHT, PROTOCOL_PREFIX, LAN_PREFIX } from './constants.js' import { ContentFetching } from './content-fetching/index.js' @@ -11,6 +9,8 @@ import { PeerRouting } from './peer-routing/index.js' import { Providers } from './providers.js' import { QueryManager } from './query/manager.js' import { QuerySelf } from './query-self.js' +import { selectors as recordSelectors } from './record/selectors.js' +import { validators as recordValidators } from './record/validators.js' import { RoutingTable } from './routing-table/index.js' import { RoutingTableRefresh } from './routing-table/refresh.js' import { RPC } from './rpc/index.js' @@ -20,9 +20,9 @@ import { removePublicAddresses } from './utils.js' import type { KadDHTComponents, KadDHTInit, QueryOptions, Validators, Selectors, KadDHT, QueryEvent } from './index.js' -import type { PeerDiscoveryEvents } from '@libp2p/interface-peer-discovery' -import type { PeerId } from '@libp2p/interface-peer-id' -import type { PeerInfo } from '@libp2p/interface-peer-info' +import type { PeerDiscoveryEvents } from '@libp2p/interface/peer-discovery' +import type { PeerId } from '@libp2p/interface/peer-id' +import type { PeerInfo } from '@libp2p/interface/peer-info' import type { CID } from 'multiformats/cid' export const DEFAULT_MAX_INBOUND_STREAMS = 32 diff --git a/packages/kad-dht/src/message/index.ts b/packages/kad-dht/src/message/index.ts index ab946ab90c..585f83c108 100644 --- a/packages/kad-dht/src/message/index.ts +++ b/packages/kad-dht/src/message/index.ts @@ -1,8 +1,8 @@ import { peerIdFromBytes } from '@libp2p/peer-id' -import { Libp2pRecord } from '@libp2p/record' import { multiaddr } from '@multiformats/multiaddr' +import { Libp2pRecord } from '../record/index.js' import { Message as PBMessage } from './dht.js' -import type { PeerInfo } from '@libp2p/interface-peer-info' +import type { PeerInfo } from '@libp2p/interface/peer-info' import type { Uint8ArrayList } from 'uint8arraylist' export const MESSAGE_TYPE = PBMessage.MessageType diff --git a/packages/kad-dht/src/network.ts b/packages/kad-dht/src/network.ts index ca525af221..ad20c47be5 100644 --- a/packages/kad-dht/src/network.ts +++ b/packages/kad-dht/src/network.ts @@ -1,5 +1,5 @@ -import { CodeError } from '@libp2p/interfaces/errors' -import { EventEmitter, CustomEvent } from '@libp2p/interfaces/events' +import { CodeError } from '@libp2p/interface/errors' +import { EventEmitter, CustomEvent } from '@libp2p/interface/events' import { logger } from '@libp2p/logger' import { abortableDuplex } from 'abortable-iterator' import drain from 'it-drain' @@ -14,11 +14,11 @@ import { queryErrorEvent } from './query/events.js' import type { KadDHTComponents, QueryEvent, QueryOptions } from './index.js' -import type { Stream } from '@libp2p/interface-connection' -import type { PeerId } from '@libp2p/interface-peer-id' -import type { PeerInfo } from '@libp2p/interface-peer-info' -import type { AbortOptions } from '@libp2p/interfaces' -import type { Startable } from '@libp2p/interfaces/startable' +import type { AbortOptions } from '@libp2p/interface' +import type { Stream } from '@libp2p/interface/connection' +import type { PeerId } from '@libp2p/interface/peer-id' +import type { PeerInfo } from '@libp2p/interface/peer-info' +import type { Startable } from '@libp2p/interface/startable' import type { Logger } from '@libp2p/logger' import type { Duplex, Source } from 'it-stream-types' import type { Uint8ArrayList } from 'uint8arraylist' diff --git a/packages/kad-dht/src/peer-list/index.ts b/packages/kad-dht/src/peer-list/index.ts index 7298a70c2b..25024a2966 100644 --- a/packages/kad-dht/src/peer-list/index.ts +++ b/packages/kad-dht/src/peer-list/index.ts @@ -1,4 +1,4 @@ -import type { PeerId } from '@libp2p/interface-peer-id' +import type { PeerId } from '@libp2p/interface/peer-id' /** * A list of unique peers. diff --git a/packages/kad-dht/src/peer-list/peer-distance-list.ts b/packages/kad-dht/src/peer-list/peer-distance-list.ts index 5cccd9a51d..eff3d80485 100644 --- a/packages/kad-dht/src/peer-list/peer-distance-list.ts +++ b/packages/kad-dht/src/peer-list/peer-distance-list.ts @@ -1,7 +1,7 @@ import { compare as uint8ArrayCompare } from 'uint8arrays/compare' import { xor as uint8ArrayXor } from 'uint8arrays/xor' import * as utils from '../utils.js' -import type { PeerId } from '@libp2p/interface-peer-id' +import type { PeerId } from '@libp2p/interface/peer-id' interface PeerDistance { peerId: PeerId diff --git a/packages/kad-dht/src/peer-routing/index.ts b/packages/kad-dht/src/peer-routing/index.ts index ab0af91cb6..b356f86263 100644 --- a/packages/kad-dht/src/peer-routing/index.ts +++ b/packages/kad-dht/src/peer-routing/index.ts @@ -1,9 +1,7 @@ import { keys } from '@libp2p/crypto' -import { CodeError } from '@libp2p/interfaces/errors' +import { CodeError } from '@libp2p/interface/errors' import { logger } from '@libp2p/logger' import { peerIdFromKeys } from '@libp2p/peer-id' -import { Libp2pRecord } from '@libp2p/record' -import { verifyRecord } from '@libp2p/record/validators' import { toString as uint8ArrayToString } from 'uint8arrays/to-string' import { Message, MESSAGE_TYPE } from '../message/index.js' import { PeerDistanceList } from '../peer-list/peer-distance-list.js' @@ -12,15 +10,17 @@ import { finalPeerEvent, valueEvent } from '../query/events.js' +import { Libp2pRecord } from '../record/index.js' +import { verifyRecord } from '../record/validators.js' import * as utils from '../utils.js' import type { KadDHTComponents, DHTRecord, DialPeerEvent, FinalPeerEvent, QueryEvent, Validators } from '../index.js' import type { Network } from '../network.js' import type { QueryManager, QueryOptions } from '../query/manager.js' import type { QueryFunc } from '../query/types.js' import type { RoutingTable } from '../routing-table/index.js' -import type { PeerId } from '@libp2p/interface-peer-id' -import type { PeerInfo } from '@libp2p/interface-peer-info' -import type { AbortOptions } from '@libp2p/interfaces' +import type { AbortOptions } from '@libp2p/interface' +import type { PeerId } from '@libp2p/interface/peer-id' +import type { PeerInfo } from '@libp2p/interface/peer-info' import type { Logger } from '@libp2p/logger' export interface PeerRoutingInit { diff --git a/packages/kad-dht/src/providers.ts b/packages/kad-dht/src/providers.ts index 46e2703792..8f8381de20 100644 --- a/packages/kad-dht/src/providers.ts +++ b/packages/kad-dht/src/providers.ts @@ -11,8 +11,8 @@ import { PROVIDERS_LRU_CACHE_SIZE, PROVIDER_KEY_PREFIX } from './constants.js' -import type { PeerId } from '@libp2p/interface-peer-id' -import type { Startable } from '@libp2p/interfaces/startable' +import type { PeerId } from '@libp2p/interface/peer-id' +import type { Startable } from '@libp2p/interface/startable' import type { Datastore } from 'interface-datastore' import type { CID } from 'multiformats' diff --git a/packages/kad-dht/src/query-self.ts b/packages/kad-dht/src/query-self.ts index 300a364c02..a6daa8c3a4 100644 --- a/packages/kad-dht/src/query-self.ts +++ b/packages/kad-dht/src/query-self.ts @@ -9,8 +9,8 @@ import { pEvent } from 'p-event' import { QUERY_SELF_INTERVAL, QUERY_SELF_TIMEOUT, K, QUERY_SELF_INITIAL_INTERVAL } from './constants.js' import type { PeerRouting } from './peer-routing/index.js' import type { RoutingTable } from './routing-table/index.js' -import type { PeerId } from '@libp2p/interface-peer-id' -import type { Startable } from '@libp2p/interfaces/startable' +import type { PeerId } from '@libp2p/interface/peer-id' +import type { Startable } from '@libp2p/interface/startable' import type { DeferredPromise } from 'p-defer' export interface QuerySelfInit { diff --git a/packages/kad-dht/src/query/events.ts b/packages/kad-dht/src/query/events.ts index d838e2b47e..b55c2edd5e 100644 --- a/packages/kad-dht/src/query/events.ts +++ b/packages/kad-dht/src/query/events.ts @@ -1,10 +1,10 @@ -import { CustomEvent } from '@libp2p/interfaces/events' +import { CustomEvent } from '@libp2p/interface/events' import { MESSAGE_TYPE_LOOKUP } from '../message/index.js' import type { SendQueryEvent, PeerResponseEvent, DialPeerEvent, AddPeerEvent, ValueEvent, ProviderEvent, QueryErrorEvent, FinalPeerEvent, QueryOptions } from '../index.js' import type { Message } from '../message/dht.js' -import type { PeerId } from '@libp2p/interface-peer-id' -import type { PeerInfo } from '@libp2p/interface-peer-info' -import type { Libp2pRecord } from '@libp2p/record' +import type { Libp2pRecord } from '../record/index.js' +import type { PeerId } from '@libp2p/interface/peer-id' +import type { PeerInfo } from '@libp2p/interface/peer-info' export interface QueryEventFields { to: PeerId diff --git a/packages/kad-dht/src/query/manager.ts b/packages/kad-dht/src/query/manager.ts index 9eb2fe0210..df830faf2d 100644 --- a/packages/kad-dht/src/query/manager.ts +++ b/packages/kad-dht/src/query/manager.ts @@ -1,6 +1,6 @@ import { setMaxListeners } from 'events' -import { AbortError } from '@libp2p/interfaces/errors' -import { EventEmitter, CustomEvent } from '@libp2p/interfaces/events' +import { AbortError } from '@libp2p/interface/errors' +import { EventEmitter, CustomEvent } from '@libp2p/interface/events' import { logger } from '@libp2p/logger' import { PeerSet } from '@libp2p/peer-collections' import { anySignal } from 'any-signal' @@ -14,9 +14,9 @@ import { queryPath } from './query-path.js' import type { QueryFunc } from './types.js' import type { QueryEvent, QueryOptions as RootQueryOptions } from '../index.js' import type { RoutingTable } from '../routing-table/index.js' -import type { Metric, Metrics } from '@libp2p/interface-metrics' -import type { PeerId } from '@libp2p/interface-peer-id' -import type { Startable } from '@libp2p/interfaces/startable' +import type { Metric, Metrics } from '@libp2p/interface/metrics' +import type { PeerId } from '@libp2p/interface/peer-id' +import type { Startable } from '@libp2p/interface/startable' import type { DeferredPromise } from 'p-defer' export interface CleanUpEvents { diff --git a/packages/kad-dht/src/query/query-path.ts b/packages/kad-dht/src/query/query-path.ts index 2966b2947d..991f1abd42 100644 --- a/packages/kad-dht/src/query/query-path.ts +++ b/packages/kad-dht/src/query/query-path.ts @@ -1,4 +1,4 @@ -import { CodeError } from '@libp2p/interfaces/errors' +import { CodeError } from '@libp2p/interface/errors' import { anySignal } from 'any-signal' import defer from 'p-defer' import Queue from 'p-queue' @@ -9,8 +9,8 @@ import { queryErrorEvent } from './events.js' import type { CleanUpEvents } from './manager.js' import type { QueryEvent, QueryOptions } from '../index.js' import type { QueryFunc } from '../query/types.js' -import type { PeerId } from '@libp2p/interface-peer-id' -import type { EventEmitter } from '@libp2p/interfaces/events' +import type { EventEmitter } from '@libp2p/interface/events' +import type { PeerId } from '@libp2p/interface/peer-id' import type { Logger } from '@libp2p/logger' import type { PeerSet } from '@libp2p/peer-collections' diff --git a/packages/kad-dht/src/query/types.ts b/packages/kad-dht/src/query/types.ts index 6c43d4ba72..a764aa50c0 100644 --- a/packages/kad-dht/src/query/types.ts +++ b/packages/kad-dht/src/query/types.ts @@ -1,5 +1,5 @@ import type { QueryEvent } from '../index.js' -import type { PeerId } from '@libp2p/interface-peer-id' +import type { PeerId } from '@libp2p/interface/peer-id' export interface QueryContext { // the key we are looking up diff --git a/packages/record/src/index.ts b/packages/kad-dht/src/record/index.ts similarity index 100% rename from packages/record/src/index.ts rename to packages/kad-dht/src/record/index.ts diff --git a/packages/record/src/record.proto b/packages/kad-dht/src/record/record.proto similarity index 100% rename from packages/record/src/record.proto rename to packages/kad-dht/src/record/record.proto diff --git a/packages/record/src/record.ts b/packages/kad-dht/src/record/record.ts similarity index 100% rename from packages/record/src/record.ts rename to packages/kad-dht/src/record/record.ts diff --git a/packages/record/src/selectors.ts b/packages/kad-dht/src/record/selectors.ts similarity index 91% rename from packages/record/src/selectors.ts rename to packages/kad-dht/src/record/selectors.ts index ed28d0124d..7753bf3b03 100644 --- a/packages/record/src/selectors.ts +++ b/packages/kad-dht/src/record/selectors.ts @@ -1,6 +1,6 @@ -import { CodeError } from '@libp2p/interfaces/errors' +import { CodeError } from '@libp2p/interface/errors' import { toString as uint8ArrayToString } from 'uint8arrays/to-string' -import type { Selectors } from '@libp2p/interface-dht' +import type { Selectors } from '../index.js' /** * Select the best record out of the given records diff --git a/packages/record/src/utils.ts b/packages/kad-dht/src/record/utils.ts similarity index 100% rename from packages/record/src/utils.ts rename to packages/kad-dht/src/record/utils.ts diff --git a/packages/record/src/validators.ts b/packages/kad-dht/src/record/validators.ts similarity index 95% rename from packages/record/src/validators.ts rename to packages/kad-dht/src/record/validators.ts index f0d438b6a7..7302a083f5 100644 --- a/packages/record/src/validators.ts +++ b/packages/kad-dht/src/record/validators.ts @@ -1,9 +1,9 @@ -import { CodeError } from '@libp2p/interfaces/errors' +import { CodeError } from '@libp2p/interface/errors' import { sha256 } from 'multiformats/hashes/sha2' import { equals as uint8ArrayEquals } from 'uint8arrays/equals' import { toString as uint8ArrayToString } from 'uint8arrays/to-string' import type { Libp2pRecord } from './index.js' -import type { Validators } from '@libp2p/interface-dht' +import type { Validators } from '../index.js' /** * Checks a record and ensures it is still valid. diff --git a/packages/kad-dht/src/routing-table/index.ts b/packages/kad-dht/src/routing-table/index.ts index a3f2afb83a..148d126b7b 100644 --- a/packages/kad-dht/src/routing-table/index.ts +++ b/packages/kad-dht/src/routing-table/index.ts @@ -1,14 +1,14 @@ -import { EventEmitter } from '@libp2p/interfaces/events' +import { EventEmitter } from '@libp2p/interface/events' import { logger } from '@libp2p/logger' import { PeerSet } from '@libp2p/peer-collections' import Queue from 'p-queue' import * as utils from '../utils.js' import { KBucket, type PingEventDetails } from './k-bucket.js' -import type { ConnectionManager } from '@libp2p/interface-connection-manager' -import type { Metric, Metrics } from '@libp2p/interface-metrics' -import type { PeerId } from '@libp2p/interface-peer-id' -import type { PeerStore } from '@libp2p/interface-peer-store' -import type { Startable } from '@libp2p/interfaces/startable' +import type { Metric, Metrics } from '@libp2p/interface/metrics' +import type { PeerId } from '@libp2p/interface/peer-id' +import type { PeerStore } from '@libp2p/interface/peer-store' +import type { Startable } from '@libp2p/interface/startable' +import type { ConnectionManager } from '@libp2p/interface-internal/connection-manager' import type { Logger } from '@libp2p/logger' export const KAD_CLOSE_TAG_NAME = 'kad-close' diff --git a/packages/kad-dht/src/routing-table/k-bucket.ts b/packages/kad-dht/src/routing-table/k-bucket.ts index e49f1d0af2..fb8bb12c79 100644 --- a/packages/kad-dht/src/routing-table/k-bucket.ts +++ b/packages/kad-dht/src/routing-table/k-bucket.ts @@ -27,8 +27,8 @@ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -import { EventEmitter } from '@libp2p/interfaces/events' -import type { PeerId } from '@libp2p/interface-peer-id' +import { EventEmitter } from '@libp2p/interface/events' +import type { PeerId } from '@libp2p/interface/peer-id' function arrayEquals (array1: Uint8Array, array2: Uint8Array): boolean { if (array1 === array2) { diff --git a/packages/kad-dht/src/routing-table/refresh.ts b/packages/kad-dht/src/routing-table/refresh.ts index 5c3d198c1c..f163317af7 100644 --- a/packages/kad-dht/src/routing-table/refresh.ts +++ b/packages/kad-dht/src/routing-table/refresh.ts @@ -8,7 +8,7 @@ import { TABLE_REFRESH_INTERVAL, TABLE_REFRESH_QUERY_TIMEOUT } from '../constant import GENERATED_PREFIXES from './generated-prefix-list.js' import type { RoutingTable } from './index.js' import type { PeerRouting } from '../peer-routing/index.js' -import type { PeerId } from '@libp2p/interface-peer-id' +import type { PeerId } from '@libp2p/interface/peer-id' import type { Logger } from '@libp2p/logger' /** diff --git a/packages/kad-dht/src/rpc/handlers/add-provider.ts b/packages/kad-dht/src/rpc/handlers/add-provider.ts index f01c5f21da..27f378db4c 100644 --- a/packages/kad-dht/src/rpc/handlers/add-provider.ts +++ b/packages/kad-dht/src/rpc/handlers/add-provider.ts @@ -1,10 +1,10 @@ -import { CodeError } from '@libp2p/interfaces/errors' +import { CodeError } from '@libp2p/interface/errors' import { logger } from '@libp2p/logger' import { CID } from 'multiformats/cid' import type { Message } from '../../message/index.js' import type { Providers } from '../../providers' import type { DHTMessageHandler } from '../index.js' -import type { PeerId } from '@libp2p/interface-peer-id' +import type { PeerId } from '@libp2p/interface/peer-id' const log = logger('libp2p:kad-dht:rpc:handlers:add-provider') diff --git a/packages/kad-dht/src/rpc/handlers/find-node.ts b/packages/kad-dht/src/rpc/handlers/find-node.ts index 1bf7b6ce47..979ed1919a 100644 --- a/packages/kad-dht/src/rpc/handlers/find-node.ts +++ b/packages/kad-dht/src/rpc/handlers/find-node.ts @@ -8,9 +8,9 @@ import { } from '../../utils.js' import type { PeerRouting } from '../../peer-routing/index.js' import type { DHTMessageHandler } from '../index.js' -import type { AddressManager } from '@libp2p/interface-address-manager' -import type { PeerId } from '@libp2p/interface-peer-id' -import type { PeerInfo } from '@libp2p/interface-peer-info' +import type { PeerId } from '@libp2p/interface/peer-id' +import type { PeerInfo } from '@libp2p/interface/peer-info' +import type { AddressManager } from '@libp2p/interface-internal/address-manager' const log = logger('libp2p:kad-dht:rpc:handlers:find-node') diff --git a/packages/kad-dht/src/rpc/handlers/get-providers.ts b/packages/kad-dht/src/rpc/handlers/get-providers.ts index c213591b61..8e0c8563bb 100644 --- a/packages/kad-dht/src/rpc/handlers/get-providers.ts +++ b/packages/kad-dht/src/rpc/handlers/get-providers.ts @@ -1,4 +1,4 @@ -import { CodeError } from '@libp2p/interfaces/errors' +import { CodeError } from '@libp2p/interface/errors' import { logger } from '@libp2p/logger' import { CID } from 'multiformats/cid' import { Message } from '../../message/index.js' @@ -9,9 +9,9 @@ import { import type { PeerRouting } from '../../peer-routing/index.js' import type { Providers } from '../../providers.js' import type { DHTMessageHandler } from '../index.js' -import type { PeerId } from '@libp2p/interface-peer-id' -import type { PeerInfo } from '@libp2p/interface-peer-info' -import type { PeerStore } from '@libp2p/interface-peer-store' +import type { PeerId } from '@libp2p/interface/peer-id' +import type { PeerInfo } from '@libp2p/interface/peer-info' +import type { PeerStore } from '@libp2p/interface/peer-store' import type { Multiaddr } from '@multiformats/multiaddr' const log = logger('libp2p:kad-dht:rpc:handlers:get-providers') diff --git a/packages/kad-dht/src/rpc/handlers/get-value.ts b/packages/kad-dht/src/rpc/handlers/get-value.ts index d5a7c0a311..6a538e0eda 100644 --- a/packages/kad-dht/src/rpc/handlers/get-value.ts +++ b/packages/kad-dht/src/rpc/handlers/get-value.ts @@ -1,15 +1,15 @@ -import { CodeError } from '@libp2p/interfaces/errors' +import { CodeError } from '@libp2p/interface/errors' import { logger } from '@libp2p/logger' -import { Libp2pRecord } from '@libp2p/record' import { MAX_RECORD_AGE } from '../../constants.js' import { Message, MESSAGE_TYPE } from '../../message/index.js' +import { Libp2pRecord } from '../../record/index.js' import { bufferToRecordKey, isPublicKeyKey, fromPublicKeyKey } from '../../utils.js' import type { PeerRouting } from '../../peer-routing/index.js' import type { DHTMessageHandler } from '../index.js' -import type { PeerId } from '@libp2p/interface-peer-id' -import type { PeerStore } from '@libp2p/interface-peer-store' +import type { PeerId } from '@libp2p/interface/peer-id' +import type { PeerStore } from '@libp2p/interface/peer-store' import type { Datastore } from 'interface-datastore' const log = logger('libp2p:kad-dht:rpc:handlers:get-value') diff --git a/packages/kad-dht/src/rpc/handlers/ping.ts b/packages/kad-dht/src/rpc/handlers/ping.ts index 09d569c06e..2ec0e664e4 100644 --- a/packages/kad-dht/src/rpc/handlers/ping.ts +++ b/packages/kad-dht/src/rpc/handlers/ping.ts @@ -1,7 +1,7 @@ import { logger } from '@libp2p/logger' import type { Message } from '../../message/index.js' import type { DHTMessageHandler } from '../index.js' -import type { PeerId } from '@libp2p/interface-peer-id' +import type { PeerId } from '@libp2p/interface/peer-id' const log = logger('libp2p:kad-dht:rpc:handlers:ping') diff --git a/packages/kad-dht/src/rpc/handlers/put-value.ts b/packages/kad-dht/src/rpc/handlers/put-value.ts index 20a4084948..0a03d46047 100644 --- a/packages/kad-dht/src/rpc/handlers/put-value.ts +++ b/packages/kad-dht/src/rpc/handlers/put-value.ts @@ -1,11 +1,11 @@ -import { CodeError } from '@libp2p/interfaces/errors' +import { CodeError } from '@libp2p/interface/errors' import { type Logger, logger } from '@libp2p/logger' -import { verifyRecord } from '@libp2p/record/validators' +import { verifyRecord } from '../../record/validators.js' import { bufferToRecordKey } from '../../utils.js' import type { Validators } from '../../index.js' import type { Message } from '../../message/index.js' import type { DHTMessageHandler } from '../index.js' -import type { PeerId } from '@libp2p/interface-peer-id' +import type { PeerId } from '@libp2p/interface/peer-id' import type { Datastore } from 'interface-datastore' export interface PutValueHandlerInit { diff --git a/packages/kad-dht/src/rpc/index.ts b/packages/kad-dht/src/rpc/index.ts index fc435fe062..b063687e2d 100644 --- a/packages/kad-dht/src/rpc/index.ts +++ b/packages/kad-dht/src/rpc/index.ts @@ -12,8 +12,8 @@ import type { Validators } from '../index.js' import type { PeerRouting } from '../peer-routing' import type { Providers } from '../providers' import type { RoutingTable } from '../routing-table' -import type { PeerId } from '@libp2p/interface-peer-id' -import type { IncomingStreamData } from '@libp2p/interface-registrar' +import type { PeerId } from '@libp2p/interface/peer-id' +import type { IncomingStreamData } from '@libp2p/interface-internal/registrar' export interface DHTMessageHandler { handle: (peerId: PeerId, msg: Message) => Promise diff --git a/packages/kad-dht/src/topology-listener.ts b/packages/kad-dht/src/topology-listener.ts index 162e2c782c..462b633a3c 100644 --- a/packages/kad-dht/src/topology-listener.ts +++ b/packages/kad-dht/src/topology-listener.ts @@ -1,9 +1,8 @@ -import { CustomEvent, EventEmitter } from '@libp2p/interfaces/events' +import { CustomEvent, EventEmitter } from '@libp2p/interface/events' import { logger } from '@libp2p/logger' -import { createTopology } from '@libp2p/topology' import type { KadDHTComponents } from '.' -import type { PeerId } from '@libp2p/interface-peer-id' -import type { Startable } from '@libp2p/interfaces/startable' +import type { PeerId } from '@libp2p/interface/peer-id' +import type { Startable } from '@libp2p/interface/startable' import type { Logger } from '@libp2p/logger' export interface TopologyListenerInit { @@ -51,7 +50,7 @@ export class TopologyListener extends EventEmitter imple this.running = true // register protocol with topology - const topology = createTopology({ + this.registrarId = await this.components.registrar.register(this.protocol, { onConnect: (peerId) => { this.log('observed peer %p with protocol %s', peerId, this.protocol) this.dispatchEvent(new CustomEvent('peer', { @@ -59,7 +58,6 @@ export class TopologyListener extends EventEmitter imple })) } }) - this.registrarId = await this.components.registrar.register(this.protocol, topology) } /** diff --git a/packages/kad-dht/src/utils.ts b/packages/kad-dht/src/utils.ts index dccf4c5b08..5ee8a06b4c 100644 --- a/packages/kad-dht/src/utils.ts +++ b/packages/kad-dht/src/utils.ts @@ -1,5 +1,4 @@ import { peerIdFromBytes } from '@libp2p/peer-id' -import { Libp2pRecord } from '@libp2p/record' import { Key } from 'interface-datastore/key' import { sha256 } from 'multiformats/hashes/sha2' import isPrivateIp from 'private-ip' @@ -7,8 +6,9 @@ import { concat as uint8ArrayConcat } from 'uint8arrays/concat' import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' import { toString as uint8ArrayToString } from 'uint8arrays/to-string' import { RECORD_KEY_PREFIX } from './constants.js' -import type { PeerId } from '@libp2p/interface-peer-id' -import type { PeerInfo } from '@libp2p/interface-peer-info' +import { Libp2pRecord } from './record/index.js' +import type { PeerId } from '@libp2p/interface/peer-id' +import type { PeerInfo } from '@libp2p/interface/peer-info' // const IPNS_PREFIX = uint8ArrayFromString('/ipns/') const PK_PREFIX = uint8ArrayFromString('/pk/') diff --git a/packages/record/test/fixtures/go-key-records.ts b/packages/kad-dht/test/fixtures/record/go-key-records.ts similarity index 100% rename from packages/record/test/fixtures/go-key-records.ts rename to packages/kad-dht/test/fixtures/record/go-key-records.ts diff --git a/packages/record/test/fixtures/go-record.ts b/packages/kad-dht/test/fixtures/record/go-record.ts similarity index 100% rename from packages/record/test/fixtures/go-record.ts rename to packages/kad-dht/test/fixtures/record/go-record.ts diff --git a/packages/kad-dht/test/generate-peers/generate-peers.node.ts b/packages/kad-dht/test/generate-peers/generate-peers.node.ts index f429d6534c..0072a03659 100644 --- a/packages/kad-dht/test/generate-peers/generate-peers.node.ts +++ b/packages/kad-dht/test/generate-peers/generate-peers.node.ts @@ -12,8 +12,8 @@ import { RoutingTableRefresh } from '../../src/routing-table/refresh.js' import { convertPeerId } from '../../src/utils.js' -import type { ConnectionManager } from '@libp2p/interface-connection-manager' -import type { PeerStore } from '@libp2p/interface-peer-store' +import type { PeerStore } from '@libp2p/interface/peer-store' +import type { ConnectionManager } from '@libp2p/interface-internal/connection-manager' const dirname = path.dirname(fileURLToPath(import.meta.url)) diff --git a/packages/kad-dht/test/kad-dht.spec.ts b/packages/kad-dht/test/kad-dht.spec.ts index 94b3687dc7..b3ec84dd4f 100644 --- a/packages/kad-dht/test/kad-dht.spec.ts +++ b/packages/kad-dht/test/kad-dht.spec.ts @@ -1,8 +1,7 @@ /* eslint-env mocha */ /* eslint max-nested-callbacks: ["error", 8] */ -import { CodeError } from '@libp2p/interfaces/errors' -import { Libp2pRecord } from '@libp2p/record' +import { CodeError } from '@libp2p/interface/errors' import { expect } from 'aegir/chai' import delay from 'delay' import all from 'it-all' @@ -18,6 +17,7 @@ import * as c from '../src/constants.js' import { EventTypes, type FinalPeerEvent, MessageType, type QueryEvent, type ValueEvent } from '../src/index.js' import { MESSAGE_TYPE } from '../src/message/index.js' import { peerResponseEvent } from '../src/query/events.js' +import { Libp2pRecord } from '../src/record/index.js' import * as kadUtils from '../src/utils.js' import { createPeerIds } from './utils/create-peer-id.js' import { createValues } from './utils/create-values.js' @@ -25,7 +25,7 @@ import { countDiffPeers } from './utils/index.js' import { sortClosestPeers } from './utils/sort-closest-peers.js' import { TestDHT } from './utils/test-dht.js' import type { DefaultDualKadDHT } from '../src/dual-kad-dht.js' -import type { PeerId } from '@libp2p/interface-peer-id' +import type { PeerId } from '@libp2p/interface/peer-id' import type { CID } from 'multiformats/cid' async function findEvent (events: AsyncIterable, name: 'FINAL_PEER'): Promise diff --git a/packages/kad-dht/test/message.node.ts b/packages/kad-dht/test/message.node.ts index 7154664498..5521e8669d 100644 --- a/packages/kad-dht/test/message.node.ts +++ b/packages/kad-dht/test/message.node.ts @@ -2,7 +2,7 @@ import fs from 'fs' import path from 'path' -import { isPeerId } from '@libp2p/interface-peer-id' +import { isPeerId } from '@libp2p/interface/peer-id' import { expect } from 'aegir/chai' import range from 'lodash.range' import { Message } from '../src/message/index.js' diff --git a/packages/kad-dht/test/message.spec.ts b/packages/kad-dht/test/message.spec.ts index 64cd22bc34..eee15095c2 100644 --- a/packages/kad-dht/test/message.spec.ts +++ b/packages/kad-dht/test/message.spec.ts @@ -1,12 +1,12 @@ /* eslint-env mocha */ import { createEd25519PeerId } from '@libp2p/peer-id-factory' -import { Libp2pRecord } from '@libp2p/record' import { multiaddr } from '@multiformats/multiaddr' import { expect } from 'aegir/chai' import random from 'lodash.random' import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' import { Message, MESSAGE_TYPE } from '../src/message/index.js' +import { Libp2pRecord } from '../src/record/index.js' describe('Message', () => { it('create', () => { diff --git a/packages/kad-dht/test/network.spec.ts b/packages/kad-dht/test/network.spec.ts index 6ab435fadc..639bc61464 100644 --- a/packages/kad-dht/test/network.spec.ts +++ b/packages/kad-dht/test/network.spec.ts @@ -1,6 +1,6 @@ /* eslint-env mocha */ -import { mockStream } from '@libp2p/interface-mocks' +import { mockStream } from '@libp2p/interface-compliance-tests/mocks' import { expect } from 'aegir/chai' import all from 'it-all' import * as lp from 'it-length-prefixed' @@ -12,8 +12,8 @@ import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' import { Message, MESSAGE_TYPE } from '../src/message/index.js' import { TestDHT } from './utils/test-dht.js' import type { DefaultDualKadDHT } from '../src/dual-kad-dht.js' -import type { Connection } from '@libp2p/interface-connection' -import type { PeerId } from '@libp2p/interface-peer-id' +import type { Connection } from '@libp2p/interface/connection' +import type { PeerId } from '@libp2p/interface/peer-id' import type { Multiaddr } from '@multiformats/multiaddr' import type { Sink, Source } from 'it-stream-types' diff --git a/packages/kad-dht/test/peer-list.spec.ts b/packages/kad-dht/test/peer-list.spec.ts index f2ebd2fecf..3eec30d022 100644 --- a/packages/kad-dht/test/peer-list.spec.ts +++ b/packages/kad-dht/test/peer-list.spec.ts @@ -3,7 +3,7 @@ import { expect } from 'aegir/chai' import { PeerList } from '../src/peer-list/index.js' import { createPeerIds } from './utils/create-peer-id.js' -import type { PeerId } from '@libp2p/interface-peer-id' +import type { PeerId } from '@libp2p/interface/peer-id' describe('PeerList', () => { let peers: PeerId[] diff --git a/packages/kad-dht/test/providers.spec.ts b/packages/kad-dht/test/providers.spec.ts index 84051bf8e0..72f9487376 100644 --- a/packages/kad-dht/test/providers.spec.ts +++ b/packages/kad-dht/test/providers.spec.ts @@ -8,7 +8,7 @@ import { sha256 } from 'multiformats/hashes/sha2' import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' import { Providers } from '../src/providers.js' import { createPeerIds } from './utils/create-peer-id.js' -import type { PeerId } from '@libp2p/interface-peer-id' +import type { PeerId } from '@libp2p/interface/peer-id' describe('Providers', () => { let peers: PeerId[] diff --git a/packages/kad-dht/test/query-self.spec.ts b/packages/kad-dht/test/query-self.spec.ts index 2220419810..d43313d29e 100644 --- a/packages/kad-dht/test/query-self.spec.ts +++ b/packages/kad-dht/test/query-self.spec.ts @@ -1,6 +1,6 @@ /* eslint-env mocha */ -import { CustomEvent } from '@libp2p/interfaces/events' +import { CustomEvent } from '@libp2p/interface/events' import { createEd25519PeerId } from '@libp2p/peer-id-factory' import { expect } from 'aegir/chai' import pDefer from 'p-defer' @@ -9,7 +9,7 @@ import { finalPeerEvent } from '../src/query/events.js' import { QuerySelf } from '../src/query-self.js' import type { PeerRouting } from '../src/peer-routing/index.js' import type { RoutingTable } from '../src/routing-table/index.js' -import type { PeerId } from '@libp2p/interface-peer-id' +import type { PeerId } from '@libp2p/interface/peer-id' import type { DeferredPromise } from 'p-defer' describe('Query Self', () => { diff --git a/packages/kad-dht/test/query.spec.ts b/packages/kad-dht/test/query.spec.ts index 7ffb678f80..e1fd7460af 100644 --- a/packages/kad-dht/test/query.spec.ts +++ b/packages/kad-dht/test/query.spec.ts @@ -20,7 +20,7 @@ import { createPeerId, createPeerIds } from './utils/create-peer-id.js' import { sortClosestPeers } from './utils/sort-closest-peers.js' import type { QueryFunc } from '../src/query/types.js' import type { RoutingTable } from '../src/routing-table/index.js' -import type { PeerId } from '@libp2p/interface-peer-id' +import type { PeerId } from '@libp2p/interface/peer-id' interface TopologyEntry { delay?: number diff --git a/packages/record/test/record.spec.ts b/packages/kad-dht/test/record/record.spec.ts similarity index 93% rename from packages/record/test/record.spec.ts rename to packages/kad-dht/test/record/record.spec.ts index ce091b4d4d..1debcdd989 100644 --- a/packages/record/test/record.spec.ts +++ b/packages/kad-dht/test/record/record.spec.ts @@ -1,8 +1,8 @@ /* eslint-env mocha */ import { expect } from 'aegir/chai' import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' -import { Libp2pRecord } from '../src/index.js' -import * as fixture from './fixtures/go-record.js' +import { Libp2pRecord } from '../../src/record/index.js' +import * as fixture from '../fixtures/record/go-record.js' const date = new Date() diff --git a/packages/record/test/selection.spec.ts b/packages/kad-dht/test/record/selection.spec.ts similarity index 94% rename from packages/record/test/selection.spec.ts rename to packages/kad-dht/test/record/selection.spec.ts index 443be63691..cf4b441943 100644 --- a/packages/record/test/selection.spec.ts +++ b/packages/kad-dht/test/record/selection.spec.ts @@ -3,8 +3,8 @@ import { expect } from 'aegir/chai' import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' -import * as selection from '../src/selectors.js' -import type { Selectors } from '@libp2p/interface-dht' +import * as selection from '../../src/record/selectors.js' +import type { Selectors } from '../../src/index.js' const records = [new Uint8Array(), uint8ArrayFromString('hello')] diff --git a/packages/record/test/utils.spec.ts b/packages/kad-dht/test/record/utils.spec.ts similarity index 95% rename from packages/record/test/utils.spec.ts rename to packages/kad-dht/test/record/utils.spec.ts index 2babd36d5d..3925afe521 100644 --- a/packages/record/test/utils.spec.ts +++ b/packages/kad-dht/test/record/utils.spec.ts @@ -1,7 +1,7 @@ /* eslint-env mocha */ import { expect } from 'aegir/chai' -import * as utils from '../src/utils.js' +import * as utils from '../../src/record/utils.js' const dates = [{ obj: new Date(Date.UTC(2016, 0, 1, 8, 22, 33, 392)), diff --git a/packages/record/test/validator.spec.ts b/packages/kad-dht/test/record/validator.spec.ts similarity index 93% rename from packages/record/test/validator.spec.ts rename to packages/kad-dht/test/record/validator.spec.ts index c2c20e187b..0fd7c2320b 100644 --- a/packages/record/test/validator.spec.ts +++ b/packages/kad-dht/test/record/validator.spec.ts @@ -4,10 +4,10 @@ import { generateKeyPair, unmarshalPublicKey } from '@libp2p/crypto/keys' import { expect } from 'aegir/chai' import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' -import { Libp2pRecord } from '../src/index.js' -import * as validator from '../src/validators.js' -import * as fixture from './fixtures/go-key-records.js' -import type { Validators } from '@libp2p/interface-dht' +import { Libp2pRecord } from '../../src/record/index.js' +import * as validator from '../../src/record/validators.js' +import * as fixture from '../fixtures/record/go-key-records.js' +import type { Validators } from '../../src/index.js' interface Cases { valid: { diff --git a/packages/kad-dht/test/routing-table.spec.ts b/packages/kad-dht/test/routing-table.spec.ts index 5fafc29784..669115c349 100644 --- a/packages/kad-dht/test/routing-table.spec.ts +++ b/packages/kad-dht/test/routing-table.spec.ts @@ -1,7 +1,7 @@ /* eslint-env mocha */ -import { mockConnectionManager } from '@libp2p/interface-mocks' -import { EventEmitter, CustomEvent } from '@libp2p/interfaces/events' +import { EventEmitter, CustomEvent } from '@libp2p/interface/events' +import { mockConnectionManager } from '@libp2p/interface-compliance-tests/mocks' import { PeerSet } from '@libp2p/peer-collections' import { peerIdFromString } from '@libp2p/peer-id' import { createEd25519PeerId } from '@libp2p/peer-id-factory' @@ -20,11 +20,11 @@ import { KAD_CLOSE_TAG_NAME, KAD_CLOSE_TAG_VALUE, KBUCKET_SIZE, RoutingTable, ty import * as kadUtils from '../src/utils.js' import { createPeerId, createPeerIds } from './utils/create-peer-id.js' import { sortClosestPeers } from './utils/sort-closest-peers.js' -import type { ConnectionManager } from '@libp2p/interface-connection-manager' -import type { Libp2pEvents } from '@libp2p/interface-libp2p' -import type { PeerId } from '@libp2p/interface-peer-id' -import type { PeerStore } from '@libp2p/interface-peer-store' -import type { Registrar } from '@libp2p/interface-registrar' +import type { Libp2pEvents } from '@libp2p/interface' +import type { PeerId } from '@libp2p/interface/peer-id' +import type { PeerStore } from '@libp2p/interface/peer-store' +import type { ConnectionManager } from '@libp2p/interface-internal/connection-manager' +import type { Registrar } from '@libp2p/interface-internal/registrar' describe('Routing Table', () => { let table: RoutingTable diff --git a/packages/kad-dht/test/rpc/handlers/add-provider.spec.ts b/packages/kad-dht/test/rpc/handlers/add-provider.spec.ts index 3455ce5e70..ad9633856d 100644 --- a/packages/kad-dht/test/rpc/handlers/add-provider.spec.ts +++ b/packages/kad-dht/test/rpc/handlers/add-provider.spec.ts @@ -10,7 +10,7 @@ import { AddProviderHandler } from '../../../src/rpc/handlers/add-provider.js' import { createPeerIds } from '../../utils/create-peer-id.js' import { createValues } from '../../utils/create-values.js' import type { DHTMessageHandler } from '../../../src/rpc/index.js' -import type { PeerId } from '@libp2p/interface-peer-id' +import type { PeerId } from '@libp2p/interface/peer-id' import type { CID } from 'multiformats' describe('rpc - handlers - AddProvider', () => { diff --git a/packages/kad-dht/test/rpc/handlers/find-node.spec.ts b/packages/kad-dht/test/rpc/handlers/find-node.spec.ts index 98ec8e84b0..5eb13982bf 100644 --- a/packages/kad-dht/test/rpc/handlers/find-node.spec.ts +++ b/packages/kad-dht/test/rpc/handlers/find-node.spec.ts @@ -9,8 +9,8 @@ import { PeerRouting } from '../../../src/peer-routing/index.js' import { FindNodeHandler } from '../../../src/rpc/handlers/find-node.js' import { createPeerId } from '../../utils/create-peer-id.js' import type { DHTMessageHandler } from '../../../src/rpc/index.js' -import type { AddressManager } from '@libp2p/interface-address-manager' -import type { PeerId } from '@libp2p/interface-peer-id' +import type { PeerId } from '@libp2p/interface/peer-id' +import type { AddressManager } from '@libp2p/interface-internal/address-manager' import type { StubbedInstance } from 'ts-sinon' const T = MESSAGE_TYPE.FIND_NODE diff --git a/packages/kad-dht/test/rpc/handlers/get-providers.spec.ts b/packages/kad-dht/test/rpc/handlers/get-providers.spec.ts index 49feba7fcc..20cab3c7e7 100644 --- a/packages/kad-dht/test/rpc/handlers/get-providers.spec.ts +++ b/packages/kad-dht/test/rpc/handlers/get-providers.spec.ts @@ -1,6 +1,6 @@ /* eslint-env mocha */ -import { EventEmitter } from '@libp2p/interfaces/events' +import { EventEmitter } from '@libp2p/interface/events' import { PersistentPeerStore } from '@libp2p/peer-store' import { multiaddr } from '@multiformats/multiaddr' import { expect } from 'aegir/chai' @@ -13,10 +13,10 @@ import { Providers } from '../../../src/providers.js' import { GetProvidersHandler, type GetProvidersHandlerComponents } from '../../../src/rpc/handlers/get-providers.js' import { createPeerId } from '../../utils/create-peer-id.js' import { createValues, type Value } from '../../utils/create-values.js' -import type { Libp2pEvents } from '@libp2p/interface-libp2p' -import type { PeerId } from '@libp2p/interface-peer-id' -import type { PeerInfo } from '@libp2p/interface-peer-info' -import type { PeerStore } from '@libp2p/interface-peer-store' +import type { Libp2pEvents } from '@libp2p/interface' +import type { PeerId } from '@libp2p/interface/peer-id' +import type { PeerInfo } from '@libp2p/interface/peer-info' +import type { PeerStore } from '@libp2p/interface/peer-store' const T = MESSAGE_TYPE.GET_PROVIDERS diff --git a/packages/kad-dht/test/rpc/handlers/get-value.spec.ts b/packages/kad-dht/test/rpc/handlers/get-value.spec.ts index b8cb3b7b6b..32cf1c9bba 100644 --- a/packages/kad-dht/test/rpc/handlers/get-value.spec.ts +++ b/packages/kad-dht/test/rpc/handlers/get-value.spec.ts @@ -1,20 +1,20 @@ /* eslint-env mocha */ -import { EventEmitter } from '@libp2p/interfaces/events' +import { EventEmitter } from '@libp2p/interface/events' import { PersistentPeerStore } from '@libp2p/peer-store' -import { Libp2pRecord } from '@libp2p/record' import { expect } from 'aegir/chai' import { MemoryDatastore } from 'datastore-core' import Sinon from 'sinon' import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' import { Message, MESSAGE_TYPE } from '../../../src/message/index.js' import { PeerRouting } from '../../../src/peer-routing/index.js' +import { Libp2pRecord } from '../../../src/record/index.js' import { GetValueHandler, type GetValueHandlerComponents } from '../../../src/rpc/handlers/get-value.js' import * as utils from '../../../src/utils.js' import { createPeerId } from '../../utils/create-peer-id.js' -import type { Libp2pEvents } from '@libp2p/interface-libp2p' -import type { PeerId } from '@libp2p/interface-peer-id' -import type { PeerStore } from '@libp2p/interface-peer-store' +import type { Libp2pEvents } from '@libp2p/interface' +import type { PeerId } from '@libp2p/interface/peer-id' +import type { PeerStore } from '@libp2p/interface/peer-store' import type { Datastore } from 'interface-datastore' import type { SinonStubbedInstance } from 'sinon' diff --git a/packages/kad-dht/test/rpc/handlers/ping.spec.ts b/packages/kad-dht/test/rpc/handlers/ping.spec.ts index 0c696c5441..0db269f0cc 100644 --- a/packages/kad-dht/test/rpc/handlers/ping.spec.ts +++ b/packages/kad-dht/test/rpc/handlers/ping.spec.ts @@ -6,7 +6,7 @@ import { Message, MESSAGE_TYPE } from '../../../src/message/index.js' import { PingHandler } from '../../../src/rpc/handlers/ping.js' import { createPeerId } from '../../utils/create-peer-id.js' import type { DHTMessageHandler } from '../../../src/rpc/index.js' -import type { PeerId } from '@libp2p/interface-peer-id' +import type { PeerId } from '@libp2p/interface/peer-id' const T = MESSAGE_TYPE.PING diff --git a/packages/kad-dht/test/rpc/handlers/put-value.spec.ts b/packages/kad-dht/test/rpc/handlers/put-value.spec.ts index 720b6308bf..fe2fa5d23a 100644 --- a/packages/kad-dht/test/rpc/handlers/put-value.spec.ts +++ b/packages/kad-dht/test/rpc/handlers/put-value.spec.ts @@ -1,17 +1,17 @@ /* eslint-env mocha */ /* eslint max-nested-callbacks: ["error", 8] */ -import { Libp2pRecord } from '@libp2p/record' import { expect } from 'aegir/chai' import { MemoryDatastore } from 'datastore-core' import delay from 'delay' import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' import { Message, MESSAGE_TYPE } from '../../../src/message/index.js' +import { Libp2pRecord } from '../../../src/record/index.js' import { PutValueHandler } from '../../../src/rpc/handlers/put-value.js' import * as utils from '../../../src/utils.js' import { createPeerId } from '../../utils/create-peer-id.js' import type { Validators } from '../../../src/index.js' -import type { PeerId } from '@libp2p/interface-peer-id' +import type { PeerId } from '@libp2p/interface/peer-id' import type { Datastore } from 'interface-datastore' const T = MESSAGE_TYPE.PUT_VALUE diff --git a/packages/kad-dht/test/rpc/index.node.ts b/packages/kad-dht/test/rpc/index.node.ts index a519b3f34f..da58989b23 100644 --- a/packages/kad-dht/test/rpc/index.node.ts +++ b/packages/kad-dht/test/rpc/index.node.ts @@ -1,8 +1,8 @@ /* eslint-env mocha */ -import { mockStream } from '@libp2p/interface-mocks' -import { EventEmitter } from '@libp2p/interfaces/events' -import { start } from '@libp2p/interfaces/startable' +import { EventEmitter } from '@libp2p/interface/events' +import { start } from '@libp2p/interface/startable' +import { mockStream } from '@libp2p/interface-compliance-tests/mocks' import { PersistentPeerStore } from '@libp2p/peer-store' import { expect } from 'aegir/chai' import { MemoryDatastore } from 'datastore-core' @@ -22,11 +22,11 @@ import { RoutingTable } from '../../src/routing-table/index.js' import { RPC, type RPCComponents } from '../../src/rpc/index.js' import { createPeerId } from '../utils/create-peer-id.js' import type { Validators } from '../../src/index.js' -import type { AddressManager } from '@libp2p/interface-address-manager' -import type { Connection } from '@libp2p/interface-connection' -import type { Libp2pEvents } from '@libp2p/interface-libp2p' -import type { PeerId } from '@libp2p/interface-peer-id' -import type { PeerStore } from '@libp2p/interface-peer-store' +import type { Libp2pEvents } from '@libp2p/interface' +import type { Connection } from '@libp2p/interface/connection' +import type { PeerId } from '@libp2p/interface/peer-id' +import type { PeerStore } from '@libp2p/interface/peer-store' +import type { AddressManager } from '@libp2p/interface-internal/address-manager' import type { Datastore } from 'interface-datastore' import type { Duplex, Source } from 'it-stream-types' diff --git a/packages/kad-dht/test/utils/create-peer-id.ts b/packages/kad-dht/test/utils/create-peer-id.ts index 5295535fb2..940aaf24d6 100644 --- a/packages/kad-dht/test/utils/create-peer-id.ts +++ b/packages/kad-dht/test/utils/create-peer-id.ts @@ -1,5 +1,5 @@ import { createEd25519PeerId } from '@libp2p/peer-id-factory' -import type { Ed25519PeerId } from '@libp2p/interface-peer-id' +import type { Ed25519PeerId } from '@libp2p/interface/peer-id' /** * Creates multiple PeerIds diff --git a/packages/kad-dht/test/utils/index.ts b/packages/kad-dht/test/utils/index.ts index 933d9e7c8b..1ee82f8070 100644 --- a/packages/kad-dht/test/utils/index.ts +++ b/packages/kad-dht/test/utils/index.ts @@ -1,4 +1,4 @@ -import type { PeerId } from '@libp2p/interface-peer-id' +import type { PeerId } from '@libp2p/interface/peer-id' /** * Count how many peers are in b but are not in a diff --git a/packages/kad-dht/test/utils/sort-closest-peers.ts b/packages/kad-dht/test/utils/sort-closest-peers.ts index 1fb81e5322..f0bdd9ae5a 100644 --- a/packages/kad-dht/test/utils/sort-closest-peers.ts +++ b/packages/kad-dht/test/utils/sort-closest-peers.ts @@ -3,7 +3,7 @@ import map from 'it-map' import { compare as uint8ArrayCompare } from 'uint8arrays/compare' import { xor as uint8ArrayXor } from 'uint8arrays/xor' import { convertPeerId } from '../../src/utils.js' -import type { PeerId } from '@libp2p/interface-peer-id' +import type { PeerId } from '@libp2p/interface/peer-id' /** * Sort peers by distance to the given `kadId` diff --git a/packages/kad-dht/test/utils/test-dht.ts b/packages/kad-dht/test/utils/test-dht.ts index e490b944d3..04be4041be 100644 --- a/packages/kad-dht/test/utils/test-dht.ts +++ b/packages/kad-dht/test/utils/test-dht.ts @@ -1,6 +1,6 @@ -import { mockRegistrar, mockConnectionManager, mockNetwork } from '@libp2p/interface-mocks' -import { EventEmitter } from '@libp2p/interfaces/events' -import { start, stop } from '@libp2p/interfaces/startable' +import { EventEmitter } from '@libp2p/interface/events' +import { start, stop } from '@libp2p/interface/startable' +import { mockRegistrar, mockConnectionManager, mockNetwork } from '@libp2p/interface-compliance-tests/mocks' import { logger } from '@libp2p/logger' import { PersistentPeerStore } from '@libp2p/peer-store' import { multiaddr } from '@multiformats/multiaddr' @@ -12,12 +12,12 @@ import { DefaultDualKadDHT } from '../../src/dual-kad-dht.js' import { createPeerId } from './create-peer-id.js' import type { DualKadDHT, KadDHTComponents, KadDHTInit } from '../../src/index.js' import type { DefaultKadDHT } from '../../src/kad-dht.js' -import type { AddressManager } from '@libp2p/interface-address-manager' -import type { ConnectionManager } from '@libp2p/interface-connection-manager' -import type { Libp2pEvents } from '@libp2p/interface-libp2p' -import type { PeerId } from '@libp2p/interface-peer-id' -import type { PeerStore } from '@libp2p/interface-peer-store' -import type { Registrar } from '@libp2p/interface-registrar' +import type { Libp2pEvents } from '@libp2p/interface' +import type { PeerId } from '@libp2p/interface/peer-id' +import type { PeerStore } from '@libp2p/interface/peer-store' +import type { AddressManager } from '@libp2p/interface-internal/address-manager' +import type { ConnectionManager } from '@libp2p/interface-internal/connection-manager' +import type { Registrar } from '@libp2p/interface-internal/registrar' const log = logger('libp2p:kad-dht:test-dht') diff --git a/packages/kad-dht/tsconfig.json b/packages/kad-dht/tsconfig.json index b0b4b2243b..7f889f2ac5 100644 --- a/packages/kad-dht/tsconfig.json +++ b/packages/kad-dht/tsconfig.json @@ -12,46 +12,13 @@ "path": "../crypto" }, { - "path": "../interface-address-manager" + "path": "../interface" }, { - "path": "../interface-connection" + "path": "../interface-compliance-tests" }, { - "path": "../interface-connection-manager" - }, - { - "path": "../interface-content-routing" - }, - { - "path": "../interface-libp2p" - }, - { - "path": "../interface-metrics" - }, - { - "path": "../interface-mocks" - }, - { - "path": "../interface-peer-discovery" - }, - { - "path": "../interface-peer-id" - }, - { - "path": "../interface-peer-info" - }, - { - "path": "../interface-peer-routing" - }, - { - "path": "../interface-peer-store" - }, - { - "path": "../interface-registrar" - }, - { - "path": "../interfaces" + "path": "../interface-internal" }, { "path": "../logger" @@ -67,12 +34,6 @@ }, { "path": "../peer-store" - }, - { - "path": "../record" - }, - { - "path": "../topology" } ] } diff --git a/packages/keychain/package.json b/packages/keychain/package.json index 9bc7e246b0..368b2f80f9 100644 --- a/packages/keychain/package.json +++ b/packages/keychain/package.json @@ -54,21 +54,19 @@ }, "dependencies": { "@libp2p/crypto": "^1.0.0", - "@libp2p/interface-keychain": "^2.0.0", - "@libp2p/interface-peer-id": "^2.0.0", - "@libp2p/interfaces": "^3.0.0", + "@libp2p/interface": "~0.0.1", "@libp2p/logger": "^2.0.0", "@libp2p/peer-id": "^2.0.0", "interface-datastore": "^8.2.0", "merge-options": "^3.0.4", "sanitize-filename": "^1.6.3", - "uint8arrays": "^4.0.3" + "uint8arrays": "^4.0.4" }, "devDependencies": { "@libp2p/peer-id-factory": "^2.0.0", "aegir": "^39.0.10", "datastore-core": "^9.0.1", - "multiformats": "^11.0.1" + "multiformats": "^12.0.1" }, "typedoc": { "entryPoint": "./src/index.ts" diff --git a/packages/keychain/src/index.ts b/packages/keychain/src/index.ts index 5c0a94ee3f..f13cc0367f 100644 --- a/packages/keychain/src/index.ts +++ b/packages/keychain/src/index.ts @@ -2,7 +2,7 @@ import { pbkdf2, randomBytes } from '@libp2p/crypto' import { generateKeyPair, importKey, unmarshalPrivateKey } from '@libp2p/crypto/keys' -import { CodeError } from '@libp2p/interfaces/errors' +import { CodeError } from '@libp2p/interface/errors' import { logger } from '@libp2p/logger' import { peerIdFromKeys } from '@libp2p/peer-id' import { Key } from 'interface-datastore/key' @@ -11,8 +11,9 @@ import sanitize from 'sanitize-filename' import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' import { toString as uint8ArrayToString } from 'uint8arrays/to-string' import { codes } from './errors.js' -import type { KeyChain, KeyInfo, KeyType } from '@libp2p/interface-keychain' -import type { PeerId } from '@libp2p/interface-peer-id' +import type { KeyChain, KeyInfo } from '@libp2p/interface/keychain' +import type { KeyType } from '@libp2p/interface/keys' +import type { PeerId } from '@libp2p/interface/peer-id' import type { Datastore } from 'interface-datastore' const log = logger('libp2p:keychain') diff --git a/packages/keychain/test/keychain.spec.ts b/packages/keychain/test/keychain.spec.ts index 6089b90734..70a70bff53 100644 --- a/packages/keychain/test/keychain.spec.ts +++ b/packages/keychain/test/keychain.spec.ts @@ -10,8 +10,8 @@ import { Key } from 'interface-datastore/key' import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' import { toString as uint8ArrayToString } from 'uint8arrays/to-string' import { DefaultKeyChain, type KeyChainInit } from '../src/index.js' -import type { KeyChain, KeyInfo } from '@libp2p/interface-keychain' -import type { PeerId } from '@libp2p/interface-peer-id' +import type { KeyChain, KeyInfo } from '@libp2p/interface/keychain' +import type { PeerId } from '@libp2p/interface/peer-id' import type { Datastore } from 'interface-datastore' describe('keychain', () => { diff --git a/packages/keychain/test/peerid.spec.ts b/packages/keychain/test/peerid.spec.ts index cc8e8a5fcf..0c567e23ad 100644 --- a/packages/keychain/test/peerid.spec.ts +++ b/packages/keychain/test/peerid.spec.ts @@ -5,7 +5,7 @@ import { createFromPrivKey } from '@libp2p/peer-id-factory' import { expect } from 'aegir/chai' import { base58btc } from 'multiformats/bases/base58' import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' -import type { PeerId } from '@libp2p/interface-peer-id' +import type { PeerId } from '@libp2p/interface/peer-id' const sample = { id: '122019318b6e5e0cf93a2314bf01269a2cc23cd3dcd452d742cdb9379d8646f6e4a9', diff --git a/packages/keychain/tsconfig.json b/packages/keychain/tsconfig.json index f3aa4228a3..b471419c56 100644 --- a/packages/keychain/tsconfig.json +++ b/packages/keychain/tsconfig.json @@ -14,13 +14,7 @@ "path": "../crypto" }, { - "path": "../interface-keychain" - }, - { - "path": "../interface-peer-id" - }, - { - "path": "../interfaces" + "path": "../interface" }, { "path": "../logger" diff --git a/packages/libp2p/README.md b/packages/libp2p/README.md index 8760b4a07a..554db067e3 100644 --- a/packages/libp2p/README.md +++ b/packages/libp2p/README.md @@ -146,7 +146,7 @@ List of packages currently in existence for libp2p | ---------|---------|---------|---------|--------- | | **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) | +| [`@libp2p/interface`](//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) | diff --git a/packages/libp2p/package-list.json b/packages/libp2p/package-list.json index e91b4876e0..5cdba6a5c9 100644 --- a/packages/libp2p/package-list.json +++ b/packages/libp2p/package-list.json @@ -9,7 +9,7 @@ "rows": [ "libp2p", ["libp2p/js-libp2p", "libp2p", "master", "main.yml"], - ["libp2p/js-libp2p-interfaces", "@libp2p/interface-libp2p", "master", "js-test-and-release.yml"], + ["libp2p/js-libp2p-interfaces", "@libp2p/interface", "master", "js-test-and-release.yml"], "transports", ["libp2p/js-libp2p-tcp", "@libp2p/tcp", "master", "js-test-and-release.yml"], diff --git a/packages/libp2p/package.json b/packages/libp2p/package.json index 83cb7e33c7..2ceeebe910 100644 --- a/packages/libp2p/package.json +++ b/packages/libp2p/package.json @@ -95,7 +95,7 @@ "scripts": { "clean": "aegir clean", "lint": "aegir lint", - "dep-check": "aegir dep-check -i protons", + "dep-check": "aegir dep-check", "prepublishOnly": "node scripts/update-version.js && npm run build", "build": "aegir build", "generate": "run-s generate:proto:*", @@ -116,26 +116,8 @@ "dependencies": { "@achingbrain/nat-port-mapper": "^1.0.9", "@libp2p/crypto": "^1.0.0", - "@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.0.0", - "@libp2p/interface-keychain": "^2.0.0", - "@libp2p/interface-libp2p": "^3.0.0", - "@libp2p/interface-metrics": "^4.0.0", - "@libp2p/interface-peer-discovery": "^2.0.0", - "@libp2p/interface-peer-id": "^2.0.0", - "@libp2p/interface-peer-info": "^1.0.0", - "@libp2p/interface-peer-routing": "^1.0.0", - "@libp2p/interface-peer-store": "^2.0.0", - "@libp2p/interface-pubsub": "^4.0.0", - "@libp2p/interface-record": "^2.0.0", - "@libp2p/interface-registrar": "^2.0.0", - "@libp2p/interface-stream-muxer": "^4.0.0", - "@libp2p/interface-transport": "^4.0.0", - "@libp2p/interfaces": "^3.0.0", + "@libp2p/interface": "~0.0.1", + "@libp2p/interface-internal": "~0.0.1", "@libp2p/keychain": "^2.0.0", "@libp2p/logger": "^2.0.0", "@libp2p/multistream-select": "^3.0.0", @@ -144,8 +126,6 @@ "@libp2p/peer-id-factory": "^2.0.0", "@libp2p/peer-record": "^5.0.0", "@libp2p/peer-store": "^8.0.0", - "@libp2p/topology": "^4.0.0", - "@libp2p/tracked-map": "^3.0.0", "@libp2p/utils": "^3.0.0", "@multiformats/mafmt": "^12.1.2", "@multiformats/multiaddr": "^12.1.3", @@ -154,20 +134,20 @@ "datastore-core": "^9.0.1", "interface-datastore": "^8.2.0", "it-all": "^3.0.2", - "it-drain": "^3.0.1", + "it-drain": "^3.0.2", "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-map": "^3.0.3", "it-merge": "^3.0.0", - "it-pair": "^2.0.2", + "it-pair": "^2.0.6", "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.2", + "multiformats": "^12.0.1", "p-defer": "^4.0.0", "p-queue": "^7.3.4", "p-retry": "^5.0.0", @@ -175,7 +155,7 @@ "protons-runtime": "^5.0.0", "rate-limiter-flexible": "^2.3.11", "uint8arraylist": "^2.4.3", - "uint8arrays": "^4.0.3", + "uint8arrays": "^4.0.4", "wherearewe": "^2.0.1", "xsalsa20": "^1.1.0" }, @@ -188,20 +168,15 @@ "@libp2p/daemon-server": "^5.0.2", "@libp2p/floodsub": "^7.0.1", "@libp2p/interface-compliance-tests": "^3.0.0", - "@libp2p/interface-connection-compliance-tests": "^2.0.0", - "@libp2p/interface-connection-encrypter-compliance-tests": "^5.0.0", - "@libp2p/interface-mocks": "^12.0.0", "@libp2p/interop": "^8.0.0", "@libp2p/kad-dht": "^9.0.0", "@libp2p/mdns": "^8.0.0", "@libp2p/mplex": "^8.0.0", - "@libp2p/pubsub": "^7.0.1", "@libp2p/tcp": "^7.0.0", "@libp2p/websockets": "^6.0.0", "@types/varint": "^6.0.0", "@types/xsalsa20": "^1.1.0", "aegir": "^39.0.10", - "cborg": "^2.0.1", "delay": "^6.0.0", "execa": "^7.0.0", "go-libp2p": "^1.1.1", @@ -212,7 +187,7 @@ "p-times": "^4.0.0", "p-wait-for": "^5.0.0", "protons": "^7.0.2", - "sinon": "^15.1.0", + "sinon": "^15.1.2", "sinon-ts": "^1.0.0" }, "browser": { diff --git a/packages/libp2p/src/address-manager/index.ts b/packages/libp2p/src/address-manager/index.ts index 1573051d57..44a8504f51 100644 --- a/packages/libp2p/src/address-manager/index.ts +++ b/packages/libp2p/src/address-manager/index.ts @@ -2,11 +2,11 @@ import { logger } from '@libp2p/logger' import { peerIdFromString } from '@libp2p/peer-id' import { multiaddr } from '@multiformats/multiaddr' import { debounce } from './utils.js' -import type { Libp2pEvents } from '@libp2p/interface-libp2p' -import type { PeerId } from '@libp2p/interface-peer-id' -import type { PeerStore } from '@libp2p/interface-peer-store' -import type { TransportManager } from '@libp2p/interface-transport' -import type { EventEmitter } from '@libp2p/interfaces/events' +import type { Libp2pEvents } from '@libp2p/interface' +import type { EventEmitter } from '@libp2p/interface/events' +import type { PeerId } from '@libp2p/interface/peer-id' +import type { PeerStore } from '@libp2p/interface/peer-store' +import type { TransportManager } from '@libp2p/interface-internal/transport-manager' import type { Multiaddr } from '@multiformats/multiaddr' const log = logger('libp2p:address-manager') diff --git a/packages/libp2p/src/autonat/index.ts b/packages/libp2p/src/autonat/index.ts index 312f557807..f9d9e92f99 100644 --- a/packages/libp2p/src/autonat/index.ts +++ b/packages/libp2p/src/autonat/index.ts @@ -17,15 +17,15 @@ import { PROTOCOL_NAME, PROTOCOL_PREFIX, PROTOCOL_VERSION, REFRESH_INTERVAL, STARTUP_DELAY, TIMEOUT } from './constants.js' import { Message } from './pb/index.js' -import type { AddressManager } from '@libp2p/interface-address-manager' -import type { Connection } from '@libp2p/interface-connection' -import type { ConnectionManager } from '@libp2p/interface-connection-manager' -import type { PeerId } from '@libp2p/interface-peer-id' -import type { PeerInfo } from '@libp2p/interface-peer-info' -import type { PeerRouting } from '@libp2p/interface-peer-routing' -import type { IncomingStreamData, Registrar } from '@libp2p/interface-registrar' -import type { TransportManager } from '@libp2p/interface-transport' -import type { Startable } from '@libp2p/interfaces/startable' +import type { Connection } from '@libp2p/interface/connection' +import type { PeerId } from '@libp2p/interface/peer-id' +import type { PeerInfo } from '@libp2p/interface/peer-info' +import type { PeerRouting } from '@libp2p/interface/peer-routing' +import type { Startable } from '@libp2p/interface/startable' +import type { AddressManager } from '@libp2p/interface-internal/address-manager' +import type { ConnectionManager } from '@libp2p/interface-internal/connection-manager' +import type { IncomingStreamData, Registrar } from '@libp2p/interface-internal/registrar' +import type { TransportManager } from '@libp2p/interface-internal/transport-manager' const log = logger('libp2p:autonat') diff --git a/packages/libp2p/src/circuit-relay/index.ts b/packages/libp2p/src/circuit-relay/index.ts index 9bd5b0f547..3f39701534 100644 --- a/packages/libp2p/src/circuit-relay/index.ts +++ b/packages/libp2p/src/circuit-relay/index.ts @@ -1,5 +1,5 @@ import type { Limit } from './pb/index.js' -import type { EventEmitter } from '@libp2p/interfaces/events' +import type { EventEmitter } from '@libp2p/interface/events' import type { PeerMap } from '@libp2p/peer-collections' import type { Multiaddr } from '@multiformats/multiaddr' diff --git a/packages/libp2p/src/circuit-relay/server/advert-service.ts b/packages/libp2p/src/circuit-relay/server/advert-service.ts index fa15c215a6..5d2c61990f 100644 --- a/packages/libp2p/src/circuit-relay/server/advert-service.ts +++ b/packages/libp2p/src/circuit-relay/server/advert-service.ts @@ -1,4 +1,4 @@ -import { EventEmitter } from '@libp2p/interfaces/events' +import { EventEmitter } from '@libp2p/interface/events' import { logger } from '@libp2p/logger' import pRetry from 'p-retry' import { codes } from '../../errors.js' @@ -7,8 +7,8 @@ import { RELAY_RENDEZVOUS_NS } from '../constants.js' import { namespaceToCid } from '../utils.js' -import type { ContentRouting } from '@libp2p/interface-content-routing' -import type { Startable } from '@libp2p/interfaces/startable' +import type { ContentRouting } from '@libp2p/interface/content-routing' +import type { Startable } from '@libp2p/interface/startable' const log = logger('libp2p:circuit-relay:advert-service') diff --git a/packages/libp2p/src/circuit-relay/server/index.ts b/packages/libp2p/src/circuit-relay/server/index.ts index 401a74d1b9..7ff6f0f323 100644 --- a/packages/libp2p/src/circuit-relay/server/index.ts +++ b/packages/libp2p/src/circuit-relay/server/index.ts @@ -1,5 +1,5 @@ import { setMaxListeners } from 'events' -import { EventEmitter } from '@libp2p/interfaces/events' +import { EventEmitter } from '@libp2p/interface/events' import { logger } from '@libp2p/logger' import { peerIdFromBytes } from '@libp2p/peer-id' import { RecordEnvelope } from '@libp2p/peer-record' @@ -19,14 +19,14 @@ import { AdvertService, type AdvertServiceComponents, type AdvertServiceInit } f import { ReservationStore, type ReservationStoreInit } from './reservation-store.js' import { ReservationVoucherRecord } from './reservation-voucher.js' import type { CircuitRelayService, RelayReservation } from '../index.js' -import type { AddressManager } from '@libp2p/interface-address-manager' -import type { Connection, Stream } from '@libp2p/interface-connection' -import type { ConnectionGater } from '@libp2p/interface-connection-gater' -import type { ConnectionManager } from '@libp2p/interface-connection-manager' -import type { PeerId } from '@libp2p/interface-peer-id' -import type { PeerStore } from '@libp2p/interface-peer-store' -import type { IncomingStreamData, Registrar } from '@libp2p/interface-registrar' -import type { Startable } from '@libp2p/interfaces/startable' +import type { Connection, Stream } from '@libp2p/interface/connection' +import type { ConnectionGater } from '@libp2p/interface/connection-gater' +import type { PeerId } from '@libp2p/interface/peer-id' +import type { PeerStore } from '@libp2p/interface/peer-store' +import type { Startable } from '@libp2p/interface/startable' +import type { AddressManager } from '@libp2p/interface-internal/address-manager' +import type { ConnectionManager } from '@libp2p/interface-internal/connection-manager' +import type { IncomingStreamData, Registrar } from '@libp2p/interface-internal/registrar' import type { PeerMap } from '@libp2p/peer-collections' const log = logger('libp2p:circuit-relay:server') diff --git a/packages/libp2p/src/circuit-relay/server/reservation-store.ts b/packages/libp2p/src/circuit-relay/server/reservation-store.ts index 19f0b8724b..0f5d3bf62e 100644 --- a/packages/libp2p/src/circuit-relay/server/reservation-store.ts +++ b/packages/libp2p/src/circuit-relay/server/reservation-store.ts @@ -2,9 +2,9 @@ import { PeerMap } from '@libp2p/peer-collections' import { DEFAULT_DATA_LIMIT, DEFAULT_DURATION_LIMIT, DEFAULT_MAX_RESERVATION_CLEAR_INTERVAL, DEFAULT_MAX_RESERVATION_STORE_SIZE, DEFAULT_MAX_RESERVATION_TTL } from '../constants.js' import { type Limit, Status } from '../pb/index.js' import type { RelayReservation } from '../index.js' -import type { PeerId } from '@libp2p/interface-peer-id' -import type { RecursivePartial } from '@libp2p/interfaces' -import type { Startable } from '@libp2p/interfaces/startable' +import type { RecursivePartial } from '@libp2p/interface' +import type { PeerId } from '@libp2p/interface/peer-id' +import type { Startable } from '@libp2p/interface/startable' import type { Multiaddr } from '@multiformats/multiaddr' export type ReservationStatus = Status.OK | Status.PERMISSION_DENIED | Status.RESERVATION_REFUSED diff --git a/packages/libp2p/src/circuit-relay/server/reservation-voucher.ts b/packages/libp2p/src/circuit-relay/server/reservation-voucher.ts index 6f51fb95c4..d32d3f6104 100644 --- a/packages/libp2p/src/circuit-relay/server/reservation-voucher.ts +++ b/packages/libp2p/src/circuit-relay/server/reservation-voucher.ts @@ -1,6 +1,6 @@ import { ReservationVoucher } from '../pb/index.js' -import type { PeerId } from '@libp2p/interface-peer-id' -import type { Record } from '@libp2p/interface-record' +import type { PeerId } from '@libp2p/interface/peer-id' +import type { Record } from '@libp2p/interface/record' export interface ReservationVoucherOptions { relay: PeerId diff --git a/packages/libp2p/src/circuit-relay/transport/discovery.ts b/packages/libp2p/src/circuit-relay/transport/discovery.ts index ad2054dbcd..58ddc80cd9 100644 --- a/packages/libp2p/src/circuit-relay/transport/discovery.ts +++ b/packages/libp2p/src/circuit-relay/transport/discovery.ts @@ -1,18 +1,17 @@ -import { EventEmitter } from '@libp2p/interfaces/events' +import { EventEmitter } from '@libp2p/interface/events' import { logger } from '@libp2p/logger' -import { createTopology } from '@libp2p/topology' import { RELAY_RENDEZVOUS_NS, RELAY_V2_HOP_CODEC } from '../constants.js' import { namespaceToCid } from '../utils.js' -import type { ConnectionManager } from '@libp2p/interface-connection-manager' -import type { ContentRouting } from '@libp2p/interface-content-routing' -import type { PeerId } from '@libp2p/interface-peer-id' -import type { PeerStore } from '@libp2p/interface-peer-store' -import type { Registrar } from '@libp2p/interface-registrar' -import type { TransportManager } from '@libp2p/interface-transport' -import type { Startable } from '@libp2p/interfaces/startable' +import type { ContentRouting } from '@libp2p/interface/content-routing' +import type { PeerId } from '@libp2p/interface/peer-id' +import type { PeerStore } from '@libp2p/interface/peer-store' +import type { Startable } from '@libp2p/interface/startable' +import type { ConnectionManager } from '@libp2p/interface-internal/connection-manager' +import type { Registrar } from '@libp2p/interface-internal/registrar' +import type { TransportManager } from '@libp2p/interface-internal/transport-manager' const log = logger('libp2p:circuit-relay:discover-relays') @@ -57,11 +56,11 @@ export class RelayDiscovery extends EventEmitter implement async start (): Promise { // register a topology listener for when new peers are encountered // that support the hop protocol - this.topologyId = await this.registrar.register(RELAY_V2_HOP_CODEC, createTopology({ + this.topologyId = await this.registrar.register(RELAY_V2_HOP_CODEC, { onConnect: (peerId) => { this.safeDispatchEvent('relay:discover', { detail: peerId }) } - })) + }) void this.discover() .catch(err => { diff --git a/packages/libp2p/src/circuit-relay/transport/index.ts b/packages/libp2p/src/circuit-relay/transport/index.ts index 504e53dcec..56214be87c 100644 --- a/packages/libp2p/src/circuit-relay/transport/index.ts +++ b/packages/libp2p/src/circuit-relay/transport/index.ts @@ -1,5 +1,5 @@ -import { symbol, type Upgrader, type Listener, type Transport, type CreateListenerOptions } from '@libp2p/interface-transport' -import { CodeError } from '@libp2p/interfaces/errors' +import { CodeError } from '@libp2p/interface/errors' +import { symbol, type Transport, type CreateListenerOptions, type Listener, type Upgrader } from '@libp2p/interface/transport' import { logger } from '@libp2p/logger' import { peerIdFromBytes, peerIdFromString } from '@libp2p/peer-id' import { streamToMaConnection } from '@libp2p/utils/stream-to-ma-conn' @@ -13,17 +13,16 @@ import { StopMessage, HopMessage, Status } from '../pb/index.js' import { RelayDiscovery, type RelayDiscoveryComponents } from './discovery.js' import { createListener } from './listener.js' import { type RelayStoreInit, ReservationStore } from './reservation-store.js' -import type { AddressManager } from '@libp2p/interface-address-manager' -import type { Connection, Stream } from '@libp2p/interface-connection' -import type { ConnectionGater } from '@libp2p/interface-connection-gater' -import type { ConnectionManager } from '@libp2p/interface-connection-manager' -import type { ContentRouting } from '@libp2p/interface-content-routing' -import type { Libp2pEvents } from '@libp2p/interface-libp2p' -import type { PeerId } from '@libp2p/interface-peer-id' -import type { PeerStore } from '@libp2p/interface-peer-store' -import type { IncomingStreamData, Registrar } from '@libp2p/interface-registrar' -import type { AbortOptions } from '@libp2p/interfaces' -import type { EventEmitter } from '@libp2p/interfaces/events' +import type { Libp2pEvents, AbortOptions } from '@libp2p/interface' +import type { Connection, Stream } from '@libp2p/interface/connection' +import type { ConnectionGater } from '@libp2p/interface/connection-gater' +import type { ContentRouting } from '@libp2p/interface/content-routing' +import type { EventEmitter } from '@libp2p/interface/events' +import type { PeerId } from '@libp2p/interface/peer-id' +import type { PeerStore } from '@libp2p/interface/peer-store' +import type { AddressManager } from '@libp2p/interface-internal/address-manager' +import type { ConnectionManager } from '@libp2p/interface-internal/connection-manager' +import type { IncomingStreamData, Registrar } from '@libp2p/interface-internal/registrar' import type { Multiaddr } from '@multiformats/multiaddr' const log = logger('libp2p:circuit-relay:transport') diff --git a/packages/libp2p/src/circuit-relay/transport/listener.ts b/packages/libp2p/src/circuit-relay/transport/listener.ts index cbeec908ef..e0536c8ba5 100644 --- a/packages/libp2p/src/circuit-relay/transport/listener.ts +++ b/packages/libp2p/src/circuit-relay/transport/listener.ts @@ -1,14 +1,14 @@ -import { CodeError } from '@libp2p/interfaces/errors' -import { EventEmitter } from '@libp2p/interfaces/events' +import { CodeError } from '@libp2p/interface/errors' +import { EventEmitter } from '@libp2p/interface/events' import { logger } from '@libp2p/logger' import { PeerMap } from '@libp2p/peer-collections' import { peerIdFromString } from '@libp2p/peer-id' import { multiaddr } from '@multiformats/multiaddr' import type { ReservationStore } from './reservation-store.js' -import type { Connection } from '@libp2p/interface-connection' -import type { ConnectionManager } from '@libp2p/interface-connection-manager' -import type { PeerId } from '@libp2p/interface-peer-id' -import type { Listener, ListenerEvents } from '@libp2p/interface-transport' +import type { Connection } from '@libp2p/interface/connection' +import type { PeerId } from '@libp2p/interface/peer-id' +import type { Listener, ListenerEvents } from '@libp2p/interface/transport' +import type { ConnectionManager } from '@libp2p/interface-internal/connection-manager' import type { Multiaddr } from '@multiformats/multiaddr' const log = logger('libp2p:circuit-relay:transport:listener') diff --git a/packages/libp2p/src/circuit-relay/transport/reservation-store.ts b/packages/libp2p/src/circuit-relay/transport/reservation-store.ts index 9eab1c40f3..e6d34ae21b 100644 --- a/packages/libp2p/src/circuit-relay/transport/reservation-store.ts +++ b/packages/libp2p/src/circuit-relay/transport/reservation-store.ts @@ -1,4 +1,4 @@ -import { EventEmitter } from '@libp2p/interfaces/events' +import { EventEmitter } from '@libp2p/interface/events' import { logger } from '@libp2p/logger' import { PeerMap } from '@libp2p/peer-collections' import { multiaddr } from '@multiformats/multiaddr' @@ -8,13 +8,13 @@ import { DEFAULT_RESERVATION_CONCURRENCY, RELAY_TAG, RELAY_V2_HOP_CODEC } from ' import { HopMessage, Status } from '../pb/index.js' import { getExpirationMilliseconds } from '../utils.js' import type { Reservation } from '../pb/index.js' -import type { Connection } from '@libp2p/interface-connection' -import type { ConnectionManager } from '@libp2p/interface-connection-manager' -import type { Libp2pEvents } from '@libp2p/interface-libp2p' -import type { PeerId } from '@libp2p/interface-peer-id' -import type { PeerStore } from '@libp2p/interface-peer-store' -import type { TransportManager } from '@libp2p/interface-transport' -import type { Startable } from '@libp2p/interfaces/startable' +import type { Libp2pEvents } from '@libp2p/interface' +import type { Connection } from '@libp2p/interface/connection' +import type { PeerId } from '@libp2p/interface/peer-id' +import type { PeerStore } from '@libp2p/interface/peer-store' +import type { Startable } from '@libp2p/interface/startable' +import type { ConnectionManager } from '@libp2p/interface-internal/connection-manager' +import type { TransportManager } from '@libp2p/interface-internal/transport-manager' const log = logger('libp2p:circuit-relay:transport:reservation-store') diff --git a/packages/libp2p/src/circuit-relay/utils.ts b/packages/libp2p/src/circuit-relay/utils.ts index 6545680479..e37b020d71 100644 --- a/packages/libp2p/src/circuit-relay/utils.ts +++ b/packages/libp2p/src/circuit-relay/utils.ts @@ -5,7 +5,7 @@ import { CID } from 'multiformats/cid' import { sha256 } from 'multiformats/hashes/sha2' import { DEFAULT_DATA_LIMIT, DEFAULT_DURATION_LIMIT } from './constants.js' import type { Limit } from './pb/index.js' -import type { Stream } from '@libp2p/interface-connection' +import type { Stream } from '@libp2p/interface/connection' import type { Source } from 'it-stream-types' import type { Uint8ArrayList } from 'uint8arraylist' diff --git a/packages/libp2p/src/components.ts b/packages/libp2p/src/components.ts index 2927f30560..f11fb2cfb6 100644 --- a/packages/libp2p/src/components.ts +++ b/packages/libp2p/src/components.ts @@ -1,18 +1,19 @@ -import { CodeError } from '@libp2p/interfaces/errors' -import { isStartable, type Startable } from '@libp2p/interfaces/startable' -import type { AddressManager } from '@libp2p/interface-address-manager' -import type { ConnectionProtector } from '@libp2p/interface-connection' -import type { ConnectionGater } from '@libp2p/interface-connection-gater' -import type { ConnectionManager } from '@libp2p/interface-connection-manager' -import type { ContentRouting } from '@libp2p/interface-content-routing' -import type { Libp2pEvents } from '@libp2p/interface-libp2p' -import type { Metrics } from '@libp2p/interface-metrics' -import type { PeerId } from '@libp2p/interface-peer-id' -import type { PeerRouting } from '@libp2p/interface-peer-routing' -import type { PeerStore } from '@libp2p/interface-peer-store' -import type { Registrar } from '@libp2p/interface-registrar' -import type { TransportManager, Upgrader } from '@libp2p/interface-transport' -import type { EventEmitter } from '@libp2p/interfaces/events' +import { CodeError } from '@libp2p/interface/errors' +import { isStartable, type Startable } from '@libp2p/interface/startable' +import type { Libp2pEvents } from '@libp2p/interface' +import type { ConnectionProtector } from '@libp2p/interface/connection' +import type { ConnectionGater } from '@libp2p/interface/connection-gater' +import type { ContentRouting } from '@libp2p/interface/content-routing' +import type { EventEmitter } from '@libp2p/interface/events' +import type { Metrics } from '@libp2p/interface/metrics' +import type { PeerId } from '@libp2p/interface/peer-id' +import type { PeerRouting } from '@libp2p/interface/peer-routing' +import type { PeerStore } from '@libp2p/interface/peer-store' +import type { Upgrader } from '@libp2p/interface/transport' +import type { AddressManager } from '@libp2p/interface-internal/address-manager' +import type { ConnectionManager } from '@libp2p/interface-internal/connection-manager' +import type { Registrar } from '@libp2p/interface-internal/registrar' +import type { TransportManager } from '@libp2p/interface-internal/transport-manager' import type { Datastore } from 'interface-datastore' export interface Components extends Record, Startable { diff --git a/packages/libp2p/src/config.ts b/packages/libp2p/src/config.ts index 20e8176b5f..fd4d3f8f63 100644 --- a/packages/libp2p/src/config.ts +++ b/packages/libp2p/src/config.ts @@ -1,12 +1,11 @@ -import { FaultTolerance } from '@libp2p/interface-transport' -import { CodeError } from '@libp2p/interfaces/errors' +import { CodeError } from '@libp2p/interface/errors' +import { FaultTolerance } from '@libp2p/interface/transport' import { publicAddressesFirst } from '@libp2p/utils/address-sort' import { dnsaddrResolver } from '@multiformats/multiaddr/resolvers' import mergeOptions from 'merge-options' import { codes, messages } from './errors.js' import type { Libp2pInit } from './index.js' -import type { ServiceMap } from '@libp2p/interface-libp2p' -import type { RecursivePartial } from '@libp2p/interfaces' +import type { ServiceMap, RecursivePartial } from '@libp2p/interface' import type { Multiaddr } from '@multiformats/multiaddr' const DefaultConfig: Partial = { diff --git a/packages/libp2p/src/config/connection-gater.browser.ts b/packages/libp2p/src/config/connection-gater.browser.ts index dbaf319df7..c03a153698 100644 --- a/packages/libp2p/src/config/connection-gater.browser.ts +++ b/packages/libp2p/src/config/connection-gater.browser.ts @@ -1,5 +1,5 @@ import isPrivate from 'private-ip' -import type { ConnectionGater } from '@libp2p/interface-connection-gater' +import type { ConnectionGater } from '@libp2p/interface/connection-gater' import type { Multiaddr } from '@multiformats/multiaddr' /** diff --git a/packages/libp2p/src/config/connection-gater.ts b/packages/libp2p/src/config/connection-gater.ts index 2f872a2ee6..40f1827ae7 100644 --- a/packages/libp2p/src/config/connection-gater.ts +++ b/packages/libp2p/src/config/connection-gater.ts @@ -1,4 +1,4 @@ -import type { ConnectionGater } from '@libp2p/interface-connection-gater' +import type { ConnectionGater } from '@libp2p/interface/connection-gater' /** * Returns a default connection gater implementation that allows everything diff --git a/packages/libp2p/src/connection-manager/auto-dial.ts b/packages/libp2p/src/connection-manager/auto-dial.ts index 3f0e60a460..a9a87ed408 100644 --- a/packages/libp2p/src/connection-manager/auto-dial.ts +++ b/packages/libp2p/src/connection-manager/auto-dial.ts @@ -2,11 +2,11 @@ import { logger } from '@libp2p/logger' import { PeerMap, PeerSet } from '@libp2p/peer-collections' import { PeerJobQueue } from '../utils/peer-job-queue.js' import { AUTO_DIAL_CONCURRENCY, AUTO_DIAL_INTERVAL, AUTO_DIAL_MAX_QUEUE_LENGTH, AUTO_DIAL_PRIORITY, MIN_CONNECTIONS } from './constants.js' -import type { ConnectionManager } from '@libp2p/interface-connection-manager' -import type { Libp2pEvents } from '@libp2p/interface-libp2p' -import type { PeerStore } from '@libp2p/interface-peer-store' -import type { EventEmitter } from '@libp2p/interfaces/events' -import type { Startable } from '@libp2p/interfaces/startable' +import type { Libp2pEvents } from '@libp2p/interface' +import type { EventEmitter } from '@libp2p/interface/events' +import type { PeerStore } from '@libp2p/interface/peer-store' +import type { Startable } from '@libp2p/interface/startable' +import type { ConnectionManager } from '@libp2p/interface-internal/connection-manager' const log = logger('libp2p:connection-manager:auto-dial') diff --git a/packages/libp2p/src/connection-manager/connection-pruner.ts b/packages/libp2p/src/connection-manager/connection-pruner.ts index 818a19ecb1..de0c5f0603 100644 --- a/packages/libp2p/src/connection-manager/connection-pruner.ts +++ b/packages/libp2p/src/connection-manager/connection-pruner.ts @@ -1,10 +1,10 @@ import { logger } from '@libp2p/logger' import { PeerMap } from '@libp2p/peer-collections' import { MAX_CONNECTIONS } from './constants.js' -import type { ConnectionManager } from '@libp2p/interface-connection-manager' -import type { Libp2pEvents } from '@libp2p/interface-libp2p' -import type { PeerStore } from '@libp2p/interface-peer-store' -import type { EventEmitter } from '@libp2p/interfaces/events' +import type { Libp2pEvents } from '@libp2p/interface' +import type { EventEmitter } from '@libp2p/interface/events' +import type { PeerStore } from '@libp2p/interface/peer-store' +import type { ConnectionManager } from '@libp2p/interface-internal/connection-manager' import type { Multiaddr } from '@multiformats/multiaddr' const log = logger('libp2p:connection-manager:connection-pruner') diff --git a/packages/libp2p/src/connection-manager/dial-queue.ts b/packages/libp2p/src/connection-manager/dial-queue.ts index 3bbd6c73fc..02b8664784 100644 --- a/packages/libp2p/src/connection-manager/dial-queue.ts +++ b/packages/libp2p/src/connection-manager/dial-queue.ts @@ -1,5 +1,5 @@ import { setMaxListeners } from 'events' -import { AbortError, CodeError } from '@libp2p/interfaces/errors' +import { AbortError, CodeError } from '@libp2p/interface/errors' import { logger } from '@libp2p/logger' import { publicAddressesFirst } from '@libp2p/utils/address-sort' import { type Multiaddr, type Resolver, resolvers } from '@multiformats/multiaddr' @@ -16,14 +16,13 @@ import { MAX_PEER_ADDRS_TO_DIAL } from './constants.js' import { combineSignals, resolveMultiaddrs } from './utils.js' -import type { Connection } from '@libp2p/interface-connection' -import type { ConnectionGater } from '@libp2p/interface-connection-gater' -import type { AddressSorter } from '@libp2p/interface-libp2p' -import type { Metric, Metrics } from '@libp2p/interface-metrics' -import type { PeerId } from '@libp2p/interface-peer-id' -import type { Address, PeerStore } from '@libp2p/interface-peer-store' -import type { TransportManager } from '@libp2p/interface-transport' -import type { AbortOptions } from '@libp2p/interfaces' +import type { AddressSorter, AbortOptions } from '@libp2p/interface' +import type { Connection } from '@libp2p/interface/connection' +import type { ConnectionGater } from '@libp2p/interface/connection-gater' +import type { Metric, Metrics } from '@libp2p/interface/metrics' +import type { PeerId } from '@libp2p/interface/peer-id' +import type { Address, PeerStore } from '@libp2p/interface/peer-store' +import type { TransportManager } from '@libp2p/interface-internal/transport-manager' const log = logger('libp2p:connection-manager:dial-queue') diff --git a/packages/libp2p/src/connection-manager/index.ts b/packages/libp2p/src/connection-manager/index.ts index 31b104bfef..b0b83268e3 100644 --- a/packages/libp2p/src/connection-manager/index.ts +++ b/packages/libp2p/src/connection-manager/index.ts @@ -1,5 +1,5 @@ -import { KEEP_ALIVE } from '@libp2p/interface-peer-store/tags' -import { CodeError } from '@libp2p/interfaces/errors' +import { CodeError } from '@libp2p/interface/errors' +import { KEEP_ALIVE } from '@libp2p/interface/peer-store/tags' import { logger } from '@libp2p/logger' import { PeerMap } from '@libp2p/peer-collections' import { publicAddressesFirst } from '@libp2p/utils/address-sort' @@ -12,17 +12,16 @@ import { AutoDial } from './auto-dial.js' import { ConnectionPruner } from './connection-pruner.js' import { AUTO_DIAL_CONCURRENCY, AUTO_DIAL_MAX_QUEUE_LENGTH, AUTO_DIAL_PRIORITY, DIAL_TIMEOUT, INBOUND_CONNECTION_THRESHOLD, MAX_CONNECTIONS, MAX_INCOMING_PENDING_CONNECTIONS, MAX_PARALLEL_DIALS, MAX_PEER_ADDRS_TO_DIAL, MIN_CONNECTIONS } from './constants.js' import { DialQueue } from './dial-queue.js' -import type { Connection, MultiaddrConnection } from '@libp2p/interface-connection' -import type { ConnectionGater } from '@libp2p/interface-connection-gater' -import type { ConnectionManager } from '@libp2p/interface-connection-manager' -import type { PendingDial, AddressSorter, Libp2pEvents } from '@libp2p/interface-libp2p' -import type { Metrics } from '@libp2p/interface-metrics' -import type { PeerId } from '@libp2p/interface-peer-id' -import type { Peer, PeerStore } from '@libp2p/interface-peer-store' -import type { TransportManager } from '@libp2p/interface-transport' -import type { AbortOptions } from '@libp2p/interfaces' -import type { EventEmitter } from '@libp2p/interfaces/events' -import type { Startable } from '@libp2p/interfaces/startable' +import type { PendingDial, AddressSorter, Libp2pEvents, AbortOptions } from '@libp2p/interface' +import type { Connection, MultiaddrConnection } from '@libp2p/interface/connection' +import type { ConnectionGater } from '@libp2p/interface/connection-gater' +import type { EventEmitter } from '@libp2p/interface/events' +import type { Metrics } from '@libp2p/interface/metrics' +import type { PeerId } from '@libp2p/interface/peer-id' +import type { Peer, PeerStore } from '@libp2p/interface/peer-store' +import type { Startable } from '@libp2p/interface/startable' +import type { ConnectionManager } from '@libp2p/interface-internal/connection-manager' +import type { TransportManager } from '@libp2p/interface-internal/transport-manager' const log = logger('libp2p:connection-manager') diff --git a/packages/libp2p/src/connection/index.ts b/packages/libp2p/src/connection/index.ts index 6bc7426e72..a26fc2f545 100644 --- a/packages/libp2p/src/connection/index.ts +++ b/packages/libp2p/src/connection/index.ts @@ -1,10 +1,10 @@ -import { symbol } from '@libp2p/interface-connection' -import { OPEN, CLOSING, CLOSED } from '@libp2p/interface-connection/status' -import { CodeError } from '@libp2p/interfaces/errors' +import { symbol } from '@libp2p/interface/connection' +import { OPEN, CLOSING, CLOSED } from '@libp2p/interface/connection/status' +import { CodeError } from '@libp2p/interface/errors' import { logger } from '@libp2p/logger' -import type { Connection, ConnectionStat, Stream } from '@libp2p/interface-connection' -import type { PeerId } from '@libp2p/interface-peer-id' -import type { AbortOptions } from '@libp2p/interfaces' +import type { AbortOptions } from '@libp2p/interface' +import type { Connection, ConnectionStat, Stream } from '@libp2p/interface/connection' +import type { PeerId } from '@libp2p/interface/peer-id' import type { Multiaddr } from '@multiformats/multiaddr' const log = logger('libp2p:connection') diff --git a/packages/libp2p/src/content-routing/index.ts b/packages/libp2p/src/content-routing/index.ts index b690a62502..f8a17a3cdd 100644 --- a/packages/libp2p/src/content-routing/index.ts +++ b/packages/libp2p/src/content-routing/index.ts @@ -1,4 +1,4 @@ -import { CodeError } from '@libp2p/interfaces/errors' +import { CodeError } from '@libp2p/interface/errors' import merge from 'it-merge' import { pipe } from 'it-pipe' import { messages, codes } from '../errors.js' @@ -7,11 +7,11 @@ import { uniquePeers, requirePeers } from './utils.js' -import type { ContentRouting } from '@libp2p/interface-content-routing' -import type { PeerInfo } from '@libp2p/interface-peer-info' -import type { PeerStore } from '@libp2p/interface-peer-store' -import type { AbortOptions } from '@libp2p/interfaces' -import type { Startable } from '@libp2p/interfaces/startable' +import type { AbortOptions } from '@libp2p/interface' +import type { ContentRouting } from '@libp2p/interface/content-routing' +import type { PeerInfo } from '@libp2p/interface/peer-info' +import type { PeerStore } from '@libp2p/interface/peer-store' +import type { Startable } from '@libp2p/interface/startable' import type { CID } from 'multiformats/cid' export interface CompoundContentRoutingInit { diff --git a/packages/libp2p/src/content-routing/utils.ts b/packages/libp2p/src/content-routing/utils.ts index f62c91baa3..f114639c41 100644 --- a/packages/libp2p/src/content-routing/utils.ts +++ b/packages/libp2p/src/content-routing/utils.ts @@ -1,8 +1,8 @@ -import { CodeError } from '@libp2p/interfaces/errors' +import { CodeError } from '@libp2p/interface/errors' import filter from 'it-filter' import map from 'it-map' -import type { PeerInfo } from '@libp2p/interface-peer-info' -import type { PeerStore } from '@libp2p/interface-peer-store' +import type { PeerInfo } from '@libp2p/interface/peer-info' +import type { PeerStore } from '@libp2p/interface/peer-store' import type { Source } from 'it-stream-types' /** diff --git a/packages/libp2p/src/fetch/index.ts b/packages/libp2p/src/fetch/index.ts index f8c4e11a26..8084fadc82 100644 --- a/packages/libp2p/src/fetch/index.ts +++ b/packages/libp2p/src/fetch/index.ts @@ -1,5 +1,5 @@ import { setMaxListeners } from 'events' -import { CodeError } from '@libp2p/interfaces/errors' +import { CodeError } from '@libp2p/interface/errors' import { logger } from '@libp2p/logger' import { abortableDuplex } from 'abortable-iterator' import first from 'it-first' @@ -10,12 +10,12 @@ import { toString as uint8arrayToString } from 'uint8arrays/to-string' import { codes } from '../errors.js' import { PROTOCOL_NAME, PROTOCOL_VERSION } from './constants.js' import { FetchRequest, FetchResponse } from './pb/proto.js' -import type { Stream } from '@libp2p/interface-connection' -import type { ConnectionManager } from '@libp2p/interface-connection-manager' -import type { PeerId } from '@libp2p/interface-peer-id' -import type { IncomingStreamData, Registrar } from '@libp2p/interface-registrar' -import type { AbortOptions } from '@libp2p/interfaces' -import type { Startable } from '@libp2p/interfaces/startable' +import type { AbortOptions } from '@libp2p/interface' +import type { Stream } from '@libp2p/interface/connection' +import type { PeerId } from '@libp2p/interface/peer-id' +import type { Startable } from '@libp2p/interface/startable' +import type { ConnectionManager } from '@libp2p/interface-internal/connection-manager' +import type { IncomingStreamData, Registrar } from '@libp2p/interface-internal/registrar' const log = logger('libp2p:fetch') diff --git a/packages/libp2p/src/get-peer.ts b/packages/libp2p/src/get-peer.ts index 653edc1f34..0d218bd62a 100644 --- a/packages/libp2p/src/get-peer.ts +++ b/packages/libp2p/src/get-peer.ts @@ -1,10 +1,10 @@ -import { isPeerId } from '@libp2p/interface-peer-id' -import { CodeError } from '@libp2p/interfaces/errors' +import { CodeError } from '@libp2p/interface/errors' +import { isPeerId } from '@libp2p/interface/peer-id' import { logger } from '@libp2p/logger' import { peerIdFromString } from '@libp2p/peer-id' import { isMultiaddr } from '@multiformats/multiaddr' import { codes } from './errors.js' -import type { PeerId } from '@libp2p/interface-peer-id' +import type { PeerId } from '@libp2p/interface/peer-id' import type { Multiaddr } from '@multiformats/multiaddr' const log = logger('libp2p:get-peer') diff --git a/packages/libp2p/src/identify/identify.ts b/packages/libp2p/src/identify/identify.ts index ea8e70a890..96ada591a8 100644 --- a/packages/libp2p/src/identify/identify.ts +++ b/packages/libp2p/src/identify/identify.ts @@ -1,5 +1,5 @@ import { setMaxListeners } from 'events' -import { CodeError } from '@libp2p/interfaces/errors' +import { CodeError } from '@libp2p/interface/errors' import { logger } from '@libp2p/logger' import { peerIdFromKeys } from '@libp2p/peer-id' import { RecordEnvelope, PeerRecord } from '@libp2p/peer-record' @@ -24,16 +24,15 @@ import { } from './consts.js' import { Identify } from './pb/message.js' import type { IdentifyServiceComponents, IdentifyServiceInit } from './index.js' -import type { AddressManager } from '@libp2p/interface-address-manager' -import type { Connection, Stream } from '@libp2p/interface-connection' -import type { ConnectionManager } from '@libp2p/interface-connection-manager' -import type { Libp2pEvents, IdentifyResult, SignedPeerRecord } from '@libp2p/interface-libp2p' -import type { PeerId } from '@libp2p/interface-peer-id' -import type { Peer, PeerStore } from '@libp2p/interface-peer-store' -import type { IncomingStreamData, Registrar } from '@libp2p/interface-registrar' -import type { AbortOptions } from '@libp2p/interfaces' -import type { EventEmitter } from '@libp2p/interfaces/events' -import type { Startable } from '@libp2p/interfaces/startable' +import type { Libp2pEvents, IdentifyResult, SignedPeerRecord, AbortOptions } from '@libp2p/interface' +import type { Connection, Stream } from '@libp2p/interface/connection' +import type { EventEmitter } from '@libp2p/interface/events' +import type { PeerId } from '@libp2p/interface/peer-id' +import type { Peer, PeerStore } from '@libp2p/interface/peer-store' +import type { Startable } from '@libp2p/interface/startable' +import type { AddressManager } from '@libp2p/interface-internal/address-manager' +import type { ConnectionManager } from '@libp2p/interface-internal/connection-manager' +import type { IncomingStreamData, Registrar } from '@libp2p/interface-internal/registrar' const log = logger('libp2p:identify') diff --git a/packages/libp2p/src/identify/index.ts b/packages/libp2p/src/identify/index.ts index 5f2403921b..dad6f8804e 100644 --- a/packages/libp2p/src/identify/index.ts +++ b/packages/libp2p/src/identify/index.ts @@ -4,13 +4,13 @@ import { } from './consts.js' import { DefaultIdentifyService } from './identify.js' import { Identify } from './pb/message.js' -import type { AddressManager } from '@libp2p/interface-address-manager' -import type { ConnectionManager } from '@libp2p/interface-connection-manager' -import type { Libp2pEvents } from '@libp2p/interface-libp2p' -import type { PeerId } from '@libp2p/interface-peer-id' -import type { PeerStore } from '@libp2p/interface-peer-store' -import type { Registrar } from '@libp2p/interface-registrar' -import type { EventEmitter } from '@libp2p/interfaces/events' +import type { Libp2pEvents } from '@libp2p/interface' +import type { EventEmitter } from '@libp2p/interface/events' +import type { PeerId } from '@libp2p/interface/peer-id' +import type { PeerStore } from '@libp2p/interface/peer-store' +import type { AddressManager } from '@libp2p/interface-internal/address-manager' +import type { ConnectionManager } from '@libp2p/interface-internal/connection-manager' +import type { Registrar } from '@libp2p/interface-internal/registrar' export interface IdentifyServiceInit { /** diff --git a/packages/libp2p/src/index.ts b/packages/libp2p/src/index.ts index 318853f71c..6a5cda3192 100644 --- a/packages/libp2p/src/index.ts +++ b/packages/libp2p/src/index.ts @@ -19,18 +19,17 @@ import type { AddressManagerInit } from './address-manager/index.js' import type { Components } from './components.js' import type { ConnectionManagerInit } from './connection-manager/index.js' import type { TransportManagerInit } from './transport-manager.js' -import type { ConnectionProtector } from '@libp2p/interface-connection' -import type { ConnectionEncrypter } from '@libp2p/interface-connection-encrypter' -import type { ConnectionGater } from '@libp2p/interface-connection-gater' -import type { ContentRouting } from '@libp2p/interface-content-routing' -import type { Libp2p, ServiceMap } from '@libp2p/interface-libp2p' -import type { Metrics } from '@libp2p/interface-metrics' -import type { PeerDiscovery } from '@libp2p/interface-peer-discovery' -import type { PeerId } from '@libp2p/interface-peer-id' -import type { PeerRouting } from '@libp2p/interface-peer-routing' -import type { StreamMuxerFactory } from '@libp2p/interface-stream-muxer' -import type { Transport } from '@libp2p/interface-transport' -import type { RecursivePartial } from '@libp2p/interfaces' +import type { Libp2p, ServiceMap, RecursivePartial } from '@libp2p/interface' +import type { ConnectionProtector } from '@libp2p/interface/connection' +import type { ConnectionEncrypter } from '@libp2p/interface/connection-encrypter' +import type { ConnectionGater } from '@libp2p/interface/connection-gater' +import type { ContentRouting } from '@libp2p/interface/content-routing' +import type { Metrics } from '@libp2p/interface/metrics' +import type { PeerDiscovery } from '@libp2p/interface/peer-discovery' +import type { PeerId } from '@libp2p/interface/peer-id' +import type { PeerRouting } from '@libp2p/interface/peer-routing' +import type { StreamMuxerFactory } from '@libp2p/interface/stream-muxer' +import type { Transport } from '@libp2p/interface/transport' import type { KeyChainInit } from '@libp2p/keychain' import type { PersistentPeerStoreInit } from '@libp2p/peer-store' import type { Datastore } from 'interface-datastore' diff --git a/packages/libp2p/src/insecure/index.ts b/packages/libp2p/src/insecure/index.ts index 7ae7aca845..0a0af59cd6 100644 --- a/packages/libp2p/src/insecure/index.ts +++ b/packages/libp2p/src/insecure/index.ts @@ -22,15 +22,15 @@ * ``` */ -import { UnexpectedPeerError, InvalidCryptoExchangeError } from '@libp2p/interface-connection-encrypter/errors' +import { UnexpectedPeerError, InvalidCryptoExchangeError } from '@libp2p/interface/errors' import { logger } from '@libp2p/logger' import { peerIdFromBytes, peerIdFromKeys } from '@libp2p/peer-id' import { handshake } from 'it-handshake' import * as lp from 'it-length-prefixed' import map from 'it-map' import { Exchange, KeyType } from './pb/proto.js' -import type { ConnectionEncrypter, SecuredConnection } from '@libp2p/interface-connection-encrypter' -import type { PeerId } from '@libp2p/interface-peer-id' +import type { ConnectionEncrypter, SecuredConnection } from '@libp2p/interface/connection-encrypter' +import type { PeerId } from '@libp2p/interface/peer-id' import type { Duplex, Source } from 'it-stream-types' import type { Uint8ArrayList } from 'uint8arraylist' diff --git a/packages/libp2p/src/libp2p.ts b/packages/libp2p/src/libp2p.ts index 130c3a2f82..79fa645b79 100644 --- a/packages/libp2p/src/libp2p.ts +++ b/packages/libp2p/src/libp2p.ts @@ -1,10 +1,10 @@ import { setMaxListeners } from 'events' import { unmarshalPublicKey } from '@libp2p/crypto/keys' -import { type ContentRouting, contentRouting } from '@libp2p/interface-content-routing' -import { peerDiscovery } from '@libp2p/interface-peer-discovery' -import { type PeerRouting, peerRouting } from '@libp2p/interface-peer-routing' -import { CodeError } from '@libp2p/interfaces/errors' -import { EventEmitter, CustomEvent } from '@libp2p/interfaces/events' +import { type ContentRouting, contentRouting } from '@libp2p/interface/content-routing' +import { CodeError } from '@libp2p/interface/errors' +import { EventEmitter, CustomEvent } from '@libp2p/interface/events' +import { peerDiscovery } from '@libp2p/interface/peer-discovery' +import { type PeerRouting, peerRouting } from '@libp2p/interface/peer-routing' import { DefaultKeyChain } from '@libp2p/keychain' import { logger } from '@libp2p/logger' import { PeerSet } from '@libp2p/peer-collections' @@ -29,15 +29,15 @@ import { DefaultTransportManager } from './transport-manager.js' import { DefaultUpgrader } from './upgrader.js' import type { Components } from './components.js' import type { Libp2p, Libp2pInit, Libp2pOptions } from './index.js' -import type { Connection, Stream } from '@libp2p/interface-connection' -import type { KeyChain } from '@libp2p/interface-keychain' -import type { Libp2pEvents, PendingDial, ServiceMap } from '@libp2p/interface-libp2p' -import type { Metrics } from '@libp2p/interface-metrics' -import type { PeerId } from '@libp2p/interface-peer-id' -import type { PeerInfo } from '@libp2p/interface-peer-info' -import type { PeerStore } from '@libp2p/interface-peer-store' -import type { StreamHandler, StreamHandlerOptions, Topology } from '@libp2p/interface-registrar' -import type { AbortOptions } from '@libp2p/interfaces' +import type { Libp2pEvents, PendingDial, ServiceMap, AbortOptions } from '@libp2p/interface' +import type { Connection, Stream } from '@libp2p/interface/connection' +import type { KeyChain } from '@libp2p/interface/keychain' +import type { Metrics } from '@libp2p/interface/metrics' +import type { PeerId } from '@libp2p/interface/peer-id' +import type { PeerInfo } from '@libp2p/interface/peer-info' +import type { PeerStore } from '@libp2p/interface/peer-store' +import type { Topology } from '@libp2p/interface/topology' +import type { StreamHandler, StreamHandlerOptions } from '@libp2p/interface-internal/registrar' import type { Datastore } from 'interface-datastore' const log = logger('libp2p') diff --git a/packages/libp2p/src/peer-routing.ts b/packages/libp2p/src/peer-routing.ts index 2747871adc..59a2f8a35b 100644 --- a/packages/libp2p/src/peer-routing.ts +++ b/packages/libp2p/src/peer-routing.ts @@ -1,4 +1,4 @@ -import { CodeError } from '@libp2p/interfaces/errors' +import { CodeError } from '@libp2p/interface/errors' import { logger } from '@libp2p/logger' import filter from 'it-filter' import first from 'it-first' @@ -10,11 +10,11 @@ import { requirePeers } from './content-routing/utils.js' import { codes, messages } from './errors.js' -import type { PeerId } from '@libp2p/interface-peer-id' -import type { PeerInfo } from '@libp2p/interface-peer-info' -import type { PeerRouting } from '@libp2p/interface-peer-routing' -import type { PeerStore } from '@libp2p/interface-peer-store' -import type { AbortOptions } from '@libp2p/interfaces' +import type { AbortOptions } from '@libp2p/interface' +import type { PeerId } from '@libp2p/interface/peer-id' +import type { PeerInfo } from '@libp2p/interface/peer-info' +import type { PeerRouting } from '@libp2p/interface/peer-routing' +import type { PeerStore } from '@libp2p/interface/peer-store' const log = logger('libp2p:peer-routing') diff --git a/packages/libp2p/src/ping/index.ts b/packages/libp2p/src/ping/index.ts index be7bd83a22..3903f9f0ae 100644 --- a/packages/libp2p/src/ping/index.ts +++ b/packages/libp2p/src/ping/index.ts @@ -1,6 +1,6 @@ import { setMaxListeners } from 'events' import { randomBytes } from '@libp2p/crypto' -import { CodeError } from '@libp2p/interfaces/errors' +import { CodeError } from '@libp2p/interface/errors' import { logger } from '@libp2p/logger' import { abortableDuplex } from 'abortable-iterator' import { anySignal } from 'any-signal' @@ -9,12 +9,12 @@ import { pipe } from 'it-pipe' import { equals as uint8ArrayEquals } from 'uint8arrays/equals' import { codes } from '../errors.js' import { PROTOCOL_PREFIX, PROTOCOL_NAME, PING_LENGTH, PROTOCOL_VERSION, TIMEOUT, MAX_INBOUND_STREAMS, MAX_OUTBOUND_STREAMS } from './constants.js' -import type { Stream } from '@libp2p/interface-connection' -import type { ConnectionManager } from '@libp2p/interface-connection-manager' -import type { PeerId } from '@libp2p/interface-peer-id' -import type { IncomingStreamData, Registrar } from '@libp2p/interface-registrar' -import type { AbortOptions } from '@libp2p/interfaces' -import type { Startable } from '@libp2p/interfaces/startable' +import type { AbortOptions } from '@libp2p/interface' +import type { Stream } from '@libp2p/interface/connection' +import type { PeerId } from '@libp2p/interface/peer-id' +import type { Startable } from '@libp2p/interface/startable' +import type { ConnectionManager } from '@libp2p/interface-internal/connection-manager' +import type { IncomingStreamData, Registrar } from '@libp2p/interface-internal/registrar' import type { Multiaddr } from '@multiformats/multiaddr' const log = logger('libp2p:ping') diff --git a/packages/libp2p/src/pnet/index.ts b/packages/libp2p/src/pnet/index.ts index 213785551b..3433710512 100644 --- a/packages/libp2p/src/pnet/index.ts +++ b/packages/libp2p/src/pnet/index.ts @@ -23,7 +23,7 @@ */ import { randomBytes } from '@libp2p/crypto' -import { CodeError } from '@libp2p/interfaces/errors' +import { CodeError } from '@libp2p/interface/errors' import { logger } from '@libp2p/logger' import { handshake } from 'it-handshake' import map from 'it-map' @@ -37,7 +37,7 @@ import { } from './crypto.js' import * as Errors from './errors.js' import { NONCE_LENGTH } from './key-generator.js' -import type { ConnectionProtector, MultiaddrConnection } from '@libp2p/interface-connection' +import type { ConnectionProtector, MultiaddrConnection } from '@libp2p/interface/connection' const log = logger('libp2p:pnet') diff --git a/packages/libp2p/src/pubsub/dummy-pubsub.ts b/packages/libp2p/src/pubsub/dummy-pubsub.ts deleted file mode 100644 index e45878687b..0000000000 --- a/packages/libp2p/src/pubsub/dummy-pubsub.ts +++ /dev/null @@ -1,53 +0,0 @@ -import { CodeError } from '@libp2p/interfaces/errors' -import { EventEmitter } from '@libp2p/interfaces/events' -import { messages, codes } from '../errors.js' -import type { PeerId } from '@libp2p/interface-peer-id' -import type { PublishResult, PubSub, PubSubEvents, StrictNoSign, StrictSign, TopicValidatorFn } from '@libp2p/interface-pubsub' - -export class DummyPubSub extends EventEmitter implements PubSub { - public topicValidators = new Map() - - isStarted (): boolean { - return false - } - - start (): void | Promise { - - } - - stop (): void | Promise { - - } - - get globalSignaturePolicy (): typeof StrictSign | typeof StrictNoSign { - throw new CodeError(messages.PUBSUB_DISABLED, codes.ERR_PUBSUB_DISABLED) - } - - get multicodecs (): string[] { - throw new CodeError(messages.PUBSUB_DISABLED, codes.ERR_PUBSUB_DISABLED) - } - - getPeers (): PeerId[] { - throw new CodeError(messages.PUBSUB_DISABLED, codes.ERR_PUBSUB_DISABLED) - } - - getTopics (): string[] { - throw new CodeError(messages.PUBSUB_DISABLED, codes.ERR_PUBSUB_DISABLED) - } - - subscribe (): void { - throw new CodeError(messages.PUBSUB_DISABLED, codes.ERR_PUBSUB_DISABLED) - } - - unsubscribe (): void { - throw new CodeError(messages.PUBSUB_DISABLED, codes.ERR_PUBSUB_DISABLED) - } - - getSubscribers (): PeerId[] { - throw new CodeError(messages.PUBSUB_DISABLED, codes.ERR_PUBSUB_DISABLED) - } - - async publish (): Promise { - throw new CodeError(messages.PUBSUB_DISABLED, codes.ERR_PUBSUB_DISABLED) - } -} diff --git a/packages/libp2p/src/registrar.ts b/packages/libp2p/src/registrar.ts index 3b9d286f2b..f42ac0afeb 100644 --- a/packages/libp2p/src/registrar.ts +++ b/packages/libp2p/src/registrar.ts @@ -1,13 +1,14 @@ -import { isTopology, type StreamHandlerOptions, type StreamHandlerRecord, type Registrar, type StreamHandler, type Topology } from '@libp2p/interface-registrar' -import { CodeError } from '@libp2p/interfaces/errors' +import { CodeError } from '@libp2p/interface/errors' import { logger } from '@libp2p/logger' import merge from 'merge-options' import { codes } from './errors.js' -import type { ConnectionManager } from '@libp2p/interface-connection-manager' -import type { Libp2pEvents, PeerUpdate } from '@libp2p/interface-libp2p' -import type { PeerId } from '@libp2p/interface-peer-id' -import type { PeerStore } from '@libp2p/interface-peer-store' -import type { EventEmitter } from '@libp2p/interfaces/events' +import type { Libp2pEvents, PeerUpdate } from '@libp2p/interface' +import type { EventEmitter } from '@libp2p/interface/events' +import type { PeerId } from '@libp2p/interface/peer-id' +import type { PeerStore } from '@libp2p/interface/peer-store' +import type { Topology } from '@libp2p/interface/topology' +import type { ConnectionManager } from '@libp2p/interface-internal/connection-manager' +import type { StreamHandlerOptions, StreamHandlerRecord, Registrar, StreamHandler } from '@libp2p/interface-internal/registrar' const log = logger('libp2p:registrar') @@ -116,9 +117,8 @@ export class DefaultRegistrar implements Registrar { * Register handlers for a set of multicodecs given */ async register (protocol: string, topology: Topology): Promise { - if (!isTopology(topology)) { - log.error('topology must be an instance of interfaces/topology') - throw new CodeError('topology must be an instance of interfaces/topology', codes.ERR_INVALID_PARAMETERS) + if (topology == null) { + throw new CodeError('invalid topology', codes.ERR_INVALID_PARAMETERS) } // Create topology @@ -133,9 +133,6 @@ export class DefaultRegistrar implements Registrar { topologies.set(id, topology) - // Set registrar - await topology.setRegistrar(this) - return id } @@ -171,7 +168,7 @@ export class DefaultRegistrar implements Registrar { } for (const topology of topologies.values()) { - topology.onDisconnect(remotePeer) + topology.onDisconnect?.(remotePeer) } } }) @@ -211,7 +208,7 @@ export class DefaultRegistrar implements Registrar { } for (const topology of topologies.values()) { - topology.onConnect(remotePeer, connection) + topology.onConnect?.(remotePeer, connection) } } }) @@ -242,7 +239,7 @@ export class DefaultRegistrar implements Registrar { } for (const topology of topologies.values()) { - topology.onDisconnect(peer.id) + topology.onDisconnect?.(peer.id) } } @@ -260,7 +257,7 @@ export class DefaultRegistrar implements Registrar { if (connection == null) { continue } - topology.onConnect(peer.id, connection) + topology.onConnect?.(peer.id, connection) } } } diff --git a/packages/libp2p/src/transport-manager.ts b/packages/libp2p/src/transport-manager.ts index 334960c28b..254bd35b38 100644 --- a/packages/libp2p/src/transport-manager.ts +++ b/packages/libp2p/src/transport-manager.ts @@ -1,16 +1,16 @@ -import { FaultTolerance } from '@libp2p/interface-transport' -import { CodeError } from '@libp2p/interfaces/errors' +import { CodeError } from '@libp2p/interface/errors' +import { trackedMap } from '@libp2p/interface/metrics/tracked-map' +import { FaultTolerance } from '@libp2p/interface/transport' import { logger } from '@libp2p/logger' -import { trackedMap } from '@libp2p/tracked-map' import { codes } from './errors.js' -import type { AddressManager } from '@libp2p/interface-address-manager' -import type { Connection } from '@libp2p/interface-connection' -import type { Libp2pEvents } from '@libp2p/interface-libp2p' -import type { Metrics } from '@libp2p/interface-metrics' -import type { Listener, Transport, TransportManager, Upgrader } from '@libp2p/interface-transport' -import type { AbortOptions } from '@libp2p/interfaces' -import type { EventEmitter } from '@libp2p/interfaces/events' -import type { Startable } from '@libp2p/interfaces/startable' +import type { Libp2pEvents, AbortOptions } from '@libp2p/interface' +import type { Connection } from '@libp2p/interface/connection' +import type { EventEmitter } from '@libp2p/interface/events' +import type { Metrics } from '@libp2p/interface/metrics' +import type { Startable } from '@libp2p/interface/startable' +import type { Listener, Transport, Upgrader } from '@libp2p/interface/transport' +import type { AddressManager } from '@libp2p/interface-internal/address-manager' +import type { TransportManager } from '@libp2p/interface-internal/transport-manager' import type { Multiaddr } from '@multiformats/multiaddr' const log = logger('libp2p:transports') diff --git a/packages/libp2p/src/upgrader.ts b/packages/libp2p/src/upgrader.ts index c495be1edc..c124063417 100644 --- a/packages/libp2p/src/upgrader.ts +++ b/packages/libp2p/src/upgrader.ts @@ -1,5 +1,5 @@ import { setMaxListeners } from 'events' -import { CodeError } from '@libp2p/interfaces/errors' +import { CodeError } from '@libp2p/interface/errors' import { logger } from '@libp2p/logger' import * as mss from '@libp2p/multistream-select' import { peerIdFromString } from '@libp2p/peer-id' @@ -9,19 +9,18 @@ import { createConnection } from './connection/index.js' import { INBOUND_UPGRADE_TIMEOUT } from './connection-manager/constants.js' import { codes } from './errors.js' import { DEFAULT_MAX_INBOUND_STREAMS, DEFAULT_MAX_OUTBOUND_STREAMS } from './registrar.js' -import type { MultiaddrConnection, Connection, Stream, ConnectionProtector, NewStreamOptions } from '@libp2p/interface-connection' -import type { ConnectionEncrypter, SecuredConnection } from '@libp2p/interface-connection-encrypter' -import type { ConnectionGater } from '@libp2p/interface-connection-gater' -import type { ConnectionManager } from '@libp2p/interface-connection-manager' -import type { Libp2pEvents } from '@libp2p/interface-libp2p' -import type { Metrics } from '@libp2p/interface-metrics' -import type { PeerId } from '@libp2p/interface-peer-id' -import type { PeerStore } from '@libp2p/interface-peer-store' -import type { Registrar } from '@libp2p/interface-registrar' -import type { StreamMuxer, StreamMuxerFactory } from '@libp2p/interface-stream-muxer' -import type { Upgrader, UpgraderOptions } from '@libp2p/interface-transport' -import type { AbortOptions } from '@libp2p/interfaces' -import type { EventEmitter } from '@libp2p/interfaces/events' +import type { Libp2pEvents, AbortOptions } from '@libp2p/interface' +import type { MultiaddrConnection, Connection, Stream, ConnectionProtector, NewStreamOptions } from '@libp2p/interface/connection' +import type { ConnectionEncrypter, SecuredConnection } from '@libp2p/interface/connection-encrypter' +import type { ConnectionGater } from '@libp2p/interface/connection-gater' +import type { EventEmitter } from '@libp2p/interface/events' +import type { Metrics } from '@libp2p/interface/metrics' +import type { PeerId } from '@libp2p/interface/peer-id' +import type { PeerStore } from '@libp2p/interface/peer-store' +import type { StreamMuxer, StreamMuxerFactory } from '@libp2p/interface/stream-muxer' +import type { ConnectionManager } from '@libp2p/interface-internal/connection-manager' +import type { Registrar } from '@libp2p/interface-internal/registrar' +import type { Upgrader, UpgraderOptions } from '@libp2p/interface-internal/upgrader' import type { Duplex, Source } from 'it-stream-types' const log = logger('libp2p:upgrader') diff --git a/packages/libp2p/src/upnp-nat/index.ts b/packages/libp2p/src/upnp-nat/index.ts index dd65748131..8e422f6b1a 100644 --- a/packages/libp2p/src/upnp-nat/index.ts +++ b/packages/libp2p/src/upnp-nat/index.ts @@ -1,5 +1,5 @@ import { upnpNat, type NatAPI } from '@achingbrain/nat-port-mapper' -import { CodeError } from '@libp2p/interfaces/errors' +import { CodeError } from '@libp2p/interface/errors' import { logger } from '@libp2p/logger' import { isLoopback } from '@libp2p/utils/multiaddr/is-loopback' import { fromNodeAddress } from '@multiformats/multiaddr' @@ -7,10 +7,10 @@ import isPrivateIp from 'private-ip' import { isBrowser } from 'wherearewe' import { codes } from '../errors.js' import * as pkg from '../version.js' -import type { AddressManager } from '@libp2p/interface-address-manager' -import type { PeerId } from '@libp2p/interface-peer-id' -import type { TransportManager } from '@libp2p/interface-transport' -import type { Startable } from '@libp2p/interfaces/startable' +import type { PeerId } from '@libp2p/interface/peer-id' +import type { Startable } from '@libp2p/interface/startable' +import type { AddressManager } from '@libp2p/interface-internal/address-manager' +import type { TransportManager } from '@libp2p/interface-internal/transport-manager' const log = logger('libp2p:upnp-nat') const DEFAULT_TTL = 7200 diff --git a/packages/libp2p/src/utils/peer-job-queue.ts b/packages/libp2p/src/utils/peer-job-queue.ts index a15effa9aa..1b38e509b8 100644 --- a/packages/libp2p/src/utils/peer-job-queue.ts +++ b/packages/libp2p/src/utils/peer-job-queue.ts @@ -1,9 +1,9 @@ /* eslint-disable @typescript-eslint/no-non-null-assertion */ -import { CodeError } from '@libp2p/interfaces/errors' +import { CodeError } from '@libp2p/interface/errors' import PQueue from 'p-queue' import { codes } from '../errors.js' -import type { PeerId } from '@libp2p/interface-peer-id' +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 diff --git a/packages/libp2p/test/addresses/address-manager.spec.ts b/packages/libp2p/test/addresses/address-manager.spec.ts index 14df153ab9..7f67fa9b07 100644 --- a/packages/libp2p/test/addresses/address-manager.spec.ts +++ b/packages/libp2p/test/addresses/address-manager.spec.ts @@ -1,16 +1,16 @@ /* eslint-env mocha */ -import { EventEmitter } from '@libp2p/interfaces/events' +import { EventEmitter } from '@libp2p/interface/events' import { createEd25519PeerId } from '@libp2p/peer-id-factory' import { multiaddr } from '@multiformats/multiaddr' import { expect } from 'aegir/chai' import delay from 'delay' import { type StubbedInstance, stubInterface } from 'sinon-ts' import { type AddressFilter, DefaultAddressManager } from '../../src/address-manager/index.js' -import type { Libp2pEvents } from '@libp2p/interface-libp2p' -import type { PeerId } from '@libp2p/interface-peer-id' -import type { PeerStore } from '@libp2p/interface-peer-store' -import type { TransportManager } from '@libp2p/interface-transport' +import type { Libp2pEvents } from '@libp2p/interface' +import type { PeerId } from '@libp2p/interface/peer-id' +import type { PeerStore } from '@libp2p/interface/peer-store' +import type { TransportManager } from '@libp2p/interface-internal/transport-manager' const listenAddresses = ['/ip4/127.0.0.1/tcp/15006/ws', '/ip4/127.0.0.1/tcp/15008/ws'] const announceAddreses = ['/dns4/peer.io'] diff --git a/packages/libp2p/test/addresses/addresses.node.ts b/packages/libp2p/test/addresses/addresses.node.ts index cff353db17..c606b78aed 100644 --- a/packages/libp2p/test/addresses/addresses.node.ts +++ b/packages/libp2p/test/addresses/addresses.node.ts @@ -10,7 +10,7 @@ import { plaintext } from '../../src/insecure/index.js' import { createNode } from '../fixtures/creators/peer.js' import { AddressesOptions } from './utils.js' import type { Libp2pNode } from '../../src/libp2p.js' -import type { PeerUpdate } from '@libp2p/interface-libp2p' +import type { PeerUpdate } from '@libp2p/interface' const listenAddresses = ['/ip4/127.0.0.1/tcp/0', '/ip4/127.0.0.1/tcp/8000/ws'] const announceAddreses = ['/dns4/peer.io/tcp/433/p2p/12D3KooWNvSZnPi3RrhrTwEY4LuuBeB6K6facKUCJcyWG1aoDd2p'] diff --git a/packages/libp2p/test/autonat/index.spec.ts b/packages/libp2p/test/autonat/index.spec.ts index a21ac4a521..75e37df817 100644 --- a/packages/libp2p/test/autonat/index.spec.ts +++ b/packages/libp2p/test/autonat/index.spec.ts @@ -1,7 +1,7 @@ /* eslint-env mocha */ /* eslint max-nested-callbacks: ["error", 5] */ -import { start, stop } from '@libp2p/interfaces/startable' +import { start, stop } from '@libp2p/interface/startable' import { createEd25519PeerId } from '@libp2p/peer-id-factory' import { multiaddr } from '@multiformats/multiaddr' import { expect } from 'aegir/chai' @@ -19,14 +19,15 @@ import { defaultComponents } from '../../src/components.js' import type { AutoNATServiceInit } from '../../src/autonat/index.js' import type { Components } from '../../src/components.js' import type { DefaultConnectionManager } from '../../src/connection-manager/index.js' -import type { AddressManager } from '@libp2p/interface-address-manager' -import type { Connection, Stream } from '@libp2p/interface-connection' -import type { PeerId } from '@libp2p/interface-peer-id' -import type { PeerInfo } from '@libp2p/interface-peer-info' -import type { PeerRouting } from '@libp2p/interface-peer-routing' -import type { PeerStore } from '@libp2p/interface-peer-store' -import type { Registrar } from '@libp2p/interface-registrar' -import type { Transport, TransportManager } from '@libp2p/interface-transport' +import type { Connection, Stream } from '@libp2p/interface/connection' +import type { PeerId } from '@libp2p/interface/peer-id' +import type { PeerInfo } from '@libp2p/interface/peer-info' +import type { PeerRouting } from '@libp2p/interface/peer-routing' +import type { PeerStore } from '@libp2p/interface/peer-store' +import type { Transport } from '@libp2p/interface/transport' +import type { AddressManager } from '@libp2p/interface-internal/address-manager' +import type { Registrar } from '@libp2p/interface-internal/registrar' +import type { TransportManager } from '@libp2p/interface-internal/transport-manager' import type { Multiaddr } from '@multiformats/multiaddr' import type { StubbedInstance } from 'sinon-ts' diff --git a/packages/libp2p/test/circuit-relay/discovery.node.ts b/packages/libp2p/test/circuit-relay/discovery.node.ts index 6123ba9b9b..19517e67be 100644 --- a/packages/libp2p/test/circuit-relay/discovery.node.ts +++ b/packages/libp2p/test/circuit-relay/discovery.node.ts @@ -8,7 +8,7 @@ import { circuitRelayServer, type CircuitRelayService, circuitRelayTransport } f import { createLibp2p } from '../../src/index.js' import { plaintext } from '../../src/insecure/index.js' import { getRelayAddress, hasRelay, MockContentRouting, mockContentRouting } from './utils.js' -import type { Libp2p } from '@libp2p/interface-libp2p' +import type { Libp2p } from '@libp2p/interface' describe('circuit-relay discovery', () => { let local: Libp2p diff --git a/packages/libp2p/test/circuit-relay/hop.spec.ts b/packages/libp2p/test/circuit-relay/hop.spec.ts index 619a7ca2f8..5c7cd47788 100644 --- a/packages/libp2p/test/circuit-relay/hop.spec.ts +++ b/packages/libp2p/test/circuit-relay/hop.spec.ts @@ -1,9 +1,9 @@ /* eslint-env mocha */ /* eslint max-nested-callbacks: ['error', 5] */ -import { mockRegistrar, mockUpgrader, mockNetwork, mockConnectionManager, mockConnectionGater } from '@libp2p/interface-mocks' -import { EventEmitter } from '@libp2p/interfaces/events' -import { isStartable } from '@libp2p/interfaces/startable' +import { EventEmitter } from '@libp2p/interface/events' +import { isStartable } from '@libp2p/interface/startable' +import { mockRegistrar, mockUpgrader, mockNetwork, mockConnectionManager, mockConnectionGater } from '@libp2p/interface-compliance-tests/mocks' import { PeerMap } from '@libp2p/peer-collections' import { createEd25519PeerId } from '@libp2p/peer-id-factory' import { type Multiaddr, multiaddr } from '@multiformats/multiaddr' @@ -16,16 +16,17 @@ import { circuitRelayServer, type CircuitRelayService, circuitRelayTransport } f import { HopMessage, Status } from '../../src/circuit-relay/pb/index.js' import { matchPeerId } from '../fixtures/match-peer-id.js' import type { CircuitRelayServerInit } from '../../src/circuit-relay/server/index.js' -import type { AddressManager } from '@libp2p/interface-address-manager' -import type { Connection, Stream } from '@libp2p/interface-connection' -import type { ConnectionGater } from '@libp2p/interface-connection-gater' -import type { ConnectionManager } from '@libp2p/interface-connection-manager' -import type { ContentRouting } from '@libp2p/interface-content-routing' -import type { Libp2pEvents } from '@libp2p/interface-libp2p' -import type { PeerId } from '@libp2p/interface-peer-id' -import type { PeerStore } from '@libp2p/interface-peer-store' -import type { Registrar } from '@libp2p/interface-registrar' -import type { Transport, TransportManager, Upgrader } from '@libp2p/interface-transport' +import type { Libp2pEvents } from '@libp2p/interface' +import type { Connection, Stream } from '@libp2p/interface/connection' +import type { ConnectionGater } from '@libp2p/interface/connection-gater' +import type { ContentRouting } from '@libp2p/interface/content-routing' +import type { PeerId } from '@libp2p/interface/peer-id' +import type { PeerStore } from '@libp2p/interface/peer-store' +import type { Transport, Upgrader } from '@libp2p/interface/transport' +import type { AddressManager } from '@libp2p/interface-internal/address-manager' +import type { ConnectionManager } from '@libp2p/interface-internal/connection-manager' +import type { Registrar } from '@libp2p/interface-internal/registrar' +import type { TransportManager } from '@libp2p/interface-internal/transport-manager' interface Node { peerId: PeerId diff --git a/packages/libp2p/test/circuit-relay/relay.node.ts b/packages/libp2p/test/circuit-relay/relay.node.ts index f9f911a5cc..35b8d4960d 100644 --- a/packages/libp2p/test/circuit-relay/relay.node.ts +++ b/packages/libp2p/test/circuit-relay/relay.node.ts @@ -20,8 +20,8 @@ import { identifyService } from '../../src/identify/index.js' import { createLibp2p } from '../../src/index.js' import { plaintext } from '../../src/insecure/index.js' import { discoveredRelayConfig, getRelayAddress, hasRelay, usingAsRelay } from './utils.js' -import type { Connection } from '@libp2p/interface-connection' -import type { Libp2p } from '@libp2p/interface-libp2p' +import type { Libp2p } from '@libp2p/interface' +import type { Connection } from '@libp2p/interface/connection' describe('circuit-relay', () => { describe('flows with 1 listener', () => { diff --git a/packages/libp2p/test/circuit-relay/relay.spec.ts b/packages/libp2p/test/circuit-relay/relay.spec.ts index c01e3d8a64..2a4543cca8 100644 --- a/packages/libp2p/test/circuit-relay/relay.spec.ts +++ b/packages/libp2p/test/circuit-relay/relay.spec.ts @@ -13,9 +13,9 @@ import { identifyService } from '../../src/identify/index.js' import { createLibp2p } from '../../src/index.js' import { plaintext } from '../../src/insecure/index.js' import { hasRelay } from './utils.js' -import type { Connection } from '@libp2p/interface-connection' -import type { Libp2p } from '@libp2p/interface-libp2p' -import type { PeerId } from '@libp2p/interface-peer-id' +import type { Libp2p } from '@libp2p/interface' +import type { Connection } from '@libp2p/interface/connection' +import type { PeerId } from '@libp2p/interface/peer-id' describe('circuit-relay', () => { let local: Libp2p diff --git a/packages/libp2p/test/circuit-relay/stop.spec.ts b/packages/libp2p/test/circuit-relay/stop.spec.ts index 6935a9db4c..fc115ced80 100644 --- a/packages/libp2p/test/circuit-relay/stop.spec.ts +++ b/packages/libp2p/test/circuit-relay/stop.spec.ts @@ -1,8 +1,8 @@ /* eslint-env mocha */ -import { mockStream } from '@libp2p/interface-mocks' -import { EventEmitter } from '@libp2p/interfaces/events' -import { isStartable } from '@libp2p/interfaces/startable' +import { EventEmitter } from '@libp2p/interface/events' +import { isStartable } from '@libp2p/interface/startable' +import { mockStream } from '@libp2p/interface-compliance-tests/mocks' import { createEd25519PeerId } from '@libp2p/peer-id-factory' import { expect } from 'aegir/chai' import { duplexPair } from 'it-pair/duplex' @@ -10,15 +10,16 @@ import { pbStream, type MessageStream } from 'it-pb-stream' import { stubInterface } from 'sinon-ts' import { circuitRelayTransport } from '../../src/circuit-relay/index.js' import { Status, StopMessage } from '../../src/circuit-relay/pb/index.js' -import type { AddressManager } from '@libp2p/interface-address-manager' -import type { Connection } from '@libp2p/interface-connection' -import type { ConnectionGater } from '@libp2p/interface-connection-gater' -import type { ConnectionManager } from '@libp2p/interface-connection-manager' -import type { ContentRouting } from '@libp2p/interface-content-routing' -import type { PeerId } from '@libp2p/interface-peer-id' -import type { PeerStore } from '@libp2p/interface-peer-store' -import type { Registrar, StreamHandler } from '@libp2p/interface-registrar' -import type { Transport, TransportManager, Upgrader } from '@libp2p/interface-transport' +import type { Connection } from '@libp2p/interface/connection' +import type { ConnectionGater } from '@libp2p/interface/connection-gater' +import type { ContentRouting } from '@libp2p/interface/content-routing' +import type { PeerId } from '@libp2p/interface/peer-id' +import type { PeerStore } from '@libp2p/interface/peer-store' +import type { Transport, Upgrader } from '@libp2p/interface/transport' +import type { AddressManager } from '@libp2p/interface-internal/address-manager' +import type { ConnectionManager } from '@libp2p/interface-internal/connection-manager' +import type { Registrar, StreamHandler } from '@libp2p/interface-internal/registrar' +import type { TransportManager } from '@libp2p/interface-internal/transport-manager' describe('circuit-relay stop protocol', function () { let transport: Transport diff --git a/packages/libp2p/test/circuit-relay/utils.spec.ts b/packages/libp2p/test/circuit-relay/utils.spec.ts index c67ac8b35c..b2d8cb436b 100644 --- a/packages/libp2p/test/circuit-relay/utils.spec.ts +++ b/packages/libp2p/test/circuit-relay/utils.spec.ts @@ -1,6 +1,6 @@ /* eslint-env mocha */ -import { mockStream } from '@libp2p/interface-mocks' +import { mockStream } from '@libp2p/interface-compliance-tests/mocks' import { expect } from 'aegir/chai' import delay from 'delay' import drain from 'it-drain' diff --git a/packages/libp2p/test/circuit-relay/utils.ts b/packages/libp2p/test/circuit-relay/utils.ts index b3402e6b25..818f3b036c 100644 --- a/packages/libp2p/test/circuit-relay/utils.ts +++ b/packages/libp2p/test/circuit-relay/utils.ts @@ -2,12 +2,11 @@ import { peerIdFromString } from '@libp2p/peer-id' import pWaitFor from 'p-wait-for' import { toString as uint8ArrayToString } from 'uint8arrays/to-string' import { RELAY_V2_HOP_CODEC } from '../../src/circuit-relay/constants.js' -import type { AddressManager } from '@libp2p/interface-address-manager' -import type { ContentRouting } from '@libp2p/interface-content-routing' -import type { Libp2p } from '@libp2p/interface-libp2p' -import type { PeerId } from '@libp2p/interface-peer-id' -import type { PeerInfo } from '@libp2p/interface-peer-info' -import type { AbortOptions } from '@libp2p/interfaces' +import type { Libp2p, AbortOptions } from '@libp2p/interface' +import type { ContentRouting } from '@libp2p/interface/content-routing' +import type { PeerId } from '@libp2p/interface/peer-id' +import type { PeerInfo } from '@libp2p/interface/peer-info' +import type { AddressManager } from '@libp2p/interface-internal/address-manager' import type { Multiaddr } from '@multiformats/multiaddr' import type { CID, Version } from 'multiformats' import type { Options as PWaitForOptions } from 'p-wait-for' diff --git a/packages/libp2p/test/configuration/protocol-prefix.node.ts b/packages/libp2p/test/configuration/protocol-prefix.node.ts index c88429b2c3..db4ecea61c 100644 --- a/packages/libp2p/test/configuration/protocol-prefix.node.ts +++ b/packages/libp2p/test/configuration/protocol-prefix.node.ts @@ -1,14 +1,13 @@ /* eslint-env mocha */ import { expect } from 'aegir/chai' -import mergeOptions from 'merge-options' import { pEvent } from 'p-event' import { type FetchService, fetchService } from '../../src/fetch/index.js' import { identifyService } from '../../src/identify/index.js' import { createLibp2p } from '../../src/index.js' import { type PingService, pingService } from '../../src/ping/index.js' -import { baseOptions } from './utils.js' -import type { Libp2p } from '@libp2p/interface-libp2p' +import { createBaseOptions } from '../fixtures/base-options.js' +import type { Libp2p } from '@libp2p/interface' describe('Protocol prefix is configurable', () => { let libp2p: Libp2p<{ identify: unknown, ping: PingService, fetch: FetchService }> @@ -21,7 +20,7 @@ describe('Protocol prefix is configurable', () => { it('protocolPrefix is provided', async () => { const testProtocol = 'test-protocol' - libp2p = await createLibp2p(mergeOptions(baseOptions, { + libp2p = await createLibp2p(createBaseOptions({ services: { identify: identifyService({ protocolPrefix: testProtocol @@ -50,7 +49,7 @@ describe('Protocol prefix is configurable', () => { }) it('protocolPrefix is not provided', async () => { - libp2p = await createLibp2p(mergeOptions(baseOptions, { + libp2p = await createLibp2p(createBaseOptions({ services: { identify: identifyService(), ping: pingService(), diff --git a/packages/libp2p/test/configuration/pubsub.spec.ts b/packages/libp2p/test/configuration/pubsub.spec.ts deleted file mode 100644 index 9894b5c596..0000000000 --- a/packages/libp2p/test/configuration/pubsub.spec.ts +++ /dev/null @@ -1,105 +0,0 @@ -/* eslint-env mocha */ - -import { floodsub } from '@libp2p/floodsub' -import { expect } from 'aegir/chai' -import delay from 'delay' -import mergeOptions from 'merge-options' -import pDefer from 'p-defer' -import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' -import { createLibp2p, type Libp2p } from '../../src/index.js' -import { createPeerId } from '../fixtures/creators/peer.js' -import { pubsubSubsystemOptions } from './utils.js' -import type { PubSub } from '@libp2p/interface-pubsub' - -describe('Pubsub subsystem is configurable', () => { - let libp2p: Libp2p<{ pubsub: PubSub }> - - afterEach(async () => { - if (libp2p != null) { - await libp2p.stop() - } - }) - - it('should not throw if the module is provided', async () => { - libp2p = await createLibp2p(pubsubSubsystemOptions) - await libp2p.start() - expect(libp2p.services.pubsub.getTopics()).to.be.empty() - }) - - it('should start and stop by default once libp2p starts', async () => { - const peerId = await createPeerId() - - const customOptions = mergeOptions(pubsubSubsystemOptions, { - start: false, - peerId - }) - - libp2p = await createLibp2p(customOptions) - // @ts-expect-error not part of interface - expect(libp2p.services.pubsub.isStarted()).to.equal(false) - - await libp2p.start() - // @ts-expect-error not part of interface - expect(libp2p.services.pubsub.isStarted()).to.equal(true) - - await libp2p.stop() - // @ts-expect-error not part of interface - expect(libp2p.services.pubsub.isStarted()).to.equal(false) - }) -}) - -describe('Pubsub subscription handlers adapter', () => { - let libp2p: Libp2p<{ pubsub: PubSub }> - - beforeEach(async () => { - const peerId = await createPeerId() - - libp2p = await createLibp2p(mergeOptions(pubsubSubsystemOptions, { - peerId, - services: { - pubsub: floodsub({ - emitSelf: true - }) - } - })) - - await libp2p.start() - }) - - afterEach(async () => { - if (libp2p != null) { - await libp2p.stop() - } - }) - - it('extends pubsub with subscribe handler', async () => { - let countMessages = 0 - const topic = 'topic' - const defer = pDefer() - - const handler = (): void => { - countMessages++ - defer.resolve() - } - - const pubsub: PubSub | undefined = libp2p.services.pubsub - - if (pubsub == null) { - throw new Error('Pubsub was not enabled') - } - - pubsub.subscribe(topic) - pubsub.addEventListener('message', handler) - await pubsub.publish(topic, uint8ArrayFromString('useless-data')) - await defer.promise - - pubsub.unsubscribe(topic) - pubsub.removeEventListener('message', handler) - await pubsub.publish(topic, uint8ArrayFromString('useless-data')) - - // wait to guarantee that the handler is not called twice - await delay(100) - - expect(countMessages).to.equal(1) - }) -}) diff --git a/packages/libp2p/test/configuration/utils.ts b/packages/libp2p/test/configuration/utils.ts deleted file mode 100644 index e175626a63..0000000000 --- a/packages/libp2p/test/configuration/utils.ts +++ /dev/null @@ -1,94 +0,0 @@ -import { yamux } from '@chainsafe/libp2p-yamux' -import { mockConnectionGater } from '@libp2p/interface-mocks' -import { PubSubBaseProtocol, type PubSubComponents } from '@libp2p/pubsub' -import { webSockets } from '@libp2p/websockets' -import * as filters from '@libp2p/websockets/filters' -import { multiaddr } from '@multiformats/multiaddr' -import * as cborg from 'cborg' -import mergeOptions from 'merge-options' -import { circuitRelayTransport } from '../../src/circuit-relay/index.js' -import { plaintext } from '../../src/insecure/index.js' -import type { Libp2pInit, Libp2pOptions } from '../../src/index.js' -import type { PeerId } from '@libp2p/interface-peer-id' -import type { Message, PublishResult, PubSub, PubSubInit, PubSubRPC, PubSubRPCMessage } from '@libp2p/interface-pubsub' - -const relayAddr = multiaddr(process.env.RELAY_MULTIADDR) - -export const baseOptions: Partial> = { - addresses: { - listen: [ - `${relayAddr}/p2p-circuit` - ] - }, - transports: [ - webSockets({ - filter: filters.all - }), - circuitRelayTransport() - ], - streamMuxers: [yamux()], - connectionEncryption: [plaintext()] -} - -class MockPubSub extends PubSubBaseProtocol { - constructor (components: PubSubComponents, init?: PubSubInit) { - super(components, { - multicodecs: ['/mock-pubsub'], - ...init - }) - } - - decodeRpc (bytes: Uint8Array): PubSubRPC { - return cborg.decode(bytes) - } - - encodeRpc (rpc: PubSubRPC): Uint8Array { - return cborg.encode(rpc) - } - - decodeMessage (bytes: Uint8Array): PubSubRPCMessage { - return cborg.decode(bytes) - } - - encodeMessage (rpc: PubSubRPCMessage): Uint8Array { - return cborg.encode(rpc) - } - - async publishMessage (from: PeerId, message: Message): Promise { - const peers = this.getSubscribers(message.topic) - const recipients: PeerId[] = [] - - if (peers == null || peers.length === 0) { - return { recipients } - } - - peers.forEach(id => { - if (this.components.peerId.equals(id)) { - return - } - - if (id.equals(from)) { - return - } - - recipients.push(id) - this.send(id, { messages: [message] }) - }) - - return { recipients } - } -} - -export const pubsubSubsystemOptions: Libp2pOptions<{ pubsub: PubSub }> = mergeOptions(baseOptions, { - addresses: { - listen: [`${relayAddr.toString()}/p2p-circuit`] - }, - transports: [ - webSockets({ filter: filters.all }), - circuitRelayTransport() - ], - services: { - pubsub: (components: PubSubComponents) => new MockPubSub(components) - }, - connectionGater: mockConnectionGater() -}) diff --git a/packages/libp2p/test/connection-manager/auto-dial.spec.ts b/packages/libp2p/test/connection-manager/auto-dial.spec.ts index 5a1e44b149..377e7bd38c 100644 --- a/packages/libp2p/test/connection-manager/auto-dial.spec.ts +++ b/packages/libp2p/test/connection-manager/auto-dial.spec.ts @@ -1,6 +1,6 @@ /* eslint-env mocha */ -import { EventEmitter } from '@libp2p/interfaces/events' +import { EventEmitter } from '@libp2p/interface/events' import { PeerMap } from '@libp2p/peer-collections' import { createEd25519PeerId } from '@libp2p/peer-id-factory' import { PersistentPeerStore } from '@libp2p/peer-store' @@ -13,11 +13,11 @@ import Sinon from 'sinon' import { stubInterface } from 'sinon-ts' import { AutoDial } from '../../src/connection-manager/auto-dial.js' import { matchPeerId } from '../fixtures/match-peer-id.js' -import type { Connection } from '@libp2p/interface-connection' -import type { ConnectionManager } from '@libp2p/interface-connection-manager' -import type { Libp2pEvents } from '@libp2p/interface-libp2p' -import type { PeerId } from '@libp2p/interface-peer-id' -import type { PeerStore, Peer } from '@libp2p/interface-peer-store' +import type { Libp2pEvents } from '@libp2p/interface' +import type { Connection } from '@libp2p/interface/connection' +import type { PeerId } from '@libp2p/interface/peer-id' +import type { PeerStore, Peer } from '@libp2p/interface/peer-store' +import type { ConnectionManager } from '@libp2p/interface-internal/connection-manager' describe('auto-dial', () => { let autoDialler: AutoDial diff --git a/packages/libp2p/test/connection-manager/dial-queue.spec.ts b/packages/libp2p/test/connection-manager/dial-queue.spec.ts index dfe9fc212c..c5c385397f 100644 --- a/packages/libp2p/test/connection-manager/dial-queue.spec.ts +++ b/packages/libp2p/test/connection-manager/dial-queue.spec.ts @@ -1,6 +1,6 @@ /* eslint-env mocha */ -import { mockConnection, mockDuplex, mockMultiaddrConnection } from '@libp2p/interface-mocks' +import { mockConnection, mockDuplex, mockMultiaddrConnection } from '@libp2p/interface-compliance-tests/mocks' import { createEd25519PeerId } from '@libp2p/peer-id-factory' import { multiaddr } from '@multiformats/multiaddr' import { expect } from 'aegir/chai' @@ -9,11 +9,12 @@ import pDefer from 'p-defer' import sinon from 'sinon' import { type StubbedInstance, stubInterface } from 'sinon-ts' import { DialQueue } from '../../src/connection-manager/dial-queue.js' -import type { Connection } from '@libp2p/interface-connection' -import type { ConnectionGater } from '@libp2p/interface-connection-gater' -import type { PeerId } from '@libp2p/interface-peer-id' -import type { PeerStore } from '@libp2p/interface-peer-store' -import type { Transport, TransportManager } from '@libp2p/interface-transport' +import type { Connection } from '@libp2p/interface/connection' +import type { ConnectionGater } from '@libp2p/interface/connection-gater' +import type { PeerId } from '@libp2p/interface/peer-id' +import type { PeerStore } from '@libp2p/interface/peer-store' +import type { Transport } from '@libp2p/interface/transport' +import type { TransportManager } from '@libp2p/interface-internal/transport-manager' describe('dial queue', () => { let components: { diff --git a/packages/libp2p/test/connection-manager/direct.node.ts b/packages/libp2p/test/connection-manager/direct.node.ts index 9bef0c0fce..cc4d709701 100644 --- a/packages/libp2p/test/connection-manager/direct.node.ts +++ b/packages/libp2p/test/connection-manager/direct.node.ts @@ -4,10 +4,10 @@ import fs from 'node:fs' import os from 'node:os' import path from 'node:path' import { yamux } from '@chainsafe/libp2p-yamux' -import { type Connection, type ConnectionProtector, isConnection } from '@libp2p/interface-connection' -import { mockConnection, mockConnectionGater, mockDuplex, mockMultiaddrConnection, mockUpgrader } from '@libp2p/interface-mocks' -import { AbortError } from '@libp2p/interfaces/errors' -import { EventEmitter } from '@libp2p/interfaces/events' +import { type Connection, type ConnectionProtector, isConnection } from '@libp2p/interface/connection' +import { AbortError } from '@libp2p/interface/errors' +import { EventEmitter } from '@libp2p/interface/events' +import { mockConnection, mockConnectionGater, mockDuplex, mockMultiaddrConnection, mockUpgrader } from '@libp2p/interface-compliance-tests/mocks' import { mplex } from '@libp2p/mplex' import { peerIdFromString } from '@libp2p/peer-id' import { createEd25519PeerId } from '@libp2p/peer-id-factory' @@ -34,8 +34,8 @@ import { createLibp2pNode, type Libp2pNode } from '../../src/libp2p.js' import { preSharedKey } from '../../src/pnet/index.js' import { DefaultTransportManager } from '../../src/transport-manager.js' import swarmKey from '../fixtures/swarm.key.js' -import type { PeerId } from '@libp2p/interface-peer-id' -import type { TransportManager } from '@libp2p/interface-transport' +import type { PeerId } from '@libp2p/interface/peer-id' +import type { TransportManager } from '@libp2p/interface-internal/transport-manager' import type { Multiaddr } from '@multiformats/multiaddr' const swarmKeyBuffer = uint8ArrayFromString(swarmKey) diff --git a/packages/libp2p/test/connection-manager/direct.spec.ts b/packages/libp2p/test/connection-manager/direct.spec.ts index ad7ecc50ea..1bede4f907 100644 --- a/packages/libp2p/test/connection-manager/direct.spec.ts +++ b/packages/libp2p/test/connection-manager/direct.spec.ts @@ -1,9 +1,9 @@ /* eslint-env mocha */ import { yamux } from '@chainsafe/libp2p-yamux' -import { mockConnectionGater, mockDuplex, mockMultiaddrConnection, mockUpgrader, mockConnection } from '@libp2p/interface-mocks' -import { AbortError } from '@libp2p/interfaces/errors' -import { EventEmitter } from '@libp2p/interfaces/events' +import { AbortError } from '@libp2p/interface/errors' +import { EventEmitter } from '@libp2p/interface/events' +import { mockConnectionGater, mockDuplex, mockMultiaddrConnection, mockUpgrader, mockConnection } from '@libp2p/interface-compliance-tests/mocks' import { mplex } from '@libp2p/mplex' import { peerIdFromString } from '@libp2p/peer-id' import { createEd25519PeerId } from '@libp2p/peer-id-factory' @@ -28,10 +28,10 @@ import { plaintext } from '../../src/insecure/index.js' import { DefaultTransportManager } from '../../src/transport-manager.js' import { createPeerId } from '../fixtures/creators/peer.js' import type { DefaultIdentifyService } from '../../src/identify/identify.js' -import type { Connection } from '@libp2p/interface-connection' -import type { Libp2p } from '@libp2p/interface-libp2p' -import type { PeerId } from '@libp2p/interface-peer-id' -import type { TransportManager } from '@libp2p/interface-transport' +import type { Libp2p } from '@libp2p/interface' +import type { Connection } from '@libp2p/interface/connection' +import type { PeerId } from '@libp2p/interface/peer-id' +import type { TransportManager } from '@libp2p/interface-internal/transport-manager' import type { Multiaddr } from '@multiformats/multiaddr' const unsupportedAddr = multiaddr('/ip4/127.0.0.1/tcp/9999') diff --git a/packages/libp2p/test/connection-manager/index.node.ts b/packages/libp2p/test/connection-manager/index.node.ts index 180df6177a..2b5e1b30ca 100644 --- a/packages/libp2p/test/connection-manager/index.node.ts +++ b/packages/libp2p/test/connection-manager/index.node.ts @@ -1,9 +1,9 @@ /* eslint-env mocha */ -import * as STATUS from '@libp2p/interface-connection/status' -import { mockConnection, mockDuplex, mockMultiaddrConnection } from '@libp2p/interface-mocks' -import { EventEmitter } from '@libp2p/interfaces/events' -import { start } from '@libp2p/interfaces/startable' +import * as STATUS from '@libp2p/interface/connection/status' +import { EventEmitter } from '@libp2p/interface/events' +import { start } from '@libp2p/interface/startable' +import { mockConnection, mockDuplex, mockMultiaddrConnection } from '@libp2p/interface-compliance-tests/mocks' import { expect } from 'aegir/chai' import delay from 'delay' import pWaitFor from 'p-wait-for' @@ -16,10 +16,10 @@ import { createBaseOptions } from '../fixtures/base-options.browser.js' import { createNode, createPeerId } from '../fixtures/creators/peer.js' import type { Libp2p } from '../../src/index.js' import type { Libp2pNode } from '../../src/libp2p.js' -import type { ConnectionGater } from '@libp2p/interface-connection-gater' -import type { PeerId } from '@libp2p/interface-peer-id' -import type { PeerStore } from '@libp2p/interface-peer-store' -import type { TransportManager } from '@libp2p/interface-transport' +import type { ConnectionGater } from '@libp2p/interface/connection-gater' +import type { PeerId } from '@libp2p/interface/peer-id' +import type { PeerStore } from '@libp2p/interface/peer-store' +import type { TransportManager } from '@libp2p/interface-internal/transport-manager' describe('Connection Manager', () => { let libp2p: Libp2p diff --git a/packages/libp2p/test/connection-manager/index.spec.ts b/packages/libp2p/test/connection-manager/index.spec.ts index 5cf7cfcc11..080557beb5 100644 --- a/packages/libp2p/test/connection-manager/index.spec.ts +++ b/packages/libp2p/test/connection-manager/index.spec.ts @@ -1,8 +1,8 @@ /* eslint-env mocha */ -import { mockConnection, mockDuplex, mockMultiaddrConnection, mockMetrics } from '@libp2p/interface-mocks' -import { KEEP_ALIVE } from '@libp2p/interface-peer-store/tags' -import { EventEmitter } from '@libp2p/interfaces/events' +import { EventEmitter } from '@libp2p/interface/events' +import { KEEP_ALIVE } from '@libp2p/interface/peer-store/tags' +import { mockConnection, mockDuplex, mockMultiaddrConnection, mockMetrics } from '@libp2p/interface-compliance-tests/mocks' import { createEd25519PeerId } from '@libp2p/peer-id-factory' import { multiaddr } from '@multiformats/multiaddr' import { expect } from 'aegir/chai' @@ -14,10 +14,10 @@ import { DefaultConnectionManager } from '../../src/connection-manager/index.js' import { createBaseOptions } from '../fixtures/base-options.browser.js' import { createNode } from '../fixtures/creators/peer.js' import type { Libp2pNode } from '../../src/libp2p.js' -import type { Connection } from '@libp2p/interface-connection' -import type { ConnectionGater } from '@libp2p/interface-connection-gater' -import type { PeerStore } from '@libp2p/interface-peer-store' -import type { TransportManager } from '@libp2p/interface-transport' +import type { Connection } from '@libp2p/interface/connection' +import type { ConnectionGater } from '@libp2p/interface/connection-gater' +import type { PeerStore } from '@libp2p/interface/peer-store' +import type { TransportManager } from '@libp2p/interface-internal/transport-manager' const defaultOptions = { maxConnections: 10, diff --git a/packages/libp2p/test/connection-manager/resolver.spec.ts b/packages/libp2p/test/connection-manager/resolver.spec.ts index 83ed0a9130..adccf3976d 100644 --- a/packages/libp2p/test/connection-manager/resolver.spec.ts +++ b/packages/libp2p/test/connection-manager/resolver.spec.ts @@ -1,7 +1,7 @@ /* eslint-env mocha */ import { yamux } from '@chainsafe/libp2p-yamux' -import { mockConnection, mockConnectionGater, mockDuplex, mockMultiaddrConnection } from '@libp2p/interface-mocks' +import { mockConnection, mockConnectionGater, mockDuplex, mockMultiaddrConnection } from '@libp2p/interface-compliance-tests/mocks' import { mplex } from '@libp2p/mplex' import { peerIdFromString } from '@libp2p/peer-id' import { createEd25519PeerId } from '@libp2p/peer-id-factory' @@ -16,8 +16,8 @@ import { circuitRelayServer, type CircuitRelayService, circuitRelayTransport } f import { codes as ErrorCodes } from '../../src/errors.js' import { plaintext } from '../../src/insecure/index.js' import { createLibp2pNode, type Libp2pNode } from '../../src/libp2p.js' -import type { PeerId } from '@libp2p/interface-peer-id' -import type { Transport } from '@libp2p/interface-transport' +import type { PeerId } from '@libp2p/interface/peer-id' +import type { Transport } from '@libp2p/interface/transport' import type { Multiaddr } from '@multiformats/multiaddr' const relayAddr = multiaddr(process.env.RELAY_MULTIADDR) diff --git a/packages/libp2p/test/connection/compliance.spec.ts b/packages/libp2p/test/connection/compliance.spec.ts index 4e2bcfe509..a5a422c954 100644 --- a/packages/libp2p/test/connection/compliance.spec.ts +++ b/packages/libp2p/test/connection/compliance.spec.ts @@ -1,10 +1,10 @@ +import tests from '@libp2p/interface-compliance-tests/connection' import peers from '@libp2p/interface-compliance-tests/peers' -import tests from '@libp2p/interface-connection-compliance-tests' import * as PeerIdFactory from '@libp2p/peer-id-factory' import { multiaddr } from '@multiformats/multiaddr' import { createConnection } from '../../src/connection/index.js' import { pair } from './fixtures/pair.js' -import type { Stream } from '@libp2p/interface-connection' +import type { Stream } from '@libp2p/interface/connection' describe('connection compliance', () => { tests({ diff --git a/packages/libp2p/test/connection/index.spec.ts b/packages/libp2p/test/connection/index.spec.ts index bbd4290078..d27584b473 100644 --- a/packages/libp2p/test/connection/index.spec.ts +++ b/packages/libp2p/test/connection/index.spec.ts @@ -2,7 +2,7 @@ import * as PeerIdFactory from '@libp2p/peer-id-factory' import { multiaddr } from '@multiformats/multiaddr' import { createConnection } from '../../src/connection/index.js' import { pair } from './fixtures/pair.js' -import type { Stream } from '@libp2p/interface-connection' +import type { Stream } from '@libp2p/interface/connection' const peers = [{ id: 'QmNMMAqSxPetRS1cVMmutW5BCN1qQQyEr4u98kUvZjcfEw', diff --git a/packages/libp2p/test/content-routing/content-routing.node.ts b/packages/libp2p/test/content-routing/content-routing.node.ts index 940077338d..bf6a754b63 100644 --- a/packages/libp2p/test/content-routing/content-routing.node.ts +++ b/packages/libp2p/test/content-routing/content-routing.node.ts @@ -13,8 +13,8 @@ import { createLibp2p, type Libp2p } from '../../src/index.js' import { createBaseOptions } from '../fixtures/base-options.js' import { createNode, createPeerId, populateAddressBooks } from '../fixtures/creators/peer.js' import { createRoutingOptions } from './utils.js' -import type { ContentRouting } from '@libp2p/interface-content-routing' -import type { PeerInfo } from '@libp2p/interface-peer-info' +import type { ContentRouting } from '@libp2p/interface/content-routing' +import type { PeerInfo } from '@libp2p/interface/peer-info' import type { KadDHT } from '@libp2p/kad-dht' describe('content-routing', () => { diff --git a/packages/libp2p/test/content-routing/dht/operation.node.ts b/packages/libp2p/test/content-routing/dht/operation.node.ts index bf3551b619..b960aa4f6a 100644 --- a/packages/libp2p/test/content-routing/dht/operation.node.ts +++ b/packages/libp2p/test/content-routing/dht/operation.node.ts @@ -12,8 +12,8 @@ import { createLibp2p } from '../../../src/index.js' import { plaintext } from '../../../src/insecure/index.js' import { createPeerId } from '../../fixtures/creators/peer.js' import { subsystemMulticodecs } from './utils.js' -import type { Libp2p } from '@libp2p/interface-libp2p' -import type { PeerId } from '@libp2p/interface-peer-id' +import type { Libp2p } from '@libp2p/interface' +import type { PeerId } from '@libp2p/interface/peer-id' import type { DualKadDHT } from '@libp2p/kad-dht' import type { Multiaddr } from '@multiformats/multiaddr' diff --git a/packages/libp2p/test/core/encryption.spec.ts b/packages/libp2p/test/core/encryption.spec.ts index 5f6b5595cd..572fc6ceac 100644 --- a/packages/libp2p/test/core/encryption.spec.ts +++ b/packages/libp2p/test/core/encryption.spec.ts @@ -4,7 +4,7 @@ import { webSockets } from '@libp2p/websockets' import { createLibp2p, type Libp2pOptions } from '../../src/index.js' import { plaintext } from '../../src/insecure/index.js' import { createPeerId } from '../fixtures/creators/peer.js' -import type { PeerId } from '@libp2p/interface-peer-id' +import type { PeerId } from '@libp2p/interface/peer-id' describe('Connection encryption configuration', () => { let peerId: PeerId diff --git a/packages/libp2p/test/core/events.spec.ts b/packages/libp2p/test/core/events.spec.ts index 7815cb9b4d..00cfd47d07 100644 --- a/packages/libp2p/test/core/events.spec.ts +++ b/packages/libp2p/test/core/events.spec.ts @@ -5,7 +5,7 @@ import { expect } from 'aegir/chai' import { pEvent } from 'p-event' import { createLibp2p } from '../../src/index.js' import { plaintext } from '../../src/insecure/index.js' -import type { Libp2p } from '@libp2p/interface-libp2p' +import type { Libp2p } from '@libp2p/interface' describe('events', () => { let node: Libp2p diff --git a/packages/libp2p/test/core/get-public-key.spec.ts b/packages/libp2p/test/core/get-public-key.spec.ts index b4de3bf238..11c84c196f 100644 --- a/packages/libp2p/test/core/get-public-key.spec.ts +++ b/packages/libp2p/test/core/get-public-key.spec.ts @@ -7,7 +7,7 @@ import sinon from 'sinon' import { plaintext } from '../../src/insecure/index.js' import { createLibp2pNode } from '../../src/libp2p.js' import { createPeerId } from '../fixtures/creators/peer.js' -import type { Libp2p } from '@libp2p/interface-libp2p' +import type { Libp2p } from '@libp2p/interface' import type { KadDHT } from '@libp2p/kad-dht' describe('getPublicKey', () => { diff --git a/packages/libp2p/test/core/listening.node.ts b/packages/libp2p/test/core/listening.node.ts index fe41500476..b09aa9d0f9 100644 --- a/packages/libp2p/test/core/listening.node.ts +++ b/packages/libp2p/test/core/listening.node.ts @@ -5,7 +5,7 @@ import { expect } from 'aegir/chai' import { plaintext } from '../../src/insecure/index.js' import { createLibp2pNode, type Libp2pNode } from '../../src/libp2p.js' import { createPeerId } from '../fixtures/creators/peer.js' -import type { PeerId } from '@libp2p/interface-peer-id' +import type { PeerId } from '@libp2p/interface/peer-id' const listenAddr = '/ip4/0.0.0.0/tcp/0' diff --git a/packages/libp2p/test/fetch/fetch.node.ts b/packages/libp2p/test/fetch/fetch.node.ts index cba225645c..53420c9a45 100644 --- a/packages/libp2p/test/fetch/fetch.node.ts +++ b/packages/libp2p/test/fetch/fetch.node.ts @@ -9,8 +9,8 @@ import { type FetchService, fetchService } from '../../src/fetch/index.js' import { createLibp2p } from '../../src/index.js' import { plaintext } from '../../src/insecure/index.js' import { createPeerId } from '../fixtures/creators/peer.js' -import type { Libp2p } from '@libp2p/interface-libp2p' -import type { PeerId } from '@libp2p/interface-peer-id' +import type { Libp2p } from '@libp2p/interface' +import type { PeerId } from '@libp2p/interface/peer-id' async function createNode (peerId: PeerId): Promise> { return createLibp2p({ diff --git a/packages/libp2p/test/fetch/index.spec.ts b/packages/libp2p/test/fetch/index.spec.ts index 37cde571cc..70d411ec65 100644 --- a/packages/libp2p/test/fetch/index.spec.ts +++ b/packages/libp2p/test/fetch/index.spec.ts @@ -1,8 +1,8 @@ /* eslint-env mocha */ -import { mockRegistrar, mockUpgrader, connectionPair } from '@libp2p/interface-mocks' -import { EventEmitter } from '@libp2p/interfaces/events' -import { start, stop } from '@libp2p/interfaces/startable' +import { EventEmitter } from '@libp2p/interface/events' +import { start, stop } from '@libp2p/interface/startable' +import { mockRegistrar, mockUpgrader, connectionPair } from '@libp2p/interface-compliance-tests/mocks' import { createEd25519PeerId } from '@libp2p/peer-id-factory' import { PersistentPeerStore } from '@libp2p/peer-store' import { expect } from 'aegir/chai' @@ -14,8 +14,8 @@ import { stubInterface } from 'sinon-ts' import { defaultComponents, type Components } from '../../src/components.js' import { DefaultConnectionManager } from '../../src/connection-manager/index.js' import { fetchService, type FetchServiceInit } from '../../src/fetch/index.js' -import type { ConnectionGater } from '@libp2p/interface-connection-gater' -import type { TransportManager } from '@libp2p/interface-transport' +import type { ConnectionGater } from '@libp2p/interface/connection-gater' +import type { TransportManager } from '@libp2p/interface-internal/transport-manager' const defaultInit: FetchServiceInit = { protocolPrefix: 'ipfs', diff --git a/packages/libp2p/test/fixtures/base-options.browser.ts b/packages/libp2p/test/fixtures/base-options.browser.ts index 65c2a69323..e2a0b97685 100644 --- a/packages/libp2p/test/fixtures/base-options.browser.ts +++ b/packages/libp2p/test/fixtures/base-options.browser.ts @@ -1,6 +1,6 @@ import { yamux } from '@chainsafe/libp2p-yamux' -import { mockConnectionGater } from '@libp2p/interface-mocks' +import { mockConnectionGater } from '@libp2p/interface-compliance-tests/mocks' import { mplex } from '@libp2p/mplex' import { webSockets } from '@libp2p/websockets' import * as filters from '@libp2p/websockets/filters' @@ -8,7 +8,7 @@ import mergeOptions from 'merge-options' import { circuitRelayTransport } from '../../src/circuit-relay/index.js' import { plaintext } from '../../src/insecure/index.js' import type { Libp2pOptions } from '../../src/index.js' -import type { ServiceMap } from '@libp2p/interface-libp2p' +import type { ServiceMap } from '@libp2p/interface' export function createBaseOptions > (overrides?: Libp2pOptions): Libp2pOptions { const options: Libp2pOptions = { diff --git a/packages/libp2p/test/fixtures/base-options.ts b/packages/libp2p/test/fixtures/base-options.ts index ab84b2af5b..b9f558d552 100644 --- a/packages/libp2p/test/fixtures/base-options.ts +++ b/packages/libp2p/test/fixtures/base-options.ts @@ -7,7 +7,7 @@ import mergeOptions from 'merge-options' import { circuitRelayTransport } from '../../src/circuit-relay/index.js' import { plaintext } from '../../src/insecure/index.js' import type { Libp2pOptions } from '../../src' -import type { ServiceMap } from '@libp2p/interface-libp2p' +import type { ServiceMap } from '@libp2p/interface' export function createBaseOptions > (...overrides: Array>): Libp2pOptions { const options: Libp2pOptions = { diff --git a/packages/libp2p/test/fixtures/creators/peer.ts b/packages/libp2p/test/fixtures/creators/peer.ts index 1f74db9fe8..d2b005cab7 100644 --- a/packages/libp2p/test/fixtures/creators/peer.ts +++ b/packages/libp2p/test/fixtures/creators/peer.ts @@ -5,8 +5,8 @@ import { createLibp2pNode, type Libp2pNode } from '../../../src/libp2p.js' import { createBaseOptions } from '../base-options.browser.js' import type { AddressManagerInit } from '../../../src/address-manager/index.js' import type { Libp2pOptions } from '../../../src/index.js' -import type { Libp2p, ServiceMap } from '@libp2p/interface-libp2p' -import type { PeerId } from '@libp2p/interface-peer-id' +import type { Libp2p, ServiceMap } from '@libp2p/interface' +import type { PeerId } from '@libp2p/interface/peer-id' const listenAddr = multiaddr('/ip4/127.0.0.1/tcp/0') diff --git a/packages/libp2p/test/fixtures/match-peer-id.ts b/packages/libp2p/test/fixtures/match-peer-id.ts index c7c29aa34a..99f2575cd3 100644 --- a/packages/libp2p/test/fixtures/match-peer-id.ts +++ b/packages/libp2p/test/fixtures/match-peer-id.ts @@ -1,5 +1,5 @@ import Sinon from 'sinon' -import type { PeerId } from '@libp2p/interface-peer-id' +import type { PeerId } from '@libp2p/interface/peer-id' export function matchPeerId (peerId: PeerId): Sinon.SinonMatcher { return Sinon.match(p => p.toString() === peerId.toString()) diff --git a/packages/libp2p/test/identify/index.spec.ts b/packages/libp2p/test/identify/index.spec.ts index ca2f58fa9d..a786b6db98 100644 --- a/packages/libp2p/test/identify/index.spec.ts +++ b/packages/libp2p/test/identify/index.spec.ts @@ -1,9 +1,9 @@ /* eslint-env mocha */ /* eslint max-nested-callbacks: ["error", 6] */ -import { mockConnectionGater, mockRegistrar, mockUpgrader, connectionPair } from '@libp2p/interface-mocks' -import { EventEmitter } from '@libp2p/interfaces/events' -import { start, stop } from '@libp2p/interfaces/startable' +import { EventEmitter } from '@libp2p/interface/events' +import { start, stop } from '@libp2p/interface/startable' +import { mockConnectionGater, mockRegistrar, mockUpgrader, connectionPair } from '@libp2p/interface-compliance-tests/mocks' import { createEd25519PeerId } from '@libp2p/peer-id-factory' import { PeerRecord, RecordEnvelope } from '@libp2p/peer-record' import { PersistentPeerStore } from '@libp2p/peer-store' @@ -31,8 +31,8 @@ import { DefaultIdentifyService } from '../../src/identify/identify.js' import { identifyService, type IdentifyServiceInit, Message } from '../../src/identify/index.js' import { Identify } from '../../src/identify/pb/message.js' import { DefaultTransportManager } from '../../src/transport-manager.js' -import type { IncomingStreamData } from '@libp2p/interface-registrar' -import type { TransportManager } from '@libp2p/interface-transport' +import type { IncomingStreamData } from '@libp2p/interface-internal/registrar' +import type { TransportManager } from '@libp2p/interface-internal/transport-manager' const listenMaddrs = [multiaddr('/ip4/127.0.0.1/tcp/15002/ws')] diff --git a/packages/libp2p/test/identify/push.spec.ts b/packages/libp2p/test/identify/push.spec.ts index f121f82540..02744d27d2 100644 --- a/packages/libp2p/test/identify/push.spec.ts +++ b/packages/libp2p/test/identify/push.spec.ts @@ -1,8 +1,8 @@ /* eslint-env mocha */ -import { mockConnectionGater, mockRegistrar, mockUpgrader, connectionPair } from '@libp2p/interface-mocks' -import { EventEmitter } from '@libp2p/interfaces/events' -import { start, stop } from '@libp2p/interfaces/startable' +import { EventEmitter } from '@libp2p/interface/events' +import { start, stop } from '@libp2p/interface/startable' +import { mockConnectionGater, mockRegistrar, mockUpgrader, connectionPair } from '@libp2p/interface-compliance-tests/mocks' import { createEd25519PeerId } from '@libp2p/peer-id-factory' import { PersistentPeerStore } from '@libp2p/peer-store' import { multiaddr } from '@multiformats/multiaddr' @@ -24,7 +24,7 @@ import { import { DefaultIdentifyService } from '../../src/identify/identify.js' import { DefaultTransportManager } from '../../src/transport-manager.js' import type { IdentifyServiceInit } from '../../src/identify/index.js' -import type { TransportManager } from '@libp2p/interface-transport' +import type { TransportManager } from '@libp2p/interface-internal/transport-manager' const listenMaddrs = [multiaddr('/ip4/127.0.0.1/tcp/15002/ws')] diff --git a/packages/libp2p/test/identify/service.node.ts b/packages/libp2p/test/identify/service.node.ts index 04bef865ad..c99c981b80 100644 --- a/packages/libp2p/test/identify/service.node.ts +++ b/packages/libp2p/test/identify/service.node.ts @@ -8,7 +8,7 @@ import { identifyService } from '../../src/identify/index.js' import { createLibp2pNode } from '../../src/libp2p.js' import { createBaseOptions } from '../fixtures/base-options.js' import { createNode } from '../fixtures/creators/peer.js' -import type { Libp2p } from '@libp2p/interface-libp2p' +import type { Libp2p } from '@libp2p/interface' const LOCAL_PORT = 47321 const REMOTE_PORT = 47322 diff --git a/packages/libp2p/test/identify/service.spec.ts b/packages/libp2p/test/identify/service.spec.ts index f79ba2c37b..8aebc246c7 100644 --- a/packages/libp2p/test/identify/service.spec.ts +++ b/packages/libp2p/test/identify/service.spec.ts @@ -14,8 +14,8 @@ import { identifyService } from '../../src/identify/index.js' import { createLibp2p } from '../../src/index.js' import { createBaseOptions } from '../fixtures/base-options.browser.js' import type { DefaultIdentifyService } from '../../src/identify/identify.js' -import type { Libp2p, IdentifyResult } from '@libp2p/interface-libp2p' -import type { PeerId } from '@libp2p/interface-peer-id' +import type { Libp2p, IdentifyResult } from '@libp2p/interface' +import type { PeerId } from '@libp2p/interface/peer-id' describe('identify', () => { let peerId: PeerId diff --git a/packages/libp2p/test/insecure/compliance.spec.ts b/packages/libp2p/test/insecure/compliance.spec.ts index d51f14ee69..3bc67adc3e 100644 --- a/packages/libp2p/test/insecure/compliance.spec.ts +++ b/packages/libp2p/test/insecure/compliance.spec.ts @@ -1,6 +1,6 @@ /* eslint-env mocha */ -import suite from '@libp2p/interface-connection-encrypter-compliance-tests' +import suite from '@libp2p/interface-compliance-tests/connection-encryption' import { plaintext } from '../../src/insecure/index.js' describe('plaintext compliance', () => { diff --git a/packages/libp2p/test/insecure/plaintext.spec.ts b/packages/libp2p/test/insecure/plaintext.spec.ts index 9e78928ce8..0fe1cc799a 100644 --- a/packages/libp2p/test/insecure/plaintext.spec.ts +++ b/packages/libp2p/test/insecure/plaintext.spec.ts @@ -3,16 +3,16 @@ import { InvalidCryptoExchangeError, UnexpectedPeerError -} from '@libp2p/interface-connection-encrypter/errors' -import { mockMultiaddrConnPair } from '@libp2p/interface-mocks' +} from '@libp2p/interface/errors' +import { mockMultiaddrConnPair } from '@libp2p/interface-compliance-tests/mocks' import { peerIdFromBytes } from '@libp2p/peer-id' import { createEd25519PeerId, createRSAPeerId } from '@libp2p/peer-id-factory' import { multiaddr } from '@multiformats/multiaddr' import { expect } from 'aegir/chai' import sinon from 'sinon' import { plaintext } from '../../src/insecure/index.js' -import type { ConnectionEncrypter } from '@libp2p/interface-connection-encrypter' -import type { PeerId } from '@libp2p/interface-peer-id' +import type { ConnectionEncrypter } from '@libp2p/interface/connection-encrypter' +import type { PeerId } from '@libp2p/interface/peer-id' describe('plaintext', () => { let localPeer: PeerId diff --git a/packages/libp2p/test/interop.ts b/packages/libp2p/test/interop.ts index f9bfd1fb34..bdf3b42fff 100644 --- a/packages/libp2p/test/interop.ts +++ b/packages/libp2p/test/interop.ts @@ -6,9 +6,9 @@ import { unmarshalPrivateKey } from '@libp2p/crypto/keys' import { createClient } from '@libp2p/daemon-client' import { createServer } from '@libp2p/daemon-server' import { floodsub } from '@libp2p/floodsub' -import { contentRouting } from '@libp2p/interface-content-routing' -import { peerDiscovery } from '@libp2p/interface-peer-discovery' -import { peerRouting } from '@libp2p/interface-peer-routing' +import { contentRouting } from '@libp2p/interface/content-routing' +import { peerDiscovery } from '@libp2p/interface/peer-discovery' +import { peerRouting } from '@libp2p/interface/peer-routing' import { interopTests } from '@libp2p/interop' import { kadDHT } from '@libp2p/kad-dht' import { logger } from '@libp2p/logger' @@ -22,8 +22,8 @@ import pDefer from 'p-defer' import { circuitRelayServer, circuitRelayTransport } from '../src/circuit-relay/index.js' import { identifyService } from '../src/identify/index.js' import { createLibp2p, type Libp2pOptions, type ServiceFactoryMap } from '../src/index.js' -import type { ServiceMap } from '@libp2p/interface-libp2p' -import type { PeerId } from '@libp2p/interface-peer-id' +import type { ServiceMap } from '@libp2p/interface' +import type { PeerId } from '@libp2p/interface/peer-id' import type { SpawnOptions, Daemon, DaemonFactory } from '@libp2p/interop' /** @@ -144,8 +144,10 @@ async function createJsPeer (options: SpawnOptions): Promise { if (options.pubsub === true) { if (options.pubsubRouter === 'floodsub') { + // @ts-expect-error floodsub needs upgrading services.pubsub = floodsub() } else { + // @ts-expect-error gossipsub needs upgrading services.pubsub = gossipsub() } } diff --git a/packages/libp2p/test/peer-discovery/index.node.ts b/packages/libp2p/test/peer-discovery/index.node.ts index 099e8c6708..7adfb0c867 100644 --- a/packages/libp2p/test/peer-discovery/index.node.ts +++ b/packages/libp2p/test/peer-discovery/index.node.ts @@ -2,8 +2,8 @@ import { bootstrap } from '@libp2p/bootstrap' import { randomBytes } from '@libp2p/crypto' -import { peerDiscovery } from '@libp2p/interface-peer-discovery' -import { EventEmitter } from '@libp2p/interfaces/events' +import { EventEmitter } from '@libp2p/interface/events' +import { peerDiscovery } from '@libp2p/interface/peer-discovery' import { kadDHT } from '@libp2p/kad-dht' import { mdns } from '@libp2p/mdns' import { multiaddr } from '@multiformats/multiaddr' @@ -15,9 +15,9 @@ import { createLibp2p } from '../../src/index.js' import { createBaseOptions } from '../fixtures/base-options.js' import { createPeerId } from '../fixtures/creators/peer.js' import type { Libp2pOptions } from '../../src/index.js' -import type { Libp2p } from '@libp2p/interface-libp2p' -import type { PeerDiscovery, PeerDiscoveryEvents } from '@libp2p/interface-peer-discovery' -import type { PeerId } from '@libp2p/interface-peer-id' +import type { Libp2p } from '@libp2p/interface' +import type { PeerDiscovery, PeerDiscoveryEvents } from '@libp2p/interface/peer-discovery' +import type { PeerId } from '@libp2p/interface/peer-id' import type { KadDHT } from '@libp2p/kad-dht' const listenAddr = multiaddr('/ip4/127.0.0.1/tcp/0') diff --git a/packages/libp2p/test/peer-discovery/index.spec.ts b/packages/libp2p/test/peer-discovery/index.spec.ts index 9d4e2380c6..c29dee1c3b 100644 --- a/packages/libp2p/test/peer-discovery/index.spec.ts +++ b/packages/libp2p/test/peer-discovery/index.spec.ts @@ -6,9 +6,9 @@ import { stubInterface } from 'sinon-ts' import { createLibp2pNode, type Libp2pNode } from '../../src/libp2p.js' import { createBaseOptions } from '../fixtures/base-options.browser.js' import { createPeerId } from '../fixtures/creators/peer.js' -import type { PeerDiscovery } from '@libp2p/interface-peer-discovery' -import type { PeerId } from '@libp2p/interface-peer-id' -import type { Startable } from '@libp2p/interfaces/startable' +import type { PeerDiscovery } from '@libp2p/interface/peer-discovery' +import type { PeerId } from '@libp2p/interface/peer-id' +import type { Startable } from '@libp2p/interface/startable' describe('peer discovery', () => { describe('basic functions', () => { diff --git a/packages/libp2p/test/peer-routing/peer-routing.node.ts b/packages/libp2p/test/peer-routing/peer-routing.node.ts index a97100f245..4e64d9da7e 100644 --- a/packages/libp2p/test/peer-routing/peer-routing.node.ts +++ b/packages/libp2p/test/peer-routing/peer-routing.node.ts @@ -14,10 +14,10 @@ import { createBaseOptions } from '../fixtures/base-options.js' import { createNode, createPeerId, populateAddressBooks } from '../fixtures/creators/peer.js' import { createRoutingOptions } from './utils.js' import type { Libp2pNode } from '../../src/libp2p.js' -import type { Libp2p } from '@libp2p/interface-libp2p' -import type { PeerId } from '@libp2p/interface-peer-id' -import type { PeerInfo } from '@libp2p/interface-peer-info' -import type { PeerRouting } from '@libp2p/interface-peer-routing' +import type { Libp2p } from '@libp2p/interface' +import type { PeerId } from '@libp2p/interface/peer-id' +import type { PeerInfo } from '@libp2p/interface/peer-info' +import type { PeerRouting } from '@libp2p/interface/peer-routing' describe('peer-routing', () => { let peerId: PeerId diff --git a/packages/libp2p/test/ping/index.spec.ts b/packages/libp2p/test/ping/index.spec.ts index dd47a169a8..66db0a93d3 100644 --- a/packages/libp2p/test/ping/index.spec.ts +++ b/packages/libp2p/test/ping/index.spec.ts @@ -1,8 +1,8 @@ /* eslint-env mocha */ -import { mockRegistrar, mockUpgrader, connectionPair } from '@libp2p/interface-mocks' -import { EventEmitter } from '@libp2p/interfaces/events' -import { start, stop } from '@libp2p/interfaces/startable' +import { EventEmitter } from '@libp2p/interface/events' +import { start, stop } from '@libp2p/interface/startable' +import { mockRegistrar, mockUpgrader, connectionPair } from '@libp2p/interface-compliance-tests/mocks' import { createEd25519PeerId } from '@libp2p/peer-id-factory' import { PersistentPeerStore } from '@libp2p/peer-store' import { expect } from 'aegir/chai' @@ -15,8 +15,8 @@ import { defaultComponents, type Components } from '../../src/components.js' import { DefaultConnectionManager } from '../../src/connection-manager/index.js' import { PROTOCOL } from '../../src/ping/constants.js' import { pingService, type PingServiceInit } from '../../src/ping/index.js' -import type { ConnectionGater } from '@libp2p/interface-connection-gater' -import type { TransportManager } from '@libp2p/interface-transport' +import type { ConnectionGater } from '@libp2p/interface/connection-gater' +import type { TransportManager } from '@libp2p/interface-internal/transport-manager' const defaultInit: PingServiceInit = { protocolPrefix: 'ipfs', diff --git a/packages/libp2p/test/ping/ping.node.ts b/packages/libp2p/test/ping/ping.node.ts index 386a2efb4c..d5c1d18840 100644 --- a/packages/libp2p/test/ping/ping.node.ts +++ b/packages/libp2p/test/ping/ping.node.ts @@ -8,7 +8,7 @@ import { PROTOCOL } from '../../src/ping/constants.js' import { pingService, type PingService } from '../../src/ping/index.js' import { createBaseOptions } from '../fixtures/base-options.js' import { createNode, populateAddressBooks } from '../fixtures/creators/peer.js' -import type { Libp2p } from '@libp2p/interface-libp2p' +import type { Libp2p } from '@libp2p/interface' describe('ping', () => { let nodes: Array> diff --git a/packages/libp2p/test/pnet/index.spec.ts b/packages/libp2p/test/pnet/index.spec.ts index 01567f574f..20812893a0 100644 --- a/packages/libp2p/test/pnet/index.spec.ts +++ b/packages/libp2p/test/pnet/index.spec.ts @@ -1,5 +1,5 @@ /* eslint-env mocha */ -import { mockMultiaddrConnPair } from '@libp2p/interface-mocks' +import { mockMultiaddrConnPair } from '@libp2p/interface-compliance-tests/mocks' import { createEd25519PeerId } from '@libp2p/peer-id-factory' import { multiaddr } from '@multiformats/multiaddr' import { expect } from 'aegir/chai' diff --git a/packages/libp2p/test/registrar/registrar.spec.ts b/packages/libp2p/test/registrar/registrar.spec.ts index 5552814902..6dc954395f 100644 --- a/packages/libp2p/test/registrar/registrar.spec.ts +++ b/packages/libp2p/test/registrar/registrar.spec.ts @@ -1,13 +1,12 @@ /* eslint-env mocha */ import { yamux } from '@chainsafe/libp2p-yamux' -import { mockDuplex, mockMultiaddrConnection, mockUpgrader, mockConnection } from '@libp2p/interface-mocks' -import { CodeError } from '@libp2p/interfaces/errors' -import { EventEmitter } from '@libp2p/interfaces/events' +import { CodeError } from '@libp2p/interface/errors' +import { EventEmitter } from '@libp2p/interface/events' +import { mockDuplex, mockMultiaddrConnection, mockUpgrader, mockConnection } from '@libp2p/interface-compliance-tests/mocks' import { mplex } from '@libp2p/mplex' import { createEd25519PeerId } from '@libp2p/peer-id-factory' import { PersistentPeerStore } from '@libp2p/peer-store' -import { createTopology } from '@libp2p/topology' import { webSockets } from '@libp2p/websockets' import { expect } from 'aegir/chai' import { MemoryDatastore } from 'datastore-core/memory' @@ -21,13 +20,14 @@ import { createLibp2pNode, type Libp2pNode } from '../../src/libp2p.js' import { DefaultRegistrar } from '../../src/registrar.js' import { createPeerId } from '../fixtures/creators/peer.js' import { matchPeerId } from '../fixtures/match-peer-id.js' -import type { ConnectionGater } from '@libp2p/interface-connection-gater' -import type { ConnectionManager } from '@libp2p/interface-connection-manager' -import type { Libp2pEvents } from '@libp2p/interface-libp2p' -import type { PeerId } from '@libp2p/interface-peer-id' -import type { PeerStore } from '@libp2p/interface-peer-store' -import type { Registrar } from '@libp2p/interface-registrar' -import type { TransportManager } from '@libp2p/interface-transport' +import type { Libp2pEvents } from '@libp2p/interface' +import type { ConnectionGater } from '@libp2p/interface/connection-gater' +import type { PeerId } from '@libp2p/interface/peer-id' +import type { PeerStore } from '@libp2p/interface/peer-store' +import type { Topology } from '@libp2p/interface/topology' +import type { ConnectionManager } from '@libp2p/interface-internal/connection-manager' +import type { Registrar } from '@libp2p/interface-internal/registrar' +import type { TransportManager } from '@libp2p/interface-internal/transport-manager' const protocol = '/test/1.0.0' @@ -98,10 +98,10 @@ describe('registrar', () => { }) it('should be able to register a protocol', async () => { - const topology = createTopology({ + const topology: Topology = { onConnect: () => { }, onDisconnect: () => { } - }) + } expect(registrar.getTopologies(protocol)).to.have.lengthOf(0) @@ -112,10 +112,10 @@ describe('registrar', () => { }) it('should be able to unregister a protocol', async () => { - const topology = createTopology({ + const topology: Topology = { onConnect: () => { }, onDisconnect: () => { } - }) + } expect(registrar.getTopologies(protocol)).to.have.lengthOf(0) @@ -143,7 +143,7 @@ describe('registrar', () => { // return connection from connection manager connectionManager.getConnections.withArgs(matchPeerId(remotePeerId)).returns([conn]) - const topology = createTopology({ + const topology: Topology = { onConnect: (peerId, connection) => { expect(peerId.equals(remotePeerId)).to.be.true() expect(connection.id).to.eql(conn.id) @@ -155,7 +155,7 @@ describe('registrar', () => { onDisconnectDefer.resolve() } - }) + } // Register protocol await registrar.register(protocol, topology) @@ -194,14 +194,14 @@ describe('registrar', () => { // return connection from connection manager connectionManager.getConnections.withArgs(matchPeerId(remotePeerId)).returns([conn]) - const topology = createTopology({ + const topology: Topology = { onConnect: () => { onConnectDefer.resolve() }, onDisconnect: () => { onDisconnectDefer.resolve() } - }) + } // Register protocol await registrar.register(protocol, topology) diff --git a/packages/libp2p/test/transports/transport-manager.node.ts b/packages/libp2p/test/transports/transport-manager.node.ts index 033bd81638..bff2e28fb7 100644 --- a/packages/libp2p/test/transports/transport-manager.node.ts +++ b/packages/libp2p/test/transports/transport-manager.node.ts @@ -1,7 +1,7 @@ /* eslint-env mocha */ -import { mockUpgrader } from '@libp2p/interface-mocks' -import { EventEmitter } from '@libp2p/interfaces/events' +import { EventEmitter } from '@libp2p/interface/events' +import { mockUpgrader } from '@libp2p/interface-compliance-tests/mocks' import { createEd25519PeerId } from '@libp2p/peer-id-factory' import { PersistentPeerStore } from '@libp2p/peer-store' import { tcp } from '@libp2p/tcp' @@ -14,7 +14,7 @@ import sinon from 'sinon' import { DefaultAddressManager } from '../../src/address-manager/index.js' import { defaultComponents, type Components } from '../../src/components.js' import { DefaultTransportManager } from '../../src/transport-manager.js' -import type { PeerId } from '@libp2p/interface-peer-id' +import type { PeerId } from '@libp2p/interface/peer-id' const addrs = [ multiaddr('/ip4/127.0.0.1/tcp/0'), diff --git a/packages/libp2p/test/transports/transport-manager.spec.ts b/packages/libp2p/test/transports/transport-manager.spec.ts index 1552eb39a6..1a996f76f0 100644 --- a/packages/libp2p/test/transports/transport-manager.spec.ts +++ b/packages/libp2p/test/transports/transport-manager.spec.ts @@ -1,8 +1,8 @@ /* eslint-env mocha */ -import { mockUpgrader } from '@libp2p/interface-mocks' -import { FaultTolerance } from '@libp2p/interface-transport' -import { EventEmitter } from '@libp2p/interfaces/events' +import { EventEmitter } from '@libp2p/interface/events' +import { FaultTolerance } from '@libp2p/interface/transport' +import { mockUpgrader } from '@libp2p/interface-compliance-tests/mocks' import { createEd25519PeerId } from '@libp2p/peer-id-factory' import { webSockets } from '@libp2p/websockets' import * as filters from '@libp2p/websockets/filters' @@ -15,8 +15,8 @@ import { createLibp2p } from '../../src/index.js' import { plaintext } from '../../src/insecure/index.js' import { DefaultTransportManager } from '../../src/transport-manager.js' import type { Components } from '../../src/components.js' -import type { Libp2p } from '@libp2p/interface-libp2p' -import type { PeerId } from '@libp2p/interface-peer-id' +import type { Libp2p } from '@libp2p/interface' +import type { PeerId } from '@libp2p/interface/peer-id' const listenAddr = multiaddr('/ip4/127.0.0.1/tcp/0') diff --git a/packages/libp2p/test/upgrading/upgrader.spec.ts b/packages/libp2p/test/upgrading/upgrader.spec.ts index 62ecbbfd87..2ffd56fca7 100644 --- a/packages/libp2p/test/upgrading/upgrader.spec.ts +++ b/packages/libp2p/test/upgrading/upgrader.spec.ts @@ -1,8 +1,8 @@ /* eslint-env mocha */ import { yamux } from '@chainsafe/libp2p-yamux' -import { mockConnectionGater, mockConnectionManager, mockMultiaddrConnPair, mockRegistrar, mockStream, mockMuxer } from '@libp2p/interface-mocks' -import { EventEmitter } from '@libp2p/interfaces/events' +import { EventEmitter } from '@libp2p/interface/events' +import { mockConnectionGater, mockConnectionManager, mockMultiaddrConnPair, mockRegistrar, mockStream, mockMuxer } from '@libp2p/interface-compliance-tests/mocks' import { mplex } from '@libp2p/mplex' import { createEd25519PeerId } from '@libp2p/peer-id-factory' import { PersistentPeerStore } from '@libp2p/peer-store' @@ -30,12 +30,12 @@ import { preSharedKey } from '../../src/pnet/index.js' import { DEFAULT_MAX_OUTBOUND_STREAMS } from '../../src/registrar.js' import { DefaultUpgrader } from '../../src/upgrader.js' import swarmKey from '../fixtures/swarm.key.js' -import type { Connection, ConnectionProtector, Stream } from '@libp2p/interface-connection' -import type { ConnectionEncrypter, SecuredConnection } from '@libp2p/interface-connection-encrypter' -import type { Libp2p } from '@libp2p/interface-libp2p' -import type { PeerId } from '@libp2p/interface-peer-id' -import type { StreamMuxer, StreamMuxerFactory, StreamMuxerInit } from '@libp2p/interface-stream-muxer' -import type { Upgrader } from '@libp2p/interface-transport' +import type { Libp2p } from '@libp2p/interface' +import type { Connection, ConnectionProtector, Stream } from '@libp2p/interface/connection' +import type { ConnectionEncrypter, SecuredConnection } from '@libp2p/interface/connection-encrypter' +import type { PeerId } from '@libp2p/interface/peer-id' +import type { StreamMuxer, StreamMuxerFactory, StreamMuxerInit } from '@libp2p/interface/stream-muxer' +import type { Upgrader } from '@libp2p/interface/transport' const addrs = [ multiaddr('/ip4/127.0.0.1/tcp/0'), diff --git a/packages/libp2p/test/upnp-nat/upnp-nat.node.ts b/packages/libp2p/test/upnp-nat/upnp-nat.node.ts index 28e4b7bf31..dee88506e2 100644 --- a/packages/libp2p/test/upnp-nat/upnp-nat.node.ts +++ b/packages/libp2p/test/upnp-nat/upnp-nat.node.ts @@ -1,9 +1,9 @@ /* eslint-env mocha */ -import { mockUpgrader } from '@libp2p/interface-mocks' -import { FaultTolerance } from '@libp2p/interface-transport' -import { EventEmitter } from '@libp2p/interfaces/events' -import { start, stop } from '@libp2p/interfaces/startable' +import { EventEmitter } from '@libp2p/interface/events' +import { start, stop } from '@libp2p/interface/startable' +import { FaultTolerance } from '@libp2p/interface/transport' +import { mockUpgrader } from '@libp2p/interface-compliance-tests/mocks' import { createEd25519PeerId } from '@libp2p/peer-id-factory' import { tcp } from '@libp2p/tcp' import { multiaddr } from '@multiformats/multiaddr' @@ -17,9 +17,9 @@ import { codes } from '../../src/errors.js' import { DefaultTransportManager } from '../../src/transport-manager.js' import { uPnPNATService } from '../../src/upnp-nat/index.js' import type { NatAPI } from '@achingbrain/nat-port-mapper' -import type { PeerUpdate } from '@libp2p/interface-libp2p' -import type { PeerId } from '@libp2p/interface-peer-id' -import type { PeerData, PeerStore } from '@libp2p/interface-peer-store' +import type { PeerUpdate } from '@libp2p/interface' +import type { PeerId } from '@libp2p/interface/peer-id' +import type { PeerData, PeerStore } from '@libp2p/interface/peer-store' const DEFAULT_ADDRESSES = [ '/ip4/127.0.0.1/tcp/0', diff --git a/packages/libp2p/tsconfig.json b/packages/libp2p/tsconfig.json index e4667a71b2..4c428d0b8b 100644 --- a/packages/libp2p/tsconfig.json +++ b/packages/libp2p/tsconfig.json @@ -12,76 +12,13 @@ "path": "../crypto" }, { - "path": "../interface-address-manager" + "path": "../interface" }, { "path": "../interface-compliance-tests" }, { - "path": "../interface-connection" - }, - { - "path": "../interface-connection-compliance-tests" - }, - { - "path": "../interface-connection-encrypter" - }, - { - "path": "../interface-connection-encrypter-compliance-tests" - }, - { - "path": "../interface-connection-gater" - }, - { - "path": "../interface-connection-manager" - }, - { - "path": "../interface-content-routing" - }, - { - "path": "../interface-keychain" - }, - { - "path": "../interface-libp2p" - }, - { - "path": "../interface-metrics" - }, - { - "path": "../interface-mocks" - }, - { - "path": "../interface-peer-discovery" - }, - { - "path": "../interface-peer-id" - }, - { - "path": "../interface-peer-info" - }, - { - "path": "../interface-peer-routing" - }, - { - "path": "../interface-peer-store" - }, - { - "path": "../interface-pubsub" - }, - { - "path": "../interface-record" - }, - { - "path": "../interface-registrar" - }, - { - "path": "../interface-stream-muxer" - }, - { - "path": "../interface-transport" - }, - { - "path": "../interfaces" + "path": "../interface-internal" }, { "path": "../kad-dht" @@ -119,12 +56,6 @@ { "path": "../stream-multiplexer-mplex" }, - { - "path": "../topology" - }, - { - "path": "../tracked-map" - }, { "path": "../transport-tcp" }, diff --git a/packages/logger/package.json b/packages/logger/package.json index 0a24ab4199..f7d269eecf 100644 --- a/packages/logger/package.json +++ b/packages/logger/package.json @@ -48,17 +48,17 @@ "test:electron-main": "aegir test -t electron-main" }, "dependencies": { - "@libp2p/interface-peer-id": "^2.0.0", + "@libp2p/interface": "~0.0.1", "@multiformats/multiaddr": "^12.1.3", "debug": "^4.3.4", "interface-datastore": "^8.2.0", - "multiformats": "^11.0.2" + "multiformats": "^12.0.1" }, "devDependencies": { "@libp2p/peer-id": "^2.0.0", "@types/debug": "^4.1.7", "aegir": "^39.0.10", - "sinon": "^15.1.0", + "sinon": "^15.1.2", "uint8arrays": "^4.0.3" }, "typedoc": { diff --git a/packages/logger/src/index.ts b/packages/logger/src/index.ts index c50728146c..9597aa813a 100644 --- a/packages/logger/src/index.ts +++ b/packages/logger/src/index.ts @@ -2,7 +2,7 @@ import debug from 'debug' import { base32 } from 'multiformats/bases/base32' import { base58btc } from 'multiformats/bases/base58' import { base64 } from 'multiformats/bases/base64' -import type { PeerId } from '@libp2p/interface-peer-id' +import type { PeerId } from '@libp2p/interface/peer-id' import type { Multiaddr } from '@multiformats/multiaddr' import type { Key } from 'interface-datastore' import type { CID } from 'multiformats/cid' diff --git a/packages/logger/tsconfig.json b/packages/logger/tsconfig.json index 38a80e7a63..7900c5e27d 100644 --- a/packages/logger/tsconfig.json +++ b/packages/logger/tsconfig.json @@ -9,7 +9,7 @@ ], "references": [ { - "path": "../interface-peer-id" + "path": "../interface" }, { "path": "../peer-id" diff --git a/packages/metrics-prometheus/package.json b/packages/metrics-prometheus/package.json index a6c2fce62f..85a69775ee 100644 --- a/packages/metrics-prometheus/package.json +++ b/packages/metrics-prometheus/package.json @@ -42,15 +42,14 @@ "test:electron-main": "aegir test -t electron-main --cov" }, "dependencies": { - "@libp2p/interface-connection": "^5.0.0", - "@libp2p/interface-metrics": "^4.0.0", + "@libp2p/interface": "~0.0.1", "@libp2p/logger": "^2.0.0", "it-foreach": "^2.0.3", "it-stream-types": "^2.0.1", "prom-client": "^14.1.0" }, "devDependencies": { - "@libp2p/interface-mocks": "^12.0.0", + "@libp2p/interface-compliance-tests": "^3.0.0", "@libp2p/peer-id-factory": "^2.0.0", "@multiformats/multiaddr": "^12.1.3", "aegir": "^39.0.10", diff --git a/packages/metrics-prometheus/src/counter-group.ts b/packages/metrics-prometheus/src/counter-group.ts index 6cd52abdde..077255e060 100644 --- a/packages/metrics-prometheus/src/counter-group.ts +++ b/packages/metrics-prometheus/src/counter-group.ts @@ -1,7 +1,7 @@ import { Counter as PromCounter, type CollectFunction } from 'prom-client' import { normaliseString, type CalculatedMetric } from './utils.js' import type { PrometheusCalculatedMetricOptions } from './index.js' -import type { CounterGroup, CalculateMetric } from '@libp2p/interface-metrics' +import type { CounterGroup, CalculateMetric } from '@libp2p/interface/metrics' export class PrometheusCounterGroup implements CounterGroup, CalculatedMetric> { private readonly counter: PromCounter diff --git a/packages/metrics-prometheus/src/counter.ts b/packages/metrics-prometheus/src/counter.ts index 3dacf85322..7e34452cee 100644 --- a/packages/metrics-prometheus/src/counter.ts +++ b/packages/metrics-prometheus/src/counter.ts @@ -1,7 +1,7 @@ import { type CollectFunction, Counter as PromCounter } from 'prom-client' import { normaliseString, type CalculatedMetric } from './utils.js' import type { PrometheusCalculatedMetricOptions } from './index.js' -import type { CalculateMetric, Counter } from '@libp2p/interface-metrics' +import type { CalculateMetric, Counter } from '@libp2p/interface/metrics' export class PrometheusCounter implements Counter, CalculatedMetric { private readonly counter: PromCounter diff --git a/packages/metrics-prometheus/src/index.ts b/packages/metrics-prometheus/src/index.ts index e8fad3b0bd..b2b35073dc 100644 --- a/packages/metrics-prometheus/src/index.ts +++ b/packages/metrics-prometheus/src/index.ts @@ -101,8 +101,8 @@ import { PrometheusCounterGroup } from './counter-group.js' import { PrometheusCounter } from './counter.js' import { PrometheusMetricGroup } from './metric-group.js' import { PrometheusMetric } from './metric.js' -import type { MultiaddrConnection, Stream, Connection } from '@libp2p/interface-connection' -import type { CalculatedMetricOptions, Counter, CounterGroup, Metric, MetricGroup, MetricOptions, Metrics } from '@libp2p/interface-metrics' +import type { MultiaddrConnection, Stream, Connection } from '@libp2p/interface/connection' +import type { CalculatedMetricOptions, Counter, CounterGroup, Metric, MetricGroup, MetricOptions, Metrics } from '@libp2p/interface/metrics' import type { Duplex, Source } from 'it-stream-types' const log = logger('libp2p:prometheus-metrics') diff --git a/packages/metrics-prometheus/src/metric-group.ts b/packages/metrics-prometheus/src/metric-group.ts index 302def85fc..652e99bbcc 100644 --- a/packages/metrics-prometheus/src/metric-group.ts +++ b/packages/metrics-prometheus/src/metric-group.ts @@ -1,7 +1,7 @@ import { type CollectFunction, Gauge } from 'prom-client' import { normaliseString, type CalculatedMetric } from './utils.js' import type { PrometheusCalculatedMetricOptions } from './index.js' -import type { CalculateMetric, MetricGroup, StopTimer } from '@libp2p/interface-metrics' +import type { CalculateMetric, MetricGroup, StopTimer } from '@libp2p/interface/metrics' export class PrometheusMetricGroup implements MetricGroup, CalculatedMetric> { private readonly gauge: Gauge diff --git a/packages/metrics-prometheus/src/metric.ts b/packages/metrics-prometheus/src/metric.ts index bc65b5c916..fc61570f26 100644 --- a/packages/metrics-prometheus/src/metric.ts +++ b/packages/metrics-prometheus/src/metric.ts @@ -1,7 +1,7 @@ import { type CollectFunction, Gauge } from 'prom-client' import { normaliseString } from './utils.js' import type { PrometheusCalculatedMetricOptions } from './index.js' -import type { Metric, StopTimer, CalculateMetric } from '@libp2p/interface-metrics' +import type { Metric, StopTimer, CalculateMetric } from '@libp2p/interface/metrics' export class PrometheusMetric implements Metric { private readonly gauge: Gauge diff --git a/packages/metrics-prometheus/src/utils.ts b/packages/metrics-prometheus/src/utils.ts index 4ec136b846..4e70930df8 100644 --- a/packages/metrics-prometheus/src/utils.ts +++ b/packages/metrics-prometheus/src/utils.ts @@ -1,4 +1,4 @@ -import type { CalculateMetric } from '@libp2p/interface-metrics' +import type { CalculateMetric } from '@libp2p/interface/metrics' export interface CalculatedMetric { addCalculator: (calculator: CalculateMetric) => void diff --git a/packages/metrics-prometheus/test/streams.spec.ts b/packages/metrics-prometheus/test/streams.spec.ts index 5cfba71e83..1198dcae44 100644 --- a/packages/metrics-prometheus/test/streams.spec.ts +++ b/packages/metrics-prometheus/test/streams.spec.ts @@ -1,4 +1,4 @@ -import { connectionPair, mockRegistrar, mockMultiaddrConnPair } from '@libp2p/interface-mocks' +import { connectionPair, mockRegistrar, mockMultiaddrConnPair } from '@libp2p/interface-compliance-tests/mocks' import { createEd25519PeerId } from '@libp2p/peer-id-factory' import { multiaddr } from '@multiformats/multiaddr' import { expect } from 'aegir/chai' @@ -7,7 +7,7 @@ import { pipe } from 'it-pipe' import defer from 'p-defer' import client from 'prom-client' import { prometheusMetrics } from '../src/index.js' -import type { Connection } from '@libp2p/interface-connection' +import type { Connection } from '@libp2p/interface/connection' describe('streams', () => { let connectionA: Connection diff --git a/packages/metrics-prometheus/tsconfig.json b/packages/metrics-prometheus/tsconfig.json index 20f43dc904..6083208574 100644 --- a/packages/metrics-prometheus/tsconfig.json +++ b/packages/metrics-prometheus/tsconfig.json @@ -9,13 +9,10 @@ ], "references": [ { - "path": "../interface-connection" + "path": "../interface" }, { - "path": "../interface-metrics" - }, - { - "path": "../interface-mocks" + "path": "../interface-compliance-tests" }, { "path": "../logger" diff --git a/packages/multistream-select/package.json b/packages/multistream-select/package.json index 156907a437..767c2a6e7f 100644 --- a/packages/multistream-select/package.json +++ b/packages/multistream-select/package.json @@ -52,7 +52,7 @@ "test:electron-main": "aegir test -t electron-main" }, "dependencies": { - "@libp2p/interfaces": "^3.0.0", + "@libp2p/interface": "~0.0.1", "@libp2p/logger": "^2.0.0", "abortable-iterator": "^5.0.1", "it-first": "^3.0.1", @@ -64,7 +64,7 @@ "it-reader": "^6.0.1", "it-stream-types": "^2.0.1", "uint8arraylist": "^2.4.3", - "uint8arrays": "^4.0.3" + "uint8arrays": "^4.0.4" }, "devDependencies": { "@types/varint": "^6.0.0", diff --git a/packages/multistream-select/src/index.ts b/packages/multistream-select/src/index.ts index 651fd77cce..efe37ef346 100644 --- a/packages/multistream-select/src/index.ts +++ b/packages/multistream-select/src/index.ts @@ -1,5 +1,5 @@ import { PROTOCOL_ID } from './constants.js' -import type { AbortOptions } from '@libp2p/interfaces' +import type { AbortOptions } from '@libp2p/interface' import type { Duplex, Source } from 'it-stream-types' export { PROTOCOL_ID } diff --git a/packages/multistream-select/src/multistream.ts b/packages/multistream-select/src/multistream.ts index 65eda32839..6719fb1ebc 100644 --- a/packages/multistream-select/src/multistream.ts +++ b/packages/multistream-select/src/multistream.ts @@ -1,5 +1,5 @@ -import { CodeError } from '@libp2p/interfaces/errors' +import { CodeError } from '@libp2p/interface/errors' import { logger } from '@libp2p/logger' import { abortableSource } from 'abortable-iterator' import first from 'it-first' @@ -10,7 +10,7 @@ import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' import { toString as uint8ArrayToString } from 'uint8arrays/to-string' import { MAX_PROTOCOL_LENGTH } from './constants.js' import type { MultistreamSelectInit } from '.' -import type { AbortOptions } from '@libp2p/interfaces' +import type { AbortOptions } from '@libp2p/interface' import type { Pushable } from 'it-pushable' import type { Reader } from 'it-reader' import type { Source } from 'it-stream-types' diff --git a/packages/multistream-select/src/select.ts b/packages/multistream-select/src/select.ts index 71dafed647..e5145c46c5 100644 --- a/packages/multistream-select/src/select.ts +++ b/packages/multistream-select/src/select.ts @@ -1,4 +1,4 @@ -import { CodeError } from '@libp2p/interfaces/errors' +import { CodeError } from '@libp2p/interface/errors' import { logger } from '@libp2p/logger' import { handshake } from 'it-handshake' import merge from 'it-merge' diff --git a/packages/multistream-select/tsconfig.json b/packages/multistream-select/tsconfig.json index 4f2b857b3b..b382e52ffe 100644 --- a/packages/multistream-select/tsconfig.json +++ b/packages/multistream-select/tsconfig.json @@ -9,7 +9,7 @@ ], "references": [ { - "path": "../interfaces" + "path": "../interface" }, { "path": "../logger" diff --git a/packages/peer-collections/package.json b/packages/peer-collections/package.json index b2b2990ab3..d267007b1a 100644 --- a/packages/peer-collections/package.json +++ b/packages/peer-collections/package.json @@ -48,7 +48,7 @@ "test:electron-main": "aegir test -t electron-main" }, "dependencies": { - "@libp2p/interface-peer-id": "^2.0.0", + "@libp2p/interface": "~0.0.1", "@libp2p/peer-id": "^2.0.0" }, "devDependencies": { diff --git a/packages/peer-collections/src/list.ts b/packages/peer-collections/src/list.ts index 562ef50a5f..85aef3be23 100644 --- a/packages/peer-collections/src/list.ts +++ b/packages/peer-collections/src/list.ts @@ -1,6 +1,6 @@ import { peerIdFromString } from '@libp2p/peer-id' import { mapIterable } from './util.js' -import type { PeerId } from '@libp2p/interface-peer-id' +import type { PeerId } from '@libp2p/interface/peer-id' /** * We can't use PeerIds as list entries because list entries are diff --git a/packages/peer-collections/src/map.ts b/packages/peer-collections/src/map.ts index aa54fe8465..8c31af330b 100644 --- a/packages/peer-collections/src/map.ts +++ b/packages/peer-collections/src/map.ts @@ -1,6 +1,6 @@ import { peerIdFromString } from '@libp2p/peer-id' import { mapIterable } from './util.js' -import type { PeerId } from '@libp2p/interface-peer-id' +import type { PeerId } from '@libp2p/interface/peer-id' /** * We can't use PeerIds as map keys because map keys are diff --git a/packages/peer-collections/src/set.ts b/packages/peer-collections/src/set.ts index b238c3db65..355c9a1581 100644 --- a/packages/peer-collections/src/set.ts +++ b/packages/peer-collections/src/set.ts @@ -1,6 +1,6 @@ import { peerIdFromString } from '@libp2p/peer-id' import { mapIterable } from './util.js' -import type { PeerId } from '@libp2p/interface-peer-id' +import type { PeerId } from '@libp2p/interface/peer-id' /** * We can't use PeerIds as set entries because set entries are diff --git a/packages/peer-collections/test/set.spec.ts b/packages/peer-collections/test/set.spec.ts index 27e12fab6b..3479a19e23 100644 --- a/packages/peer-collections/test/set.spec.ts +++ b/packages/peer-collections/test/set.spec.ts @@ -2,7 +2,7 @@ import { peerIdFromBytes } from '@libp2p/peer-id' import { createEd25519PeerId } from '@libp2p/peer-id-factory' import { expect } from 'aegir/chai' import { PeerSet } from '../src/index.js' -import type { PeerId } from '@libp2p/interface-peer-id' +import type { PeerId } from '@libp2p/interface/peer-id' describe('peer-set', () => { it('should return a set', async () => { diff --git a/packages/peer-collections/tsconfig.json b/packages/peer-collections/tsconfig.json index 6a53317368..4795efb1d1 100644 --- a/packages/peer-collections/tsconfig.json +++ b/packages/peer-collections/tsconfig.json @@ -9,7 +9,7 @@ ], "references": [ { - "path": "../interface-peer-id" + "path": "../interface" }, { "path": "../peer-id" diff --git a/packages/peer-discovery-bootstrap/package.json b/packages/peer-discovery-bootstrap/package.json index 792fcabd24..ca2713f651 100644 --- a/packages/peer-discovery-bootstrap/package.json +++ b/packages/peer-discovery-bootstrap/package.json @@ -48,18 +48,14 @@ "test:electron-main": "aegir test -t electron-main" }, "dependencies": { - "@libp2p/interface-peer-discovery": "^2.0.0", - "@libp2p/interface-peer-info": "^1.0.0", - "@libp2p/interface-peer-store": "^2.0.0", - "@libp2p/interfaces": "^3.0.0", + "@libp2p/interface": "~0.0.1", "@libp2p/logger": "^2.0.0", "@libp2p/peer-id": "^2.0.0", "@multiformats/mafmt": "^12.1.2", "@multiformats/multiaddr": "^12.1.3" }, "devDependencies": { - "@libp2p/interface-peer-discovery-compliance-tests": "^2.0.0", - "@libp2p/interface-peer-id": "^2.0.0", + "@libp2p/interface-compliance-tests": "^3.0.0", "aegir": "^39.0.10", "sinon-ts": "^1.0.0" }, diff --git a/packages/peer-discovery-bootstrap/src/index.ts b/packages/peer-discovery-bootstrap/src/index.ts index e283223b21..1debb10fc6 100644 --- a/packages/peer-discovery-bootstrap/src/index.ts +++ b/packages/peer-discovery-bootstrap/src/index.ts @@ -1,13 +1,13 @@ -import { peerDiscovery } from '@libp2p/interface-peer-discovery' -import { EventEmitter } from '@libp2p/interfaces/events' +import { EventEmitter } from '@libp2p/interface/events' +import { peerDiscovery } from '@libp2p/interface/peer-discovery' import { logger } from '@libp2p/logger' import { peerIdFromString } from '@libp2p/peer-id' import { P2P } from '@multiformats/mafmt' import { multiaddr } from '@multiformats/multiaddr' -import type { PeerDiscovery, PeerDiscoveryEvents } from '@libp2p/interface-peer-discovery' -import type { PeerInfo } from '@libp2p/interface-peer-info' -import type { PeerStore } from '@libp2p/interface-peer-store' -import type { Startable } from '@libp2p/interfaces/dist/src/startable' +import type { PeerDiscovery, PeerDiscoveryEvents } from '@libp2p/interface/peer-discovery' +import type { PeerInfo } from '@libp2p/interface/peer-info' +import type { PeerStore } from '@libp2p/interface/peer-store' +import type { Startable } from '@libp2p/interface/startable' const log = logger('libp2p:bootstrap') diff --git a/packages/peer-discovery-bootstrap/test/bootstrap.spec.ts b/packages/peer-discovery-bootstrap/test/bootstrap.spec.ts index 4213385204..3dd7bc27ee 100644 --- a/packages/peer-discovery-bootstrap/test/bootstrap.spec.ts +++ b/packages/peer-discovery-bootstrap/test/bootstrap.spec.ts @@ -1,7 +1,7 @@ /* eslint-env mocha */ -import { isPeerId } from '@libp2p/interface-peer-id' -import { start, stop } from '@libp2p/interfaces/startable' +import { isPeerId } from '@libp2p/interface/peer-id' +import { start, stop } from '@libp2p/interface/startable' import { peerIdFromString } from '@libp2p/peer-id' import { IPFS } from '@multiformats/mafmt' import { multiaddr } from '@multiformats/multiaddr' @@ -10,7 +10,7 @@ import { type StubbedInstance, stubInterface } from 'sinon-ts' import { bootstrap, type BootstrapComponents } from '../src/index.js' import peerList from './fixtures/default-peers.js' import partialValidPeerList from './fixtures/some-invalid-peers.js' -import type { PeerStore } from '@libp2p/interface-peer-store' +import type { PeerStore } from '@libp2p/interface/peer-store' describe('bootstrap', () => { let components: BootstrapComponents diff --git a/packages/peer-discovery-bootstrap/test/compliance.spec.ts b/packages/peer-discovery-bootstrap/test/compliance.spec.ts index 7afc7dba12..2d3b68ee70 100644 --- a/packages/peer-discovery-bootstrap/test/compliance.spec.ts +++ b/packages/peer-discovery-bootstrap/test/compliance.spec.ts @@ -1,10 +1,10 @@ /* eslint-env mocha */ -import tests from '@libp2p/interface-peer-discovery-compliance-tests' +import tests from '@libp2p/interface-compliance-tests/peer-discovery' import { stubInterface } from 'sinon-ts' import { bootstrap } from '../src/index.js' import peerList from './fixtures/default-peers.js' -import type { PeerStore } from '@libp2p/interface-peer-store' +import type { PeerStore } from '@libp2p/interface/peer-store' describe('compliance tests', () => { tests({ diff --git a/packages/peer-discovery-bootstrap/tsconfig.json b/packages/peer-discovery-bootstrap/tsconfig.json index 954f3f631c..51b0155870 100644 --- a/packages/peer-discovery-bootstrap/tsconfig.json +++ b/packages/peer-discovery-bootstrap/tsconfig.json @@ -11,22 +11,10 @@ ], "references": [ { - "path": "../interface-peer-discovery" + "path": "../interface" }, { - "path": "../interface-peer-discovery-compliance-tests" - }, - { - "path": "../interface-peer-id" - }, - { - "path": "../interface-peer-info" - }, - { - "path": "../interface-peer-store" - }, - { - "path": "../interfaces" + "path": "../interface-compliance-tests" }, { "path": "../logger" diff --git a/packages/peer-discovery-mdns/package.json b/packages/peer-discovery-mdns/package.json index 7c2969d741..23fe0fa314 100644 --- a/packages/peer-discovery-mdns/package.json +++ b/packages/peer-discovery-mdns/package.json @@ -44,9 +44,7 @@ "test:electron-main": "aegir test -t electron-main" }, "dependencies": { - "@libp2p/interface-peer-discovery": "^2.0.0", - "@libp2p/interface-peer-info": "^1.0.0", - "@libp2p/interfaces": "^3.0.0", + "@libp2p/interface": "~0.0.1", "@libp2p/logger": "^2.0.0", "@libp2p/peer-id": "^2.0.0", "@multiformats/multiaddr": "^12.1.3", @@ -55,9 +53,8 @@ "multicast-dns": "^7.2.5" }, "devDependencies": { - "@libp2p/interface-address-manager": "^3.0.0", - "@libp2p/interface-peer-discovery-compliance-tests": "^2.0.0", - "@libp2p/interface-peer-id": "^2.0.0", + "@libp2p/interface-compliance-tests": "^3.0.0", + "@libp2p/interface-internal": "~0.0.1", "@libp2p/peer-id-factory": "^2.0.0", "aegir": "^39.0.10", "p-wait-for": "^5.0.0", diff --git a/packages/peer-discovery-mdns/src/index.ts b/packages/peer-discovery-mdns/src/index.ts index 1d49e45555..4f2f36ab89 100644 --- a/packages/peer-discovery-mdns/src/index.ts +++ b/packages/peer-discovery-mdns/src/index.ts @@ -1,12 +1,12 @@ -import { peerDiscovery } from '@libp2p/interface-peer-discovery' -import { CustomEvent, EventEmitter } from '@libp2p/interfaces/events' +import { CustomEvent, EventEmitter } from '@libp2p/interface/events' +import { peerDiscovery } from '@libp2p/interface/peer-discovery' import { logger } from '@libp2p/logger' import multicastDNS from 'multicast-dns' import * as query from './query.js' import { stringGen } from './utils.js' -import type { AddressManager } from '@libp2p/interface-address-manager' -import type { PeerDiscovery, PeerDiscoveryEvents } from '@libp2p/interface-peer-discovery' -import type { PeerInfo } from '@libp2p/interface-peer-info' +import type { PeerDiscovery, PeerDiscoveryEvents } from '@libp2p/interface/peer-discovery' +import type { PeerInfo } from '@libp2p/interface/peer-info' +import type { AddressManager } from '@libp2p/interface-internal/address-manager' const log = logger('libp2p:mdns') diff --git a/packages/peer-discovery-mdns/src/query.ts b/packages/peer-discovery-mdns/src/query.ts index da0e854087..f1ae075a82 100644 --- a/packages/peer-discovery-mdns/src/query.ts +++ b/packages/peer-discovery-mdns/src/query.ts @@ -1,7 +1,7 @@ import { logger } from '@libp2p/logger' import { peerIdFromString } from '@libp2p/peer-id' import { multiaddr, type Multiaddr } from '@multiformats/multiaddr' -import type { PeerInfo } from '@libp2p/interface-peer-info' +import type { PeerInfo } from '@libp2p/interface/peer-info' import type { Answer, StringAnswer, TxtAnswer } from 'dns-packet' import type { MulticastDNS, QueryPacket, ResponsePacket } from 'multicast-dns' diff --git a/packages/peer-discovery-mdns/test/compliance.spec.ts b/packages/peer-discovery-mdns/test/compliance.spec.ts index e9b00b62f9..a823f9ed35 100644 --- a/packages/peer-discovery-mdns/test/compliance.spec.ts +++ b/packages/peer-discovery-mdns/test/compliance.spec.ts @@ -1,13 +1,13 @@ /* eslint-env mocha */ -import tests from '@libp2p/interface-peer-discovery-compliance-tests' -import { CustomEvent } from '@libp2p/interfaces/events' +import { CustomEvent } from '@libp2p/interface/events' +import tests from '@libp2p/interface-compliance-tests/peer-discovery' import { createEd25519PeerId } from '@libp2p/peer-id-factory' import { multiaddr } from '@multiformats/multiaddr' import { stubInterface } from 'ts-sinon' import { mdns } from '../src/index.js' -import type { AddressManager } from '@libp2p/interface-address-manager' -import type { PeerDiscovery } from '@libp2p/interface-peer-discovery' +import type { PeerDiscovery } from '@libp2p/interface/peer-discovery' +import type { AddressManager } from '@libp2p/interface-internal/address-manager' let discovery: PeerDiscovery diff --git a/packages/peer-discovery-mdns/test/multicast-dns.spec.ts b/packages/peer-discovery-mdns/test/multicast-dns.spec.ts index 62613717e3..3ddf5c8ea9 100644 --- a/packages/peer-discovery-mdns/test/multicast-dns.spec.ts +++ b/packages/peer-discovery-mdns/test/multicast-dns.spec.ts @@ -1,15 +1,15 @@ /* eslint-env mocha */ -import { start, stop } from '@libp2p/interfaces/startable' +import { start, stop } from '@libp2p/interface/startable' import { createEd25519PeerId } from '@libp2p/peer-id-factory' import { multiaddr } from '@multiformats/multiaddr' import { expect } from 'aegir/chai' import pWaitFor from 'p-wait-for' import { stubInterface } from 'ts-sinon' import { mdns, type MulticastDNSComponents } from './../src/index.js' -import type { AddressManager } from '@libp2p/interface-address-manager' -import type { PeerId } from '@libp2p/interface-peer-id' -import type { PeerInfo } from '@libp2p/interface-peer-info' +import type { PeerId } from '@libp2p/interface/peer-id' +import type { PeerInfo } from '@libp2p/interface/peer-info' +import type { AddressManager } from '@libp2p/interface-internal/address-manager' import type { Multiaddr } from '@multiformats/multiaddr' function getComponents (peerId: PeerId, multiaddrs: Multiaddr[]): MulticastDNSComponents { diff --git a/packages/peer-discovery-mdns/tsconfig.json b/packages/peer-discovery-mdns/tsconfig.json index f89978dd99..556dd28bf9 100644 --- a/packages/peer-discovery-mdns/tsconfig.json +++ b/packages/peer-discovery-mdns/tsconfig.json @@ -9,22 +9,13 @@ ], "references": [ { - "path": "../interface-address-manager" + "path": "../interface" }, { - "path": "../interface-peer-discovery" + "path": "../interface-compliance-tests" }, { - "path": "../interface-peer-discovery-compliance-tests" - }, - { - "path": "../interface-peer-id" - }, - { - "path": "../interface-peer-info" - }, - { - "path": "../interfaces" + "path": "../interface-internal" }, { "path": "../logger" diff --git a/packages/peer-id-factory/package.json b/packages/peer-id-factory/package.json index 8d03095bc8..4b9eeacf0d 100644 --- a/packages/peer-id-factory/package.json +++ b/packages/peer-id-factory/package.json @@ -53,13 +53,13 @@ }, "dependencies": { "@libp2p/crypto": "^1.0.0", + "@libp2p/interface": "~0.0.1", "@libp2p/interface-keys": "^1.0.0", - "@libp2p/interface-peer-id": "^2.0.0", "@libp2p/peer-id": "^2.0.0", - "multiformats": "^11.0.2", + "multiformats": "^12.0.1", "protons-runtime": "^5.0.0", "uint8arraylist": "^2.4.3", - "uint8arrays": "^4.0.3" + "uint8arrays": "^4.0.4" }, "devDependencies": { "aegir": "^39.0.10", diff --git a/packages/peer-id-factory/src/index.ts b/packages/peer-id-factory/src/index.ts index f3b66da887..c1802af493 100644 --- a/packages/peer-id-factory/src/index.ts +++ b/packages/peer-id-factory/src/index.ts @@ -2,8 +2,8 @@ import { generateKeyPair, marshalPrivateKey, unmarshalPrivateKey, marshalPublicK import { peerIdFromKeys, peerIdFromBytes } from '@libp2p/peer-id' import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' import { PeerIdProto } from './proto.js' +import type { RSAPeerId, Ed25519PeerId, Secp256k1PeerId, PeerId } from '@libp2p/interface/peer-id' import type { PublicKey, PrivateKey } from '@libp2p/interface-keys' -import type { RSAPeerId, Ed25519PeerId, Secp256k1PeerId, PeerId } from '@libp2p/interface-peer-id' export const createEd25519PeerId = async (): Promise => { const key = await generateKeyPair('Ed25519') diff --git a/packages/peer-id-factory/tsconfig.json b/packages/peer-id-factory/tsconfig.json index 6338201752..74af969900 100644 --- a/packages/peer-id-factory/tsconfig.json +++ b/packages/peer-id-factory/tsconfig.json @@ -12,10 +12,7 @@ "path": "../crypto" }, { - "path": "../interface-keys" - }, - { - "path": "../interface-peer-id" + "path": "../interface" }, { "path": "../peer-id" diff --git a/packages/peer-id/package.json b/packages/peer-id/package.json index 42a9d54bcd..191f890f35 100644 --- a/packages/peer-id/package.json +++ b/packages/peer-id/package.json @@ -48,10 +48,9 @@ "test:electron-main": "aegir test -t electron-main" }, "dependencies": { - "@libp2p/interface-peer-id": "^2.0.0", - "@libp2p/interfaces": "^3.0.0", - "multiformats": "^11.0.2", - "uint8arrays": "^4.0.3" + "@libp2p/interface": "~0.0.1", + "multiformats": "^12.0.1", + "uint8arrays": "^4.0.4" }, "devDependencies": { "aegir": "^39.0.10" diff --git a/packages/peer-id/src/index.ts b/packages/peer-id/src/index.ts index 9ef86986c5..b1dfd2fabe 100644 --- a/packages/peer-id/src/index.ts +++ b/packages/peer-id/src/index.ts @@ -1,5 +1,5 @@ -import { type Ed25519PeerId, type PeerIdType, type RSAPeerId, type Secp256k1PeerId, symbol, type PeerId } from '@libp2p/interface-peer-id' -import { CodeError } from '@libp2p/interfaces/errors' +import { CodeError } from '@libp2p/interface/errors' +import { type Ed25519PeerId, type PeerIdType, type RSAPeerId, type Secp256k1PeerId, symbol, type PeerId } from '@libp2p/interface/peer-id' import { base58btc } from 'multiformats/bases/base58' import { bases } from 'multiformats/basics' import { CID } from 'multiformats/cid' diff --git a/packages/peer-id/tsconfig.json b/packages/peer-id/tsconfig.json index ba25a6ed4a..4c0bdf7723 100644 --- a/packages/peer-id/tsconfig.json +++ b/packages/peer-id/tsconfig.json @@ -9,10 +9,7 @@ ], "references": [ { - "path": "../interface-peer-id" - }, - { - "path": "../interfaces" + "path": "../interface" } ] } diff --git a/packages/peer-record/package.json b/packages/peer-record/package.json index b3fbd458e2..5ceda4c374 100644 --- a/packages/peer-record/package.json +++ b/packages/peer-record/package.json @@ -43,7 +43,7 @@ "scripts": { "clean": "aegir clean", "lint": "aegir lint", - "dep-check": "aegir dep-check -i protons", + "dep-check": "aegir dep-check", "generate": "protons src/envelope/envelope.proto src/peer-record/peer-record.proto", "build": "aegir build", "test": "aegir test", @@ -56,19 +56,16 @@ }, "dependencies": { "@libp2p/crypto": "^1.0.0", - "@libp2p/interface-peer-id": "^2.0.0", - "@libp2p/interface-record": "^2.0.0", - "@libp2p/interfaces": "^3.0.0", + "@libp2p/interface": "~0.0.1", "@libp2p/peer-id": "^2.0.0", "@libp2p/utils": "^3.0.0", "@multiformats/multiaddr": "^12.1.3", "protons-runtime": "^5.0.0", "uint8-varint": "^1.0.2", "uint8arraylist": "^2.4.3", - "uint8arrays": "^4.0.3" + "uint8arrays": "^4.0.4" }, "devDependencies": { - "@libp2p/interface-record-compliance-tests": "^2.0.0", "@libp2p/peer-id-factory": "^2.0.0", "@types/varint": "^6.0.0", "aegir": "^39.0.10", diff --git a/packages/peer-record/src/envelope/index.ts b/packages/peer-record/src/envelope/index.ts index 6ef0d7951d..2210be9bca 100644 --- a/packages/peer-record/src/envelope/index.ts +++ b/packages/peer-record/src/envelope/index.ts @@ -1,5 +1,5 @@ import { unmarshalPrivateKey, unmarshalPublicKey } from '@libp2p/crypto/keys' -import { CodeError } from '@libp2p/interfaces/errors' +import { CodeError } from '@libp2p/interface/errors' import { peerIdFromKeys } from '@libp2p/peer-id' import { unsigned } from 'uint8-varint' import { Uint8ArrayList } from 'uint8arraylist' @@ -7,8 +7,8 @@ import { equals as uint8ArrayEquals } from 'uint8arrays/equals' import { fromString as uint8arraysFromString } from 'uint8arrays/from-string' import { codes } from '../errors.js' import { Envelope as Protobuf } from './envelope.js' -import type { PeerId } from '@libp2p/interface-peer-id' -import type { Record, Envelope } from '@libp2p/interface-record' +import type { PeerId } from '@libp2p/interface/peer-id' +import type { Record, Envelope } from '@libp2p/interface/record' export interface RecordEnvelopeInit { peerId: PeerId diff --git a/packages/peer-record/src/peer-record/index.ts b/packages/peer-record/src/peer-record/index.ts index bd93db078e..7ef105c692 100644 --- a/packages/peer-record/src/peer-record/index.ts +++ b/packages/peer-record/src/peer-record/index.ts @@ -6,7 +6,7 @@ import { ENVELOPE_PAYLOAD_TYPE_PEER_RECORD } from './consts.js' import { PeerRecord as Protobuf } from './peer-record.js' -import type { PeerId } from '@libp2p/interface-peer-id' +import type { PeerId } from '@libp2p/interface/peer-id' import type { Multiaddr } from '@multiformats/multiaddr' import type { Uint8ArrayList } from 'uint8arraylist' diff --git a/packages/peer-record/test/envelope.spec.ts b/packages/peer-record/test/envelope.spec.ts index 1f536288c8..baff7a2190 100644 --- a/packages/peer-record/test/envelope.spec.ts +++ b/packages/peer-record/test/envelope.spec.ts @@ -4,8 +4,8 @@ import { equals as uint8ArrayEquals } from 'uint8arrays/equals' import { fromString as uint8arrayFromString } from 'uint8arrays/from-string' import { RecordEnvelope } from '../src/envelope/index.js' import { codes as ErrorCodes } from '../src/errors.js' -import type { PeerId } from '@libp2p/interface-peer-id' -import type { Record } from '@libp2p/interface-record' +import type { PeerId } from '@libp2p/interface/peer-id' +import type { Record } from '@libp2p/interface/record' const domain = 'libp2p-testing' const codec = uint8arrayFromString('/libp2p/testdata') diff --git a/packages/peer-record/test/peer-record.spec.ts b/packages/peer-record/test/peer-record.spec.ts index f2fa396a86..14de3eca9b 100644 --- a/packages/peer-record/test/peer-record.spec.ts +++ b/packages/peer-record/test/peer-record.spec.ts @@ -1,26 +1,13 @@ /* eslint-env mocha */ import { unmarshalPrivateKey } from '@libp2p/crypto/keys' -import tests from '@libp2p/interface-record-compliance-tests' import { peerIdFromKeys } from '@libp2p/peer-id' import { createEd25519PeerId } from '@libp2p/peer-id-factory' import { multiaddr } from '@multiformats/multiaddr' import { expect } from 'aegir/chai' import { RecordEnvelope } from '../src/envelope/index.js' import { PeerRecord } from '../src/peer-record/index.js' -import type { PeerId } from '@libp2p/interface-peer-id' - -describe('interface-record compliance', () => { - tests({ - async setup () { - const peerId = await createEd25519PeerId() - return new PeerRecord({ peerId }) - }, - async teardown () { - // cleanup resources created by setup() - } - }) -}) +import type { PeerId } from '@libp2p/interface/peer-id' describe('PeerRecord', () => { let peerId: PeerId diff --git a/packages/peer-record/tsconfig.json b/packages/peer-record/tsconfig.json index 27e810f549..3052d247ba 100644 --- a/packages/peer-record/tsconfig.json +++ b/packages/peer-record/tsconfig.json @@ -12,16 +12,7 @@ "path": "../crypto" }, { - "path": "../interface-peer-id" - }, - { - "path": "../interface-record" - }, - { - "path": "../interface-record-compliance-tests" - }, - { - "path": "../interfaces" + "path": "../interface" }, { "path": "../peer-id" diff --git a/packages/peer-store/CHANGELOG.md b/packages/peer-store/CHANGELOG.md index 539320f571..d9f685ac4b 100644 --- a/packages/peer-store/CHANGELOG.md +++ b/packages/peer-store/CHANGELOG.md @@ -45,7 +45,7 @@ ### Dependencies -* bump @libp2p/interface-libp2p from 2.0.0 to 3.1.0 ([#83](https://github.com/libp2p/js-libp2p-peer-store/issues/83)) ([9a8d6c6](https://github.com/libp2p/js-libp2p-peer-store/commit/9a8d6c61d3d64dca463c74df2984a4e294424f51)) +* bump @libp2p/interface from 2.0.0 to 3.1.0 ([#83](https://github.com/libp2p/js-libp2p-peer-store/issues/83)) ([9a8d6c6](https://github.com/libp2p/js-libp2p-peer-store/commit/9a8d6c61d3d64dca463c74df2984a4e294424f51)) ## [8.1.0](https://github.com/libp2p/js-libp2p-peer-store/compare/v8.0.0...v8.1.0) (2023-05-10) diff --git a/packages/peer-store/package.json b/packages/peer-store/package.json index 9acd98b945..9de492e4df 100644 --- a/packages/peer-store/package.json +++ b/packages/peer-store/package.json @@ -41,7 +41,7 @@ "scripts": { "clean": "aegir clean", "lint": "aegir lint", - "dep-check": "aegir dep-check -i protons", + "dep-check": "aegir dep-check", "generate": "protons src/pb/*.proto", "build": "aegir build", "test": "aegir test", @@ -53,10 +53,7 @@ "test:electron-main": "aegir test -t electron-main" }, "dependencies": { - "@libp2p/interface-libp2p": "^3.0.0", - "@libp2p/interface-peer-id": "^2.0.0", - "@libp2p/interface-peer-store": "^2.0.0", - "@libp2p/interfaces": "^3.0.0", + "@libp2p/interface": "~0.0.1", "@libp2p/logger": "^2.0.0", "@libp2p/peer-collections": "^3.0.0", "@libp2p/peer-id": "^2.0.0", @@ -66,10 +63,10 @@ "interface-datastore": "^8.2.0", "it-all": "^3.0.2", "mortice": "^3.0.1", - "multiformats": "^11.0.2", + "multiformats": "^12.0.1", "protons-runtime": "^5.0.0", "uint8arraylist": "^2.4.3", - "uint8arrays": "^4.0.3" + "uint8arrays": "^4.0.4" }, "devDependencies": { "@types/sinon": "^10.0.15", @@ -79,7 +76,7 @@ "p-defer": "^4.0.0", "p-event": "^6.0.0", "protons": "^7.0.2", - "sinon": "^15.1.0" + "sinon": "^15.1.2" }, "typedoc": { "entryPoint": "./src/index.ts" diff --git a/packages/peer-store/src/index.ts b/packages/peer-store/src/index.ts index 20036c4668..d130a8a7c3 100644 --- a/packages/peer-store/src/index.ts +++ b/packages/peer-store/src/index.ts @@ -2,10 +2,10 @@ import { logger } from '@libp2p/logger' import { RecordEnvelope, PeerRecord } from '@libp2p/peer-record' import all from 'it-all' import { PersistentStore, type PeerUpdate } from './store.js' -import type { Libp2pEvents } from '@libp2p/interface-libp2p' -import type { PeerId } from '@libp2p/interface-peer-id' -import type { PeerStore, Peer, PeerData, PeerQuery } from '@libp2p/interface-peer-store' -import type { EventEmitter } from '@libp2p/interfaces/events' +import type { Libp2pEvents } from '@libp2p/interface' +import type { EventEmitter } from '@libp2p/interface/events' +import type { PeerId } from '@libp2p/interface/peer-id' +import type { PeerStore, Peer, PeerData, PeerQuery } from '@libp2p/interface/peer-store' import type { Multiaddr } from '@multiformats/multiaddr' import type { Datastore } from 'interface-datastore' diff --git a/packages/peer-store/src/store.ts b/packages/peer-store/src/store.ts index 98ef673a6d..6eaea53097 100644 --- a/packages/peer-store/src/store.ts +++ b/packages/peer-store/src/store.ts @@ -1,4 +1,4 @@ -import { CodeError } from '@libp2p/interfaces/errors' +import { CodeError } from '@libp2p/interface/errors' import { PeerMap } from '@libp2p/peer-collections' import { peerIdFromBytes } from '@libp2p/peer-id' import mortice, { type Mortice } from 'mortice' @@ -10,9 +10,9 @@ import { bytesToPeer } from './utils/bytes-to-peer.js' import { NAMESPACE_COMMON, peerIdToDatastoreKey } from './utils/peer-id-to-datastore-key.js' import { toPeerPB } from './utils/to-peer-pb.js' import type { AddressFilter, PersistentPeerStoreComponents, PersistentPeerStoreInit } from './index.js' -import type { PeerUpdate as PeerUpdateExternal } from '@libp2p/interface-libp2p' -import type { PeerId } from '@libp2p/interface-peer-id' -import type { Peer, PeerData, PeerQuery } from '@libp2p/interface-peer-store' +import type { PeerUpdate as PeerUpdateExternal } from '@libp2p/interface' +import type { PeerId } from '@libp2p/interface/peer-id' +import type { Peer, PeerData, PeerQuery } from '@libp2p/interface/peer-store' import type { Datastore, Key, Query } from 'interface-datastore' /** diff --git a/packages/peer-store/src/utils/bytes-to-peer.ts b/packages/peer-store/src/utils/bytes-to-peer.ts index bd3c7c0d83..3b723efcbe 100644 --- a/packages/peer-store/src/utils/bytes-to-peer.ts +++ b/packages/peer-store/src/utils/bytes-to-peer.ts @@ -1,8 +1,8 @@ import { peerIdFromPeerId } from '@libp2p/peer-id' import { multiaddr } from '@multiformats/multiaddr' import { Peer as PeerPB } from '../pb/peer.js' -import type { PeerId } from '@libp2p/interface-peer-id' -import type { Peer, Tag } from '@libp2p/interface-peer-store' +import type { PeerId } from '@libp2p/interface/peer-id' +import type { Peer, Tag } from '@libp2p/interface/peer-store' export function bytesToPeer (peerId: PeerId, buf: Uint8Array): Peer { const peer = PeerPB.decode(buf) diff --git a/packages/peer-store/src/utils/dedupe-addresses.ts b/packages/peer-store/src/utils/dedupe-addresses.ts index ec8e6f6d9d..d6f55d7120 100644 --- a/packages/peer-store/src/utils/dedupe-addresses.ts +++ b/packages/peer-store/src/utils/dedupe-addresses.ts @@ -1,10 +1,10 @@ -import { CodeError } from '@libp2p/interfaces/errors' +import { CodeError } from '@libp2p/interface/errors' import { isMultiaddr, multiaddr } from '@multiformats/multiaddr' import { codes } from '../errors.js' import type { AddressFilter } from '../index.js' import type { Address as AddressPB } from '../pb/peer.js' -import type { PeerId } from '@libp2p/interface-peer-id' -import type { Address } from '@libp2p/interface-peer-store' +import type { PeerId } from '@libp2p/interface/peer-id' +import type { Address } from '@libp2p/interface/peer-store' export async function dedupeFilterAndSortAddresses (peerId: PeerId, filter: AddressFilter, addresses: Array
): Promise { const addressMap = new Map() diff --git a/packages/peer-store/src/utils/peer-data-to-datastore-peer.ts b/packages/peer-store/src/utils/peer-data-to-datastore-peer.ts index 606aa63a5e..f97e6fecd9 100644 --- a/packages/peer-store/src/utils/peer-data-to-datastore-peer.ts +++ b/packages/peer-store/src/utils/peer-data-to-datastore-peer.ts @@ -1,11 +1,11 @@ -import { CodeError } from '@libp2p/interfaces/errors' +import { CodeError } from '@libp2p/interface/errors' import { isMultiaddr } from '@multiformats/multiaddr' import { equals as uint8arrayEquals } from 'uint8arrays/equals' import { codes } from '../errors.js' import type { Peer as PeerPB } from '../pb/peer.js' -import type { PeerId } from '@libp2p/interface-peer-id' -import type { PeerData } from '@libp2p/interface-peer-store' +import type { PeerId } from '@libp2p/interface/peer-id' +import type { PeerData } from '@libp2p/interface/peer-store' export function toDatastorePeer (peerId: PeerId, data: PeerData): PeerPB { if (data == null) { diff --git a/packages/peer-store/src/utils/peer-id-to-datastore-key.ts b/packages/peer-store/src/utils/peer-id-to-datastore-key.ts index 4ff988ac91..191ef2dffc 100644 --- a/packages/peer-store/src/utils/peer-id-to-datastore-key.ts +++ b/packages/peer-store/src/utils/peer-id-to-datastore-key.ts @@ -1,5 +1,5 @@ -import { isPeerId, type PeerId } from '@libp2p/interface-peer-id' -import { CodeError } from '@libp2p/interfaces/errors' +import { CodeError } from '@libp2p/interface/errors' +import { isPeerId, type PeerId } from '@libp2p/interface/peer-id' import { Key } from 'interface-datastore/key' import { codes } from '../errors.js' diff --git a/packages/peer-store/src/utils/to-peer-pb.ts b/packages/peer-store/src/utils/to-peer-pb.ts index 1ba6fa29dd..a3a3c92763 100644 --- a/packages/peer-store/src/utils/to-peer-pb.ts +++ b/packages/peer-store/src/utils/to-peer-pb.ts @@ -1,11 +1,11 @@ -import { CodeError } from '@libp2p/interfaces/errors' +import { CodeError } from '@libp2p/interface/errors' import { equals as uint8arrayEquals } from 'uint8arrays/equals' import { codes } from '../errors.js' import { dedupeFilterAndSortAddresses } from './dedupe-addresses.js' import type { AddressFilter } from '../index.js' import type { Tag, Peer as PeerPB } from '../pb/peer.js' -import type { PeerId } from '@libp2p/interface-peer-id' -import type { Address, Peer, PeerData, TagOptions } from '@libp2p/interface-peer-store' +import type { PeerId } from '@libp2p/interface/peer-id' +import type { Address, Peer, PeerData, TagOptions } from '@libp2p/interface/peer-store' export interface ToPBPeerOptions { addressFilter?: AddressFilter diff --git a/packages/peer-store/test/index.spec.ts b/packages/peer-store/test/index.spec.ts index efd9275f58..868d811c72 100644 --- a/packages/peer-store/test/index.spec.ts +++ b/packages/peer-store/test/index.spec.ts @@ -1,7 +1,7 @@ /* eslint-env mocha */ /* eslint max-nested-callbacks: ["error", 6] */ -import { EventEmitter } from '@libp2p/interfaces/events' +import { EventEmitter } from '@libp2p/interface/events' import { createEd25519PeerId } from '@libp2p/peer-id-factory' import { RecordEnvelope, PeerRecord } from '@libp2p/peer-record' import { multiaddr } from '@multiformats/multiaddr' @@ -9,8 +9,8 @@ import { expect } from 'aegir/chai' import { MemoryDatastore } from 'datastore-core/memory' import delay from 'delay' import { PersistentPeerStore } from '../src/index.js' -import type { Libp2pEvents } from '@libp2p/interface-libp2p' -import type { PeerId } from '@libp2p/interface-peer-id' +import type { Libp2pEvents } from '@libp2p/interface' +import type { PeerId } from '@libp2p/interface/peer-id' const addr1 = multiaddr('/ip4/127.0.0.1/tcp/8000') diff --git a/packages/peer-store/test/merge.spec.ts b/packages/peer-store/test/merge.spec.ts index b16a56dc5a..304512781f 100644 --- a/packages/peer-store/test/merge.spec.ts +++ b/packages/peer-store/test/merge.spec.ts @@ -1,16 +1,16 @@ /* eslint-env mocha */ /* eslint max-nested-callbacks: ["error", 6] */ -import { EventEmitter } from '@libp2p/interfaces/events' +import { EventEmitter } from '@libp2p/interface/events' import { createEd25519PeerId } from '@libp2p/peer-id-factory' import { multiaddr } from '@multiformats/multiaddr' import { expect } from 'aegir/chai' import { MemoryDatastore } from 'datastore-core/memory' import { pEvent } from 'p-event' import { PersistentPeerStore } from '../src/index.js' -import type { Libp2pEvents } from '@libp2p/interface-libp2p' -import type { PeerId } from '@libp2p/interface-peer-id' -import type { PeerData } from '@libp2p/interface-peer-store' +import type { Libp2pEvents } from '@libp2p/interface' +import type { PeerId } from '@libp2p/interface/peer-id' +import type { PeerData } from '@libp2p/interface/peer-store' const addr1 = multiaddr('/ip4/127.0.0.1/tcp/8000') const addr2 = multiaddr('/ip4/20.0.0.1/tcp/8001') diff --git a/packages/peer-store/test/patch.spec.ts b/packages/peer-store/test/patch.spec.ts index 3d64bf4d02..a30e22e872 100644 --- a/packages/peer-store/test/patch.spec.ts +++ b/packages/peer-store/test/patch.spec.ts @@ -1,16 +1,16 @@ /* eslint-env mocha */ /* eslint max-nested-callbacks: ["error", 6] */ -import { EventEmitter } from '@libp2p/interfaces/events' +import { EventEmitter } from '@libp2p/interface/events' import { createEd25519PeerId } from '@libp2p/peer-id-factory' import { multiaddr } from '@multiformats/multiaddr' import { expect } from 'aegir/chai' import { MemoryDatastore } from 'datastore-core/memory' import { pEvent } from 'p-event' import { PersistentPeerStore } from '../src/index.js' -import type { Libp2pEvents } from '@libp2p/interface-libp2p' -import type { PeerId } from '@libp2p/interface-peer-id' -import type { PeerData } from '@libp2p/interface-peer-store' +import type { Libp2pEvents } from '@libp2p/interface' +import type { PeerId } from '@libp2p/interface/peer-id' +import type { PeerData } from '@libp2p/interface/peer-store' const addr1 = multiaddr('/ip4/127.0.0.1/tcp/8000') const addr2 = multiaddr('/ip4/20.0.0.1/tcp/8001') diff --git a/packages/peer-store/test/save.spec.ts b/packages/peer-store/test/save.spec.ts index 222ee2ea66..43552cb883 100644 --- a/packages/peer-store/test/save.spec.ts +++ b/packages/peer-store/test/save.spec.ts @@ -1,7 +1,7 @@ /* eslint-env mocha */ /* eslint max-nested-callbacks: ["error", 6] */ -import { EventEmitter } from '@libp2p/interfaces/events' +import { EventEmitter } from '@libp2p/interface/events' import { createEd25519PeerId, createRSAPeerId, createSecp256k1PeerId } from '@libp2p/peer-id-factory' import { multiaddr } from '@multiformats/multiaddr' import { expect } from 'aegir/chai' @@ -12,9 +12,9 @@ import sinon from 'sinon' import { codes } from '../src/errors.js' import { PersistentPeerStore } from '../src/index.js' import { Peer as PeerPB } from '../src/pb/peer.js' -import type { Libp2pEvents, PeerUpdate } from '@libp2p/interface-libp2p' -import type { PeerId } from '@libp2p/interface-peer-id' -import type { PeerData } from '@libp2p/interface-peer-store' +import type { Libp2pEvents, PeerUpdate } from '@libp2p/interface' +import type { PeerId } from '@libp2p/interface/peer-id' +import type { PeerData } from '@libp2p/interface/peer-store' const addr1 = multiaddr('/ip4/127.0.0.1/tcp/8000') const addr2 = multiaddr('/ip4/20.0.0.1/tcp/8001') diff --git a/packages/peer-store/test/utils/dedupe-addresses.spec.ts b/packages/peer-store/test/utils/dedupe-addresses.spec.ts index 6fa5001007..233e576239 100644 --- a/packages/peer-store/test/utils/dedupe-addresses.spec.ts +++ b/packages/peer-store/test/utils/dedupe-addresses.spec.ts @@ -4,7 +4,7 @@ import { createEd25519PeerId } from '@libp2p/peer-id-factory' import { multiaddr } from '@multiformats/multiaddr' import { expect } from 'aegir/chai' import { dedupeFilterAndSortAddresses } from '../../src/utils/dedupe-addresses.js' -import type { PeerId } from '@libp2p/interface-peer-id' +import type { PeerId } from '@libp2p/interface/peer-id' const addr1 = multiaddr('/ip4/127.0.0.1/tcp/8000') const addr2 = multiaddr('/ip4/20.0.0.1/tcp/8001') diff --git a/packages/peer-store/tsconfig.json b/packages/peer-store/tsconfig.json index 7b195f0cb6..7520207294 100644 --- a/packages/peer-store/tsconfig.json +++ b/packages/peer-store/tsconfig.json @@ -12,16 +12,7 @@ ], "references": [ { - "path": "../interface-libp2p" - }, - { - "path": "../interface-peer-id" - }, - { - "path": "../interface-peer-store" - }, - { - "path": "../interfaces" + "path": "../interface" }, { "path": "../logger" diff --git a/packages/record/CHANGELOG.md b/packages/record/CHANGELOG.md deleted file mode 100644 index 4d904e156d..0000000000 --- a/packages/record/CHANGELOG.md +++ /dev/null @@ -1,323 +0,0 @@ -## [3.0.4](https://github.com/libp2p/js-libp2p-record/compare/v3.0.3...v3.0.4) (2023-06-15) - - -### Trivial Changes - -* Update .github/workflows/semantic-pull-request.yml [skip ci] ([afec2c9](https://github.com/libp2p/js-libp2p-record/commit/afec2c9d1685707c9cff82342099839abb6976da)) -* Update .github/workflows/stale.yml [skip ci] ([2d12a78](https://github.com/libp2p/js-libp2p-record/commit/2d12a789581d65181d463fa9b908280b14fc2070)) - - -### Dependencies - -* **dev:** bump aegir from 38.1.8 to 39.0.10 ([#95](https://github.com/libp2p/js-libp2p-record/issues/95)) ([30e0fb5](https://github.com/libp2p/js-libp2p-record/commit/30e0fb5dfb193e3289f1aec6c29a8d194fd9aa92)) - -## [3.0.3](https://github.com/libp2p/js-libp2p-record/compare/v3.0.2...v3.0.3) (2023-04-04) - - -### Bug Fixes - -* correction package.json exports types path ([#87](https://github.com/libp2p/js-libp2p-record/issues/87)) ([c1e9a6d](https://github.com/libp2p/js-libp2p-record/commit/c1e9a6d402a971b3ef66484c151b9dc4627fea1b)) - -## [3.0.2](https://github.com/libp2p/js-libp2p-record/compare/v3.0.1...v3.0.2) (2023-03-10) - - -### Dependencies - -* bump protons-runtime from 4.0.2 to 5.0.0 ([#73](https://github.com/libp2p/js-libp2p-record/issues/73)) ([4b1b67b](https://github.com/libp2p/js-libp2p-record/commit/4b1b67bac77cb13a01ce330a4a93eb6c3dc042a5)) - -## [3.0.1](https://github.com/libp2p/js-libp2p-record/compare/v3.0.0...v3.0.1) (2023-03-10) - - -### Trivial Changes - -* replace err-code with CodeError ([#71](https://github.com/libp2p/js-libp2p-record/issues/71)) ([a843ae4](https://github.com/libp2p/js-libp2p-record/commit/a843ae4fbdc8c262a55f4ed87f989770d3783c5a)), closes [js-libp2p#1269](https://github.com/libp2p/js-libp2p/issues/1269) -* Update .github/workflows/semantic-pull-request.yml [skip ci] ([3982918](https://github.com/libp2p/js-libp2p-record/commit/3982918a51c25bf1f803702073eaf17cc5feee9b)) -* Update .github/workflows/semantic-pull-request.yml [skip ci] ([79984c0](https://github.com/libp2p/js-libp2p-record/commit/79984c0ce651cb0bff634b3b8df630cf807baa59)) -* Update .github/workflows/semantic-pull-request.yml [skip ci] ([7ccccc7](https://github.com/libp2p/js-libp2p-record/commit/7ccccc73fb1aad74cd4b696acd8dc912199afec3)) - - -### Dependencies - -* **dev:** bump aegir from 37.12.1 to 38.1.7 ([#84](https://github.com/libp2p/js-libp2p-record/issues/84)) ([4cc5935](https://github.com/libp2p/js-libp2p-record/commit/4cc593576ccda281950f30aa6c8e769baa1aeee6)) - -## [3.0.0](https://github.com/libp2p/js-libp2p-record/compare/v2.0.4...v3.0.0) (2023-01-06) - - -### ⚠ BREAKING CHANGES - -* update multiformats to 11.x.x (#70) - -### Bug Fixes - -* update multiformats to 11.x.x ([#70](https://github.com/libp2p/js-libp2p-record/issues/70)) ([594fc41](https://github.com/libp2p/js-libp2p-record/commit/594fc4171ec20f4fc1fbc36c99c61eed06aeab25)) - -## [2.0.4](https://github.com/libp2p/js-libp2p-record/compare/v2.0.3...v2.0.4) (2022-12-16) - - -### Documentation - -* publish api docs ([#68](https://github.com/libp2p/js-libp2p-record/issues/68)) ([5a3dd41](https://github.com/libp2p/js-libp2p-record/commit/5a3dd419f13b67e27c19f3b23252937d80fc8b93)) - -## [2.0.3](https://github.com/libp2p/js-libp2p-record/compare/v2.0.2...v2.0.3) (2022-10-12) - - -### Trivial Changes - -* Update .github/workflows/stale.yml [skip ci] ([92044b6](https://github.com/libp2p/js-libp2p-record/commit/92044b646180e2b2d0f495d26cc54c184ad6fb7b)) - - -### Dependencies - -* bump uint8arrays, protons and multiformats ([#63](https://github.com/libp2p/js-libp2p-record/issues/63)) ([9106a6a](https://github.com/libp2p/js-libp2p-record/commit/9106a6abdc71a2c94359759bbc2f61213e9a6a0b)) - -## [2.0.2](https://github.com/libp2p/js-libp2p-record/compare/v2.0.1...v2.0.2) (2022-08-11) - - -### Dependencies - -* update protons to 5.1.0 ([#58](https://github.com/libp2p/js-libp2p-record/issues/58)) ([24d4047](https://github.com/libp2p/js-libp2p-record/commit/24d404733aa89c28ae71abfcb51ee20b6af919cf)) - -## [2.0.1](https://github.com/libp2p/js-libp2p-record/compare/v2.0.0...v2.0.1) (2022-08-03) - - -### Trivial Changes - -* update project ([#53](https://github.com/libp2p/js-libp2p-record/issues/53)) ([1927144](https://github.com/libp2p/js-libp2p-record/commit/1927144ce346592f513e2f29e0b4677dd1feb468)) - - -### Dependencies - -* update deps to support no-copy operations ([#55](https://github.com/libp2p/js-libp2p-record/issues/55)) ([7be8515](https://github.com/libp2p/js-libp2p-record/commit/7be8515ad87d062bbc9db20fc3134ed06b1286a9)) - -## [2.0.0](https://github.com/libp2p/js-libp2p-record/compare/v1.0.5...v2.0.0) (2022-06-15) - - -### ⚠ BREAKING CHANGES - -* uses new single-issue libp2p interface modules - -### Features - -* update to latest libp2p interfaces ([#45](https://github.com/libp2p/js-libp2p-record/issues/45)) ([b5eb989](https://github.com/libp2p/js-libp2p-record/commit/b5eb9897f23ebf39e2a728672f3727222bc1159f)) - -### [1.0.5](https://github.com/libp2p/js-libp2p-record/compare/v1.0.4...v1.0.5) (2022-05-25) - - -### Trivial Changes - -* **deps:** bump @libp2p/interfaces from 1.3.32 to 2.0.2 ([#43](https://github.com/libp2p/js-libp2p-record/issues/43)) ([992677b](https://github.com/libp2p/js-libp2p-record/commit/992677bd6bf432b3ce894c53ac7a721e2dd44bf9)) - -### [1.0.4](https://github.com/libp2p/js-libp2p-record/compare/v1.0.3...v1.0.4) (2022-04-14) - - -### Bug Fixes - -* pad ns correctly ([#41](https://github.com/libp2p/js-libp2p-record/issues/41)) ([18030d9](https://github.com/libp2p/js-libp2p-record/commit/18030d9d3832a7d09dee928923909875a5780a2f)) - -### [1.0.3](https://github.com/libp2p/js-libp2p-record/compare/v1.0.2...v1.0.3) (2022-04-13) - - -### Bug Fixes - -* update interfaces ([#40](https://github.com/libp2p/js-libp2p-record/issues/40)) ([e2713a3](https://github.com/libp2p/js-libp2p-record/commit/e2713a3a6b5351e2dc012cf734ff1c945479920b)) - -### [1.0.2](https://github.com/libp2p/js-libp2p-record/compare/v1.0.1...v1.0.2) (2022-04-09) - - -### Bug Fixes - -* use protons ([#39](https://github.com/libp2p/js-libp2p-record/issues/39)) ([10b4cc2](https://github.com/libp2p/js-libp2p-record/commit/10b4cc2600e8f3bed9a2d646b68b0b2107e1caa4)) - -### [1.0.1](https://github.com/libp2p/js-libp2p-record/compare/v1.0.0...v1.0.1) (2022-03-24) - - -### Bug Fixes - -* export selector/validators with the same name as their prefix ([#34](https://github.com/libp2p/js-libp2p-record/issues/34)) ([4913d1f](https://github.com/libp2p/js-libp2p-record/commit/4913d1fec2ed92d4803f3497bef81142bd560a91)) - -## [1.0.0](https://github.com/libp2p/js-libp2p-record/compare/v0.10.6...v1.0.0) (2022-02-18) - - -### ⚠ BREAKING CHANGES - -* switch to named exports, ESM only - -### Features - -* convert to typescript ([#32](https://github.com/libp2p/js-libp2p-record/issues/32)) ([89cc2ef](https://github.com/libp2p/js-libp2p-record/commit/89cc2ef5234835c82ea29ff54a4887d630921ae3)) - -## [0.10.6](https://github.com/libp2p/js-libp2p-record/compare/v0.10.5...v0.10.6) (2021-09-24) - - -### Bug Fixes - -* auto select if only one record ([#31](https://github.com/libp2p/js-libp2p-record/issues/31)) ([53bc7f2](https://github.com/libp2p/js-libp2p-record/commit/53bc7f2627a95256337033977a05df54a534f951)) - - - -## [0.10.5](https://github.com/libp2p/js-libp2p-record/compare/v0.10.4...v0.10.5) (2021-08-18) - - - -## [0.10.4](https://github.com/libp2p/js-libp2p-record/compare/v0.10.3...v0.10.4) (2021-07-07) - - - -## [0.10.3](https://github.com/libp2p/js-libp2p-record/compare/v0.10.2...v0.10.3) (2021-04-22) - - -### Bug Fixes - -* use dht selectors and validators from interfaces ([#28](https://github.com/libp2p/js-libp2p-record/issues/28)) ([7b211a5](https://github.com/libp2p/js-libp2p-record/commit/7b211a528675018abbc8e4674bedbdd5ab7b5eea)) - - - -## [0.10.2](https://github.com/libp2p/js-libp2p-record/compare/v0.10.1...v0.10.2) (2021-04-20) - - -### Bug Fixes - -* specify pbjs root ([#27](https://github.com/libp2p/js-libp2p-record/issues/27)) ([32ddb1d](https://github.com/libp2p/js-libp2p-record/commit/32ddb1deec71543d0ef34157b6ef2d271e8408f5)) - - - -## [0.10.1](https://github.com/libp2p/js-libp2p-record/compare/v0.10.0...v0.10.1) (2021-04-07) - - - -# [0.10.0](https://github.com/libp2p/js-libp2p-record/compare/v0.8.0...v0.10.0) (2021-02-02) - - -### Features - -* add types and update deps ([#25](https://github.com/libp2p/js-libp2p-record/issues/25)) ([e2395de](https://github.com/libp2p/js-libp2p-record/commit/e2395de924a9c71d761c6ea3f5aab2844b252591)) - - - - -# [0.9.0](https://github.com/libp2p/js-libp2p-record/compare/v0.8.0...v0.9.0) (2020-08-07) - - - - -# [0.8.0](https://github.com/libp2p/js-libp2p-record/compare/v0.7.3...v0.8.0) (2020-07-29) - - -### Bug Fixes - -* support uint8arrays in place of node buffers ([#23](https://github.com/libp2p/js-libp2p-record/issues/23)) ([3b99ee1](https://github.com/libp2p/js-libp2p-record/commit/3b99ee1)) - - -### BREAKING CHANGES - -* takes Uint8Arrays as well as Node Buffers - - - - -## [0.7.3](https://github.com/libp2p/js-libp2p-record/compare/v0.7.2...v0.7.3) (2020-04-27) - - -### Bug Fixes - -* remove buffer ([#21](https://github.com/libp2p/js-libp2p-record/issues/21)) ([80fb248](https://github.com/libp2p/js-libp2p-record/commit/80fb248)) - - - - -## [0.7.2](https://github.com/libp2p/js-libp2p-record/compare/v0.7.1...v0.7.2) (2020-02-13) - - -### Bug Fixes - -* remove use of assert module ([#18](https://github.com/libp2p/js-libp2p-record/issues/18)) ([57e24a7](https://github.com/libp2p/js-libp2p-record/commit/57e24a7)) - - - - -## [0.7.1](https://github.com/libp2p/js-libp2p-record/compare/v0.7.0...v0.7.1) (2020-01-03) - - - - -# [0.7.0](https://github.com/libp2p/js-libp2p-record/compare/v0.6.3...v0.7.0) (2019-08-16) - - -### Code Refactoring - -* convert from callbacks to async ([#13](https://github.com/libp2p/js-libp2p-record/issues/13)) ([42eab95](https://github.com/libp2p/js-libp2p-record/commit/42eab95)) - - -### BREAKING CHANGES - -* All places in the API that used callbacks are now replaced with async/await - - - - -## [0.6.3](https://github.com/libp2p/js-libp2p-record/compare/v0.6.2...v0.6.3) (2019-05-23) - - -### Bug Fixes - -* remove leftpad ([#16](https://github.com/libp2p/js-libp2p-record/issues/16)) ([4f46885](https://github.com/libp2p/js-libp2p-record/commit/4f46885)) - - - - -## [0.6.2](https://github.com/libp2p/js-libp2p-record/compare/v0.6.1...v0.6.2) (2019-02-20) - - - - -## [0.6.1](https://github.com/libp2p/js-libp2p-record/compare/v0.6.0...v0.6.1) (2018-11-08) - - - - -# [0.6.0](https://github.com/libp2p/js-libp2p-record/compare/v0.5.1...v0.6.0) (2018-10-18) - - -### Features - -* new record definition ([#8](https://github.com/libp2p/js-libp2p-record/issues/8)) ([10177ae](https://github.com/libp2p/js-libp2p-record/commit/10177ae)) - - -### BREAKING CHANGES - -* having the libp2p-record protobuf definition compliant with go-libp2p-record. Author and signature were removed. - - - - -## [0.5.1](https://github.com/libp2p/js-libp2p-record/compare/v0.5.0...v0.5.1) (2017-09-07) - - -### Features - -* replace protocol-buffers with protons ([#5](https://github.com/libp2p/js-libp2p-record/issues/5)) ([8774a4f](https://github.com/libp2p/js-libp2p-record/commit/8774a4f)) - - - - -# [0.5.0](https://github.com/libp2p/js-libp2p-record/compare/v0.4.0...v0.5.0) (2017-09-03) - - -### Features - -* p2p addrs situation ([#4](https://github.com/libp2p/js-libp2p-record/issues/4)) ([bcba43c](https://github.com/libp2p/js-libp2p-record/commit/bcba43c)) - - - - -# [0.4.0](https://github.com/libp2p/js-libp2p-record/compare/v0.3.1...v0.4.0) (2017-07-22) - - - - -## [0.3.1](https://github.com/libp2p/js-libp2p-record/compare/v0.3.0...v0.3.1) (2017-03-29) - - - - -# 0.3.0 (2017-03-29) diff --git a/packages/record/LICENSE b/packages/record/LICENSE deleted file mode 100644 index 20ce483c86..0000000000 --- a/packages/record/LICENSE +++ /dev/null @@ -1,4 +0,0 @@ -This project is dual licensed under MIT and Apache-2.0. - -MIT: https://www.opensource.org/licenses/mit -Apache-2.0: https://www.apache.org/licenses/license-2.0 diff --git a/packages/record/LICENSE-APACHE b/packages/record/LICENSE-APACHE deleted file mode 100644 index 14478a3b60..0000000000 --- a/packages/record/LICENSE-APACHE +++ /dev/null @@ -1,5 +0,0 @@ -Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - -http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. diff --git a/packages/record/LICENSE-MIT b/packages/record/LICENSE-MIT deleted file mode 100644 index 72dc60d84b..0000000000 --- a/packages/record/LICENSE-MIT +++ /dev/null @@ -1,19 +0,0 @@ -The MIT License (MIT) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/packages/record/package.json b/packages/record/package.json deleted file mode 100644 index caa5a086cd..0000000000 --- a/packages/record/package.json +++ /dev/null @@ -1,94 +0,0 @@ -{ - "name": "@libp2p/record", - "version": "3.0.4", - "description": "libp2p record implementation", - "author": "Friedel Ziegelmayer ", - "license": "Apache-2.0 OR MIT", - "homepage": "https://github.com/libp2p/js-libp2p/tree/master/packages/record#readme", - "repository": { - "type": "git", - "url": "git+https://github.com/libp2p/js-libp2p.git" - }, - "bugs": { - "url": "https://github.com/libp2p/js-libp2p/issues" - }, - "keywords": [ - "IPFS" - ], - "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" - }, - "./selectors": { - "types": "./dist/src/selectors.d.ts", - "import": "./dist/src/selectors.js" - }, - "./validators": { - "types": "./dist/src/validators.d.ts", - "import": "./dist/src/validators.js" - } - }, - "eslintConfig": { - "extends": "ipfs", - "parserOptions": { - "sourceType": "module" - }, - "ignorePatterns": [ - "src/record.d.ts" - ] - }, - "scripts": { - "clean": "aegir clean", - "lint": "aegir lint", - "dep-check": "aegir dep-check -i protons", - "test": "aegir test", - "test:node": "aegir test -t node", - "test:chrome": "aegir test -t browser", - "test:chrome-webworker": "aegir test -t webworker", - "test:firefox": "aegir test -t browser -- --browser firefox", - "test:firefox-webworker": "aegir test -t webworker -- --browser firefox", - "build": "aegir build", - "generate": "protons ./src/record.proto" - }, - "dependencies": { - "@libp2p/interface-dht": "^2.0.0", - "@libp2p/interfaces": "^3.0.0", - "multiformats": "^11.0.2", - "protons-runtime": "^5.0.0", - "uint8arraylist": "^2.4.3", - "uint8arrays": "^4.0.3" - }, - "devDependencies": { - "@libp2p/crypto": "^1.0.0", - "aegir": "^39.0.10", - "protons": "^7.0.2" - }, - "typedoc": { - "entryPoint": "./src/index.ts" - } -} diff --git a/packages/record/tsconfig.json b/packages/record/tsconfig.json deleted file mode 100644 index e59bf6ba31..0000000000 --- a/packages/record/tsconfig.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "extends": "aegir/src/config/tsconfig.aegir.json", - "compilerOptions": { - "outDir": "dist" - }, - "include": [ - "src", - "test" - ], - "references": [ - { - "path": "../crypto" - }, - { - "path": "../interface-dht" - }, - { - "path": "../interfaces" - } - ] -} diff --git a/packages/stream-multiplexer-mplex/package.json b/packages/stream-multiplexer-mplex/package.json index aaafc96a07..3e7831a9b2 100644 --- a/packages/stream-multiplexer-mplex/package.json +++ b/packages/stream-multiplexer-mplex/package.json @@ -56,9 +56,7 @@ "test:electron-main": "aegir test -t electron-main" }, "dependencies": { - "@libp2p/interface-connection": "^5.0.0", - "@libp2p/interface-stream-muxer": "^4.0.0", - "@libp2p/interfaces": "^3.0.0", + "@libp2p/interface": "~0.0.1", "@libp2p/logger": "^2.0.0", "abortable-iterator": "^5.0.1", "any-signal": "^4.1.1", @@ -68,11 +66,11 @@ "it-stream-types": "^2.0.1", "rate-limiter-flexible": "^2.3.11", "uint8arraylist": "^2.4.3", - "uint8arrays": "^4.0.3", + "uint8arrays": "^4.0.4", "varint": "^6.0.0" }, "devDependencies": { - "@libp2p/interface-stream-muxer-compliance-tests": "^7.0.0", + "@libp2p/interface-compliance-tests": "^3.0.0", "@types/varint": "^6.0.0", "aegir": "^39.0.10", "cborg": "^2.0.1", diff --git a/packages/stream-multiplexer-mplex/src/index.ts b/packages/stream-multiplexer-mplex/src/index.ts index d78f65255d..c7ef9549df 100644 --- a/packages/stream-multiplexer-mplex/src/index.ts +++ b/packages/stream-multiplexer-mplex/src/index.ts @@ -1,5 +1,5 @@ import { MplexStreamMuxer } from './mplex.js' -import type { StreamMuxer, StreamMuxerFactory, StreamMuxerInit } from '@libp2p/interface-stream-muxer' +import type { StreamMuxer, StreamMuxerFactory, StreamMuxerInit } from '@libp2p/interface/stream-muxer' export interface MplexInit { /** diff --git a/packages/stream-multiplexer-mplex/src/mplex.ts b/packages/stream-multiplexer-mplex/src/mplex.ts index 7b216711a7..a984315b09 100644 --- a/packages/stream-multiplexer-mplex/src/mplex.ts +++ b/packages/stream-multiplexer-mplex/src/mplex.ts @@ -1,4 +1,4 @@ -import { CodeError } from '@libp2p/interfaces/errors' +import { CodeError } from '@libp2p/interface/errors' import { logger } from '@libp2p/logger' import { abortableSource } from 'abortable-iterator' import { anySignal } from 'any-signal' @@ -10,8 +10,8 @@ import { encode } from './encode.js' import { MessageTypes, MessageTypeNames, type Message } from './message-types.js' import { createStream } from './stream.js' import type { MplexInit } from './index.js' -import type { Stream } from '@libp2p/interface-connection' -import type { StreamMuxer, StreamMuxerInit } from '@libp2p/interface-stream-muxer' +import type { Stream } from '@libp2p/interface/connection' +import type { StreamMuxer, StreamMuxerInit } from '@libp2p/interface/stream-muxer' import type { Sink, Source } from 'it-stream-types' import type { Uint8ArrayList } from 'uint8arraylist' diff --git a/packages/stream-multiplexer-mplex/src/stream.ts b/packages/stream-multiplexer-mplex/src/stream.ts index 14d705ecb9..45fc21b57a 100644 --- a/packages/stream-multiplexer-mplex/src/stream.ts +++ b/packages/stream-multiplexer-mplex/src/stream.ts @@ -1,4 +1,4 @@ -import { AbstractStream, type AbstractStreamInit } from '@libp2p/interface-stream-muxer/stream' +import { AbstractStream, type AbstractStreamInit } from '@libp2p/interface/stream-muxer/stream' import { Uint8ArrayList } from 'uint8arraylist' import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' import { MAX_MSG_SIZE } from './decode.js' diff --git a/packages/stream-multiplexer-mplex/test/compliance.spec.ts b/packages/stream-multiplexer-mplex/test/compliance.spec.ts index 3162211646..e9f21edbd5 100644 --- a/packages/stream-multiplexer-mplex/test/compliance.spec.ts +++ b/packages/stream-multiplexer-mplex/test/compliance.spec.ts @@ -1,6 +1,6 @@ /* eslint-env mocha */ -import tests from '@libp2p/interface-stream-muxer-compliance-tests' +import tests from '@libp2p/interface-compliance-tests/stream-muxer' import { mplex } from '../src/index.js' describe('compliance', () => { diff --git a/packages/stream-multiplexer-mplex/tsconfig.json b/packages/stream-multiplexer-mplex/tsconfig.json index 5eeae73ed9..c1ac576e1b 100644 --- a/packages/stream-multiplexer-mplex/tsconfig.json +++ b/packages/stream-multiplexer-mplex/tsconfig.json @@ -9,16 +9,10 @@ ], "references": [ { - "path": "../interface-connection" + "path": "../interface" }, { - "path": "../interface-stream-muxer" - }, - { - "path": "../interface-stream-muxer-compliance-tests" - }, - { - "path": "../interfaces" + "path": "../interface-compliance-tests" }, { "path": "../logger" diff --git a/packages/topology/CHANGELOG.md b/packages/topology/CHANGELOG.md deleted file mode 100644 index bad4141262..0000000000 --- a/packages/topology/CHANGELOG.md +++ /dev/null @@ -1,248 +0,0 @@ -## [4.0.3](https://github.com/libp2p/js-libp2p-topology/compare/v4.0.2...v4.0.3) (2023-06-15) - - -### Dependencies - -* **dev:** bump aegir from 37.12.1 to 38.1.8 ([#31](https://github.com/libp2p/js-libp2p-topology/issues/31)) ([628f1a8](https://github.com/libp2p/js-libp2p-topology/commit/628f1a8618411dff87c9283292da0e43f95d57d1)) - -## [4.0.2](https://github.com/libp2p/js-libp2p-topology/compare/v4.0.1...v4.0.2) (2023-06-15) - - -### Trivial Changes - -* Update .github/workflows/semantic-pull-request.yml [skip ci] ([944bcae](https://github.com/libp2p/js-libp2p-topology/commit/944bcae65d709ac70f986df403e367cb898f7700)) -* Update .github/workflows/semantic-pull-request.yml [skip ci] ([8d3e9af](https://github.com/libp2p/js-libp2p-topology/commit/8d3e9afa5925856b5ad89e46d87aa944ff7678d3)) -* Update .github/workflows/semantic-pull-request.yml [skip ci] ([aae4c14](https://github.com/libp2p/js-libp2p-topology/commit/aae4c146b0fa310920a229867ac188a89cb5b951)) -* Update .github/workflows/semantic-pull-request.yml [skip ci] ([eed0e46](https://github.com/libp2p/js-libp2p-topology/commit/eed0e462b9c9d9dd51adffd9755f1bb7fa911432)) -* Update .github/workflows/stale.yml [skip ci] ([fdc316d](https://github.com/libp2p/js-libp2p-topology/commit/fdc316d09807aeb69df9c63810255a249c311bad)) - - -### Dependencies - -* bump it-all from 2.0.1 to 3.0.1 ([#32](https://github.com/libp2p/js-libp2p-topology/issues/32)) ([d2db182](https://github.com/libp2p/js-libp2p-topology/commit/d2db18262c918db5a61a946a3b42a406031d4861)) - -## [4.0.1](https://github.com/libp2p/js-libp2p-topology/compare/v4.0.0...v4.0.1) (2023-01-13) - - -### Dependencies - -* remove err-code ([#18](https://github.com/libp2p/js-libp2p-topology/issues/18)) ([70cc52b](https://github.com/libp2p/js-libp2p-topology/commit/70cc52b0da883fba9288fab1de362d3f71707f28)) - -## [4.0.0](https://github.com/libp2p/js-libp2p-topology/compare/v3.0.2...v4.0.0) (2023-01-06) - - -### ⚠ BREAKING CHANGES - -* update to multiformats v11 (#17) - -### Bug Fixes - -* update to multiformats v11 ([#17](https://github.com/libp2p/js-libp2p-topology/issues/17)) ([e7d9c91](https://github.com/libp2p/js-libp2p-topology/commit/e7d9c91e1c0697ec885828c661e874dc15bd0919)) - -## [3.0.2](https://github.com/libp2p/js-libp2p-topology/compare/v3.0.1...v3.0.2) (2022-12-16) - - -### Documentation - -* publish api docs ([#16](https://github.com/libp2p/js-libp2p-topology/issues/16)) ([285caba](https://github.com/libp2p/js-libp2p-topology/commit/285caba282d75cb9156a298c7a1b6463d58e3064)) - -## [3.0.1](https://github.com/libp2p/js-libp2p-topology/compare/v3.0.0...v3.0.1) (2022-09-21) - - -### Bug Fixes - -* remove unused deps and update project config ([#9](https://github.com/libp2p/js-libp2p-topology/issues/9)) ([2aa138f](https://github.com/libp2p/js-libp2p-topology/commit/2aa138f4784662ada8f82304d2b50858a0b0e5ba)) - - -### Trivial Changes - -* Update .github/workflows/stale.yml [skip ci] ([ce9f715](https://github.com/libp2p/js-libp2p-topology/commit/ce9f71582680514156031f75fa00e8925d12b85e)) - -## [3.0.0](https://github.com/libp2p/js-libp2p-pubsub-topology/compare/v2.0.0...v3.0.0) (2022-06-16) - - -### ⚠ BREAKING CHANGES - -* registrar API has changed - -### Trivial Changes - -* update deps ([#6](https://github.com/libp2p/js-libp2p-pubsub-topology/issues/6)) ([ad2330b](https://github.com/libp2p/js-libp2p-pubsub-topology/commit/ad2330be33f4bf5ba91ef67f92eb23109504fb0a)) - -## [2.0.0](https://github.com/libp2p/js-libp2p-pubsub-topology/compare/v1.1.9...v2.0.0) (2022-06-14) - - -### ⚠ BREAKING CHANGES - -* uses new single-issue libp2p interface modules - -### Features - -* update to latest interfaces ([#2](https://github.com/libp2p/js-libp2p-pubsub-topology/issues/2)) ([201ade5](https://github.com/libp2p/js-libp2p-pubsub-topology/commit/201ade5b8ce2b8233d267f71a5ffd685110a4115)) - -### [1.1.9](https://github.com/libp2p/js-libp2p-pubsub-topology/compare/v1.1.8...v1.1.9) (2022-06-09) - - -### Trivial Changes - -* update readme ([#1](https://github.com/libp2p/js-libp2p-pubsub-topology/issues/1)) ([f1cfdc6](https://github.com/libp2p/js-libp2p-pubsub-topology/commit/f1cfdc67808ae2ec6fa01a54f96d708129b25371)) - -## [@libp2p/topology-v1.1.8](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/topology-v1.1.7...@libp2p/topology-v1.1.8) (2022-05-20) - - -### Bug Fixes - -* update interfaces ([#215](https://github.com/libp2p/js-libp2p-interfaces/issues/215)) ([72e6890](https://github.com/libp2p/js-libp2p-interfaces/commit/72e6890826dadbd6e7cbba5536bde350ca4286e6)) - -## [@libp2p/topology-v1.1.7](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/topology-v1.1.6...@libp2p/topology-v1.1.7) (2022-04-08) - - -### Bug Fixes - -* swap protobufjs for protons ([#191](https://github.com/libp2p/js-libp2p-interfaces/issues/191)) ([d72b30c](https://github.com/libp2p/js-libp2p-interfaces/commit/d72b30cfca4b9145e0b31db28e8fa3329a180e83)) - - -### Trivial Changes - -* update aegir ([#192](https://github.com/libp2p/js-libp2p-interfaces/issues/192)) ([41c1494](https://github.com/libp2p/js-libp2p-interfaces/commit/41c14941e8b67d6601a90b4d48a2776573d55e60)) - -## [@libp2p/topology-v1.1.6](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/topology-v1.1.5...@libp2p/topology-v1.1.6) (2022-03-15) - - -### Bug Fixes - -* simplify transport interface, update interfaces for use with libp2p ([#180](https://github.com/libp2p/js-libp2p-interfaces/issues/180)) ([ec81622](https://github.com/libp2p/js-libp2p-interfaces/commit/ec81622e5b7c6d256e0f8aed6d3695642473293b)) - -## [@libp2p/topology-v1.1.5](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/topology-v1.1.4...@libp2p/topology-v1.1.5) (2022-02-27) - - -### Bug Fixes - -* rename crypto to connection-encrypter ([#179](https://github.com/libp2p/js-libp2p-interfaces/issues/179)) ([d197f55](https://github.com/libp2p/js-libp2p-interfaces/commit/d197f554d7cdadb3b05ed2d6c69fda2c4362b1eb)) - -## [@libp2p/topology-v1.1.4](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/topology-v1.1.3...@libp2p/topology-v1.1.4) (2022-02-27) - - -### Bug Fixes - -* update package config and add connection gater interface ([#178](https://github.com/libp2p/js-libp2p-interfaces/issues/178)) ([c6079a6](https://github.com/libp2p/js-libp2p-interfaces/commit/c6079a6367f004788062df3e30ad2e26330d947b)) - -## [@libp2p/topology-v1.1.3](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/topology-v1.1.2...@libp2p/topology-v1.1.3) (2022-02-11) - - -### Bug Fixes - -* simpler topologies ([#164](https://github.com/libp2p/js-libp2p-interfaces/issues/164)) ([45fcaa1](https://github.com/libp2p/js-libp2p-interfaces/commit/45fcaa10a6a3215089340ff2eff117d7fd1100e7)) - -## [@libp2p/topology-v1.1.2](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/topology-v1.1.1...@libp2p/topology-v1.1.2) (2022-02-10) - - -### Bug Fixes - -* make registrar simpler ([#163](https://github.com/libp2p/js-libp2p-interfaces/issues/163)) ([d122f3d](https://github.com/libp2p/js-libp2p-interfaces/commit/d122f3daaccc04039d90814960da92b513265644)) - -## [@libp2p/topology-v1.1.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/topology-v1.1.0...@libp2p/topology-v1.1.1) (2022-02-10) - - -### Bug Fixes - -* remove node event emitters ([#161](https://github.com/libp2p/js-libp2p-interfaces/issues/161)) ([221fb6a](https://github.com/libp2p/js-libp2p-interfaces/commit/221fb6a024430dc56288d73d8b8ce1aa88427701)) - -## [@libp2p/topology-v1.1.0](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/topology-v1.0.3...@libp2p/topology-v1.1.0) (2022-02-09) - - -### Features - -* add peer store/records, and streams are just streams ([#160](https://github.com/libp2p/js-libp2p-interfaces/issues/160)) ([8860a0c](https://github.com/libp2p/js-libp2p-interfaces/commit/8860a0cd46b359a5648402d83870f7ff957222fe)) - -## [@libp2p/topology-v1.0.3](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/topology-v1.0.2...@libp2p/topology-v1.0.3) (2022-01-15) - - -### Trivial Changes - -* update project config ([#149](https://github.com/libp2p/js-libp2p-interfaces/issues/149)) ([6eb8556](https://github.com/libp2p/js-libp2p-interfaces/commit/6eb85562c0da167d222808da10a7914daf12970b)) - -## [@libp2p/topology-v1.0.2](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/topology-v1.0.1...@libp2p/topology-v1.0.2) (2022-01-08) - - -### Trivial Changes - -* add semantic release config ([#141](https://github.com/libp2p/js-libp2p-interfaces/issues/141)) ([5f0de59](https://github.com/libp2p/js-libp2p-interfaces/commit/5f0de59136b6343d2411abb2d6a4dd2cd0b7efe4)) -* update package versions ([#140](https://github.com/libp2p/js-libp2p-interfaces/issues/140)) ([cd844f6](https://github.com/libp2p/js-libp2p-interfaces/commit/cd844f6e39f4ee50d006e86eac8dadf696900eb5)) - -# Change Log - -All notable changes to this project will be documented in this file. -See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -# 0.2.0 (2022-01-04) - - -### chore - -* update libp2p-crypto and peer-id ([c711e8b](https://github.com/libp2p/js-libp2p-interfaces/commit/c711e8bd4d606f6974b13fad2eeb723f93cebb87)) - - -### Features - -* add auto-publish ([7aede5d](https://github.com/libp2p/js-libp2p-interfaces/commit/7aede5df39ea6b5f243348ec9a212b3e33c16a81)) -* simpler peer id ([#117](https://github.com/libp2p/js-libp2p-interfaces/issues/117)) ([fa2c4f5](https://github.com/libp2p/js-libp2p-interfaces/commit/fa2c4f5be74a5cfc11489771881e57b4e53bf174)) -* split out code, convert to typescript ([#111](https://github.com/libp2p/js-libp2p-interfaces/issues/111)) ([e174bba](https://github.com/libp2p/js-libp2p-interfaces/commit/e174bba889388269b806643c79a6b53c8d6a0f8c)), closes [#110](https://github.com/libp2p/js-libp2p-interfaces/issues/110) [#101](https://github.com/libp2p/js-libp2p-interfaces/issues/101) -* update package names ([#133](https://github.com/libp2p/js-libp2p-interfaces/issues/133)) ([337adc9](https://github.com/libp2p/js-libp2p-interfaces/commit/337adc9a9bc0278bdae8cbce9c57d07a83c8b5c2)) - - -### BREAKING CHANGES - -* requires node 15+ -* not all fields from concrete classes have been added to the interfaces, some adjustment may be necessary as this gets rolled out - - - - - -## [0.3.1](https://github.com/libp2p/js-libp2p-interfaces/compare/libp2p-topology@0.3.0...libp2p-topology@0.3.1) (2022-01-02) - -**Note:** Version bump only for package libp2p-topology - - - - - -# [0.3.0](https://github.com/libp2p/js-libp2p-interfaces/compare/libp2p-topology@0.2.0...libp2p-topology@0.3.0) (2022-01-02) - - -### Features - -* simpler peer id ([#117](https://github.com/libp2p/js-libp2p-interfaces/issues/117)) ([fa2c4f5](https://github.com/libp2p/js-libp2p-interfaces/commit/fa2c4f5be74a5cfc11489771881e57b4e53bf174)) - - - - - -# [0.2.0](https://github.com/libp2p/js-libp2p-interfaces/compare/libp2p-topology@0.1.0...libp2p-topology@0.2.0) (2021-12-02) - - -### chore - -* update libp2p-crypto and peer-id ([c711e8b](https://github.com/libp2p/js-libp2p-interfaces/commit/c711e8bd4d606f6974b13fad2eeb723f93cebb87)) - - -### BREAKING CHANGES - -* requires node 15+ - - - - - -# 0.1.0 (2021-11-22) - - -### Features - -* split out code, convert to typescript ([#111](https://github.com/libp2p/js-libp2p-interfaces/issues/111)) ([e174bba](https://github.com/libp2p/js-libp2p-interfaces/commit/e174bba889388269b806643c79a6b53c8d6a0f8c)), closes [#110](https://github.com/libp2p/js-libp2p-interfaces/issues/110) [#101](https://github.com/libp2p/js-libp2p-interfaces/issues/101) - - -### BREAKING CHANGES - -* not all fields from concrete classes have been added to the interfaces, some adjustment may be necessary as this gets rolled out diff --git a/packages/topology/LICENSE b/packages/topology/LICENSE deleted file mode 100644 index 20ce483c86..0000000000 --- a/packages/topology/LICENSE +++ /dev/null @@ -1,4 +0,0 @@ -This project is dual licensed under MIT and Apache-2.0. - -MIT: https://www.opensource.org/licenses/mit -Apache-2.0: https://www.apache.org/licenses/license-2.0 diff --git a/packages/topology/LICENSE-APACHE b/packages/topology/LICENSE-APACHE deleted file mode 100644 index 14478a3b60..0000000000 --- a/packages/topology/LICENSE-APACHE +++ /dev/null @@ -1,5 +0,0 @@ -Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - -http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. diff --git a/packages/topology/LICENSE-MIT b/packages/topology/LICENSE-MIT deleted file mode 100644 index 72dc60d84b..0000000000 --- a/packages/topology/LICENSE-MIT +++ /dev/null @@ -1,19 +0,0 @@ -The MIT License (MIT) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/packages/topology/README.md b/packages/topology/README.md deleted file mode 100644 index 915f0bc473..0000000000 --- a/packages/topology/README.md +++ /dev/null @@ -1,45 +0,0 @@ -# @libp2p/topology - -[![libp2p.io](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](http://libp2p.io/) -[![Discuss](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg?style=flat-square)](https://discuss.libp2p.io) -[![codecov](https://img.shields.io/codecov/c/github/libp2p/js-libp2p.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p) -[![CI](https://img.shields.io/github/actions/workflow/status/libp2p/js-libp2p/main.yml?branch=master\&style=flat-square)](https://github.com/libp2p/js-libp2p/actions/workflows/main.yml?query=branch%3Amaster) - -> libp2p network topology - -## Table of contents - -- [Install](#install) -- [Usage](#usage) -- [API Docs](#api-docs) -- [License](#license) -- [Contribution](#contribution) - -## Install - -```console -$ npm i @libp2p/topology -``` - -## Usage - -```javascript -import { createTopology } from '@libp2p/topology' - -const topology = createTopology({ ... }) -``` - -## API Docs - -- - -## License - -Licensed under either of - -- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / ) -- MIT ([LICENSE-MIT](LICENSE-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/packages/topology/package.json b/packages/topology/package.json deleted file mode 100644 index 055834a6bd..0000000000 --- a/packages/topology/package.json +++ /dev/null @@ -1,74 +0,0 @@ -{ - "name": "@libp2p/topology", - "version": "4.0.3", - "description": "libp2p network topology", - "license": "Apache-2.0 OR MIT", - "homepage": "https://github.com/libp2p/js-libp2p/tree/master/packages/topology#readme", - "repository": { - "type": "git", - "url": "git+https://github.com/libp2p/js-libp2p.git" - }, - "bugs": { - "url": "https://github.com/libp2p/js-libp2p/issues" - }, - "keywords": [ - "interface", - "libp2p" - ], - "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" - }, - "./multicodec-topology": { - "types": "./dist/src/multicodec-topology.d.ts", - "import": "./dist/src/multicodec-topology.js" - } - }, - "eslintConfig": { - "extends": "ipfs", - "parserOptions": { - "sourceType": "module" - } - }, - "scripts": { - "clean": "aegir clean", - "lint": "aegir lint", - "dep-check": "aegir dep-check", - "build": "aegir build" - }, - "dependencies": { - "@libp2p/interface-peer-id": "^2.0.0", - "@libp2p/interface-registrar": "^2.0.0" - }, - "devDependencies": { - "aegir": "^39.0.10" - }, - "typedoc": { - "entryPoint": "./src/index.ts" - } -} diff --git a/packages/topology/src/index.ts b/packages/topology/src/index.ts deleted file mode 100644 index d81878b728..0000000000 --- a/packages/topology/src/index.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { topologySymbol as symbol } from '@libp2p/interface-registrar' -import type { PeerId } from '@libp2p/interface-peer-id' -import type { Topology, TopologyInit, onConnectHandler, onDisconnectHandler, Registrar } from '@libp2p/interface-registrar' - -const noop = (): void => {} - -class TopologyImpl implements Topology { - public min: number - public max: number - - /** - * Set of peers that support the protocol - */ - public peers: Set - public onConnect: onConnectHandler - public onDisconnect: onDisconnectHandler - - protected registrar: Registrar | undefined - - constructor (init: TopologyInit) { - this.min = init.min ?? 0 - this.max = init.max ?? Infinity - this.peers = new Set() - - this.onConnect = init.onConnect ?? noop - this.onDisconnect = init.onDisconnect ?? noop - } - - get [Symbol.toStringTag] (): string { - return symbol.toString() - } - - readonly [symbol] = true - - async setRegistrar (registrar: Registrar): Promise { - this.registrar = registrar - } - - /** - * Notify about peer disconnected event - */ - disconnect (peerId: PeerId): void { - this.onDisconnect(peerId) - } -} - -export function createTopology (init: TopologyInit): Topology { - return new TopologyImpl(init) -} diff --git a/packages/topology/tsconfig.json b/packages/topology/tsconfig.json deleted file mode 100644 index c1017faac2..0000000000 --- a/packages/topology/tsconfig.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "extends": "aegir/src/config/tsconfig.aegir.json", - "compilerOptions": { - "outDir": "dist" - }, - "include": [ - "src", - "test" - ], - "references": [ - { - "path": "../interface-peer-id" - }, - { - "path": "../interface-registrar" - } - ] -} diff --git a/packages/tracked-map/CHANGELOG.md b/packages/tracked-map/CHANGELOG.md deleted file mode 100644 index 4d32eb15c7..0000000000 --- a/packages/tracked-map/CHANGELOG.md +++ /dev/null @@ -1,139 +0,0 @@ -## [3.0.3](https://github.com/libp2p/js-libp2p-tracked-map/compare/v3.0.2...v3.0.3) (2023-06-15) - - -### Trivial Changes - -* Update .github/workflows/semantic-pull-request.yml [skip ci] ([6447152](https://github.com/libp2p/js-libp2p-tracked-map/commit/6447152525c274482d6f8e78ef857e68b57d96bd)) -* Update .github/workflows/semantic-pull-request.yml [skip ci] ([80163d7](https://github.com/libp2p/js-libp2p-tracked-map/commit/80163d7b950106a653441171f7fc455980935f12)) -* Update .github/workflows/semantic-pull-request.yml [skip ci] ([5fc1905](https://github.com/libp2p/js-libp2p-tracked-map/commit/5fc1905f868da61cdc6f75d5ef108653eb20072e)) -* Update .github/workflows/semantic-pull-request.yml [skip ci] ([cb4e22d](https://github.com/libp2p/js-libp2p-tracked-map/commit/cb4e22de6b601c52fbab09e384173590e2ecc0d8)) -* Update .github/workflows/stale.yml [skip ci] ([bda0a65](https://github.com/libp2p/js-libp2p-tracked-map/commit/bda0a656569ae5a6e47cf2d58fa83916d4b2af19)) - - -### Dependencies - -* **dev:** bump aegir from 37.12.1 to 38.1.7 ([#30](https://github.com/libp2p/js-libp2p-tracked-map/issues/30)) ([42a4d8b](https://github.com/libp2p/js-libp2p-tracked-map/commit/42a4d8be71ea05c435895cf3f139d3fbfee95708)) - -## [3.0.2](https://github.com/libp2p/js-libp2p-tracked-map/compare/v3.0.1...v3.0.2) (2022-12-16) - - -### Documentation - -* update docs ([6ad441d](https://github.com/libp2p/js-libp2p-tracked-map/commit/6ad441df9be1a516a17d2c175218f11af204e559)) - -## [3.0.1](https://github.com/libp2p/js-libp2p-tracked-map/compare/v3.0.0...v3.0.1) (2022-12-16) - - -### Documentation - -* publish api docs ([#20](https://github.com/libp2p/js-libp2p-tracked-map/issues/20)) ([61446e1](https://github.com/libp2p/js-libp2p-tracked-map/commit/61446e15a05988ab3e18eafeac0adf9cb153414f)) - -## [3.0.0](https://github.com/libp2p/js-libp2p-tracked-map/compare/v2.0.2...v3.0.0) (2022-11-05) - - -### ⚠ BREAKING CHANGES - -* requires @libp2p/interface-metrics v4 - -### Bug Fixes - -* update @libp2p/interface-metrics to v4 ([#12](https://github.com/libp2p/js-libp2p-tracked-map/issues/12)) ([6a97551](https://github.com/libp2p/js-libp2p-tracked-map/commit/6a97551c3c3c718c63f7ba3102b83b7ac1e08d8f)) - - -### Trivial Changes - -* Update .github/workflows/stale.yml [skip ci] ([fb388de](https://github.com/libp2p/js-libp2p-tracked-map/commit/fb388de359071a8c66ae8e17cca14f06a878aa20)) -* update project config ([#13](https://github.com/libp2p/js-libp2p-tracked-map/issues/13)) ([e58d7df](https://github.com/libp2p/js-libp2p-tracked-map/commit/e58d7dfefe80daebee042b4a5925f847ae6ded09)) - -## [2.0.2](https://github.com/libp2p/js-libp2p-tracked-map/compare/v2.0.1...v2.0.2) (2022-08-12) - - -### Dependencies - -* update interface deps ([#9](https://github.com/libp2p/js-libp2p-tracked-map/issues/9)) ([424b9e8](https://github.com/libp2p/js-libp2p-tracked-map/commit/424b9e81db1d1005fcfdfd599f590e7ff1c30a68)) - -## [2.0.1](https://github.com/libp2p/js-libp2p-tracked-map/compare/v2.0.0...v2.0.1) (2022-07-01) - - -### Trivial Changes - -* update @libp2p/interface-metrics ([#7](https://github.com/libp2p/js-libp2p-tracked-map/issues/7)) ([de16bc7](https://github.com/libp2p/js-libp2p-tracked-map/commit/de16bc7776b52b6eee8e5d4a14aa9cff484a21ae)) - -## [2.0.0](https://github.com/libp2p/js-libp2p-tracked-map/compare/v1.0.8...v2.0.0) (2022-06-28) - - -### ⚠ BREAKING CHANGES - -* accepts a @libp2p/interface-metrics ComponentMetricsTracker - -### Bug Fixes - -* update deps ([#5](https://github.com/libp2p/js-libp2p-tracked-map/issues/5)) ([a134743](https://github.com/libp2p/js-libp2p-tracked-map/commit/a1347439d95346f5361ec030e159d53e22402914)) - -### [1.0.8](https://github.com/libp2p/js-libp2p-tracked-map/compare/v1.0.7...v1.0.8) (2022-06-09) - - -### Trivial Changes - -* fix project config ([#1](https://github.com/libp2p/js-libp2p-tracked-map/issues/1)) ([eb3d2ea](https://github.com/libp2p/js-libp2p-tracked-map/commit/eb3d2eaf094d51b4724d040325ac4e7bb3daa74b)) - -## [@libp2p/tracked-map-v1.0.7](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/tracked-map-v1.0.6...@libp2p/tracked-map-v1.0.7) (2022-05-20) - - -### Bug Fixes - -* update interfaces ([#215](https://github.com/libp2p/js-libp2p-interfaces/issues/215)) ([72e6890](https://github.com/libp2p/js-libp2p-interfaces/commit/72e6890826dadbd6e7cbba5536bde350ca4286e6)) - -## [@libp2p/tracked-map-v1.0.6](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/tracked-map-v1.0.5...@libp2p/tracked-map-v1.0.6) (2022-05-10) - - -### Trivial Changes - -* **deps:** bump sinon from 13.0.2 to 14.0.0 ([#211](https://github.com/libp2p/js-libp2p-interfaces/issues/211)) ([8859f70](https://github.com/libp2p/js-libp2p-interfaces/commit/8859f70943c0bcdb210f54a338ae901739e5e6f2)) - -## [@libp2p/tracked-map-v1.0.5](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/tracked-map-v1.0.4...@libp2p/tracked-map-v1.0.5) (2022-04-08) - - -### Bug Fixes - -* swap protobufjs for protons ([#191](https://github.com/libp2p/js-libp2p-interfaces/issues/191)) ([d72b30c](https://github.com/libp2p/js-libp2p-interfaces/commit/d72b30cfca4b9145e0b31db28e8fa3329a180e83)) - - -### Trivial Changes - -* update aegir ([#192](https://github.com/libp2p/js-libp2p-interfaces/issues/192)) ([41c1494](https://github.com/libp2p/js-libp2p-interfaces/commit/41c14941e8b67d6601a90b4d48a2776573d55e60)) - -## [@libp2p/tracked-map-v1.0.4](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/tracked-map-v1.0.3...@libp2p/tracked-map-v1.0.4) (2022-03-15) - - -### Bug Fixes - -* simplify transport interface, update interfaces for use with libp2p ([#180](https://github.com/libp2p/js-libp2p-interfaces/issues/180)) ([ec81622](https://github.com/libp2p/js-libp2p-interfaces/commit/ec81622e5b7c6d256e0f8aed6d3695642473293b)) - -## [@libp2p/tracked-map-v1.0.3](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/tracked-map-v1.0.2...@libp2p/tracked-map-v1.0.3) (2022-02-27) - - -### Bug Fixes - -* rename crypto to connection-encrypter ([#179](https://github.com/libp2p/js-libp2p-interfaces/issues/179)) ([d197f55](https://github.com/libp2p/js-libp2p-interfaces/commit/d197f554d7cdadb3b05ed2d6c69fda2c4362b1eb)) - -## [@libp2p/tracked-map-v1.0.2](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/tracked-map-v1.0.1...@libp2p/tracked-map-v1.0.2) (2022-02-27) - - -### Bug Fixes - -* update package config and add connection gater interface ([#178](https://github.com/libp2p/js-libp2p-interfaces/issues/178)) ([c6079a6](https://github.com/libp2p/js-libp2p-interfaces/commit/c6079a6367f004788062df3e30ad2e26330d947b)) - -## [@libp2p/tracked-map-v1.0.1](https://github.com/libp2p/js-libp2p-interfaces/compare/@libp2p/tracked-map-v1.0.0...@libp2p/tracked-map-v1.0.1) (2022-02-10) - - -### Bug Fixes - -* remove node event emitters ([#161](https://github.com/libp2p/js-libp2p-interfaces/issues/161)) ([221fb6a](https://github.com/libp2p/js-libp2p-interfaces/commit/221fb6a024430dc56288d73d8b8ce1aa88427701)) - -## @libp2p/tracked-map-v1.0.0 (2022-02-05) - - -### Features - -* add tracked-map ([#156](https://github.com/libp2p/js-libp2p-interfaces/issues/156)) ([c17730f](https://github.com/libp2p/js-libp2p-interfaces/commit/c17730f8bca172db85507740eaba81b3cf514d04)) diff --git a/packages/tracked-map/LICENSE b/packages/tracked-map/LICENSE deleted file mode 100644 index 20ce483c86..0000000000 --- a/packages/tracked-map/LICENSE +++ /dev/null @@ -1,4 +0,0 @@ -This project is dual licensed under MIT and Apache-2.0. - -MIT: https://www.opensource.org/licenses/mit -Apache-2.0: https://www.apache.org/licenses/license-2.0 diff --git a/packages/tracked-map/LICENSE-APACHE b/packages/tracked-map/LICENSE-APACHE deleted file mode 100644 index 14478a3b60..0000000000 --- a/packages/tracked-map/LICENSE-APACHE +++ /dev/null @@ -1,5 +0,0 @@ -Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - -http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. diff --git a/packages/tracked-map/LICENSE-MIT b/packages/tracked-map/LICENSE-MIT deleted file mode 100644 index 72dc60d84b..0000000000 --- a/packages/tracked-map/LICENSE-MIT +++ /dev/null @@ -1,19 +0,0 @@ -The MIT License (MIT) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/packages/tracked-map/README.md b/packages/tracked-map/README.md deleted file mode 100644 index 0766685453..0000000000 --- a/packages/tracked-map/README.md +++ /dev/null @@ -1,63 +0,0 @@ -# @libp2p/tracked-map - -[![libp2p.io](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](http://libp2p.io/) -[![Discuss](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg?style=flat-square)](https://discuss.libp2p.io) -[![codecov](https://img.shields.io/codecov/c/github/libp2p/js-libp2p.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p) -[![CI](https://img.shields.io/github/actions/workflow/status/libp2p/js-libp2p/main.yml?branch=master\&style=flat-square)](https://github.com/libp2p/js-libp2p/actions/workflows/main.yml?query=branch%3Amaster) - -> Allows tracking of statistics while libp2p is running - -## Table of contents - -- [Install](#install) - - [Browser ` -``` - -## Description - -A map that reports it's size to the libp2p [Metrics](https://github.com/libp2p/js-libp2p-interfaces/tree/master/packages/libp2p-interfaces/src/metrics#readme) system. - -If metrics are disabled a regular map is used. - -## Example - -```JavaScript -import { trackedMap } from '@libp2p/tracked-map' - -const map = trackedMap({ metrics }) - -map.set('key', 'value') -``` - -## API Docs - -- - -## License - -Licensed under either of - -- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / ) -- MIT ([LICENSE-MIT](LICENSE-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/packages/tracked-map/package.json b/packages/tracked-map/package.json deleted file mode 100644 index 427c7da0de..0000000000 --- a/packages/tracked-map/package.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "name": "@libp2p/tracked-map", - "version": "3.0.3", - "description": "Allows tracking of statistics while libp2p is running", - "license": "Apache-2.0 OR MIT", - "homepage": "https://github.com/libp2p/js-libp2p/tree/master/packages/tracked-map#readme", - "repository": { - "type": "git", - "url": "git+https://github.com/libp2p/js-libp2p.git" - }, - "bugs": { - "url": "https://github.com/libp2p/js-libp2p/issues" - }, - "keywords": [ - "IPFS" - ], - "type": "module", - "types": "./dist/src/index.d.ts", - "files": [ - "src", - "dist", - "!dist/test", - "!**/*.tsbuildinfo" - ], - "exports": { - ".": { - "types": "./dist/src/index.d.ts", - "import": "./dist/src/index.js" - } - }, - "eslintConfig": { - "extends": "ipfs", - "parserOptions": { - "sourceType": "module" - } - }, - "scripts": { - "clean": "aegir clean", - "lint": "aegir lint", - "dep-check": "aegir dep-check", - "build": "aegir build", - "test": "aegir test", - "test:chrome": "aegir test -t browser --cov", - "test:chrome-webworker": "aegir test -t webworker", - "test:firefox": "aegir test -t browser -- --browser firefox", - "test:firefox-webworker": "aegir test -t webworker -- --browser firefox", - "test:node": "aegir test -t node --cov", - "test:electron-main": "aegir test -t electron-main" - }, - "dependencies": { - "@libp2p/interface-metrics": "^4.0.0" - }, - "devDependencies": { - "@types/sinon": "^10.0.15", - "aegir": "^39.0.10", - "sinon": "^15.1.0", - "sinon-ts": "^1.0.0" - }, - "typedoc": { - "entryPoint": "./src/index.ts" - } -} diff --git a/packages/tracked-map/tsconfig.json b/packages/tracked-map/tsconfig.json deleted file mode 100644 index c60dfc7151..0000000000 --- a/packages/tracked-map/tsconfig.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "extends": "aegir/src/config/tsconfig.aegir.json", - "compilerOptions": { - "outDir": "dist" - }, - "include": [ - "src", - "test" - ], - "references": [ - { - "path": "../interface-metrics" - } - ] -} diff --git a/packages/transport-tcp/package.json b/packages/transport-tcp/package.json index 3169f9a5b3..f855e5e9c1 100644 --- a/packages/transport-tcp/package.json +++ b/packages/transport-tcp/package.json @@ -50,10 +50,7 @@ "test:electron-main": "aegir test -t electron-main" }, "dependencies": { - "@libp2p/interface-connection": "^5.0.0", - "@libp2p/interface-metrics": "^4.0.0", - "@libp2p/interface-transport": "^4.0.0", - "@libp2p/interfaces": "^3.0.0", + "@libp2p/interface": "~0.0.1", "@libp2p/logger": "^2.0.0", "@libp2p/utils": "^3.0.0", "@multiformats/mafmt": "^12.1.2", @@ -62,13 +59,12 @@ "stream-to-it": "^0.2.2" }, "devDependencies": { - "@libp2p/interface-mocks": "^12.0.0", - "@libp2p/interface-transport-compliance-tests": "^4.0.0", + "@libp2p/interface-compliance-tests": "^3.0.0", "aegir": "^39.0.10", "it-all": "^3.0.1", "it-pipe": "^3.0.1", "p-defer": "^4.0.0", - "sinon": "^15.1.0", + "sinon": "^15.1.2", "uint8arrays": "^4.0.3" }, "typedoc": { diff --git a/packages/transport-tcp/src/index.ts b/packages/transport-tcp/src/index.ts index 71b50114e2..ed526a2182 100644 --- a/packages/transport-tcp/src/index.ts +++ b/packages/transport-tcp/src/index.ts @@ -1,14 +1,14 @@ import net from 'net' -import { type CreateListenerOptions, type DialOptions, type Listener, symbol, type Transport } from '@libp2p/interface-transport' -import { AbortError, CodeError } from '@libp2p/interfaces/errors' +import { AbortError, CodeError } from '@libp2p/interface/errors' +import { type CreateListenerOptions, type DialOptions, symbol, type Transport, type Listener } from '@libp2p/interface/transport' import { logger } from '@libp2p/logger' import * as mafmt from '@multiformats/mafmt' import { CODE_CIRCUIT, CODE_P2P, CODE_UNIX } from './constants.js' import { type CloseServerOnMaxConnectionsOpts, TCPListener } from './listener.js' import { toMultiaddrConnection } from './socket-to-conn.js' import { multiaddrToNetConfig } from './utils.js' -import type { Connection } from '@libp2p/interface-connection' -import type { CounterGroup, Metrics } from '@libp2p/interface-metrics' +import type { Connection } from '@libp2p/interface/connection' +import type { CounterGroup, Metrics } from '@libp2p/interface/metrics' import type { AbortOptions, Multiaddr } from '@multiformats/multiaddr' import type { Socket, IpcSocketConnectOpts, TcpSocketConnectOpts } from 'net' diff --git a/packages/transport-tcp/src/listener.ts b/packages/transport-tcp/src/listener.ts index 016f9e4228..c7de579471 100644 --- a/packages/transport-tcp/src/listener.ts +++ b/packages/transport-tcp/src/listener.ts @@ -1,5 +1,5 @@ import net from 'net' -import { EventEmitter, CustomEvent } from '@libp2p/interfaces/events' +import { EventEmitter, CustomEvent } from '@libp2p/interface/events' import { logger } from '@libp2p/logger' import { CODE_P2P } from './constants.js' import { toMultiaddrConnection } from './socket-to-conn.js' @@ -9,9 +9,9 @@ import { type NetConfig } from './utils.js' import type { TCPCreateListenerOptions } from './index.js' -import type { MultiaddrConnection, Connection } from '@libp2p/interface-connection' -import type { CounterGroup, MetricGroup, Metrics } from '@libp2p/interface-metrics' -import type { Upgrader, Listener, ListenerEvents } from '@libp2p/interface-transport' +import type { MultiaddrConnection, Connection } from '@libp2p/interface/connection' +import type { CounterGroup, MetricGroup, Metrics } from '@libp2p/interface/metrics' +import type { Listener, ListenerEvents, Upgrader } from '@libp2p/interface/transport' import type { Multiaddr } from '@multiformats/multiaddr' const log = logger('libp2p:tcp:listener') diff --git a/packages/transport-tcp/src/socket-to-conn.ts b/packages/transport-tcp/src/socket-to-conn.ts index 993776a831..e08d2dbecb 100644 --- a/packages/transport-tcp/src/socket-to-conn.ts +++ b/packages/transport-tcp/src/socket-to-conn.ts @@ -1,12 +1,12 @@ -import { CodeError } from '@libp2p/interfaces/errors' +import { CodeError } from '@libp2p/interface/errors' import { logger } from '@libp2p/logger' import { ipPortToMultiaddr as toMultiaddr } from '@libp2p/utils/ip-port-to-multiaddr' // @ts-expect-error no types import toIterable from 'stream-to-it' import { CLOSE_TIMEOUT, SOCKET_TIMEOUT } from './constants.js' import { multiaddrToNetConfig } from './utils.js' -import type { MultiaddrConnection } from '@libp2p/interface-connection' -import type { CounterGroup } from '@libp2p/interface-metrics' +import type { MultiaddrConnection } from '@libp2p/interface/connection' +import type { CounterGroup } from '@libp2p/interface/metrics' import type { Multiaddr } from '@multiformats/multiaddr' import type { Socket } from 'net' diff --git a/packages/transport-tcp/test/compliance.spec.ts b/packages/transport-tcp/test/compliance.spec.ts index 7c6ba85808..ef1602c6d9 100644 --- a/packages/transport-tcp/test/compliance.spec.ts +++ b/packages/transport-tcp/test/compliance.spec.ts @@ -1,5 +1,5 @@ import net from 'net' -import tests from '@libp2p/interface-transport-compliance-tests' +import tests from '@libp2p/interface-compliance-tests/transport' import { multiaddr } from '@multiformats/multiaddr' import sinon from 'sinon' import { tcp } from '../src/index.js' diff --git a/packages/transport-tcp/test/connection.spec.ts b/packages/transport-tcp/test/connection.spec.ts index 67b1d23597..0308d61708 100644 --- a/packages/transport-tcp/test/connection.spec.ts +++ b/packages/transport-tcp/test/connection.spec.ts @@ -1,10 +1,10 @@ -import { mockUpgrader } from '@libp2p/interface-mocks' -import { EventEmitter } from '@libp2p/interfaces/events' +import { EventEmitter } from '@libp2p/interface/events' +import { mockUpgrader } from '@libp2p/interface-compliance-tests/mocks' import { multiaddr } from '@multiformats/multiaddr' import { expect } from 'aegir/chai' import { tcp } from '../src/index.js' -import type { Connection } from '@libp2p/interface-connection' -import type { Transport, Upgrader } from '@libp2p/interface-transport' +import type { Connection } from '@libp2p/interface/connection' +import type { Transport, Upgrader } from '@libp2p/interface/transport' describe('valid localAddr and remoteAddr', () => { let transport: Transport diff --git a/packages/transport-tcp/test/filter.spec.ts b/packages/transport-tcp/test/filter.spec.ts index ce345a4079..195f9a5985 100644 --- a/packages/transport-tcp/test/filter.spec.ts +++ b/packages/transport-tcp/test/filter.spec.ts @@ -1,7 +1,7 @@ import { multiaddr } from '@multiformats/multiaddr' import { expect } from 'aegir/chai' import { tcp } from '../src/index.js' -import type { Transport } from '@libp2p/interface-transport' +import type { Transport } from '@libp2p/interface/transport' describe('filter addrs', () => { const base = '/ip4/127.0.0.1' diff --git a/packages/transport-tcp/test/listen-dial.spec.ts b/packages/transport-tcp/test/listen-dial.spec.ts index f1c54b852e..a2988bce77 100644 --- a/packages/transport-tcp/test/listen-dial.spec.ts +++ b/packages/transport-tcp/test/listen-dial.spec.ts @@ -1,7 +1,7 @@ import os from 'os' import path from 'path' -import { mockRegistrar, mockUpgrader } from '@libp2p/interface-mocks' -import { EventEmitter } from '@libp2p/interfaces/events' +import { EventEmitter } from '@libp2p/interface/events' +import { mockRegistrar, mockUpgrader } from '@libp2p/interface-compliance-tests/mocks' import { multiaddr } from '@multiformats/multiaddr' import { expect } from 'aegir/chai' import all from 'it-all' @@ -9,8 +9,8 @@ import { pipe } from 'it-pipe' import pDefer from 'p-defer' import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' import { tcp } from '../src/index.js' -import type { MultiaddrConnection } from '@libp2p/interface-connection' -import type { Transport, Upgrader } from '@libp2p/interface-transport' +import type { MultiaddrConnection } from '@libp2p/interface/connection' +import type { Transport, Upgrader } from '@libp2p/interface/transport' const isCI = process.env.CI diff --git a/packages/transport-tcp/test/max-connections-close.spec.ts b/packages/transport-tcp/test/max-connections-close.spec.ts index 422a9f8b87..177c71bbe9 100644 --- a/packages/transport-tcp/test/max-connections-close.spec.ts +++ b/packages/transport-tcp/test/max-connections-close.spec.ts @@ -1,7 +1,7 @@ import net from 'node:net' import { promisify } from 'util' -import { mockUpgrader } from '@libp2p/interface-mocks' -import { EventEmitter } from '@libp2p/interfaces/events' +import { EventEmitter } from '@libp2p/interface/events' +import { mockUpgrader } from '@libp2p/interface-compliance-tests/mocks' import { multiaddr } from '@multiformats/multiaddr' import { expect } from 'aegir/chai' import { tcp } from '../src/index.js' diff --git a/packages/transport-tcp/test/max-connections.spec.ts b/packages/transport-tcp/test/max-connections.spec.ts index 4e1634b01f..13d18d0c14 100644 --- a/packages/transport-tcp/test/max-connections.spec.ts +++ b/packages/transport-tcp/test/max-connections.spec.ts @@ -1,7 +1,7 @@ import net from 'node:net' import { promisify } from 'node:util' -import { mockUpgrader } from '@libp2p/interface-mocks' -import { EventEmitter } from '@libp2p/interfaces/events' +import { EventEmitter } from '@libp2p/interface/events' +import { mockUpgrader } from '@libp2p/interface-compliance-tests/mocks' import { multiaddr } from '@multiformats/multiaddr' import { expect } from 'aegir/chai' import { tcp } from '../src/index.js' diff --git a/packages/transport-tcp/tsconfig.json b/packages/transport-tcp/tsconfig.json index 770ba81a1e..b5b8e9d6e1 100644 --- a/packages/transport-tcp/tsconfig.json +++ b/packages/transport-tcp/tsconfig.json @@ -9,22 +9,10 @@ ], "references": [ { - "path": "../interface-connection" + "path": "../interface" }, { - "path": "../interface-metrics" - }, - { - "path": "../interface-mocks" - }, - { - "path": "../interface-transport" - }, - { - "path": "../interface-transport-compliance-tests" - }, - { - "path": "../interfaces" + "path": "../interface-compliance-tests" }, { "path": "../logger" diff --git a/packages/transport-webrtc/package.json b/packages/transport-webrtc/package.json index 3a5543d2ad..b225f72974 100644 --- a/packages/transport-webrtc/package.json +++ b/packages/transport-webrtc/package.json @@ -41,17 +41,12 @@ "lint": "aegir lint", "lint:fix": "aegir lint --fix", "clean": "aegir clean", - "dep-check": "aegir dep-check -i protons" + "dep-check": "aegir dep-check" }, "dependencies": { "@chainsafe/libp2p-noise": "^12.0.1", - "@libp2p/interface-connection": "^5.0.0", - "@libp2p/interface-metrics": "^4.0.0", - "@libp2p/interface-peer-id": "^2.0.0", - "@libp2p/interface-registrar": "^2.0.0", - "@libp2p/interface-stream-muxer": "^4.0.0", - "@libp2p/interface-transport": "^4.0.0", - "@libp2p/interfaces": "^3.0.0", + "@libp2p/interface": "~0.0.1", + "@libp2p/interface-internal": "~0.0.1", "@libp2p/logger": "^2.0.0", "@libp2p/peer-id": "^2.0.0", "@multiformats/mafmt": "^12.1.2", @@ -64,18 +59,17 @@ "it-pushable": "^3.1.3", "it-stream-types": "^2.0.1", "it-to-buffer": "^4.0.2", - "multiformats": "^11.0.2", + "multiformats": "^12.0.1", "multihashes": "^4.0.3", "p-defer": "^4.0.0", "p-event": "^6.0.0", "protons-runtime": "^5.0.0", "uint8arraylist": "^2.4.3", - "uint8arrays": "^4.0.3" + "uint8arrays": "^4.0.4" }, "devDependencies": { "@chainsafe/libp2p-yamux": "^4.0.1", - "@libp2p/interface-libp2p": "^3.0.0", - "@libp2p/interface-mocks": "^12.0.0", + "@libp2p/interface-compliance-tests": "^3.0.0", "@libp2p/peer-id-factory": "^2.0.0", "@libp2p/websockets": "^6.0.0", "@types/sinon": "^10.0.15", @@ -86,7 +80,7 @@ "it-pair": "^2.0.6", "libp2p": "^0.45.0", "protons": "^7.0.2", - "sinon": "^15.1.0", + "sinon": "^15.1.2", "sinon-ts": "^1.0.0" }, "typedoc": { diff --git a/packages/transport-webrtc/src/error.ts b/packages/transport-webrtc/src/error.ts index 360b4e3d73..4c6d3b42df 100644 --- a/packages/transport-webrtc/src/error.ts +++ b/packages/transport-webrtc/src/error.ts @@ -1,5 +1,5 @@ -import { CodeError } from '@libp2p/interfaces/errors' -import type { Direction } from '@libp2p/interface-connection' +import { CodeError } from '@libp2p/interface/errors' +import type { Direction } from '@libp2p/interface/connection' export enum codes { ERR_ALREADY_ABORTED = 'ERR_ALREADY_ABORTED', diff --git a/packages/transport-webrtc/src/index.ts b/packages/transport-webrtc/src/index.ts index b35a16ced4..0245aefcc9 100644 --- a/packages/transport-webrtc/src/index.ts +++ b/packages/transport-webrtc/src/index.ts @@ -1,7 +1,7 @@ import { WebRTCTransport } from './private-to-private/transport.js' import { WebRTCDirectTransport, type WebRTCTransportDirectInit, type WebRTCDirectTransportComponents } from './private-to-public/transport.js' import type { WebRTCTransportComponents, WebRTCTransportInit } from './private-to-private/transport.js' -import type { Transport } from '@libp2p/interface-transport' +import type { Transport } from '@libp2p/interface/transport' /** * @param {WebRTCTransportDirectInit} init - WebRTC direct transport configuration diff --git a/packages/transport-webrtc/src/maconn.ts b/packages/transport-webrtc/src/maconn.ts index 3ce4e3c458..2281db9fa9 100644 --- a/packages/transport-webrtc/src/maconn.ts +++ b/packages/transport-webrtc/src/maconn.ts @@ -1,7 +1,7 @@ import { logger } from '@libp2p/logger' import { nopSink, nopSource } from './util.js' -import type { MultiaddrConnection, MultiaddrConnectionTimeline } from '@libp2p/interface-connection' -import type { CounterGroup } from '@libp2p/interface-metrics' +import type { MultiaddrConnection, MultiaddrConnectionTimeline } from '@libp2p/interface/connection' +import type { CounterGroup } from '@libp2p/interface/metrics' import type { Multiaddr } from '@multiformats/multiaddr' import type { Source, Sink } from 'it-stream-types' diff --git a/packages/transport-webrtc/src/muxer.ts b/packages/transport-webrtc/src/muxer.ts index 95f925cf81..93825a923b 100644 --- a/packages/transport-webrtc/src/muxer.ts +++ b/packages/transport-webrtc/src/muxer.ts @@ -1,9 +1,9 @@ import { createStream } from './stream.js' import { nopSink, nopSource } from './util.js' import type { DataChannelOpts } from './stream.js' -import type { Stream } from '@libp2p/interface-connection' -import type { CounterGroup } from '@libp2p/interface-metrics' -import type { StreamMuxer, StreamMuxerFactory, StreamMuxerInit } from '@libp2p/interface-stream-muxer' +import type { Stream } from '@libp2p/interface/connection' +import type { CounterGroup } from '@libp2p/interface/metrics' +import type { StreamMuxer, StreamMuxerFactory, StreamMuxerInit } from '@libp2p/interface/stream-muxer' import type { Source, Sink } from 'it-stream-types' import type { Uint8ArrayList } from 'uint8arraylist' diff --git a/packages/transport-webrtc/src/private-to-private/handler.ts b/packages/transport-webrtc/src/private-to-private/handler.ts index 176031b4fe..9818a224b8 100644 --- a/packages/transport-webrtc/src/private-to-private/handler.ts +++ b/packages/transport-webrtc/src/private-to-private/handler.ts @@ -6,9 +6,9 @@ import { DataChannelMuxerFactory } from '../muxer.js' import { Message } from './pb/message.js' import { readCandidatesUntilConnected, resolveOnConnected } from './util.js' import type { DataChannelOpts } from '../stream.js' -import type { Stream } from '@libp2p/interface-connection' -import type { IncomingStreamData } from '@libp2p/interface-registrar' -import type { StreamMuxerFactory } from '@libp2p/interface-stream-muxer' +import type { Stream } from '@libp2p/interface/connection' +import type { StreamMuxerFactory } from '@libp2p/interface/stream-muxer' +import type { IncomingStreamData } from '@libp2p/interface-internal/registrar' const DEFAULT_TIMEOUT = 30 * 1000 diff --git a/packages/transport-webrtc/src/private-to-private/listener.ts b/packages/transport-webrtc/src/private-to-private/listener.ts index 018e569264..1dccac6e25 100644 --- a/packages/transport-webrtc/src/private-to-private/listener.ts +++ b/packages/transport-webrtc/src/private-to-private/listener.ts @@ -1,7 +1,8 @@ -import { EventEmitter } from '@libp2p/interfaces/events' +import { EventEmitter } from '@libp2p/interface/events' import { Circuit } from '@multiformats/mafmt' -import type { PeerId } from '@libp2p/interface-peer-id' -import type { ListenerEvents, Listener, TransportManager } from '@libp2p/interface-transport' +import type { PeerId } from '@libp2p/interface/peer-id' +import type { ListenerEvents, Listener } from '@libp2p/interface/transport' +import type { TransportManager } from '@libp2p/interface-internal/transport-manager' import type { Multiaddr } from '@multiformats/multiaddr' export interface ListenerOptions { diff --git a/packages/transport-webrtc/src/private-to-private/transport.ts b/packages/transport-webrtc/src/private-to-private/transport.ts index 196854d24e..ca24931930 100644 --- a/packages/transport-webrtc/src/private-to-private/transport.ts +++ b/packages/transport-webrtc/src/private-to-private/transport.ts @@ -1,5 +1,5 @@ -import { type CreateListenerOptions, type DialOptions, type Listener, symbol, type Transport, type Upgrader, type TransportManager } from '@libp2p/interface-transport' -import { CodeError } from '@libp2p/interfaces/errors' +import { CodeError } from '@libp2p/interface/errors' +import { type CreateListenerOptions, type DialOptions, symbol, type Transport, type Listener, type Upgrader } from '@libp2p/interface/transport' import { logger } from '@libp2p/logger' import { peerIdFromString } from '@libp2p/peer-id' import { multiaddr, type Multiaddr, protocols } from '@multiformats/multiaddr' @@ -8,10 +8,11 @@ import { WebRTCMultiaddrConnection } from '../maconn.js' import { initiateConnection, handleIncomingStream } from './handler.js' import { WebRTCPeerListener } from './listener.js' import type { DataChannelOpts } from '../stream.js' -import type { Connection } from '@libp2p/interface-connection' -import type { PeerId } from '@libp2p/interface-peer-id' -import type { IncomingStreamData, Registrar } from '@libp2p/interface-registrar' -import type { Startable } from '@libp2p/interfaces/startable' +import type { Connection } from '@libp2p/interface/connection' +import type { PeerId } from '@libp2p/interface/peer-id' +import type { Startable } from '@libp2p/interface/startable' +import type { IncomingStreamData, Registrar } from '@libp2p/interface-internal/registrar' +import type { TransportManager } from '@libp2p/interface-internal/transport-manager' const log = logger('libp2p:webrtc:peer') diff --git a/packages/transport-webrtc/src/private-to-public/options.ts b/packages/transport-webrtc/src/private-to-public/options.ts index 838c627ffe..d30bc9f304 100644 --- a/packages/transport-webrtc/src/private-to-public/options.ts +++ b/packages/transport-webrtc/src/private-to-public/options.ts @@ -1,4 +1,4 @@ -import type { CreateListenerOptions, DialOptions } from '@libp2p/interface-transport' +import type { CreateListenerOptions, DialOptions } from '@libp2p/interface/transport' export interface WebRTCListenerOptions extends CreateListenerOptions {} export interface WebRTCDialOptions extends DialOptions {} diff --git a/packages/transport-webrtc/src/private-to-public/transport.ts b/packages/transport-webrtc/src/private-to-public/transport.ts index c23b715c88..c65f823387 100644 --- a/packages/transport-webrtc/src/private-to-public/transport.ts +++ b/packages/transport-webrtc/src/private-to-public/transport.ts @@ -1,5 +1,5 @@ import { noise as Noise } from '@chainsafe/libp2p-noise' -import { type CreateListenerOptions, type Listener, symbol, type Transport } from '@libp2p/interface-transport' +import { type CreateListenerOptions, symbol, type Transport, type Listener } from '@libp2p/interface/transport' import { logger } from '@libp2p/logger' import * as p from '@libp2p/peer-id' import { protocols } from '@multiformats/multiaddr' @@ -15,9 +15,9 @@ import * as sdp from './sdp.js' import { genUfrag } from './util.js' import type { WebRTCDialOptions } from './options.js' import type { DataChannelOpts } from '../stream.js' -import type { Connection } from '@libp2p/interface-connection' -import type { CounterGroup, Metrics } from '@libp2p/interface-metrics' -import type { PeerId } from '@libp2p/interface-peer-id' +import type { Connection } from '@libp2p/interface/connection' +import type { CounterGroup, Metrics } from '@libp2p/interface/metrics' +import type { PeerId } from '@libp2p/interface/peer-id' import type { Multiaddr } from '@multiformats/multiaddr' const log = logger('libp2p:webrtc:transport') diff --git a/packages/transport-webrtc/src/stream.ts b/packages/transport-webrtc/src/stream.ts index fe5482bca3..bc997397a8 100644 --- a/packages/transport-webrtc/src/stream.ts +++ b/packages/transport-webrtc/src/stream.ts @@ -1,12 +1,12 @@ -import { AbstractStream, type AbstractStreamInit } from '@libp2p/interface-stream-muxer/stream' -import { CodeError } from '@libp2p/interfaces/errors' +import { CodeError } from '@libp2p/interface/errors' +import { AbstractStream, type AbstractStreamInit } from '@libp2p/interface/stream-muxer/stream' import { logger } from '@libp2p/logger' import * as lengthPrefixed from 'it-length-prefixed' import { type Pushable, pushable } from 'it-pushable' import { pEvent, TimeoutError } from 'p-event' import { Uint8ArrayList } from 'uint8arraylist' import { Message } from './pb/message.js' -import type { Direction, Stream } from '@libp2p/interface-connection' +import type { Direction, Stream } from '@libp2p/interface/connection' const log = logger('libp2p:webrtc:stream') diff --git a/packages/transport-webrtc/test/basics.spec.ts b/packages/transport-webrtc/test/basics.spec.ts index ec15c43703..a241d15c54 100644 --- a/packages/transport-webrtc/test/basics.spec.ts +++ b/packages/transport-webrtc/test/basics.spec.ts @@ -14,8 +14,8 @@ import { createLibp2p } from 'libp2p' import { circuitRelayTransport } from 'libp2p/circuit-relay' import { identifyService } from 'libp2p/identify' import { webRTC } from '../src/index.js' -import type { Connection } from '@libp2p/interface-connection' -import type { Libp2p } from '@libp2p/interface-libp2p' +import type { Libp2p } from '@libp2p/interface' +import type { Connection } from '@libp2p/interface/connection' async function createNode (): Promise { return createLibp2p({ diff --git a/packages/transport-webrtc/test/listener.spec.ts b/packages/transport-webrtc/test/listener.spec.ts index 4928ca682c..e4e6dc149c 100644 --- a/packages/transport-webrtc/test/listener.spec.ts +++ b/packages/transport-webrtc/test/listener.spec.ts @@ -3,7 +3,8 @@ import { multiaddr } from '@multiformats/multiaddr' import { expect } from 'aegir/chai' import { stubInterface } from 'sinon-ts' import { WebRTCPeerListener } from '../src/private-to-private/listener' -import type { Listener, TransportManager } from '@libp2p/interface-transport' +import type { Listener } from '@libp2p/interface/transport' +import type { TransportManager } from '@libp2p/interface-internal/transport-manager' describe('webrtc private-to-private listener', () => { it('should only return relay addresses as webrtc listen addresses', async () => { diff --git a/packages/transport-webrtc/test/maconn.browser.spec.ts b/packages/transport-webrtc/test/maconn.browser.spec.ts index 9a25dc541c..a8e91272c4 100644 --- a/packages/transport-webrtc/test/maconn.browser.spec.ts +++ b/packages/transport-webrtc/test/maconn.browser.spec.ts @@ -4,7 +4,7 @@ import { multiaddr } from '@multiformats/multiaddr' import { expect } from 'aegir/chai' import { stubObject } from 'sinon-ts' import { WebRTCMultiaddrConnection } from '../src/maconn.js' -import type { CounterGroup } from '@libp2p/interface-metrics' +import type { CounterGroup } from '@libp2p/interface/metrics' describe('Multiaddr Connection', () => { it('can open and close', async () => { diff --git a/packages/transport-webrtc/test/peer.browser.spec.ts b/packages/transport-webrtc/test/peer.browser.spec.ts index 25fe8284bb..ae3b79d325 100644 --- a/packages/transport-webrtc/test/peer.browser.spec.ts +++ b/packages/transport-webrtc/test/peer.browser.spec.ts @@ -1,4 +1,4 @@ -import { mockConnection, mockMultiaddrConnection, mockRegistrar, mockStream, mockUpgrader } from '@libp2p/interface-mocks' +import { mockConnection, mockMultiaddrConnection, mockRegistrar, mockStream, mockUpgrader } from '@libp2p/interface-compliance-tests/mocks' import { createEd25519PeerId } from '@libp2p/peer-id-factory' import { multiaddr } from '@multiformats/multiaddr' import { expect } from 'aegir/chai' diff --git a/packages/transport-webrtc/test/stream.browser.spec.ts b/packages/transport-webrtc/test/stream.browser.spec.ts index ee57a61d84..a098d93a24 100644 --- a/packages/transport-webrtc/test/stream.browser.spec.ts +++ b/packages/transport-webrtc/test/stream.browser.spec.ts @@ -4,7 +4,7 @@ import * as lengthPrefixed from 'it-length-prefixed' import { bytes } from 'multiformats' import { Message } from '../src/pb/message.js' import { createStream } from '../src/stream' -import type { Stream } from '@libp2p/interface-connection' +import type { Stream } from '@libp2p/interface/connection' const TEST_MESSAGE = 'test_message' function setup (): { peerConnection: RTCPeerConnection, dataChannel: RTCDataChannel, stream: Stream } { diff --git a/packages/transport-webrtc/test/transport.browser.spec.ts b/packages/transport-webrtc/test/transport.browser.spec.ts index dea6c68fbd..ea7b56d545 100644 --- a/packages/transport-webrtc/test/transport.browser.spec.ts +++ b/packages/transport-webrtc/test/transport.browser.spec.ts @@ -1,14 +1,14 @@ /* eslint-disable @typescript-eslint/no-floating-promises */ -import { mockMetrics, mockUpgrader } from '@libp2p/interface-mocks' -import { type CreateListenerOptions, symbol } from '@libp2p/interface-transport' +import { type CreateListenerOptions, symbol } from '@libp2p/interface/transport' +import { mockMetrics, mockUpgrader } from '@libp2p/interface-compliance-tests/mocks' import { createEd25519PeerId } from '@libp2p/peer-id-factory' import { multiaddr, type Multiaddr } from '@multiformats/multiaddr' import { expect, assert } from 'aegir/chai' import { UnimplementedError } from '../src/error.js' import * as underTest from '../src/private-to-public/transport.js' import { expectError } from './util.js' -import type { Metrics } from '@libp2p/interface-metrics' +import type { Metrics } from '@libp2p/interface/metrics' function ignoredDialOption (): CreateListenerOptions { const upgrader = mockUpgrader({}) diff --git a/packages/transport-webrtc/tsconfig.json b/packages/transport-webrtc/tsconfig.json index aa7a3a98ba..4008808465 100644 --- a/packages/transport-webrtc/tsconfig.json +++ b/packages/transport-webrtc/tsconfig.json @@ -10,31 +10,13 @@ ], "references": [ { - "path": "../interface-connection" + "path": "../interface" }, { - "path": "../interface-libp2p" + "path": "../interface-compliance-tests" }, { - "path": "../interface-metrics" - }, - { - "path": "../interface-mocks" - }, - { - "path": "../interface-peer-id" - }, - { - "path": "../interface-registrar" - }, - { - "path": "../interface-stream-muxer" - }, - { - "path": "../interface-transport" - }, - { - "path": "../interfaces" + "path": "../interface-internal" }, { "path": "../libp2p" diff --git a/packages/transport-websockets/.aegir.js b/packages/transport-websockets/.aegir.js index 19b4335f8f..1a81ef61be 100644 --- a/packages/transport-websockets/.aegir.js +++ b/packages/transport-websockets/.aegir.js @@ -5,8 +5,8 @@ export default { test: { async before () { const { multiaddr } = await import('@multiformats/multiaddr') - const { mockRegistrar, mockUpgrader } = await import('@libp2p/interface-mocks') - const { EventEmitter } = await import('@libp2p/interfaces/events') + const { mockRegistrar, mockUpgrader } = await import('@libp2p/interface-compliance-tests/mocks') + const { EventEmitter } = await import('@libp2p/interface/events') const { webSockets } = await import('./dist/src/index.js') const protocol = '/echo/1.0.0' diff --git a/packages/transport-websockets/package.json b/packages/transport-websockets/package.json index f6a6b8a18a..6bfc33e43b 100644 --- a/packages/transport-websockets/package.json +++ b/packages/transport-websockets/package.json @@ -68,9 +68,7 @@ "test:electron-main": "aegir test -t electron-main -f ./dist/test/node.js --cov" }, "dependencies": { - "@libp2p/interface-connection": "^5.0.0", - "@libp2p/interface-transport": "^4.0.0", - "@libp2p/interfaces": "^3.0.0", + "@libp2p/interface": "~0.0.1", "@libp2p/logger": "^2.0.0", "@libp2p/utils": "^3.0.0", "@multiformats/mafmt": "^12.1.2", @@ -85,8 +83,7 @@ "ws": "^8.12.1" }, "devDependencies": { - "@libp2p/interface-mocks": "^12.0.0", - "@libp2p/interface-transport-compliance-tests": "^4.0.0", + "@libp2p/interface-compliance-tests": "^3.0.0", "aegir": "^39.0.10", "is-loopback-addr": "^2.0.1", "it-all": "^3.0.1", diff --git a/packages/transport-websockets/src/index.ts b/packages/transport-websockets/src/index.ts index 0ce23bd7e8..38cc8ec1ff 100644 --- a/packages/transport-websockets/src/index.ts +++ b/packages/transport-websockets/src/index.ts @@ -1,5 +1,5 @@ -import { type Transport, type MultiaddrFilter, symbol, type CreateListenerOptions, type DialOptions, type Listener } from '@libp2p/interface-transport' -import { AbortError } from '@libp2p/interfaces/errors' +import { AbortError } from '@libp2p/interface/errors' +import { type Transport, type MultiaddrFilter, symbol, type CreateListenerOptions, type DialOptions, type Listener } from '@libp2p/interface/transport' import { logger } from '@libp2p/logger' import { multiaddrToUri as toUri } from '@multiformats/multiaddr-to-uri' import { connect, type WebSocketOptions } from 'it-ws/client' @@ -8,8 +8,8 @@ import { isBrowser, isWebWorker } from 'wherearewe' import * as filters from './filters.js' import { createListener } from './listener.js' import { socketToMaConn } from './socket-to-conn.js' -import type { Connection } from '@libp2p/interface-connection' -import type { AbortOptions } from '@libp2p/interfaces' +import type { AbortOptions } from '@libp2p/interface' +import type { Connection } from '@libp2p/interface/connection' import type { Multiaddr } from '@multiformats/multiaddr' import type { Server } from 'http' import type { DuplexWebSocket } from 'it-ws/duplex' diff --git a/packages/transport-websockets/src/listener.browser.ts b/packages/transport-websockets/src/listener.browser.ts index d5568a9d8a..9fb4354f23 100644 --- a/packages/transport-websockets/src/listener.browser.ts +++ b/packages/transport-websockets/src/listener.browser.ts @@ -1,4 +1,4 @@ -import type { Listener } from '@libp2p/interface-transport' +import type { Listener } from '@libp2p/interface/transport' export function createListener (): Listener { throw new Error('WebSocket Servers can not be created in the browser!') diff --git a/packages/transport-websockets/src/listener.ts b/packages/transport-websockets/src/listener.ts index abb63aa894..9adb5957ae 100644 --- a/packages/transport-websockets/src/listener.ts +++ b/packages/transport-websockets/src/listener.ts @@ -1,12 +1,12 @@ import os from 'os' -import { EventEmitter, CustomEvent } from '@libp2p/interfaces/events' +import { EventEmitter, CustomEvent } from '@libp2p/interface/events' import { logger } from '@libp2p/logger' import { ipPortToMultiaddr as toMultiaddr } from '@libp2p/utils/ip-port-to-multiaddr' import { multiaddr, protocols } from '@multiformats/multiaddr' import { createServer } from 'it-ws/server' import { socketToMaConn } from './socket-to-conn.js' -import type { Connection } from '@libp2p/interface-connection' -import type { Listener, ListenerEvents, CreateListenerOptions } from '@libp2p/interface-transport' +import type { Connection } from '@libp2p/interface/connection' +import type { Listener, ListenerEvents, CreateListenerOptions } from '@libp2p/interface/transport' import type { Multiaddr } from '@multiformats/multiaddr' import type { Server } from 'http' import type { DuplexWebSocket } from 'it-ws/duplex' diff --git a/packages/transport-websockets/src/socket-to-conn.ts b/packages/transport-websockets/src/socket-to-conn.ts index a3bf2b8699..b7de27dd63 100644 --- a/packages/transport-websockets/src/socket-to-conn.ts +++ b/packages/transport-websockets/src/socket-to-conn.ts @@ -2,8 +2,8 @@ import { logger } from '@libp2p/logger' import { abortableSource } from 'abortable-iterator' import pTimeout from 'p-timeout' import { CLOSE_TIMEOUT } from './constants.js' -import type { MultiaddrConnection } from '@libp2p/interface-connection' -import type { AbortOptions } from '@libp2p/interfaces' +import type { AbortOptions } from '@libp2p/interface' +import type { MultiaddrConnection } from '@libp2p/interface/connection' import type { Multiaddr } from '@multiformats/multiaddr' import type { DuplexWebSocket } from 'it-ws/duplex' diff --git a/packages/transport-websockets/test/browser.ts b/packages/transport-websockets/test/browser.ts index 5fc89b6f89..616f09e37e 100644 --- a/packages/transport-websockets/test/browser.ts +++ b/packages/transport-websockets/test/browser.ts @@ -1,7 +1,7 @@ /* eslint-env mocha */ -import { mockUpgrader } from '@libp2p/interface-mocks' -import { EventEmitter } from '@libp2p/interfaces/events' +import { EventEmitter } from '@libp2p/interface/events' +import { mockUpgrader } from '@libp2p/interface-compliance-tests/mocks' import { multiaddr } from '@multiformats/multiaddr' import { expect } from 'aegir/chai' import all from 'it-all' @@ -9,8 +9,8 @@ import { pipe } from 'it-pipe' import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' import { isBrowser, isWebWorker } from 'wherearewe' import { webSockets } from '../src/index.js' -import type { Connection } from '@libp2p/interface-connection' -import type { Transport } from '@libp2p/interface-transport' +import type { Connection } from '@libp2p/interface/connection' +import type { Transport } from '@libp2p/interface/transport' const protocol = '/echo/1.0.0' diff --git a/packages/transport-websockets/test/compliance.node.ts b/packages/transport-websockets/test/compliance.node.ts index eef82737de..1ad8b4a1ff 100644 --- a/packages/transport-websockets/test/compliance.node.ts +++ b/packages/transport-websockets/test/compliance.node.ts @@ -1,12 +1,12 @@ /* eslint-env mocha */ import http from 'http' -import tests from '@libp2p/interface-transport-compliance-tests' +import tests from '@libp2p/interface-compliance-tests/transport' import { multiaddr } from '@multiformats/multiaddr' import * as filters from '../src/filters.js' import { webSockets } from '../src/index.js' import type { WebSocketListenerInit } from '../src/listener.js' -import type { Listener } from '@libp2p/interface-transport' +import type { Listener } from '@libp2p/interface/transport' describe('interface-transport compliance', () => { tests({ diff --git a/packages/transport-websockets/test/node.ts b/packages/transport-websockets/test/node.ts index 43d88d5d7a..2df43cf9e1 100644 --- a/packages/transport-websockets/test/node.ts +++ b/packages/transport-websockets/test/node.ts @@ -4,8 +4,8 @@ import fs from 'fs' import http from 'http' import https from 'https' -import { mockRegistrar, mockUpgrader } from '@libp2p/interface-mocks' -import { EventEmitter } from '@libp2p/interfaces/events' +import { EventEmitter } from '@libp2p/interface/events' +import { mockRegistrar, mockUpgrader } from '@libp2p/interface-compliance-tests/mocks' import { multiaddr } from '@multiformats/multiaddr' import { expect } from 'aegir/chai' import { isLoopbackAddr } from 'is-loopback-addr' @@ -18,7 +18,7 @@ import waitFor from 'p-wait-for' import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' import * as filters from '../src/filters.js' import { webSockets } from '../src/index.js' -import type { Listener, Transport } from '@libp2p/interface-transport' +import type { Listener, Transport } from '@libp2p/interface/transport' import type { Source } from 'it-stream-types' import type { Uint8ArrayList } from 'uint8arraylist' import './compliance.node.js' diff --git a/packages/transport-websockets/tsconfig.json b/packages/transport-websockets/tsconfig.json index 9047d208ae..b5b8e9d6e1 100644 --- a/packages/transport-websockets/tsconfig.json +++ b/packages/transport-websockets/tsconfig.json @@ -9,19 +9,10 @@ ], "references": [ { - "path": "../interface-connection" + "path": "../interface" }, { - "path": "../interface-mocks" - }, - { - "path": "../interface-transport" - }, - { - "path": "../interface-transport-compliance-tests" - }, - { - "path": "../interfaces" + "path": "../interface-compliance-tests" }, { "path": "../logger" diff --git a/packages/transport-webtransport/.gitignore b/packages/transport-webtransport/.gitignore new file mode 100644 index 0000000000..431f7bde19 --- /dev/null +++ b/packages/transport-webtransport/.gitignore @@ -0,0 +1 @@ +go-libp2p-webtransport-server/main diff --git a/packages/transport-webtransport/examples/fetch-file-from-kubo/package.json b/packages/transport-webtransport/examples/fetch-file-from-kubo/package.json index 143eeb2ea6..e6aa5a2125 100644 --- a/packages/transport-webtransport/examples/fetch-file-from-kubo/package.json +++ b/packages/transport-webtransport/examples/fetch-file-from-kubo/package.json @@ -16,7 +16,7 @@ "blockstore-core": "^4.1.0", "ipfs-bitswap": "^18.0.1", "libp2p": "^0.45.9", - "multiformats": "^11.0.2" + "multiformats": "^12.0.1" }, "devDependencies": { "test-ipfs-example": "^1.0.0", diff --git a/packages/transport-webtransport/package.json b/packages/transport-webtransport/package.json index 9c8c6300ac..8255a46729 100644 --- a/packages/transport-webtransport/package.json +++ b/packages/transport-webtransport/package.json @@ -65,15 +65,12 @@ }, "dependencies": { "@chainsafe/libp2p-noise": "^12.0.1", - "@libp2p/interface-connection": "^5.0.0", - "@libp2p/interface-peer-id": "^2.0.0", - "@libp2p/interface-stream-muxer": "^4.0.0", - "@libp2p/interface-transport": "^4.0.0", + "@libp2p/interface": "~0.0.1", "@libp2p/logger": "^2.0.0", "@libp2p/peer-id": "^2.0.0", "@multiformats/multiaddr": "^12.1.3", "it-stream-types": "^2.0.1", - "multiformats": "^11.0.2", + "multiformats": "^12.0.1", "uint8arraylist": "^2.4.3" }, "devDependencies": { diff --git a/packages/transport-webtransport/src/index.ts b/packages/transport-webtransport/src/index.ts index d10b5b559d..273c37be89 100644 --- a/packages/transport-webtransport/src/index.ts +++ b/packages/transport-webtransport/src/index.ts @@ -1,13 +1,13 @@ import { noise } from '@chainsafe/libp2p-noise' -import { type Transport, symbol, type CreateListenerOptions, type DialOptions, type Listener } from '@libp2p/interface-transport' +import { type Transport, symbol, type CreateListenerOptions, type DialOptions, type Listener } from '@libp2p/interface/transport' import { logger } from '@libp2p/logger' import { peerIdFromString } from '@libp2p/peer-id' import { type Multiaddr, protocols } from '@multiformats/multiaddr' import { bases, digest } from 'multiformats/basics' import { Uint8ArrayList } from 'uint8arraylist' -import type { Connection, Direction, MultiaddrConnection, Stream } from '@libp2p/interface-connection' -import type { PeerId } from '@libp2p/interface-peer-id' -import type { StreamMuxerFactory, StreamMuxerInit, StreamMuxer } from '@libp2p/interface-stream-muxer' +import type { Connection, Direction, MultiaddrConnection, Stream } from '@libp2p/interface/connection' +import type { PeerId } from '@libp2p/interface/peer-id' +import type { StreamMuxerFactory, StreamMuxerInit, StreamMuxer } from '@libp2p/interface/stream-muxer' import type { Duplex, Source } from 'it-stream-types' import type { MultihashDigest } from 'multiformats/hashes/interface' diff --git a/packages/transport-webtransport/tsconfig.json b/packages/transport-webtransport/tsconfig.json index 4f3f92ea0b..0344702f51 100644 --- a/packages/transport-webtransport/tsconfig.json +++ b/packages/transport-webtransport/tsconfig.json @@ -9,16 +9,7 @@ ], "references": [ { - "path": "../interface-connection" - }, - { - "path": "../interface-peer-id" - }, - { - "path": "../interface-stream-muxer" - }, - { - "path": "../interface-transport" + "path": "../interface" }, { "path": "../libp2p" diff --git a/packages/utils/package.json b/packages/utils/package.json index 604b675c13..07eb025c33 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -86,9 +86,7 @@ }, "dependencies": { "@achingbrain/ip-address": "^8.1.0", - "@libp2p/interface-connection": "^5.0.0", - "@libp2p/interface-peer-store": "^2.0.0", - "@libp2p/interfaces": "^3.0.0", + "@libp2p/interface": "~0.0.1", "@libp2p/logger": "^2.0.0", "@multiformats/multiaddr": "^12.1.3", "abortable-iterator": "^5.0.1", diff --git a/packages/utils/src/address-sort.ts b/packages/utils/src/address-sort.ts index 3df8ababd4..7ab8128561 100644 --- a/packages/utils/src/address-sort.ts +++ b/packages/utils/src/address-sort.ts @@ -21,7 +21,7 @@ */ import { isPrivate } from './multiaddr/is-private.js' -import type { Address } from '@libp2p/interface-peer-store' +import type { Address } from '@libp2p/interface/peer-store' /** * Compare function for array.sort(). diff --git a/packages/utils/src/ip-port-to-multiaddr.ts b/packages/utils/src/ip-port-to-multiaddr.ts index bff7020e3a..8c0538a092 100644 --- a/packages/utils/src/ip-port-to-multiaddr.ts +++ b/packages/utils/src/ip-port-to-multiaddr.ts @@ -1,5 +1,5 @@ import { Address4, Address6 } from '@achingbrain/ip-address' -import { CodeError } from '@libp2p/interfaces/errors' +import { CodeError } from '@libp2p/interface/errors' import { logger } from '@libp2p/logger' import { type Multiaddr, multiaddr } from '@multiformats/multiaddr' diff --git a/packages/utils/src/stream-to-ma-conn.ts b/packages/utils/src/stream-to-ma-conn.ts index 3fa09dac4a..4fc812e38e 100644 --- a/packages/utils/src/stream-to-ma-conn.ts +++ b/packages/utils/src/stream-to-ma-conn.ts @@ -1,6 +1,6 @@ import { logger } from '@libp2p/logger' import { abortableSource } from 'abortable-iterator' -import type { MultiaddrConnection } from '@libp2p/interface-connection' +import type { MultiaddrConnection } from '@libp2p/interface/connection' import type { Multiaddr } from '@multiformats/multiaddr' import type { Duplex, Source } from 'it-stream-types' import type { Uint8ArrayList } from 'uint8arraylist' diff --git a/packages/utils/test/stream-to-ma-conn.spec.ts b/packages/utils/test/stream-to-ma-conn.spec.ts index 470cb85090..b23b64154f 100644 --- a/packages/utils/test/stream-to-ma-conn.spec.ts +++ b/packages/utils/test/stream-to-ma-conn.spec.ts @@ -7,7 +7,7 @@ import { pair } from 'it-pair' import { pipe } from 'it-pipe' import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' import { streamToMaConnection } from '../src/stream-to-ma-conn.js' -import type { Stream } from '@libp2p/interface-connection' +import type { Stream } from '@libp2p/interface/connection' import type { Duplex, Source } from 'it-stream-types' import type { Uint8ArrayList } from 'uint8arraylist' diff --git a/packages/utils/tsconfig.json b/packages/utils/tsconfig.json index 1bd7fbd5b8..b382e52ffe 100644 --- a/packages/utils/tsconfig.json +++ b/packages/utils/tsconfig.json @@ -9,13 +9,7 @@ ], "references": [ { - "path": "../interface-connection" - }, - { - "path": "../interface-peer-store" - }, - { - "path": "../interfaces" + "path": "../interface" }, { "path": "../logger"