Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type TapIf ¶
type TapIf struct { Name string // contains filtered or unexported fields }
TapIf represents a tap interface, which exchanges behaves like a full Ethernet-capable network interface to userspace, but also permits that network interface to be a io.ReadWriteCloser.
func CreateTap ¶
CreateTap requests a new automatically named tap interface from the OS. This device is created with the NO_PI flag set, because essentially no sane users are interested in the alternative. A TapIf must be Close()d before it is GC'd or we will panic.
func CreateTapNamed ¶
CreateTapNamed requests a new tap interface from the OS, and requests that it be named with the provided string. It is otherwise identical to CreateTap(). The requested name may be up to IFNAMSIZ bytes, which technically can vary, but seems to be 16 everywhere. A TapIf must be Close()d before it is GC'd or we will panic.
func (*TapIf) NetIf ¶
NetIf returns a NetIf for the tap interface. For example:
t := tuntap.CreateTap() t.NetIf().Up()
func (*TapIf) SetPersistent ¶
SetPersistent allows the interface to persist after being closed.