config

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	CredentialsFilePath string `json:"credentials_file_path"`
	ShowConsoleLog      bool   `json:"show_console_log"`
}

func (*Config) Validate

func (c *Config) Validate() error

type Credentials

type Credentials struct {
	Server    string `json:"server"`
	Username  string `json:"username"`
	Password  string `json:"password"`
	Group     int    `json:"group"`
	OTPSecret string `json:"otp_secret"`
}

func (*Credentials) Validate

func (c *Credentials) Validate() error

type Manager

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

func NewManager

func NewManager() *Manager

func (*Manager) ConfigExists

func (m *Manager) ConfigExists() bool

ConfigExists checks if the configuration file is present

func (*Manager) ConfigPath

func (m *Manager) ConfigPath() string

ConfigPath returns the path to the main application configuration file

func (*Manager) GetConfig

func (m *Manager) GetConfig() *Config

GetConfig returns the current configuration, loading it if necessary

func (*Manager) LoadConfig

func (m *Manager) LoadConfig() error

LoadConfig reads the configuration from the file system

func (*Manager) LoadCredentials

func (m *Manager) LoadCredentials(password string, path string) (*Credentials, error)

LoadCredentials reads and decrypts VPN credentials from a file

func (*Manager) SaveConfig

func (m *Manager) SaveConfig(cfg *Config) error

SaveConfig persists the configuration to disk and updates in-memory state

func (*Manager) SaveCredentials

func (m *Manager) SaveCredentials(creds *Credentials, password string, path string) error

SaveCredentials encrypts and saves VPN credentials to a file

Jump to

Keyboard shortcuts

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