This repository was archived by the owner on Jul 21, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Converts to typescript - Only named exports - No more CJS, only ESM - Runs tests on all supported environments - Adds auto-publish - Adds dependabot BREAKING CHANGE: switch to named exports, ESM only
- Loading branch information
1 parent
3997d67
commit 9696346
Showing
101 changed files
with
10,444 additions
and
11,257 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"name": "libp2p-kad-dht", | ||
"name": "@libp2p/kad-dht", | ||
"version": "0.28.6", | ||
"description": "JavaScript implementation of the Kad-DHT for libp2p", | ||
"license": "Apache-2.0 OR MIT", | ||
|
@@ -18,28 +18,24 @@ | |
"node": ">=16.0.0", | ||
"npm": ">=7.0.0" | ||
}, | ||
"main": "src/index.js", | ||
"types": "dist/src/index.d.ts", | ||
"typesVersions": { | ||
"*": { | ||
"*": [ | ||
"*", | ||
"dist/*", | ||
"dist/src/*" | ||
], | ||
"src/*": [ | ||
"*", | ||
"dist/*", | ||
"dist/src/*" | ||
] | ||
} | ||
}, | ||
"type": "module", | ||
"types": "./dist/src/index.d.ts", | ||
"files": [ | ||
"src", | ||
"dist" | ||
"dist/src", | ||
"!dist/test", | ||
"!**/*.tsbuildinfo" | ||
], | ||
"exports": { | ||
".": { | ||
"import": "./dist/src/index.js" | ||
} | ||
}, | ||
"eslintConfig": { | ||
"extends": "ipfs", | ||
"parserOptions": { | ||
"sourceType": "module" | ||
}, | ||
"ignorePatterns": [ | ||
"src/message/dht.d.ts" | ||
] | ||
|
@@ -126,49 +122,48 @@ | |
] | ||
}, | ||
"scripts": { | ||
"prepare": "npm run build", | ||
"lint": "aegir ts -p check && aegir lint", | ||
"build": "npm run build:proto && npm run build:proto-types && aegir build", | ||
"build:proto": "pbjs -t static-module -w commonjs -r libp2p-dht-message --force-number --no-verify --no-delimited --no-create --no-beautify --no-defaults --lint eslint-disable -o src/message/dht.js ./src/message/dht.proto", | ||
"build:proto-types": "pbts -o src/message/dht.d.ts src/message/dht.js", | ||
"test": "aegir test -t node", | ||
"test:node": "aegir test -t node", | ||
"docs": "aegir docs", | ||
"release": "aegir release --docs -t node", | ||
"release-minor": "aegir release --type minor --docs -t node", | ||
"release-major": "aegir release --type major --docs -t node", | ||
"coverage": "aegir coverage", | ||
"coverage-publish": "aegir-coverage publish", | ||
"sim": "node test/simulation/index.js", | ||
"dep-check": "aegir dep-check" | ||
"lint": "aegir lint", | ||
"build": "tsc", | ||
"postbuild": "npm run build:copy-proto-files", | ||
"generate": "npm run generate:proto && npm run generate:proto-types", | ||
"generate:proto": "pbjs -t static-module -w es6 -r libp2p-dht-message --force-number --no-verify --no-delimited --no-create --no-beautify --no-defaults --lint eslint-disable -o src/message/dht.js ./src/message/dht.proto", | ||
"generate:proto-types": "pbts -o src/message/dht.d.ts src/message/dht.js", | ||
"build:copy-proto-files": "cp src/message/dht.js src/message/dht.d.ts dist/src/message", | ||
"pretest": "npm run build", | ||
"test": "aegir test -t node -f ./dist/test", | ||
"test:node": "aegir test -t node -f ./dist/test", | ||
"dep-check": "aegir dep-check", | ||
"release": "semantic-release" | ||
}, | ||
"dependencies": { | ||
"@libp2p/crypto": "^0.22.7", | ||
"@libp2p/interfaces": "^1.3.2", | ||
"@libp2p/logger": "^1.0.2", | ||
"@libp2p/peer-id": "^1.0.4", | ||
"@libp2p/record": "^1.0.0", | ||
"@libp2p/topology": "^1.0.3", | ||
"@multiformats/multiaddr": "^10.0.0", | ||
"any-signal": "^3.0.0", | ||
"datastore-core": "^7.0.0", | ||
"debug": "^4.3.1", | ||
"err-code": "^3.0.0", | ||
"hashlru": "^2.3.0", | ||
"interface-datastore": "^6.0.2", | ||
"it-all": "^1.0.5", | ||
"it-drain": "^1.0.4", | ||
"it-first": "^1.0.4", | ||
"it-length": "^1.0.3", | ||
"it-length-prefixed": "^5.0.2", | ||
"it-length-prefixed": "^7.0.0", | ||
"it-map": "^1.0.5", | ||
"it-merge": "^1.0.3", | ||
"it-parallel": "^2.0.1", | ||
"it-pipe": "^1.1.0", | ||
"it-pipe": "^2.0.3", | ||
"it-stream-types": "^1.0.4", | ||
"it-take": "^1.0.2", | ||
"k-bucket": "^5.1.0", | ||
"libp2p-crypto": "^0.21.0", | ||
"libp2p-interfaces": "^4.0.0", | ||
"libp2p-record": "^0.10.4", | ||
"multiaddr": "^10.0.0", | ||
"multiformats": "^9.4.5", | ||
"p-defer": "^3.0.0", | ||
"p-map": "^4.0.0", | ||
"p-queue": "^6.6.2", | ||
"peer-id": "^0.16.0", | ||
"p-defer": "^4.0.0", | ||
"p-map": "^5.3.0", | ||
"p-queue": "^7.2.0", | ||
"private-ip": "^2.3.3", | ||
"protobufjs": "^6.10.2", | ||
"streaming-iterables": "^6.0.0", | ||
|
@@ -177,44 +172,29 @@ | |
"varint": "^6.0.0" | ||
}, | ||
"devDependencies": { | ||
"@types/debug": "^4.1.7", | ||
"aegir": "^36.0.1", | ||
"async-iterator-all": "^1.0.0", | ||
"datastore-level": "^7.0.1", | ||
"@libp2p/interface-compliance-tests": "^1.1.3", | ||
"@libp2p/peer-id-factory": "^1.0.4", | ||
"@libp2p/peer-store": "^1.0.1", | ||
"@types/lodash.random": "^3.2.6", | ||
"@types/lodash.range": "^3.2.6", | ||
"@types/node": "^16.11.7", | ||
"@types/varint": "^6.0.0", | ||
"@types/which": "^2.0.1", | ||
"aegir": "^36.1.3", | ||
"datastore-level": "^8.0.0", | ||
"delay": "^5.0.0", | ||
"execa": "^5.1.1", | ||
"execa": "^6.0.0", | ||
"it-filter": "^1.0.3", | ||
"it-last": "^1.0.6", | ||
"it-pair": "^1.0.0", | ||
"libp2p": "next", | ||
"it-pair": "^2.0.2", | ||
"libp2p": "^0.36.2", | ||
"lodash.random": "^3.2.0", | ||
"lodash.range": "^3.2.0", | ||
"p-retry": "^4.2.0", | ||
"sinon": "^12.0.1", | ||
"p-retry": "^5.0.0", | ||
"sinon": "^13.0.1", | ||
"which": "^2.0.2" | ||
}, | ||
"browser": { | ||
"./src/routing-table/generated-prefix-list.json": "./src/routing-table/generated-prefix-list-browser.json" | ||
}, | ||
"contributors": [ | ||
"Vasco Santos <[email protected]>", | ||
"achingbrain <[email protected]>", | ||
"David Dias <[email protected]>", | ||
"Jacob Heun <[email protected]>", | ||
"kumavis <[email protected]>", | ||
"dirkmc <[email protected]>", | ||
"Alan Shaw <[email protected]>", | ||
"Friedel Ziegelmayer <[email protected]>", | ||
"Josh Field <[email protected]>", | ||
"Hugo Dias <[email protected]>", | ||
"Blake Byrnes <[email protected]>", | ||
"Richard Schneider <[email protected]>", | ||
"John Hiesey <[email protected]>", | ||
"ᴠɪᴄᴛᴏʀ ʙᴊᴇʟᴋʜᴏʟᴍ <[email protected]>", | ||
"Lars Gierth <[email protected]>", | ||
"Marcus Bernales <[email protected]>", | ||
"Pedro Teixeira <[email protected]>", | ||
"Qmstream <[email protected]>", | ||
"Thomas Eizinger <[email protected]>" | ||
] | ||
"./dist/src/routing-table/generated-prefix-list.js": "./dist/src/routing-table/generated-prefix-list-browser.js" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,50 @@ | ||
'use strict' | ||
|
||
// MaxRecordAge specifies the maximum time that any node will hold onto a record | ||
// from the time its received. This does not apply to any other forms of validity that | ||
// the record may contain. | ||
// For example, a record may contain an ipns entry with an EOL saying its valid | ||
// until the year 2020 (a great time in the future). For that record to stick around | ||
// it must be rebroadcasted more frequently than once every 'MaxRecordAge' | ||
|
||
const second = exports.second = 1000 | ||
const minute = exports.minute = 60 * second | ||
const hour = exports.hour = 60 * minute | ||
export const second = 1000 | ||
export const minute = 60 * second | ||
export const hour = 60 * minute | ||
|
||
exports.MAX_RECORD_AGE = 36 * hour | ||
export const MAX_RECORD_AGE = 36 * hour | ||
|
||
exports.PROTOCOL_DHT = '/kad/1.0.0' | ||
export const PROTOCOL_DHT = '/kad/1.0.0' | ||
|
||
exports.RECORD_KEY_PREFIX = '/dht/record' | ||
export const RECORD_KEY_PREFIX = '/dht/record' | ||
|
||
exports.PROVIDER_KEY_PREFIX = '/dht/provider' | ||
export const PROVIDER_KEY_PREFIX = '/dht/provider' | ||
|
||
exports.PROVIDERS_LRU_CACHE_SIZE = 256 | ||
export const PROVIDERS_LRU_CACHE_SIZE = 256 | ||
|
||
exports.PROVIDERS_VALIDITY = 24 * hour | ||
export const PROVIDERS_VALIDITY = 24 * hour | ||
|
||
exports.PROVIDERS_CLEANUP_INTERVAL = hour | ||
export const PROVIDERS_CLEANUP_INTERVAL = hour | ||
|
||
exports.READ_MESSAGE_TIMEOUT = 10 * second | ||
export const READ_MESSAGE_TIMEOUT = 10 * second | ||
|
||
// The number of records that will be retrieved on a call to getMany() | ||
exports.GET_MANY_RECORD_COUNT = 16 | ||
export const GET_MANY_RECORD_COUNT = 16 | ||
|
||
// K is the maximum number of requests to perform before returning failure | ||
exports.K = 20 | ||
export const K = 20 | ||
|
||
// Alpha is the concurrency for asynchronous requests | ||
exports.ALPHA = 3 | ||
export const ALPHA = 3 | ||
|
||
// How often we look for our closest DHT neighbours | ||
exports.QUERY_SELF_INTERVAL = Number(5 * minute) | ||
export const QUERY_SELF_INTERVAL = Number(5 * minute) | ||
|
||
// How long to look for our closest DHT neighbours for | ||
exports.QUERY_SELF_TIMEOUT = Number(30 * second) | ||
export const QUERY_SELF_TIMEOUT = Number(30 * second) | ||
|
||
// How often we try to find new peers | ||
exports.TABLE_REFRESH_INTERVAL = Number(5 * minute) | ||
export const TABLE_REFRESH_INTERVAL = Number(5 * minute) | ||
|
||
// How how long to look for new peers for | ||
exports.TABLE_REFRESH_QUERY_TIMEOUT = Number(30 * second) | ||
export const TABLE_REFRESH_QUERY_TIMEOUT = Number(30 * second) | ||
|
||
// When a timeout is not specified, run a query for this long | ||
exports.DEFAULT_QUERY_TIMEOUT = Number(30 * second) | ||
export const DEFAULT_QUERY_TIMEOUT = Number(30 * second) |
Oops, something went wrong.