wireguard

package
v0.0.0-...-ccdb22c Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PublicKeyAnnotationName = "wireguard-publickey"
	IPAnnotationName        = "wireguard-ip"
	DefaultListenPort       = 51820
)

Variables

This section is empty.

Functions

func FromNode

func FromNode(node v1.Node) (*wgtypes.Peer, error)

FromNode returns a valid WireGuard peer if the node has the necessary metadata

Types

type Config

type Config struct {
	HostInterface Host
	Peers         []Peer
}

Config is the WireGuard config on the host

func GetConfig

func GetConfig(deviceName string) (*Config, error)

GetConfig builds the current WireGuard configuration of the host. This uses the custom Config type because the wgctrl device type does not return the IP used by the wireguard interface.

type Host

type Host struct {
	Address    string
	PrivateKey string
	PublicKey  string
	ListenPort int
}

Host is a custom type for holding WireGuard state information about the host

func NewHost

func NewHost(overlayip string) (Host, error)

NewHost returns a new host config.

type LinkWireGuard

type LinkWireGuard struct {
	LinkAttrs netlink.LinkAttrs
}

WireGuard link type

func (*LinkWireGuard) Attrs

func (w *LinkWireGuard) Attrs() *netlink.LinkAttrs

Attrs returns the attributes of the link

func (*LinkWireGuard) Type

func (w *LinkWireGuard) Type() string

Type returns the link type

type Peer

type Peer struct {
	PublicKey  string
	AllowedIPs []string
	Endpoint   string
}

Peer is a custom WireGuard peer type. todo(tyler-lloyd) remove usage eventually and only use wgctrl/wgtypes.Peer

Jump to

Keyboard shortcuts

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