mirror of
				https://github.com/1Panel-dev/1Panel.git
				synced 2025-10-28 01:36:56 +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 | ||||
| 	ttl                = 3600 | ||||
| 	dnsTimeOut         = 30 * time.Minute | ||||
| 	manualDnsTimeout   = 10 * time.Minute | ||||
| ) | ||||
| 
 | ||||
| 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 { | ||||
| 	p, err := dns01.NewDNSProviderManual() | ||||
| 	p, err := NewCustomDNSProviderManual(&ManualConfig{ | ||||
| 		PropagationTimeout: propagationTimeout, | ||||
| 		PollingInterval:    pollingInterval, | ||||
| 		TTL:                ttl, | ||||
| 	}) | ||||
| 	if err != nil { | ||||
| 		return err | ||||
| 	} | ||||
|  | @ -376,18 +381,36 @@ type Resolve struct { | |||
| 	Err   string | ||||
| } | ||||
| 
 | ||||
| type manualDnsProvider struct { | ||||
| 	Resolve *Resolve | ||||
| type ManualConfig struct { | ||||
| 	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 | ||||
| } | ||||
| 
 | ||||
| func (p *manualDnsProvider) CleanUp(domain, token, keyAuth string) error { | ||||
| func (p *CustomManualDnsProvider) CleanUp(domain, token, keyAuth string) error { | ||||
| 	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) { | ||||
| 	core, err := api.New(c.Config.HTTPClient, c.Config.UserAgent, c.Config.CADirURL, c.User.Registration.URI, c.User.Key) | ||||
| 	if err != nil { | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue