Documentation ¶
Index ¶
- Variables
- func LoconfScanner(settings *settings.Settings, configDir string, interval time.Duration, ...) (stop func())
- func NewStatsTracker() *statsTracker
- func ShouldReportToSentry() bool
- type App
- func (app *App) AddExitFunc(label string, exitFunc func())
- func (app *App) AuthClient() auth.AuthClient
- func (app *App) Connect()
- func (app *App) CreateUser(ctx context.Context) (*protos.User, error)
- func (app *App) Disconnect()
- func (app *App) Exit(err error) bool
- func (app *App) FetchPaymentMethods(ctx context.Context) (*proclient.PaymentMethodsResponse, error)
- func (app *App) GetHasConfigFetched() bool
- func (app *App) GetHasProxyFetched() bool
- func (app *App) GetLanguage() string
- func (app *App) GetOnSuccess() bool
- func (app *App) GetPaymentMethods(ctx context.Context) ([]protos.PaymentMethod, error)
- func (app *App) GetTranslations(filename string) ([]byte, error)
- func (app *App) GetUserData(userID int64) (*protos.User, bool)
- func (app *App) HasSucceedingProxy() bool
- func (app *App) IsFeatureEnabled(feature string) bool
- func (app *App) IsPro() bool
- func (app *App) IsProUser(ctx context.Context, uc common.UserConfig) (isPro bool, ok bool)
- func (app *App) IsProUserFast(uc common.UserConfig) (isPro bool, statusKnown bool)
- func (app *App) IsUserLoggedIn() bool
- func (app *App) LogPanicAndExit(msg string)
- func (app *App) OnSettingChange(attr settings.SettingName, cb func(interface{}))
- func (app *App) OnStatsChange(fn func(stats.Stats))
- func (app *App) Plans(ctx context.Context) ([]protos.Plan, error)
- func (app *App) ProClient() pro.ProClient
- func (app *App) ProxyAddrReachable(ctx context.Context) error
- func (app *App) Run(ctx context.Context)
- func (app *App) SendConfig()
- func (app *App) SendMessageToUI(service string, message interface{})
- func (app *App) SendUpdateUserDataToUI()
- func (app *App) SetLanguage(lang string)
- func (app *App) SetUserData(ctx context.Context, userID int64, u *protos.User)
- func (app *App) SetUserDevices(userID int64, devices []*protos.Device)
- func (app *App) SetUserLoggedIn(value bool)
- func (app *App) Settings() *settings.Settings
- func (app *App) Stats() stats.Stats
- func (app *App) SysProxyOff() error
- func (app *App) SysproxyOn() error
- func (app *App) UserData(ctx context.Context) (*protos.User, error)
- func (app *App) WaitForExit() error
- func (app *App) WebsocketAddr() string
- type ChatOptions
- type ConfigOptions
- type Tab
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func LoconfScanner ¶
func LoconfScanner(settings *settings.Settings, configDir string, interval time.Duration, proChecker func() (bool, bool), iconURL func() string) (stop func())
LoconfScanner starts a goroutine to periodically check for new loconf files. This will show announcements via desktop notification. Each announcement is shown only once. It will also do things like check for updates to uninstall survey config
interval: The duration between each check.
proChecker: A function to check if current user is Pro (to decide whether show the announcement or not).
Returns a function to stop the loop.
func NewStatsTracker ¶
func NewStatsTracker() *statsTracker
func ShouldReportToSentry ¶
func ShouldReportToSentry() bool
ShouldReportToSentry determines if we should report errors/panics to Sentry
Types ¶
type App ¶
type App struct { Flags flashlight.Flags // contains filtered or unexported fields }
App is the core of the Lantern desktop application, in the form of a library.
func NewApp ¶
NewApp creates a new desktop app that initializes the app and acts as a moderator between all desktop components.
func (*App) AddExitFunc ¶
AddExitFunc adds a function to be called before the application exits.
func (*App) AuthClient ¶
func (app *App) AuthClient() auth.AuthClient
func (*App) CreateUser ¶
CreateUser is used when Lantern is run for the first time and creates a new user with the pro server
func (*App) Exit ¶
Exit tells the application to exit, optionally supplying an error that caused the exit. Returns true if the app is actually exiting, false if exit has already been requested.
func (*App) FetchPaymentMethods ¶
FetchPaymentMethods returns the plans and payment plans available to a user
func (*App) GetHasConfigFetched ¶
func (*App) GetHasProxyFetched ¶
func (*App) GetLanguage ¶
GetLanguage returns the user language
func (*App) GetOnSuccess ¶
func (*App) GetPaymentMethods ¶
GetPaymentMethods returns the plans and payment from cache if available if not then call FetchPaymentMethods
func (*App) GetTranslations ¶
GetTranslations accesses translations with the given filename
func (*App) HasSucceedingProxy ¶
HasSucceedingProxy returns whether or not the app is currently configured with any succeeding proxies
func (*App) IsFeatureEnabled ¶
IsFeatureEnabled checks whether or not the given feature is enabled by flashlight
func (*App) IsProUserFast ¶
func (app *App) IsProUserFast(uc common.UserConfig) (isPro bool, statusKnown bool)
IsProUserFast indicates whether or not the user is pro and whether or not the user's status is know, never calling the Pro API to determine the status.
func (*App) IsUserLoggedIn ¶
func (*App) LogPanicAndExit ¶
is only used in the panicwrap parent process.
func (*App) OnSettingChange ¶
func (app *App) OnSettingChange(attr settings.SettingName, cb func(interface{}))
OnSettingChange sets a callback cb to get called when attr is changed from server. When calling multiple times for same attr, only the last one takes effect.
func (*App) OnStatsChange ¶
OnStatsChange adds a listener for Stats changes.
func (*App) ProxyAddrReachable ¶
ProxyAddrReachable checks if Lantern's HTTP proxy responds with the correct status within the deadline.
func (*App) SendConfig ¶
func (app *App) SendConfig()
func (*App) SendMessageToUI ¶
Create func that send message to UI
func (*App) SendUpdateUserDataToUI ¶
func (app *App) SendUpdateUserDataToUI()
func (*App) SetLanguage ¶
SetLanguage sets the user language
func (*App) SetUserData ¶
func (*App) SetUserLoggedIn ¶
func (*App) SysProxyOff ¶
func (*App) SysproxyOn ¶
func (*App) WaitForExit ¶
WaitForExit waits for a request to exit the application.
func (*App) WebsocketAddr ¶
type ChatOptions ¶
type ConfigOptions ¶
type ConfigOptions struct { DevelopmentMode bool `json:"developmentMode"` ReplicaAddr string `json:"replicaAddr"` HttpProxyAddr string `json:"httpProxyAddr"` SocksProxyAddr string `json:"socksProxyAddr"` AuthEnabled bool `json:"authEnabled"` ChatEnabled bool `json:"chatEnabled"` SplitTunneling bool `json:"splitTunneling"` HasSucceedingProxy bool `json:"hasSucceedingProxy"` FetchedGlobalConfig bool `json:"fetchedGlobalConfig"` FetchedProxiesConfig bool `json:"fetchedProxiesConfig"` Plans []protos.Plan `json:"plans"` PaymentMethods []protos.PaymentMethod `json:"paymentMethods"` Devices protos.Devices `json:"devices"` SdkVersion string `json:"sdkVersion"` AppVersion string `json:"appVersion"` DeviceId string `json:"deviceId"` ExpirationDate string `json:"expirationDate"` Chat ChatOptions `json:"chat"` ProxyAll bool `json:"proxyAll"` }
ConfigOptions are the config options that Lantern is running with