mirror of
				https://github.com/TeaOSLab/EdgeAPI.git
				synced 2025-11-04 16:00:24 +08:00 
			
		
		
		
	优化代码
This commit is contained in:
		@@ -9,30 +9,11 @@ type Provider struct {
 | 
				
			|||||||
	Code           string `json:"code"`
 | 
						Code           string `json:"code"`
 | 
				
			||||||
	Description    string `json:"description"`
 | 
						Description    string `json:"description"`
 | 
				
			||||||
	APIURL         string `json:"apiURL"`
 | 
						APIURL         string `json:"apiURL"`
 | 
				
			||||||
 | 
						TestAPIURL     string `json:"testAPIURL"`
 | 
				
			||||||
	RequireEAB     bool   `json:"requireEAB"`
 | 
						RequireEAB     bool   `json:"requireEAB"`
 | 
				
			||||||
	EABDescription string `json:"eabDescription"`
 | 
						EABDescription string `json:"eabDescription"`
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func FindAllProviders() []*Provider {
 | 
					 | 
				
			||||||
	return []*Provider{
 | 
					 | 
				
			||||||
		{
 | 
					 | 
				
			||||||
			Name:        "Let's Encrypt",
 | 
					 | 
				
			||||||
			Code:        DefaultProviderCode,
 | 
					 | 
				
			||||||
			Description: "非盈利组织Let's Encrypt提供的免费证书。",
 | 
					 | 
				
			||||||
			APIURL:      "https://acme-v02.api.letsencrypt.org/directory",
 | 
					 | 
				
			||||||
			RequireEAB:  false,
 | 
					 | 
				
			||||||
		},
 | 
					 | 
				
			||||||
		{
 | 
					 | 
				
			||||||
			Name:           "ZeroSSL",
 | 
					 | 
				
			||||||
			Code:           "zerossl",
 | 
					 | 
				
			||||||
			Description:    "相关文档 <a href=\"https://zerossl.com/documentation/acme/\" target=\"_blank\">https://zerossl.com/documentation/acme/</a>。",
 | 
					 | 
				
			||||||
			APIURL:         "https://acme.zerossl.com/v2/DV90",
 | 
					 | 
				
			||||||
			RequireEAB:     true,
 | 
					 | 
				
			||||||
			EABDescription: "在官网<a href=\"https://app.zerossl.com/developer\" target=\"_blank\">[Developer]</a>页面底部点击\"Generate\"按钮生成。",
 | 
					 | 
				
			||||||
		},
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
func FindProviderWithCode(code string) *Provider {
 | 
					func FindProviderWithCode(code string) *Provider {
 | 
				
			||||||
	for _, provider := range FindAllProviders() {
 | 
						for _, provider := range FindAllProviders() {
 | 
				
			||||||
		if provider.Code == code {
 | 
							if provider.Code == code {
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										24
									
								
								internal/acme/providers_ext.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								internal/acme/providers_ext.go
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,24 @@
 | 
				
			|||||||
 | 
					// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
 | 
				
			||||||
 | 
					//go:build !plus
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					package acme
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func FindAllProviders() []*Provider {
 | 
				
			||||||
 | 
						return []*Provider{
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								Name:        "Let's Encrypt",
 | 
				
			||||||
 | 
								Code:        DefaultProviderCode,
 | 
				
			||||||
 | 
								Description: "非盈利组织Let's Encrypt提供的免费证书。",
 | 
				
			||||||
 | 
								APIURL:      "https://acme-v02.api.letsencrypt.org/directory",
 | 
				
			||||||
 | 
								RequireEAB:  false,
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								Name:           "ZeroSSL",
 | 
				
			||||||
 | 
								Code:           "zerossl",
 | 
				
			||||||
 | 
								Description:    "相关文档 <a href=\"https://zerossl.com/documentation/acme/\" target=\"_blank\">https://zerossl.com/documentation/acme/</a>。",
 | 
				
			||||||
 | 
								APIURL:         "https://acme.zerossl.com/v2/DV90",
 | 
				
			||||||
 | 
								RequireEAB:     true,
 | 
				
			||||||
 | 
								EABDescription: "在官网<a href=\"https://app.zerossl.com/developer\" target=\"_blank\">[Developer]</a>页面底部点击\"Generate\"按钮生成。",
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
		Reference in New Issue
	
	Block a user