halogen-websocket-ipc-playzone/src/App/RR.purs

71 lines
1.9 KiB
Plaintext
Raw Normal View History

module App.RR where
type InputParameter
= { valid :: Boolean
, value :: String
}
type RecordType = String
type RecordValue = String
type RecordDomain = String
-- 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
type RRId = Int
type Modified = Boolean
type Valid = Boolean
type RecordBase l
= { t :: RecordType
, id :: RRId
, modified :: Boolean
, valid :: Boolean
, ttl :: TTL
, domain :: RecordDomain
, value :: RecordValue | l
}
-- CNAME A AAAA NS TXT
type SimpleRR l = RecordBase (|l)
type MXRR l = RecordBase ( priority :: Priority | l)
type SRVRR l = RecordBase ( priority :: Priority
2023-07-12 01:38:21 +02:00
, protocol :: Protocol
, weight :: Weight
, port :: Port
| l)
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)
defaultResourceA :: SimpleRR ()
2023-07-12 19:11:09 +02:00
defaultResourceA
= { id: 0, t: "A", modified: false, valid: true
, ttl: "200", domain: "www", value: "192.168.10.2" }
defaultResourceMX :: MXRR ()
2023-07-12 19:11:09 +02:00
defaultResourceMX
= { id: 0, t: "MX", modified: false, valid: true
, ttl: "500", priority: "10", domain: "mail", value: "www" }
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
= { id: 0, t: "SRV", modified: false, valid: true
, priority: "10", protocol: "_tcp", weight: "100"
, port: "80", ttl: "200"
, domain: "_sip._tcp.example.com.", value: "sip.example.com." }