5
0
mirror of https://github.com/cwinfo/yggdrasil-go.git synced 2024-11-09 17:30:26 +00:00

add yggdrasilctl support for getSourceSubnets and getRoutes

This commit is contained in:
Arceliar 2018-11-22 21:37:57 -06:00
parent 4870a2e149
commit 12cc7fc639

View File

@ -274,6 +274,28 @@ func main() {
fmt.Println("-", v)
}
}
case "getsourcesubnets":
if _, ok := res["source_subnets"]; !ok {
fmt.Println("No source subnets found")
} else if res["source_subnets"] == nil {
fmt.Println("No source subnets found")
} else {
fmt.Println("Source subnets:")
for _, v := range res["source_subnets"].([]interface{}) {
fmt.Println("-", v)
}
}
case "getroutes":
if _, ok := res["routes"]; !ok {
fmt.Println("No routes found")
} else if res["routes"] == nil {
fmt.Println("No routes found")
} else {
fmt.Println("Routes:")
for _, v := range res["routes"].([]interface{}) {
fmt.Println("-", v)
}
}
default:
if json, err := json.MarshalIndent(recv["response"], "", " "); err == nil {
fmt.Println(string(json))