tun

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package tun provides functionality to create and manage TUN Devices

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetInterfaceAddresses

func GetInterfaceAddresses() (addrs []net.IP, err error)

Get Device Network Interfaces

Types

type TunConfig

type TunConfig struct {
	// Maximum transmission unit
	MTU int
	// IP Address of the Device
	IP net.IP
	// CIDR network of the Device
	CIDR *net.IPNet
}

Tun Config

func NewTunConfig

func NewTunConfig(mtu int, address string) (config TunConfig, err error)

Create Tun Config

func (*TunConfig) String

func (tc *TunConfig) String() string

Stringify

type TunDevice

type TunDevice struct {
	// Config
	Config TunConfig
	// Name
	Name string
	// IO Device
	Device *water.Interface
	// Active Status
	Active bool
}

Tun Device

func (*TunDevice) Close

func (td *TunDevice) Close()

Close Device

func (*TunDevice) Open

func (td *TunDevice) Open(config TunConfig) (err error)

Open TunDevice on Linux

func (*TunDevice) String

func (td *TunDevice) String() string

Stringify

Jump to

Keyboard shortcuts

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