tun

package
v0.10.2 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2024 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Delete

func Delete(name string) error

Delete removes a TUN device from the host.

Types

type Option added in v0.2.0

type Option func(tun *TUN) error

Option defines a TUN device modifier option.

func Address added in v0.2.0

func Address(address string) Option

Address sets the local address and subnet for an interface. On MacOS devices use this function to set the Src Address for an interface and use DestAddress to set the destination ip.

func DestAddress added in v0.2.0

func DestAddress(address string) Option

DestAddress sets the destination address for a point-to-point interface. Only use this option on MacOS devices.

func MTU added in v0.2.0

func MTU(mtu int) Option

MTU sets the Maximum Transmission Unit size for an interface.

func RemoveRoute added in v0.8.6

func RemoveRoute(dest net.IPNet) Option

RemoveRoute removes an entry from the system route table

func Route added in v0.8.6

func Route(dest net.IPNet) Option

Route adds an entry to the system route table

type TUN added in v0.2.0

type TUN struct {
	Iface *water.Interface
	MTU   int
	Src   string
	Dst   string
}

TUN is a struct containing the fields necessary to configure a system TUN device. Access the internal TUN device through TUN.Iface

func New

func New(name string, opts ...Option) (*TUN, error)

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

func (*TUN) Apply added in v0.2.0

func (t *TUN) Apply(opts ...Option) error

Apply configures the specified options for a TUN device.

func (*TUN) Down added in v0.2.0

func (t *TUN) Down() error

Down brings down an interface stopping active connections.

func (*TUN) Up added in v0.2.0

func (t *TUN) Up() error

Up brings up an interface to allow it to start accepting connections.

Jump to

Keyboard shortcuts

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