--- | Perform a query, but take the result from the authority section
--- of the response rather than the answer section. Code shamelessly
--- stolen from Network.DNS.lookup.
-lookup_authority :: Resolver -> Domain -> TYPE -> IO (Maybe [RDATA])
-lookup_authority rlv dom typ = (>>= toRDATA) <$> lookupRaw rlv dom typ
- where
- correct r = rrtype r == typ
- listToMaybe [] = Nothing
- listToMaybe xs = Just xs
- toRDATA = listToMaybe . map rdata . filter correct . authority
-
--- | Like lookupNS, except we take the result from the authority
--- section of the response (as opposed to the answer section).
-lookupNS_authority :: Resolver -> Domain -> IO (Maybe [Domain])
-lookupNS_authority rlv dom = toNS <$> DNS.lookup_authority rlv dom NS
- where
- toNS = fmap (map unTag)
- unTag (RD_NS dm) = dm
- unTag _ = error "lookupNS_authority"
-
-resolve_address :: String -> IO (Maybe IPv4)
+-- | Takes a String representing either a hostname or an IP
+-- address. If a hostname was supplied, it is resolved to either an
+-- [IPv4] or an error. If an IP address is supplied, it is returned
+-- as a singleton [IPv4].
+--
+-- Examples:
+--
+-- >>> resolve_address "example.com"
+-- Right [93.184.216.34]
+-- >>> resolve_address "93.184.216.34"
+-- Right [93.184.216.34]
+--
+resolve_address :: String -> IO (Either DNSError [IPv4])