openvpn

package
v0.0.0-...-0ef06cd Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrorConfigsNotFound indicates that no openvpn configuration files were found in the specified path.
	ErrorConfigsNotFound = errors.New("no valid openvpn configuration files were found")

	// ErrorNoUnusedConfigs indicates that all given configurations have been used previously.
	ErrorNoUnusedConfigs = errors.New("no unused openvpn configuration files were found")
)

Functions

This section is empty.

Types

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager is a type that is used to configure and control a instances of OpenVPN.

func NewManager

func NewManager(configsDir, auth, args string) (*Manager, error)

NewManager returns a configured instance of *Manager.

func (*Manager) Backup

func (v *Manager) Backup() (string, error)

Backup is meant to be used after starting an OpenVPN instance fails. This function attempts to start an instance of OpenVPN and returns the config used to spawn the instance if successful in trying to do so.

func (*Manager) IsConfigUsed

func (v *Manager) IsConfigUsed(config string) bool

IsConfigUsed returns true if the provided config has been used before.

func (*Manager) Restart

func (v *Manager) Restart(config string) error

Restart restarts the currently running instance of OpenVPN with the provided config.

func (*Manager) Start

func (v *Manager) Start(config string) error

Start spawns a new instance of OpenVPN with the provided config.

func (*Manager) Stop

func (v *Manager) Stop() error

Stop attemps to stop the currently running instance of OpenVPN.

func (*Manager) UseConfig

func (v *Manager) UseConfig(config string)

UseConfig adds the provided config to a cache of previously used config files.

Jump to

Keyboard shortcuts

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