tun

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SYS_IOCTL     = 29
	TUNSETIFF     = 0x400454ca
	TUNSETPERSIST = 0x400454cb
	TUNSETGROUP   = 0x400454ce
	TUNSETOWNER   = 0x400454cc

	IFF_NO_PI      = 0x1000
	IFF_TUN        = 0x1
	IFF_TAP        = 0x2
	TUN       Mode = iota
	TAP
)

Variables

View Source
var DefaultNamePrefix = "fvpn"

Functions

This section is empty.

Types

type Device

type Device interface {
	Name() string
	Read(buff []byte) (int, error)
	Write(buff []byte) (int, error)
	SetIP(net, ip string) error
	SetMTU(mtu int) error
	IPToString() string
	Addr() net.IP
}

func New

func New() (Device, error)

type Ifreq

type Ifreq struct {
	Name  [16]byte
	Flags uint16
}

type Mode

type Mode int

type NativeTun

type NativeTun struct {
	Fd int

	NetworkId string
	IP        net.IP
	// contains filtered or unexported fields
}

NativeTun a tuntap for net

func (*NativeTun) Addr

func (tun *NativeTun) Addr() net.IP

func (*NativeTun) Close

func (tun *NativeTun) Close() error

Close close the device

func (*NativeTun) IPToString

func (tun *NativeTun) IPToString() string

func (*NativeTun) Name

func (tun *NativeTun) Name() string

func (*NativeTun) Read

func (tun *NativeTun) Read(buff []byte) (n int, err error)

func (*NativeTun) SetIP

func (tun *NativeTun) SetIP(network, ip string) error

func (*NativeTun) SetMTU

func (tun *NativeTun) SetMTU(mtu int) error

func (*NativeTun) Write

func (tun *NativeTun) Write(buff []byte) (int, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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