Files
kiri-client/TSwooleClient.php
T
as2252258 336cc875a1 Revert "改名"
This reverts commit fdf58326
2022-01-11 14:46:08 +08:00

42 lines
860 B
PHP

<?php
namespace Kiri;
use JetBrains\PhpStorm\Pure;
trait TSwooleClient
{
/**
* @return array
*/
#[Pure] private function settings(): array
{
$sslCert = $this->getSslCertFile();
$sslKey = $this->getSslKeyFile();
$sslCa = $this->getCa();
$params = [
'open_eof_check' => true,
'package_eof' => "\r\n\r\n",
'package_max_length' => 1024 * 1024 * 2,
];
if ($this->getConnectTimeout() > 0) {
$params['timeout'] = $this->getConnectTimeout();
}
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;
return $params;
}
}