2023-07-09 05:14:29 +02:00
|
|
|
module App.RR where
|
|
|
|
|
|
|
|
type InputParameter
|
|
|
|
= { valid :: Boolean
|
|
|
|
, value :: String
|
|
|
|
}
|
|
|
|
|
|
|
|
type RecordType = String
|
2023-07-12 20:38:50 +02:00
|
|
|
type RecordTarget = String
|
|
|
|
type RecordName = String
|
2023-07-09 05:14:29 +02:00
|
|
|
|
|
|
|
-- These should be integers, but I use these values in user inputs.
|
|
|
|
type TTL = String
|
|
|
|
type Weight = String
|
|
|
|
type Priority = String
|
|
|
|
type Port = String
|
2023-07-12 01:38:21 +02:00
|
|
|
type Protocol = String
|
2023-07-09 05:14:29 +02:00
|
|
|
|
|
|
|
type RRId = Int
|
|
|
|
|
|
|
|
type Modified = Boolean
|
|
|
|
type Valid = Boolean
|
|
|
|
|
|
|
|
type RecordBase l
|
2023-07-12 20:38:50 +02:00
|
|
|
= { rrtype :: RecordType
|
|
|
|
, rrid :: RRId
|
2023-07-09 05:14:29 +02:00
|
|
|
, modified :: Boolean
|
|
|
|
, valid :: Boolean
|
|
|
|
, ttl :: TTL
|
2023-07-12 20:38:50 +02:00
|
|
|
, name :: RecordName
|
|
|
|
, target :: RecordTarget
|
|
|
|
, readonly :: Boolean
|
|
|
|
| l
|
2023-07-09 05:14:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
-- CNAME A AAAA NS TXT
|
|
|
|
type SimpleRR l = RecordBase (|l)
|
|
|
|
|
|
|
|
type MXRR l = RecordBase ( priority :: Priority | l)
|
2023-07-12 20:38:50 +02:00
|
|
|
type SRVRR l = MXRR ( protocol :: Protocol
|
|
|
|
, weight :: Weight
|
|
|
|
, port :: Port
|
|
|
|
| l)
|
2023-07-09 05:14:29 +02:00
|
|
|
|
2023-07-11 23:35:56 +02:00
|
|
|
type SOARR l
|
|
|
|
= RecordBase ( mname :: String
|
|
|
|
, rname :: String
|
|
|
|
, serial :: String -- Int
|
|
|
|
, refresh :: String -- Int
|
|
|
|
, retry :: String -- Int
|
|
|
|
, expire :: String -- Int
|
|
|
|
, minttl :: String -- Int
|
|
|
|
| l)
|
|
|
|
|
2023-07-09 05:14:29 +02:00
|
|
|
defaultResourceA :: SimpleRR ()
|
2023-07-12 19:11:09 +02:00
|
|
|
defaultResourceA
|
2023-07-12 20:38:50 +02:00
|
|
|
= { rrid: 0, rrtype: "A", modified: false, valid: true, readonly: false
|
|
|
|
, ttl: "200", name : "www", target: "192.168.10.2" }
|
2023-07-09 05:14:29 +02:00
|
|
|
|
|
|
|
defaultResourceMX :: MXRR ()
|
2023-07-12 19:11:09 +02:00
|
|
|
defaultResourceMX
|
2023-07-12 20:38:50 +02:00
|
|
|
= { rrid: 0, rrtype: "MX", modified: false, valid: true, readonly: false
|
|
|
|
, ttl: "500", priority: "10", name : "mail", target: "www" }
|
2023-07-09 05:14:29 +02:00
|
|
|
|
|
|
|
defaultResourceSRV :: SRVRR ()
|
2023-07-12 01:38:21 +02:00
|
|
|
-- RRId Modified Valid Priority Protocol Weight Port TTL Domain Value
|
2023-07-12 19:11:09 +02:00
|
|
|
defaultResourceSRV
|
2023-07-12 20:38:50 +02:00
|
|
|
= { rrid: 0, rrtype: "SRV", modified: false, valid: true, readonly: false
|
2023-07-12 19:11:09 +02:00
|
|
|
, priority: "10", protocol: "_tcp", weight: "100"
|
|
|
|
, port: "80", ttl: "200"
|
2023-07-12 20:38:50 +02:00
|
|
|
, name : "_sip._tcp.example.com.", target: "sip.example.com." }
|