From 61c640dbdeb6dfa72d7ff4d7f0e83967d81b00ec Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Mon, 21 May 2018 14:25:11 +0100 Subject: [PATCH] Add addPeer and removePeer --- yggdrasilctl.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/yggdrasilctl.go b/yggdrasilctl.go index a2fd9c3..48ea19b 100644 --- a/yggdrasilctl.go +++ b/yggdrasilctl.go @@ -134,6 +134,27 @@ func main() { fmt.Println("TAP mode:", tap_mode) } } + case "addPeer", "removePeer": + if _, ok := res["added"]; ok { + for _, v := range res["added"].([]interface{}) { + fmt.Println("Peer added:", fmt.Sprint(v)) + } + } + if _, ok := res["not_added"]; ok { + for _, v := range res["not_added"].([]interface{}) { + fmt.Println("Peer not added:", fmt.Sprint(v)) + } + } + if _, ok := res["removed"]; ok { + for _, v := range res["removed"].([]interface{}) { + fmt.Println("Peer removed:", fmt.Sprint(v)) + } + } + if _, ok := res["not_removed"]; ok { + for _, v := range res["not_removed"].([]interface{}) { + fmt.Println("Peer not removed:", fmt.Sprint(v)) + } + } default: if json, err := json.MarshalIndent(recv["response"], "", " "); err == nil { fmt.Println(string(json))