Skip to content

Instantly share code, notes, and snippets.

@jbenet

jbenet/dnsweb.md Secret

Last active October 5, 2015 13:01
Show Gist options
  • Save jbenet/ca4f31dfbaec7c8ce9a8 to your computer and use it in GitHub Desktop.
Save jbenet/ca4f31dfbaec7c8ce9a8 to your computer and use it in GitHub Desktop.
note on dns + web

note on DNS and the Web

DISCLAIMER: I have not done any review of other systems that already do this. I'm sure there are many, as this is a trivial extension. Further disclaimer: I also dislike DNS, and this note should not be taken to mean otherwise.

DNS is used mostly to map names to IP Addresses and other protocol-specific resources. IPFS will use a TXT record to map to objects or names:

// ipfs (objects)
TXT  example.com  "ipfs=<hash-of-object>[/path]"

// ipns (names)
TXT  example.com  "ipns=<hash-of-publickey>[/path]"

But perhaps much better to use a general, protocol agnostic link:

// format
TXT  example.com  "link=/path/to/resource"

// ipfs (objects)
TXT  example.com  "link=/ipfs/<hash-of-object>[/path]"

// ipns (names)
TXT  example.com  "link=/ipns/<hash-of-publickey>[/path]"

// http
TXT  example.com  "link=/http/<hostname>[/path]"

// bittorrent
TXT  example.com  "link=/bittorrent/<infohash>[/piece]"

// bitcoin
TXT  example.com  "link=/bitcoin/address/<bitcoin-address>"

The key can be link or dnsweb or whatever isn't taken.

This way path file systems can use dns in its paths without locking users into one protocol. I.e. http uses dns, but it's in an http-only context:

consider http://foo.com/bar/baz.txt

> DNS resolve A foo.com 
< A foo.com 10.20.30.40

> HTTP get http://10.20.30.40:80/bar/baz.txt
< ...

But with these links, we could use dns to reference other protocols easily, and make the web cross protocol boundaries seamlessly.

consider /ipns/foo.com/bar/baz.txt

> IPNS "foo.com" is a DNS name, thus resolve with DNS
> DNS resolve TXT (link) foo.com

< TXT foo.com "link=/ipfs/<hash-of-foo>"
> IPFS get /ipfs/<hash-of-foo>/bar/baz.txt

or

< TXT foo.com "link=/bittorrent/<foo-infohash>"
> BitTorrent get <foo-infohash>/bar/baz.txt

or 

< TXT foo.com "link=/http/<bar.com>/baz.txt"
> HTTP get http://<bar.com>/baz.txt

fs root

This fits in well with another idea I have, which I'll detail more in the future. The gist of that is to make all root file systems the same, specifying the protocol in the first path component. (Shoving all your local filesystem into /local for now.)

/dns/foo.com/bar/baz.txt
/http/10.20.30.40/bar/baz.txt
/ipfs/abcabcabcbabcacab/bar/baz.txt
/ipns/foo.com/bar/baz.txt
/bittorrent/abbaabababbaabab/bar/baz.txt
/local/foo/bar/baz.txt

And thus all our filesystems would work nicely together. Links would make sense across protocols.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment