tuntap

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2022 License: LGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const TUN_OFFSET_BYTES = 4

Variables

This section is empty.

Functions

func DefaultMTU

func DefaultMTU() uint64

DefaultMTU gets the default TUN interface MTU for your platform. This can be as high as MaximumMTU(), depending on platform, but is never lower than 1280.

func DefaultName

func DefaultName() string

DefaultName gets the default TUN interface name for your platform.

func MaximumMTU

func MaximumMTU() uint64

MaximumMTU returns the maximum supported TUN interface MTU for your platform. This can be as high as 65535, depending on platform, but is never lower than 1280.

Types

type GetTUNRequest added in v0.4.0

type GetTUNRequest struct{}

type GetTUNResponse added in v0.4.0

type GetTUNResponse map[string]TUNEntry

type MTU added in v0.3.14

type MTU uint16

type TUNEntry added in v0.4.0

type TUNEntry struct {
	MTU uint64 `json:"mtu"`
}

type TunAdapter

type TunAdapter struct {
	phony.Inbox // Currently only used for _handlePacket from the reader, TODO: all the stuff that currently needs a mutex below
	// contains filtered or unexported fields
}

TunAdapter represents a running TUN interface and extends the yggdrasil.Adapter type. In order to use the TUN adapter with Yggdrasil, you should pass this object to the yggdrasil.SetRouterAdapter() function before calling yggdrasil.Start().

func (*TunAdapter) Init

func (tun *TunAdapter) Init(rwc *ipv6rwc.ReadWriteCloser, config *config.NodeConfig, log *log.Logger, options interface{}) error

Init initialises the TUN module. You must have acquired a Listener from the Yggdrasil core before this point and it must not be in use elsewhere.

func (*TunAdapter) IsStarted added in v0.3.14

func (tun *TunAdapter) IsStarted() bool

IsStarted returns true if the module has been started.

func (*TunAdapter) MTU

func (tun *TunAdapter) MTU() uint64

MTU gets the adapter's MTU. This can range between 1280 and 65535, although the maximum value is determined by your platform. The returned value will never exceed that of MaximumMTU().

func (*TunAdapter) Name

func (tun *TunAdapter) Name() string

Name returns the name of the adapter, e.g. "tun0". On Windows, this may return a canonical adapter name instead.

func (*TunAdapter) SetupAdminHandlers

func (t *TunAdapter) SetupAdminHandlers(a *admin.AdminSocket)

func (*TunAdapter) Start

func (tun *TunAdapter) Start() error

Start the setup process for the TUN adapter. If successful, starts the reader actor to handle packets on that interface.

func (*TunAdapter) Stop

func (tun *TunAdapter) Stop() error

Start the setup process for the TUN adapter. If successful, starts the read/write goroutines to handle packets on that interface.

Jump to

Keyboard shortcuts

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