Skip to content

Commit cda2170

Browse files
committed
Refactor and compile masking code again
1 parent 5df0303 commit cda2170

File tree

7 files changed

+11
-9
lines changed

7 files changed

+11
-9
lines changed

frame.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ func writeFrameHeader(h header, w *bufio.Writer, buf []byte) (err error) {
173173
return nil
174174
}
175175

176-
// mask applies the WebSocket masking algorithm to p
176+
// maskGo applies the WebSocket masking algorithm to p
177177
// with the given key.
178178
// See https://tools.ietf.org/html/rfc6455#section-5.3
179179
//

internal/examples/go.mod

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,5 @@ require (
88
golang.org/x/time v0.3.0
99
nhooyr.io/websocket v0.0.0-00010101000000-000000000000
1010
)
11+
12+
require golang.org/x/sys v0.13.0 // indirect

internal/examples/go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1+
golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE=
2+
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
13
golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4=
24
golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=

internal/thirdparty/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ require (
3434
golang.org/x/arch v0.3.0 // indirect
3535
golang.org/x/crypto v0.9.0 // indirect
3636
golang.org/x/net v0.10.0 // indirect
37-
golang.org/x/sys v0.8.0 // indirect
37+
golang.org/x/sys v0.13.0 // indirect
3838
golang.org/x/text v0.9.0 // indirect
3939
google.golang.org/protobuf v1.30.0 // indirect
4040
gopkg.in/yaml.v3 v3.0.1 // indirect

internal/thirdparty/go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M=
7676
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
7777
golang.org/x/sys v0.0.0-20220704084225-05e143d24a9e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
7878
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
79-
golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU=
80-
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
79+
golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE=
80+
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
8181
golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE=
8282
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
8383
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=

mask_generic.go renamed to mask.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//go:build appengine || (!amd64 && !arm64 && !js)
1+
//go:build !amd64 && !arm64 && !js
22

33
package websocket
44

mask_asm.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
//go:build !appengine && (amd64 || arm64)
2-
// +build !appengine
3-
// +build amd64 arm64
1+
//go:build amd64 || arm64
42

53
package websocket
64

@@ -13,7 +11,7 @@ func mask(key uint32, b []byte) uint32 {
1311
return key
1412
}
1513

16-
var useAVX2 = cpu.X86.HasAVX2
14+
var useAVX2 = cpu.X86.HasAVX2 //lint:ignore U1000 mask_amd64.s
1715

1816
//go:noescape
1917
func maskAsm(b *byte, len int, key uint32) uint32

0 commit comments

Comments
 (0)