public function testCIDRList()
 {
     $list = array('172.30.0.0/16', '127.0.0.3/32');
     $cases = array('0.0.0.0' => false, '172.30.0.5' => true, '127.0.0.2' => false, '127.0.0.3' => true);
     $list = PhutilCIDRList::newList($list);
     foreach ($cases as $input => $expect) {
         $this->assertEqual($expect, $list->containsAddress($input), 'PhutilCIDRList->containsAddress(' . $input . ')');
     }
 }
 public static function isClusterAddress($address)
 {
     $cluster_addresses = self::getEnvConfig('cluster.addresses');
     if (!$cluster_addresses) {
         throw new Exception(pht('Phabricator is not configured to serve cluster requests. ' . 'Set `cluster.addresses` in the configuration to whitelist ' . 'cluster hosts before sending requests that use a cluster ' . 'authentication mechanism.'));
     }
     return PhutilCIDRList::newList($cluster_addresses)->containsAddress($address);
 }