refactor: normalize providers constructors

This commit is contained in:
Fu Diwei
2025-02-18 19:18:28 +08:00
parent 1bac6174ad
commit ff53866e9e
132 changed files with 1014 additions and 1160 deletions

View File

@@ -8,7 +8,7 @@ import (
"github.com/go-acme/lego/v4/providers/dns/httpreq"
)
type ACMEHttpReqApplicantConfig struct {
type ChallengeProviderConfig struct {
Endpoint string `json:"endpoint"`
Mode string `json:"mode"`
Username string `json:"username"`
@@ -16,7 +16,7 @@ type ACMEHttpReqApplicantConfig struct {
DnsPropagationTimeout int32 `json:"dnsPropagationTimeout,omitempty"`
}
func NewChallengeProvider(config *ACMEHttpReqApplicantConfig) (challenge.Provider, error) {
func NewChallengeProvider(config *ChallengeProviderConfig) (challenge.Provider, error) {
if config == nil {
panic("config is nil")
}

View File

@@ -7,14 +7,14 @@ import (
"github.com/go-acme/lego/v4/providers/dns/alidns"
)
type AliyunApplicantConfig struct {
type ChallengeProviderConfig struct {
AccessKeyId string `json:"accessKeyId"`
AccessKeySecret string `json:"accessKeySecret"`
DnsPropagationTimeout int32 `json:"dnsPropagationTimeout,omitempty"`
DnsTTL int32 `json:"dnsTTL,omitempty"`
}
func NewChallengeProvider(config *AliyunApplicantConfig) (challenge.Provider, error) {
func NewChallengeProvider(config *ChallengeProviderConfig) (challenge.Provider, error) {
if config == nil {
panic("config is nil")
}

View File

@@ -7,7 +7,7 @@ import (
"github.com/go-acme/lego/v4/providers/dns/route53"
)
type AWSRoute53ApplicantConfig struct {
type ChallengeProviderConfig struct {
AccessKeyId string `json:"accessKeyId"`
SecretAccessKey string `json:"secretAccessKey"`
Region string `json:"region"`
@@ -16,7 +16,7 @@ type AWSRoute53ApplicantConfig struct {
DnsTTL int32 `json:"dnsTTL,omitempty"`
}
func NewChallengeProvider(config *AWSRoute53ApplicantConfig) (challenge.Provider, error) {
func NewChallengeProvider(config *ChallengeProviderConfig) (challenge.Provider, error) {
if config == nil {
panic("config is nil")
}

View File

@@ -10,7 +10,7 @@ import (
"github.com/go-acme/lego/v4/providers/dns/azuredns"
)
type AzureDNSApplicantConfig struct {
type ChallengeProviderConfig struct {
TenantId string `json:"tenantId"`
ClientId string `json:"clientId"`
ClientSecret string `json:"clientSecret"`
@@ -19,7 +19,7 @@ type AzureDNSApplicantConfig struct {
DnsTTL int32 `json:"dnsTTL,omitempty"`
}
func NewChallengeProvider(config *AzureDNSApplicantConfig) (challenge.Provider, error) {
func NewChallengeProvider(config *ChallengeProviderConfig) (challenge.Provider, error) {
if config == nil {
panic("config is nil")
}

View File

@@ -8,14 +8,14 @@ import (
internal "github.com/usual2970/certimate/internal/pkg/core/applicant/acme-dns-01/lego-providers/baiducloud/internal"
)
type BaiduCloudApplicantConfig struct {
type ChallengeProviderConfig struct {
AccessKeyId string `json:"accessKeyId"`
SecretAccessKey string `json:"secretAccessKey"`
DnsPropagationTimeout int32 `json:"dnsPropagationTimeout,omitempty"`
DnsTTL int32 `json:"dnsTTL,omitempty"`
}
func NewChallengeProvider(config *BaiduCloudApplicantConfig) (challenge.Provider, error) {
func NewChallengeProvider(config *ChallengeProviderConfig) (challenge.Provider, error) {
if config == nil {
panic("config is nil")
}

View File

@@ -7,13 +7,13 @@ import (
"github.com/go-acme/lego/v4/providers/dns/cloudflare"
)
type CloudflareApplicantConfig struct {
type ChallengeProviderConfig struct {
DnsApiToken string `json:"dnsApiToken"`
DnsPropagationTimeout int32 `json:"dnsPropagationTimeout,omitempty"`
DnsTTL int32 `json:"dnsTTL,omitempty"`
}
func NewChallengeProvider(config *CloudflareApplicantConfig) (challenge.Provider, error) {
func NewChallengeProvider(config *ChallengeProviderConfig) (challenge.Provider, error) {
if config == nil {
panic("config is nil")
}

View File

@@ -7,14 +7,14 @@ import (
"github.com/go-acme/lego/v4/providers/dns/cloudns"
)
type ClouDNSApplicantConfig struct {
type ChallengeProviderConfig struct {
AuthId string `json:"authId"`
AuthPassword string `json:"authPassword"`
DnsPropagationTimeout int32 `json:"dnsPropagationTimeout,omitempty"`
DnsTTL int32 `json:"dnsTTL,omitempty"`
}
func NewChallengeProvider(config *ClouDNSApplicantConfig) (challenge.Provider, error) {
func NewChallengeProvider(config *ChallengeProviderConfig) (challenge.Provider, error) {
if config == nil {
panic("config is nil")
}

View File

@@ -7,13 +7,13 @@ import (
"github.com/go-acme/lego/v4/providers/dns/gcore"
)
type GcoreApplicantConfig struct {
type ChallengeProviderConfig struct {
ApiToken string `json:"apiToken"`
DnsPropagationTimeout int32 `json:"dnsPropagationTimeout,omitempty"`
DnsTTL int32 `json:"dnsTTL,omitempty"`
}
func NewChallengeProvider(config *GcoreApplicantConfig) (challenge.Provider, error) {
func NewChallengeProvider(config *ChallengeProviderConfig) (challenge.Provider, error) {
if config == nil {
panic("config is nil")
}

View File

@@ -8,14 +8,14 @@ import (
internal "github.com/usual2970/certimate/internal/pkg/core/applicant/acme-dns-01/lego-providers/gname/internal"
)
type GnameApplicantConfig struct {
type ChallengeProviderConfig struct {
AppId string `json:"appId"`
AppKey string `json:"appKey"`
DnsPropagationTimeout int32 `json:"dnsPropagationTimeout,omitempty"`
DnsTTL int32 `json:"dnsTTL,omitempty"`
}
func NewChallengeProvider(config *GnameApplicantConfig) (challenge.Provider, error) {
func NewChallengeProvider(config *ChallengeProviderConfig) (challenge.Provider, error) {
if config == nil {
panic("config is nil")
}

View File

@@ -7,14 +7,14 @@ import (
"github.com/go-acme/lego/v4/providers/dns/godaddy"
)
type GoDaddyApplicantConfig struct {
type ChallengeProviderConfig struct {
ApiKey string `json:"apiKey"`
ApiSecret string `json:"apiSecret"`
DnsPropagationTimeout int32 `json:"dnsPropagationTimeout,omitempty"`
DnsTTL int32 `json:"dnsTTL,omitempty"`
}
func NewChallengeProvider(config *GoDaddyApplicantConfig) (challenge.Provider, error) {
func NewChallengeProvider(config *ChallengeProviderConfig) (challenge.Provider, error) {
if config == nil {
panic("config is nil")
}

View File

@@ -7,7 +7,7 @@ import (
hwc "github.com/go-acme/lego/v4/providers/dns/huaweicloud"
)
type HuaweiCloudApplicantConfig struct {
type ChallengeProviderConfig struct {
AccessKeyId string `json:"accessKeyId"`
SecretAccessKey string `json:"secretAccessKey"`
Region string `json:"region"`
@@ -15,7 +15,7 @@ type HuaweiCloudApplicantConfig struct {
DnsTTL int32 `json:"dnsTTL,omitempty"`
}
func NewChallengeProvider(config *HuaweiCloudApplicantConfig) (challenge.Provider, error) {
func NewChallengeProvider(config *ChallengeProviderConfig) (challenge.Provider, error) {
if config == nil {
panic("config is nil")
}

View File

@@ -7,14 +7,14 @@ import (
"github.com/go-acme/lego/v4/providers/dns/namedotcom"
)
type NameDotComApplicantConfig struct {
type ChallengeProviderConfig struct {
Username string `json:"username"`
ApiToken string `json:"apiToken"`
DnsPropagationTimeout int32 `json:"dnsPropagationTimeout,omitempty"`
DnsTTL int32 `json:"dnsTTL,omitempty"`
}
func NewChallengeProvider(config *NameDotComApplicantConfig) (challenge.Provider, error) {
func NewChallengeProvider(config *ChallengeProviderConfig) (challenge.Provider, error) {
if config == nil {
panic("config is nil")
}

View File

@@ -7,13 +7,13 @@ import (
"github.com/go-acme/lego/v4/providers/dns/namesilo"
)
type NameSiloApplicantConfig struct {
type ChallengeProviderConfig struct {
ApiKey string `json:"apiKey"`
DnsPropagationTimeout int32 `json:"dnsPropagationTimeout,omitempty"`
DnsTTL int32 `json:"dnsTTL,omitempty"`
}
func NewChallengeProvider(config *NameSiloApplicantConfig) (challenge.Provider, error) {
func NewChallengeProvider(config *ChallengeProviderConfig) (challenge.Provider, error) {
if config == nil {
panic("config is nil")
}

View File

@@ -7,13 +7,13 @@ import (
"github.com/go-acme/lego/v4/providers/dns/ns1"
)
type NS1ApplicantConfig struct {
type ChallengeProviderConfig struct {
ApiKey string `json:"apiKey"`
DnsPropagationTimeout int32 `json:"dnsPropagationTimeout,omitempty"`
DnsTTL int32 `json:"dnsTTL,omitempty"`
}
func NewChallengeProvider(config *NS1ApplicantConfig) (challenge.Provider, error) {
func NewChallengeProvider(config *ChallengeProviderConfig) (challenge.Provider, error) {
if config == nil {
panic("config is nil")
}

View File

@@ -8,14 +8,14 @@ import (
"github.com/go-acme/lego/v4/providers/dns/pdns"
)
type PowerDNSApplicantConfig struct {
type ChallengeProviderConfig struct {
ApiUrl string `json:"apiUrl"`
ApiKey string `json:"apiKey"`
DnsPropagationTimeout int32 `json:"dnsPropagationTimeout,omitempty"`
DnsTTL int32 `json:"dnsTTL,omitempty"`
}
func NewChallengeProvider(config *PowerDNSApplicantConfig) (challenge.Provider, error) {
func NewChallengeProvider(config *ChallengeProviderConfig) (challenge.Provider, error) {
if config == nil {
panic("config is nil")
}

View File

@@ -7,13 +7,13 @@ import (
"github.com/go-acme/lego/v4/providers/dns/rainyun"
)
type RainYunApplicantConfig struct {
type ChallengeProviderConfig struct {
ApiKey string `json:"apiKey"`
DnsPropagationTimeout int32 `json:"dnsPropagationTimeout,omitempty"`
DnsTTL int32 `json:"dnsTTL,omitempty"`
}
func NewChallengeProvider(config *RainYunApplicantConfig) (challenge.Provider, error) {
func NewChallengeProvider(config *ChallengeProviderConfig) (challenge.Provider, error) {
if config == nil {
panic("config is nil")
}

View File

@@ -7,14 +7,14 @@ import (
"github.com/go-acme/lego/v4/providers/dns/tencentcloud"
)
type TencentCloudApplicantConfig struct {
type ChallengeProviderConfig struct {
SecretId string `json:"secretId"`
SecretKey string `json:"secretKey"`
DnsPropagationTimeout int32 `json:"dnsPropagationTimeout,omitempty"`
DnsTTL int32 `json:"dnsTTL,omitempty"`
}
func NewChallengeProvider(config *TencentCloudApplicantConfig) (challenge.Provider, error) {
func NewChallengeProvider(config *ChallengeProviderConfig) (challenge.Provider, error) {
if config == nil {
panic("config is nil")
}

View File

@@ -7,14 +7,14 @@ import (
"github.com/go-acme/lego/v4/providers/dns/volcengine"
)
type VolcEngineApplicantConfig struct {
type ChallengeProviderConfig struct {
AccessKeyId string `json:"accessKeyId"`
SecretAccessKey string `json:"secretAccessKey"`
DnsPropagationTimeout int32 `json:"dnsPropagationTimeout,omitempty"`
DnsTTL int32 `json:"dnsTTL,omitempty"`
}
func NewChallengeProvider(config *VolcEngineApplicantConfig) (challenge.Provider, error) {
func NewChallengeProvider(config *ChallengeProviderConfig) (challenge.Provider, error) {
if config == nil {
panic("config is nil")
}

View File

@@ -7,14 +7,14 @@ import (
"github.com/go-acme/lego/v4/providers/dns/westcn"
)
type WestcnApplicantConfig struct {
type ChallengeProviderConfig struct {
Username string `json:"username"`
ApiPassword string `json:"apiPassword"`
DnsPropagationTimeout int32 `json:"dnsPropagationTimeout,omitempty"`
DnsTTL int32 `json:"dnsTTL,omitempty"`
}
func NewChallengeProvider(config *WestcnApplicantConfig) (challenge.Provider, error) {
func NewChallengeProvider(config *ChallengeProviderConfig) (challenge.Provider, error) {
if config == nil {
panic("config is nil")
}