add mkSOA
This commit is contained in:
parent
8d8f68f5ab
commit
2b9ee5b29b
|
@ -77,18 +77,33 @@ data Zone = Zone
|
||||||
|
|
||||||
-- | Every domain has a SOA record, which is big and complicated.
|
-- | Every domain has a SOA record, which is big and complicated.
|
||||||
data SOA = SOA
|
data SOA = SOA
|
||||||
{ sRoot :: BindDomain
|
{ sDomain :: BindDomain
|
||||||
|
-- ^ Typically ns1.your.domain
|
||||||
, sSerial :: SerialNumber
|
, sSerial :: SerialNumber
|
||||||
-- ^ The most important parameter is the serial number,
|
-- ^ The most important parameter is the serial number,
|
||||||
-- which must increase after each change.
|
-- which must increase after each change.
|
||||||
, sRefresh :: Integer
|
, sRefresh :: Integer
|
||||||
, sRetry :: Integer
|
, sRetry :: Integer
|
||||||
, sExpire :: Integer
|
, sExpire :: Integer
|
||||||
, sTTL :: Integer
|
, sTTL :: Integer
|
||||||
, sRecord :: [Record]
|
, sRecord :: [Record]
|
||||||
-- ^ Records for the root of the domain. Typically NS, A, TXT
|
-- ^ Records for the root of the domain. Typically NS, A, TXT
|
||||||
}
|
}
|
||||||
deriving (Read, Show, Eq)
|
deriving (Read, Show, Eq)
|
||||||
|
|
||||||
|
-- | Generates a SOA with some fairly sane numbers in it.
|
||||||
|
mkSOA :: Domain -> [Record] -> SOA
|
||||||
|
mkSOA d rs = SOA
|
||||||
|
{ sDomain = AbsDomain d
|
||||||
|
, sSerial = 1
|
||||||
|
, sRefresh = hours 4
|
||||||
|
, sRetry = hours 1
|
||||||
|
, sExpire = 2419200 -- 4 weeks
|
||||||
|
, sTTL = hours 8
|
||||||
|
, sRecord = rs
|
||||||
|
}
|
||||||
|
where
|
||||||
|
hours n = n * 60 * 60
|
||||||
|
|
||||||
-- | Types of DNS records.
|
-- | Types of DNS records.
|
||||||
--
|
--
|
||||||
|
@ -232,7 +247,7 @@ genSOA soa = unlines $
|
||||||
[ dValue SOADomain
|
[ dValue SOADomain
|
||||||
, "IN"
|
, "IN"
|
||||||
, "SOA"
|
, "SOA"
|
||||||
, dValue (sRoot soa)
|
, dValue (sDomain soa)
|
||||||
, "root"
|
, "root"
|
||||||
, "("
|
, "("
|
||||||
]
|
]
|
||||||
|
|
Loading…
Reference in New Issue