hsdns-1.5: Asynchronous DNS Resolver

Portabilityportable
Stabilityprovisional
Maintainersimons@cryp.to

ADNS

Description

An asynchronous DNS resolver based on GNU ADNS http://www.gnu.org/software/adns/. You should link your program with the threaded runtime-system when using this module. In GHC, this is accomplished by specifying -threaded on the command-line.

Synopsis

Documentation

type HostName = String

Either a host name e.g., "haskell.org" or a numeric host address string consisting of a dotted decimal IPv4 address or an IPv6 address e.g., "192.168.0.1".

type Resolver = String -> RRType -> [QueryFlag] -> IO (MVar Answer)Source

A Resolver is an IO computation which -- given the name and type of the record to query -- returns an MVar that will eventually contain the Answer from the Domain Name System.

initResolver :: [InitFlag] -> (Resolver -> IO a) -> IO aSource

Run the given IO computation with an Initialized Resolver. Note that resolver functions can be shared, and should be shared between any number of IO threads. You may use multiple resolvers, of course, but doing so defeats the purpose of an asynchronous resolver.

data InitFlag Source

Constructors

NoEnv

do not look at environment

NoErrPrint

never print output to stderr (Debug overrides)

NoServerWarn

do not warn to stderr about duff nameservers etc

Debug

enable all output to stderr plus Debug msgs

LogPid

include process id in diagnostic output

NoAutoSys

do not make syscalls at every opportunity

Eintr

allow adnsSynch to return eINTR

NoSigPipe

application has SIGPIPE set to SIG_IGN, do not protect

CheckC_EntEx

do consistency checks on entry/exit to adns functions

CheckC_Freq

do consistency checks very frequently (slow!)

querySRV :: Resolver -> HostName -> IO (Maybe [(HostName, PortID)])Source

For quering SRV records. Result is the list of tuples (host, port).

dummyDNS :: ResolverSource

Use this function to disable DNS resolving. It will always return (Answer sSYSTEMFAIL Nothing (Just host) (-1) []).