tun

package
v2.1.5-rc.0 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2021 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

tun_linux.go: Open a Tunnel (L3 virtual interface) using the Universal TUN/TAP device driver.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IoctlGetInterfaceIndex

func IoctlGetInterfaceIndex(fd int, name string) (int32, error)

IoctlGetInterfaceIndex wraps the SIOCGIFINDEX ioctl

func IoctlTunSetInterfaceFlags

func IoctlTunSetInterfaceFlags(fd int, name string, flags int16) (string, error)

IoctlTunSetInterfaceFlags wraps the TUNSETIFF ioctl

func OpenTun

func OpenTun() (io.ReadWriteCloser, string, error)

Types

type InterfaceWithDNS

type InterfaceWithDNS struct {
	io.ReadWriteCloser
	// contains filtered or unexported fields
}

An InterfaceWithDNS is a TUN device capable of dispatching DNS requests that are sent to its configured DNS to a DNS server that uses a local address.

func CreateInterfaceWithDNS

func CreateInterfaceWithDNS(c context.Context, dConn *dbus.ResolveD) (*InterfaceWithDNS, error)

CreateInterfaceWithDNS creates a new TUN device and assigns the first available class C subnet to it. The x.x.x.2 address of that network is then declared to be the DNS service of that network. The interface is then set to state "up".

func (*InterfaceWithDNS) ForwardDNS

func (t *InterfaceWithDNS) ForwardDNS(c context.Context, forwardAddr *net.UDPAddr, initDone *sync.WaitGroup) error

func (*InterfaceWithDNS) InterfaceIndex

func (t *InterfaceWithDNS) InterfaceIndex() int

func (*InterfaceWithDNS) Name

func (t *InterfaceWithDNS) Name() string

func (*InterfaceWithDNS) RequestCount

func (t *InterfaceWithDNS) RequestCount() uint64

Jump to

Keyboard shortcuts

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