rait

package
v2.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2020 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package rait provides the core logic of rait

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrDecode

type ErrDecode struct {
	Type string
	Key  string
	Err  error
}

func NewErrDecode

func NewErrDecode(Type string, Key string, Err error) ErrDecode

func (ErrDecode) Error

func (e ErrDecode) Error() string

func (ErrDecode) Unwrap

func (e ErrDecode) Unwrap() error

type Instance

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

Instance represents the control structure of RAIT

func InstanceFromMap

func InstanceFromMap(data map[string]interface{}) (*Instance, error)

func InstanceFromPath

func InstanceFromPath(path string) (*Instance, error)

func (*Instance) EnsureInterface

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

func (*Instance) IsManagedInterface

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

func (*Instance) ListInterfaces

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

func (*Instance) LoadPeers

func (instance *Instance) LoadPeers() ([]*Peer, error)

func (*Instance) RenderTemplate

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

RenderTemplate gathers information about interfaces and renders the liquid template

func (*Instance) SyncInterfaces

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

func (*Instance) WireguardConfig

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

type Peer

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

Peer represents a single wireguard peer which corresponds to an interface in RAIT

func PeerFromMap

func PeerFromMap(data map[string]interface{}) (*Peer, error)

func PeersFromPath

func PeersFromPath(path string) ([]*Peer, error)

Jump to

Keyboard shortcuts

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