multiformats / multicodec

Compact self-describing codecs. Save space by using predefined multicodec tables.
MIT License
336 stars 201 forks source link

add dnslink namespace #268

Closed lidel closed 2 years ago

lidel commented 2 years ago

Rationale:

rvagg commented 2 years ago

sgtm, but could we bump this above 0x7f to save that precious single byte space? or do we anticipate the codec code being used enough to warrant a short code?

mrodriguez3313 commented 2 years ago

I understand the problem, but I don't understand the solution. Would adding this one csv entry, allow go-ipfs to interpret /dnslink? Thus we would re-add (later on) this feature in the dnslink docs to say, 'Hey! If you're using dnslink for your site, use "/dnslink" instead of "/ipns". Because of this...! :

  • we want to support DNSLink chaining without /ipns/ in TXT records, so it is useful for non-IPFS use cases dnslink=/dnslink/example.com
  • we want a clear way for pinning DNSLink names within Pinning Service API (https://github.com/ipfs/pinning-services-api-spec/issues/85), that is separate from pinning IPFS (cryptographic records)
lidel commented 2 years ago

@rvagg I don't think it will be as useful as /ip4, more likely usage will be closer to ipfs-ns and ipns-ns ones. Moved to 0xe8 – would this work?

@mrodriguez3313 It is not enough, this PR is only a formal prerequisite that needs to happen before we implement support for mentioned use cases.

RangerMauve commented 2 years ago

What would CIDs with this new codec look like?

lidel commented 2 years ago

@RangerMauve bit bizarre, but in places where DNSLink has to be passed as a CID, one could inline DNS name (ASCII) using identity multihash, something like:

$ echo -n 'dnslink-site.example.com' | ipfs add --inline --raw-leaves -Q
bafkqagdenzzwy2lonmwxg2lumuxgk6dbnvygyzjomnxw2

(but with dnslink instead of raw codec)

RangerMauve commented 2 years ago

Hmmm. Personally, the CIDs for DNS Name approach seems like it'll add a lot more burden for pinning service client implementations since they'd need to include CID libraries in whatever code they're writing (I'm a dependency minimalist 🤪).

Have you considered alternatives to CIDs like URLs? e.g. instead of passing a CID, clients could specify a ipfs://bafywhatever URL or ipns://ipfs.io/subpath URL. It'd add more work on the pinning service implementor side, but it might make the client side a lot more flexible. 🤷 (I'm also really into URLs)

lidel commented 2 years ago

@RangerMauve agree on many of your points, would appreciate your feedback in discussion on "how to pin mutable content paths" happening in https://github.com/ipfs/pinning-services-api-spec/issues/85.

Let's keep discussion in this PR limited to adding dnslink codec (to be in pair with existing dnsaddr)

@vmx @rvagg ok for me to merge this?

vmx commented 2 years ago

I know too little about all this, hence this one is not blocked on me.