Skip to content
This repository has been archived by the owner on Jul 21, 2023. It is now read-only.

Expose utils.convertPeerId #79

Open
JGAntunes opened this issue Feb 13, 2019 · 3 comments
Open

Expose utils.convertPeerId #79

JGAntunes opened this issue Feb 13, 2019 · 3 comments
Labels
help wanted Seeking public contribution on this issue kind/enhancement A net-new feature or improvement to an existing feature P3 Low: Not priority right now status/ready Ready to be worked

Comments

@JGAntunes
Copy link

Hello 👋

First of all great work 👍 awesome module with great docs 😄

I'm using it in pulsarcast - ipfs/notes#266 and I'm currently looking for a way to access the closest peer(s) to a given peer locally. I understand this is a really specific use case for which exposing a method might not be worth it 🤷‍♂️ but I was wondering if exposing utils.convertPeerId as a static method would be something you would consider? This would be more than enough for me to then perform the search in the local routing table and I take it it could be useful to have some way on the module API to convert a PeerId into a DHT key?

@vasco-santos vasco-santos added kind/enhancement A net-new feature or improvement to an existing feature help wanted Seeking public contribution on this issue P3 Low: Not priority right now status/ready Ready to be worked labels Apr 26, 2019
@daviddias
Copy link
Member

@JGAntunes might not be worth it as that method is just sugar coating on multihashing, see:

https://github.com/libp2p/js-libp2p-kad-dht/blob/master/src/utils.js#L32-L34

That said, also not opposed. If you want to create a PR that exposes it, we can take it :)

@kumavis
Copy link
Contributor

kumavis commented May 21, 2019

👋 @JGAntunes
maybe a new method in RoutingTable ? closestPeersByPeerId

closestPeersByPeerId (peerId, count) {
   // ... 
}

@JGAntunes
Copy link
Author

@daviddias thanks, I'll take a look into exposing it, will submit a PR when I have some time.

@kumavis well that would be ideal 😄 if you folks think it would be useful happy to work on it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
help wanted Seeking public contribution on this issue kind/enhancement A net-new feature or improvement to an existing feature P3 Low: Not priority right now status/ready Ready to be worked
Projects
None yet
Development

No branches or pull requests

4 participants