コード例 #1
0
ファイル: flashlight.go プロジェクト: kidaa/lantern
func applyClientConfig(client *client.Client, cfg *config.Config) {
	cfgMutex.Lock()
	defer cfgMutex.Unlock()

	autoupdate.Configure(cfg)
	logging.Configure(cfg.Addr, cfg.CloudConfigCA, cfg.InstanceId,
		version, revisionDate)
	settings.Configure(cfg, version, revisionDate, buildDate)
	proxiedsites.Configure(cfg.ProxiedSites)
	analytics.Configure(cfg, version)
	log.Debugf("Proxy all traffic or not: %v", cfg.Client.ProxyAll)
	ServeProxyAllPacFile(cfg.Client.ProxyAll)
	// Note - we deliberately ignore the error from statreporter.Configure here
	_ = statreporter.Configure(cfg.Stats)

	// Update client configuration and get the highest QOS dialer available.
	hqfd := client.Configure(cfg.Client)
	if hqfd == nil {
		log.Errorf("No fronted dialer available, not enabling geolocation, config lookup, or stats")
	} else {
		// Give everyone their own *http.Client that uses the highest QOS dialer. Separate
		// clients for everyone avoids data races configuring those clients.
		config.Configure(hqfd.NewDirectDomainFronter())
		geolookup.Configure(hqfd.NewDirectDomainFronter())
		statserver.Configure(hqfd.NewDirectDomainFronter())
		// Note we don't call Configure on analytics here, as that would
		// result in an extra analytics call and double counting.
	}
}
コード例 #2
0
ファイル: main.go プロジェクト: 2722/lantern
func onConfigUpdate(cfg *config.Config) {
	autoupdate.Configure(cfg)
	proxiedsites.Configure(cfg.ProxiedSites)
}