libp2p / js-peer-info

libp2p Peer abstraction Node.js implementation
https://libp2p.io
MIT License
37 stars 28 forks source link

RFC: extend peerInfo #70

Open pgte opened 5 years ago

pgte commented 5 years ago

In peer-star-app we pass around PeerInfo objects to represent peers in apps and collaborations. Once we introduce identity and capabilities, we need to encode and exchange this new information, and I'm thinking whether the PeerInfo objects would be the best place for this.

If yes, is there a safe extension mechanism where an app can store arbitrary information about a peer?

satazor commented 5 years ago

I like this idea. One possible way to ensure that those extensions do not conflict with each other is by using Symbols. The extensions would have a "getter" where you pass the PeerInfo and it would return the underlying data. For instance, getIdentity(PeerInfo) would return that symbol key's value that the identity extension created.

pgte commented 5 years ago

Would also love to have your input on this @alanshaw

alanshaw commented 5 years ago

Could you give some more info on the requirements please?