config

package
v1.0.0-alpha Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	OSLinux = "Linux"
)

All OS types, currently only used to distinguish Linux.

Variables

View Source
var LoadOptions = ini.LoadOptions{
	Insensitive:            true,
	AllowNonUniqueSections: true,
	AllowShadows:           true,
}

LoadOptions contains the options to load the config correctly.

Functions

This section is empty.

Types

type Config

type Config struct {
	Network `ini:"Network"`
	Peers   []Peer `ini:"Peer,,,nonunique"`
}

Config reflects a network configuration file.

func LoadConfigFromFile

func LoadConfigFromFile(filePath string) (*Config, error)

LoadConfigFromFile reads Config from given filePath.

func (*Config) GetPeerByID

func (p *Config) GetPeerByID(id string) (*Peer, bool)

GetPeerByID returns Peer of given ID.

type Network

type Network struct {
	ID     string `ini:"ID"`
	Subnet string `ini:"Subnet"`
}

Network reflects the Network section within a network configuration file.

type Peer

type Peer struct {
	wireguard.Interface `ini:"Peer"`
	wireguard.Peer      `ini:"Peer"`
	ID                  string `ini:"ID"`
	LocalSubnets        string `int:"LocalSubnets"`
	PublicInterface     string `ini:"PublicInterface,omitempty"`
	OS                  string `ini:"OS,omitempty"`
}

Peer reflects a Peer section within a network configuration file.

func (*Peer) AllowedIPsForPeer

func (p *Peer) AllowedIPsForPeer(peer *Peer) string

AllowedIPsForPeer returns the computed AllowedIPs at the perspective of given peer.

func (*Peer) IsBounceServer

func (p *Peer) IsBounceServer() bool

IsBounceServer returns true if the peer is capable of traffic relaying.

func (*Peer) IsLinux

func (p *Peer) IsLinux() bool

IsLinux returns true if OS is Linux.

func (*Peer) Validate

func (p *Peer) Validate() error

Validate returns the first error when validating the Peer.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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