Copyright | © 2017 Herbert Valerio Riedel |
---|---|
License | GPLv3 |
Safe Haskell | Trustworthy |
Language | Haskell2010 |
This module implements an API for accessing the Domain Name Service (DNS) resolver service via the standard <windns.h>/dnsapi.dll system library on Win32 systems.
Synopsis
- queryA :: Name -> IO [(TTL, IPv4)]
- queryAAAA :: Name -> IO [(TTL, IPv6)]
- queryCNAME :: Name -> IO [(TTL, Name)]
- querySRV :: Name -> IO [(TTL, SRV Name)]
- queryTXT :: Name -> IO [(TTL, [CharStr])]
- newtype Name = Name ByteString
- newtype CharStr = CharStr ByteString
- data IPv4 = IPv4 !Word32
- data IPv6 = IPv6 !Word64 !Word64
- newtype TTL = TTL Int32
- data SRV l = SRV {}
High level API
queryA :: Name -> IO [(TTL, IPv4)] Source #
Query A
record (see RFC 1035, section 3.4.1).
This query returns only exact matches (modulo foldCaseName
).
E.g. in case of CNAME
responses even if the
answer section would contain A
records for the hostnames pointed
to by the CNAME
.
>>>
queryA (Name "www.google.com")
[(TTL 72,IPv4 0xd83acde4)]
queryAAAA :: Name -> IO [(TTL, IPv6)] Source #
Query AAAA
records (see RFC 3596).
This query returns only exact matches (modulo foldCaseName
).
E.g. in case of CNAME
responses even if the answer section would
contain A
records for the hostnames pointed to by the
CNAME
.
>>>
queryAAAA (Name "www.google.com")
[(TTL 299,IPv6 0x2a0014504001081e 0x2004)]
queryCNAME :: Name -> IO [(TTL, Name)] Source #
Query CNAME
records (see RFC 1035, section 3.3.1).
>>>
queryCNAME (Name "hackage.haskell.org")
[(TTL 299,Name "j.global-ssl.fastly.net.")]
querySRV :: Name -> IO [(TTL, SRV Name)] Source #
Query SRV
records (see RFC 2782).
>>>
querySRV (Name "_imap._tcp.gmail.com")
[(TTL 21599,SRV {srvPriority = 0, srvWeight = 0, srvPort = 0, srvTarget = Name "."})]
queryTXT :: Name -> IO [(TTL, [CharStr])] Source #
Query TXT
records (see RFC 1035, section 3.3.14).
>>>
queryTXT (Name "_mirrors.hackage.haskell.org")
[(TTL 299,["0.urlbase=http://hackage.fpcomplete.com/", "1.urlbase=http://objects-us-west-1.dream.io/hackage-mirror/"])]
Types
<domain-name>
as per RFC 1035, section 3.3.
A domain-name represented as a series of labels separated by dots.
<character-string>
as per RFC 1035, section 3.3.
A sequence of up to 255 octets
The limit of 255 octets is caused by the encoding which uses by a prefixed octet denoting the length.
An IPv4 address
The IP address is represented in network order, i.e. 127.0.0.1
is
represented as (IPv4 0x7f000001)
.
An IPv6 address
The IP address is represented in network order,
i.e. 2606:2800:220:1:248:1893:25c8:1946
is
represented as (IPv6 0x2606280002200001 0x248189325c81946)
.
Cache time-to-live expressed in seconds
SRV
Record data as per RFC 2782
Instances
Functor SRV Source # | |
Foldable SRV Source # | |
Defined in Network.DNS.FFI fold :: Monoid m => SRV m -> m # foldMap :: Monoid m => (a -> m) -> SRV a -> m # foldr :: (a -> b -> b) -> b -> SRV a -> b # foldr' :: (a -> b -> b) -> b -> SRV a -> b # foldl :: (b -> a -> b) -> b -> SRV a -> b # foldl' :: (b -> a -> b) -> b -> SRV a -> b # foldr1 :: (a -> a -> a) -> SRV a -> a # foldl1 :: (a -> a -> a) -> SRV a -> a # elem :: Eq a => a -> SRV a -> Bool # maximum :: Ord a => SRV a -> a # | |
Traversable SRV Source # | |
Eq l => Eq (SRV l) Source # | |
Read l => Read (SRV l) Source # | |
Show l => Show (SRV l) Source # | |
NFData l => NFData (SRV l) Source # | |
Defined in Network.DNS.FFI |