Ejemplo n.º 1
0
func NewClient() *Client {
	return &Client{
		bal: eventual.NewValue(),
		rp:  eventual.NewValue(),
	}
}
Ejemplo n.º 2
0
	"sync"
	"time"

	"github.com/getlantern/eventual"
	"github.com/getlantern/golog"
	"github.com/getlantern/idletiming"
	"github.com/getlantern/tlsdialer"
)

const (
	NumberToVetInitially = 20
)

var (
	log       = golog.LoggerFor("fronted")
	_instance = eventual.NewValue()
)

type direct struct {
	tlsConfigsMutex sync.Mutex
	tlsConfigs      map[string]*tls.Config
	certPool        *x509.CertPool
	candidates      chan *Masquerade
	masquerades     chan *Masquerade
}

func Configure(pool *x509.CertPool, masquerades map[string][]*Masquerade) {
	log.Debug("Configuring fronted")
	if masquerades == nil || len(masquerades) == 0 {
		log.Errorf("No masquerades!!")
		return
Ejemplo n.º 3
0
)

const (
	// LanternSpecialDomain is a special domain for use by lantern that gets
	// resolved to localhost by the proxy
	LanternSpecialDomain          = "ui.lantern.io"
	LanternSpecialDomainWithColon = "ui.lantern.io:"
)

var (
	log = golog.LoggerFor("flashlight.client")

	// Address at which UI is to be found
	UIAddr string

	addr      = eventual.NewValue()
	socksAddr = eventual.NewValue()
)

// Client is an HTTP proxy that accepts connections from local programs and
// proxies these via remote flashlight servers.
type Client struct {
	// ReadTimeout: (optional) timeout for read ops
	ReadTimeout time.Duration

	// WriteTimeout: (optional) timeout for write ops
	WriteTimeout time.Duration

	proxyAll  atomic.Value
	cfgHolder atomic.Value
	priorCfg  *ClientConfig