This is an implementation of Kademlia DHT Wikipedia Link this implementation was refrenced from Stanford Paper
Note: This repository is an IntelliJ project.
Here is an example for the routing and creation of a couple DHT nodes. Example
Download Jar Library Download and include the library to your project.
Creating a node
int port = 8080;
boolean local = true;
KademliaNode knode = new KademliaNode(port, local);
Joining / Bootstrap to node
int port = 8070;
int toPort = 8080;
boolean local = true;
KademliaNode knode = new KademliaNode(port, local);
knode.join(InetAddress.getLocalHost(), toPort);
Storing data on DHT
KademliaNode knode = new KademliaNode(port, local);
knode.store("STRING DATA");
Getting data on DHT
KademliaNode knode = new KademliaNode(port, local);
knode.get(new KID("STRING DATA"));
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE