DHT based on the [lip2p kademlia spec](https://github.com/libp2p/specs/tree/master/kad-dht)
* encodeMessagePacket: expose haskey encodeMessagePacket checks for session and behaves differently based on that. Exposing this difference in behavior. Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com> * improve tracing of message exchange run e.g. as ``` nim c -r -d:debug -d:chronicles_enabled=on -d:chronicles_log_level=TRACE -d:chronicles_sinks=textlines[nocolors,stdout] tests/dht/test_providers.nim >err ``` Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com> * add debug on Handshake timeour Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com> * queue messages during handshake and send later If a handshake was already in progress, messages were dropped. Instead of this, it is better to queue these and send as soon as the handshake is finished and thus the encryption key is known. Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com> * rename handshakeInProgress to keyexchangeInProgress Handshake is also a name of a message, which makes previous name less clear. Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com> * keyexchangeInProgress: do not remove on handshake received This is the wrong direction, not needed Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com> --------- Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com> |
||
---|---|---|
.github | ||
codexdht | ||
tests | ||
vendor | ||
.gitignore | ||
LICENSE-APACHEv2 | ||
LICENSE-MIT | ||
README.md | ||
atlas.lock | ||
build.nims | ||
codecov.yml | ||
codexdht.nim | ||
codexdht.nimble | ||
config.nims | ||
nimble.lock |
README.md
A DHT implementation for Codex
This DHT implementation is aiming to provide a DHT for Codex with the following properties
- flexible secure transport usage with
- fast UDP based operation
- eventual fallback to TCP-based operation (maybe though libp2p)
- eventually support operation on top of libp2p
- flexible message encoding that plays well with the above transports
- provide node lookup, content storage/lookup, and provider storage/lookup operations
- roughly follow the libp2p-dht specifications from https://github.com/libp2p/specs/tree/master/kad-dht
- eventually provide compatibility mode with the above specs
Current implementation is based on nim-eth's Discovery v5 implementation.
Base files were copied from status-im/nim-eth@779d767b024175a51cf74c79ec7513301ebe2f46
Building
This repo is setup to use Nimble lockfiles. This requires Nimble 0.14+ which isn't installed by default when this was written. If nimble -v
reports 0.13.x
then you will need to install Nimble 0.14. Note that using Nimble 0.14 changes how Nimble behaves!
Nimble 0.14 can be install by:
nimble install nimble@0.14.2
After this you can setup your Nimble environment. Note that this will build the pinned version of Nim! The first run can take ~15 minutes.
nimble setup # creates a nimble.paths used for rest of Nimble commands
nimble testAll
You can also run tasks directly:
nim testAll