Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Handler ¶
type Handler interface {
// PhyToVirt converts a physical frame to a virtual frame typically by performing decapsulation.
// Returns the length of the resulting virtual frame.
PhyToVirt(phyFrame, virtFrame []byte) int
// VirtToPhy converts a virtual frame to a physical frame typically by performing encapsulation.
// Returns the length of the resulting physical frame.
VirtToPhy(virtFrame, phyFrame []byte) (length int, loopback bool)
// ScheduledToPhy is called periodically to allow the handler to send
// scheduled frames to the physical interface, e.g. keep-alive packets.
// Returns the length of the resulting physical frame.
ScheduledToPhy(phyFrame []byte) int
}
Decapsulate and encapsulate frames between physical and virtual interfaces.
type Tunnel ¶
type Tunnel struct {
// contains filtered or unexported fields
}
Tunnel splices frames between a physical and a virtual interface using XDP sockets. It uses a handler to convert frames between the two interfaces.
type TunnelOption ¶ added in v0.10.0
type TunnelOption func(*tunnelOptions) error
func WithPcapWriter ¶ added in v0.10.0
func WithPcapWriter(writer *pcapgo.Writer) TunnelOption
WithPcapWriter sets a pcap writer to log all frames sent and received on both interfaces. If nil, no pcap logging is performed.
func WithPhyFilter ¶ added in v0.10.0
func WithPhyFilter(filter *xdp.Program) TunnelOption
WithPhyFilter sets a custom XDP filter program to use on the physical interface. If nil, a default filter is created that accepts all GENEVE packets addressed to the default port (6081).
func WithPhyName ¶ added in v0.10.0
func WithPhyName(name string) TunnelOption
WithPhyName sets the name of the physical interface to use. Defaults to "eth0".
func WithVirtName ¶ added in v0.10.0
func WithVirtName(name string) TunnelOption
WithVirtName sets the name of the virtual interface to use. Defaults to "tun0".