diff options
| author | Joey Hess <joey@kitenet.net> | 2014-04-23 15:04:35 -0400 |
|---|---|---|
| committer | Joey Hess <joey@kitenet.net> | 2014-04-23 15:04:35 -0400 |
| commit | 34c7a1406018ce1566a09f8823a2aeee16f1505a (patch) | |
| tree | 6735d1c1a9493472c69b6dc563da5c05ab573858 /Propellor/Types | |
| parent | 0bc737c1ba01459124a9f409e79f31923be0217a (diff) | |
propellor spin
Diffstat (limited to 'Propellor/Types')
| -rw-r--r-- | Propellor/Types/Dns.hs | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/Propellor/Types/Dns.hs b/Propellor/Types/Dns.hs index 9b2ad1e7..ba6a92dd 100644 --- a/Propellor/Types/Dns.hs +++ b/Propellor/Types/Dns.hs @@ -1,5 +1,7 @@ module Propellor.Types.Dns where +import Propellor.Types.OS (HostName) + import Data.Word type Domain = String @@ -14,14 +16,15 @@ fromIPAddr (IPv6 addr) = addr -- | Represents a bind 9 named.conf file. data NamedConf = NamedConf { confDomain :: Domain - , confType :: Type + , confDnsServerType :: DnsServerType , confFile :: FilePath , confMasters :: [IPAddr] + , confAllowTransfer :: [IPAddr] , confLines :: [String] } deriving (Show, Eq, Ord) -data Type = Master | Secondary +data DnsServerType = Master | Secondary deriving (Show, Eq, Ord) -- | Represents a bind 9 zone file. @@ -66,6 +69,10 @@ getCNAME :: Record -> Maybe BindDomain getCNAME (CNAME d) = Just d getCNAME _ = Nothing +getNS :: Record -> Maybe BindDomain +getNS (NS d) = Just d +getNS _ = Nothing + -- | Bind serial numbers are unsigned, 32 bit integers. type SerialNumber = Word32 @@ -78,3 +85,8 @@ type SerialNumber = Word32 -- to add nameservers, MX's, etc to a domain. data BindDomain = RelDomain Domain | AbsDomain Domain | RootDomain deriving (Read, Show, Eq, Ord) + +domainHostName :: BindDomain -> Maybe HostName +domainHostName (RelDomain d) = Just d +domainHostName (AbsDomain d) = Just d +domainHostName RootDomain = Nothing |
