跳过预检查

pull/79/head^2
zhangchenhao 2025-05-13 12:34:03 +08:00
parent bcf63fea79
commit 2b38701211
1 changed files with 21 additions and 11 deletions

View File

@ -120,21 +120,31 @@ func Apply(cfg map[string]any, logger *public.Logger) (map[string]any, error) {
} }
} }
var skipCheck int var skipCheck bool
if cfg["skip_check"] == nil { if cfg["skip_check"] == nil {
skipCheck = 1 skipCheck = true
} else { } else {
switch v := cfg["skip_check"].(type) { switch v := cfg["skip_check"].(type) {
case int: case int:
skipCheck = v if v > 0 {
case float64: skipCheck = true
skipCheck = int(v) } else {
case string: skipCheck = false
skipCheckStr := v
skipCheck, err = strconv.Atoi(skipCheckStr)
if err != nil {
return nil, fmt.Errorf("参数错误skip_check")
} }
case float64:
if v > 0 {
skipCheck = true
} else {
skipCheck = false
}
case string:
if v == "true" || v == "1" {
skipCheck = true
} else {
skipCheck = false
}
case bool:
skipCheck = v
default: default:
return nil, fmt.Errorf("参数错误skip_check") return nil, fmt.Errorf("参数错误skip_check")
} }
@ -269,7 +279,7 @@ func Apply(cfg map[string]any, logger *public.Logger) (map[string]any, error) {
return nil, fmt.Errorf("创建 DNS provider 失败: %v", err) return nil, fmt.Errorf("创建 DNS provider 失败: %v", err)
} }
if skipCheck == 1 { if skipCheck {
// 跳过预检查 // 跳过预检查
err = client.Challenge.SetDNS01Provider(provider, err = client.Challenge.SetDNS01Provider(provider,
dns01.WrapPreCheck(func(domain, fqdn, value string, check dns01.PreCheckFunc) (bool, error) { dns01.WrapPreCheck(func(domain, fqdn, value string, check dns01.PreCheckFunc) (bool, error) {