Full control over the peerstore

Hi,

We have a use case in which we need to gain full control over the peerstore.
We need to be able to (1) read the currently known list of peers of a host such that we can send it to a second host, (2) add peers on a host based on a list of peers received from a second host (3) remove specific peers from the list of peers and make sure these peers are no longer accessed once removed. We also need to make sure such peers are not included in the currently known list of peers of this host that we are sending to other peers…

From reading the Q&A on this subject it seems that no such control is presently supported.

Questions:
a. Are there other projects that already encountered this requirement and have implemented some solution(s) - can you point us to them?

b. Would you advise that we develop our own extended Peerstore? Any pointers? Anyone already did that for some project? The peerstore interface seems very elaborate, any thoughts about parts of teh interface we may not need to implement ?

c. Are there additional options that will allow us to extend the current support to our needs?

Thanks,
DH

From what I understand, you want to have control over trusted peers, is that correct?

If that’s the case, you can do the following: there is the EventBus where you can subscribe using the Identity protocol. As soon as a peer identifies itself, you can create a rule to only accept peers from a “white list”.

To publish the trusted peers, you can promote a peer as the author of a pubsub and make the other peers accept only the white list sent from this peer.

Actually, our POC is using a PrivateNetwork, hence we trust any peer given that it has the secret key of the PrivateNetwork.

We require require full control over the peerlist since we are synching the peerlist across all peers and wish to have full control of what we know about each peer in the entire network.

What we chose so far (instead of extending/replacing the Peersotre) is to share our own peerlist object between all peers and than sync the Peerstore from this shared peerlist object by:

  • Removing previous entries using ClearAddrs(peerId), RemovePeer(peerId), RemoveProtocols(peerId) and
  • Adding new entries using AddAddrs(peerId, <Multiaddr derived from URL and ID>, peerstore.PermanentAddrTTL)

Should we expect any issues with this approach?