DNS节点可以自动升级

This commit is contained in:
GoEdgeLab
2021-07-22 18:42:57 +08:00
parent 90da95a285
commit 40a3a0f66d
15 changed files with 96 additions and 47 deletions

View File

@@ -65,7 +65,7 @@ func (this *DeployManager) FindNodeFile(os string, arch string) *DeployFile {
return nil
}
// LoadNSNodeFiles 加载所有文件
// LoadNSNodeFiles 加载所有NS节点安装文件
func (this *DeployManager) LoadNSNodeFiles() []*DeployFile {
keyMap := map[string]*DeployFile{} // key => File
@@ -99,3 +99,13 @@ func (this *DeployManager) LoadNSNodeFiles() []*DeployFile {
}
return result
}
// FindNSNodeFile 查找特别平台的NS节点安装文件
func (this *DeployManager) FindNSNodeFile(os string, arch string) *DeployFile {
for _, file := range this.LoadNSNodeFiles() {
if file.OS == os && file.Arch == arch {
return file
}
}
return nil
}

View File

@@ -16,3 +16,9 @@ func TestDeployManager_LoadNSNodeFiles(t *testing.T) {
t.Logf("%#v", file)
}
}
func TestDeployManager_FindNSNodeFile(t *testing.T) {
file := NewDeployManager().FindNSNodeFile("linux", "amd64")
t.Log(file)
}