Documentation
¶
Overview ¶
Package device contains the structs and logic to create, configure, and maintain virtual multi-queue network devices. Each network device type is represented by a struct adhering to the included Device interface, which describes a generic multi-queue virtual network device.
Currently supported devices:
- TUN device
Index ¶
Constants ¶
const ( // TUNDevice creates and manages a TUN based network device. TUNDevice = "tun" // MOCKDevice creates and manages a mocked out network device for testing. MOCKDevice = "mock" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Device ¶
type Device interface { // Should return the name of the virual network device. Name() string // Read should return a formatted *common.Payload, based on the provided byte slice, off the specified device queue. Read(queue int, buf []byte) (*common.Payload, bool) // Write should handle being passed a formatted *common.Payload, and write the underlying raw data to the specified device queue. Write(queue int, payload *common.Payload) bool // Close should gracefully destroy the virtual network device. Close() error // Queues should return all underlying queue file descriptors to pass along during a rolling restart. Queues() []int }
Device interface for a generic multi-queue network device.
type Mock ¶
type Mock struct { }
Mock device struct to use for testing.
func (*Mock) Read ¶
Read which just returns the supplied buffer in the form of a *common.Payload.
type Tun ¶
type Tun struct {
// contains filtered or unexported fields
}
Tun device struct for managing a multi-queue TUN networking device.
func (*Tun) Close ¶
Close the Tun device and remove associated network configuration.
func (*Tun) Queues ¶
Queues returns the underlying device queue file descriptors.
func (*Tun) Read ¶
Read a packet off the specified device queue and return a *common.Payload representation of the packet.
Source Files
¶
- device.go
- doc.go
- mock.go
- tun.go