mirror of
https://github.com/yggdrasil-network/yggdrasil-go
synced 2024-11-09 23:20:26 +03:00
adjust dhtPing response so 'nodes' defaults to an empty list instead of null
This commit is contained in:
parent
d520a8a1d5
commit
12e635f946
@ -308,11 +308,12 @@ func (a *admin) init(c *Core, listenaddr string) {
|
||||
}
|
||||
result, err := a.admin_dhtPing(in["key"].(string), in["coords"].(string), in["target"].(string))
|
||||
if err == nil {
|
||||
var infos []map[string]string
|
||||
infos := make([]map[string]string, 0, len(result.Infos))
|
||||
for _, dinfo := range result.Infos {
|
||||
info := make(map[string]string)
|
||||
info["key"] = hex.EncodeToString(dinfo.key[:])
|
||||
info["coords"] = fmt.Sprintf("%v", dinfo.coords)
|
||||
info := map[string]string{
|
||||
"key": hex.EncodeToString(dinfo.key[:]),
|
||||
"coords": fmt.Sprintf("%v", dinfo.coords),
|
||||
}
|
||||
infos = append(infos, info)
|
||||
}
|
||||
return admin_info{"nodes": infos}, nil
|
||||
|
Loading…
Reference in New Issue
Block a user