Peers: assigning nicknames / pet names
A peer nickname can be added next to peer ID.
@lidel @olizilla and others -- thoughts on feasibility/desirability here? Marking as an issue for discussion for now.
The idea of "pet names" was part of https://github.com/ipfs-shipyard/ipfs-webui/issues/891 but only "Add connection" button was added to the Peers screen. Labeling peers was descoped because while we could implement it in userland (store names in local storage of webui Origin), the names would show only in webui.
I believe a better way is to add support for this to ipfs swarm * commands and persist them as additional metadata in peerstore that could be read on-demand, similar to existing --direction:
$ ipfs swarm connect --petname PeeryMcPeer /p2p/QmPeerId
connect QmPeerId success
$ ipfs swarm peers --petname
/ipv4/somethingelse OtherNick
/ipv4/no-petname
/ipv4/something PeeryMcPeer
That way we can not only support them in webui, but also CLI, RPC API and other tools.
cc @vasco-santos (from libp2p) if libp2p project discussed adding this type of metadata before
Hey folks!
I am currently working on improving libp2p's PeerStore on JS land and this is one of the things that I intend to support. By the end of the PeerStore improvements, we should support adding metadata to a peer.
Regarding API for libp2p and IPFS, we did not start discussing this yet, since my main focus has been the AddressBook, ProtoBook and KeyBook. As soon as we have the former books, I will be working on the MetadataBook, which should be used for this use case. I will keep you posted and we can discuss further this API
PSA: I wrote my initial thoughts on the MetadataBook for js-libp2p. Depending on the feedback, this might get into the next js-libp2p release work: https://github.com/libp2p/js-libp2p/issues/627
@vasco-santos - what's the latest status of this? Thanks!
Hey!
@jessicaschilling well, it is shipped in libp2p, you can add data to the metadatabook as described in the API doc. There is no friendly API in the IPFS side of things so far, like the examples @lidel wrote above.
For now you can use that feature by doing ipfs.libp2p.peerStore* through the API (no CLI support). You can use .peers to access all the peers if you want to do a "filter" per a specific metadata key later on. This is supported from [email protected] IIRC
Thanks, @vasco-santos!
@lidel - given the current status, do you think this is something that's worth putting out for bounty right now?
This is blocked until high level API support for peerstore metadata is present in both js-ipfs and go-ipfs (like https://github.com/ipfs-shipyard/ipfs-webui/issues/1018#issuecomment-610623276 or even more generic kv approach).