Documentation ¶
Index ¶
- Constants
- Variables
- func Addr(timeout time.Duration) (interface{}, bool)
- func ChainedDialer(si *ChainedServerInfo, deviceID string) (*balancer.Dialer, error)
- func Socks5Addr(timeout time.Duration) (interface{}, bool)
- type ChainedServerInfo
- type Client
- func (client *Client) Addr(timeout time.Duration) (interface{}, bool)
- func (client *Client) Configure(cfg *ClientConfig, deviceID string)
- func (client *Client) ListenAndServeHTTP(requestedAddr string, onListeningFn func()) error
- func (client *Client) ListenAndServeSOCKS5(requestedAddr string) error
- func (client *Client) ServeHTTP(resp http.ResponseWriter, req *http.Request)
- func (client *Client) Socks5Addr(timeout time.Duration) (interface{}, bool)
- func (client *Client) Stop() error
- type ClientConfig
Constants ¶
const ( // LanternSpecialDomain is a special domain for use by lantern that gets // resolved to localhost by the proxy LanternSpecialDomain = "ui.lantern.io" )
Variables ¶
var ForceAuthToken string
ForceAuthToken - If specified, auth token will be forced to this
var ForceChainedProxyAddr string
ForceChainedProxyAddr - If specified, all proxying will go through this address
var ( // UIAddr is the address at which UI is to be found UIAddr string )
Functions ¶
func Addr ¶
Addr returns the address at which the client is listening with HTTP, blocking until the given timeout for an address to become available.
func ChainedDialer ¶
func ChainedDialer(si *ChainedServerInfo, deviceID string) (*balancer.Dialer, error)
ChainedDialer creates a *balancer.Dialer backed by a chained server.
func Socks5Addr ¶
Socks5Addr returns the address at which the client is listening with SOCKS5, blocking until the given timeout for an address to become available.
Types ¶
type ChainedServerInfo ¶
type ChainedServerInfo struct { // Addr: the host:port of the upstream proxy server Addr string // Cert: optional PEM encoded certificate for the server. If specified, // server will be dialed using TLS over tcp. Otherwise, server will be // dialed using plain tcp. For OBFS4 proxies, this is the Base64-encoded obfs4 // certificate. Cert string // AuthToken: the authtoken to present to the upstream server. AuthToken string // Trusted: Determines if a host can be trusted with plain HTTP traffic. Trusted bool // PluggableTransport: If specified, a pluggable transport will be used PluggableTransport string // PluggableTransportSettings: Settings for pluggable transport PluggableTransportSettings map[string]string }
ChainedServerInfo contains all the data for connecting to a given chained server.
type Client ¶
type Client struct { // ReadTimeout: (optional) timeout for read ops ReadTimeout time.Duration // WriteTimeout: (optional) timeout for write ops WriteTimeout time.Duration // contains filtered or unexported fields }
Client is an HTTP proxy that accepts connections from local programs and proxies these via remote flashlight servers.
func NewClient ¶
NewClient creates a new client that does things like starts the HTTP and SOCKS proxies. It take a function for determing whether or not to proxy all traffic.
func (*Client) Addr ¶
Addr returns the address at which the client is listening with HTTP, blocking until the given timeout for an address to become available.
func (*Client) Configure ¶
func (client *Client) Configure(cfg *ClientConfig, deviceID string)
Configure updates the client's configuration. Configure can be called before or after ListenAndServe, and can be called multiple times.
func (*Client) ListenAndServeHTTP ¶
ListenAndServeHTTP makes the client listen for HTTP connections at a the given address or, if a blank address is given, at a random port on localhost. onListeningFn is a callback that gets invoked as soon as the server is accepting TCP connections.
func (*Client) ListenAndServeSOCKS5 ¶
ListenAndServeSOCKS5 starts the SOCKS server listening at the specified address.
func (*Client) ServeHTTP ¶
func (client *Client) ServeHTTP(resp http.ResponseWriter, req *http.Request)
ServeHTTP implements the method from interface http.Handler using the latest handler available from getHandler() and latest ReverseProxy available from getReverseProxy().
func (*Client) Socks5Addr ¶
Socks5Addr returns the address at which the client is listening with SOCKS5, blocking until the given timeout for an address to become available.
type ClientConfig ¶
type ClientConfig struct { // MinQOS: (optional) the minimum QOS to require from proxies. MinQOS int // List of CONNECT ports that are proxied via the remote proxy. Other ports // will be handled with direct connections. ProxiedCONNECTPorts []int DumpHeaders bool // whether or not to dump headers of requests and responses ChainedServers map[string]*ChainedServerInfo MasqueradeSets map[string][]*fronted.Masquerade }
ClientConfig captures configuration information for a Client