-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Conversation
I believe that meanwhile @vasco-santos started tackling this one as well. @JGAntunes mind syncing up with him to avoid dup work and find a converged solution? Thank you both! |
Sure, @vasco-santos I'm currently finishing the tests for this and also doing some cleanup. I needed something to test the connections between 2 IPFS nodes hence why I'm working on this. Let me know what's the status on this from your side, I'll gladly drop this if you have something ready already 👍 or we can also work together if you like. |
Hello @JGAntunes I started this on Friday, but I didn't finish it yet. I was implementing using the pull stream (as you did too), but I didn't notice that you had created libp2p/js-libp2p-ping#69, which would be useful for me 😄 I cloned your repo, and linked your PR to Just several notes that I was encompassing in my solution:
|
src/cli/commands/ping.js
Outdated
module.exports = { | ||
command: 'ping <peerId>', | ||
|
||
describe: 'Measure the latency of a connection', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are several command definitions using describe
and others using description
.
According to yargs docs, I think that the correct usage in this case is description
. In spite of, describe
also working, it is aimed at another use cases, as documented here.
What do you think @JGAntunes and @diasdavid ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fine either way, pick only one though, consistency is key.
Hey @diasdavid, @vasco-santos . I was looking to finish this asap but I have some questions regarding tests. Noticed the There seems to be an issue when running a As for the http-api tests I've noticed you have both using the inject interface from hapi and |
Regarding running a For your other questions, it is better waiting for a @diasdavid answer. |
That is because js-ipfs doesn't have the DHT by default, which gives peers Peer Routing. Learn more about it here: |
@JGAntunes @vasco-santos merged and released libp2p/js-libp2p-ping#69, please update https://github.com/libp2p/js-libp2p and make sure that all tests pass, then we can update all the deps here :) |
Sorry for delay on this everyone. I think the only thing missing now are the tests on the HTTP API using
Will add the missing tests between today and tomorrow. Let me know if is anything else missing. |
Added tests for both DHT enabled and disabled. However couldn't find a workaround for this - https://github.com/ipfs/js-ipfs/pull/1299/files#diff-0e68633477fac5c3c897f68c6b28f7a9R187 This is also dependent on #1340 Let me know what you think @diasdavid @vasco-santos |
Merging this PR into a branch on the main repo so that I can update and test things. |
* feat: implement `ipfs ping` flags #928 * feat: first shot at ping implementaion * fix: ETOOMANYSTREAMS 😢 * chore: cleanup on the ping component * chore: ping component linting * chore: bump js-ipfs-api and fix http ping validation * chore: add test to ping cli command * chore: add ping cli test * chore: refactor ping component and some cleanup * chore: add tests to the ping http API * fix: no need to check for peerRouting method in ping * chore: add tests for ping core functionality
* feat: implement `ipfs ping` flags #928 * feat: first shot at ping implementaion * fix: ETOOMANYSTREAMS 😢 * chore: cleanup on the ping component * chore: ping component linting * chore: bump js-ipfs-api and fix http ping validation * chore: add test to ping cli command * chore: add ping cli test * chore: refactor ping component and some cleanup * chore: add tests to the ping http API * fix: no need to check for peerRouting method in ping * chore: add tests for ping core functionality
Just opening this for visibility, working on finishing the ping endeavour started at #1202.
Also, some relevant notes. Seems like hapijs has compression enabled by default, which means responses will take into account the
Accept-Encoding
header and will use gzip to compress responses (it seems hapi has no way of disabling compression for a specific route only also). From what I've seen thego-ipfs
http api doesn't gzip responses by default AFAIK. Anyway, there seems to be an issue when compression is enabled and we're streaming responses - hapijs/hapi#3599 - as it seems the response is actually buffered, compressed and only then it is sent to the client. This results in the actual "streaming" capabilities being lost (the response all at once and only when it is complete). Not sure if this is a relevant issue or not, but though it was worth mentioning since when using the http API from a browser, theAccept-Encoding
headers will be set and the resulting response will not be streamed.Closes #928.