DNS Resolver and lookup functions.
Sample code:
import qualified Network.DNS as DNS (lookup) import Network.DNS hiding (lookup) main :: IO () main = do rs <- makeResolvSeed defaultResolvConf withResolver rs $ \resolver -> do DNS.lookup resolver "www.example.com" A >>= print
- data FileOrNumericHost
- data ResolvConf = ResolvConf {}
- defaultResolvConf :: ResolvConf
- data ResolvSeed
- makeResolvSeed :: ResolvConf -> IO ResolvSeed
- data Resolver
- withResolver :: ResolvSeed -> (Resolver -> IO ()) -> IO ()
- lookup :: Resolver -> Domain -> TYPE -> IO (Maybe [RDATA])
- lookupRaw :: Resolver -> Domain -> TYPE -> IO (Maybe DNSFormat)
Documentation
Configuration for resolver
data FileOrNumericHost Source
data ResolvConf Source
Type for resolver configuration
defaultResolvConf :: ResolvConfSource
Default ResolvConf
.
resolvInfo
is RCFilePath
"/etc/resolv.conf".
resolvTimeout
is 3,000,000 micro seconds.
resolvBufsize
is 512.
Intermediate data type for resolver
data ResolvSeed Source
Abstract data type of DNS Resolver seed
makeResolvSeed :: ResolvConf -> IO ResolvSeedSource
Making ResolvSeed
from an IP address of a DNS cache server.
Type and function for resolver
withResolver :: ResolvSeed -> (Resolver -> IO ()) -> IO ()Source
Giving a thread-safe Resolver
to the function of the second
argument. withResolver
should be passed to forkIO
.