Returns whether or not a given IP address falls within this range.
@param string $ipAddress The given IP address.
@return boolean Returns true if the IP address falls within the range
and false otherwise.
481119
public function containsIp($ipAddress)
    {
        $ipLong = ip2long($ipAddress);
        return ($this->getLowerInt() <= $ipLong) && ($this->getUpperInt() >= $ipLong);
    }
29719
public function frontend_excluded_ip_addresses($request)
    {
        $frontend_excluded_ip_addresses = config('lasallecmsfrontend.frontend_excluded_ip_addresses');

        // "true" = exclude
        if (empty($frontend_excluded_ip_addresses)) return false;

        $requestIPAddress = $this->customAdminAuthChecks->getRequestIPAddress($request);

        return $this->customAdminAuthChecks->ipAddressCheck($frontend_excluded_ip_addresses, $requestIPAddress);
    }
689128
public function validateIp($ip)
    {
        $ipnums = explode(".", $ip);
        if (count($ipnums) != 4) {
            return false;
        }
        foreach($ipnums as $ipnum) {
            if (!is_numeric($ipnum) || ($ipnum > 255)) {
                return false;
            }
        }
        return $ip;
    }
786700
public static boolean isValidIPAddress(String networkAddress) {
		if (networkAddress != null) {
			String[] split = networkAddress.split("\\.");
			if (split.length == 4) {
				int[] octets = new int[4];
				for (int i=0; i<4; i++) {
					try {
						octets[i] = Integer.parseInt(split[i]);
					} catch (NumberFormatException e) {
						return false;
					}
					if (octets[i] < 0 || octets[i] > 255) {
						return false;
					}
				}
				return true;
			}
		}
		return false;
	}
558958
public function containsRange(RangeInterface $range)
    {
        $result = false;
        if ($range->getAddressType() === $this->getAddressType()) {
            if ($range->toString(false) === $this->toString(false)) {
                $result = true;
            }
        }

        return $result;
    }
369076
public function getCountryCode3ByIP($ipAddress = '')
    {
        // Get remote ip address if empty
        $ipAddress = (empty($ipAddress) ? $this->request->server->get('REMOTE_ADDR') : $ipAddress);

        // Check implementation
        if (!function_exists('geoip_country_code3_by_name')) {
            throw new Exception('geoip_country_code3_by_name() function is not available.');
        }

        // Return country code
        return geoip_country_code3_by_name($ipAddress);
    }
1020789
public function getIpsForRange($ipRange)
    {
        $range = IPUtils::getIPRangeBounds($ipRange);
        if ($range === null) {
            return false;
        }

        return array(IPUtils::binaryToStringIP($range[0]), IPUtils::binaryToStringIP($range[1]));
    }
857004
public function getAttemptsLeftWithSameIp(string $ipAddress): int
    {
        $attemptsLeft = ((int) $this->maxAttemptsForIpAddress) - $this->enhancedAuthenticationMapper->fetchAttemptsWithSameIp($ipAddress, $this->banTimeInSeconds);

        return \max(0, $attemptsLeft);
    }
159478
public function ipAddress($subject) : bool
    {
        if ($subject === null) {
            return false;
        }
        $v = '' . $subject;
        return $v === '' ? false : !!filter_var($v, FILTER_VALIDATE_IP);
    }
281189
public function validateIP($ipAddress = null)
    {
        if ($ipAddress === null) {
            $parsed = parse_url($this->uri);
            $ipAddress = isset($parsed['host']) ? $parsed['host'] : null;
        }
        return (
            filter_var($ipAddress, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4) ||
            filter_var(trim($ipAddress, '[]'), FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)
        );
    }
334400
public function isFree($ipAddress) {
        if (!isset($this->current)) {
            throw new BadMethodCallException('You need to call method "load()" first.');
        }

        $longIP = $this->convertIPv4Address($ipAddress);

        return ! $this->isUsed($longIP);
    }
626070
private function inRange($ip, $cidr, $range)
    {
        $ipVersion = $this->getIpVersion($ip);
        $binIp = $this->ip2bin($ip);

        $parts = explode('/', $range);
        $net = array_shift($parts);
        $range_cidr = array_shift($parts);


        $netVersion = $this->getIpVersion($net);
        if ($ipVersion !== $netVersion) {
            return false;
        }
        if ($range_cidr === null) {
            $range_cidr = $netVersion === 4 ? static::IPV4_ADDRESS_LENGTH : static::IPV6_ADDRESS_LENGTH;
        }

        $binNet = $this->ip2bin($net);
        if (substr($binIp, 0, $range_cidr) === substr($binNet, 0, $range_cidr) && $cidr >= $range_cidr) {
            return true;
        }
        return false;
    }
4934
public function isIPAddressInSubnet($ip_address_string)
    {
        $ip_address = ip2long($ip_address_string);
        list($start_ip, $end_ip) = $this->getIPAddressRangeAsInts();

        return $ip_address >= $start_ip && $ip_address <= $end_ip
            ? true
            : false;
    }
585039
public function isIpAddress($flags = 0)
    {
        $this->isString();

        return $this->doCheck(function ($value) use ($flags) {
            $this->throwExceptionIfFalse(
                filter_var($value, FILTER_VALIDATE_IP, $flags),
                '"%s" is not a valid IP address.', $value
            );
        });
    }
152299
public function getAddressInfo($ipAddress)
    {
        // This test is a trick to determine if we have a valid IPv4 address, the
        // only kind we can handle at the moment.
        $long = ip2long($ipAddress);
        if ($long == -1 || $long === false) {
            return null;
        }
        $result = $this->gateway->get(
            'ipv4address',
            ['ip_address' => $ipAddress, '_max_results' => 1]
        );
        return (isset($result[0])) ? $result[0] : null;
    }
384448
public function isTwoFactorRequired($ipAddress, $hasKey)
    {
        // \MUtil_Echo::track($ipAddress, $hasKey, $this->_get('ggp_2factor_set'), $this->_get('ggp_2factor_not_set'));
        
        if ($hasKey) {
            switch ($this->_get('ggp_2factor_set')) {
                case self::TWO_FACTOR_SET_REQUIRED:
                    return true;

                case self::TWO_FACTOR_SET_OUTSIDE_ONLY:
                    // Required when not in range
                    return ! $this->util->isAllowedIP($ipAddress, $this->_get('ggp_no_2factor_ip_ranges'));
            }
        } else {
            switch ($this->_get('ggp_2factor_not_set')) {
                case self::NO_TWO_FACTOR_INSIDE_ONLY:
                    // Required even when not set when not in range
                    return ! $this->util->isAllowedIP($ipAddress, $this->_get('ggp_no_2factor_ip_ranges'));
            }
        }

        return false;
    }
190552
private function isAddressValid(string $address): bool
    {
        $position = \strrpos($address, ':');
        if ($position === false) {
            return ($address[0] ?? '') === "\0"; // udg socket address.
        }

        $ip = \trim(\substr($address, 0, $position), '[]');
        $port = (int) \substr($address, $position + 1);

        return \inet_pton($ip) !== false && $port > 0 && $port < 65536;
    }