Dat

From IndieWeb

Dat was a protocol for transferring files peer-to-peer, renamed to Hypercore protocol in 2020. [1]

IndieWeb Examples

How to run dat dat as a daemon on linux

Important: as Martijn van der Ven pointed out, the commands below import everything, including hidden files, such as .htpasswd, .htaccess, will show source code of PHP files, and so on. It is very easy to leak secrets this way.

This only works with static websites that use relative URLs to navigate.

   # get the latest binary release of dat cli
   cd /tmp
   wget https://github.com/datproject/dat/releases/download/v13.13.1/dat-13.13.1-linux-x64.zip
   unzip dat-13.13.1-linux-x64.zip
   cd dat-13.13.1-linux-x64
   # make the dat binary executable and copy it to a folder in $PATH
   chmod  0755 dat
   sudo cp dat ~/.local/bin
   # go to your website's root directory
   cd /var/www
   # create the dat information - this will be interactive
   dat create
   # create a file to tie your domain to your dat hash
   mkdir .well-known
   grep dat dat.json | sed -r 's/.*: "(.*)"/\1/' > .well-known/dat
   echo "TTL=3600" > .well-known/dat
   # open iptables for dat
   sudo iptables -A INPUT -p tcp -m tcp --dport 3282 -m state --state NEW -j ACCEPT
   # switch to a screen session, because dat doesn't seem to have a real daemon 
   # mode yet
   screen -S dat
   # start sharing - this will import every file it finds in the directory
   # it's running from and will keep watching for changes
   dat share --port 3282 --watch --import

See Also