summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/gorilla/websocket/mask.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/gorilla/websocket/mask.go')
-rw-r--r--vendor/github.com/gorilla/websocket/mask.go12
1 files changed, 9 insertions, 3 deletions
diff --git a/vendor/github.com/gorilla/websocket/mask.go b/vendor/github.com/gorilla/websocket/mask.go
index 6a88bbc74..6758a2cb7 100644
--- a/vendor/github.com/gorilla/websocket/mask.go
+++ b/vendor/github.com/gorilla/websocket/mask.go
@@ -2,14 +2,20 @@
// this source code is governed by a BSD-style license that can be found in the
// LICENSE file.
-// +build !appengine
-
package websocket
-import "unsafe"
+import (
+ "math/rand"
+ "unsafe"
+)
const wordSize = int(unsafe.Sizeof(uintptr(0)))
+func newMaskKey() [4]byte {
+ n := rand.Uint32()
+ return [4]byte{byte(n), byte(n >> 8), byte(n >> 16), byte(n >> 24)}
+}
+
func maskBytes(key [4]byte, pos int, b []byte) int {
// Mask one byte at a time for small buffers.