udwTapTun

package
v0.0.0-...-f254aa5 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2020 License: MIT Imports: 16 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateIpv4Tun

func CreateIpv4Tun(ctx *CreateIpv4TunContext) (err error)

func GetErrPlatformNotSupport

func GetErrPlatformNotSupport() error

func MustCreateIpv4Tun

func MustCreateIpv4Tun(ctx *CreateIpv4TunContext)

func SetP2PIpAndUp

func SetP2PIpAndUp(req SetP2PIpRequest) error

Types

type CreateIpv4TunContext

type CreateIpv4TunContext struct {
	SrcIp net.IP

	DstIp net.IP

	FirstIp net.IP

	DhcpServerIp net.IP

	Mask net.IPMask

	Mtu int

	ReturnTun io.ReadWriteCloser
	ReturnDev *udwNet.NetDevice
}

type DeviceType

type DeviceType string
var DeviceTypeTap DeviceType = "tap"
var DeviceTypeTun DeviceType = "tun"

func (DeviceType) String

func (s DeviceType) String() string

type SetP2PIpRequest

type SetP2PIpRequest struct {
	IfaceName string
	SrcIp     net.IP
	DstIp     net.IP
	Mtu       int
	Mask      net.IPMask
}

type TunTapInterface

type TunTapInterface interface {
	io.ReadWriteCloser
	GetDeviceType() DeviceType
	Name() string
}

type TunTapObj

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

func NewTap

func NewTap(ifName string) (ifce *TunTapObj, err error)

func NewTun

func NewTun(ifName string) (ifce *TunTapObj, err error)

func NewTunNoName

func NewTunNoName() (ifce *TunTapObj, err error)

func (*TunTapObj) Close

func (ifce *TunTapObj) Close() (err error)

func (*TunTapObj) GetDeviceType

func (ifce *TunTapObj) GetDeviceType() DeviceType

func (*TunTapObj) Name

func (ifce *TunTapObj) Name() string

func (*TunTapObj) Read

func (ifce *TunTapObj) Read(p []byte) (n int, err error)

func (*TunTapObj) StartWriteBufferThread

func (ifce *TunTapObj) StartWriteBufferThread(printErrorMsg string)

func (*TunTapObj) Write

func (ifce *TunTapObj) Write(p []byte) (n int, err error)

func (*TunTapObj) WriteFastNoLock

func (ifce *TunTapObj) WriteFastNoLock(p []byte) (err error)

func (*TunTapObj) WriteWithBuffer

func (ifce *TunTapObj) WriteWithBuffer(buf []byte)

Jump to

Keyboard shortcuts

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