I needed to do detailed DNS lookups in client-side JavaScript. I didn't find anything existing, so I whipped up a simple gateway that resolves DNS queries submitted via HTTP and returns the answers in JSON.
Please note that this is not meant for heavy or commerical use. If you need something more stable/scalable, let me know: I can set you up for a modest (extremely modest) fee.
The script is located at /tool/rest/dns.json
. Some samples:
Apple NS,
Gmail MX,
Microsoft A,
www.fileformat.info CNAME.
Parameter | Description |
---|---|
callback | (optional) JSONP function name |
q | (required) question: the name of the host you want to lookup |
type | (optional: defaults to 'A'): the type of record to lookup. Currently supported: A, CNAME, MX, NS, TXT |
A single object with answer, question and result members.
answer has code, message and values members. The code and message are from the DNS lookup.
question has q and type members
result has code and message members. These will be the dns.json script's HTTP-like code and message.
dnsjava for querying DNS
json-simple for JSON encoding
Goole Public DNS for getting the answers