Fix according to staticcheck result

staticcheck repo: https://github.com/dominikh/go-tools/tree/master/cmd/staticcheck
This commit is contained in:
loyalsoldier
2020-08-30 23:41:15 +08:00
parent 1fa89b32d4
commit f12f76582f
10 changed files with 22 additions and 30 deletions
+4 -6
View File
@@ -12,19 +12,18 @@ import (
"io/ioutil"
"sync"
"time"
"v2ray.com/core/common/dice"
vmessaead "v2ray.com/core/proxy/vmess/aead"
"golang.org/x/crypto/chacha20poly1305"
"v2ray.com/core/common"
"v2ray.com/core/common/bitmask"
"v2ray.com/core/common/buf"
"v2ray.com/core/common/crypto"
"v2ray.com/core/common/dice"
"v2ray.com/core/common/net"
"v2ray.com/core/common/protocol"
"v2ray.com/core/common/task"
"v2ray.com/core/proxy/vmess"
vmessaead "v2ray.com/core/proxy/vmess/aead"
)
type sessionId struct {
@@ -170,7 +169,7 @@ func (s *ServerSession) DecodeRequestHeader(reader io.Reader) (*protocol.Request
var fixedSizeAuthID [16]byte
copy(fixedSizeAuthID[:], buffer.Bytes())
if foundAEAD == true {
if foundAEAD {
vmessAccount = user.Account.(*vmess.MemoryAccount)
var fixedSizeCmdKey [16]byte
copy(fixedSizeCmdKey[:], vmessAccount.ID.CmdKey())
@@ -405,8 +404,7 @@ func (s *ServerSession) EncodeResponseHeader(header *protocol.ResponseHeader, wr
aeadResponseHeaderLengthEncryptionBuffer := bytes.NewBuffer(nil)
var decryptedResponseHeaderLengthBinaryDeserializeBuffer uint16
decryptedResponseHeaderLengthBinaryDeserializeBuffer = uint16(aeadEncryptedHeaderBuffer.Len())
decryptedResponseHeaderLengthBinaryDeserializeBuffer := uint16(aeadEncryptedHeaderBuffer.Len())
common.Must(binary.Write(aeadResponseHeaderLengthEncryptionBuffer, binary.BigEndian, decryptedResponseHeaderLengthBinaryDeserializeBuffer))