Skip to content
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

unix-friendly output for 'ipfs dht' commands #2494

Open
6 of 8 tasks
hackergrrl opened this issue Mar 23, 2016 · 6 comments
Open
6 of 8 tasks

unix-friendly output for 'ipfs dht' commands #2494

hackergrrl opened this issue Mar 23, 2016 · 6 comments
Labels
exp/novice Someone with a little familiarity can pick up help wanted Seeking public contribution on this issue

Comments

@hackergrrl
Copy link
Contributor

hackergrrl commented Mar 23, 2016

Work Items

Summary

Today:

$ ipfs dht findprovs QmNmL1foPtvw25dWR41eeqW5YcLZJA5b3XoKrrBYUwKhnv
QmRc5iJERYKMjFsJ57jsxJhUjf86HL1WyqrQBTJrCCAnKN
* <peer.ID QmT3B2> says use <peer.ID QmPhm1> <peer.ID QmaL57> <peer.ID QmRv1G> <peer.ID QmYHk2> <peer.ID QmSoLn> <peer.ID QmXSyB> <peer.ID QmZyo1> <peer.ID QmRPhq> <peer.ID QmV7E3> <peer.ID QmNMeh> 
* <peer.ID QmRv1G> says use <peer.ID QmPhm1> <peer.ID QmaL57> <peer.ID QmT3B2> <peer.ID QmSNEN> <peer.ID QmYHk2> <peer.ID QmSoLn> <peer.ID QmXSyB> <peer.ID QmZyo1> <peer.ID QmUZax> <peer.ID QmRPhq> <peer.ID QmV7E3> <peer.ID QmNMeh> <peer.ID QmUDHg> <peer.ID QmSoLj> <peer.ID Qmda2A> <peer.ID QmVhJf> <peer.ID QmfBPE> <peer.ID QmZY7M> <peer.ID QmR5Cr> <peer.ID QmaSfi>

Imagined output:

$ ipfs dht findprovs QmNmL1foPtvw25dWR41eeqW5YcLZJA5b3XoKrrBYUwKhnv
QmNh2nZ3tWc8hbAbGNmfQQN9TmPAkpwKztjH8xZvcrv3eF
QmSoLju6m7xTh3DuokvT3886QRYqxAzb1kShaanJgW36yx
QmSoLnSGccFuZQJzRadHn95W2CrSFmZuTdDWP8HXaHca9z
...

Important properties:

  1. no errors inlined into output (or, use stderr at least)
  2. simple, newline-delimited output that is immediately usable for unix programs

This makes the commands much friendlier to unix scripts -- IDs can be grabbed and fed into e.g. ipfs dht findpeer more or less directly! We could still retain a -s|--simple option that gives short PeerIDs for existing compatibility, and keep -v|--verbose for detailed human output.


cc @whyrusleeping

@hackergrrl hackergrrl changed the title script-friendly output for 'ipfs dht' commands unix-friendly output for 'ipfs dht' commands Mar 23, 2016
@whyrusleeping whyrusleeping added the exp/novice Someone with a little familiarity can pick up label Apr 1, 2016
@whyrusleeping
Copy link
Member

Heres what I would like to see as output for the various subcommands of ipfs dht

  • ipfs dht findprovs
    • defaults to listing full peerIDs of providers, one per line
  • ipfs dht findpeer
    • defaults to just listing multiaddrs discovered for the given peer, one per line
  • ipfs dht get
    • defaults to just outputting the single best value selected for that key
    • an option to output every received value (including duplicates and bad values) is very much wanted
  • ipfs dht query
    • list of peer ID's, one per line by default

And for each of those, a verbose flag that prints the dht debugging events as they come in, making sure there arent any missed event types.

@hackergrrl
Copy link
Contributor Author

What format would you like to see for a PeerID?

  • QmRc5iJERYKMjFsJ57jsxJhUjf86HL1WyqrQBTJrCCAnKN
  • /ipfs/QmRc5iJERYKMjFsJ57jsxJhUjf86HL1WyqrQBTJrCCAnKN
  • /ip6/2601:646:8500:1f00:7256:81ff:feb1:c7bd/tcp/4001/ipfs/QmRc5iJERYKMjFsJ57jsxJhUjf86HL1WyqrQBTJrCCAnKN
  • something else!

@whyrusleeping
Copy link
Member

peer IDs are just the Qm... hash

@hackergrrl
Copy link
Contributor Author

One more: how about ipfs dht put?

@whyrusleeping
Copy link
Member

ehm... i guess it should take input from a file or standard in, and print out the peer IDs of peers that it stored a record with

@hackergrrl
Copy link
Contributor Author

I've tackled most of these with #2560, but two trickier pieces remain:

verbose output to stderr

Since all output comes from the daemon over a single channel, we'll need to wrap its output in a struct or similar so it can be multiplexed to (stdout, stderr) on the receiving end.

flag to list all records on ipfs dht get

Records are generally binary, so newline delimited output doesn't work here. We'll need to figure out how we'd like to format this output (newline'd base64? JSON?) to be maximally useful for users of this feature.

@RichardLitt RichardLitt added help wanted Seeking public contribution on this issue and removed help wanted Seeking public contribution on this issue labels May 31, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
exp/novice Someone with a little familiarity can pick up help wanted Seeking public contribution on this issue
Projects
None yet
Development

No branches or pull requests

3 participants