From b5ec04723db48422f71041f4043002e7f5b450b1 Mon Sep 17 00:00:00 2001 From: xiaojunnuo Date: Mon, 24 Nov 2025 23:33:25 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20ssl.com=E6=94=AF=E6=8C=81ecc?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/core/acme-client/src/index.js | 19 +++++++++++++++++++ packages/core/acme-client/types/index.d.ts | 2 ++ packages/core/basic/src/utils/util.lock.ts | 1 - .../src/plugin/cert-plugin/acme.ts | 2 +- 4 files changed, 22 insertions(+), 2 deletions(-) diff --git a/packages/core/acme-client/src/index.js b/packages/core/acme-client/src/index.js index 561c5195..48b6d922 100644 --- a/packages/core/acme-client/src/index.js +++ b/packages/core/acme-client/src/index.js @@ -31,9 +31,28 @@ export const directory = { sslcom:{ staging: 'https://acme.ssl.com/sslcom-dv-rsa', production: 'https://acme.ssl.com/sslcom-dv-rsa', + ec: 'https://acme.ssl.com/sslcom-dv-ecc', } }; +export function getDirectoryUrl(opts) { + const {sslProvider, pkType} = opts + const list= directory[sslProvider] + if (!list) { + throw new Error(`sslProvider ${sslProvider} not found`) + } + pkType = pkType || 'rsa' + if (pkType) { + pkType = pkType.toLowerCase().split("_")[0] + } + + if (pkType && list[pkType]) { + return list[pkType] + } + + return list.production +} + /** * Crypto */ diff --git a/packages/core/acme-client/types/index.d.ts b/packages/core/acme-client/types/index.d.ts index 90b57a70..f0a55597 100644 --- a/packages/core/acme-client/types/index.d.ts +++ b/packages/core/acme-client/types/index.d.ts @@ -117,6 +117,8 @@ export const directory: { } }; +export function getDirectoryUrl(opts:{sslProvider:string, pkType: string}): string; + /** * Crypto */ diff --git a/packages/core/basic/src/utils/util.lock.ts b/packages/core/basic/src/utils/util.lock.ts index e8ea24ec..b63bf042 100644 --- a/packages/core/basic/src/utils/util.lock.ts +++ b/packages/core/basic/src/utils/util.lock.ts @@ -1,4 +1,3 @@ -import { logger } from "./index.js"; // @ts-ignore import AsyncLock from "async-lock"; diff --git a/packages/plugins/plugin-cert/src/plugin/cert-plugin/acme.ts b/packages/plugins/plugin-cert/src/plugin/cert-plugin/acme.ts index 4d84cde3..dce677c2 100644 --- a/packages/plugins/plugin-cert/src/plugin/cert-plugin/acme.ts +++ b/packages/plugins/plugin-cert/src/plugin/cert-plugin/acme.ts @@ -128,7 +128,7 @@ export class AcmeService { await this.saveAccountConfig(email, conf); this.logger.info(`创建新的Accountkey:${email}`); } - const directoryUrl = acme.directory[this.sslProvider].production; + const directoryUrl = acme.getDirectoryUrl({ sslProvider: this.sslProvider, pkType: this.options.privateKeyType }); if (this.options.useMappingProxy) { urlMapping.enabled = true; } else {