dns 1.1.0 → 1.1.1
raw patch · 3 files changed
+15/−9 lines, 3 files
Files
- Network/DNS.hs +1/−0
- Network/DNS/Resolver.hs +13/−8
- dns.cabal +1/−1
Network/DNS.hs view
@@ -4,6 +4,7 @@ -- convenience. -- Applications will most likely use the high-level interface, while -- library/daemon authors may need to use the lower-level one.+-- EDNS0 and TCP fallback are not supported yet. -- module Network.DNS ( -- * High level
Network/DNS/Resolver.hs view
@@ -46,16 +46,18 @@ -- -- >>> let cache = RCHostName "8.8.8.8" ---data FileOrNumericHost = RCFilePath FilePath | RCHostName HostName-+data FileOrNumericHost = RCFilePath FilePath -- ^ A path for \"resolv.conf\"+ | RCHostName HostName -- ^ A numeric IP address -- | Type for resolver configuration. The easiest way to construct a -- @ResolvConf@ object is to modify the 'defaultResolvConf'. data ResolvConf = ResolvConf { resolvInfo :: FileOrNumericHost+ -- | Timeout in micro seconds. , resolvTimeout :: Int+ -- | The number of retries including the first try. , resolvRetry :: Int- -- | This field was obsoleted.+ -- | This field was obsoleted. , resolvBufsize :: Integer } @@ -66,7 +68,7 @@ -- -- * 'resolvTimeout' is 3,000,000 micro seconds. ----- * 'resolvRetry' is 5.+-- * 'resolvRetry' is 3. -- -- * 'resolvBufsize' is 512. (obsoleted) --@@ -79,13 +81,14 @@ defaultResolvConf = ResolvConf { resolvInfo = RCFilePath "/etc/resolv.conf" , resolvTimeout = 3 * 1000 * 1000- , resolvRetry = 5+ , resolvRetry = 3 , resolvBufsize = 512 } ---------------------------------------------------------------- --- | Abstract data type of DNS Resolver seed+-- | Abstract data type of DNS Resolver seed.+-- When implementing a DNS cache, this should be re-used. data ResolvSeed = ResolvSeed { addrInfo :: AddrInfo , rsTimeout :: Int@@ -94,6 +97,7 @@ } -- | Abstract data type of DNS Resolver+-- When implementing a DNS cache, this MUST NOT be re-used. data Resolver = Resolver { genId :: IO Int , dnsSock :: Socket@@ -139,13 +143,14 @@ -- | Giving a thread-safe 'Resolver' to the function of the second--- argument. 'withResolver' should be passed to 'forkIO'. For--- examples, see "Network.DNS.Lookup".+-- argument. A socket for UDP is opened inside and is surely closed. withResolver :: ResolvSeed -> (Resolver -> IO a) -> IO a withResolver seed func = bracket (openSocket seed) sClose $ \sock -> do connectSocket sock seed func $ makeResolver seed sock +-- | Giving thread-safe 'Resolver's to the function of the second+-- argument. Sockets for UDP are opened inside and are surely closed. withResolvers :: [ResolvSeed] -> ([Resolver] -> IO a) -> IO a withResolvers seeds func = bracket openSockets closeSockets $ \socks -> do mapM_ (uncurry connectSocket) $ zip socks seeds
dns.cabal view
@@ -1,5 +1,5 @@ Name: dns-Version: 1.1.0+Version: 1.1.1 Author: Kazu Yamamoto <kazu@iij.ad.jp> Maintainer: Kazu Yamamoto <kazu@iij.ad.jp> License: BSD3