This commit is contained in:
esrrhs committed 2018-12-19 14:38:44 +08:00
1 parent 743b82dda4
commit 2beaecc533
4 files changed
+78 -35

No files matched your search

+9 -5
View File
@@ -31,8 +31,11 @@ Usage:
-timeout 本地记录连接超时的时间,单位是秒,默认60s
The time when the local record connection timed out, in seconds, 60 seconds by default
-proto ping的协议,默认是42
Ping protocol, the default is 42
-sproto 客户端发送ping协议的协议,默认是42
The protocol that the client sends the ping. The default is 42.
-rproto 客户端接收ping协议的协议,默认是42
The protocol that the client receives the ping. The default is 42.
`
func main() {
@@ -42,7 +45,8 @@ func main() {
target := flag.String("t", "", "target addr")
server := flag.String("s", "", "server addr")
timeout := flag.Int("timeout", 60, "conn timeout")
proto := flag.Int("proto", 2, "ping proto")
sproto := flag.Int("sproto", 42, "send ping proto")
rproto := flag.Int("rproto", 42, "recv ping proto")
flag.Usage = func() {
fmt.Printf(usage)
}
@@ -57,7 +61,7 @@ func main() {
fmt.Println("start...")
if *t == "server" {
s, err := pingtunnel.NewServer(*timeout, *proto)
s, err := pingtunnel.NewServer(*timeout)
if err != nil {
fmt.Printf("ERROR: %s\n", err.Error())
return
@@ -72,7 +76,7 @@ func main() {
fmt.Printf("server %s\n", *server)
fmt.Printf("target %s\n", *target)
c, err := pingtunnel.NewClient(*listen, *server, *target, *timeout, *proto)
c, err := pingtunnel.NewClient(*listen, *server, *target, *timeout, *sproto, *rproto)
if err != nil {
fmt.Printf("ERROR: %s\n", err.Error())
return