Beispiel #1
0
    def validate(self, default_record=False):
        if not default_record:
            self.validate_domain_id()
        self.validate_record_hostname(default_record)

        ip = str(self.values.get("value"))
        if not ValidateIPAddress.ipv4(ip):
            raise RecordValueException("Invalid IP address: " + ip)
Beispiel #2
0
    def validate(self, default_record=False):
        if not default_record:
            self.validate_domain_id()
        self.validate_record_hostname(default_record)
        self.validate_cname_record_value(default_record)

        value = str(self.values.get("value"))
        if ValidateIPAddress.ipv4(value):
            raise RecordValueException(
                "CNAME records cannot point to an IP address")
Beispiel #3
0
    def validate(self, default_record=False):
        if not default_record:
            self.validate_domain_id()
        self.validate_record_hostname(default_record)

        ip = str(self.values.get("value"))
        if not ValidateIPAddress.ipv4(ip):
            raise RecordValueException(
                "Invalid IP address: " + ip
            )
Beispiel #4
0
    def validate(self, default_record=False):
        if not default_record:
            self.validate_domain_id()
        self.validate_record_hostname(default_record)
        self.validate_cname_record_value(default_record)

        value = str(self.values.get("value"))
        if ValidateIPAddress.ipv4(value):
            raise RecordValueException(
                "CNAME records cannot point to an IP address"
            )
Beispiel #5
0
    def validate(self, default_record=False):
        if not default_record:
            self.validate_domain_id()
        self.validate_record_hostname(default_record)

        ip = str(self.values.get("value"))
        if ValidateIPAddress.ipv4(ip):
            raise RecordValueException("MX records cannot be an IP address")

        distance = str(self.values.get("distance"))
        if not distance.isdigit():
            raise RecordValueException("Invalid MX distance: " + distance)
Beispiel #6
0
    def validate(self, default_record=False):
        if not default_record:
            self.validate_domain_id()
        self.validate_record_hostname(default_record)

        value = str(self.values.get("value"))
        if ValidateIPAddress.ipv4(value):
            raise RecordValueException(
                "NS record names cannot be an IP address")

        if not ValidateDNS.record_hostname(value):
            raise RecordValueException("Invalid value for NS record: " + value)
Beispiel #7
0
    def validate(self, default_record=False):
        if not default_record:
            self.validate_domain_id()
        self.validate_record_hostname(default_record)

        ip = str(self.values.get("value"))
        if ValidateIPAddress.ipv4(ip):
            raise RecordValueException("MX records cannot be an IP address")

        distance = str(self.values.get("distance"))
        if not distance.isdigit():
            raise RecordValueException("Invalid MX distance: " + distance)
Beispiel #8
0
    def validate(self, default_record=False):
        if not default_record:
            self.validate_domain_id()
        self.validate_record_hostname(default_record)

        value = str(self.values.get("value"))
        if ValidateIPAddress.ipv4(value):
            raise RecordValueException(
                "NS record names cannot be an IP address"
            )

        if not ValidateDNS.record_hostname(value):
            raise RecordValueException(
                "Invalid value for NS record: " + value
            )
Beispiel #9
0
    def ipv6_to_tinydns(self, uncompressed):
        out = ""
        for part in uncompressed.split(':'):
            # Check IPv4 dotted decimal usage
            if ValidateIPAddress.ipv4(part):
                for ipv4 in part.split('.'):
                    out += dec_to_oct_tinydns(ipv4)
            else:
                # characters 1 and 2
                out += "\\" + self.base_convert(part[0] + part[1], 16,
                                                8).lstrip('0').zfill(3)

                # characters 3 and 4
                out += "\\" + self.base_convert(part[2] + part[3], 16,
                                                8).lstrip('0').zfill(3)

        return out
Beispiel #10
0
    def ipv6_to_tinydns(self, uncompressed):
        out = ""
        for part in uncompressed.split(':'):
            # Check IPv4 dotted decimal usage
            if ValidateIPAddress.ipv4(part):
                for ipv4 in part.split('.'):
                    out += dec_to_oct_tinydns(ipv4)
            else:
                # characters 1 and 2
                out += "\\" + self.base_convert(
                    part[0] + part[1], 16, 8
                ).lstrip('0').zfill(3)

                # characters 3 and 4
                out += "\\" + self.base_convert(
                    part[2] + part[3], 16, 8
                ).lstrip('0').zfill(3)

        return out
Beispiel #11
0
 def ipv6(self, ipv6_address):
     return ValidateIPAddress.ipv6(ipv6_address)
Beispiel #12
0
 def ipv4(self, ipv4_address):
     return ValidateIPAddress.ipv4(ipv4_address)
Beispiel #13
0
 def ipv6(self, ipv6_address):
     return ValidateIPAddress.ipv6(ipv6_address)
Beispiel #14
0
 def ipv4(self, ipv4_address):
     return ValidateIPAddress.ipv4(ipv4_address)