Documentation ¶
Index ¶
- Variables
- type Instance
- func (instance *Instance) EnsureInterface(peer *Peer) (netlink.Link, error)
- func (instance *Instance) IsManagedInterface(link netlink.Link) bool
- func (instance *Instance) ListInterfaces() ([]netlink.Link, error)
- func (instance *Instance) RenderTemplate(in string, out string) error
- func (instance *Instance) SyncInterfaces(up bool) error
- func (instance *Instance) WireguardConfig(peer *Peer) (string, *wgtypes.Config, error)
- type Peer
- type PeerList
Constants ¶
This section is empty.
Variables ¶
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
EnsureInterface setups wireguard interface for specified peer
func (*Instance) IsManagedInterface ¶ added in v1.6.0
IsManagedInterface indicates whether the specified link is managed by the current rait instance
func (*Instance) ListInterfaces ¶ added in v1.6.0
ListInterfaces lists the interfaces managed by rait
func (*Instance) RenderTemplate ¶ added in v1.6.0
RenderTemplate gathers information about interfaces and renders the liquid template
func (*Instance) SyncInterfaces ¶ added in v1.6.0
SyncInterfaces ensures the state of the interfaces matches the configuration files
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
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