package
0.0.0-20240503093246-678d81269f95
Repository: https://github.com/newinfooffical/core.git
Documentation: pkg.go.dev

# README

DHT Lite

This code is a fork from https://github.com/james-lawrence/kademlia and https://github.com/prettymuchbryce/kademlia with modifications for proper abstraction. All networking code was removed from the original one. This package shall only provide DHT fuctionality.

The following functions are not handled here and must be done by the caller, if desired:

  • Remove nodes that are deemed inactive via dht.RemoveNode.
  • Provide a function ShouldEvict to determine if a node shall be evicted in favor of another one.
  • Refresh buckets via dht.RefreshBuckets.
  • The actual store data functions (and associated replication/expiration) are not provided, only the functionality to traverse through the network.

# Functions

NewDHT initializes a new DHT node with default values.

# Constants

Find a node.
Find a value.
MaxAcceptKnownStore is maximum count accepted of known peers that store the value.
MaxClosest is maximum number of closest peers accepted.
MaxLevel defines the max level.

# Variables

DisableBucketRefresh is an option for debug purposes to reduce noise.

# Structs

DHT represents the state of the local node in the distributed hash table.
InformationRequest is an asynchronous request sent to nodes.
Node is the over-the-wire representation of a node.
NodeMessage is a message sent by a node.
SearchClient defines a search in the distributed hash table involving multiple information requests.
SearchResult is a single result to the search.

# Type aliases

NodeFilterFunc is called to filter nodes based on the callers choice.