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)
        );
    }