preferences

package
Version: v0.0.0-...-846a3b6 Latest Latest
Warning

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

Go to latest
Published: May 14, 2021 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultWGKeysInterval - Default WireGuard keys rotation interval
	DefaultWGKeysInterval = time.Hour * 24 * 1
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountStatus

type AccountStatus struct {
	Active         bool
	ActiveUntil    int64
	CurrentPlan    string
	PaymentMethod  string
	IsRenewable    bool
	WillAutoRebill bool
	IsFreeTrial    bool
	Capabilities   []string
	Upgradable     bool
	UpgradeToPlan  string
	UpgradeToURL   string
	Limit          int
}

AccountStatus contains information about current account

type Preferences

type Preferences struct {
	IsLogging                bool
	IsFwPersistant           bool
	IsFwAllowLAN             bool
	IsFwAllowLANMulticast    bool
	IsStopOnClientDisconnect bool
	IsObfsproxy              bool

	// last known account status
	Session SessionStatus
}

Preferences - IVPN service preferences

func (*Preferences) LoadPreferences

func (p *Preferences) LoadPreferences() error

LoadPreferences loads preferences

func (*Preferences) SavePreferences

func (p *Preferences) SavePreferences() error

SavePreferences saves preferences

func (*Preferences) SetSession

func (p *Preferences) SetSession(accountID string,
	session string,
	vpnUser string,
	vpnPass string,
	wgPublicKey string,
	wgPrivateKey string,
	wgLocalIP string)

SetSession save account credentials

func (*Preferences) UpdateWgCredentials

func (p *Preferences) UpdateWgCredentials(wgPublicKey string, wgPrivateKey string, wgLocalIP string)

UpdateWgCredentials save wireguard credentials

type SessionStatus

type SessionStatus struct {
	AccountID          string
	Session            string `json:",omitempty"`
	OpenVPNUser        string `json:",omitempty"`
	OpenVPNPass        string `json:",omitempty"`
	WGPublicKey        string
	WGPrivateKey       string `json:",omitempty"`
	WGLocalIP          string
	WGKeyGenerated     time.Time
	WGKeysRegenInerval time.Duration // syntax error in variable name. Keeping it as is for compatibility with previous versions
}

SessionStatus contains information about current session

func (*SessionStatus) IsLoggedIn

func (s *SessionStatus) IsLoggedIn() bool

IsLoggedIn returns 'true' when user logged-in

func (*SessionStatus) IsWGCredentialsOk

func (s *SessionStatus) IsWGCredentialsOk() bool

IsWGCredentialsOk returns 'true' when WireGuard credentials are initialized

Jump to

Keyboard shortcuts

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