|
|
|
|
@ -15,8 +15,8 @@ var helpText = `usage: pong <adress> <port> [-t <timeout> -k <protocol>]
|
|
|
|
|
eg:
|
|
|
|
|
pong www.baidu.com
|
|
|
|
|
pong www.baidu.com 443
|
|
|
|
|
pong www.baidu.com 443 -t 1
|
|
|
|
|
pong www.baidu.com 443 -t 1 -k udp
|
|
|
|
|
pong -t 1www.baidu.com 443
|
|
|
|
|
pong -k udp www.baidu.com 443
|
|
|
|
|
pong -a www.baidu.com -p 443 -k tcp -t 3
|
|
|
|
|
`
|
|
|
|
|
|
|
|
|
|
@ -27,6 +27,9 @@ func main() {
|
|
|
|
|
timeout := flag.Int("t", 1, "timeout")
|
|
|
|
|
flag.Parse()
|
|
|
|
|
|
|
|
|
|
fmt.Println("port:", *port)
|
|
|
|
|
fmt.Println("protocol:", *protocol)
|
|
|
|
|
|
|
|
|
|
switch flag.NArg() { //函数返回没有被解析的命令行参数的个数
|
|
|
|
|
// flag.Args() 函数返回没有被解析的命令行参数
|
|
|
|
|
case 0:
|
|
|
|
|
|