mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2025-04-28 14:15:06 +03:00
better response format and yggdrasilctl printing
This commit is contained in:
parent
a34ca40594
commit
0ec6207e05
2 changed files with 4 additions and 14 deletions
|
@ -107,7 +107,7 @@ func main() {
|
|||
switch strings.ToLower(req["request"].(string)) {
|
||||
case "dot":
|
||||
fmt.Println(res["dot"])
|
||||
case "help", "getpeers", "getswitchpeers", "getdht", "getsessions":
|
||||
case "help", "getpeers", "getswitchpeers", "getdht", "getsessions", "dhtping":
|
||||
maxWidths := make(map[string]int)
|
||||
var keyOrder []string
|
||||
keysOrdered := false
|
||||
|
@ -296,17 +296,6 @@ func main() {
|
|||
fmt.Println("-", v)
|
||||
}
|
||||
}
|
||||
case "dhtping":
|
||||
if _, ok := res["nodes"]; !ok {
|
||||
fmt.Println("No nodes found")
|
||||
} else if res["nodes"] == nil {
|
||||
fmt.Println("No nodes found")
|
||||
} else {
|
||||
for _, v := range res["nodes"].([]interface{}) {
|
||||
m := v.(map[string]interface{})
|
||||
fmt.Println("-", m["key"], m["coords"])
|
||||
}
|
||||
}
|
||||
default:
|
||||
if json, err := json.MarshalIndent(recv["response"], "", " "); err == nil {
|
||||
fmt.Println(string(json))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue