Documentation ¶
Index ¶
- type Flags
- type Flashlight
- func (f *Flashlight) DisableNamedDomainRules(names ...string)
- func (f *Flashlight) EnableNamedDomainRules(names ...string)
- func (f *Flashlight) EnabledFeatures() map[string]bool
- func (f *Flashlight) FeatureEnabled(feature, applicationVersion string) bool
- func (f *Flashlight) FeatureOptions(feature string, opts config.FeatureOptions) error
- func (f *Flashlight) Run(httpProxyAddr, socksProxyAddr string, afterStart func(cl *client.Client), ...)
- func (f *Flashlight) RunClientListeners(httpProxyAddr, socksProxyAddr string, afterStart func(cl *client.Client), ...)
- func (f *Flashlight) SetErrorHandler(handler func(t HandledErrorType, err error))
- func (f *Flashlight) StartBackgroundServices() func()
- func (f *Flashlight) Stop() error
- type HandledErrorType
- type Option
- func WithInit(onInit func()) Option
- func WithOnConfig(onConfigUpdate func(*config.Global, config.Source)) Option
- func WithOnDialError(onDialError func(error, bool)) Option
- func WithOnProxies(onProxiesUpdate func([]dialer.ProxyDialer, config.Source)) Option
- func WithOnSucceedingProxy(onSucceedingProxy func()) Option
- type ProxyListener
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Flags ¶
type Flags struct { Addr string `` /* 170-byte string literal not displayed */ SocksAddr string `flag:"socksaddr" help:"ip:port on which to listen for SOCKS5 proxy requests."` ConfigDir string `flag:"configdir" help:"directory in which to store configuration. Defaults to platform-specific directories."` VPN bool `help:"specify this flag to enable vpn mode"` CloudConfig string `flag:"cloudconfig" help:"optional http(s) URL to a cloud-based source for configuration updates"` CloudConfigCA string `flag:"cloudconfigca" help:"optional PEM encoded certificate used to verify TLS connections to fetch cloudconfig"` RegisterAt string `flag:"registerat" help:"base URL for peer DNS registry at which to register (e.g. https://peerscanner.getiantem.org)"` Country string `help:"2 digit country code under which to report stats"` ClearProxySettings bool `flag:"clear-proxy-settings" help:"if true, Lantern removes proxy settings from the system."` CpuProfile string `flag:"cpuprofile" help:"write cpu profile to given file"` MemProfile string `flag:"memprofile" help:"write heap profile to given file"` UIAddr string `flag:"uiaddr" help:"if specified, indicates host:port the UI HTTP server should be started on"` ProxyAll bool `flag:"proxyall" help:"set to true to proxy all traffic through Lantern network"` StickyConfig bool `flag:"stickyconfig" help:"set to true to only use the local config file"` AuthAddr string `flag:"authaddr" help:"if specified, indicates the address to use for the Lantern auth server"` YinbiAddr string `flag:"yinbiaddr" help:"if specified, indicates the address to use for the Yinbi server"` Headless bool `help:"if true, lantern will run with no ui"` Startup bool `help:"if true, Lantern was automatically run on system startup"` Pprof bool `flag:"pprof" help:"if true, run a pprof server on port 6060"` ForceProxyAddr string `` /* 141-byte string literal not displayed */ ForceAuthToken string `flag:"force-auth-token" help:"if specified, force chained proxying to use this auth token instead of the configured one"` ForceConfigCountry string `` /* 127-byte string literal not displayed */ ReadableConfig bool `flag:"readableconfig" help:"if specified, disables obfuscation of the config yaml so that it remains human readable"` Help bool `flag:"help" help:"Get usage help"` NoUiHttpToken bool `flag:"no-ui-http-token" help:"don't require a HTTP token from the UI"` Standalone bool `flag:"standalone" help:"run Lantern in its own browser window (doesn't rely on system browser)"` Initialize bool `` /* 128-byte string literal not displayed */ Timeout time.Duration `flag:"timeout" help:"force stop Lantern with an exit status of -1 after the timeout."` ReplicaRustUrl string `flag:"replica-rust-url" help:"use the replica-rust service at the provided endpoint"` Staging bool `flag:"-"` Experiments []string `flag:"enabled-experiments" help:"comma separated list of experiments to enable"` }
func ParseFlags ¶
func ParseFlags() Flags
type Flashlight ¶
type Flashlight struct {
// contains filtered or unexported fields
}
func New ¶
func New( appName string, appVersion string, revisionDate string, configDir string, enableVPN bool, disconnected func() bool, _proxyAll func() bool, allowPrivateHosts func() bool, autoReport func() bool, flagsAsMap map[string]interface{}, userConfig common.UserConfig, statsTracker stats.Tracker, isPro func() bool, lang func() string, reverseDNS func(host string) (string, error), eventWithLabel func(category, action, label string), options ...Option, ) (*Flashlight, error)
New creates a client proxy.
func (*Flashlight) DisableNamedDomainRules ¶
func (f *Flashlight) DisableNamedDomainRules(names ...string)
DisableNamedDomainRules removes named domain rules specified as arguments from the domainrouting rules table
func (*Flashlight) EnableNamedDomainRules ¶
func (f *Flashlight) EnableNamedDomainRules(names ...string)
EnableNamedDomainRules adds named domain rules specified as arguments to the domainrouting rules table
func (*Flashlight) EnabledFeatures ¶
func (f *Flashlight) EnabledFeatures() map[string]bool
EnabledFeatures gets all features enabled based on current conditions
func (*Flashlight) FeatureEnabled ¶
func (f *Flashlight) FeatureEnabled(feature, applicationVersion string) bool
func (*Flashlight) FeatureOptions ¶
func (f *Flashlight) FeatureOptions(feature string, opts config.FeatureOptions) error
FeatureOptions unmarshals options for the input feature. Feature names are tracked in the config package.
func (*Flashlight) Run ¶
func (f *Flashlight) Run(httpProxyAddr, socksProxyAddr string, afterStart func(cl *client.Client), onError func(err error), )
Run starts background services and runs the client proxy. It blocks as long as the proxy is running.
func (*Flashlight) RunClientListeners ¶
func (f *Flashlight) RunClientListeners(httpProxyAddr, socksProxyAddr string, afterStart func(cl *client.Client), onError func(err error), )
Runs client listeners, blocking as long as the proxy is running.
func (*Flashlight) SetErrorHandler ¶
func (f *Flashlight) SetErrorHandler(handler func(t HandledErrorType, err error))
SetErrorHandler configures error handling. All errors provided to the handler are significant, but not enough to stop operation of the Flashlight instance. This method must be called before calling Run. All errors provided to the handler will be of a HandledErrorType defined in this package. The handler may be called multiple times concurrently.
If no handler is configured, these errors will be logged on the ERROR level.
func (*Flashlight) StartBackgroundServices ¶
func (f *Flashlight) StartBackgroundServices() func()
Starts background services like config fetching
type HandledErrorType ¶
type HandledErrorType int
HandledErrorType is used to differentiate error types to handlers configured via Flashlight.SetErrorHandler.
const ( ErrorTypeProxySaveFailure HandledErrorType = iota ErrorTypeConfigSaveFailure HandledErrorType = iota )
func (HandledErrorType) String ¶
func (t HandledErrorType) String() string
type Option ¶ added in v7.6.82
type Option func(*Flashlight)
func WithInit ¶ added in v7.6.82
func WithInit(onInit func()) Option
WithInit sets the callback that is called when flashlight is ready and has a config or needs to be initialized
func WithOnConfig ¶ added in v7.6.82
WithOnConfig sets the callback that is called when a config is successfully fetched
func WithOnDialError ¶ added in v7.6.83
WithOnDialError sets the callback that is called when an error occurs dialing a proxy. It includes the error itself and whether or not we have any successful dialers
func WithOnProxies ¶ added in v7.6.82
func WithOnProxies(onProxiesUpdate func([]dialer.ProxyDialer, config.Source)) Option
WithOnProxies sets the callback when new proxies are received
func WithOnSucceedingProxy ¶ added in v7.6.82
func WithOnSucceedingProxy(onSucceedingProxy func()) Option
WithOnSucceedingProxy sets the onSucceedingProxy callback
type ProxyListener ¶
type ProxyListener interface {
OnProxies(map[string]*commonconfig.ProxyConfig)
}
Directories ¶
Path | Synopsis |
---|---|
Package browsers provides utilities centered around web browsers.
|
Package browsers provides utilities centered around web browsers. |
defaultbrowser
Command defaultbrowser prints the name of the system's default web browser.
|
Command defaultbrowser prints the name of the system's default web browser. |
simbrowser
Package simbrowser provides facilities for simulating aspects of web browsers.
|
Package simbrowser provides facilities for simulating aspects of web browsers. |
Package chained provides a chained proxy that can proxy any tcp traffic over any underlying transport through a remote proxy.
|
Package chained provides a chained proxy that can proxy any tcp traffic over any underlying transport through a remote proxy. |
prefixgen
Package prefixgen defines a language for generating connection prefixes.
|
Package prefixgen defines a language for generating connection prefixes. |
configchecker
This program is a simple config checker tool for proxies and global configs.
|
This program is a simple config checker tool for proxies and global configs. |
global
This package breaks out some global config handling to where it can be used externally without dependence on all flashlight config.
|
This package breaks out some global config handling to where it can be used externally without dependence on all flashlight config. |
Package deterministic is used to make deterministic choices for users.
|
Package deterministic is used to make deterministic choices for users. |
Package dialer contains the interfaces for creating connections to proxies.
|
Package dialer contains the interfaces for creating connections to proxies. |
Package email provides functionality for sending email messages via Mandrill
|
Package email provides functionality for sending email messages via Mandrill |
Package main is a generated GoMock package.
|
Package main is a generated GoMock package. |
Package goroutines spawns a loop to periodically check for the count of goroutines.
|
Package goroutines spawns a loop to periodically check for the count of goroutines. |
Command hellocap captures a sample ClientHello from the default browser and prints it to stdout.
|
Command hellocap captures a sample ClientHello from the default browser and prints it to stdout. |
Package integrationtest provides support for integration style tests that need a local web server and proxy server.
|
Package integrationtest provides support for integration style tests that need a local web server and proxy server. |
Package logging configures the golog subsystem for use with Lantern Import this to make sure golog is initialized before you log.
|
Package logging configures the golog subsystem for use with Lantern Import this to make sure golog is initialized before you log. |
Package ops wraps github.com/getlantern/ops with convenience methods for flashlight
|
Package ops wraps github.com/getlantern/ops with convenience methods for flashlight |
This file focuses on a structure called ProxiedFlow.
|
This file focuses on a structure called ProxiedFlow. |
package shortcut loads country specific shortcut subnet list from resources so the caller can check if an IP should be dialed directly or not.
|
package shortcut loads country specific shortcut subnet list from resources so the caller can check if an IP should be dialed directly or not. |