/** * Analyzes user agents claiming to be Baidu Spider. * * @param \FlameCore\Gatekeeper\Visitor $visitor The visitor information * @return int * @throws \FlameCore\Gatekeeper\Exceptions\StopScreeningException */ protected function checkBaiduBot(Visitor $visitor) { if (Utils::isIPv6($visitor->getIP())) { return CheckInterface::RESULT_OKAY; } if (Utils::matchCIDR($visitor->getIP(), ['119.63.192.0/21', '123.125.71.0/24', '180.76.0.0/16', '220.181.0.0/16'])) { throw new StopScreeningException(); } return CheckInterface::RESULT_UNSURE; }
/** * {@inheritdoc} */ public function match($value) { return Utils::matchCIDR($value, $this->list); }