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, Apache-2.0 Imports: 8 Imported by: 0

README

openvpn-go

openvpn-go is an extremenly rudimentary wrapper over the OpenVPN linux CLI.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrorConfigNotFound is returned when a specified OpenVPN file is not found.
	ErrorConfigNotFound = errors.New("specified openvpn config not found")

	// ErrorNoVpnProcess is returned when a user attempts to stop an OpenVPN instance that
	// does not exist.
	ErrorNoVpnProcess = errors.New("no openvpn processes were found")
)

Functions

func Restart

func Restart(
	process *cmd.Cmd,
	config, auth, args string,
	timeout time.Duration,
) (*cmd.Cmd, <-chan cmd.Status, error)

Restart is a function which attempts to restart the OpenVPN process with the provided configuration, credentials and arguments.

func Start

func Start(config, auth, args string, timeout time.Duration) (*cmd.Cmd, <-chan cmd.Status, error)

Start spawns an OpenVPN process with the provided configuration, credentials and arguments and returns *cmd.Cmd and [<-chan cmd.Status] for controlling and monitoring the spawned process.

func Stop

func Stop(process *cmd.Cmd) (err error)

Stop is a function which attempts to stop the provided OpenVPN process. ErrorNoVpnProcess is returned if there is no process found matching the details of the provided process.

Types

type ErrorVpnFailure

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

ErrorVpnFailure is returned when the OpenVPN process fails to start-up.

func (ErrorVpnFailure) Error

func (e ErrorVpnFailure) Error() string

type ErrorVpnTimedOut

type ErrorVpnTimedOut struct{ Msg string }

ErrorVpnTimedOut is returned when the OpenVPN proccess doesn't launch within the specified timeout.

func (ErrorVpnTimedOut) Error

func (e ErrorVpnTimedOut) Error() string

Jump to

Keyboard shortcuts

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