mirror of
https://github.com/cwinfo/yggdrasil-go.git
synced 2024-11-26 21:11:36 +00:00
commit
898f7865b1
@ -388,16 +388,30 @@ func main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
case "getroutes":
|
case "getroutes":
|
||||||
if _, ok := res["routes"]; !ok {
|
if routes, ok := res["routes"].(map[string]interface{}); !ok {
|
||||||
fmt.Println("No routes found")
|
|
||||||
} else if res["routes"] == nil {
|
|
||||||
fmt.Println("No routes found")
|
fmt.Println("No routes found")
|
||||||
} else {
|
} else {
|
||||||
fmt.Println("Routes:")
|
if res["routes"] == nil || len(routes) == 0 {
|
||||||
for _, v := range res["routes"].([]interface{}) {
|
fmt.Println("No routes found")
|
||||||
fmt.Println("-", v)
|
} else {
|
||||||
|
fmt.Println("Routes:")
|
||||||
|
for k, v := range routes {
|
||||||
|
if pv, ok := v.(string); ok {
|
||||||
|
fmt.Println("-", k, " via ", pv)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
case "settunnelrouting":
|
||||||
|
fallthrough
|
||||||
|
case "gettunnelrouting":
|
||||||
|
if enabled, ok := res["enabled"].(bool); !ok {
|
||||||
|
fmt.Println("Tunnel routing is disabled")
|
||||||
|
} else if !enabled {
|
||||||
|
fmt.Println("Tunnel routing is disabled")
|
||||||
|
} else {
|
||||||
|
fmt.Println("Tunnel routing is enabled")
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
if json, err := json.MarshalIndent(recv["response"], "", " "); err == nil {
|
if json, err := json.MarshalIndent(recv["response"], "", " "); err == nil {
|
||||||
fmt.Println(string(json))
|
fmt.Println(string(json))
|
||||||
|
Loading…
Reference in New Issue
Block a user