segment.go 375 B

123456789101112
  1. package tio
  2. import "fmt"
  3. // SegmentSuperpacket invokes fn once per segment of pkt.
  4. // This is a stub implementation that does not actually support segmentation
  5. func SegmentSuperpacket(pkt Packet, fn func(seg []byte) error) error {
  6. if pkt.GSO.IsSuperpacket() {
  7. return fmt.Errorf("tio: GSO superpacket on platform without segmentation support")
  8. }
  9. return fn(pkt.Bytes)
  10. }