mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-10-28 09:46:28 +08:00
feat: Optimize the manual certificate application process (#8755)
Refs https://github.com/1Panel-dev/1Panel/issues/7885
This commit is contained in:
parent
c2101824ed
commit
6d8d6f05f1
1 changed files with 28 additions and 5 deletions
|
|
@ -131,6 +131,7 @@ var (
|
||||||
pollingInterval = 10 * time.Second
|
pollingInterval = 10 * time.Second
|
||||||
ttl = 3600
|
ttl = 3600
|
||||||
dnsTimeOut = 30 * time.Minute
|
dnsTimeOut = 30 * time.Minute
|
||||||
|
manualDnsTimeout = 10 * time.Minute
|
||||||
)
|
)
|
||||||
|
|
||||||
func getDNSProviderConfig(dnsType DnsType, params string) (challenge.Provider, error) {
|
func getDNSProviderConfig(dnsType DnsType, params string) (challenge.Provider, error) {
|
||||||
|
|
@ -311,7 +312,11 @@ func (c *AcmeClient) UseDns(dnsType DnsType, params string, websiteSSL model.Web
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *AcmeClient) UseManualDns(websiteSSL model.WebsiteSSL) error {
|
func (c *AcmeClient) UseManualDns(websiteSSL model.WebsiteSSL) error {
|
||||||
p, err := dns01.NewDNSProviderManual()
|
p, err := NewCustomDNSProviderManual(&ManualConfig{
|
||||||
|
PropagationTimeout: propagationTimeout,
|
||||||
|
PollingInterval: pollingInterval,
|
||||||
|
TTL: ttl,
|
||||||
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
@ -376,18 +381,36 @@ type Resolve struct {
|
||||||
Err string
|
Err string
|
||||||
}
|
}
|
||||||
|
|
||||||
type manualDnsProvider struct {
|
type ManualConfig struct {
|
||||||
Resolve *Resolve
|
TTL int
|
||||||
|
PropagationTimeout time.Duration
|
||||||
|
PollingInterval time.Duration
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *manualDnsProvider) Present(domain, token, keyAuth string) error {
|
type CustomManualDnsProvider struct {
|
||||||
|
config *ManualConfig
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewCustomDNSProviderManual(config *ManualConfig) (*CustomManualDnsProvider, error) {
|
||||||
|
return &CustomManualDnsProvider{config}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *CustomManualDnsProvider) Present(domain, token, keyAuth string) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *manualDnsProvider) CleanUp(domain, token, keyAuth string) error {
|
func (p *CustomManualDnsProvider) CleanUp(domain, token, keyAuth string) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (p *CustomManualDnsProvider) Sequential() time.Duration {
|
||||||
|
return manualDnsTimeout
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *CustomManualDnsProvider) Timeout() (timeout, interval time.Duration) {
|
||||||
|
return p.config.PropagationTimeout, p.config.PollingInterval
|
||||||
|
}
|
||||||
|
|
||||||
func (c *AcmeClient) GetDNSResolve(domains []string) (map[string]Resolve, error) {
|
func (c *AcmeClient) GetDNSResolve(domains []string) (map[string]Resolve, error) {
|
||||||
core, err := api.New(c.Config.HTTPClient, c.Config.UserAgent, c.Config.CADirURL, c.User.Registration.URI, c.User.Key)
|
core, err := api.New(c.Config.HTTPClient, c.Config.UserAgent, c.Config.CADirURL, c.User.Registration.URI, c.User.Key)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue