mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2025-04-28 14:15:06 +03:00
Builds for yggdrasilctl plus usage info and fixes
This commit is contained in:
parent
ee99ae008d
commit
cda7a2abcc
3 changed files with 32 additions and 15 deletions
|
@ -15,6 +15,14 @@ func main() {
|
|||
flag.Parse()
|
||||
args := flag.Args()
|
||||
|
||||
if len(args) == 0 {
|
||||
fmt.Println("usage:", os.Args[0], "[-endpoint=localhost:9001] command [key=value] [...]")
|
||||
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], "-endpoint=localhost:9001 getDHT")
|
||||
return
|
||||
}
|
||||
|
||||
conn, err := net.Dial("tcp", *server)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
|
@ -50,6 +58,14 @@ func main() {
|
|||
panic(err)
|
||||
}
|
||||
if err := decoder.Decode(&recv); err == nil {
|
||||
if _, ok := recv["request"]; !ok {
|
||||
fmt.Println("Missing request")
|
||||
return
|
||||
}
|
||||
if _, ok := recv["response"]; !ok {
|
||||
fmt.Println("Missing response")
|
||||
return
|
||||
}
|
||||
req := recv["request"].(map[string]interface{})
|
||||
res := recv["response"].(map[string]interface{})
|
||||
switch req["request"] {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue