Documentation ¶
Index ¶
Constants ¶
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 InterfaceMTU ¶
type InterfaceMTU uint64
type InterfaceName ¶
type InterfaceName string
type SetupOption ¶
type SetupOption interface {
// contains filtered or unexported methods
}
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 mesh.Adapter type. In order to use the TUN adapter with Mesh, you should pass this object to the mesh.SetRouterAdapter() function before calling mesh.Start().
func New ¶
func New(core *core.Core, rwc *ckriprwc.ReadWriteCloser, log core.Logger, opts ...SetupOption) (*TunAdapter, error)
Init initialises the TUN module. You must have acquired a Listener from the RiV-mesh core before this point and it must not be in use elsewhere.
func (*TunAdapter) IsStarted ¶
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) 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.