Documentation ¶
Index ¶
- func UserConfig(settings *Settings) sdkcommon.UserConfig
- type SettingName
- type Settings
- func (s *Settings) GetAddr() string
- func (s *Settings) GetAppName() string
- func (s *Settings) GetCountry() string
- func (s *Settings) GetDeviceID() string
- func (s *Settings) GetDisconnected() bool
- func (s *Settings) GetEmailAddress() string
- func (s *Settings) GetEnabledExperiments() []string
- func (s *Settings) GetExpirationDate() string
- func (s *Settings) GetGoogleAds() bool
- func (s *Settings) GetInt64Eventually(name SettingName) (int64, error)
- func (s *Settings) GetInternalHeaders() map[string]string
- func (s *Settings) GetLanguage() string
- func (s *Settings) GetLocalHTTPToken() string
- func (s *Settings) GetMigratedDeviceIDForUserID() int64
- func (s *Settings) GetPastAnnouncements() []string
- func (s *Settings) GetProxyAll() bool
- func (s *Settings) GetReferralCode() string
- func (s *Settings) GetSOCKSAddr() string
- func (s *Settings) GetSalt() []byte
- func (s *Settings) GetSystemProxy() bool
- func (s *Settings) GetTakenSurveys() []string
- func (s *Settings) GetTimeZone() (string, error)
- func (s *Settings) GetToken() string
- func (s *Settings) GetUIAddr() string
- func (s *Settings) GetUserFirstVisit() bool
- func (s *Settings) GetUserID() int64
- func (s *Settings) IsAutoLaunch() bool
- func (s *Settings) IsAutoReport() bool
- func (s *Settings) IsProUser() bool
- func (s *Settings) IsUserLoggedIn() bool
- func (s *Settings) OnChange(attr SettingName, cb func(interface{}))
- func (s *Settings) SaveSalt(salt []byte)
- func (s *Settings) SetAddr(addr string)
- func (s *Settings) SetCountry(country string)
- func (s *Settings) SetDisconnected(disconnected bool)
- func (s *Settings) SetEmailAddress(email string)
- func (s *Settings) SetEnabledExperiments(ex []string)
- func (s *Settings) SetExpiration(expiration int64)
- func (s *Settings) SetExpirationDate(date string)
- func (s *Settings) SetGoogleAds(g bool)
- func (s *Settings) SetLanguage(language string)
- func (s *Settings) SetLocalHTTPToken(token string)
- func (s *Settings) SetMigratedDeviceIDForUserID(userID int64)
- func (s *Settings) SetPastAnnouncements(announcements []string)
- func (s *Settings) SetProUser(value bool)
- func (s *Settings) SetProxyAll(proxyAll bool)
- func (s *Settings) SetReferralCode(referralCode string)
- func (s *Settings) SetSOCKSAddr(addr string)
- func (s *Settings) SetTakenSurveys(campaigns []string)
- func (s *Settings) SetUIAddr(uiaddr string)
- func (s *Settings) SetUserFirstVisit(value bool)
- func (s *Settings) SetUserIDAndToken(id int64, token string)
- func (s *Settings) SetUserLoggedIn(value bool)
- func (s *Settings) StartService(channel ws.UIChannel) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func UserConfig ¶
func UserConfig(settings *Settings) sdkcommon.UserConfig
UserConfig creates a new user config from the given settings
Types ¶
type SettingName ¶
type SettingName string
SettingName is the name of a setting.
const ( SNAutoReport SettingName = "autoReport" SNAutoLaunch SettingName = "autoLaunch" SNProxyAll SettingName = "proxyAll" SNGoogleAds SettingName = "googleAds" SNSystemProxy SettingName = "systemProxy" SNDisconnected SettingName = "disconnected" SNLanguage SettingName = "lang" SNCountry SettingName = "country" SNLocalHTTPToken SettingName = "localHTTPToken" SNDeviceID SettingName = "deviceID" SNEmailAddress SettingName = "emailAddress" SNUserID SettingName = "userID" SNUserToken SettingName = "userToken" SNUserPro SettingName = "userPro" SNReferralCode SettingName = "referralCode" SNMigratedDeviceIDForUserID SettingName = "migratedDeviceIDForUserID" SNTakenSurveys SettingName = "takenSurveys" SNPastAnnouncements SettingName = "pastAnnouncements" SNAddr SettingName = "addr" SNSOCKSAddr SettingName = "socksAddr" SNUIAddr SettingName = "uiAddr" SNVersion SettingName = "version" SNBuildDate SettingName = "buildDate" SNRevisionDate SettingName = "revisionDate" SNEnabledExperiments SettingName = "enabledExperiments" // Auth methods SNUserFirstVisit SettingName = "userFirstVisit" SNExpiryDate SettingName = "expirydate" SNUserLoggedIn SettingName = "userLoggedIn" SNSalt SettingName = "salt" )
type Settings ¶
Settings is a struct of all settings unique to this particular Lantern instance.
func EmptySettings ¶
func EmptySettings() *Settings
EmptySettings returns a new settings instance without loading any file from disk.
func LoadSettings ¶
LoadSettings loads the initial settings at startup, either from disk or using defaults.
func LoadSettingsFrom ¶
func (*Settings) GetAppName ¶
func (*Settings) GetCountry ¶
GetCountry returns the user country
func (*Settings) GetDeviceID ¶
GetDeviceID returns the unique ID of this device.
func (*Settings) GetDisconnected ¶
GetDisconnected returns whether or not we're disconnected
func (*Settings) GetEmailAddress ¶
GetEmailAddress gets the email address of pro users.
func (*Settings) GetEnabledExperiments ¶
GetEnabledExperiments returns the names of the Lantern experiment IDs that were enabled via flags.
func (*Settings) GetExpirationDate ¶
func (*Settings) GetGoogleAds ¶
GetGoogleAds returns whether or not to proxy all traffic.
func (*Settings) GetInt64Eventually ¶
func (s *Settings) GetInt64Eventually(name SettingName) (int64, error)
GetInt64Eventually blocks returning an int64 until the int has a value other than the defualt.
func (*Settings) GetInternalHeaders ¶
GetInternalHeaders returns extra headers sent with requests to internal services
func (*Settings) GetLanguage ¶
GetLanguage returns the user language
func (*Settings) GetLocalHTTPToken ¶
GetLocalHTTPToken returns the local HTTP token.
func (*Settings) GetMigratedDeviceIDForUserID ¶
GetMigratedDeviceIDForUserID returns the user ID (if any) for which the current device's ID has been migrated from the old style to the new style
func (*Settings) GetPastAnnouncements ¶
GetPastAnnouncements returns past campaign announcements
func (*Settings) GetProxyAll ¶
GetProxyAll returns whether or not to proxy all traffic.
func (*Settings) GetReferralCode ¶
GetReferralCode returns the user referral code
func (*Settings) GetSOCKSAddr ¶
GetSOCKSAddr returns the SOCKS proxy address.
func (*Settings) GetSystemProxy ¶
GetSystemProxy returns whether or not to set system proxy when lantern starts
func (*Settings) GetTakenSurveys ¶
GetTakenSurveys returns the IDs of surveys the user has already taken.
func (*Settings) GetTimeZone ¶
func (*Settings) GetUIAddr ¶
GetUIAddr returns the address of the UI, stored across runs to avoid a different port on each run, which breaks things like local storage in the UI.
func (*Settings) GetUserFirstVisit ¶
GetUserFirstVisit returns the user's first visit flag
func (*Settings) IsAutoLaunch ¶
IsAutoLaunch returns whether or not to automatically launch on system startup.
func (*Settings) IsAutoReport ¶
IsAutoReport returns whether or not to auto-report debugging and analytics data.
func (*Settings) IsUserLoggedIn ¶
func (*Settings) OnChange ¶
func (s *Settings) OnChange(attr SettingName, cb func(interface{}))
OnChange sets a callback cb to get called when attr is changed from UI.
func (*Settings) SetCountry ¶
SetCountry sets the user's country.
func (*Settings) SetDisconnected ¶
SetDisconnected sets whether or not we're disconnected
func (*Settings) SetEmailAddress ¶
SetEmailAddress locally stores the email address of a pro user
func (*Settings) SetEnabledExperiments ¶
SetEnabledExperiments sets the Lantern experiment IDs that were enabled via flags.
func (*Settings) SetExpiration ¶
func (*Settings) SetExpirationDate ¶
func (*Settings) SetGoogleAds ¶
SetGoogleAds sets whether or not to proxy all traffic.
func (*Settings) SetLanguage ¶
SetLanguage sets the user language
func (*Settings) SetLocalHTTPToken ¶
SetLocalHTTPToken sets the local HTTP token, stored on disk because we've seen weird issues on Windows where the OS remembers old, inactive PAC URLs with old tokens and uses them, breaking Edge and IE.
func (*Settings) SetMigratedDeviceIDForUserID ¶
SetMigratedDeviceIDForUserID stores the user ID (if any) for which the current device's ID has been migrated from the old style to the new style
func (*Settings) SetPastAnnouncements ¶
SetPastAnnouncements sets past campaigns announcements
func (*Settings) SetProUser ¶
func (*Settings) SetProxyAll ¶
SetProxyAll sets whether or not to proxy all traffic.
func (*Settings) SetReferralCode ¶
SetReferralCode sets the user referral code
func (*Settings) SetSOCKSAddr ¶
SetSOCKSAddr sets the SOCKS proxy address.
func (*Settings) SetTakenSurveys ¶
SetTakenSurveys sets the IDs of taken surveys.
func (*Settings) SetUserFirstVisit ¶
Auth methods SetUserFirstVisit sets the user's first visit flag
func (*Settings) SetUserIDAndToken ¶
SetUserIDAndToken sets the user ID and token atomically