mirror of
https://github.com/nadoo/glider.git
synced 2025-02-23 17:35:40 +08:00
vmess: set rand.Seed only 1 time in NewClient
This commit is contained in:
parent
7a7b25f173
commit
e0f746fa3d
@ -99,6 +99,9 @@ func NewClient(uuidStr, security string, alterID int) (*Client, error) {
|
||||
return nil, errors.New("unknown security type: " + security)
|
||||
}
|
||||
|
||||
// NOTE: give rand a new seed to avoid the same sequence of values
|
||||
rand.Seed(time.Now().UnixNano())
|
||||
|
||||
return c, nil
|
||||
}
|
||||
|
||||
@ -114,7 +117,6 @@ func (c *Client) NewConn(rc net.Conn, target string) (*Conn, error) {
|
||||
}
|
||||
|
||||
randBytes := make([]byte, 33)
|
||||
rand.Seed(time.Now().UnixNano())
|
||||
rand.Read(randBytes)
|
||||
|
||||
copy(conn.reqBodyIV[:], randBytes[:16])
|
||||
|
Loading…
Reference in New Issue
Block a user