-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlan.go
47 lines (42 loc) · 825 Bytes
/
lan.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package main
import (
"fmt"
"github.com/codegangsta/cli"
"github.com/modouwifi/md/api"
)
var cmdLan = cli.Command{
Name: "lan",
Usage: "LAN",
Subcommands: []cli.Command{
{
Name: "get",
Usage: "Get LAN config",
Action: runLanGet,
},
{
Name: "check",
Usage: "Check LAN status",
Action: runLanCheck,
},
},
}
func runLanGet(c *cli.Context) {
req, err := client.NewRequest("GET", "/lan/get_lan_config")
if err != nil {
fmt.Println(err)
}
req.SetCookie(config.Cookie)
var result api.Lan
err = req.ToJSON(&result)
fmt.Println(result)
}
func runLanCheck(c *cli.Context) {
req, err := client.NewRequest("GET", "/lan/check_set")
if err != nil {
fmt.Println(err)
}
req.SetCookie(config.Cookie)
var result api.ResponseMessage
err = req.ToJSON(&result)
fmt.Println(result)
}