mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2025-04-28 14:15:06 +03:00
Run gofmt -s -w
This commit is contained in:
parent
cc6fb8bd98
commit
bd32f5890b
2 changed files with 23 additions and 23 deletions
|
@ -15,13 +15,13 @@ 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
|
||||
}
|
||||
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 {
|
||||
|
@ -58,16 +58,16 @@ 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{})
|
||||
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"] {
|
||||
case "dot":
|
||||
fmt.Println(res["dot"])
|
||||
|
@ -78,8 +78,8 @@ func main() {
|
|||
}
|
||||
}
|
||||
|
||||
if v, ok := recv["status"]; ok && v == "error" {
|
||||
os.Exit(1)
|
||||
}
|
||||
os.Exit(0)
|
||||
if v, ok := recv["status"]; ok && v == "error" {
|
||||
os.Exit(1)
|
||||
}
|
||||
os.Exit(0)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue