mirror of
https://github.com/v2fly/v2ray-core.git
synced 2026-11-16 21:43:00 -08:00
Drain Connection with invalid checksum before closing. Emergency fix for weakness described in https://github.com/v2ray/v2ray-core/issues/2523
This commit is contained in:
2 files changed
+22
-1
No files matched your search
@@ -15,6 +15,14 @@ func Roll(n int) int {
|
||||
return rand.Intn(n)
|
||||
}
|
||||
|
||||
// Roll returns a non-negative number between 0 (inclusive) and n (exclusive).
|
||||
func RollDeterministic(n int, seed int64) int {
|
||||
if n == 1 {
|
||||
return 0
|
||||
}
|
||||
return rand.New(rand.NewSource(seed)).Intn(n)
|
||||
}
|
||||
|
||||
// RollUint16 returns a random uint16 value.
|
||||
func RollUint16() uint16 {
|
||||
return uint16(rand.Intn(65536))
|
||||
|
||||
Reference in new issue
Block a user