mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2025-04-28 14:15:06 +03:00
Add getMulticastInterfaces and getSelf to yggdrasilctl
This commit is contained in:
parent
9b5965fd9a
commit
5d87601118
2 changed files with 32 additions and 1 deletions
|
@ -155,6 +155,16 @@ func main() {
|
|||
fmt.Println("TAP mode:", tap_mode)
|
||||
}
|
||||
}
|
||||
case "getSelf":
|
||||
for k, v := range res["self"].(map[string]interface{}) {
|
||||
fmt.Println("address:", k)
|
||||
if subnet, ok := v.(map[string]interface{})["subnet"].(string); ok {
|
||||
fmt.Println("subnet:", subnet)
|
||||
}
|
||||
if coords, ok := v.(map[string]interface{})["coords"].(string); ok {
|
||||
fmt.Println("coords:", coords)
|
||||
}
|
||||
}
|
||||
case "addPeer", "removePeer", "addAllowedEncryptionPublicKey", "removeAllowedEncryptionPublicKey":
|
||||
if _, ok := res["added"]; ok {
|
||||
for _, v := range res["added"].([]interface{}) {
|
||||
|
@ -187,6 +197,17 @@ func main() {
|
|||
fmt.Println("-", v)
|
||||
}
|
||||
}
|
||||
case "getMulticastInterfaces":
|
||||
if _, ok := res["multicast_interfaces"]; !ok {
|
||||
fmt.Println("No multicast interfaces found")
|
||||
} else if res["multicast_interfaces"] == nil {
|
||||
fmt.Println("No multicast interfaces found")
|
||||
} else {
|
||||
fmt.Println("Multicast peer discovery is active on:")
|
||||
for _, v := range res["multicast_interfaces"].([]interface{}) {
|
||||
fmt.Println("-", v)
|
||||
}
|
||||
}
|
||||
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