Hoogle Search
Within LTS Haskell 24.61 (ghc-9.10.3)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
-
data-effects Data.Effect.KVStore No documentation available.
lookupA :: Resolver -> Domain -> IO (Either DNSError [IPv4])dns Network.DNS.Lookup Look up all 'A' records for the given hostname. A straightforward example:
>>> rs <- makeResolvSeed defaultResolvConf >>> withResolver rs $ \resolver -> lookupA resolver "192.0.2.1.nip.io" Right [192.0.2.1]
This function will also follow a CNAME and resolve its target if one exists for the queried hostname:>>> rs2 <- makeResolvSeed defaultResolvConf >>> withResolver rs2 $ \resolver -> lookupA resolver "www.kame.net" Right [210.155.141.200]
lookupAAAA :: Resolver -> Domain -> IO (Either DNSError [IPv6])dns Network.DNS.Lookup Look up all (IPv6) 'AAAA' records for the given hostname. Examples:
>>> rs <- makeResolvSeed defaultResolvConf >>> withResolver rs $ \resolver -> lookupAAAA resolver "www.wide.ad.jp" Right [2001:200:0:180c:20c:29ff:fec9:9d61]
lookupAAAAviaMX :: Resolver -> Domain -> IO (Either DNSError [IPv6])dns Network.DNS.Lookup Look up all 'MX' records for the given hostname, and then resolve their hostnames to IPv6 addresses by calling lookupAAAA. The priorities are not retained.
lookupAviaMX :: Resolver -> Domain -> IO (Either DNSError [IPv4])dns Network.DNS.Lookup Look up all 'MX' records for the given hostname, and then resolve their hostnames to IPv4 addresses by calling lookupA. The priorities are not retained. Examples:
>>> import Data.List (sort) >>> rs <- makeResolvSeed defaultResolvConf >>> ips <- withResolver rs $ \resolver -> lookupAviaMX resolver "wide.ad.jp" >>> fmap sort ips Right [203.178.136.30]
Since there is more than one result, it is necessary to sort the list in order to check for equality.lookupMX :: Resolver -> Domain -> IO (Either DNSError [(Domain, Int)])dns Network.DNS.Lookup Look up all 'MX' records for the given hostname. Two parts constitute an MX record: a hostname , and an integer priority. We therefore return each record as a (Domain, Int). In this first example, we look up the MX for the domain "example.com". It has an RFC7505 NULL MX (to prevent a deluge of spam from examples posted on the internet).
>>> rs <- makeResolvSeed defaultResolvConf >>> withResolver rs $ \resolver -> lookupMX resolver "example.com" Right [(".",0)]The domain "mew.org" does however have a single MX:>>> rs2 <- makeResolvSeed defaultResolvConf >>> withResolver rs2 $ \resolver -> lookupMX resolver "mew.org" Right [("mail.mew.org.",10)]Also note that all hostnames are returned with a trailing dot to indicate the DNS root. However the MX host itself has no need for an MX record, so its MX RRset is empty. But, "no results" is still a successful result.>>> rs3 <- makeResolvSeed defaultResolvConf >>> withResolver rs3 $ \resolver -> lookupMX resolver "mail.mew.org" Right []
lookupNS :: Resolver -> Domain -> IO (Either DNSError [Domain])dns Network.DNS.Lookup Look up all 'NS' records for the given hostname. The results 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/. There will typically be more than one name server for a domain. It is therefore extra important to sort the results if you prefer them to be at all deterministic. Examples:
>>> import Data.List (sort) >>> rs <- makeResolvSeed defaultResolvConf >>> ns <- withResolver rs $ \resolver -> lookupNS resolver "mew.org" >>> fmap sort ns Right ["ns1.mew.org.","ns2.mew.org."]
lookupNSAuth :: Resolver -> Domain -> IO (Either DNSError [Domain])dns Network.DNS.Lookup Look up all 'NS' records for the given hostname. The results are taken from the AUTHORITY section of the response and not the usual ANSWER (use lookupNS for that). For details, see e.g. http://www.zytrax.com/books/dns/ch15/. There will typically be more than one name server for a domain. It is therefore extra important to sort the results if you prefer them to be at all deterministic. For an example, we can look up the nameservers for "example.com" from one of the root servers, a.gtld-servers.net, the IP address of which was found beforehand:
>>> import Data.List (sort) >>> let ri = RCHostName "192.5.6.30" -- a.gtld-servers.net >>> let rc = defaultResolvConf { resolvInfo = ri } >>> rs <- makeResolvSeed rc >>> ns <- withResolver rs $ \resolver -> lookupNSAuth resolver "example.com" >>> fmap sort ns Right ["a.iana-servers.net.","b.iana-servers.net."]lookupPTR :: Resolver -> Domain -> IO (Either DNSError [Domain])dns Network.DNS.Lookup 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." We look up the PTR associated with the IP address 210.130.137.80, i.e., 80.137.130.210.in-addr.arpa:
>>> rs <- makeResolvSeed defaultResolvConf >>> withResolver rs $ \resolver -> lookupPTR resolver "180.2.232.202.in-addr.arpa" Right ["www.iij.ad.jp."]
The lookupRDNS function is more suited to this particular task.lookupRDNS :: Resolver -> Domain -> IO (Either DNSError [Domain])dns Network.DNS.Lookup Convenient wrapper around lookupPTR to perform a reverse lookup on a single IP address. We repeat the example from lookupPTR, except now we pass the IP address directly:
>>> rs <- makeResolvSeed defaultResolvConf >>> withResolver rs $ \resolver -> lookupRDNS resolver "202.232.2.180" Right ["www.iij.ad.jp."]