Documentation ¶
Overview ¶
Package tun contains methods to open TAP and TUN devices.
Index ¶
- Constants
- func Open(name string) (int, error)
- func OpenTAP(name string) (int, error)
- type Device
- func (d *Device) Flags() Flags
- func (d *Device) MTU() (uint32, error)
- func (d *Device) Name() string
- func (d *Device) Read() (*buffer.View, error)
- func (d *Device) Readiness(mask waiter.EventMask) waiter.EventMask
- func (d *Device) Release(ctx context.Context)
- func (d *Device) SetIff(s *stack.Stack, name string, flags Flags) error
- func (d *Device) Write(data *buffer.View) (int64, error)
- func (d *Device) WriteNotify()
- type Flags
- type PacketInfoFields
- type PacketInfoHeader
Constants ¶
View Source
const (
// PacketInfoHeaderSize is the size of the packet information header.
PacketInfoHeaderSize = 4
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Device ¶
Device is an opened /dev/net/tun device.
+stateify savable
func (*Device) Name ¶
Name returns the name of the attached network interface. Empty string if unattached.
func (*Device) WriteNotify ¶
func (d *Device) WriteNotify()
WriteNotify implements channel.Notification.WriteNotify.
type PacketInfoFields ¶
type PacketInfoFields struct { Flags uint16 Protocol tcpip.NetworkProtocolNumber }
PacketInfoFields contains fields sent through the wire if IFF_NO_PI flag is not set.
type PacketInfoHeader ¶
type PacketInfoHeader []byte
PacketInfoHeader is the wire representation of the packet information sent if IFF_NO_PI flag is not set.
func (PacketInfoHeader) Encode ¶
func (h PacketInfoHeader) Encode(f *PacketInfoFields)
Encode encodes f into h.
func (PacketInfoHeader) Flags ¶
func (h PacketInfoHeader) Flags() uint16
Flags returns the flag field in h.
func (PacketInfoHeader) Protocol ¶
func (h PacketInfoHeader) Protocol() tcpip.NetworkProtocolNumber
Protocol returns the protocol field in h.
Click to show internal directories.
Click to hide internal directories.