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:
Shelikhoo committed 2020-06-01 16:40:54 +08:00
1 parent 9dc12961fa
commit e0aa18b6f3
2 files changed
+22 -1

No files matched your search

+8
View File
@@ -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))