config

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMissingPublicKey = errors.New("missing public key")
	ErrMissingSecretKey = errors.New("missing private key")
)

Functions

This section is empty.

Types

type File

type File struct {
	// A filename containing this nodes raw public key
	PublicKey string `toml:"public_key" comment:"A filename containing this nodes raw public key"`

	// A filename containing this nodes raw secret key
	SecretKey string `toml:"secret_key" comment:"A filename containing this nodes raw secret key"`

	// A host:port pair to identify the interface and port to listen for handshake messages
	ListenAddrs []string `toml:"listen,omitempty" comment:"A host:port pair to identify the interface and port to listen for handshake messages"`

	// Use eBPF to listen and share the same port with an existing WireGuard interface
	ListenSinglePort bool `toml:"single_port,omitempty"`

	// Set to 'Verbose' or 'Quiet'
	Verbosity string `toml:"verbosity,omitempty" comment:"Set to 'Verbose' or 'Quiet'"`

	// A table of peers
	Peers []PeerSection `toml:"peers,omitempty" comment:"A table of peers"`
}

func FromArgs

func FromArgs(args []string) (_ []string, cfg File, err error)

FromArgs parses exchange config from CLI args Format: private-key <file-path> public-key <file-path> [ OPTIONS ] PEERS.

func FromWireGuardInterface added in v0.4.0

func FromWireGuardInterface(intfName string) (cfgFile File, err error)

func (*File) Dump

func (f *File) Dump(w io.Writer) error

func (*File) DumpFile

func (f *File) DumpFile(fn string) error

func (*File) FromConfig

func (f *File) FromConfig(c rp.Config, dir string) (err error)

func (*File) Load

func (f *File) Load(r io.Reader) error

func (*File) LoadFile

func (f *File) LoadFile(fn string) error

func (*File) ToConfig

func (f *File) ToConfig() (c rp.Config, err error)

type PeerSection

type PeerSection struct {
	// The peer’s public key
	PublicKey string `toml:"public_key" comment:"The peer’s public key"`

	// The peers's endpoint
	Endpoint *string `toml:"endpoint" comment:"The peers's endpoint"`

	// The peer's pre-shared key
	PresharedKey *string `toml:"pre_shared_key" comment:"The peer's pre-shared key"`

	// A path to a file to which we will write the base64-encoded PSK after each handshake
	KeyOut *string `toml:"key_out" comment:"A path to a file to which we will write the base64-encoded PSK after each handshake"`

	// A command which is executed after each completed handshake
	ExchangeCommand []string `toml:"exchange_command,multiline,omitempty" comment:"A command which is executed after each completed handshake"`

	// Settings for directly configuring a WireGuard peer with the negotiated PSK
	WireGuard *WireGuardSection `toml:"wireguard,inline" comment:"Settings for directly configuring a WireGuard peer with the negotiated PSK"`
}

func PeerConfigFromArgs

func PeerConfigFromArgs(args []string) (_ []string, cfg PeerSection, err error)

Parse peer config from CLI arguments Format: peer public-key <file-path> [endpoint <ip>[:<port>]] [preshared-key <file-path>] [outfile <file-path>] [wireguard <dev> <peer> <extra_params>].

func (*PeerSection) FromConfig

func (ps *PeerSection) FromConfig(pc rp.PeerConfig, dir string) (err error)

func (*PeerSection) ToConfig

func (ps *PeerSection) ToConfig() (pc rp.PeerConfig, err error)

type WireGuardSection

type WireGuardSection struct {
	// The peers network interface name
	Interface string `toml:"interface"`

	// The peers WireGuard (not Rosenpass') PublicKey
	PublicKey rp.Key `toml:"public_key"`
}

Jump to

Keyboard shortcuts

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