aboutsummaryrefslogtreecommitdiff
path: root/lib/websocket
diff options
context:
space:
mode:
Diffstat (limited to 'lib/websocket')
-rw-r--r--lib/websocket/client.go2
-rw-r--r--lib/websocket/frame_test.go4
-rw-r--r--lib/websocket/funcs.go4
-rw-r--r--lib/websocket/handshake.go2
-rw-r--r--lib/websocket/request.go1
-rw-r--r--lib/websocket/response.go1
-rw-r--r--lib/websocket/rootroute_test.go3
-rw-r--r--lib/websocket/server_bench_test.go3
-rw-r--r--lib/websocket/websocket.go4
-rw-r--r--lib/websocket/websocket_test.go1
10 files changed, 6 insertions, 19 deletions
diff --git a/lib/websocket/client.go b/lib/websocket/client.go
index 455a4b78..9aeae12b 100644
--- a/lib/websocket/client.go
+++ b/lib/websocket/client.go
@@ -627,7 +627,7 @@ func (cl *Client) handleHandshake(keyAccept string, resp []byte) (rest []byte, e
var httpRes *http.Response
- httpRes, rest, err = libhttp.ParseResponseHeader(resp) //nolint:bodyclose
+ httpRes, rest, err = libhttp.ParseResponseHeader(resp)
if err != nil {
return nil, err
}
diff --git a/lib/websocket/frame_test.go b/lib/websocket/frame_test.go
index a060e83a..306dd3f9 100644
--- a/lib/websocket/frame_test.go
+++ b/lib/websocket/frame_test.go
@@ -11,7 +11,6 @@ import (
"github.com/shuLhan/share/lib/test"
)
-//nolint:dupl
func TestNewFrameBin(t *testing.T) {
cases := []struct {
desc string
@@ -94,7 +93,6 @@ func TestNewFrameClose(t *testing.T) {
}
}
-//nolint:dupl
func TestNewFramePing(t *testing.T) {
cases := []struct {
desc string
@@ -134,7 +132,6 @@ func TestNewFramePing(t *testing.T) {
}
}
-//nolint:dupl
func TestNewFramePong(t *testing.T) {
cases := []struct {
desc string
@@ -174,7 +171,6 @@ func TestNewFramePong(t *testing.T) {
}
}
-//nolint:dupl
func TestNewFrameText(t *testing.T) {
cases := []struct {
desc string
diff --git a/lib/websocket/funcs.go b/lib/websocket/funcs.go
index f2016eb8..80d6cc18 100644
--- a/lib/websocket/funcs.go
+++ b/lib/websocket/funcs.go
@@ -5,7 +5,7 @@
package websocket
import (
- "crypto/sha1" //nolint:gosec
+ "crypto/sha1"
"encoding/base64"
"encoding/binary"
"log"
@@ -87,7 +87,7 @@ func Send(fd int, packet []byte) (err error) {
//
func generateHandshakeAccept(key []byte) string {
key = append(key, "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"...)
- sum := sha1.Sum(key) //nolint:gosec
+ sum := sha1.Sum(key)
return base64.StdEncoding.EncodeToString(sum[:])
}
diff --git a/lib/websocket/handshake.go b/lib/websocket/handshake.go
index b57034c0..e8d6c661 100644
--- a/lib/websocket/handshake.go
+++ b/lib/websocket/handshake.go
@@ -61,7 +61,6 @@ const (
_hdrValWSVersion = "13"
)
-//nolint:gochecknoglobals
var (
_handshakePool = sync.Pool{
New: func() interface{} {
@@ -319,7 +318,6 @@ func (h *Handshake) headerValueContains(hv, sub []byte) bool {
//
// The minimum length of request without HTTP line is: 144 - 16 = 128 bytes.
//
-//nolint:gocyclo
func (h *Handshake) parse(req []byte) (err error) {
if len(req) < 144 {
return ErrRequestLength
diff --git a/lib/websocket/request.go b/lib/websocket/request.go
index 343da267..aae3e44a 100644
--- a/lib/websocket/request.go
+++ b/lib/websocket/request.go
@@ -11,7 +11,6 @@ import (
"sync"
)
-//nolint:gochecknoglobals
var (
_reqPool = sync.Pool{
New: func() interface{} {
diff --git a/lib/websocket/response.go b/lib/websocket/response.go
index e22a9f0a..78c740f1 100644
--- a/lib/websocket/response.go
+++ b/lib/websocket/response.go
@@ -9,7 +9,6 @@ import (
"sync"
)
-//nolint:gochecknoglobals
var (
_resPool = sync.Pool{
New: func() interface{} {
diff --git a/lib/websocket/rootroute_test.go b/lib/websocket/rootroute_test.go
index f09232a7..c9ec3c32 100644
--- a/lib/websocket/rootroute_test.go
+++ b/lib/websocket/rootroute_test.go
@@ -13,14 +13,13 @@ import (
"github.com/shuLhan/share/lib/test"
)
-//nolint:gochecknoglobals
var (
_testRootRoute = newRootRoute()
_testDefMethod string
)
func testRouteHandler(t *testing.T, target string) RouteHandler {
- return func(ctx context.Context, req *Request) (res Response) { //nolint:unparam
+ return func(ctx context.Context, req *Request) (res Response) {
test.Assert(t, "routeHandler", target, req.Target, true)
return
}
diff --git a/lib/websocket/server_bench_test.go b/lib/websocket/server_bench_test.go
index 9d2ae408..ab4189f6 100644
--- a/lib/websocket/server_bench_test.go
+++ b/lib/websocket/server_bench_test.go
@@ -28,7 +28,6 @@ type upgradeCase struct {
req *http.Request
}
-//nolint:gochecknoglobals
var upgradeCases = []upgradeCase{
{
label: "base",
@@ -254,7 +253,7 @@ func withoutHeader(header string, req *http.Request) *http.Request {
func initNonce(dst []byte) {
// NOTE: bts does not escapes.
bts := make([]byte, nonceKeySize)
- if _, err := rand.Read(bts); err != nil { //nolint:gas
+ if _, err := rand.Read(bts); err != nil {
panic(fmt.Sprintf("rand read error: %s", err))
}
base64.StdEncoding.Encode(dst, bts)
diff --git a/lib/websocket/websocket.go b/lib/websocket/websocket.go
index 69833fbd..fba5a4a3 100644
--- a/lib/websocket/websocket.go
+++ b/lib/websocket/websocket.go
@@ -5,7 +5,7 @@
package websocket
import (
- "bytes" //nolint:gosec
+ "bytes"
"math/rand"
"sync"
"time"
@@ -24,7 +24,6 @@ const (
frameIsMasked = 0x80
)
-//nolint:gochecknoglobals
var (
defaultTimeout = 10 * time.Second
defaultPingInterval = 10 * time.Second
@@ -36,7 +35,6 @@ var (
}
)
-//nolint:gochecknoinits
func init() {
rand.Seed(time.Now().UnixNano())
}
diff --git a/lib/websocket/websocket_test.go b/lib/websocket/websocket_test.go
index edc02470..33ee727c 100644
--- a/lib/websocket/websocket_test.go
+++ b/lib/websocket/websocket_test.go
@@ -15,7 +15,6 @@ import (
"time"
)
-//nolint:lll,gochecknoglobals
var (
_testExternalJWT = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1MzA0NjU2MDYsImhhc2giOiJiYmJiYmJiYi1iYmJiLWJiYmItYmJiYi1iYmJiYmJiYmJiYmIiLCJpYXQiOjE1MzAyMDY0MDYsIm5hZiI6MTUzMjc5ODQwNn0.15quj_gkeo9cWkLN98_2rXjtjihQym16Kn_9BQjYC14"