add mkSOA
This commit is contained in:
parent
8d8f68f5ab
commit
2b9ee5b29b
|
@ -77,7 +77,8 @@ 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.
|
||||||
|
@ -90,6 +91,20 @@ data SOA = SOA
|
||||||
}
|
}
|
||||||
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.
|
||||||
--
|
--
|
||||||
-- This is not a complete list, more can be added.
|
-- This is not a complete list, more can be added.
|
||||||
|
@ -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