windns-0.1.0.0: Domain Name Service (DNS) lookup via the <windns.h>/dnsapi.dll standard library

Copyright© 2017 Herbert Valerio Riedel
LicenseGPLv3
Safe HaskellTrustworthy
LanguageHaskell2010

Network.DNS

Contents

Description

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

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

newtype Name Source #

<domain-name> as per RFC 1035, section 3.3.

A domain-name represented as a series of labels separated by dots.

Constructors

Name ByteString 

Instances

Eq Name Source # 

Methods

(==) :: Name -> Name -> Bool #

(/=) :: Name -> Name -> Bool #

Ord Name Source # 

Methods

compare :: Name -> Name -> Ordering #

(<) :: Name -> Name -> Bool #

(<=) :: Name -> Name -> Bool #

(>) :: Name -> Name -> Bool #

(>=) :: Name -> Name -> Bool #

max :: Name -> Name -> Name #

min :: Name -> Name -> Name #

Read Name Source # 
Show Name Source # 

Methods

showsPrec :: Int -> Name -> ShowS #

show :: Name -> String #

showList :: [Name] -> ShowS #

NFData Name Source # 

Methods

rnf :: Name -> () #

newtype CharStr Source #

<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.

Constructors

CharStr ByteString 

data IPv4 Source #

An IPv4 address

The IP address is represented in network order, i.e. 127.0.0.1 is represented as (IPv4 0x7f000001).

Constructors

IPv4 !Word32 

Instances

Eq IPv4 Source # 

Methods

(==) :: IPv4 -> IPv4 -> Bool #

(/=) :: IPv4 -> IPv4 -> Bool #

Ord IPv4 Source # 

Methods

compare :: IPv4 -> IPv4 -> Ordering #

(<) :: IPv4 -> IPv4 -> Bool #

(<=) :: IPv4 -> IPv4 -> Bool #

(>) :: IPv4 -> IPv4 -> Bool #

(>=) :: IPv4 -> IPv4 -> Bool #

max :: IPv4 -> IPv4 -> IPv4 #

min :: IPv4 -> IPv4 -> IPv4 #

Read IPv4 Source # 
Show IPv4 Source # 

Methods

showsPrec :: Int -> IPv4 -> ShowS #

show :: IPv4 -> String #

showList :: [IPv4] -> ShowS #

NFData IPv4 Source # 

Methods

rnf :: IPv4 -> () #

data IPv6 Source #

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).

Constructors

IPv6 !Word64 !Word64 

Instances

Eq IPv6 Source # 

Methods

(==) :: IPv6 -> IPv6 -> Bool #

(/=) :: IPv6 -> IPv6 -> Bool #

Ord IPv6 Source # 

Methods

compare :: IPv6 -> IPv6 -> Ordering #

(<) :: IPv6 -> IPv6 -> Bool #

(<=) :: IPv6 -> IPv6 -> Bool #

(>) :: IPv6 -> IPv6 -> Bool #

(>=) :: IPv6 -> IPv6 -> Bool #

max :: IPv6 -> IPv6 -> IPv6 #

min :: IPv6 -> IPv6 -> IPv6 #

Read IPv6 Source # 
Show IPv6 Source # 

Methods

showsPrec :: Int -> IPv6 -> ShowS #

show :: IPv6 -> String #

showList :: [IPv6] -> ShowS #

NFData IPv6 Source # 

Methods

rnf :: IPv6 -> () #

newtype TTL Source #

Cache time-to-live expressed in seconds

Constructors

TTL Int32 

Instances

Eq TTL Source # 

Methods

(==) :: TTL -> TTL -> Bool #

(/=) :: TTL -> TTL -> Bool #

Ord TTL Source # 

Methods

compare :: TTL -> TTL -> Ordering #

(<) :: TTL -> TTL -> Bool #

(<=) :: TTL -> TTL -> Bool #

(>) :: TTL -> TTL -> Bool #

(>=) :: TTL -> TTL -> Bool #

max :: TTL -> TTL -> TTL #

min :: TTL -> TTL -> TTL #

Read TTL Source # 
Show TTL Source # 

Methods

showsPrec :: Int -> TTL -> ShowS #

show :: TTL -> String #

showList :: [TTL] -> ShowS #

NFData TTL Source # 

Methods

rnf :: TTL -> () #

data SRV l Source #

SRV Record data as per RFC 2782

Constructors

SRV 

Instances

Functor SRV Source # 

Methods

fmap :: (a -> b) -> SRV a -> SRV b #

(<$) :: a -> SRV b -> SRV a #

Foldable SRV Source # 

Methods

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 #

toList :: SRV a -> [a] #

null :: SRV a -> Bool #

length :: SRV a -> Int #

elem :: Eq a => a -> SRV a -> Bool #

maximum :: Ord a => SRV a -> a #

minimum :: Ord a => SRV a -> a #

sum :: Num a => SRV a -> a #

product :: Num a => SRV a -> a #

Traversable SRV Source # 

Methods

traverse :: Applicative f => (a -> f b) -> SRV a -> f (SRV b) #

sequenceA :: Applicative f => SRV (f a) -> f (SRV a) #

mapM :: Monad m => (a -> m b) -> SRV a -> m (SRV b) #

sequence :: Monad m => SRV (m a) -> m (SRV a) #

Eq l => Eq (SRV l) Source # 

Methods

(==) :: SRV l -> SRV l -> Bool #

(/=) :: SRV l -> SRV l -> Bool #

Read l => Read (SRV l) Source # 
Show l => Show (SRV l) Source # 

Methods

showsPrec :: Int -> SRV l -> ShowS #

show :: SRV l -> String #

showList :: [SRV l] -> ShowS #

NFData l => NFData (SRV l) Source # 

Methods

rnf :: SRV l -> () #