X-Git-Url: http://git.cielonegro.org/gitweb.cgi?p=haskell-dns.git;a=blobdiff_plain;f=ExampleDNSServer.hs;fp=ExampleDNSServer.hs;h=1aae098bc93e93dcaa1dc582deb164fba202bc2a;hp=75b261aa9effb9349a6f4e7d9a0f75fd557b5803;hb=f3ad40fd6916408dde9b9e6237b41828d90c1e34;hpb=845dca95afa7e073e62520ef3c4840b3b078bdad diff --git a/ExampleDNSServer.hs b/ExampleDNSServer.hs index 75b261a..1aae098 100644 --- a/ExampleDNSServer.hs +++ b/ExampleDNSServer.hs @@ -1,3 +1,4 @@ +import Network.DNS.DomainMap (DomainMap) import Network.DNS.Message import Network.DNS.Named import Network.DNS.Named.Config @@ -5,7 +6,7 @@ import Network.DNS.Named.Zone import Network.Socket.IsString () main :: IO () -main = runNamed cnf (return . findZone) +main = runNamed cnf zones where cnf :: Config cnf = Config { @@ -13,29 +14,26 @@ main = runNamed cnf (return . findZone) , cnfAllowTransfer = True } - findZone :: DomainName -> Maybe Zone - findZone name - | name `isInZone` zone = Just zone - | otherwise = Nothing - - zone :: Zone - zone = Zone { - zoneName = "cielonegro.org." - , zoneSOA = Just SOAFields { - soaMasterNameServer = "ns.cielonegro.org." - , soaResponsibleMailbox = "root.ns.cielonegro.org." - , soaSerialNumber = 2008022148 - , soaRefreshInterval = 3600 - , soaRetryInterval = 900 - , soaExpirationLimit = 3600000 - , soaMinimumTTL = 3600 - } - , zoneRecordNames = return [ "ns.cielonegro.org." - , "www.cielonegro.org." - , "git.cielonegro.org." - ] - , zoneResponder = return . responder - } + zones :: DomainMap Zone + zones = fromZones + [ Zone { + zoneName = "cielonegro.org." + , zoneSOA = Just SOAFields { + soaMasterNameServer = "ns.cielonegro.org." + , soaResponsibleMailbox = "root.ns.cielonegro.org." + , soaSerialNumber = 2008022148 + , soaRefreshInterval = 3600 + , soaRetryInterval = 900 + , soaExpirationLimit = 3600000 + , soaMinimumTTL = 3600 + } + , zoneRecordNames = return [ "ns.cielonegro.org." + , "www.cielonegro.org." + , "git.cielonegro.org." + ] + , zoneResponder = return . responder + } + ] responder :: DomainName -> [SomeRR] responder name