public static function isIp($ip, $allowIpV4 = true, $allowIpV6 = true) {
        if ($allowIpV6 && $allowIpV4)
            return \filter_var($ip, FILTER_VALIDATE_IP) !== false;
        if (!$allowIpV6 && $allowIpV4)
            return \filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4) !== false;
        if ($allowIpV6 && !$allowIpV4)
            return \filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) !== false;
    }