-
Notifications
You must be signed in to change notification settings - Fork 59
/
cmd.go
49 lines (46 loc) · 896 Bytes
/
cmd.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
48
49
package server
import (
"github.com/Sirupsen/logrus"
"github.com/urfave/cli"
)
// Command run listen command
var Command = cli.Command{
Name: "listen",
Usage: "Listen as a server, wait connects from clients.",
Flags: []cli.Flag{
cli.BoolFlag{
Name: "d, debug",
Usage: "debug log level",
},
cli.StringFlag{
Name: "P, proto",
Value: "tcp",
Usage: "the proto between two points",
},
cli.StringFlag{
Name: "s, secret",
Value: "",
Usage: "secret phrase",
},
cli.IntFlag{
Name: "keyiter",
Usage: "key iter times for pbkdf2",
},
cli.IntFlag{
Name: "keylen",
Usage: "key length for pbkdf2",
},
cli.IntFlag{
Name: "keepalive",
Value: 30,
Usage: "keepalive interval",
},
},
Action: func(c *cli.Context) {
if c.Bool("debug") {
logrus.SetLevel(logrus.DebugLevel)
}
_server := newServer(c)
_server.Start()
},
}