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

72 lines
1.9 KiB
Plaintext
Raw Normal View History

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
2023-07-12 01:38:21 +02:00
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)
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
= { rrid: 0, rrtype: "A", modified: false, valid: true, readonly: false
, ttl: "200", name : "www", target: "192.168.10.2" }
defaultResourceMX :: MXRR ()
2023-07-12 19:11:09 +02:00
defaultResourceMX
= { rrid: 0, rrtype: "MX", modified: false, valid: true, readonly: false
, ttl: "500", priority: "10", name : "mail", target: "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
= { 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"
, name : "_sip._tcp.example.com.", target: "sip.example.com." }