mirror of
https://github.com/cwinfo/yggdrasil-go.git
synced 2024-11-22 15:20:30 +00: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))
|
result, err := a.admin_dhtPing(in["key"].(string), in["coords"].(string), in["target"].(string))
|
||||||
if err == nil {
|
if err == nil {
|
||||||
var infos []map[string]string
|
infos := make([]map[string]string, 0, len(result.Infos))
|
||||||
for _, dinfo := range result.Infos {
|
for _, dinfo := range result.Infos {
|
||||||
info := make(map[string]string)
|
info := map[string]string{
|
||||||
info["key"] = hex.EncodeToString(dinfo.key[:])
|
"key": hex.EncodeToString(dinfo.key[:]),
|
||||||
info["coords"] = fmt.Sprintf("%v", dinfo.coords)
|
"coords": fmt.Sprintf("%v", dinfo.coords),
|
||||||
|
}
|
||||||
infos = append(infos, info)
|
infos = append(infos, info)
|
||||||
}
|
}
|
||||||
return admin_info{"nodes": infos}, nil
|
return admin_info{"nodes": infos}, nil
|
||||||
|
Loading…
Reference in New Issue
Block a user