wireguard

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// NetlinkName is the Netlink name for WireGuard
	NetlinkName = "wireguard"
)

Variables

This section is empty.

Functions

func AddCatchAllRoute

func AddCatchAllRoute(l nl.Link, dst net.IPNet, config *lib.Config) error

AddCatchAllRoute sets up routing to forward all traffic

func AddDevice

func AddDevice(instance string, config *lib.Config) error

AddDevice adds a new WireGuard link and assigns the given IP address

func AddDeviceRoutes

func AddDeviceRoutes(instance string, config *lib.Config) error

AddDeviceRoutes sets up the routes for all AllowedIPs in the peer configuration

func ConfigureDevice

func ConfigureDevice(instance string, config *lib.Config, replacePeers bool) error

ConfigureDevice sets all WireGuard parameter in a Config

func DeleteDevice

func DeleteDevice(instance string) error

DeleteDevice deleted a WireGuard device and all routes and rules linked to it'

func GetDevice

func GetDevice(ifname string) (*wgtypes.Device, nl.Link, error)

GetDevice returns the WireGuard interface and the link device for an interface name

func ParsePeer

func ParsePeer(p *lib.Peer) wgtypes.PeerConfig

ParsePeer creates a Netlink-compatible view of a peer

func SetDevice

func SetDevice(instance string, config wgtypes.Config, replacePeers bool) error

SetDevice sets individual properties on a wireguard device without creating low-level interfaces.

func SetFWMark

func SetFWMark(instance string, fwmark int) error

SetFWMark changes the firewall mark on a specified WireGuard device

func SetRPFilter

func SetRPFilter() error

SetRPFilter sets the rp_filter of all interaces that are set to 1, to 2

Types

type WGLink struct {
	nl.LinkAttrs
}

WGLink is a WireGuard link

func (*WGLink) Attrs

func (wg *WGLink) Attrs() *nl.LinkAttrs

Attrs retirns the WireGuard netlink attrs

func (*WGLink) Type

func (wg *WGLink) Type() string

Type retirns the WireGuard netlink type name

Jump to

Keyboard shortcuts

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