src/Config/Adapter/Apollo.php
protected function getClient($namespace) {
		$path = sprintf('%s/configs/%s/%s/%s?releaseKey=%s',
			$this->conf['path'],
			$this->conf['appid'],
			$this->conf['cluster'],
			$this->conf['namespace'],
			$this->last_key);
		if ($this->conf['with_ip']) {
			$cidr = Container::getInstance()->get(CIDRmatch::class);
			foreach (swoole_get_local_ip() as $v) {
				if ($cidr->match($v, $this->conf['with_ip'])) {
					$path .= '&ip=' . $v;
					break;
				}
			}
		}
		$cli = new Client($this->conf['host'], $this->conf['port']);
		$cli->set([
			'timeout' => 1
		]);
		$cli->setDefer();
		$cli->get($path);
		return $cli;
	}
protected function getClient($namespace) {
		$path = sprintf('%s/configs/%s/%s/%s?releaseKey=%s',
			$this->conf['path'],
			$this->conf['appid'],
			$this->conf['cluster'],
			$this->conf['namespace'],
			$this->last_key);
		if ($this->conf['with_ip']) {
			$cidr = Container::getInstance()->get(CIDRmatch::class);
			foreach (swoole_get_local_ip() as $v) {
				if ($cidr->match($v, $this->conf['with_ip'])) {
					$path .= '&ip=' . $v;
					break;
				}
			}
		}
		$cli = new Client($this->conf['host'], $this->conf['port']);
		$cli->set([
			'timeout' => 1
		]);
		$cli->setDefer();
		$cli->get($path);
		return $cli;
	}
protected function getClient ( $ namespace ) { $ path = sprintf ( '%s/configs/%s/%s/%s?releaseKey=%s' , $ this -> conf [ 'path' ] , $ this -> conf [ 'appid' ] , $ this -> conf [ 'cluster' ] , $ this -> conf [ 'namespace' ] , $ this -> last_key ) ; if ( $ this -> conf [ 'with_ip' ] ) { $ cidr = Container :: getInstance ( ) -> get ( CIDRmatch :: class ) ; foreach ( swoole_get_local_ip ( ) as $ v ) { if ( $ cidr -> match ( $ v , $ this -> conf [ 'with_ip' ] ) ) { $ path .= '&ip=' . $ v ; break ; } } } $ cli = new Client ( $ this -> conf [ 'host' ] , $ this -> conf [ 'port' ] ) ; $ cli -> set ( [ 'timeout' => 1 ] ) ; $ cli -> setDefer ( ) ; $ cli -> get ( $ path ) ; return $ cli ; }
Get HTTP Client

@access protected
@param string $namespace
@return object
Get HTTP Client