iface

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2022 License: BSD-3-Clause Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultMTU    = 1280
	DefaultWgPort = 51820
)
View Source
const WgInterfaceDefault = "wt0"

WgInterfaceDefault is a default interface name of Wiretrustee

Variables

This section is empty.

Functions

func WireguardModExists

func WireguardModExists() bool

Types

type NativeLink struct {
	Link *netlink.Link
}

type NetInterface

type NetInterface interface {
	Close() error
}

NetInterface represents a generic network tunnel interface

type WGAddress

type WGAddress struct {
	IP      net.IP
	Network *net.IPNet
}

WGAddress Wireguard parsed address

func (*WGAddress) String added in v0.6.3

func (addr *WGAddress) String() string

type WGIface

type WGIface struct {
	Name      string
	Port      int
	MTU       int
	Address   WGAddress
	Interface NetInterface
	// contains filtered or unexported fields
}

WGIface represents a interface instance

func NewWGIFace added in v0.6.3

func NewWGIFace(iface string, address string, mtu int) (*WGIface, error)

NewWGIFace Creates a new Wireguard interface instance

func (*WGIface) Close

func (w *WGIface) Close() error

Close closes the tunnel interface

func (*WGIface) Configure

func (w *WGIface) Configure(privateKey string, port int) error

Configure configures a Wireguard interface The interface must exist before calling this method (e.g. call interface.Create() before)

func (*WGIface) Create

func (w *WGIface) Create() error

Create creates a new Wireguard interface, sets a given IP and brings it up. Will reuse an existing one.

func (*WGIface) GetListenPort

func (w *WGIface) GetListenPort() (*int, error)

GetListenPort returns the listening port of the Wireguard endpoint

func (*WGIface) RemovePeer

func (w *WGIface) RemovePeer(peerKey string) error

RemovePeer removes a Wireguard Peer from the interface iface

func (*WGIface) UpdateAddr added in v0.6.3

func (w *WGIface) UpdateAddr(newAddr string) error

UpdateAddr updates address of the interface

func (*WGIface) UpdatePeer

func (w *WGIface) UpdatePeer(peerKey string, allowedIps string, keepAlive time.Duration, endpoint *net.UDPAddr, preSharedKey *wgtypes.Key) error

UpdatePeer updates existing Wireguard Peer or creates a new one if doesn't exist Endpoint is optional

Jump to

Keyboard shortcuts

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