增加Edgeone IP优选,修复EO海外版部署失败
This commit is contained in:
@@ -998,6 +998,24 @@ class DeployHelper
|
||||
'show' => 'product==\'lighthouse\'||product==\'ddos\'',
|
||||
'required' => true,
|
||||
],
|
||||
'site_type' => [
|
||||
'name' => '站点类型',
|
||||
'type' => 'select',
|
||||
'options' => [
|
||||
['value'=>'cn', 'label'=>'国内站'],
|
||||
['value'=>'intl', 'label'=>'国际站'],
|
||||
],
|
||||
'value' => 'cn',
|
||||
'show' => 'product==\'teo\'',
|
||||
'required' => true,
|
||||
],
|
||||
'site_id' => [
|
||||
'name' => '站点ID',
|
||||
'type' => 'input',
|
||||
'placeholder' => '类似于zone-xxxx,在站点列表或概览页面查看',
|
||||
'show' => 'product==\'teo\'',
|
||||
'required' => true,
|
||||
],
|
||||
'domain' => [
|
||||
'name' => '绑定的域名',
|
||||
'type' => 'input',
|
||||
@@ -1866,6 +1884,12 @@ class DeployHelper
|
||||
'show' => 'format==\'pfx\'',
|
||||
'required' => true,
|
||||
],
|
||||
'cmd_pre' => [
|
||||
'name' => '上传前执行命令',
|
||||
'type' => 'textarea',
|
||||
'show' => 'format==\'pem\'||uptype==0',
|
||||
'placeholder' => '可留空,上传前执行脚本命令',
|
||||
],
|
||||
'cmd' => [
|
||||
'name' => '上传完执行命令',
|
||||
'type' => 'textarea',
|
||||
|
||||
@@ -292,6 +292,9 @@ class aliyun implements DeployInterface
|
||||
} catch (Exception $e) {
|
||||
throw new Exception('查询CNAME接入详情失败:' . $e->getMessage());
|
||||
}
|
||||
if (!isset($data['Listen'])) {
|
||||
throw new Exception('没有找到' . $domain . '监听器');
|
||||
}
|
||||
|
||||
if (isset($data['Listen']['CertId'])) {
|
||||
$old_cert_id = $data['Listen']['CertId'];
|
||||
|
||||
@@ -23,6 +23,14 @@ class ssh implements DeployInterface
|
||||
public function deploy($fullchain, $privatekey, $config, &$info)
|
||||
{
|
||||
$connection = $this->connect();
|
||||
if (isset($config['cmd_pre']) && !empty($config['cmd_pre'])) {
|
||||
$cmds = explode("\n", $config['cmd_pre']);
|
||||
foreach ($cmds as $cmd) {
|
||||
$cmd = trim($cmd);
|
||||
if (empty($cmd)) continue;
|
||||
$this->exec($connection, $cmd);
|
||||
}
|
||||
}
|
||||
$sftp = ssh2_sftp($connection);
|
||||
if ($config['format'] == 'pem') {
|
||||
$stream = fopen("ssh2.sftp://$sftp{$config['pem_cert_file']}", 'w');
|
||||
|
||||
@@ -60,6 +60,8 @@ class tencent implements DeployInterface
|
||||
return $this->deploy_clb($cert_id, $config);
|
||||
} elseif ($config['product'] == 'scf') {
|
||||
return $this->deploy_scf($cert_id, $config);
|
||||
} elseif ($config['product'] == 'teo' && isset($config['site_id'])) {
|
||||
return $this->deploy_teo($cert_id, $config);
|
||||
} else {
|
||||
if (empty($config['domain'])) throw new Exception('绑定的域名不能为空');
|
||||
if ($config['product'] == 'waf') {
|
||||
@@ -122,11 +124,17 @@ class tencent implements DeployInterface
|
||||
} else {
|
||||
$instance_ids = [$instance_id];
|
||||
}
|
||||
if ($product == 'cdn') {
|
||||
$instance_ids = array_map(function ($id) {
|
||||
return $id . '|on';
|
||||
}, $instance_ids);
|
||||
}
|
||||
$param = [
|
||||
'CertificateId' => $cert_id,
|
||||
'InstanceIdList' => $instance_ids,
|
||||
'ResourceType' => $product,
|
||||
];
|
||||
if ($product == 'live') $param['Status'] = 1;
|
||||
$data = $this->client->request('DeployCertificateInstance', $param);
|
||||
$this->log(json_encode($data));
|
||||
$this->log(strtoupper($product) . '实例 ' . $instance_id . ' 部署证书成功!');
|
||||
@@ -253,6 +261,26 @@ class tencent implements DeployInterface
|
||||
$this->log('云函数自定义域名 ' . $config['domain'] . ' 部署证书成功!');
|
||||
}
|
||||
|
||||
private function deploy_teo($cert_id, $config)
|
||||
{
|
||||
if (empty($config['site_id'])) throw new Exception('站点ID不能为空');
|
||||
if (empty($config['domain'])) throw new Exception('绑定的域名不能为空');
|
||||
|
||||
$endpoint = isset($config['site_type']) && $config['site_type'] == 'intl' ? 'teo.intl.tencentcloudapi.com' : 'teo.tencentcloudapi.com';
|
||||
$client = new TencentCloud($this->SecretId, $this->SecretKey, $endpoint, 'teo', '2022-09-01', null, $this->proxy);
|
||||
$hosts = explode(',', $config['domain']);
|
||||
$param = [
|
||||
'ZoneId' => $config['site_id'],
|
||||
'Hosts' => $hosts,
|
||||
'Mode' => 'sslcert',
|
||||
'ServerCertInfo' => [[
|
||||
'CertId' => $cert_id
|
||||
]]
|
||||
];
|
||||
$data = $client->request('ModifyHostsCertificate', $param);
|
||||
$this->log('边缘安全加速域名 ' . $config['domain'] . ' 部署证书成功!');
|
||||
}
|
||||
|
||||
public function setLogger($func)
|
||||
{
|
||||
$this->logger = $func;
|
||||
|
||||
@@ -39,9 +39,7 @@ class OptimizeService
|
||||
public function get_ip_address($cdn_type = 1, $ip_type = 'v4')
|
||||
{
|
||||
$api = config_get('optimize_ip_api', 0);
|
||||
if ($api == 2) {
|
||||
$url = 'https://api.345673.xyz/get_data';
|
||||
} elseif ($api == 1) {
|
||||
if ($api == 1) {
|
||||
$url = 'https://api.hostmonit.com/get_optimization_ip';
|
||||
} else {
|
||||
$url = 'https://www.wetest.vip/api/cf2dns/';
|
||||
@@ -51,6 +49,8 @@ class OptimizeService
|
||||
$url .= 'get_cloudfront_ip';
|
||||
} elseif ($cdn_type == 3) {
|
||||
$url .= 'get_gcore_ip';
|
||||
} elseif ($cdn_type == 4) {
|
||||
$url .= 'get_edgeone_ip';
|
||||
}
|
||||
}
|
||||
$params = [
|
||||
|
||||
@@ -129,7 +129,7 @@ new Vue({
|
||||
cdntypeList: {
|
||||
1:'CloudFlare',
|
||||
2:"CloudFront",
|
||||
3:'Gcore'
|
||||
4:'EdgeOne'
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
|
||||
@@ -75,6 +75,8 @@ $(document).ready(function(){
|
||||
return 'CloudFront';
|
||||
}else if(value == 3){
|
||||
return 'Gcore';
|
||||
}else if(value == 4){
|
||||
return 'EdgeOne';
|
||||
}else{
|
||||
return '未知';
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<div class="panel-heading"><h3 class="panel-title">使用说明</h3></div>
|
||||
<div class="panel-body">
|
||||
<p><li>不支持对CloudFlare里的域名添加优选,必须使用其他DNS服务商。需开通Cloudflare for SaaS,且域名使用CNAME的方式解析到CloudFlare。</li></p>
|
||||
<p><li>数据接口:<a href="https://www.wetest.vip/" target="_blank" rel="noreferrer">wetest.vip</a> 数据接口支持CloudFlare、CloudFront、Gcore;<a href="https://stock.hostmonit.com/" target="_blank" rel="noreferrer">HostMonit</a> 只支持CloudFlare。</li></p>
|
||||
<p><li>数据接口:<a href="https://www.wetest.vip/" target="_blank" rel="noreferrer">wetest.vip</a> 数据接口支持CloudFlare、CloudFront、EdgeOne;<a href="https://stock.hostmonit.com/" target="_blank" rel="noreferrer">HostMonit</a> 只支持CloudFlare。</li></p>
|
||||
<p><li>接口密钥:默认o1zrmHAF为免费KEY可永久免费使用。</li></p>
|
||||
<p><li>计划任务:将以下命令添加到计划任务,周期设置为15分钟以上</li></p>
|
||||
<p><code>cd {:app()->getRootPath()} && php think opiptask</code></p>
|
||||
|
||||
Reference in New Issue
Block a user