1 import Network.DNS.Message
2 import Network.DNS.Named
3 import Network.DNS.Named.Config
4 import Network.DNS.Named.Responder
5 import Network.DNS.Named.Zone
7 import System.IO.Unsafe
10 main = runNamed cnf zoneFor
14 cnfServerAddress = SockAddrInet 9090 iNADDR_ANY
17 zoneFor :: DomainName -> Maybe Zone
19 | name `isInZone` zone = Just zone
24 zoneName = mkDN "cielonegro.org."
25 , zoneResponders = [ wrapResponder responderA
27 , zoneIsAuthoritative = True
30 responderA :: Responder A IN ()
31 responderA = do name <- getQueryName
32 if name == mkDN "ns.cielonegro.org." then
33 respond ResourceRecord {
38 , rrData = inetAddr "127.0.0.1"
41 fail "FIXME: we want to throw NameError but we can't for now"
44 inetAddr :: String -> HostAddress
45 inetAddr = unsafePerformIO . inet_addr