dettanym / dhtpir-ipfs

Prototyping a private retrieval system into IPFS
MIT License
0 stars 0 forks source link

docs: libp2p private RT integration #1

Open dettanym opened 1 year ago

dettanym commented 1 year ago

Start off with Go LibP2P library's example and this example to create a LibP2P host.

The Go LibP2P Kad DHT library is used internally by the Go LibP2P library, as seen from the second example. We will probably need to have private implementations of the FindPeers and FindProviders methods. Both of these might internally lookup GetClosestPeers, which would need to be modified as well.

The Go LibP2P Bucket library is also used internally by Go LibP2P.

dettanym commented 1 year ago

Protobuf schemas and PB messages: GetClosestPeers and GetProviders should replace their last arguments (id and key respectively) with private versions and create the corresponding ‘pmes’ variables. The PB schemas themselves only need minimal modifications, if any: the records are just key/value pairs, so any encrypted outputs can probably be made compatible.

Routing.go is the main high-level file whose function implementations will need to be modified. Both FindPeer and FindProviders ultimately make a call to query.go’s runLookupWithFollowup method. The third argument to this call is a querying function, which calls the PB messenger functions (peer, provider) with the non-private arguments. We need to have private implementations of these functions that call the underlying PB messages with private args.

Query.go is another high-level file, which essentially runs the main “querying loop”, handling when to terminate etc. Its runLookupWithFollowup function is called by the provider and peer lookup functions in routing.go. I expect that we’ll need to change this file minimally.

ssveitch commented 1 year ago

The min function in the kbucket repo may be used when constructing a normalized routing table. The "less than" operator passed in as a parameter will have to incorporate some processes from the normalization algorithm.