diff --git a/common/protocol/http/sniff.go b/common/protocol/http/sniff.go index db478da6..f15e6bd2 100644 --- a/common/protocol/http/sniff.go +++ b/common/protocol/http/sniff.go @@ -42,7 +42,7 @@ var ( ) func beginWithHTTPMethod(b []byte) error { - for _, m := range methods { + for _, m := range &methods { if len(b) >= len(m) && strings.ToLower(string(b[:len(m)])) == m { return nil } diff --git a/proxy/mtproto/auth.go b/proxy/mtproto/auth.go index 973561ca..dd866239 100644 --- a/proxy/mtproto/auth.go +++ b/proxy/mtproto/auth.go @@ -36,7 +36,7 @@ func (a *Authentication) ApplySecret(b []byte) { func generateRandomBytes(random []byte) { for { - common.Must2(rand.Read(random[:])) + common.Must2(rand.Read(random)) if random[0] == 0xef { continue diff --git a/transport/internet/kcp/crypt.go b/transport/internet/kcp/crypt.go index 4bedbe31..61d2677e 100644 --- a/transport/internet/kcp/crypt.go +++ b/transport/internet/kcp/crypt.go @@ -36,14 +36,14 @@ func (a *SimpleAuthenticator) Seal(dst, nonce, plain, extra []byte) []byte { common.Must2(fnvHash.Write(dst[4:])) fnvHash.Sum(dst[:0]) - len := len(dst) - xtra := 4 - len%4 + dstLen := len(dst) + xtra := 4 - dstLen%4 if xtra != 4 { dst = append(dst, make([]byte, xtra)...) } xorfwd(dst) if xtra != 4 { - dst = dst[:len] + dst = dst[:dstLen] } return dst }