resolve_address )
import ExitCodes (exit_bad_server)
-report :: (Domain, Maybe [Domain]) -> IO ()
+
+-- | Report results for this LookupResult. If there's a Nothing in the
+-- second component, there were no query results, so we report that
+-- the domain was not delegated. If there were some results and
+-- there are leftovers (after "cleaning"), we report those as well.
+report :: LookupResult -> IO ()
report (d, Nothing) =
putStrLn $ "Domain " ++ (show d) ++ " not delegated."
report (d, Just leftovers) =
" delegates somewhere else: " ++
(join " " (map show leftovers))
+
+-- | "Clean" a lookup result by subtracting out the list of delegates.
+-- There shouldn't be anything left over. If there were no lookup
+-- results, we leave the Nothing in place so that 'report' can
+-- pattern match on it.
clean :: [Domain] -- ^ List of delegates, @ds@
-> LookupResult
-> LookupResult
rs <- makeResolvSeed rc
let lookup_function = case cfg of
- (NS _ _ _) -> lookupNS'
- (MX _ _ _) -> lookupMX'
+ NS{} -> lookupNS'
+ MX{} -> lookupMX'
_ <- withResolver rs $ \resolver -> do
-- Bad stuff happens if we try to run these lookups in parallel