Documentation
¶
Index ¶
Constants ¶
View Source
const ( STATUS_CONNECTING = "connecting" STATUS_CONNECTED = "connected" STATUS_DISCONNECTED = "disconnected" STATUS_THROTTLED = "throttled" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Alert ¶
type Stats ¶
type Stats struct {
City string `json:"city"`
Country string `json:"country"`
CountryCode string `json:"countryCode"`
HTTPSUpgrades int `json:"httpsUpgrades"`
AdsBlocked int `json:"adsBlocked"`
Disconnected bool `json:"disconnected"`
HasSucceedingProxy bool `json:"hasSucceedingProxy"`
HitDataCap bool `json:"hitDataCap"`
IsPro bool `json:"isPro"`
YinbiEnabled bool `json:"yinbiEnabled"`
Status string `json:"status"`
Alerts []Alert `json:"alerts"`
}
Stats are stats and status of the current Lantern
type Tracker ¶
type Tracker interface {
// Latest returns the latest Stats that are being tracked
Latest() Stats
// AddListener registers a new listener for stats updates and returns a
// function that can be used to close the listener.
AddListener(func(newStats Stats)) (close func())
// SetActiveProxyLocation updates the location of last successfully dialed
// proxy. countryCode is in ISO Alpha-2 form, see
// http://www.nationsonline.org/oneworld/country_code_list.htm
SetActiveProxyLocation(city, country, countryCode string)
// IncHTTPSUpgrades indicates that Lantern client redirects a HTTP request
// to HTTPS via HTTPSEverywhere.
IncHTTPSUpgrades()
// IncAdsBlocked indicates that a proxy request is blocked per easylist rules.
IncAdsBlocked()
// SetDisconnected indicates that we've entered disconnected mode
SetDisconnected(val bool)
// SetHasSucceedingProxy indicates that we do (or don't) have a succeeding
// proxy.
SetHasSucceedingProxy(val bool)
// SetHitDataCap indicates that we've hit the data cap
SetHitDataCap(val bool)
// SetIsPro indicates that we're pro
SetIsPro(val bool)
// SetYinbiEnabled indicates that the user is eligible to participate in the
// Yinbi giveaway
SetYinbiEnabled(val bool)
// SetAlert indicates that some alert needs user attention. If transient is
// true, the alert will be cleared automatically 10 seconds later.
SetAlert(alertType AlertType, details string, transient bool)
// ClearAlert clears the alert state if the current alert has the specific
// type.
ClearAlert(alertType AlertType)
}
Tracker is a common interface to receive user perceptible Lantern stats
Click to show internal directories.
Click to hide internal directories.