go-libp2p-daemon
go-libp2p-daemon copied to clipboard
Expose the Peerstore
Expose the Peerstore to allow daemon clients to access that information, such as known protocols a peer supports.
~~I'm proposing an addition of protos to the PeerInfo protobuf. This would enable us to expose the known protocols of a peer to consuming clients during the LIST_PEERS request.~~
I am not too excited about that.
PeerInfo
is used in LIST_PEERS
and in DHT
requests.
Sorry but i can't see any use-cases for LIST_PEERS
, but i see how it can be used in DHT
. But i think its not possible in current version of DHT to obtain list of protocols supported by peer, or i'm wrong? @vyzo
The protocols are discovered and added to the Peer Store during Identify, there's just currently no trivial way for us to get those known protocols from the Daemon. Right now the only access we have to the Peer Store is LIST_PEERS. I'd like to be able to get this information from the Daemon about a given peer.
I am not too excited about that.
@vyzo is it the usage in LIST_PEERS, or exposing the protocols period?
You can use identify directly on a peer.
Unless I am missing something, the only way to currently use identify directly on a peer would be to implement the identify protocol in a daemon client and perform that on a connected peer.
IDENTIFY
currently only applies to the daemon itself.
It's trivial, you just open a stream and read the identify response.
Having said that, we probably want to expose the Peerstore where such information can be obtained.
I don't want to extend the PeerInfo
struct though, it's a kludge.
Exposing the Peerstore would be ideal.
I can create a PR for the proto and Spec additions.