MaskFrameWith masks frame with given mask and returns frame with masked payload and Mask header's field set. Note that it copies f payload to prevent collisions. For less allocations you could use MaskFrameInPlaceWith or construct frame manually.
(f Frame, mask [4]byte)
| 326 | // Note that it copies f payload to prevent collisions. |
| 327 | // For less allocations you could use MaskFrameInPlaceWith or construct frame manually. |
| 328 | func MaskFrameWith(f Frame, mask [4]byte) Frame { |
| 329 | // TODO(gobwas): check CopyCipher ws copy() Cipher(). |
| 330 | p := make([]byte, len(f.Payload)) |
| 331 | copy(p, f.Payload) |
| 332 | f.Payload = p |
| 333 | return MaskFrameInPlaceWith(f, mask) |
| 334 | } |
| 335 | |
| 336 | // MaskFrameInPlace masks frame and returns frame with masked payload and Mask |
| 337 | // header's field set. |
no test coverage detected
searching dependent graphs…