Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 17 additions & 17 deletions backend/utils/ssl/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import (
"github.com/go-acme/lego/v4/lego"
"github.com/go-acme/lego/v4/providers/dns/alidns"
"github.com/go-acme/lego/v4/providers/dns/clouddns"
"github.com/go-acme/lego/v4/providers/dns/cloudns"
"github.com/go-acme/lego/v4/providers/dns/cloudflare"
"github.com/go-acme/lego/v4/providers/dns/cloudns"
"github.com/go-acme/lego/v4/providers/dns/dnspod"
"github.com/go-acme/lego/v4/providers/dns/godaddy"
"github.com/go-acme/lego/v4/providers/dns/huaweicloud"
Expand Down Expand Up @@ -88,21 +88,21 @@ const (
)

type DNSParam struct {
ID string `json:"id"`
Token string `json:"token"`
AccessKey string `json:"accessKey"`
SecretKey string `json:"secretKey"`
Email string `json:"email"`
APIkey string `json:"apiKey"`
APIUser string `json:"apiUser"`
APISecret string `json:"apiSecret"`
SecretID string `json:"secretID"`
Region string `json:"region"`
ClientID string `json:"clientID"`
Password string `json:"password"`
AuthID string `json:"authID"`
SubAuthID string `json:"subAuthID"`
AuthPassword string `json:"authPassword"`
ID string `json:"id"`
Token string `json:"token"`
AccessKey string `json:"accessKey"`
SecretKey string `json:"secretKey"`
Email string `json:"email"`
APIkey string `json:"apiKey"`
APIUser string `json:"apiUser"`
APISecret string `json:"apiSecret"`
SecretID string `json:"secretID"`
Region string `json:"region"`
ClientID string `json:"clientID"`
Password string `json:"password"`
AuthID string `json:"authID"`
SubAuthID string `json:"subAuthID"`
AuthPassword string `json:"authPassword"`
}

var (
Expand Down Expand Up @@ -171,7 +171,7 @@ func (c *AcmeClient) UseDns(dnsType DnsType, params string, websiteSSL model.Web
cloudnsConfig.PropagationTimeout = propagationTimeout
cloudnsConfig.PollingInterval = pollingInterval
cloudnsConfig.TTL = ttl
p, err = clouddns.NewDNSProviderConfig(cloudnsConfig)
p, err = cloudns.NewDNSProviderConfig(cloudnsConfig)
case FreeMyIP:
freeMyIpConfig := freemyip.NewDefaultConfig()
freeMyIpConfig.Token = param.Token
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes you made do not appear to introduce any significant errors or irregularities. However, there are a few minor improvements that could be made for clarity and maintainability:

  1. Consistency: Ensure consistency between struct fields and variable names. For example, all fields related to authentication should use camelCase.

  2. Comment Removal: The comment after the first change set is redundant since it mirrors the preceding line.

  3. Variable Naming: While this patch does not directly affect functionality, renaming variables like APIkey to apiKey can improve readability in some contexts.

Here's an updated version of your code with these considerations:

import (
	"github.com/go-acme/lego/v4/lego"
	"github.com/go-acme/lego/v4/providers/dns/alidns"
	"github.com/go-acme/lego/v4/providers/dns/clouddns"
	"github.com/go-acme/lego/v4/providers/dns/cloudns"
	"github.com/go-acme/lego/v4/providers/dns/cloudflare"
	"github.com/go-acme/lego/v4/providers/dns/dnspod"
	"github.com/go-acme/lego/v4/providers/dns/godaddy"
	"github.com/go-acme/lego/v4/providers/dns/huaweicloud"
)

type DNSParam struct {
	ID        string `json:"id"`
	Token     string `json:"token"`
	AccessKey string `json:"accessKey"`
	SecretKey string `json:"secretKey"`
	Email     string `json:"email"`
	APIkey       string `json:"apikey"` // Updated field name for better readability
	APIUser      string `json:"apiUser"`
	APISecret    string `json:"apiSecret"`
	SecretID     string `json:"secretID"`
	Region       string `json:"region"`
	ClientID     string `json:"clientID"`
	Password     string `json:"password"`
	AuthID       string `json:"authID"`
	SubAuthID     string `json:"subAuthID"`
	AuthPassword string `json:"authPassword"`
}

var (
	defaultProviders map[DnsType]DNSProviderFactory = Providers{
		HuaweiCloud: &HuaWeiCloudDNS{},
		DNSPod:      &DNSPODDNS{},
		GoodDaddy:   &GoodDaddyDNS{},
		AliyunDNS:    &AlibabaCloudDNS{},
		Akamai:       &AkamaiDNS{},
	}
)

func init() {
	initCaching()
	for i := range defaultProviders {
		factory := defaultProviders[i]
		Register(factory.Name(), factory.FactoryFunc())
		log.Printf("[INFO] Register %s provider", i)
	}
}

// AcmeClient defines methods used for creating ACME challenge solvers.
type AcmeClient struct {
	Config Config
}

type Solver interface {
	Network(context.Context) error
}

Expand Down
Loading