kad.go: Defines a set of interfaces that are then implemented in libp2p-go-kad-dht v2 repo. They use Go Generics; might be worth checking them out before diving into this file. We discuss interfaces that we need to modify below.
routing/simplert: A simple RT implementing the RoutingTable interface. Includes a test function as well.
key.go: Implements the Key interface through 256 and 32 bit keys. The 32 bit keys can be used for simulating small networks.
Key interface --- we want another interface that is parameterized on top of the Key interface, called KeyPrefix. Alternately, this interface includes a CommonPrefixLength method. Maybe make a similar method called CommonPrefix?
RoutingTable interface --- we will develop a normalized RT interface, which will run the normalization algorithm in its implementation of AddNode. Its implementation of the NearestNodes will take only the KeyPrefix as an argument and then just grab all nodes in the normalized bucket.
Request and Response interfaces --- we need to have a PrivateRequest and PrivateResponse interfaces. These interfaces will not be parameterized on the Key type but the KeyPrefix type. In the PrivateRequest, we should replace the Target method with a method to preprocess the PIR request, if necessary, before computing the response. In the PrivateResponse, retain the CloserNodes method and type signature, but it should probably process the PIR response.
RoutingProtocol interface --- the FindNode method's third argument target will now be of type KeyPrefix.
Probelab's GoKademlia repo LibP2P Go Kad DHT repo v2-develop branch
Important files:
Key
interface through 256 and 32 bit keys. The 32 bit keys can be used for simulating small networks.Interfaces we need to modify in kad.go:
Key
interface, calledKeyPrefix
. Alternately, this interface includes aCommonPrefixLength
method. Maybe make a similar method calledCommonPrefix
?AddNode
. Its implementation of theNearestNodes
will take only theKeyPrefix
as an argument and then just grab all nodes in the normalized bucket.Key
type but theKeyPrefix
type. In the PrivateRequest, we should replace theTarget
method with a method to preprocess the PIR request, if necessary, before computing the response. In the PrivateResponse, retain theCloserNodes
method and type signature, but it should probably process the PIR response.FindNode
method's third argumenttarget
will now be of typeKeyPrefix
.