adjust: Improve WebSocket mask

This commit is contained in:
H1JK
2023-01-16 11:42:10 +08:00
parent 50832aab47
commit bec66e9e69
2 changed files with 133 additions and 2 deletions

View File

@ -123,8 +123,8 @@ func (wsc *websocketConn) WriteBuffer(buffer *buf.Buffer) error {
}
maskKey := rand.Uint32()
binary.BigEndian.PutUint32(header[1+payloadBitLength:], maskKey)
maskBytes(*(*[4]byte)(header[1+payloadBitLength:]), 0, data)
binary.LittleEndian.PutUint32(header[1+payloadBitLength:], maskKey)
N.MaskWebSocket(maskKey, data)
wsc.wMux.Lock()
defer wsc.wMux.Unlock()