Fix create padding

This commit is contained in:
世界 2022-05-31 11:24:27 +08:00
parent 52a7f9f469
commit 182b7837c8
No known key found for this signature in database
GPG key ID: CD109927C34A63C4

View file

@ -266,7 +266,7 @@ func (c *clientConn) writeRequest(payload []byte) error {
common.Must(binary.Write(fixedLengthBuffer, binary.BigEndian, uint64(time.Now().Unix())))
var paddingLen int
if len(payload) == 0 {
paddingLen = mRand.Intn(MaxPaddingLength + 1)
paddingLen = mRand.Intn(MaxPaddingLength) + 1
}
variableLengthHeaderLen := M.SocksaddrSerializer.AddrPortLen(c.destination) + 2 + paddingLen + len(payload)
common.Must(binary.Write(fixedLengthBuffer, binary.BigEndian, uint16(variableLengthHeaderLen)))