module Network.DNS.Types.Internal where
import Network.Socket (AddrInfo(..), PortNumber, HostName)
import Network.DNS.Imports
import Network.DNS.Memo
import Network.DNS.Types
data FileOrNumericHost = RCFilePath FilePath
| RCHostName HostName
| RCHostNames [HostName]
| RCHostPort HostName PortNumber
deriving Int -> FileOrNumericHost -> ShowS
[FileOrNumericHost] -> ShowS
FileOrNumericHost -> String
(Int -> FileOrNumericHost -> ShowS)
-> (FileOrNumericHost -> String)
-> ([FileOrNumericHost] -> ShowS)
-> Show FileOrNumericHost
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FileOrNumericHost] -> ShowS
$cshowList :: [FileOrNumericHost] -> ShowS
show :: FileOrNumericHost -> String
$cshow :: FileOrNumericHost -> String
showsPrec :: Int -> FileOrNumericHost -> ShowS
$cshowsPrec :: Int -> FileOrNumericHost -> ShowS
Show
data CacheConf = CacheConf {
CacheConf -> TTL
maximumTTL :: TTL
, CacheConf -> Int
pruningDelay :: Int
} deriving Int -> CacheConf -> ShowS
[CacheConf] -> ShowS
CacheConf -> String
(Int -> CacheConf -> ShowS)
-> (CacheConf -> String)
-> ([CacheConf] -> ShowS)
-> Show CacheConf
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CacheConf] -> ShowS
$cshowList :: [CacheConf] -> ShowS
show :: CacheConf -> String
$cshow :: CacheConf -> String
showsPrec :: Int -> CacheConf -> ShowS
$cshowsPrec :: Int -> CacheConf -> ShowS
Show
defaultCacheConf :: CacheConf
defaultCacheConf :: CacheConf
defaultCacheConf = TTL -> Int -> CacheConf
CacheConf TTL
300 Int
10
data ResolvConf = ResolvConf {
ResolvConf -> FileOrNumericHost
resolvInfo :: FileOrNumericHost
, ResolvConf -> Int
resolvTimeout :: Int
, ResolvConf -> Int
resolvRetry :: Int
, ResolvConf -> [ResourceRecord]
resolvEDNS :: [ResourceRecord]
, ResolvConf -> Bool
resolvConcurrent :: Bool
, ResolvConf -> Maybe CacheConf
resolvCache :: Maybe CacheConf
} deriving Int -> ResolvConf -> ShowS
[ResolvConf] -> ShowS
ResolvConf -> String
(Int -> ResolvConf -> ShowS)
-> (ResolvConf -> String)
-> ([ResolvConf] -> ShowS)
-> Show ResolvConf
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ResolvConf] -> ShowS
$cshowList :: [ResolvConf] -> ShowS
show :: ResolvConf -> String
$cshow :: ResolvConf -> String
showsPrec :: Int -> ResolvConf -> ShowS
$cshowsPrec :: Int -> ResolvConf -> ShowS
Show
defaultResolvConf :: ResolvConf
defaultResolvConf :: ResolvConf
defaultResolvConf = ResolvConf :: FileOrNumericHost
-> Int
-> Int
-> [ResourceRecord]
-> Bool
-> Maybe CacheConf
-> ResolvConf
ResolvConf {
resolvInfo :: FileOrNumericHost
resolvInfo = String -> FileOrNumericHost
RCFilePath String
"/etc/resolv.conf"
, resolvTimeout :: Int
resolvTimeout = Int
3 Int -> Int -> Int
forall a. Num a => a -> a -> a
* Int
1000 Int -> Int -> Int
forall a. Num a => a -> a -> a
* Int
1000
, resolvRetry :: Int
resolvRetry = Int
3
, resolvEDNS :: [ResourceRecord]
resolvEDNS = [EDNS0 -> ResourceRecord
fromEDNS0 EDNS0
defaultEDNS0]
, resolvConcurrent :: Bool
resolvConcurrent = Bool
False
, resolvCache :: Maybe CacheConf
resolvCache = Maybe CacheConf
forall a. Maybe a
Nothing
}
data ResolvSeed = ResolvSeed {
ResolvSeed -> ResolvConf
resolvconf :: ResolvConf
, ResolvSeed -> NonEmpty AddrInfo
nameservers :: NonEmpty AddrInfo
}
data Resolver = Resolver {
Resolver -> ResolvSeed
resolvseed :: ResolvSeed
, Resolver -> NonEmpty (IO Word16)
genIds :: NonEmpty (IO Word16)
, Resolver -> Maybe Cache
cache :: Maybe Cache
}