writer

package
v0.0.0-...-ab0a638 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 4, 2024 License: EUPL-1.2 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AFPacket

type AFPacket struct {
	// contains filtered or unexported fields
}

AFPacket is a writer to an AFPacket packet connection.

func (*AFPacket) Close

func (w *AFPacket) Close()

Close closes all open resources.

func (*AFPacket) Run

func (w *AFPacket) Run(ch <-chan []packet.Packet)

Run writes packets from the given channel to the underlying interface until the channel is closed.

func (*AFPacket) Write

func (w *AFPacket) Write(m []packet.Packet)

Write writes a batch of messages to the underlying interface.

type DevNull

type DevNull struct{}

DevNull represents a throw-away writer.

func (*DevNull) Close

func (w *DevNull) Close()

Close closes all open resources.

func (*DevNull) Run

func (w *DevNull) Run(ch <-chan []packet.Packet)

Run writes packets from the given channel to the underlying interface until the channel is closed.

func (*DevNull) Write

func (w *DevNull) Write(m []packet.Packet)

Write writes a batch of messages to the underlying interface.

type Writer

type Writer interface {
	// Run writes packets from the given channel to the underlying interface
	// until the channel is closed.
	Run(ch <-chan []packet.Packet)

	// Write writes a batch of messages to the underlying interface.
	Write(m []packet.Packet)

	// Close closes all open resources.
	Close()
}

Writer represents a packet writer.

func NewAFPacket

func NewAFPacket(iface *net.Interface) (Writer, error)

NewAFPacket creates a Writer for the given source address and buffer size. The buffer size is used for determining the batch size of writes.

func NewDevNull

func NewDevNull() Writer

NewDevNull returns an initialised throw-away writer.

func NewXDP

func NewXDP(iface *net.Interface, queue int) (Writer, error)

NewXDP creates a Writer for the given source address and buffer size. The buffer size is used for determining the batch size of writes.

type XDP

type XDP struct {
	// contains filtered or unexported fields
}

XDP is a writer to an XDP packet connection.

func (*XDP) Close

func (w *XDP) Close()

Close closes all open resources.

func (*XDP) Run

func (w *XDP) Run(ch <-chan []packet.Packet)

Run writes packets from the given channel to the underlying interface until the channel is closed.

func (*XDP) Write

func (w *XDP) Write(m []packet.Packet)

Write writes a batch of messages to the underlying interface.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳