mirror of
https://github.com/cwinfo/yggdrasil-go.git
synced 2024-11-22 21:10:29 +00:00
Add -v for verbose output from yggdrasilctl
This commit is contained in:
parent
315aadae06
commit
498d664f51
@ -18,11 +18,12 @@ type admin_info map[string]interface{}
|
|||||||
func main() {
|
func main() {
|
||||||
server := flag.String("endpoint", defaults.GetDefaults().DefaultAdminListen, "Admin socket endpoint")
|
server := flag.String("endpoint", defaults.GetDefaults().DefaultAdminListen, "Admin socket endpoint")
|
||||||
injson := flag.Bool("json", false, "Output in JSON format")
|
injson := flag.Bool("json", false, "Output in JSON format")
|
||||||
|
verbose := flag.Bool("v", false, "Verbose output (includes public keys)")
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
args := flag.Args()
|
args := flag.Args()
|
||||||
|
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
fmt.Println("usage:", os.Args[0], "[-endpoint=proto://server] [-json] command [key=value] [...]")
|
fmt.Println("usage:", os.Args[0], "[-endpoint=proto://server] [-verbose] [-json] command [key=value] [...]")
|
||||||
fmt.Println("example:", os.Args[0], "getPeers")
|
fmt.Println("example:", os.Args[0], "getPeers")
|
||||||
fmt.Println("example:", os.Args[0], "setTunTap name=auto mtu=1500 tap_mode=false")
|
fmt.Println("example:", os.Args[0], "setTunTap name=auto mtu=1500 tap_mode=false")
|
||||||
fmt.Println("example:", os.Args[0], "-endpoint=tcp://localhost:9001 getDHT")
|
fmt.Println("example:", os.Args[0], "-endpoint=tcp://localhost:9001 getDHT")
|
||||||
@ -116,9 +117,11 @@ func main() {
|
|||||||
for slk, slv := range tlv.(map[string]interface{}) {
|
for slk, slv := range tlv.(map[string]interface{}) {
|
||||||
if !keysOrdered {
|
if !keysOrdered {
|
||||||
for k := range slv.(map[string]interface{}) {
|
for k := range slv.(map[string]interface{}) {
|
||||||
|
if !*verbose {
|
||||||
if k == "box_pub_key" || k == "box_sig_key" {
|
if k == "box_pub_key" || k == "box_sig_key" {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
}
|
||||||
keyOrder = append(keyOrder, fmt.Sprint(k))
|
keyOrder = append(keyOrder, fmt.Sprint(k))
|
||||||
}
|
}
|
||||||
sort.Strings(keyOrder)
|
sort.Strings(keyOrder)
|
||||||
@ -185,11 +188,13 @@ func main() {
|
|||||||
if coords, ok := v.(map[string]interface{})["coords"].(string); ok {
|
if coords, ok := v.(map[string]interface{})["coords"].(string); ok {
|
||||||
fmt.Println("Coords:", coords)
|
fmt.Println("Coords:", coords)
|
||||||
}
|
}
|
||||||
|
if *verbose {
|
||||||
if boxPubKey, ok := v.(map[string]interface{})["box_pub_key"].(string); ok {
|
if boxPubKey, ok := v.(map[string]interface{})["box_pub_key"].(string); ok {
|
||||||
fmt.Println("Public encryption key:", boxPubKey)
|
fmt.Println("Public encryption key:", boxPubKey)
|
||||||
}
|
}
|
||||||
if boxSigKey, ok := v.(map[string]interface{})["box_sig_key"].(string); ok {
|
if boxSigKey, ok := v.(map[string]interface{})["box_sig_key"].(string); ok {
|
||||||
fmt.Println("Public signing key:", boxPubKey)
|
fmt.Println("Public signing key:", boxSigKey)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case "getswitchqueues":
|
case "getswitchqueues":
|
||||||
|
Loading…
Reference in New Issue
Block a user