This commit is contained in:
esrrhs 2019-01-08 11:14:35 +08:00
commit 8dddc24f69

View File

@ -39,6 +39,9 @@ Usage:
-catch 主动抓模式每秒从服务器主动抓多少个reply包默认0 -catch 主动抓模式每秒从服务器主动抓多少个reply包默认0
Active capture mode, how many reply packets are actively captured from the server per second, default 0 Active capture mode, how many reply packets are actively captured from the server per second, default 0
-key 设置的密码默认0
Set password, default 0
` `
func main() { func main() {
@ -50,7 +53,8 @@ func main() {
timeout := flag.Int("timeout", 60, "conn timeout") timeout := flag.Int("timeout", 60, "conn timeout")
sproto := flag.Int("sproto", 8, "send ping proto") sproto := flag.Int("sproto", 8, "send ping proto")
rproto := flag.Int("rproto", 0, "recv ping proto") rproto := flag.Int("rproto", 0, "recv ping proto")
catch := flag.Int("catch", 0, "catch mdoe") catch := flag.Int("catch", 0, "catch mode")
key := flag.Int("key", 0, "key")
flag.Usage = func() { flag.Usage = func() {
fmt.Printf(usage) fmt.Printf(usage)
} }
@ -63,9 +67,10 @@ func main() {
} }
fmt.Println("start...") fmt.Println("start...")
fmt.Printf("key %d\n", *key)
if *t == "server" { if *t == "server" {
s, err := pingtunnel.NewServer(*timeout) s, err := pingtunnel.NewServer(*timeout, *key)
if err != nil { if err != nil {
fmt.Printf("ERROR: %s\n", err.Error()) fmt.Printf("ERROR: %s\n", err.Error())
return return
@ -80,7 +85,7 @@ func main() {
fmt.Printf("server %s\n", *server) fmt.Printf("server %s\n", *server)
fmt.Printf("target %s\n", *target) fmt.Printf("target %s\n", *target)
c, err := pingtunnel.NewClient(*listen, *server, *target, *timeout, *sproto, *rproto, *catch) c, err := pingtunnel.NewClient(*listen, *server, *target, *timeout, *sproto, *rproto, *catch, *key)
if err != nil { if err != nil {
fmt.Printf("ERROR: %s\n", err.Error()) fmt.Printf("ERROR: %s\n", err.Error())
return return