MCPcopy
hub / github.com/gobwas/ws / MaskFrameWith

Function MaskFrameWith

frame.go:328–334  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

326// Note that it copies f payload to prevent collisions.
327// For less allocations you could use MaskFrameInPlaceWith or construct frame manually.
328func 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.

Callers 1

MaskFrameFunction · 0.85

Calls 1

MaskFrameInPlaceWithFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…