arnaucube
arnaucube/go-dhtPublic Self-hosted repository
go-dht/README.md
README.mdRaw
 1# go-dht [![Go Report Card](https://goreportcard.com/badge/github.com/arnaucube/go-dht)](https://goreportcard.com/report/github.com/arnaucube/go-dht) [![Build Status](https://travis-ci.org/arnaucube/go-dht.svg?branch=master)](https://travis-ci.org/arnaucube/go-dht)
 2
 3Kademlia DHT Go implementation.
 4
 5Following the specification from
 6- https://pdos.csail.mit.edu/~petar/papers/maymounkov-kademlia-lncs.pdf
 7- http://xlattice.sourceforge.net/components/protocol/kademlia/specs.html
 8
 9## Run
10To run a node:
11```
12go run main.go --config config.test0.yaml --debug start
13```
14
15
16## Test
17- Scenario:
18```
19+--+           +--+
20|n0+-----------+n1|
21+-++           +--+
22  |
23  |
24  |    +--+           +--+
25  +----+n2+-----------+n3|
26       +--+           +--+
27```
28
29- To run 4 test nodes inside a tmux session:
30```
31bash run-dev-nodes.sh
32```
33
34Using the `test.go` in the `rpc-test` directory:
35
36- calls to the node to perform lookups
37	- `go run test.go -find`
38		- performs an `admin` call to `Find` node, to the `n0`, asking about the `n3`
39- calls to simulate kademlia protocol rpc calls
40	- `go run test.go -ping`
41		- performs the `PING` call
42	- `go run test.go -findnode`
43		- performs the `FIND_NODE` call
44	- `go run test.go -findvalue`
45		- performs the `FIND_VALUE` call
46	- `go run test.go -store`
47		- performs the `STORE` call
48