Documentation ¶
Index ¶
- Variables
- func Deploy(record reform.Record, rootDir, srvAddr string, login, pass string, ...) (string, error)
- func ParseCertFromFile(caCertPath string) (string, error)
- func PushConfig(ctx context.Context, sessSrvConfig *srv.Config, logger *util.Logger, ...) error
- func ServerConfig(filePath string, withCa bool, keys []string) (map[string]string, error)
- type PushConfigReq
Constants ¶
This section is empty.
Variables ¶
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 ¶
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
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