From f6ea6fcc850272ad164c3887837e9c524c7022f9 Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Mon, 21 May 2018 18:12:36 +0100 Subject: [PATCH] Add addAllowedBoxPub, removeAllowedBoxPub, getAllowedBoxPubs --- yggdrasilctl.go | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/yggdrasilctl.go b/yggdrasilctl.go index 693fd1f..2fbebf7 100644 --- a/yggdrasilctl.go +++ b/yggdrasilctl.go @@ -155,25 +155,36 @@ func main() { fmt.Println("TAP mode:", tap_mode) } } - case "addPeer", "removePeer": + case "addPeer", "removePeer", "addAllowedBoxPub", "removeAllowedBoxPub": if _, ok := res["added"]; ok { for _, v := range res["added"].([]interface{}) { - fmt.Println("Peer added:", fmt.Sprint(v)) + fmt.Println("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)) + fmt.Println("Not added:", fmt.Sprint(v)) } } if _, ok := res["removed"]; ok { for _, v := range res["removed"].([]interface{}) { - fmt.Println("Peer removed:", fmt.Sprint(v)) + fmt.Println("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)) + fmt.Println("Not removed:", fmt.Sprint(v)) + } + } + case "getAllowedBoxPubs": + if _, ok := res["allowed_box_pubs"]; !ok { + fmt.Println("All connections are allowed") + } else if res["allowed_box_pubs"] == nil { + fmt.Println("All connections are allowed") + } else { + fmt.Println("Connections are allowed only from the following public box keys:") + for _, v := range res["allowed_box_pubs"].([]interface{}) { + fmt.Println("-", v) } } default: