1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2026-04-14 01:29:17 -04:00

Refine code according to golangci-lint results

This commit is contained in:
loyalsoldier
2020-10-11 19:22:46 +08:00
parent ff6bb51732
commit 784775f689
118 changed files with 515 additions and 532 deletions

View File

@@ -136,7 +136,6 @@ func (c *Client) Process(ctx context.Context, link *transport.Link, dialer inter
}
if request.Command == protocol.RequestCommandUDP {
writer := &buf.SequentialWriter{Writer: &UDPWriter{
Writer: conn,
Request: request,

View File

@@ -6,14 +6,13 @@ import (
"crypto/hmac"
"crypto/rand"
"crypto/sha256"
"hash"
"hash/crc32"
"io"
"io/ioutil"
"v2ray.com/core/common/dice"
"v2ray.com/core/common"
"v2ray.com/core/common/buf"
"v2ray.com/core/common/dice"
"v2ray.com/core/common/net"
"v2ray.com/core/common/protocol"
)
@@ -35,7 +34,7 @@ var addrParser = protocol.NewAddressParser(
func ReadTCPSession(user *protocol.MemoryUser, reader io.Reader) (*protocol.RequestHeader, buf.Reader, error) {
account := user.Account.(*MemoryAccount)
hashkdf := hmac.New(func() hash.Hash { return sha256.New() }, []byte("SSBSKDF"))
hashkdf := hmac.New(sha256.New, []byte("SSBSKDF"))
hashkdf.Write(account.Key)
behaviorSeed := crc32.ChecksumIEEE(hashkdf.Sum(nil))

View File

@@ -133,7 +133,6 @@ func TestTCPRequest(t *testing.T) {
for _, test := range cases {
runTest(test.request, test.payload)
}
}
func TestUDPReaderWriter(t *testing.T) {