Stability | experimental |
---|---|
Maintainer | Ertugrul Soeylemez <es@ertes.de> |
This module implements an asynchronous, caching DNS resolver.
- data DnsCache
- createDnsCache :: MonadIO m => Int -> NominalDiffTime -> m DnsCache
- freeDnsCache :: MonadIO m => DnsCache -> m ()
- withDnsCache :: (HasExceptions m, MonadIO m) => Int -> NominalDiffTime -> (DnsCache -> m a) -> m a
- class MonadIO m => DnsMonad m where
- getDnsCache :: m DnsCache
- withDnsStateT :: (Applicative m, HasExceptions m, MonadIO m) => Int -> NominalDiffTime -> StateT a DnsCache m a -> m a
- resolveA :: DnsMonad m => Domain -> m (Maybe [IPv4])
- resolveAAAA :: DnsMonad m => Domain -> m (Maybe [IPv6])
- resolveMX :: DnsMonad m => Domain -> m (Maybe [Domain])
- data MassResult = MassResult {}
- data MassType
- massLookup :: DnsMonad m => MassType -> [Domain] -> m (Map Domain MassResult)
- massLookupReport :: DnsMonad m => MassType -> [Domain] -> (MassResult -> m ()) -> m ()
- type Domain = String
DNS cache
createDnsCache :: MonadIO m => Int -> NominalDiffTime -> m DnsCacheSource
Start a DNS cache with the given number of resolver threads and the given cache timeout.
freeDnsCache :: MonadIO m => DnsCache -> m ()Source
Free existing DNS cache.
withDnsCache :: (HasExceptions m, MonadIO m) => Int -> NominalDiffTime -> (DnsCache -> m a) -> m aSource
Convenient wrapper around createDnsCache
and freeDnsCache
.
Monadic interface
class MonadIO m => DnsMonad m whereSource
Monads, which contain a DNS cache.
getDnsCache :: m DnsCacheSource
Get the current DNS cache.
withDnsStateT :: (Applicative m, HasExceptions m, MonadIO m) => Int -> NominalDiffTime -> StateT a DnsCache m a -> m aSource
Run a StateT
computation with a DNS cache.
DNS lookup
DNS mass lookup
massLookup :: DnsMonad m => MassType -> [Domain] -> m (Map Domain MassResult)Source
Perform a mass lookup.
massLookupReport :: DnsMonad m => MassType -> [Domain] -> (MassResult -> m ()) -> m ()Source
Perform a mass lookup with report function.