Wordle over DNS

Why not? It's all the rage.

If you're not intricately familiar with DNS then you might have heard it likened to a phone book; you look up a name and get a number. That is true, one of the most common uses is looking up an A record (for IPv4 addresses) or an AAAA record (for IPv6). However there are many other record types, including text records (TXT) and these can be used for many purposes.

I wrote Wikipedia over DNS a long time ago, which puts a summary of Wikipedia articles into TXT records. It's amazing how much can be put into TXT records. They are sadly, although in keeping with their name designed for text and characters outside the ASCII range will be escaped by most tools. Meaning emoji doesn't just work, a key aspect of Wordle. However it's easy to write a shell function to reverse that and do unescaping. Then we can serve that command over DNS too, so it's easy to get hold of!

So, here is Wordle over DNS:

$ host -t txt wd.ip.wtf
wd.ip.wtf descriptive text "Welcome to Wordle over DNS! Today's puzzle is #1: <guess>.1.wd.ip.wtf"
wd.ip.wtf descriptive text "This shell function makes it easier to play"
  "wd() { dig +short txt $1.1.wd.ip.wtf | perl -pe's/\\([0-9]{1,3})/chr$1/eg'; }"

For the sake of this example I've replaced the 1 with example which is one I prepared earlier so I'm not revealing an actual answer.

$ wd() { dig +short txt $1.example.wd.ip.wtf | perl -pe's/\\([0-9]{1,3})/chr$1/eg'; }
$ wd crane
"⬜⬜🟨🟨🟨"
$ wd reads
"⬜🟨🟨⬜🟩"
$ wd sense
"🟨🟨🟨⬜⬜"
$ wd names
"🟩🟩🟩🟩🟩"

[Note crane was considered one of the best openers, but this is using its own list of words, so that's not really true here.]

If you don't have easy access to DNS, you can use the shell at http://ip.wtf/sh to make DNS queries using the host command.

Implementation

This is implemented as a very simple standalone DNS server in Go using miekg's DNS library. Code is on GitHub (contains spoilers!).