tap

package
v0.3.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 27, 2021 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventUp = 1 << iota
	EventDown
	EventMTUUpdate
)
View Source
const (
	VPP_SUPPORT = "VPP support disabled"
)

Variables

This section is empty.

Functions

func GetIP added in v0.3.2

func GetIP(version int, netcidr string, uid uint32) (net.IP, net.IPMask, error)

func IsNotUnicast

func IsNotUnicast(mac_in MacAddress) bool

func Mac2charForm

func Mac2charForm(m []byte) byte

Types

type Device

type Device interface {
	Read([]byte, int) (int, error)  // read a packet from the device (without any additional headers)
	Write([]byte, int) (int, error) // writes a packet to the device (without any additional headers)
	Flush() error                   // flush all previous writes to the device
	MTU() (int, error)              // returns the MTU of the device
	Name() (string, error)          // fetches and returns the current name
	Events() chan Event             // returns a constant channel of events related to the device
	Close() error                   // stops the device and closes the event channel
}

func CreateDummyTAP

func CreateDummyTAP() (tapdev Device, err error)

New creates and returns a new TUN interface for the application.

func CreateFdTAP

func CreateFdTAP(iconfig mtypes.InterfaceConf, NodeID mtypes.Vertex) (tapdev Device, err error)

New creates and returns a new TUN interface for the application.

func CreateSockTAP

func CreateSockTAP(iconfig mtypes.InterfaceConf, protocol string, NodeID mtypes.Vertex, loglevel mtypes.LoggerInfo) (tapdev Device, err error)

New creates and returns a new TUN interface for the application.

func CreateStdIOTAP

func CreateStdIOTAP(iconfig mtypes.InterfaceConf, NodeID mtypes.Vertex) (tapdev Device, err error)

New creates and returns a new TUN interface for the application.

func CreateTAP

func CreateTAP(iconfig mtypes.InterfaceConf, NodeID mtypes.Vertex) (Device, error)

func CreateTAPFromFile

func CreateTAPFromFile(file *os.File, iconfig mtypes.InterfaceConf, NodeID mtypes.Vertex) (Device, error)

func CreateUDPSockTAP

func CreateUDPSockTAP(iconfig mtypes.InterfaceConf, NodeID mtypes.Vertex) (tapdev Device, err error)

New creates and returns a new TUN interface for the application.

func CreateUnmonitoredTUNFromFD

func CreateUnmonitoredTUNFromFD(fd int) (Device, string, error)

func CreateVppTAP

func CreateVppTAP(iconfig mtypes.InterfaceConf, NodeID mtypes.Vertex, loglevel string) (tapdev Device, err error)

New creates and returns a new TUN interface for the application.

type DummyTap

type DummyTap struct {
	// contains filtered or unexported fields
}

func (*DummyTap) Close

func (tap *DummyTap) Close() error

func (*DummyTap) Events

func (tap *DummyTap) Events() chan Event

func (*DummyTap) Flush

func (tap *DummyTap) Flush() error

func (*DummyTap) MTU

func (tap *DummyTap) MTU() (int, error)

func (*DummyTap) Name

func (tap *DummyTap) Name() (string, error)

func (*DummyTap) Read

func (tap *DummyTap) Read([]byte, int) (int, error)

func (*DummyTap) Write

func (tap *DummyTap) Write(packet []byte, size int) (int, error)

type Event

type Event int

type FdTap

type FdTap struct {
	// contains filtered or unexported fields
}

func (*FdTap) Close

func (tap *FdTap) Close() error

func (*FdTap) Events

func (tap *FdTap) Events() chan Event

func (*FdTap) Flush

func (tap *FdTap) Flush() error

func (*FdTap) MTU

func (tap *FdTap) MTU() (int, error)

func (*FdTap) Name

func (tap *FdTap) Name() (string, error)

func (*FdTap) Read

func (tap *FdTap) Read(buf []byte, offset int) (int, error)

func (*FdTap) Write

func (tap *FdTap) Write(buf []byte, offset int) (size int, err error)

type L2MODE

type L2MODE uint8
const (
	NoChange      L2MODE = iota
	KeyboardDebug        //Register to server
	BoardcastAndNodeID
)

func GetL2Mode

func GetL2Mode(mode string) L2MODE

type MacAddress

type MacAddress [6]byte

func Charform2mac

func Charform2mac(b byte) MacAddress

func GetDstMacAddr

func GetDstMacAddr(packet []byte) (dstMacAddr MacAddress)

func GetMacAddr

func GetMacAddr(prefix string, uid uint32) (mac MacAddress, err error)

func GetSrcMacAddr

func GetSrcMacAddr(packet []byte) (srcMacAddr MacAddress)

func (*MacAddress) String

func (mac *MacAddress) String() string

type NativeTap

type NativeTap struct {
	// contains filtered or unexported fields
}

func (*NativeTap) Close

func (tap *NativeTap) Close() error

func (*NativeTap) Events

func (tap *NativeTap) Events() chan Event

func (*NativeTap) File

func (tap *NativeTap) File() *os.File

func (*NativeTap) Flush

func (tap *NativeTap) Flush() error

func (*NativeTap) MTU

func (tap *NativeTap) MTU() (int, error)

func (*NativeTap) Name

func (tap *NativeTap) Name() (string, error)

func (*NativeTap) Read

func (tap *NativeTap) Read(buf []byte, offset int) (n int, err error)

func (*NativeTap) Write

func (tap *NativeTap) Write(buf []byte, offset int) (int, error)

type SockServerTap

type SockServerTap struct {
	// contains filtered or unexported fields
}

func (*SockServerTap) Close

func (tap *SockServerTap) Close() error

func (*SockServerTap) Events

func (tap *SockServerTap) Events() chan Event

func (*SockServerTap) Flush

func (tap *SockServerTap) Flush() error

func (*SockServerTap) MTU

func (tap *SockServerTap) MTU() (int, error)

func (*SockServerTap) Name

func (tap *SockServerTap) Name() (string, error)

func (*SockServerTap) Read

func (tap *SockServerTap) Read(buf []byte, offset int) (size int, err error)

func (*SockServerTap) RoutineAcceptConnection

func (tap *SockServerTap) RoutineAcceptConnection()

func (*SockServerTap) Write

func (tap *SockServerTap) Write(buf []byte, offset int) (size int, err error)

type StdIOTap

type StdIOTap struct {
	L2mode L2MODE
	// contains filtered or unexported fields
}

func (*StdIOTap) Close

func (tap *StdIOTap) Close() error

func (*StdIOTap) Events

func (tap *StdIOTap) Events() chan Event

func (*StdIOTap) Flush

func (tap *StdIOTap) Flush() error

func (*StdIOTap) MTU

func (tap *StdIOTap) MTU() (int, error)

func (*StdIOTap) Name

func (tap *StdIOTap) Name() (string, error)

func (*StdIOTap) Read

func (tap *StdIOTap) Read(buf []byte, offset int) (int, error)

func (*StdIOTap) Write

func (tap *StdIOTap) Write(buf []byte, offset int) (size int, err error)

type UdpSockTap

type UdpSockTap struct {
	// contains filtered or unexported fields
}

func (*UdpSockTap) Close

func (tap *UdpSockTap) Close() error

func (*UdpSockTap) Events

func (tap *UdpSockTap) Events() chan Event

func (*UdpSockTap) Flush

func (tap *UdpSockTap) Flush() error

func (*UdpSockTap) MTU

func (tap *UdpSockTap) MTU() (int, error)

func (*UdpSockTap) Name

func (tap *UdpSockTap) Name() (string, error)

func (*UdpSockTap) Read

func (tap *UdpSockTap) Read(buf []byte, offset int) (int, error)

func (*UdpSockTap) Write

func (tap *UdpSockTap) Write(buf []byte, offset int) (size int, err error)

type VppTap

type VppTap struct {
	// contains filtered or unexported fields
}

func (*VppTap) Close

func (tap *VppTap) Close() error

func (*VppTap) Events

func (tap *VppTap) Events() chan Event

func (*VppTap) Flush

func (tap *VppTap) Flush() error

func (*VppTap) MTU

func (tap *VppTap) MTU() (int, error)

func (*VppTap) Name

func (tap *VppTap) Name() (string, error)

func (*VppTap) Read

func (tap *VppTap) Read([]byte, int) (int, error)

func (*VppTap) Write

func (tap *VppTap) Write(packet []byte, size int) (int, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL