Skip to content

chore/remove-peer-info-from-api #25

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 23, 2020
Merged

Conversation

vasco-santos
Copy link
Member

@vasco-santos vasco-santos commented Apr 7, 2020

In the context of deprecating peer-info as described on libp2p/js-libp2p#589, this PR removes the peer-info from being returned in the API, in favour of returning { id, addrs } in the same way as ipfs does.

BREAKING CHANGE: findPeer returns id and addrs properties instead of peer-info instance

Needs:

@jacobheun
Copy link
Contributor

Just FYI there are issues with the latest http client being worked on in #23. Builds should be fine here once that's merged.

Copy link
Member

@hugomrdias hugomrdias left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another issue is the timeout, for some reason the string you are sending isnt working. To work around this just send the timeout as a number in ms

@hugomrdias
Copy link
Member

you also need the stuff in the PR jacob mentioned for remote nodes

@vasco-santos vasco-santos force-pushed the chore/remove-peer-info-from-api branch 2 times, most recently from d925627 to 266a5f4 Compare April 10, 2020 14:41
@hugomrdias
Copy link
Member

updated ipfsd-ctl docs to better explain the setup

@jacobheun jacobheun added this to the 0.5 milestone Apr 16, 2020
@vasco-santos vasco-santos force-pushed the chore/remove-peer-info-from-api branch 2 times, most recently from b1af5e2 to be62fa2 Compare April 16, 2020 13:52
BREAKING CHANGE: findPeer returns id and addrs properties instead of peer-info instance
@vasco-santos vasco-santos force-pushed the chore/remove-peer-info-from-api branch from be62fa2 to 60137d2 Compare April 16, 2020 15:19
@vasco-santos vasco-santos marked this pull request as ready for review April 16, 2020 15:20
@vasco-santos vasco-santos requested a review from jacobheun April 17, 2020 16:38
README.md Outdated
@@ -17,9 +17,9 @@ const DelegatedPeerRouting = require('libp2p-delegated-peer-routing')
const routing = new DelegatedPeerRouing()

try {
const peerInfo = await routing.findPeer('peerid')
const { id, addresses } = await routing.findPeer('peerid')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will fail, needs to be addrs.

Also, I realized this is different than the peer discovery api. Perhaps we should make peer routing consistent with peer discovery and do { id, multiaddrs }? https://github.com/libp2p/js-libp2p-interfaces/tree/v0.3.x/src/peer-discovery#discoverying-peers

Suggested change
const { id, addresses } = await routing.findPeer('peerid')
const { id, addrs } = await routing.findPeer('peerid')

src/index.js Outdated
@@ -36,25 +35,28 @@ class DelegatedPeerRouting {
* @param {PeerID} id
* @param {object} options
* @param {number} options.timeout How long the query can take. Defaults to 30 seconds
* @returns {Promise<PeerInfo>}
* @returns {Promise<{ id: PeerId, addrs: Multiaddr[] }>}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Per above, make this { id, multiaddrs }?

Copy link
Contributor

@jacobheun jacobheun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jacobheun jacobheun merged commit f49ddc0 into master Apr 23, 2020
@jacobheun jacobheun deleted the chore/remove-peer-info-from-api branch April 23, 2020 12:28
@jacobheun
Copy link
Contributor

Beta release is out

dist-tags:
beta: 0.5.0    latest: 0.4.3  

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants