Documentation ¶
Overview ¶
Package tap contains bindings to create TAP/TUN interfaces on Linux and OpenBSD.
Index ¶
- type Interface
- func (i Interface) AddAddr(ip net.IP, network *net.IPNet) error
- func (i Interface) AddNeighbor(mac net.HardwareAddr, ip net.IP) error
- func (i Interface) Close() error
- func (i Interface) Name() string
- func (i Interface) Read() (*ethernet.Frame, error)
- func (i Interface) SetHardwareAddr(addr net.HardwareAddr) error
- func (i Interface) SetMTU(sz uint) error
- func (i Interface) SetUp(updown bool) error
- func (i Interface) Write(frame *ethernet.Frame) error
- type Options
- type PlatformOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Interface ¶
type Interface struct {
// contains filtered or unexported fields
}
Interface is a handle to a created TAP/TUN interface.
func (Interface) AddAddr ¶
AddAddr will add the provided IP Address and Network (CIDR/Netmask) to the TAP device. Both IPv4 and IPv6 are supported.
Under the hood this uses The Linux netlink interface to add the IP Address to the interface.
func (Interface) AddNeighbor ¶
AddNeighbor will add an entry into the ARP / NDP table
func (Interface) SetHardwareAddr ¶
func (i Interface) SetHardwareAddr(addr net.HardwareAddr) error
SetHardwareAddr will set the link state to up or down.
type Options ¶
type Options struct {
PlatformOptions PlatformOptions
}
Options contains a number of configuration params for the creation of the TAP/TUN interface. The PlatformOptions struct is OS dependent, and may contain options on your OS that are not present on other OSs.
type PlatformOptions ¶
type PlatformOptions struct { // Name will set the name of the TAP interface to override the default // of a tap* name (like tap0, tap5, tap3) Name string }
PlatformOptions are the Linux specific TAP Interface options that we're able to use during the TAP inteface creation. This is different per-host, and needs to be used carefully.