protected function isIpInRange($targetIp, $rangeIp, $cidrMask)
    {
        $target = sprintf('%032b', ip2long($targetIp));
        $range = sprintf('%032b', ip2long($rangeIp));

        return 0 === substr_compare($target, $range, 0, $cidrMask);
    }