linkmgr

package
Version: v0.0.0-...-742e75e Latest Latest
Warning

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

Go to latest
Published: May 14, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RouteProto = 157
)

Variables

View Source
var ErrNotWireguard = errors.New("named link is not a wireguard tunnel")

Functions

This section is empty.

Types

type AddrScope

type AddrScope int
const (
	ScopeGlobal AddrScope = unix.RT_SCOPE_UNIVERSE
	ScopeLink   AddrScope = unix.RT_SCOPE_LINK
)

type Address

type Address struct {
	net.IPNet
	Peer  *net.IPNet
	Scope AddrScope
}
type Link interface {
	Interface() net.Interface
	Name() string
	Index() int

	IsUp() bool
	SetUp(bool) error
	Addrs() ([]Address, error)
	DelAddr(a Address) error
	AddAddr(a Address) error

	ConfigureWG(wgtypes.Config) error
	WGConfig() (*wgtypes.Device, error)

	DialUDP(local, remote net.UDPAddr) (*net.UDPConn, error)
	ListenUDP(local net.UDPAddr) (*net.UDPConn, error)

	GetRoutes() ([]Route, error)
	AddRoute(Route) error
	DelRoute(Route) error
}

type LinkError

type LinkError struct {
	LinkName string
	E        error
}

func (LinkError) Error

func (err LinkError) Error() string

func (LinkError) Unwrap

func (err LinkError) Unwrap() error

type Manager

type Manager interface {
	Links() ([]Link, error)
	CreateLink(name string) (Link, error)
	DelLink(indx int) error
	GetLink(name string) (Link, error)

	Close() error
}

func NewManager

func NewManager() (Manager, error)

type Route

type Route struct {
	Dest net.IPNet
	Src  net.IP
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL