Skip to content
This repository has been archived by the owner on Sep 15, 2020. It is now read-only.

Dump DHT as JSON #565

Closed
philipbeadle opened this issue Feb 14, 2018 · 3 comments
Closed

Dump DHT as JSON #565

philipbeadle opened this issue Feb 14, 2018 · 3 comments
Assignees

Comments

@philipbeadle
Copy link
Contributor

Same as for 561 Dump Chain as JSON.

@clarenceb
Copy link
Contributor

As discussed, the existing DHT dump to string contains binary encoded values so the output looks weird.

The proposed JSON output will look something like in this gist: https://gist.github.com/clarenceb/1b301fd802d4a5a33b3cac706153cf1b

Please provide feedback on whether this is ok.

If we can decode the binary values or store them in a more human-readable manner then it would make the DHT JSON dump more useful.

@clarenceb
Copy link
Contributor

clarenceb commented Feb 21, 2018

I have a working implementation here: clarenceb@8b16cba

But I want to add more test cases and also refactor code to remove duplication in functions dht.String() and dht.JSON() and also dht.DumpIdx() and dht.DumpIdxJSON().

Also, because of weird characters in the entry and link "value" field, I had to create a function to strip out some non-printable chars (see utils.EscapeJSONValue). There might be a nicer way to do this or it might not be necessary if the encoding of this field is changed.

A real DHT dump can be seen in this gist: https://gist.github.com/clarenceb/389e186995b11e29a2206aa67df4458e

@clarenceb
Copy link
Contributor

PR submitted and build passing: #569

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

No branches or pull requests

4 participants