aboutsummaryrefslogtreecommitdiff
path: root/lib/websocket
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2025-01-23 03:40:50 +0700
committerShulhan <ms@kilabit.info>2025-01-23 03:41:10 +0700
commit2a0694d2fa577574b505c4635eb8a824eaf88ddc (patch)
treecce840739c7f59893c3a6a65a1600f9f857c484e /lib/websocket
parent605d847b236dde031a2e387e74298d66a27b5e0a (diff)
downloadpakakeh.go-2a0694d2fa577574b505c4635eb8a824eaf88ddc.tar.xz
all: use for-range with numeric
Go 1.22 now support for-range on numeric value.
Diffstat (limited to 'lib/websocket')
-rw-r--r--lib/websocket/client_test.go8
-rw-r--r--lib/websocket/frame.go8
-rw-r--r--lib/websocket/websocket_test.go8
3 files changed, 12 insertions, 12 deletions
diff --git a/lib/websocket/client_test.go b/lib/websocket/client_test.go
index 091b1aa5..827b3d9c 100644
--- a/lib/websocket/client_test.go
+++ b/lib/websocket/client_test.go
@@ -1,6 +1,6 @@
-// Copyright 2018, Shulhan <ms@kilabit.info>. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
+// SPDX-FileCopyrightText: 2018 M. Shulhan <ms@kilabit.info>
+//
+// SPDX-License-Identifier: BSD-3-Clause
package websocket
@@ -541,7 +541,7 @@ func TestClientFragmentation2(t *testing.T) {
payload: []byte("Shulhan"),
}}
- for x = 0; x < len(frames); x++ {
+ for x = range len(frames) {
req = frames[x].pack()
testClient.Lock()
diff --git a/lib/websocket/frame.go b/lib/websocket/frame.go
index b3003aaa..235f166b 100644
--- a/lib/websocket/frame.go
+++ b/lib/websocket/frame.go
@@ -1,6 +1,6 @@
-// Copyright 2018, Shulhan <ms@kilabit.info>. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
+// SPDX-FileCopyrightText: 2018 M. Shulhan <ms@kilabit.info>
+//
+// SPDX-License-Identifier: BSD-3-Clause
package websocket
@@ -296,7 +296,7 @@ func (f *Frame) pack() (out []byte) {
out[x] = f.maskKey[3]
x++
- for y = 0; y < payloadSize; y++ {
+ for y = range payloadSize {
out[x] = f.payload[y] ^ f.maskKey[y%4]
x++
}
diff --git a/lib/websocket/websocket_test.go b/lib/websocket/websocket_test.go
index ed205692..ee58956a 100644
--- a/lib/websocket/websocket_test.go
+++ b/lib/websocket/websocket_test.go
@@ -1,6 +1,6 @@
-// Copyright 2018, Shulhan <ms@kilabit.info>. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
+// SPDX-FileCopyrightText: 2018 M. Shulhan <ms@kilabit.info>
+//
+// SPDX-License-Identifier: BSD-3-Clause
package websocket
@@ -42,7 +42,7 @@ func generateDummyPayload(size uint64) (payload []byte, masked []byte) {
copy(payload[x:], payload[:x])
}
- for x = 0; x < size; x++ {
+ for x = range size {
masked[x] = payload[x] ^ _testMaskKey[x%4]
}