Skip to content
No description, website, or topics provided.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin
lib
presentations
.gitignore
.npmignore
.travis.yml
Dockerfile
LICENSE
README.md
docker-compose.yml
example.js
package-lock.json
package.json
tsconfig-build.json
tsconfig.json
tslint.json

README.md

rc-kademlia 🕸️

Build Status Try rc-kademlia on RunKit install size

This is a DHT for use on a local network. It takes bootstrap peer information or will broadcast on port 1338 asking for local peers. The local peer discovery uses udp Datagrams which can be relied upon to arrive as a whole message. A small binary packet is used to communicate info

Install

npm install rc-kademlia

Development

To build and run 10 nodes type

docker-compose up --build --scale node=10

Example

Overview

API

tk

function tk<T>(size: number, iterable: AsyncIterable<T>): AsyncIterableIterator<T[]>
function tk<T>(size: number, iterable: Iterable<T>): IterableIterator<T[]>

TK means "to come" in editing parlance. This isn't a real function - the api is TK

size can be betweeen 1 and Infinity.

import { batch } from 'rc-kademlia'
import { getPokemon } from 'iterable-pokedex'

// batch 10 pokemon while we process them
for await (const pokemons of batch(10, getPokemon())) {
  console.log(pokemons) // 10 pokemon at a time!
}

Contributors wanted!

Writing docs and code is a lot of work! Thank you in advance for helping out.

TODO

Tomorrow I want to get

  • limit local peer discovery to one node
  • find_node request and response flow
  • the recursive find_node search
  • actual good find_node results
  • dht bootstrapping process (does this need a real address book with actual k-buckets? Maybe)
  • A better way of visualizing what's going on

Thing I probably won't do

  • peer state and removal
    • responses should count as a pong
  • store and find_value
  • a real k-bucket address book

Things I'll probably have to do but don't want to

  • test with many more peers
  • visualize what's going on with many more peers

References

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.