重构项目
This commit is contained in:
		
							
								
								
									
										22
									
								
								internal/Func/UpdateCheck.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								internal/Func/UpdateCheck.go
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,22 @@ | ||||
| package Func | ||||
|  | ||||
| import ( | ||||
| 	"SafelineAPI/internal/app/SafelineRequest" | ||||
| 	"SafelineAPI/internal/app/logger" | ||||
| 	"SafelineAPI/internal/class/config" | ||||
| 	"SafelineAPI/internal/moudle" | ||||
| 	"SafelineAPI/pkg/utils" | ||||
| 	"log" | ||||
| ) | ||||
|  | ||||
| func UpdateCertCheck(conf config.Config) ([]SafelineRequest.Nodes, bool) { | ||||
| 	certNodes := utils.GetList(conf.Server.Host.Url(), conf.Server.ApiToken.String()) | ||||
| 	certUpsert := moudle.CheckNodes(certNodes, conf.Days) | ||||
| 	if len(certUpsert) != 0 { | ||||
| 		log.Printf("本次需要更新证书数量有 %s%d%s 个,现在开始更新...", logger.Yellow, len(certUpsert), logger.Reset) | ||||
| 	} else { | ||||
| 		log.Print("本次无需更新证书,即将退出本程序。") | ||||
| 		return nil, true | ||||
| 	} | ||||
| 	return certUpsert, false | ||||
| } | ||||
		Reference in New Issue
	
	Block a user