This commit is contained in:
esrrhs 2018-12-19 15:37:04 +08:00
parent c4b969d0a1
commit d9579c3c48
2 changed files with 7 additions and 7 deletions

View File

@ -160,7 +160,7 @@ func (p *Client) processPacket(packet *Packet) {
t := time.Time{} t := time.Time{}
t.UnmarshalBinary(packet.data) t.UnmarshalBinary(packet.data)
d := time.Now().Sub(t) d := time.Now().Sub(t)
fmt.Printf("pong from %s %s %d\n", packet.src.String(), d.String(), packet.rproto) fmt.Printf("pong from %s %s\n", packet.src.String(), d.String())
sendICMP(*p.conn, packet.src, "", "", (uint32)(DATA), packet.data, packet.rproto, 0) sendICMP(*p.conn, packet.src, "", "", (uint32)(DATA), packet.data, packet.rproto, 0)
return return
} }

View File

@ -31,11 +31,11 @@ Usage:
-timeout 本地记录连接超时的时间单位是秒默认60s -timeout 本地记录连接超时的时间单位是秒默认60s
The time when the local record connection timed out, in seconds, 60 seconds by default The time when the local record connection timed out, in seconds, 60 seconds by default
-sproto 客户端发送ping协议的协议默认是42 -sproto 客户端发送ping协议的协议默认是13
The protocol that the client sends the ping. The default is 42. The protocol that the client sends the ping. The default is 13.
-rproto 客户端接收ping协议的协议默认是42 -rproto 客户端接收ping协议的协议默认是14
The protocol that the client receives the ping. The default is 42. The protocol that the client receives the ping. The default is 14.
` `
func main() { func main() {
@ -45,8 +45,8 @@ func main() {
target := flag.String("t", "", "target addr") target := flag.String("t", "", "target addr")
server := flag.String("s", "", "server addr") server := flag.String("s", "", "server addr")
timeout := flag.Int("timeout", 60, "conn timeout") timeout := flag.Int("timeout", 60, "conn timeout")
sproto := flag.Int("sproto", 42, "send ping proto") sproto := flag.Int("sproto", 13, "send ping proto")
rproto := flag.Int("rproto", 42, "recv ping proto") rproto := flag.Int("rproto", 14, "recv ping proto")
flag.Usage = func() { flag.Usage = func() {
fmt.Printf(usage) fmt.Printf(usage)
} }