app

package
v0.0.0-...-b80b294 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2024 License: GPL-3.0 Imports: 55 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMissingTab = errors.New("missing tab")
	AccountTab    = Tab("account")
	DeveloperTab  = Tab("developer")
	VPNTab        = Tab("vpn")
	UnknownTab    = Tab("")
)

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

func NewApp(flags flashlight.Flags, configDir string) *App

NewApp creates a new desktop app that initializes the app and acts as a moderator between all desktop components.

func (*App) AddExitFunc

func (app *App) AddExitFunc(label string, exitFunc func())

AddExitFunc adds a function to be called before the application exits.

func (*App) AuthClient

func (app *App) AuthClient() auth.AuthClient

func (*App) Connect

func (app *App) Connect()

Connect turns on proxying

func (*App) CreateUser

func (app *App) CreateUser(ctx context.Context) (*protos.User, error)

CreateUser is used when Lantern is run for the first time and creates a new user with the pro server

func (*App) Disconnect

func (app *App) Disconnect()

Disconnect turns off proxying

func (*App) Exit

func (app *App) Exit(err error) bool

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

func (app *App) FetchPaymentMethods(ctx context.Context) (*proclient.PaymentMethodsResponse, error)

FetchPaymentMethods returns the plans and payment plans available to a user

func (*App) GetHasConfigFetched

func (app *App) GetHasConfigFetched() bool

func (*App) GetHasProxyFetched

func (app *App) GetHasProxyFetched() bool

func (*App) GetLanguage

func (app *App) GetLanguage() string

GetLanguage returns the user language

func (*App) GetOnSuccess

func (app *App) GetOnSuccess() bool

func (*App) GetPaymentMethods

func (app *App) GetPaymentMethods(ctx context.Context) ([]protos.PaymentMethod, error)

GetPaymentMethods returns the plans and payment from cache if available if not then call FetchPaymentMethods

func (*App) GetTranslations

func (app *App) GetTranslations(filename string) ([]byte, error)

GetTranslations accesses translations with the given filename

func (*App) GetUserData

func (app *App) GetUserData(userID int64) (*protos.User, bool)

func (*App) HasSucceedingProxy

func (app *App) HasSucceedingProxy() bool

HasSucceedingProxy returns whether or not the app is currently configured with any succeeding proxies

func (*App) IsFeatureEnabled

func (app *App) IsFeatureEnabled(feature string) bool

IsFeatureEnabled checks whether or not the given feature is enabled by flashlight

func (*App) IsPro

func (app *App) IsPro() bool

IsPro indicates whether or not the app is pro

func (*App) IsProUser

func (app *App) IsProUser(ctx context.Context, uc common.UserConfig) (isPro bool, ok bool)

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 *App) IsUserLoggedIn() bool

func (*App) LogPanicAndExit

func (app *App) LogPanicAndExit(msg string)

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

func (app *App) OnStatsChange(fn func(stats.Stats))

OnStatsChange adds a listener for Stats changes.

func (*App) Plans

func (app *App) Plans(ctx context.Context) ([]protos.Plan, error)

Plans returns the plans available to a user

func (*App) ProClient

func (app *App) ProClient() pro.ProClient

func (*App) ProxyAddrReachable

func (app *App) ProxyAddrReachable(ctx context.Context) error

ProxyAddrReachable checks if Lantern's HTTP proxy responds with the correct status within the deadline.

func (*App) Run

func (app *App) Run(ctx context.Context)

Run starts the app.

func (*App) SendConfig

func (app *App) SendConfig()

func (*App) SendMessageToUI

func (app *App) SendMessageToUI(service string, message interface{})

Create func that send message to UI

func (*App) SendUpdateUserDataToUI

func (app *App) SendUpdateUserDataToUI()

func (*App) SetLanguage

func (app *App) SetLanguage(lang string)

SetLanguage sets the user language

func (*App) SetUserData

func (app *App) SetUserData(ctx context.Context, userID int64, u *protos.User)

func (*App) SetUserDevices

func (app *App) SetUserDevices(userID int64, devices []*protos.Device)

func (*App) SetUserLoggedIn

func (app *App) SetUserLoggedIn(value bool)

func (*App) Settings

func (app *App) Settings() *settings.Settings

func (*App) Stats

func (app *App) Stats() stats.Stats

func (*App) SysProxyOff

func (app *App) SysProxyOff() error

func (*App) SysproxyOn

func (app *App) SysproxyOn() error

func (*App) UserData

func (app *App) UserData(ctx context.Context) (*protos.User, error)

UserData looks up user data that is associated with the given UserConfig

func (*App) WaitForExit

func (app *App) WaitForExit() error

WaitForExit waits for a request to exit the application.

func (*App) WebsocketAddr

func (app *App) WebsocketAddr() string

type ChatOptions

type ChatOptions struct {
	OnBoardingStatus     bool `json:"onBoardingStatus"`
	AcceptedTermsVersion int  `json:"acceptedTermsVersion"`
}

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

type Tab

type Tab string

Identifies a specific tab in the desktop app

func ParseTab

func ParseTab(s string) (Tab, error)

Parse the given string into a Tab

Jump to

Keyboard shortcuts

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