mirror of
https://github.com/MetaCubeX/Clash.Meta.git
synced 2025-04-18 08:20:53 +00:00
fix: handling padding size boundary conditions
This commit is contained in:
parent
952f286e5f
commit
e4cf7e9133
1 changed files with 9 additions and 2 deletions
|
@ -74,8 +74,15 @@ func (p *PaddingFactory) GenerateRecordPayloadSizes(pkt uint32) (pktSizes []int)
|
|||
continue
|
||||
}
|
||||
_min, _max = common.Min(_min, _max), common.Max(_min, _max)
|
||||
i, _ := rand.Int(rand.Reader, big.NewInt(_max-_min))
|
||||
pktSizes = append(pktSizes, int(i.Int64()+_min))
|
||||
if _min <= 0 || _max <= 0 {
|
||||
continue
|
||||
}
|
||||
if _min == _max {
|
||||
pktSizes = append(pktSizes, int(_min))
|
||||
} else {
|
||||
i, _ := rand.Int(rand.Reader, big.NewInt(_max-_min))
|
||||
pktSizes = append(pktSizes, int(i.Int64()+_min))
|
||||
}
|
||||
} else if sRange == "c" {
|
||||
pktSizes = append(pktSizes, CheckMark)
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue