config

package
v0.0.0-...-cb3ca1d Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2019 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInput           = errors.New("one or more input parameters is wrong")
	ErrFilePathIsEmpty = errors.New("filePath is empty")
	ErrCertNotExist    = errors.New("certificate doesn't exist in the config file")
	ErrCertCanNotRead  = errors.New("cannot read certificate file")
	ErrCertNotFound    = errors.New("certificate can not be found in the specified path")
	ErrCancel          = errors.New("canceled sending product config to session server")
)

Config errors

Functions

func Deploy

func Deploy(record reform.Record, rootDir, srvAddr string,
	login, pass string, params []byte) (string, error)

Deploy creates target directory, the name is equivalent to channel.ID or endpoint.Channel. In target directory, two files are created ("client.ovpn", "access.ovpn"): 1) "client.ovpn" - the file is filled with parameters from "srvAddr" (server host or ip address) and params (OpenVpn server configuration parameters) 2) "access.ovpn" - the file is filled "login" and "pass" parameters. rootDir - information about the location of the directory in which the directories with configuration files are stored.

func ParseCertFromFile

func ParseCertFromFile(caCertPath string) (string, error)

ParseCertFromFile Parsing TLS certificate from file

func PushConfig

func PushConfig(ctx context.Context, sessSrvConfig *srv.Config,
	logger *util.Logger, in *PushConfigReq) error

PushConfig push OpenVpn config to Session Server Hostname or ip address and port from Session Server is taken from sessSrvConfig. Function can be canceled via context. username and password needed for access the product in the database. The confPath, caPath are absolute paths to OpenVpn config and Ca files, In variable keys the list of keys for parsing. The timeout in seconds between attempts to send data to the server must be specified in variable retrySec

func ServerConfig

func ServerConfig(filePath string, withCa bool,
	keys []string) (map[string]string, error)

ServerConfig parsing OpenVpn config file and parsing certificate from file.

Types

type PushConfigReq

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

PushConfigReq the parameters that are needed to send the configuration to the server

func NewPushConfigReq

func NewPushConfigReq(username, password, confPath,
	caPath string, keys []string, retrySec int64) *PushConfigReq

NewPushConfigReq fills the request structure

Jump to

Keyboard shortcuts

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