mirror of
https://github.com/bettercap/bettercap
synced 2025-08-14 02:36:57 -07:00
yeah i should have done this before, i know
This commit is contained in:
commit
0091ffdbb3
33 changed files with 25678 additions and 0 deletions
20
packets/serialize.go
Normal file
20
packets/serialize.go
Normal file
|
@ -0,0 +1,20 @@
|
|||
package packets
|
||||
|
||||
import (
|
||||
"github.com/google/gopacket"
|
||||
)
|
||||
|
||||
func Serialize(layers ...gopacket.SerializableLayer) (error, []byte) {
|
||||
// Set up buffer and options for serialization.
|
||||
buf := gopacket.NewSerializeBuffer()
|
||||
opts := gopacket.SerializeOptions{
|
||||
FixLengths: true,
|
||||
ComputeChecksums: true,
|
||||
}
|
||||
|
||||
if err := gopacket.SerializeLayers(buf, opts, layers...); err != nil {
|
||||
return err, nil
|
||||
}
|
||||
|
||||
return nil, buf.Bytes()
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue