Zone is correctly received. SOA todo.

This commit is contained in:
Philippe Pittoli 2023-07-11 03:43:16 +02:00
parent 88226019fd
commit 0680c9f1ab

View File

@ -508,6 +508,7 @@ handleQuery = case _ of
H.raise $ Log $ SimpleLog $ "[🎉] Got the zone!"
H.raise $ Log $ SimpleLog $ "DEBUG: the zone has domain: " <> response.zone.domain
H.raise $ Log $ SimpleLog $ "DEBUG: zone: " <> show_zone response.zone
add_entries response.zone.resources
(DNSManager.MkSuccess _) -> do
H.raise $ Log $ SimpleLog $ "[🎉] Success!"
@ -533,6 +534,19 @@ handleQuery = case _ of
Just { head: x, tail: xs } -> "(" <> x.rrtype <> ": " <> show x.rrid <> ") " <> resource_list xs
Nothing -> ""
add_entries [] = H.raise $ Log $ SimpleLog "Done adding entries"
add_entries arr = do
state <- H.get
case A.head arr, A.tail arr of
Nothing, _ -> H.raise $ Log $ SimpleLog "Done adding entries (but why this didn't performed pattern matching??)"
Just new_rr, tail -> case add_entry state new_rr of
Left error_message -> do
H.raise $ Log $ SimpleLog $ "Error while adding new entry: " <> error_message
add_entries $ fromMaybe [] tail
Right new_state -> do
H.put new_state
add_entries $ fromMaybe [] tail
add_entry :: State -> ResourceRecord -> Either String State
add_entry state new_rr = do
case new_rr.rrtype, (A.elem new_rr.rrtype baseRecords) of