mirror of
https://github.com/soypat/lneto.git
synced 2026-09-10 08:39:30 +00:00
add lneto.Validator type for frame validation
This commit is contained in:
+7
-6
@@ -217,16 +217,17 @@ func (gen *packetGen) appendRandomIPv4TCPPacket(dst []byte, rng *rand.Rand) []by
|
||||
case len(tcpPayload) > 0 && firstPayloadByte != tcpPayload[0]:
|
||||
panic("TCP options overwrite payload")
|
||||
}
|
||||
err = efrm.ValidateSize()
|
||||
if err != nil {
|
||||
var vld Validator
|
||||
efrm.ValidateSize(&vld)
|
||||
if err = vld.Err(); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
err = ifrm.ValidateSize()
|
||||
if err != nil {
|
||||
ifrm.Validate(&vld)
|
||||
if err = vld.Err(); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
err = tfrm.ValidateSize()
|
||||
if err != nil {
|
||||
tfrm.ValidateSize(&vld)
|
||||
if err = vld.Err(); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return dst
|
||||
|
||||
Reference in New Issue
Block a user