// newClient creates a proxy client. func newClient(addr, appName string) *mobileClient { client := client.Client{ Addr: addr, ReadTimeout: 0, // don't timeout WriteTimeout: 0, } err := globals.SetTrustedCAs(clientConfig.getTrustedCerts()) if err != nil { log.Errorf("Unable to configure trusted CAs: %s", err) } hqfd := client.Configure(clientConfig.Client) mClient := &mobileClient{ Client: client, closed: make(chan bool), fronter: hqfd.NewDirectDomainFronter(), appName: appName, } if err := mClient.updateConfig(); err != nil { log.Errorf("Unable to update config: %v", err) } return mClient }
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) }