fix: 修复ipv6作为证书域名申请证书校验失败的bug

This commit is contained in:
xiaojunnuo
2025-12-15 23:34:47 +08:00
parent e4c21c4d5c
commit e4e16bc6a6
8 changed files with 59 additions and 24 deletions
+1
View File
@@ -26,3 +26,4 @@ dist-ssr
test/user.secret.*
test/**/*.js
src/**/*.spec.ts
test.mjs
+1 -1
View File
@@ -58,7 +58,7 @@ function isIpv6(d: string) {
if (!d) {
return false;
}
const isIPv6Regex = /^([\da-f]{1,4}:){2,7}[\da-f]{1,4}$/i;
const isIPv6Regex = /^([0-9A-Fa-f]{0,4}:){2,7}([0-9A-Fa-f]{1,4}$|((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\.|$)){4})$/gm;
return isIPv6Regex.test(d);
}
+16 -12
View File
@@ -1,14 +1,18 @@
import { random } from "lodash-es";
import { locker } from "./dist/utils/util.lock.js";
// import { random } from "lodash-es";
// import { locker } from "./dist/utils/util.lock.js";
async function testLocker() {
for (let i = 0; i < 10; i++) {
await locker.execute("test", async () => {
console.log("test", i);
await new Promise(resolve => setTimeout(resolve, Math.random() * 1000));
throw new Error("test error");
});
}
}
// async function testLocker() {
// for (let i = 0; i < 10; i++) {
// await locker.execute("test", async () => {
// console.log("test", i);
// await new Promise(resolve => setTimeout(resolve, Math.random() * 1000));
// throw new Error("test error");
// });
// }
// }
await testLocker();
// await testLocker();
import { domainUtils } from "./dist/utils/util.domain.js";
console.log(domainUtils.isIpv6("::0:0:0:FFFF:129.144.52.38"));