standard commit

This commit is contained in:
MDK
2023-08-03 15:25:17 +08:00
parent 38be845348
commit 4fcf28804c
12 changed files with 466 additions and 87 deletions

31
prober/result_handler.go Normal file
View File

@@ -0,0 +1,31 @@
package prober
import "dtool/utils"
func OutputHandler(data interface{}) (string, error) {
var output_str string
var err error
switch value := data.(type) {
case CacheStruct:
result := make(map[string]map[int][]string)
temp := make(map[int][]string)
if len(value.dict) > 0 {
for cache_id := range value.dict {
for rdns := range value.dict[cache_id] {
temp[cache_id] = append(temp[cache_id], rdns)
}
}
}
result[value.target] = temp
output_str, err = utils.ToJSON(result, "")
case RecursiveStruct:
result := make(map[string][]string)
temp := []string{}
for rdns := range value.dict {
temp = append(temp, rdns)
}
result[value.target] = temp
output_str, err = utils.ToJSON(result, "")
}
return output_str, err
}