Skip to content

Commit

Permalink
randomize ping content
Browse files Browse the repository at this point in the history
  • Loading branch information
xtaci committed Jun 4, 2016
1 parent 4145cd0 commit a479e03
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sess.go
Original file line number Diff line number Diff line change
Expand Up @@ -387,8 +387,8 @@ func (s *UDPSession) outputTask() {
sz := rand.Intn(IKCP_MTU_DEF - s.headerSize - IKCP_OVERHEAD)
sz += s.headerSize + IKCP_OVERHEAD
ping := make([]byte, sz)
io.ReadFull(crand.Reader, ping)
if s.block != nil {
io.ReadFull(crand.Reader, ping[:otpSize]) // OTP
checksum := crc32.ChecksumIEEE(ping[cryptHeaderSize:])
binary.LittleEndian.PutUint32(ping[otpSize:], checksum)
encrypt(s.block, ping, encbuf)
Expand Down

0 comments on commit a479e03

Please sign in to comment.