u      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstNone Raw data format for each type. &Raw data format for resource records. #Raw data format for DNS questions. $9Raw data format for the flags of DNS Query and Response. -:Raw data format for the header of DNS Query and Response. 5,Raw data format for DNS Query and Response. <:An enumeration of all possible DNS errors that can occur. =<The answer has the correct sequence number, but returned an  unexpected RDATA format. >The request simply timed out. ?'The sequence number of the answer doesn't match our query. This  could indicate foul play. @Types for resource records. KType for domain. uMaking Question. W  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKvwLMNuxyOPzV  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKvwLMNuxyOP    !#"$%&'()*+,-./0123456789:;<?>=@ JIHGFEDCBAKvwLMNuxyOPzNoneQ  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQK@JIHGFEDCBALMN<?>=56789:;-./01234$%&'()*+,!#"   OPNone({|}~'{|}~"{|}~NoneQReceiving DNS data from  and parse it. RParsing DNS data. QRQRRQQRNoneSBComposing query. First argument is a number to identify response. TComposing DNS data. STSTTS STNone U#Abstract data type of DNS Resolver [(Abstract data type of DNS Resolver seed \@Type for resolver configuration. The easiest way to construct a   ResolvConf object is to modify the d. `This field was obsoleted. aUnion type for  and  . Specify  to  " resolv.conf" or numeric IP address in  form. Warning&: Only numeric IP addresses are valid  RCHostNames. Example (using Google's public DNS cache):  let cache = RCHostName "8.8.8.8"dReturn a default \:  ^ is c "/etc/ resolv.conf".  _ is 3,000,000 micro seconds.  ` is 512. (obsoleted) Example (use Google',s public DNS cache instead of resolv.conf):  let cache = RCHostName "8.8.8.8"1let rc = defaultResolvConf { resolvInfo = cache }eMake a [ from a \.  Examples: &rs <- makeResolvSeed defaultResolvConffGiving a thread-safe U to the function of the second  argument. f should be passed to forkIO. For  examples, see Network.DNS.Lookup. GLooking up resource records of a domain. The first parameter is one of  the field accessors of the 5 type -- this allows you to J choose which section (answer, authority, or additional) you would like  to inspect for the result. g>Look up resource records for a domain, collecting the results , from the ANSWER section of the response. We repeat an example from Network.DNS.Lookup: ;let hostname = Data.ByteString.Char8.pack "www.example.com"&rs <- makeResolvSeed defaultResolvConf9withResolver rs $ \resolver -> lookup resolver hostname ARight [93.184.216.119]h>Look up resource records for a domain, collecting the results / from the AUTHORITY section of the response. iALook up a name and return the entire DNS Response. Sample output $ is included below, however it is not tested -- the sequence , number is unpredictable (it has to be!). The example code:   - let hostname = Data.ByteString.Char8.pack "www.example.com"  rs <#- makeResolvSeed defaultResolvConf  withResolver rs $ r)esolver -> lookupRaw resolver hostname A %And the (formatted) expected output:   Right (DNSFormat  { header = DNSHeader * { identifier = 1, + flags = DNSFlags : { qOrR = QR_Response, 7 opcode = OP_STD, : authAnswer = False, : trunCation = False, 9 recDesired = True, ; recAvailable = True, 7 rcode = NoErr }, ' qdCount = 1, ' anCount = 1, ' nsCount = 0, ( arCount = 0}, , question = [Question { qname = "www.example.com.", . qtype = A}], 0 answer = [ResourceRecord {rrname = "www.example.com.", 3 rrtype = A, 4 rrttl = 800, 2 rdlen = 4, > rdata = 93.184.216.119}],  authority = [],  additional = []}) UVWXYZ[\]^_`abcdefghiUVWXYZ[\]^_`abcdefghiacb\]^_`d[eUVWXYZfghi UVWXYZ[\]^_`acbdefghiNone j Look up all 'A'! records for the given hostname. A straightforward example: 7let hostname = Data.ByteString.Char8.pack "www.mew.org"&rs <- makeResolvSeed defaultResolvConf8withResolver rs $ \resolver -> lookupA resolver hostnameRight [202.232.15.101]AThis function will also follow a CNAME and resolve its target if ( one exists for the queries hostname: 8let hostname = Data.ByteString.Char8.pack "www.kame.net"&rs <- makeResolvSeed defaultResolvConf8withResolver rs $ \resolver -> lookupA resolver hostnameRight [203.178.141.194]kLook up all (IPv6) 'AAAA'! records for the given hostname.  Examples: 7let hostname = Data.ByteString.Char8.pack "www.mew.org"&rs <- makeResolvSeed defaultResolvConf;withResolver rs $ \resolver -> lookupAAAA resolver hostname%Right [2001:240:11e:c00:00:00:00:101]l Look up all 'MX'+ records for the given hostname. Two parts E constitute an MX record: a hostname , and an integer priority. We % therefore return each record as a (K, Int). 8In this first example, we look up the MX for the domain  " example.com"1. It has no MX (to prevent a deluge of spam from 3 examples posted on the internet). But remember, " no results" is  still a successful result. 7let hostname = Data.ByteString.Char8.pack "example.com"&rs <- makeResolvSeed defaultResolvConf9withResolver rs $ \resolver -> lookupMX resolver hostnameRight [] The domain "mew.org" does however have a single MX: 3let hostname = Data.ByteString.Char8.pack "mew.org"&rs <- makeResolvSeed defaultResolvConf9withResolver rs $ \resolver -> lookupMX resolver hostnameRight [("mail.mew.org.",10)]AAlso note that all hostnames are returned with a trailing dot to  indicate the DNS root. m Look up all 'MX'* records for the given hostname, and then 8 resolve their hostnames to IPv4 addresses by calling  j#. The priorities are not retained.  Examples: import Data.List (sort)3let hostname = Data.ByteString.Char8.pack "mixi.jp"&rs <- makeResolvSeed defaultResolvConfDips <- withResolver rs $ \resolver -> lookupAviaMX resolver hostname fmap sort ipsRight [202.32.29.4,202.32.29.5]ASince there is more than one result, it is necessary to sort the ( list in order to check for equality. n Look up all 'MX'* records for the given hostname, and then 8 resolve their hostnames to IPv6 addresses by calling  k#. The priorities are not retained. .This function performs the real work for both o and  p1. The only difference between those two is which  function, g or h, is used to perform the ; lookup. We take either of those as our first parameter. o Look up all 'NS'- records for the given hostname. The results D are taken from the ANSWER section of the response (as opposed to % AUTHORITY). For details, see e.g.   %http://www.zytrax.com/books/dns/ch15/. 8There will typically be more than one name server for a B domain. It is therefore extra important to sort the results if / you prefer them to be at all deterministic.  Examples: import Data.List (sort)3let hostname = Data.ByteString.Char8.pack "mew.org"&rs <- makeResolvSeed defaultResolvConf?ns <- withResolver rs $ \resolver -> lookupNS resolver hostname fmap sort ns%Right ["ns1.mew.org.","ns2.mew.org."]p Look up all 'NS'- records for the given hostname. The results D are taken from the AUTHORITY section of the response and not the  usual ANSWER (use o" for that). For details, see e.g.   %http://www.zytrax.com/books/dns/ch15/. 8There will typically be more than one name server for a B domain. It is therefore extra important to sort the results if / you prefer them to be at all deterministic. 3For an example, we can look up the nameservers for  " example.com"3 from one of the root servers, a.gtld-servers.net, 1 the IP address of which was found beforehand: import Data.List (sort)7let hostname = Data.ByteString.Char8.pack "example.com"6let ri = RCHostName "192.5.6.30" -- a.gtld-servers.net.let rc = defaultResolvConf { resolvInfo = ri }rs <- makeResolvSeed rcCns <- withResolver rs $ \resolver -> lookupNSAuth resolver hostname fmap sort ns3Right ["a.iana-servers.net.","b.iana-servers.net."]q Look up all 'TXT'- records for the given hostname. The results  are free-form s. Two common uses for 'TXT' records are   4http://en.wikipedia.org/wiki/Sender_Policy_Framework and   7http://en.wikipedia.org/wiki/DomainKeys_Identified_Mail. As an ' example, we find the SPF record for "mew.org": 3let hostname = Data.ByteString.Char8.pack "mew.org"&rs <- makeResolvSeed defaultResolvConf:withResolver rs $ \resolver -> lookupTXT resolver hostnameRight ["v=spf1 +mx -all"]r Look up all 'PTR'. records for the given hostname. To perform a ? reverse lookup on an IP address, you must first reverse its % octets and then append the suffix ".in-addr.arpa." 2We look up the PTR associated with the IP address 6 210.130.137.80, i.e., 80.137.130.210.in-addr.arpa: Glet hostname = Data.ByteString.Char8.pack "80.137.130.210.in-addr.arpa"&rs <- makeResolvSeed defaultResolvConf:withResolver rs $ \resolver -> lookupPTR resolver hostnameRight ["www-v4.iij.ad.jp."]The s2 function is more suited to this particular task. sConvenient wrapper around r to perform a reverse lookup  on a single IP address. We repeat the example from r, except now we pass the IP  address directly: :let hostname = Data.ByteString.Char8.pack "210.130.137.80"&rs <- makeResolvSeed defaultResolvConf;withResolver rs $ \resolver -> lookupRDNS resolver hostnameRight ["www-v4.iij.ad.jp."]t Look up all 'SRV'. records for the given hostname. A SRV record  comprises four fields, $ Priority (lower is more-preferred) : Weight (relative frequency with which to use this record 3 amongst all results with the same priority) 1 Port (the port on which the service is offered) 7 Target (the hostname on which the service is offered) <The first three are integral, and the target is another DNS . hostname. We therefore return a four-tuple   (Int,Int,Int,K).  Examples: ?let hostname = Data.ByteString.Char8.pack "_sip._tcp.cisco.com"&rs <- makeResolvSeed defaultResolvConf:withResolver rs $ \resolver -> lookupSRV resolver hostname%Right [(1,0,5060,"vcsgw.cisco.com.")] jklmnopqrst jklmnopqrst jklmnopqrst jklmnopqrstNoneu  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrst      !"#$%&'()*++,-./01233456789::;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYYZ[\]^__`abcdefghijklmnopqrstuvwxyz{|}}~^ dns-1.0.0Network.DNS.TypesNetwork.DNS.DecodeNetwork.DNS.EncodeNetwork.DNS.ResolverNetwork.DNS.LookupNetwork.DNS.InternalNetwork.DNS.StateBinary Network.DNSRDATARD_OTHRD_SRVRD_TXTRD_AAAARD_ARD_SOARD_PTRRD_MXRD_CNAMERD_NSResourceRecordrrnamerrtyperrttlrdlenrdataQuestionqnameqtypeRCODERefusedNotImplNameErrServFail FormatErrNoErrOPCODEOP_SSROP_INVOP_STDQorR QR_ResponseQR_QueryDNSFlagsqOrRopcode authAnswer trunCation recDesired recAvailablercode DNSHeader identifierflagsqdCountanCountnsCountarCount DNSFormatheaderquestionanswer authority additionalDNSErrorUnexpectedRDATATimeoutExpiredSequenceNumberMismatchTYPEUNKNOWNSRVPTRSOACNAMEMXTXTNSAAAAADomain intToType typeToInttoType responseA responseAAAAreceivedecode composeQueryencodeResolvergenIddnsSock dnsTimeout dnsBufsize ResolvSeed ResolvConf resolvInfo resolvTimeout resolvBufsizeFileOrNumericHost RCHostName RCFilePathdefaultResolvConfmakeResolvSeed withResolverlookup lookupAuth lookupRawlookupA lookupAAAAlookupMX lookupAviaMXlookupAAAAviaMXlookupNS lookupNSAuth lookupTXT lookupPTR lookupRDNS lookupSRV makeQuestionrrDBrookup defaultQuerydefaultResponse $fShowRDATAPStatepsDomain psPositionSGetWStatewsDomain wsPositionSPut initialWStateput8put16put32putInt8putInt16putInt32 putByteString addPositionW fixedSized writeSizedwsPopwsPush getPosition addPositionpushpopget8get16get32getInt8getInt16getInt32 getNBytesgetNByteString initialStatesinkSGetrunSGetrunSPut$fMonoidStateTnetwork-2.4.1.2Network.Socket.TypesSocketreceiveDNSFormatdecodeResponse decodeFlags decodeHeader decodeQueries decodeType decodeQuery decodeRRsdecodeRR decodeRData decodeDomain ignoreClass+++encodeDNSFormat encodeHeader encodeFlagsencodeQuestionencodeRR encodeRDATA encodeDomain encodePointerencodePartialDomainbaseGHC.IOFilePathNetwork.SocketHostNameGHC.BaseString lookupSectionaddrInfo rsTimeout rsBufsize makeAddrInfo getRandom lookupNSImplbytestring-0.10.0.2Data.ByteString.Internal ByteString lookupXviaMX