Documentation
¶
Index ¶
- Constants
- func GetFriendlyDeviceName() string
- func GetIconsPath() string
- func GetLogDir() string
- func GetProgramDataDir() string
- func GetSystemLogLevel() string
- type Account
- type AccountManager
- func (m *AccountManager) ActiveAccount() (*Account, error)
- func (m *AccountManager) AddAccount(account Account) error
- func (m *AccountManager) RemoveAccount(userID string) error
- func (m *AccountManager) Save() error
- func (m *AccountManager) SetActiveUser(userID string) error
- func (m *AccountManager) SetUserOrganization(userID string, orgID string) error
- func (m *AccountManager) UpdateAccountUserInfo(userID, username, name string) error
- type Config
- type ConfigManager
- func (cm *ConfigManager) Clear() bool
- func (cm *ConfigManager) GetAuthPath() string
- func (cm *ConfigManager) GetConfig() *Config
- func (cm *ConfigManager) GetConfigCopy() *Config
- func (cm *ConfigManager) GetDNSOverride() bool
- func (cm *ConfigManager) GetDNSTunnel() bool
- func (cm *ConfigManager) GetDefaultServerURL() string
- func (cm *ConfigManager) GetOpenStatusTabOnConnect() bool
- func (cm *ConfigManager) GetPrimaryDNS() string
- func (cm *ConfigManager) GetSecondaryDNS() string
- func (cm *ConfigManager) GetUserSettingsDisabled() bool
- func (cm *ConfigManager) Load() *Config
- func (cm *ConfigManager) Save(cfg *Config) bool
- func (cm *ConfigManager) SetAuthPath(value string) bool
- func (cm *ConfigManager) SetDNSOverride(value bool) bool
- func (cm *ConfigManager) SetDNSTunnel(value bool) bool
- func (cm *ConfigManager) SetDefaultServerURL(value string) bool
- func (cm *ConfigManager) SetPrimaryDNS(value string) bool
- func (cm *ConfigManager) SetSecondaryDNS(value string) bool
- func (cm *ConfigManager) SetUserSettingsDisabled(disabled bool) bool
- type SystemConfig
Constants ¶
const ( AppName = "Pangolin" DefaultHostname = "https://app.pangolin.net" ConfigFileName = "pangolin.json" LogLevel = "info" DefaultPrimaryDNS = "1.1.1.1" DefaultDNSOverride = true DefaultDNSTunnel = false )
const (
AccountsFileName = "accounts.json"
)
Variables ¶
This section is empty.
Functions ¶
func GetFriendlyDeviceName ¶
func GetFriendlyDeviceName() string
GetFriendlyDeviceName returns a friendly device name like "Windows Laptop" or "Windows Desktop" It attempts to detect the device type by checking for battery presence
func GetIconsPath ¶
func GetIconsPath() string
GetIconsPath returns the directory path for icon files
func GetProgramDataDir ¶
func GetProgramDataDir() string
GetProgramDataDir returns the base ProgramData directory for the application The installer should create this directory and place application files here
func GetSystemLogLevel ¶
func GetSystemLogLevel() string
GetSystemLogLevel returns the log level from the system config file
Types ¶
type AccountManager ¶
type AccountManager struct {
ActiveUserID string `json:"activeUserId"`
Accounts map[string]Account `json:"accounts"`
// contains filtered or unexported fields
}
func NewAccountManager ¶
func NewAccountManager() *AccountManager
func (*AccountManager) ActiveAccount ¶
func (m *AccountManager) ActiveAccount() (*Account, error)
func (*AccountManager) AddAccount ¶
func (m *AccountManager) AddAccount(account Account) error
func (*AccountManager) RemoveAccount ¶
func (m *AccountManager) RemoveAccount(userID string) error
func (*AccountManager) Save ¶
func (m *AccountManager) Save() error
func (*AccountManager) SetActiveUser ¶
func (m *AccountManager) SetActiveUser(userID string) error
func (*AccountManager) SetUserOrganization ¶
func (m *AccountManager) SetUserOrganization(userID string, orgID string) error
func (*AccountManager) UpdateAccountUserInfo ¶
func (m *AccountManager) UpdateAccountUserInfo(userID, username, name string) error
type Config ¶
type Config struct {
DNSOverride *bool `json:"dnsOverride,omitempty"`
DNSTunnel *bool `json:"dnsTunnel,omitempty"`
PrimaryDNS *string `json:"primaryDNS,omitempty"`
SecondaryDNS *string `json:"secondaryDNS,omitempty"`
DefaultServerURL *string `json:"defaultServerURL,omitempty"`
UserSettingsDisabled *bool `json:"userSettingsDisabled,omitempty"`
AuthPath *string `json:"authPath,omitempty"`
OpenStatusTabOnConnect *bool `json:"openStatusTabOnConnect,omitempty"`
}
Config represents the per-user application configuration stored under %LOCALAPPDATA%\Pangolin\pangolin.json (or %APPDATA% as a fallback).
type ConfigManager ¶
type ConfigManager struct {
// contains filtered or unexported fields
}
ConfigManager manages loading and saving of application configuration
func NewConfigManager ¶
func NewConfigManager() *ConfigManager
NewConfigManager creates a new ConfigManager instance
func (*ConfigManager) Clear ¶
func (cm *ConfigManager) Clear() bool
Clear clears user-specific fields Returns true if successful
func (*ConfigManager) GetAuthPath ¶
func (cm *ConfigManager) GetAuthPath() string
GetAuthPath returns the auth path query value for login URLs, or empty string if not set
func (*ConfigManager) GetConfig ¶
func (cm *ConfigManager) GetConfig() *Config
GetConfig returns the current configuration (do not modify; use GetConfigCopy for that)
func (*ConfigManager) GetConfigCopy ¶
func (cm *ConfigManager) GetConfigCopy() *Config
GetConfigCopy returns a deep copy of the current configuration. Callers can modify the copy and pass it to Save to update only specific fields while preserving others.
func (*ConfigManager) GetDNSOverride ¶
func (cm *ConfigManager) GetDNSOverride() bool
GetDNSOverride returns the DNS override setting from config or the default value
func (*ConfigManager) GetDNSTunnel ¶
func (cm *ConfigManager) GetDNSTunnel() bool
GetDNSTunnel returns the DNS tunnel setting from config or false if not set
func (*ConfigManager) GetDefaultServerURL ¶
func (cm *ConfigManager) GetDefaultServerURL() string
GetDefaultServerURL returns the default server URL from config or empty string if not set
func (*ConfigManager) GetOpenStatusTabOnConnect ¶
func (cm *ConfigManager) GetOpenStatusTabOnConnect() bool
GetOpenStatusTabOnConnect returns whether the tray Connect action should open the preferences window directly on the Status tab after a successful connect.
func (*ConfigManager) GetPrimaryDNS ¶
func (cm *ConfigManager) GetPrimaryDNS() string
GetPrimaryDNS returns the primary DNS server from config or the default value
func (*ConfigManager) GetSecondaryDNS ¶
func (cm *ConfigManager) GetSecondaryDNS() string
GetSecondaryDNS returns the secondary DNS server from config or empty string if not set
func (*ConfigManager) GetUserSettingsDisabled ¶
func (cm *ConfigManager) GetUserSettingsDisabled() bool
GetUserSettingsDisabled returns whether user settings are disabled (e.g. by admin policy)
func (*ConfigManager) Load ¶
func (cm *ConfigManager) Load() *Config
Load loads the configuration from the file This is a public method that can be called to reload the config
func (*ConfigManager) Save ¶
func (cm *ConfigManager) Save(cfg *Config) bool
Save saves the configuration to the file Returns true if successful, false otherwise
func (*ConfigManager) SetAuthPath ¶
func (cm *ConfigManager) SetAuthPath(value string) bool
SetAuthPath sets the auth path and saves to config
func (*ConfigManager) SetDNSOverride ¶
func (cm *ConfigManager) SetDNSOverride(value bool) bool
SetDNSOverride sets the DNS override setting and saves to config
func (*ConfigManager) SetDNSTunnel ¶
func (cm *ConfigManager) SetDNSTunnel(value bool) bool
SetDNSTunnel sets the DNS tunnel setting and saves to config
func (*ConfigManager) SetDefaultServerURL ¶
func (cm *ConfigManager) SetDefaultServerURL(value string) bool
SetDefaultServerURL sets the default server URL and saves to config
func (*ConfigManager) SetPrimaryDNS ¶
func (cm *ConfigManager) SetPrimaryDNS(value string) bool
SetPrimaryDNS sets the primary DNS server and saves to config
func (*ConfigManager) SetSecondaryDNS ¶
func (cm *ConfigManager) SetSecondaryDNS(value string) bool
SetSecondaryDNS sets the secondary DNS server and saves to config
func (*ConfigManager) SetUserSettingsDisabled ¶
func (cm *ConfigManager) SetUserSettingsDisabled(disabled bool) bool
SetUserSettingsDisabled sets whether user settings are disabled and saves to config
type SystemConfig ¶
SystemConfig represents machine-wide configuration stored under %ProgramData%\Pangolin\pangolin.json. It supports the same settings as per-user config plus system-only fields like log level.
func LoadSystemConfig ¶
func LoadSystemConfig() *SystemConfig