]> gitweb.michael.orlitzky.com - haeredes.git/blobdiff - src/Main.hs
Change "IP" to "HOST" in the --server arg.
[haeredes.git] / src / Main.hs
index 5c6f401f7a5e839b6f5545bd4e4bba91cd6b3195..6b276b7980b9b5687493f6b72ab46590d5fb9b9d 100644 (file)
@@ -32,7 +32,12 @@ import DNS (
   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) =
@@ -42,6 +47,11 @@ 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
@@ -88,8 +98,8 @@ main = do
   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