ipfs / kubo

An IPFS implementation in Go
https://docs.ipfs.tech/how-to/command-line-quick-start/
Other
16.07k stars 3.01k forks source link

Feature: Advanced ipns tooling #4536

Open kpcyrd opened 6 years ago

kpcyrd commented 6 years ago

Type:

Feature

Description:

While discussion ipns on irc, the following tools might be interesting for advanced ipns operations, eg. during DDoS:

whyrusleeping commented 6 years ago

I really want both of these.

Not sure where exactly to put it in the api though, could be something like:

ipfs name record create <params>
ipfs name record push <rawdata>
kpcyrd commented 6 years ago

For additional input:

ipfs name record sign <params>
ipfs name record seed <rawdata>

but I don't have any strong opinion on this, I like create/push as well.

Maybe an additional inspect command might make sense as well that prints the encoded data in a human readable way to ease debugging.

In the end, this should work:

RECORD=`ipfs name record create $params`
ipfs name inspect "$RECORD"
ipfs name push "$RECORD"

Also, for even more bonus points, something like this:

while sleep 5m; do
    # TODO: resolve-raw feels somewhat clunky
    ipfs name resolve-raw $params | ipfs name push
done

These might be related to ipfs name follow from #4435

mildred commented 6 years ago

ipns name republish NAME ?

mildred commented 6 years ago

Why not something like this...

Generate raw data

ipfs name generate [--lifetime=<lifetime>] [--key=<key>] [--] <ipfs-path>

Will do just like ipfs name publish but instead of publishing the record, will print it on the standard output (probably base58 encoded, or perhaps not?)

Use case: generate a record for others to publish

Publish a record

ipfs name publish --raw [--] [<raw-record>]

Additional form of ipfs name publish but with a --raw option. It will decode the raw record and publish it as it is. The private key is not needed to publish the record.

edit: if the raw record is not on the command line, it is read from stdin (with or without encoding?)

Use case: seed offline generated record

Resolve a raw record for republish

ipfs name resolve --raw [--] [<name>]

An additional option to ipfs name resolve to print a (base58 encoded probably, or not) raw record. It can be used to republish the record as it is with ipfs name publish --raw

Use case: republish a record taken from the network

Republish a record

ipfs name republish [--follow] [--extend] [--key=<key>] [--] <name>

Will republish a record already existing on the network.

Use case: have multiple nodes to republish the same record in case the primary node is failing

added: Inspect a record

ipfs name inspect [<raw-record>]

Use case: inspect a raw record so it is readable and we know what it contains


What do you think?

kpcyrd commented 6 years ago

@mildred sounds great. For the commands accepting a raw (untrusted) record it might make sense to accept the data on stdin instead, but this might be neglectable. The only thing I would want to add to the list would be the inspect command to parse the raw record into something human readable and/or json. This would also be useful for debugging when combined with ipfs name resolve --raw because you would get additional information that isn't accessible with a regular resolve.

whyrusleeping commented 6 years ago

@mildred Thats a great proposal, I don't disagree with any of it.

@kpcyrd its pretty easy to accept from either stdin or an explicit argument. We can definitely do that. also 👍 to the 'inspect' command.

mildred commented 6 years ago

Added the inspect command so we don't forget about it.

Also, if the raw record is read from stdin and not the command line, it is possible to skip the encoding part and have the raw binary bytes. Perhaps we should add an option to choose the encoding of the record itself (default being binary). Something like --enc=binary|hex|base64|base58.

disclaimer: I'm interested in the republish command so I can publish a record on my laptop and have my server follow it and republish it forever

whyrusleeping commented 6 years ago

Something like --enc=binary|hex|base64|base58.

We generally use --input-enc, but yeah. Agreed.