halogen-websocket-ipc-playzone/drop/RR.purs

72 lines
1.9 KiB
Plaintext

module App.RR where
type InputParameter
= { valid :: Boolean
, value :: String
}
type RecordType = String
type RecordTarget = String
type RecordName = 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
type Protocol = String
type RRId = Int
type Modified = Boolean
type Valid = Boolean
type RecordBase l
= { rrtype :: RecordType
, rrid :: RRId
, modified :: Boolean
, valid :: Boolean
, ttl :: TTL
, name :: RecordName
, target :: RecordTarget
, readonly :: Boolean
| l
}
-- CNAME A AAAA NS TXT
type SimpleRR l = RecordBase (|l)
type MXRR l = RecordBase ( priority :: Priority | l)
type SRVRR l = MXRR ( protocol :: Protocol
, weight :: Weight
, port :: Port
| l)
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 ()
defaultResourceA
= { rrid: 0, rrtype: "A", modified: false, valid: true, readonly: false
, ttl: "200", name : "www", target: "192.168.10.2" }
defaultResourceMX :: MXRR ()
defaultResourceMX
= { rrid: 0, rrtype: "MX", modified: false, valid: true, readonly: false
, ttl: "500", priority: "10", name : "mail", target: "www" }
defaultResourceSRV :: SRVRR ()
-- RRId Modified Valid Priority Protocol Weight Port TTL Domain Value
defaultResourceSRV
= { rrid: 0, rrtype: "SRV", modified: false, valid: true, readonly: false
, priority: "10", protocol: "_tcp", weight: "100"
, port: "80", ttl: "200"
, name : "_sip._tcp.example.com.", target: "sip.example.com." }