mirror of
https://github.com/bettercap/bettercap.git
synced 2024-11-03 04:00:07 -08:00
19 lines
411 B
Go
19 lines
411 B
Go
package packets
|
|
|
|
import (
|
|
"github.com/google/gopacket"
|
|
)
|
|
|
|
var SerializationOptions = gopacket.SerializeOptions{
|
|
FixLengths: true,
|
|
ComputeChecksums: true,
|
|
}
|
|
|
|
func Serialize(layers ...gopacket.SerializableLayer) (error, []byte) {
|
|
buf := gopacket.NewSerializeBuffer()
|
|
if err := gopacket.SerializeLayers(buf, SerializationOptions, layers...); err != nil {
|
|
return err, nil
|
|
}
|
|
return nil, buf.Bytes()
|
|
}
|