openvpn

package
v0.0.0-...-be0919c Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2018 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bootstrap

func Bootstrap()

Bootstrap is called on program initialization time and registers various deserializers related to opepnvpn service

func NewClient

func NewClient(openvpnBinary string, config *ClientConfig, middlewares ...management.Middleware) openvpn.Process

NewClient creates openvpn client with given config params

Types

type ClientConfig

type ClientConfig struct {
	*config.GenericConfig
}

ClientConfig represents specific "openvpn as client" configuration

func NewClientConfigFromSession

func NewClientConfigFromSession(session *session.Session, configDir string, runtimeDir string) (*ClientConfig, error)

NewClientConfigFromSession creates client configuration structure for given VPNConfig, configuration dir to store serialized file args, and configuration filename to store other args TODO this will become the part of openvpn service consumer separate package

func (*ClientConfig) SetClientMode

func (c *ClientConfig) SetClientMode(serverIP string, serverPort int)

SetClientMode adds config arguments for openvpn behave as client

func (*ClientConfig) SetProtocol

func (c *ClientConfig) SetProtocol(protocol string)

SetProtocol specifies openvpn connection protocol type (tcp or udp)

type ConfigValidator

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

ConfigValidator represents structure which contains list of validating functions

func NewDefaultValidator

func NewDefaultValidator() *ConfigValidator

NewDefaultValidator returns ConfigValidator with predefined list of validating functions

func (*ConfigValidator) IsValid

func (v *ConfigValidator) IsValid(config *VPNConfig) error

IsValid function checks if provided config is valid against given config validator and returns first encountered error

type ServerConfig

type ServerConfig struct {
	*config.GenericConfig
}

ServerConfig defines openvpn in server mode configuration structure

func NewServerConfig

func NewServerConfig(
	runtimeDir string,
	configDir string,
	network, netmask string,
	secPrimitives *tls.Primitives,
	port int,
	protocol string,
) *ServerConfig

NewServerConfig creates server configuration structure from given basic parameters

func (*ServerConfig) SetProtocol

func (c *ServerConfig) SetProtocol(protocol string)

SetProtocol adds protocol option (tcp or udp)

func (*ServerConfig) SetServerMode

func (c *ServerConfig) SetServerMode(port int, network, netmask string)

SetServerMode sets a set of options for openvpn to act as server

func (*ServerConfig) SetTLSServer

func (c *ServerConfig) SetTLSServer()

SetTLSServer add tls-server option to config, also sets dh to none

type VPNConfig

type VPNConfig struct {
	RemoteIP        string `json:"remote"`
	RemotePort      int    `json:"port"`
	RemoteProtocol  string `json:"protocol"`
	TLSPresharedKey string `json:"TLSPresharedKey"`
	CACertificate   string `json:"CACertificate"`
}

VPNConfig structure represents VPN configuration options for given session

type ValidateConfig

type ValidateConfig func(config *VPNConfig) error

ValidateConfig is function which takes VPNConfig as argument, checks it and returns error if validation fails

Directories

Path Synopsis
dto
middlewares

Jump to

Keyboard shortcuts

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