vif

package
v2.6.9-test.1 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Device

type Device struct {
	*os.File
	// contains filtered or unexported fields
}

func OpenTun

func OpenTun(ctx context.Context) (*Device, error)

OpenTun creates a new TUN device and ensures that it is up and running.

func (*Device) AddStaticRoute added in v2.4.6

func (t *Device) AddStaticRoute(ctx context.Context, route routing.Route) error

AddStaticRoute adds a specific route. This can be used to prevent certain IP addresses from being routed to the TUN device.

func (*Device) AddSubnet

func (t *Device) AddSubnet(ctx context.Context, subnet *net.IPNet) error

AddSubnet adds a subnet to this TUN device and creates a route for that subnet which is associated with the device (removing the device will automatically remove the route).

func (*Device) Index

func (t *Device) Index() int32

Index returns the index of this device

func (*Device) Name

func (t *Device) Name() string

Name returns the name of this device, e.g. "tun0"

func (*Device) ReadPacket

func (t *Device) ReadPacket(into *buffer.Data) (int, error)

ReadPacket reads as many bytes as possible into the given buffer.Data and returns the number of bytes actually read

func (*Device) RemoveStaticRoute added in v2.4.6

func (t *Device) RemoveStaticRoute(ctx context.Context, route routing.Route) error

RemoveStaticRoute removes a specific route added via AddStaticRoute.

func (*Device) RemoveSubnet

func (t *Device) RemoveSubnet(ctx context.Context, subnet *net.IPNet) error

RemoveSubnet removes a subnet from this TUN device and also removes the route for that subnet which is associated with the device.

func (*Device) SetDNS

func (t *Device) SetDNS(ctx context.Context, server net.IP, domains []string) (err error)

SetDNS sets the DNS configuration for the device on the windows platform

func (*Device) SetMTU

func (t *Device) SetMTU(mtu int) error

func (*Device) WritePacket

func (t *Device) WritePacket(from *buffer.Data, offset int) (int, error)

WritePacket writes bytes from the buffer.Data starting at offset and returns the number of bytes actually written.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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