X-Git-Url: http://git.cielonegro.org/gitweb.cgi?a=blobdiff_plain;f=ExampleDNSServer.hs;h=2dd9564ed8554c20dc52534feab9c09ddf6d001e;hb=dbb3426a4ece9ca6ed398d016a5c0090a2e51c30;hp=e1aaa22e1cf56b86d9c9ce38700073a6bfbadcae;hpb=7a09a987b0369db0c013fb10272329c733ffc8a1;p=haskell-dns.git diff --git a/ExampleDNSServer.hs b/ExampleDNSServer.hs index e1aaa22..2dd9564 100644 --- a/ExampleDNSServer.hs +++ b/ExampleDNSServer.hs @@ -1,16 +1,81 @@ +import Network.DNS.DomainMap (DomainMap) import Network.DNS.Message import Network.DNS.Named import Network.DNS.Named.Config import Network.DNS.Named.Zone -import Network.Socket +import Network.Socket.IsString () main :: IO () -main = runNamed cnf zoneFor +main = runNamed cnf zones where cnf :: Config cnf = Config { - cnfServerAddress = SockAddrInet 9090 iNADDR_ANY + cnfServerPort = "9090" + , cnfAllowTransfer = True } - zoneFor :: DomainName -> Maybe Zone - zoneFor = const Nothing -- FIXME \ No newline at end of file + zones :: DomainMap SomeZone + zones = fromZones + [ wrapZone StaticZone { + szName = "cielonegro.org." + , szRecords = fromRecords + [ wrapRecord ResourceRecord { + rrName = "cielonegro.org." + , rrType = SOA + , rrClass = IN + , rrTTL = 3600 + , rrData = SOAFields { + soaMasterNameServer = "ns.cielonegro.org." + , soaResponsibleMailbox = "root.ns.cielonegro.org." + , soaSerialNumber = 2008022148 + , soaRefreshInterval = 3600 + , soaRetryInterval = 900 + , soaExpirationLimit = 3600000 + , soaMinimumTTL = 3600 + } + } + , wrapRecord ResourceRecord { + rrName = "cielonegro.org." + , rrType = NS + , rrClass = IN + , rrTTL = 3600 + , rrData = "ns.cielonegro.org." + } + , wrapRecord ResourceRecord { + rrName = "ns.cielonegro.org." + , rrType = A + , rrClass = IN + , rrTTL = 9600 + , rrData = "127.0.0.1" + } + , wrapRecord ResourceRecord { + rrName = "ns.cielonegro.org." + , rrType = AAAA + , rrClass = IN + , rrTTL = 9600 + , rrData = "::1" + } + , wrapRecord ResourceRecord { + rrName = "www.cielonegro.org." + , rrType = A + , rrClass = IN + , rrTTL = 9600 + , rrData = "127.0.0.2" + } + , wrapRecord ResourceRecord { + rrName = "www.cielonegro.org." + , rrType = AAAA + , rrClass = IN + , rrTTL = 9600 + , rrData = "fe80::216:cbff:fe39:56a4" + } + , wrapRecord ResourceRecord { + rrName = "git.cielonegro.org." + , rrType = CNAME + , rrClass = IN + , rrTTL = 9600 + , rrData = "www.cielonegro.org." + } + ] + } + ]