Js-ipfs: Implement the `jsipfs ping` command

Created on 23 Jul 2017  路  9Comments  路  Source: ipfs/js-ipfs

Following: https://github.com/ipfs/js-ipfs/pull/925/files

We want to support the same command that go-ipfs supports: jsipfs ping.

From go-ipfs:

禄 ipfs ping --help
USAGE
  ipfs ping <peer ID>... - Send echo request packets to IPFS hosts.

SYNOPSIS
  ipfs ping [--count=<count> | -n] [--] <peer ID>...

ARGUMENTS

  <peer ID>... - ID of peer to be pinged.

OPTIONS

  -n, --count int - Number of ping messages to send. Default: 10.

DESCRIPTION

  'ipfs ping' is a tool to test sending data to other nodes. It finds nodes
  via the routing system, sends pings, waits for pongs, and prints out round-
  trip latency information.
P3 dieasy help wanted

All 9 comments

@diasdavid I can take a stab at this

Thank you @trendsetter37 馃専

Hey @diasdavid,

Thanks a lot for the IPFS project. I really enjoyed reading about the project and have been blown away with the vision <3.
I would like to start contributing to this project.

I gave this issue a shot and got the ping implementing but had few implementation detail questions

  1. In short I called the ping exposed by libp2p . However I noticed although the documentation says it takes in an option. The underlying implementation doesn't take in options. So would you like me to change the underlying implementation in and help it take options (--count)

  2. I would like to update the curent API for ipfs.ping() from not taking anything to take in key, option and callback. I see that we have two folders one called core and other commands. Since commands is where we would be logging the ping times and average latency. What is expected from the ipfs.ping() in core to return?
    List of times for all ping operations?

Once, these doubts are cleared I would like to submit a PR if needed.

Thanks :)

Thanks a lot for the IPFS project. I really enjoyed reading about the project and have been blown away with the vision <3.

Thank you 鉂わ笍鉂わ笍鉂わ笍

I would like to start contributing to this project.

YEAAS, Welcome! :)

  1. In short I called the ping exposed by libp2p ...

You should not have to change the implementation. The implementation gives you a event emitter and a stop call. You can get the --count to function with just that.

What is expected from the ipfs.ping() in core to return?

Return the ping object. See usage at https://github.com/libp2p/js-libp2p-ping#usage

image

Return the ping object.

My second question was regarding js-ipfs library. Shouldn't the ipfs.ping() implemented in link take in peerId and options? In the README it indicates there are no parameters.

Just to confirm this ipfs.ping() call would return the ping object and be used by jsipfs ping implementation in commands folder to console the ping results?

In the README it indicates there are no parameters.

I see where the confusion is from. The README has just a reference to the func, but it is not yet "documented". The func full definition should be added to https://github.com/ipfs/interface-ipfs-core/blob/master/SPEC/MISCELLANEOUS.md and then that table of contents should be updated.

Sorry for the confusion. I would love some help in going through all the methods and making sure that docs are up to date. //cc @hacdias

No worries. Just wanted to clear that out. I will send in a PR for the ping implementation and also will update the doc with it. :)

Work happening at https://github.com/ipfs/js-ipfs/pull/1202 :)

Work happening on #1299 now.

Was this page helpful?
0 / 5 - 0 ratings