# Path: uamobile/cidr.py
# def get_ip_addrs(carrier):
# def get_ip(carrier, _memo={}):


from uamobile import cidr
    def supports_cookie(self):
        """
        returns True if the agent supports HTTP cookie.
        """
        raise NotImplementedError

    def _get_real_ip(self):
        """
        get real IP address of client from REMOTE_ADDR and
        HTTP_X_FORWARDED_FOR variables
        """
        try:
            remote_addr = self.environ['REMOTE_ADDR']
        except KeyError:
            return None

        forwared_for = self.environ.get('HTTP_X_FORWARDED_FOR')
        proxy_ips = self.context.get_proxy_ips()
        if forwared_for and proxy_ips:
            forwared_for = forwared_for.split(',', 1)[0].strip()

            # check REMOTE_ADDR is included in trusted reverse
            # proxy address
            for addr in proxy_ips:
                if remote_addr in addr:
                    # override remote addr
                    remote_addr = forwared_for
                    break

        try:

# Path: uamobile/cidr.py
# def get_ip_addrs(carrier):
# def get_ip(carrier, _memo={}):


# Path: uamobile/base.py
from uamobile import cidr

    def supports_cookie(self):
        """
        returns True if the agent supports HTTP cookie.
        """
        raise NotImplementedError

    def _get_real_ip(self):
        """
        get real IP address of client from REMOTE_ADDR and
        HTTP_X_FORWARDED_FOR variables
        """
        try:
            remote_addr = self.environ['REMOTE_ADDR']
        except KeyError:
            return None

        forwared_for = self.environ.get('HTTP_X_FORWARDED_FOR')
        proxy_ips = self.context.get_proxy_ips()
        if forwared_for and proxy_ips:
            forwared_for = forwared_for.split(',', 1)[0].strip()

            # check REMOTE_ADDR is included in trusted reverse
            # proxy address
            for addr in proxy_ips:
                if remote_addr in addr:
                    # override remote addr
                    remote_addr = forwared_for
                    break

        try:

            return cidr.IP(remote_addr)