wire.go 687 B

1234567891011121314151617
  1. package wire
  2. // TunPacket is the unit a read from a tun device returns.
  3. // On supported platforms, it may be a superpacket, but a single TunPacket will never have more than one destination.
  4. type TunPacket struct {
  5. // Bytes contains the actual packet
  6. Bytes []byte
  7. // Meta contains other information to help process the packet correctly, such as offsets for segmentation offloads
  8. // Fields in Meta should be as portable/platform-agnostic as possible.
  9. Meta struct{}
  10. }
  11. // PerSegment invokes fn once per segment of pkt.
  12. // This is a stub implementation that does not actually support segmentation
  13. func (t *TunPacket) PerSegment(fn func(seg []byte) error) error {
  14. return fn(t.Bytes)
  15. }