Documentation ¶
Index ¶
- Constants
- type Alert
- type AlertType
- type Noop
- func (s *Noop) AddListener(_ func(newStats Stats)) (close func())
- func (s *Noop) ClearAlert(alertType AlertType)
- func (s *Noop) IncAdsBlocked()
- func (s *Noop) IncHTTPSUpgrades()
- func (s *Noop) Latest() Stats
- func (s *Noop) SetActiveProxyLocation(city string, country string, countryCode string)
- func (s *Noop) SetAlert(alertType AlertType, details string, transient bool)
- func (s *Noop) SetDisconnected(val bool)
- func (s *Noop) SetHasSucceedingProxy(val bool)
- func (s *Noop) SetHitDataCap(val bool)
- func (s *Noop) SetIsPro(val bool)
- func (s *Noop) SetYinbiEnabled(val bool)
- type Stats
- type Tracker
Constants ¶
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 Noop ¶ added in v7.6.46
type Noop struct{}
Noop is a no-op implementation of Tracker
func (*Noop) AddListener ¶ added in v7.6.46
AddListener registers a new listener for stats updates and returns a function that can be used to close the listener.
func (*Noop) ClearAlert ¶ added in v7.6.46
ClearAlert clears the alert state if the current alert has the specific type.
func (*Noop) IncAdsBlocked ¶ added in v7.6.46
func (s *Noop) IncAdsBlocked()
IncAdsBlocked indicates that a proxy request is blocked per easylist rules.
func (*Noop) IncHTTPSUpgrades ¶ added in v7.6.46
func (s *Noop) IncHTTPSUpgrades()
IncHTTPSUpgrades indicates that Lantern client redirects a HTTP request to HTTPS via HTTPSEverywhere.
func (*Noop) SetActiveProxyLocation ¶ added in v7.6.46
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
func (*Noop) SetAlert ¶ added in v7.6.46
SetAlert indicates that some alert needs user attention. If transient is true, the alert will be cleared automatically 10 seconds later.
func (*Noop) SetDisconnected ¶ added in v7.6.46
SetDisconnected indicates that we've entered disconnected mode
func (*Noop) SetHasSucceedingProxy ¶ added in v7.6.46
SetHasSucceedingProxy indicates that we do (or don't) have a succeeding proxy.
func (*Noop) SetHitDataCap ¶ added in v7.6.46
SetHitDataCap indicates that we've hit the data cap
func (*Noop) SetYinbiEnabled ¶ added in v7.6.46
SetYinbiEnabled indicates that the user is eligible to participate in the Yinbi giveaway
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