Files
kiri-client/TSwooleClient.php
T

42 lines
928 B
PHP
Raw Permalink Normal View History

2022-01-09 13:54:34 +08:00
<?php
2022-01-10 11:39:56 +08:00
namespace Kiri;
2022-01-09 13:54:34 +08:00
trait TSwooleClient
{
2022-01-11 14:46:08 +08:00
/**
* @return array
*/
2023-07-12 21:38:27 +08:00
private function settings(): array
2022-01-11 14:46:08 +08:00
{
$sslCert = $this->getSslCertFile();
$sslKey = $this->getSslKeyFile();
$sslCa = $this->getCa();
2022-01-11 14:51:50 +08:00
$params = [];
2022-01-11 14:46:08 +08:00
if ($this->getConnectTimeout() > 0) {
$params['timeout'] = $this->getConnectTimeout();
}
2023-10-27 22:23:11 +08:00
[$proxy, $port] = [$this->getProxyHost(), $this->getProxyPort()];
if (!empty($proxy) && $port > 0) {
$params['http_proxy_host'] = $proxy;
$params['http_proxy_port'] = $port;
}
2023-08-18 16:36:05 +08:00
if (empty($sslCert) || empty($sslKey) || empty($sslCa)) {
return $params;
}
$params['ssl_host_name'] = $this->getHost();
$params['ssl_cert_file'] = $this->getSslCertFile();
$params['ssl_key_file'] = $this->getSslKeyFile();
$params['ssl_verify_peer'] = TRUE;
$params['ssl_cafile'] = $sslCa;
2022-01-11 14:46:08 +08:00
return $params;
}
2022-01-09 13:54:34 +08:00
2022-01-10 11:39:56 +08:00
}