# Path: dyndnsc/detector/base.py
# LOG = logging.getLogger(__name__)
# class IPDetector(Subject, DynamicCliMixin):
#     def __init__(self, *args, **kwargs):
#     def can_detect_offline(self):
#     def af(self):
#     def get_old_value(self):
#     def set_old_value(self, value):
#     def get_current_value(self, default=None):
#     def set_current_value(self, value):
#     def has_changed(self):
#     def configuration_key_prefix():
# 
# Path: dyndnsc/common/six.py
# def ipaddress(addr):
#     """Return an ipaddress.ip_address object from the given string IP."""
#     return _ipaddress.ip_address(addr)
# 
# def ipnetwork(addr):
#     """Return an ipaddress.ip_network object from the given string IP."""
#     return _ipaddress.ip_network(addr)


import logging
from random import randint
from .base import IPDetector, AF_INET
from ..common.six import ipaddress, ipnetwork
    def is_reserved_ip(self, ip):
        """Check if the given ip address is in a reserved ipv4 address space.

        :param ip: ip address
        :return: boolean
        """
        theip = ipaddress(ip)
        for res in self._reserved_netmasks:
            if theip in ipnetwork(res):
                return True
        return False

    def random_public_ip(self):
        """Return a randomly generated, public IPv4 address.

        :return: ip address
        """
        randomip = random_ip()
        while self.is_reserved_ip(randomip):
            randomip = random_ip()
        return randomip

    def __iter__(self):
        """Iterate over this instance.."""
        count = 0
        while self._max is None or count < self._max:
            yield self.random_public_ip()
            count += 1



# Path: dyndnsc/detector/base.py
# LOG = logging.getLogger(__name__)
# class IPDetector(Subject, DynamicCliMixin):
#     def __init__(self, *args, **kwargs):
#     def can_detect_offline(self):
#     def af(self):
#     def get_old_value(self):
#     def set_old_value(self, value):
#     def get_current_value(self, default=None):
#     def set_current_value(self, value):
#     def has_changed(self):
#     def configuration_key_prefix():
# 
# Path: dyndnsc/common/six.py
# def ipaddress(addr):
#     """Return an ipaddress.ip_address object from the given string IP."""
#     return _ipaddress.ip_address(addr)
# 
# def ipnetwork(addr):
#     """Return an ipaddress.ip_network object from the given string IP."""
#     return _ipaddress.ip_network(addr)


# Path: dyndnsc/detector/rand.py
import logging
from random import randint
from .base import IPDetector, AF_INET
from ..common.six import ipaddress, ipnetwork

    def is_reserved_ip(self, ip):
        """Check if the given ip address is in a reserved ipv4 address space.

        :param ip: ip address
        :return: boolean
        """
        theip = ipaddress(ip)
        for res in self._reserved_netmasks:
            if theip in ipnetwork(res):
                return True
        return False

    def random_public_ip(self):
        """Return a randomly generated, public IPv4 address.

        :return: ip address
        """
        randomip = random_ip()
        while self.is_reserved_ip(randomip):
            randomip = random_ip()
        return randomip

    def __iter__(self):
        """Iterate over this instance.."""
        count = 0
        while self._max is None or count < self._max:
            yield self.random_public_ip()
            count += 1



class IPDetector_Random(IPDetector):