Skip to content
This repository was archived by the owner on Jul 21, 2023. It is now read-only.
/ js-libp2p-kad-dht Public archive

JavaScript implementation of the DHT for libp2p

License

Unknown and 2 other licenses found

Licenses found

Unknown
LICENSE
Unknown
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

libp2p/js-libp2p-kad-dht

Folders and files

NameName
Last commit message
Last commit date

Latest commit

d90f1a6 · Nov 25, 2021
Nov 24, 2021
Nov 25, 2021
Nov 24, 2021
Sep 7, 2021
Nov 25, 2021
Nov 24, 2021
Jan 2, 2017
Nov 22, 2021
Nov 24, 2021
Sep 3, 2021

Repository files navigation

js-libp2p-kad-dht

Discourse posts Build status Coverage Status Dependency Status Bundle Size js-standard-style standard-readme compliant

JavaScript implementation of the Kademlia DHT for libp2p, based on go-libp2p-kad-dht.

Lead Maintainer

Vasco Santos.

Table of Contents

Install

npm

> npm i libp2p-kad-dht

Use in Node.js

import { create } from 'libp2p-kad-dht'

API

See https://libp2p.github.io/js-libp2p-kad-dht for the auto generated docs.

The libp2p-kad-dht module offers 3 APIs: Peer Routing, Content Routing and Peer Discovery.

Custom secondary DHT in libp2p

import { create } from 'libp2p-kad-dht'

/**
 * @param {Libp2p} libp2p
 */
function addDHT(libp2p) {
    const customDHT = create({
        libp2p,
        protocolPrefix: '/custom'
    })
    customDHT.start()

    return customDHT
}

Note that you may want to supply your own peer discovery function and datastore

Peer Routing

Content Routing

Peer Discovery

Spec

js-libp2p-kad-dht follows the libp2p/kad-dht spec and implements the algorithms described in the IPFS DHT documentation.

Contribute

Feel free to join in. All welcome. Open an issue!

This repository falls under the IPFS Code of Conduct.

License

MIT - Protocol Labs 2017