Safe Haskell | None |
---|---|
Language | Haskell2010 |
Resolver related data types.
Synopsis
- data ResolvConf
- defaultResolvConf :: ResolvConf
- resolvInfo :: ResolvConf -> FileOrNumericHost
- resolvTimeout :: ResolvConf -> Int
- resolvRetry :: ResolvConf -> Int
- resolvEDNS :: ResolvConf -> [ ResourceRecord ]
- resolvConcurrent :: ResolvConf -> Bool
- resolvCache :: ResolvConf -> Maybe CacheConf
- data FileOrNumericHost
- data CacheConf
- defaultCacheConf :: CacheConf
- maximumTTL :: CacheConf -> TTL
- pruningDelay :: CacheConf -> Int
- data ResolvSeed
- makeResolvSeed :: ResolvConf -> IO ResolvSeed
- data Resolver
- withResolver :: ResolvSeed -> ( Resolver -> IO a) -> IO a
- withResolvers :: [ ResolvSeed ] -> ([ Resolver ] -> IO a) -> IO a
Configuration for resolver
data ResolvConf Source #
Type for resolver configuration.
Use
defaultResolvConf
to create a new value.
An example to use Google's public DNS cache instead of resolv.conf:
>>>
let conf = defaultResolvConf { resolvInfo = RCHostName "8.8.8.8" }
An example to use multiple Google's public DNS cache concurrently:
>>>
let conf = defaultResolvConf { resolvInfo = RCHostNames ["8.8.8.8","8.8.4.4"], resolvConcurrent = True }
An example to disable EDNS0:
>>>
let conf = defaultResolvConf { resolvEDNS = [] }
An example to enable EDNS0 with a 1,280-bytes buffer:
>>>
let conf = defaultResolvConf { resolvEDNS = [fromEDNS0 defaultEDNS0 { udpSize = 1280 }] }
An example to enable cache:
>>>
let conf = defaultResolvConf { resolvCache = Just defaultCacheConf }
Instances
Show ResolvConf Source # | |
Defined in Network.DNS.Types.Internal |
defaultResolvConf :: ResolvConf Source #
Return a default
ResolvConf
:
-
resolvInfo
isRCFilePath
"/etc/resolv.conf". -
resolvTimeout
is 3,000,000 micro seconds. -
resolvRetry
is 3. -
resolvEDNS
is EDNS0 with a 4,096-bytes buffer. -
resolvConcurrent
is False. -
resolvCache
is Nothing.
Accessors
resolvInfo :: ResolvConf -> FileOrNumericHost Source #
Server information.
resolvTimeout :: ResolvConf -> Int Source #
Timeout in micro seconds.
resolvRetry :: ResolvConf -> Int Source #
The number of retries including the first try.
resolvEDNS :: ResolvConf -> [ ResourceRecord ] Source #
Additional resource records to specify EDNS.
resolvConcurrent :: ResolvConf -> Bool Source #
Concurrent queries if multiple DNS servers are specified.
resolvCache :: ResolvConf -> Maybe CacheConf Source #
Cache configuration.
Specifying DNS servers
data FileOrNumericHost Source #
The type to specify a cache server.
RCFilePath FilePath |
A path for "resolv.conf" where one or more IP addresses of DNS servers should be found on Unix. Default DNS servers are automatically detected on Windows regardless of the value of the file name. |
RCHostName HostName |
A numeric IP address. Warning : host names are invalid. |
RCHostNames [ HostName ] |
Numeric IP addresses. Warning : host names are invalid. |
RCHostPort HostName PortNumber |
A numeric IP address and port number. Warning : host names are invalid. |
Instances
Show FileOrNumericHost Source # | |
Defined in Network.DNS.Types.Internal |
Configuring cache
Cache configuration for responses.
defaultCacheConf :: CacheConf Source #
Default cache configuration.
>>>
defaultCacheConf
CacheConf {maximumTTL = 300, pruningDelay = 10}
maximumTTL :: CacheConf -> TTL Source #
If RR's TTL is higher than this value, this value is used instead.
pruningDelay :: CacheConf -> Int Source #
Cache pruning interval in seconds.
Intermediate data type for resolver
data ResolvSeed Source #
Intermediate abstract data type for resolvers.
IP address information of DNS servers is generated
according to
resolvInfo
internally.
This value can be safely reused for
withResolver
.
The naming is confusing for historical reasons.
makeResolvSeed :: ResolvConf -> IO ResolvSeed Source #
Type and function for resolver
Abstract data type of DNS Resolver. This includes newly seeded identifier generators for all specified DNS servers and a cache database.
withResolver :: ResolvSeed -> ( Resolver -> IO a) -> IO a Source #
Giving a thread-safe
Resolver
to the function of the second
argument.
withResolvers :: [ ResolvSeed ] -> ([ Resolver ] -> IO a) -> IO a Source #