chore: use fastrand to replace math/rand

This commit is contained in:
wwqgtxx
2023-03-06 18:10:14 +08:00
parent ad6336231c
commit 6a97ab9ecb
26 changed files with 109 additions and 111 deletions

View File

@ -2,12 +2,14 @@ package wechat
import (
"encoding/binary"
"github.com/Dreamacro/clash/log"
"github.com/Dreamacro/clash/transport/hysteria/obfs"
"math/rand"
"net"
"sync"
"time"
"github.com/Dreamacro/clash/log"
"github.com/Dreamacro/clash/transport/hysteria/obfs"
"github.com/zhangyunhao116/fastrand"
)
const udpBufferSize = 65535
@ -29,7 +31,7 @@ func NewObfsWeChatUDPConn(orig net.PacketConn, obfs obfs.Obfuscator) *ObfsWeChat
obfs: obfs,
readBuf: make([]byte, udpBufferSize),
writeBuf: make([]byte, udpBufferSize),
sn: rand.Uint32() & 0xFFFF,
sn: fastrand.Uint32() & 0xFFFF,
}
}