config

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2019 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateTrustEvaluator

func CreateTrustEvaluator(peers Peers) trust.Evaluator

CreateTrustEvaluator maps a peer config map into an evaluator that returns the configured trust levels

Types

type Peer

type Peer struct {
	Name  string
	Trust *trust.Level
}

Peer represents the parsed info about a peer read from the config file

func (*Peer) String

func (p *Peer) String() string

type PeerData

type PeerData struct {
	PublicKey string
	Name      string
	Trust     string
}

PeerData represents the raw data to configure a peer read from the config file

func (*PeerData) Parse

func (p *PeerData) Parse() (key wgtypes.Key, peer Peer, err error)

Parse validates the info in the PeerData and returns the parsed tuple + error

type Peers

type Peers map[wgtypes.Key]*Peer

Peers represents a set of peer configs, with handy access methods that avoid boiler plate for peers that are not configured

func (Peers) Name

func (p Peers) Name(peer wgtypes.Key) string

Name returns the name of the peer, if configured, or else its key string

func (Peers) Trust

func (p Peers) Trust(peer wgtypes.Key, def trust.Level) trust.Level

Trust returns the configured trust level (if present and valid) or else the provided default

type Server

type Server struct {
	Iface    string
	Port     int
	IsRouter bool
	Peers    Peers
}

Server describes the configuration for the server, after parsing from various sources

Jump to

Keyboard shortcuts

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