rait

package
v4.4.5 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2021 License: Apache-2.0 Imports: 17 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 Babeld

type Babeld struct {
	SocketType     string   `hcl:"socket_type,optional"`     // optional, control socket type, tcp or unix
	SocketAddr     string   `hcl:"socket_addr,optional"`     // optional, control socket address
	AddonInterface []string `hcl:"addon_interface,optional"` // optional, control socket address
	Param          string   `hcl:"param,optional"`           // optional, interfaces params
	ExtraCmd       string   `hcl:"extra_cmd,optional"`       // optional, additional command passed to socket at the end of sync
}

func (*Babeld) LinkAdd

func (b *Babeld) LinkAdd(name string) error

func (*Babeld) LinkDel

func (b *Babeld) LinkDel(name string) error
func (b *Babeld) LinkList() ([]string, error)

func (*Babeld) LinkSync

func (b *Babeld) LinkSync(target []string) error

func (*Babeld) WriteCommand

func (b *Babeld) WriteCommand(command string) (*bytes.Buffer, error)

type Endpoint

type Endpoint struct {
	AddressFamily string `hcl:"address_family,attr"`    // mandatory, socket address family, ip4 or ip6
	Mac           string `hcl:"mac,optional"`           // optional, mac address
	Port          int    `hcl:"port,attr"`              // mandatory, socket listen port
	InnerAddress  string `hcl:"inner_address,optional"` // optional, remote inner address
	Address       string `hcl:"address,optional"`       // optional, ip address or resolvable domain name
}

type Isolation

type Isolation struct {
	IFGroup int    `hcl:"ifgroup,attr"`     // mandatory, interface group, for recognizing managed interfaces
	Transit string `hcl:"transit,optional"` // optional, the namespace to create sockets in
	Target  string `hcl:"target,optional"`  // optional, the namespace to move interfaces into
}

type Peer

type Peer struct {
	PublicKey string   `hcl:"public_key,attr"` // mandatory, wireguard public key, base64 encoded
	Name      string   `hcl:"name,optional"`   // optional, peer human readable name
	Remarks   hcl.Body `hcl:"remarks,remain"`  // optional, additional information
	Endpoint  Endpoint `hcl:"endpoint,block"`  // mandatory, node endpoints
}

func NewPeers

func NewPeers(path string, privateKeys []wgtypes.Key) ([]Peer, error)

func (*Peer) GenerateInnerAddress

func (s *Peer) GenerateInnerAddress() net.IP

func (*Peer) GenerateMac

func (s *Peer) GenerateMac() net.HardwareAddr

type Peers

type Peers struct {
	Peers []Peer `hcl:"peers,block"`
}

type RAIT

type RAIT struct {
	Name      string      `hcl:"name,optional"`   // optional, human readable node name
	Peers     string      `hcl:"peers,attr"`      // mandatory, list of peers, in hcl format
	Transport []Transport `hcl:"transport,block"` // mandatory, underlying transport for wireguard sockets
	Isolation *Isolation  `hcl:"isolation,block"` // optional, params for the separation of underlay and overlay
	Babeld    *Babeld     `hcl:"babeld,block"`    // optional, integration with babeld
	Remarks   hcl.Body    `hcl:"remarks,remain"`  // optional, additional information
}

RAIT is the model corresponding to rait.conf, for default value of fields, see NewRAIT

func NewRAIT

func NewRAIT(path string) (*RAIT, error)

func (*RAIT) List

func (r *RAIT) List() ([]misc.Link, error)

func (*RAIT) Load

func (r *RAIT) Load() ([]misc.Link, error)

func (*RAIT) PublicConf

func (r *RAIT) PublicConf(dest string) error

func (*RAIT) Sync

func (r *RAIT) Sync(up bool) error

type Transport

type Transport struct {
	PrivateKey    string `hcl:"private_key,attr"`       // mandatory, wireguard private key, base64 encoded
	AddressFamily string `hcl:"address_family,attr"`    // mandatory, socket address family, ip4 or ip6
	Port          int    `hcl:"port,attr"`              // mandatory, socket listen port
	MTU           int    `hcl:"mtu,attr"`               // mandatory, interface mtu
	IFPrefix      string `hcl:"ifprefix,attr"`          // mandatory, interface naming prefix, should not collide between transports
	InnerAddress  string `hcl:"inner_address,optional"` //optional, interface inner ip, should not collide in a network
	Mac           string `hcl:"mac,optional"`
	VNI           int    `hcl:"vni"`
	Address       string `hcl:"address,optional"`      // optional, public ip address or resolvable domain name
	BindAddress   string `hcl:"bind_addr,optional"`    // optional, socket bind address, only has effect when -b is set
	FwMark        int    `hcl:"fwmark,optional"`       // optional, fwmark set on out going packets
	RandomPort    bool   `hcl:"random_port,optional"`  // optional, whether to randomize listen port
	WgGoInterface string `hcl:"go_interface,optional"` // optional, use userspace wireguard instead of kernel module
}

Jump to

Keyboard shortcuts

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