Skip to content

Allowing URI values in DNSLink TXT records #33

@lidel

Description

@lidel

Context

I've been talking with @sjoerdvangroning about https://github.com/pdsinterop/simply-domain (originally created with SOLID in mind, but aims to be generic interop as part of Personal Data Stores Interoperability project) and there is a lot of overlap between that spec draft and what DNSLink allows.

The gist is they want to support TXT pointers to the content using multiple protocols (DNSLink already allows that).
The differences are:

  • providing "proxy" (we use subdomain+A record convention instead),
  • "priority" (we don't have that)
  • "url" (we use unix-like paths with namespace prefix instead).

The diff is mostly cosmetic, and my hope is they could reuse DNSLink, so we don't end up with the standard "standard" situation described in this XKCD:

DNSLink TXT record

dnslink=/<namespace>/<identifier>
dnslink=/ipfs/bafybeigdyrzt5sfp7udm7hu76uh7y26nf3efuylqabf3oclgtqy55fbzdi

Simply-domain TXT record

<proxy> <priority> <url>
www.resource.com 10 https://example.com/file.jpg
www.resource.com 15 https://mirror.example.org/file.jpg
www.resource.com 20 ipfs://bafybeigdyrzt5sfp7udm7hu76uh7y26nf3efuylqabf3oclgtqy55fbzdi

<proxy> is solved in DNSLink by a convention of using of A record on the domain hosting _dnslink subdomain.
<priority> is discussed in #34, let's focus this issue about allowing URIs.
<url> is.. a subset of URIs, and there is a good argument they are more user and developer friendly than our content/addr paths (especially, given that multiaddr can't represent all HTTP URL attributes yet).

Proposal: allow URIs (URLs, URNs)

#16 made the spec a bit more strict, it removed mention of URLs being allowed (things that don't start with / are simply ignored).

After getting feedback from @sjoerdvangroning I feel that was a mistake that will alienate developers who are not entrenched in IPFS ecosystem, sabotaging DNSLink potential to be trully cross-protocol and cross-ecosystem.

DNSLink should support values being URIs (https://en.wikipedia.org/wiki/Uniform_Resource_Identifier).

👉 What notation should be used?

My proposal is to extend spec somehow.

(A) Assume URI unless the value starts with /

One way, is to state that everything that does not start with / should be interpreted as URI:

dnslink=/ipfs/bafybeigdyrzt5sfp7udm7hu76uh7y26nf3efuylqabf3oclgtqy55fbzdi
dnslink=hyper://hypercore-id+version-tag
dnslink=https://example.com/file.jpg

The main argument for this approach is that it looks natural when used outside IPFS ecosystem.
The entire world talks URIs, and this makes them first-class citizens.

My vote is to go this route.

(B) Create explicit /uri/ namespace

An alternative is to document /uri/ namespace, and allow things like:

dnslink=/ipfs/bafybeigdyrzt5sfp7udm7hu76uh7y26nf3efuylqabf3oclgtqy55fbzdi
dnslink=/uri/hyper://hypercore-id+version-tag
dnslink=/uri/https://example.com/file.jpg

It makes it clear that other namespaces than URI are allowed, but looks wasteful and redundant when used outside IPFS ecosystem.
My vote would be against this, as it feels unnecessary.

Backward-compatibility notes

This needs some thought around backward-compatibility and DX/UX:"

  • Values that do not start with / are already ignored, so no change in existing software is necessary, no matter which way we go.
  • IPFS specific question: to remove surprises, should IPFS software support ipfs:// and ipns:// in addition to paths? We most likely need to support both, open question is what we should default in the docs.
  • What to do in reference libraries? How to map namespace and identifier when URI is detected?
    • If we go with /uri/ prefix, no change is needed
    • If we have no prefix, and identify URIs by the lack of '/ in the front, need to solve mapping somehow:
      • (A) namespace would be uri and the identifier be opaque string with the original value
      • (B) set namespace to the URI scheme, and turn the reminder after : into a weird slice (//example.com)?

Value added

Things like this would be possible:

  • data mirrors on IPFS path (backward-compatible)
  • data mirrors on IPFS URI (improved UX for people copying and pasting)
  • URLs pointing multiple HTTP servers (with optional SRI), other p2p systems such as hyper:// (without having to convert them to awkward paths)
  • Magnet URIs could be used as-is
  • URNs with BitTorrent Info Hash, additional hashes that could act as additional content routing hints / integrity checks
dnslink=/ipfs/bafybeigdyrzt5sfp7udm7hu76uh7y26nf3efuylqabf3oclgtqy55fbzdi
dnslink=ipfs://bafybeigdyrzt5sfp7udm7hu76uh7y26nf3efuylqabf3oclgtqy55fbzdi
dnslink=https://example.com/file.zip#sha384-oqVuAfXRKap7fdgcCY5uykM6+R9GqQ8K/uxy9rx7HNQlGYl1kPzQho1wx4JwY8wC
dnslink=https://mirror.example.org/file.zip#sha384-oqVuAfXRKap7fdgcCY5uykM6+R9GqQ8K/uxy9rx7HNQlGYl1kPzQho1wx4JwY8wC
dnslink=urn:btih:c12fe1c06bba254a9dc9f519b335aa7c1367a88a
dnslink=urn:sha1:FINYVGHENTHSMNDSQQYDNLPONVBZTICF
dnslink=urn:md5:b1946ac92492d2347c6235b4d2611184
dnslink=hyper://hypercore-id+version-tag

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions