Wikipedia over DNS
Tuesday, April 12, 2011
A few days ago, I noticed a project that
allowed querying Wikipedia over DNS. The way this works is to use the
sub-domain query.wp.dg.cx
and parse the DNS “text record”, TXT, as
defined in RFC 1035.
For example, to query for the term “computer”:
$ host -t txt computer.wp.dg.cx
computer.wp.dg.cx descriptive text "A computer is a machine that mani
pulates data according to a list of instructions. The first devices t
hat resemble modern computers date to the mid-20th century (1940\226\
128\1471945), although the computer concept and various machines simi
lar to computers existed" " earlier. Early electronic computers were
the size of a large room, consuming as much power as several hundred
modern personal... https://a.vu/w:Computer"
Several months ago, Doug Coleman wrote the dns
vocabulary to make DNS
requests from Factor. Using it, you can lookup
information for a hostname using a “pure Factor” version of
host:
IN: scratchpad USE: tools.dns
IN: scratchpad "microsoft.com" host
microsoft.com has address 207.46.197.32
microsoft.com has address 207.46.232.182
microsoft.com mail is handled by 10 mail.messaging.microsoft.com
Yesterday, I spoke to Doug about using the dns
vocabulary with the
“Wikipedia over DNS” service. He discovered it required a few minor
changes to support DNS TXT queries:
- Add support for parsing DNS TXT queries.
- Decode TXT strings as utf8, use write instead of print.
- Print a newline after each TXT message in DNS.
With a newer version of Factor that includes those changes, you can now make these queries:
IN: scratchpad USE: dns
IN: scratchpad "computer.wp.dg.cx" TXT.
A computer is a machine that manipulates data according to a list of
instructions. The first devices that resemble modern computers date
to the mid-20th century (1940–1945), although the computer concept a
nd various machines similar to computers existed earlier. Early elec
tronic computers were the size of a large room, consuming as much po
wer as several hundred modern personal... https://a.vu/w:Computer