A DNS resolver. This code acts like the resolver library from libc, except that it can work asynchronously, and can return much more information.
At the moment, the interface is very much undecided but currently looks like this:
import qualified Network.DNS.Client as DNS DNS.resolve DNS.A "somedomain.com" Right [(2008-02-01 00:27:14.861098 UTC, DNS.RRA )]
The first element of the tuple is the time when the information expires. The second depends on the record type requested (A, in this case) and A records contain IP address, so that's a HostAddress in there.
This module parses
etcresolv.conf for it's configuration. It needs a
recursive server to do the hard work. If you're lacking a recursive
server, you can setup dnscache (from djbdns) locally and point at that.
the type of DNS information requested
the domain to query
|-> IO (Either DNSError [(UTCTime, RR)])|
The RR values here will always be of the correct type for the requested DNSType
Lookup some information from DNS
This is the same as resolve, below, put you get the answer asynchronously. Blocking the thread which makes the callback in this case is bad - it'll block the DNS network reading thread.
This is the type of errors from the library. Either it's one of the first two errors (which are generated from within this code), or it's an error directly from the DNS server.
the DNS server didn't answer
this is returned when the DNS server returned a valid answer, but the answer didn't include the information we were looking for. Firstly, this isn't a recursive resolver, so if you point it at a non-recursive server you'll get this for nearly every query as the server will just be telling us the location of the roots.
This can also occur when you ask for a resource which doesn't exist - like a AAAA record from www.google.com
errors from the DNS server