v1.5.1 增强程序稳定性
This commit is contained in:
@@ -198,6 +198,21 @@ func (this *DeployManager) FindHTTPDNSNodeFile(os string, arch string) *DeployFi
|
||||
return nil
|
||||
}
|
||||
|
||||
// LatestNodeVersion 获取部署目录中边缘节点的最新版本号
|
||||
func (this *DeployManager) LatestNodeVersion() string {
|
||||
return latestVersion(this.LoadNodeFiles())
|
||||
}
|
||||
|
||||
// LatestNSNodeVersion 获取部署目录中DNS节点的最新版本号
|
||||
func (this *DeployManager) LatestNSNodeVersion() string {
|
||||
return latestVersion(this.LoadNSNodeFiles())
|
||||
}
|
||||
|
||||
// LatestHTTPDNSNodeVersion 获取部署目录中HTTPDNS节点的最新版本号
|
||||
func (this *DeployManager) LatestHTTPDNSNodeVersion() string {
|
||||
return latestVersion(this.LoadHTTPDNSNodeFiles())
|
||||
}
|
||||
|
||||
// Reload 重置缓存
|
||||
func (this *DeployManager) Reload() {
|
||||
this.locker.Lock()
|
||||
@@ -207,3 +222,13 @@ func (this *DeployManager) Reload() {
|
||||
this.nsNodeFiles = nil
|
||||
this.httpdnsNodeFiles = nil
|
||||
}
|
||||
|
||||
func latestVersion(files []*DeployFile) string {
|
||||
var latest string
|
||||
for _, f := range files {
|
||||
if len(latest) == 0 || stringutil.VersionCompare(f.Version, latest) > 0 {
|
||||
latest = f.Version
|
||||
}
|
||||
}
|
||||
return latest
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user