rait

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: May 23, 2020 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrExpected = errors.New("expected error")

Functions

This section is empty.

Types

type Instance added in v1.6.0

type Instance struct {
	PrivateKey         string // mandatory, the private key of the client
	AddressFamily      string // the address family of the client, ip4 or ip6
	SendPort           int    // mandatory, the sending port of the client
	InterfacePrefix    string // the common prefix to name the wireguard interfaces
	InterfaceGroup     int    // the ifgroup for the wireguard interfaces
	InterfaceNamespace string // the netns to move wireguard interface into
	TransitNamespace   string // the netns to create wireguard sockets in
	MTU                int    // the MTU of the wireguard interfaces
	FwMark             int    // the fwmark on packets sent by wireguard
	Peers              string // the url of the peer list
}

Instance represents the control structure of RAIT

func DefaultInstance added in v1.6.0

func DefaultInstance() *Instance

DefaultInstance returns a sane default for most fields in Instance

func (*Instance) EnsureInterface added in v1.6.0

func (instance *Instance) EnsureInterface(peer *Peer) (netlink.Link, error)

EnsureInterface setups wireguard interface for specified peer

func (*Instance) IsManagedInterface added in v1.6.0

func (instance *Instance) IsManagedInterface(link netlink.Link) bool

IsManagedInterface indicates whether the specified link is managed by the current rait instance

func (*Instance) ListInterfaces added in v1.6.0

func (instance *Instance) ListInterfaces() ([]netlink.Link, error)

ListInterfaces lists the interfaces managed by rait

func (*Instance) RenderTemplate added in v1.6.0

func (instance *Instance) RenderTemplate(in string, out string) error

RenderTemplate gathers information about interfaces and renders the liquid template

func (*Instance) SyncInterfaces added in v1.6.0

func (instance *Instance) SyncInterfaces(up bool) error

SyncInterfaces ensures the state of the interfaces matches the configuration files

func (*Instance) WireguardConfig added in v1.6.0

func (instance *Instance) WireguardConfig(peer *Peer) (string, *wgtypes.Config, error)

WireguardConfig generates wireguard interface configuration for specified peer

type Peer

type Peer struct {
	PublicKey     string // mandatory, the public key of the peer
	AddressFamily string // the address family of the specified endpoint, ip4 or ip6
	Endpoint      string // the endpoint ip address or resolvable domain name
	SendPort      int    // mandatory, the sending port of the peer
}

Peer represents a wireguard peer

type PeerList added in v1.4.0

type PeerList struct {
	Peers []*Peer
}

PeerList contains a list of peers (to workaround the lack of top level array in toml)

func LoadPeersFromPath added in v1.5.0

func LoadPeersFromPath(path string) (PeerList, error)

LoadPeersFromPath returns PeerList loaded from given path

func (*PeerList) SetDefaults added in v1.6.0

func (pl *PeerList) SetDefaults()

SetDefaults sets sane defaults for fields that are not present when decoding toml

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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