iface

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2022 License: BSD-3-Clause Imports: 16 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 Exists added in v0.2.3

func Exists(iface string) (*bool, error)

Exists checks whether specified Wireguard device exists or not

func WireguardModExists added in v0.0.8

func WireguardModExists() bool

Types

type NativeLink struct {
	Link *netlink.Link
}

type NetInterface added in v0.3.4

type NetInterface interface {
	Close() error
}

NetInterface represents a generic network tunnel interface

type WGAddress added in v0.3.4

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

WGAddress Wireguard parsed address

type WGIface added in v0.3.4

type WGIface struct {
	Name      string
	Port      int
	MTU       int
	Address   WGAddress
	Interface NetInterface
}

WGIface represents a interface instance

func NewWGIface added in v0.3.4

func NewWGIface(iface string, address string, mtu int) (WGIface, error)

NewWGIface Creates a new Wireguard interface instance

func (*WGIface) Close added in v0.3.4

func (w *WGIface) Close() error

Closes the tunnel interface

func (*WGIface) Configure added in v0.3.4

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 added in v0.3.4

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) CreateWithKernel added in v0.3.4

func (w *WGIface) CreateWithKernel() error

CreateWithKernel Creates a new Wireguard interface using kernel Wireguard module. Works for Linux and offers much better network performance

func (*WGIface) CreateWithUserspace added in v0.3.4

func (w *WGIface) CreateWithUserspace() error

CreateWithUserspace Creates a new Wireguard interface, using wireguard-go userspace implementation

func (*WGIface) GetListenPort added in v0.3.4

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

GetListenPort returns the listening port of the Wireguard endpoint

func (*WGIface) RemovePeer added in v0.3.4

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

RemovePeer removes a Wireguard Peer from the interface iface

func (*WGIface) UpdatePeer added in v0.3.4

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