Documentation ¶
Overview ¶
Package config provides code for working with both the wirelink command line arguments and its configuration file.
Index ¶
- Constants
- func CreateTrustEvaluator(peers Peers) trust.Evaluator
- func Init(args []string) (flags *pflag.FlagSet, vcfg *viper.Viper)
- type Peer
- type PeerData
- type PeerEndpoint
- type Peers
- func (p Peers) AllowedIPs(peer wgtypes.Key) []net.IPNet
- func (p Peers) AnyTrustedAt(level trust.Level) bool
- func (p Peers) Endpoints(peer wgtypes.Key) []PeerEndpoint
- func (p Peers) Has(peer wgtypes.Key) bool
- func (p Peers) IsBasic(peer wgtypes.Key) bool
- func (p Peers) IsFactExchanger(peer wgtypes.Key) bool
- func (p Peers) Name(peer wgtypes.Key) string
- func (p Peers) Trust(peer wgtypes.Key, def trust.Level) trust.Level
- type Server
- type ServerData
Constants ¶
const ( // RouterFlag is the name of the flag to set router mode RouterFlag = "router" // IfaceFlag is the name of the flag to set the wireguard interface to use IfaceFlag = "iface" // DumpConfigFlag is the name of the flag to request config dumping DumpConfigFlag = "dump" // VersionFlag is the name of the flag to request printing the program version VersionFlag = "version" // HelpFlag is the name of the flag to request printing program usage HelpFlag = "help" // ConfigPathFlag is the name of the setting for the config file base path ConfigPathFlag = "config-path" // DebugFlag enables debug logging DebugFlag = "debug" // ChattyFlag is the name of the setting to enable chatty mode ChattyFlag = "chatty" )
Variables ¶
This section is empty.
Functions ¶
func CreateTrustEvaluator ¶
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 FactExchanger bool Endpoints []PeerEndpoint AllowedIPs []net.IPNet Basic bool }
Peer represents the parsed info about a peer read from the config file
type PeerData ¶
type PeerData struct { PublicKey string Name string Trust string FactExchanger bool Endpoints []string AllowedIPs []string Basic bool }
PeerData represents the raw data to configure a peer read from the config file
type PeerEndpoint ¶ added in v0.7.1
PeerEndpoint represents a single endpoint (possibly by hostname) for a peer
type Peers ¶
Peers represents a set of peer configs, with handy access methods that avoid boiler plate for peers that are not configured
func (Peers) AllowedIPs ¶ added in v0.7.1
AllowedIPs returns the array of AllowedIPs explicitly configured for the peer, if any
func (Peers) AnyTrustedAt ¶ added in v0.9.0
AnyTrustedAt returns whether any peer is configured with a trust level of at least the given level
func (Peers) Endpoints ¶ added in v0.7.1
func (p Peers) Endpoints(peer wgtypes.Key) []PeerEndpoint
Endpoints returns the array of Endpoints explicitly configured for the peer, if any
func (Peers) IsBasic ¶ added in v0.5.0
IsBasic returns true if the peer is explicitly configured as a basic peer, or false otherwise
func (Peers) IsFactExchanger ¶ added in v0.3.1
IsFactExchanger returns true if the peer is configured as a FactExchanger
type Server ¶
type Server struct { Iface string Port int Chatty bool AutoDetectRouter bool IsRouterNow bool ReportIfaces []string HideIfaces []string Peers Peers Debug bool }
Server describes the configuration for the server, after parsing from various sources
func (*Server) ShouldReportIface ¶ added in v0.8.1
ShouldReportIface checks a given local network interface name against the config for whether we should tell other peers about our configuration on it
type ServerData ¶ added in v0.3.0
type ServerData struct { Iface string Port int Router *bool Chatty bool Peers []PeerData ReportIfaces []string HideIfaces []string Debug bool Dump bool Help bool Version bool // Deprecated: this prop is here for compat, but is ignored because it's how we find the // config file, so the config file can't use it to point at a different config. // with newer versions of mapstructure, can't get away with making this an un-exported member. ConfigPath string `mapstructure:"config-path"` }
ServerData represents the raw data from the config for the server, before it is cleaned up into a `Server` config object.