From 68e58e5c4aaf0279f041c251e73e4aaccf616286 Mon Sep 17 00:00:00 2001 From: PHO Date: Tue, 26 May 2009 11:52:46 +0900 Subject: [PATCH] Code cleanup --- ExampleDNSServer.hs | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/ExampleDNSServer.hs b/ExampleDNSServer.hs index f590caa..b366e14 100644 --- a/ExampleDNSServer.hs +++ b/ExampleDNSServer.hs @@ -21,25 +21,24 @@ main = runNamed cnf zoneFor zone :: Zone zone = Zone { - zoneName = mkDN "cielonegro.org." - , zoneResponders = [ wrapResponder' $ - do name <- getQueryName - if name == mkDN "ns.cielonegro.org." then - respond ResourceRecord { - rrName = name - , rrType = A - , rrClass = IN - , rrTTL = 9600 - , rrData = inetAddr "127.0.0.1" - } - else - fail "FIXME: we want to throw NameError but we can't for now" - ] + zoneName = mkDN "cielonegro.org." + , zoneResponders = [ wrapResponder responderA + ] , zoneIsAuthoritative = True } - wrapResponder' :: Responder A IN () -> SomeResponder - wrapResponder' = wrapResponder + responderA :: Responder A IN () + responderA = do name <- getQueryName + if name == mkDN "ns.cielonegro.org." then + respond ResourceRecord { + rrName = name + , rrType = A + , rrClass = IN + , rrTTL = 9600 + , rrData = inetAddr "127.0.0.1" + } + else + fail "FIXME: we want to throw NameError but we can't for now" inetAddr :: String -> HostAddress -- 2.40.0