Check is an IP is valid.

@param ip
@return
@since 0.9.1.1
555871
public static boolean isValidIp(String ip) {
        if (!IP_PATTERN_FULL.matcher(ip).matches()) {
            return false;
        }
        String[] ipArr = ip.split("\\.");
        for (String part : ipArr) {
            int v = Integer.parseInt(part);
            if (v < 0 || v > 255) {
                return false;
            }
        }
        return true;
    }
114068
def validate_ip(self):
        
        if self.request.app.get('_check_ip', False):
            ip_address, accept = self.check_ip()
            if not accept:
                raise web.HTTPUnauthorized()
803541
def check_ip(ip, log=False):
        """"""
        if log:
            print('Checking ip: {}...'.format(ip))

        request_timeout = 0.1

        try:
            tv_url = 'http://{}:6095/request?action=isalive'.format(ip)
            request = requests.get(tv_url, timeout=request_timeout)
        except requests.exceptions.ConnectTimeout:
            return False

        return request.status_code == 200
116808
public boolean inRange(InetAddress ip) {
        if (greaterThan(ip, ipHigher))
            return false;
        else if (lessThan(ip, ipLower))
            return false;
        else
            return true;
    }
415040
public static function isPrivateIp(string $ip): bool
    {
        foreach (self::PRIVATE_IPV4_RANGES as $range) {
            if (self::isIpInCidr($ip, $range)) {
                return true;
            }
        }

        return false;
    }
805594
def is_valid_version_ip(param):
    
    if param is None:
        return False

    if param == IP_VERSION.IPv4[0] or param == IP_VERSION.IPv6[0]:
        return True

    return False
234735
public function ipValidateV6($ip)
    {
        $this->debug->info(__FUNCTION__, 'IP: ' . json_encode($ip));
        if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) === FALSE) {
            $this->debug->info(__FUNCTION__, 'Valid is FALSE');

            return FALSE;
        }

        $this->debug->info(__FUNCTION__, 'Valid is TRUE');

        return TRUE;
    }
883257
def is_valid_ipv6 (ip):
    
    # XXX this is not complete: check ipv6 and ipv4 semantics too here
    if not (_ipv6_re.match(ip) or _ipv6_ipv4_re.match(ip) or
            _ipv6_abbr_re.match(ip) or _ipv6_ipv4_abbr_re.match(ip)):
        return False
    return True
1099508
def check_ip(original_ip):
    '''
    
    ''' 
    ip = original_ip.strip()
    parts = ip.split('.')
    if len(parts) != 4:
        return None
    for p in parts:
        try:
            p = int(p)
            if (p < 0) or (p > 255):
                return None
        except:
            return None
    return ip
182051
public Set<Session> findSessionsByIP(final String ip) {
    final Set<Session> ret = new HashSet<>();

    final Map<String, Session> cacheSnapshot = this.cache.asMap();
    for (final Entry<String, Session> entry : cacheSnapshot.entrySet()) {
      if (entry.getValue().getIp().equals(ip)) {
        ret.add(entry.getValue());
      }
    }

    return ret;
  }
389892
def is_valid_ip(ip: str) -> bool:
    
    if not ip or "\x00" in ip:
        # getaddrinfo resolves empty strings to localhost, and truncates
        # on zero bytes.
        return False
    try:
        res = socket.getaddrinfo(
            ip, 0, socket.AF_UNSPEC, socket.SOCK_STREAM, 0, socket.AI_NUMERICHOST
        )
        return bool(res)
    except socket.gaierror as e:
        if e.args[0] == socket.EAI_NONAME:
            return False
        raise
    return True
901833
def is_ip(string):
    
    mo = re.match(r'(\d+)\.(\d+)\.(\d+)\.(\d+)', string)
    if mo is None:
        return False
    for group in mo.groups():
        if int(group) not in list(range(0, 256)):
            return False
    return True
1111327
private static function assertIpIsValid(string $ip)
    {
        if (preg_match(self::REGEX_IP, $ip) === self::PREG_MATCH_SUCCESS) {
            // Ip address is valid
        } else {
            throw new BunqException(self::ERROR_INVALID_IP_ADDRESS, [$ip]);
        }
    }
771648
public static boolean isIPv4(final String ip) {
        if (StringUtils.isBlank(ip)) {
            return false;
        }

        final String regex = "^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$";
        final Pattern pattern = Pattern.compile(regex);
        final Matcher matcher = pattern.matcher(ip);

        return matcher.matches();
    }
1020927
public boolean checkIP(String ipstring)
    {
        Boolean ipconstrain = (Boolean) ips.get(ipstring);
        if (ipconstrain != null)
        {
            return ipconstrain.booleanValue();
        }
        else
        {
            return standard;
        }
    }
585943
private function ip($ip)
    {
        return ((false === ip2long($ip)) || (long2ip(ip2long($ip)) !== $ip)) ? false : true;
    }
338271
public static boolean isValidIp(@NotNull final String ipStr) {
        return ipPattern.matcher(StringUtils.strip(ipStr)).matches();
    }