tun

package
v0.0.0-...-a69ce32 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IFF_NO_PI = 0x10
	IFF_TUN   = 0x01
	IFF_TAP   = 0x02
	TUNSETIFF = 0x400454CA
)

Variables

View Source
var TUNCHANBUFFSIZE = 1024

Functions

This section is empty.

Types

type Tun

type Tun interface {
	GetMtu() int

	Read(data []byte) (int, error)
	Write(data []byte) (int, error)
	Close() error
}

func NewLinuxTun

func NewLinuxTun(name string, mtu int) (Tun, error)

type TunServer

type TunServer struct {
	TunConn Tun
	//Key: clientProtocol:clientIP:clientPort  Value: chan string
	RouteMap *cache.Cache
	//write to tun
	InputChan chan string
}

func NewTunServer

func NewTunServer(tname string, mtu int) (*TunServer, error)

func (*TunServer) Start

func (ts *TunServer) Start()

func (*TunServer) StartClient

func (ts *TunServer) StartClient(client string, inputChan chan string, outputChan chan string)

func (*TunServer) Stop

func (ts *TunServer) Stop()

Jump to

Keyboard shortcuts

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