Migration: go1.20

This commit is contained in:
Dreamacro
2023-02-16 21:43:40 +08:00
parent fbf2f26516
commit 8173d6681b
15 changed files with 65 additions and 69 deletions

View File

@ -1,9 +1,10 @@
package obfs
import (
"crypto/rand"
"encoding/binary"
"hash/crc32"
"math/rand"
mathRand "math/rand"
"net"
"github.com/Dreamacro/clash/common/pool"
@ -53,7 +54,7 @@ func (c *randomHeadConn) Write(b []byte) (int, error) {
c.buf = append(c.buf, b...)
if !c.hasSentHeader {
c.hasSentHeader = true
dataLength := rand.Intn(96) + 4
dataLength := mathRand.Intn(96) + 4
buf := pool.Get(dataLength + 4)
defer pool.Put(buf)
rand.Read(buf[:dataLength])