+class MX:
+ def __init__(self, name: str, prio: int = 10) -> None:
+ self._priority = int(prio)
+ self._name = check_hostname(name)
+
+ def generate_rr(self, owner: str, zone: 'Zone') -> 'Any':
+ return zone.RR(owner, 'MX', '{0} {1}'.format(self._priority, zone.abs_hostname(self._name)))
+
+
+class SRV:
+ def __init__(self, protocol: str, service: str, name: str, port: int, prio: int, weight: int) -> None:
+ self._service = check_label(service)
+ self._protocol = check_label(protocol)
+ self._priority = int(prio)
+ self._weight = int(weight)
+ self._port = int(port)
+ self._name = check_hostname(name)
+
+ def generate_rr(self, owner: str, zone: 'Zone') -> 'Any':
+ return zone.RR('_{0}._{1}.{2}'.format(self._service, self._protocol, owner), 'SRV',
+ '{0} {1} {2} {3}'.format(self._priority, self._weight, self._port, zone.abs_hostname(self._name)))
+
+
+class TLSA:
+ class Usage:
+ CA = 0 # certificate must pass the usual CA check, with the CA specified by the TLSA record
+ EndEntity_PlusCAs = 1 # the certificate must match the TLSA record *and* pass the usual CA check
+ TrustAnchor = 2 # the certificate must pass a check with the TLSA record giving the (only) trust anchor
+ EndEntity = 3 # the certificate must match the TLSA record
+
+ class Selector:
+ Full = 0
+ SubjectPublicKeyInfo = 1
+
+ class MatchingType:
+ Exact = 0
+ SHA256 = 1
+ SHA512 = 2
+
+ def __init__(self, protocol: str, port: int, usage: int, selector: int, matching_type: int, data: str) -> None:
+ self._port = int(port)
+ self._protocol = str(protocol)
+ self._usage = int(usage)
+ self._selector = int(selector)
+ self._matching_type = int(matching_type)
+ self._data = check_hex(data)
+
+ def generate_rr(self, owner: str, zone: 'Zone') -> 'Any':
+ return zone.RR('_{0}._{1}.{2}'.format(self._port, self._protocol, owner), 'TLSA', '{0} {1} {2} {3}'.format(self._usage, self._selector, self._matching_type, self._data))