iface

package
v0.7.10 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2024 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	MTU        int
	IPv4, IPv6 string
}

type Interface

type Interface interface {
	io.Closer
	RoutingTable
	Device() tun.Device
}

type RoutingTable

type RoutingTable interface {
	GetPeer(ip string) (net.Addr, bool)
	AddPeer(peer net.Addr, ipv4, ipv6 string)
	AddRoute(dst *net.IPNet, via net.IP) bool
	DelRoute(dst *net.IPNet, via net.IP) bool
}

type TunInterface

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

func Create

func Create(tunName string, cfg Config) (*TunInterface, error)

func CreateFD

func CreateFD(tunFD int, cfg Config) (*TunInterface, error)

func (*TunInterface) AddPeer

func (r *TunInterface) AddPeer(peer net.Addr, ipv4, ipv6 string)

func (*TunInterface) AddRoute

func (r *TunInterface) AddRoute(dst *net.IPNet, via net.IP) bool

func (*TunInterface) Close

func (r *TunInterface) Close() error

func (*TunInterface) DelRoute

func (r *TunInterface) DelRoute(dst *net.IPNet, via net.IP) bool

func (*TunInterface) Device

func (r *TunInterface) Device() tun.Device

func (*TunInterface) GetPeer

func (r *TunInterface) GetPeer(ip string) (net.Addr, bool)

Jump to

Keyboard shortcuts

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