diff --git a/shadowaead_2022/protocol.go b/shadowaead_2022/protocol.go index 2686354..3156d85 100644 --- a/shadowaead_2022/protocol.go +++ b/shadowaead_2022/protocol.go @@ -294,7 +294,7 @@ func (c *clientConn) writeRequest(payload []byte) error { payloadLen := len(payload) variableLengthHeaderLen += payloadLen common.Must(binary.Write(fixedLengthBuffer, binary.BigEndian, uint16(variableLengthHeaderLen))) - writer.WriteChunk(header, fixedLengthBuffer.Slice()) + writer.WriteChunk(header, fixedLengthBuffer.Bytes()) variableLengthBuffer := buf.NewSize(variableLengthHeaderLen) err = M.SocksaddrSerializer.WriteAddrPort(variableLengthBuffer, c.destination) @@ -308,7 +308,7 @@ func (c *clientConn) writeRequest(payload []byte) error { if payloadLen > 0 { common.Must1(variableLengthBuffer.Write(payload[:payloadLen])) } - writer.WriteChunk(header, variableLengthBuffer.Slice()) + writer.WriteChunk(header, variableLengthBuffer.Bytes()) variableLengthBuffer.Release() err = writer.BufferedWriter(header.Len()).Flush() diff --git a/shadowaead_2022/service.go b/shadowaead_2022/service.go index 4dfdf97..68ccf72 100644 --- a/shadowaead_2022/service.go +++ b/shadowaead_2022/service.go @@ -287,7 +287,7 @@ func (c *serverConn) writeResponse(payload []byte) (n int, err error) { common.Must1(headerFixedChunk.Write(c.requestSalt)) common.Must(binary.Write(headerFixedChunk, binary.BigEndian, uint16(payloadLen))) - writer.WriteChunk(header, headerFixedChunk.Slice()) + writer.WriteChunk(header, headerFixedChunk.Bytes()) headerFixedChunk.Release() c.requestSalt = nil