device

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2024 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NetTun

type NetTun struct {
	// contains filtered or unexported fields
}

func (*NetTun) AddSubnet

func (t *NetTun) AddSubnet(context.Context, *net.IPNet) error

AddSubnet adds a subnet route to the TUN device.

func (*NetTun) Close

func (t *NetTun) Close() error

Close gracefully closes the TUN device and its associated resources.

func (*NetTun) Dev

func (t *NetTun) Dev() stack.LinkEndpoint

Dev returns the LinkEndpoint for the TUN device.

func (*NetTun) Name

func (t *NetTun) Name() string

Name returns the name of the TUN device.

func (*NetTun) RemoveSubnet

func (t *NetTun) RemoveSubnet(context.Context, *net.IPNet) error

RemoveSubnet removes a subnet route from the TUN device.

type TUNDevice

type TUNDevice interface {
	Name() string
	AddSubnet(context.Context, *net.IPNet) error
	RemoveSubnet(context.Context, *net.IPNet) error
	Dev() stack.LinkEndpoint
}

TUNDevice abstracts a virtual network TUN device.

func Open

func Open(name string) (TUNDevice, error)

Open initializes the TUN device, retrieves the MTU, and creates the LinkEndpoint.

Jump to

Keyboard shortcuts

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