Ejemplo n.º 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)
Ejemplo n.º 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")
Ejemplo n.º 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
            )
Ejemplo n.º 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"
            )
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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
            )
Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 11
0
 def ipv6(self, ipv6_address):
     return ValidateIPAddress.ipv6(ipv6_address)
Ejemplo n.º 12
0
 def ipv4(self, ipv4_address):
     return ValidateIPAddress.ipv4(ipv4_address)
Ejemplo n.º 13
0
 def ipv6(self, ipv6_address):
     return ValidateIPAddress.ipv6(ipv6_address)
Ejemplo n.º 14
0
 def ipv4(self, ipv4_address):
     return ValidateIPAddress.ipv4(ipv4_address)