Paul Frazee

I work on a peer-to-peer browser called Beaker. I live in Austin TX. We run a public-peer service called Hashbase, still in closed beta.

<-- home

Announcing DatHTTPD

Configure the variables in this post
$YOUR_DNS
$YOUR_DAT
$YOUR_EMAIL


As of Beaker Browser 0.6.1, you can visit Dat sites using DNS shortnames:

This is accomplished with DNS-over-HTTPS, and made simple with DatHTTPD. DatHTTPD serves Web sites over HTTPS and Dat with automatic TLS certificates.


DNS-over-HTTPS

DNS shortnames for Dat were not possible until Beaker 0.6.1.

We needed a secure way to transmit a DNS mapping for non-HTTPS sites. Originally we used DNS TXT records, but the lack of authentication made the lookup easy to MITM. We considered DNSSEC, but due to limited deployment and difficult setup, we felt that was the wrong solution.

We opted for DNS-over-HTTPS instead.

How it works. When a Dat URL with a shortname such as dat:// is loaded, Beaker makes a GET request to https:///.well-known/dat. The response looks like this:

dat:///
TTL=3600

Beaker loads the URL from line 1, and then caches it for the number of seconds specified by the TTL line 2. This is used by DatHTTPD to host sites over Dat and HTTPS at the same shortname.



DNS for Dat!


DatHTTPD

DatHTTPD is a static server for Dat and HTTPS. It rehosts dats so that you can visit https:// or dat:// and get the same content.

How it works. DatHTTPD joins the swarm for the sites it’s hosting, then creates an HTTPS server for each site and hosts them at separate domains. It uses Lets Encrypt to provision TLS certificates automatically. The /.well-known/dat file is served for each domain.

How to use it. Host your Dat site locally using Beaker or the Dat CLI. Setup a VPS and point your DNS entry to it. Then create a config file at ~/.dathttpd.yml:

letsencrypt:
  email: ''
  agreeTos: true
sites:
  :
    url: dat:///

Now run:

npm install -g dathttpd
dathttpd start

The server is now running. Traditional browsers can visit https:// and Beaker can visit dat://.

When you publish updates to the Dat sites, DatHTTPD will automatically sync those changes from your device.

More info on the readme


Summary

DNS-over-HTTPS enables Beaker to load Dat sites with shortnames, and DatHTTPD lets you host sites over Dat and HTTPS.

Links:


-prf



Tweets: twitter.com/pfrazee

Code: github.com/pfrazee

Creating a peer-to-peer Web: beakerbrowser.com