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. } }
func applyClientConfig(client *client.Client, cfg *config.Config, proxyAll func() bool) { certs, err := cfg.GetTrustedCACerts() if err != nil { log.Errorf("Unable to get trusted ca certs, not configuring fronted: %s", err) } else { fronted.Configure(certs, cfg.Client.MasqueradeSets) } logging.Configure(client.Addr, cfg.CloudConfigCA, cfg.Client.DeviceID, Version, RevisionDate) // Update client configuration client.Configure(cfg.Client, proxyAll) }
func logPanic(msg string) { cfg, err := config.Init(flashlight.PackageVersion, *configdir, *stickyConfig, flagsAsMap()) if err != nil { panic("Error initializing config") } if err := logging.EnableFileLogging(); err != nil { panic("Error initializing logging") } <-logging.Configure(eventual.DefaultGetter(""), "", cfg.Client.DeviceID, flashlight.Version, flashlight.RevisionDate) log.Error(msg) logging.Flush() _ = logging.Close() }
func logPanic(msg string) { cfg, err := config.Init(packageVersion) if err != nil { panic("Error initializing config") } if err := logging.Init(); err != nil { panic("Error initializing logging") } <-logging.Configure("", "", cfg.InstanceId, version, revisionDate) log.Error(msg) logging.Flush() _ = logging.Close() }
// serveHTTP will run the proxy func (client *mobileClient) serveHTTP() { go func() { onListening := func() { log.Debugf("Now listening for connections...") analytics.Configure("", trackingCodes["FireTweet"], "", client.Client.Addr) logging.Configure(client.Client.Addr, cloudConfigCA, instanceId, version, revisionDate) } defer func() { close(client.closed) }() if err := client.ListenAndServe(onListening); err != nil { // Error is not exported: https://golang.org/src/net/net.go#L284 if !strings.Contains(err.Error(), "use of closed network connection") { panic(err.Error()) } } }() go client.pollConfiguration() }