// ProxyConfig returns the proxy settings for the current model.
490556
func (api *API) ProxyConfig() (ProxyConfiguration, error) {
	var empty ProxyConfiguration
	if api.facade.BestAPIVersion() <= 1 {
		legacyProxySettings, aptProxySettings, err := api.proxyConfigV1()
		if err != nil {
			return empty, err
		}
		return ProxyConfiguration{
			LegacyProxy: legacyProxySettings,
			APTProxy:    aptProxySettings,
		}, nil
	}

	var results params.ProxyConfigResults
	args := params.Entities{
		Entities: []params.Entity{{Tag: api.tag.String()}},
	}
	err := api.facade.FacadeCall("ProxyConfig", args, &results)
	if err != nil {
		return empty, err
	}
	if len(results.Results) != 1 {
		return empty, errors.NotFoundf("ProxyConfig for %q", api.tag)
	}
	result := results.Results[0]
	return ProxyConfiguration{
		LegacyProxy: proxySettingsParamToProxySettings(result.LegacyProxySettings),
		JujuProxy:   proxySettingsParamToProxySettings(result.JujuProxySettings),
		APTProxy:    proxySettingsParamToProxySettings(result.APTProxySettings),
		SnapProxy:   proxySettingsParamToProxySettings(result.SnapProxySettings),

		SnapStoreProxyId:         result.SnapStoreProxyId,
		SnapStoreProxyAssertions: result.SnapStoreProxyAssertions,
	}, nil
}
58405
func (s *Service) ProxyPost(w http.ResponseWriter, r *http.Request) {
	s.Proxy(w, r)
}
891639
func (pc *ProxyConfig) Set(newSettings proxyutils.Settings) error {
	pc.mu.Lock()
	defer pc.mu.Unlock()
	httpUrl, err := tolerantParse(newSettings.Http)
	if err != nil {
		return errors.Annotate(err, "http proxy")
	}
	httpsUrl, err := tolerantParse(newSettings.Https)
	if err != nil {
		return errors.Annotate(err, "https proxy")
	}
	pc.http = httpUrl
	pc.https = httpsUrl
	pc.noProxy = newSettings.FullNoProxy()
	return nil
}
36838
func (m *Model) Config() map[string]interface{} {
	m.mu.Lock()
	cfg := make(map[string]interface{}, len(m.details.Config))
	for k, v := range m.details.Config {
		cfg[k] = v
	}
	m.mu.Unlock()
	m.metrics.ModelConfigReads.Inc()
	return cfg
}
924527
func SetProxy(proxy func(*http.Request) (*url.URL, error)) error {
	return std.SetProxy(proxy)
}
547740
func (k *kubernetesClient) Config() *config.Config {
	k.lock.Lock()
	defer k.lock.Unlock()
	cfg := k.envCfgUnlocked
	return cfg
}
802102
func (p *Proxy) Configure(ctx context.Context, port string) {
	p.addToEndpointList(ctx, "localhost")
	p.addToEndpointList(ctx, "127.0.0.1")
}
678014
func Config() (*DefaultConfig, error) {
	conf, err := config.Config()
	return (*DefaultConfig)(conf), err
}
485561
func (l *State) Proxy(id string) *ManagedProxy {
	l.RLock()
	defer l.RUnlock()
	return l.managedProxies[id]
}
809547
func (c *Config) ProxySSH() bool {
	value, _ := c.defined["proxy-ssh"].(bool)
	return value
}
741670
func (cs *ChannelService) ChannelConfig() (fab.ChannelCfg, error) {
	return cs.ctxtCache.GetChannelConfig(cs.channelID)
}
603857
func (p *ConnectManagedProxy) ParseConfig() (*ConnectManagedProxyConfig, error) {
	var cfg ConnectManagedProxyConfig
	d, err := mapstructure.NewDecoder(&mapstructure.DecoderConfig{
		ErrorUnused:      false,
		WeaklyTypedInput: true, // allow string port etc.
		Result:           &cfg,
	})
	if err != nil {
		return nil, err
	}
	err = d.Decode(p.Config)
	if err != nil {
		return nil, err
	}
	return &cfg, nil
}
256512
func (c *Context) ClientConfig(serviceName string, cfgs ...*aws.Config) client.Config {
	if c.awsConfigProvider == nil {
		c.awsConfigProvider = newConfigProvider(c)
	}

	return c.awsConfigProvider.ClientConfig(serviceName, cfgs...)
}
152379
func Proxy(proxy func(*http.Request) (*url.URL, error)) func(*Attacker) {
	return func(a *Attacker) {
		tr := a.client.Transport.(*http.Transport)
		tr.Proxy = proxy
	}
}
806426
func (c *ControllerAPI) ModelConfig() (params.ModelConfigResults, error) {
	result := params.ModelConfigResults{}
	if err := c.checkHasAdmin(); err != nil {
		return result, errors.Trace(err)
	}

	controllerState := c.statePool.SystemState()
	controllerModel, err := controllerState.Model()
	if err != nil {
		return result, errors.Trace(err)
	}
	cfg, err := controllerModel.Config()
	if err != nil {
		return result, errors.Trace(err)
	}

	result.Config = make(map[string]params.ConfigValue)
	for name, val := range cfg.AllAttrs() {
		result.Config[name] = params.ConfigValue{
			Value: val,
		}
	}
	return result, nil
}
1273916
func (prod *Proxy) Configure(conf core.PluginConfigReader) {
	prod.SetStopCallback(prod.close)

	prod.protocol, prod.address = tnet.ParseAddress(conf.GetString("Address", ":5880"), "tcp")
	if prod.protocol == "udp" {
		conf.Errors.Pushf("Proxy does not support UDP")
	}

	delimiter := tstrings.Unescape(conf.GetString("Delimiter", "\n"))
	offset := int(conf.GetInt("Offset", 0))
	flags := tio.BufferedReaderFlagEverything // pass all messages as-is

	partitioner := strings.ToLower(conf.GetString("Partitioner", "delimiter"))
	switch partitioner {
	case "binary_be":
		flags |= tio.BufferedReaderFlagBigEndian
		fallthrough

	case "binary", "binary_le":
		switch conf.GetInt("Size", 4) {
		case 1:
			flags |= tio.BufferedReaderFlagMLE8
		case 2:
			flags |= tio.BufferedReaderFlagMLE16
		case 4:
			flags |= tio.BufferedReaderFlagMLE32
		case 8:
			flags |= tio.BufferedReaderFlagMLE64
		default:
			conf.Errors.Pushf("Size only supports the value 1,2,4 and 8")
		}

	case "fixed":
		flags |= tio.BufferedReaderFlagMLEFixed
		offset = int(conf.GetInt("Size", 1))

	case "ascii":
		flags |= tio.BufferedReaderFlagMLE

	case "delimiter":
		// Nothing to add

	default:
		conf.Errors.Pushf("Unknown partitioner: %s", partitioner)
	}

	prod.reader = tio.NewBufferedReader(prod.bufferSizeKB, flags, offset, delimiter)
}
951804
func LoadConfig() (err error) {
	if !base.IsExist(ConfigFile) {
		os.MkdirAll(path.Dir(ConfigFile), os.ModePerm)
		if _, err = os.Create(ConfigFile); err != nil {
			return fmt.Errorf("fail to create config file: %v", err)
		}
	}

	Cfg, err = goconfig.LoadConfigFile(ConfigFile)
	if err != nil {
		return fmt.Errorf("fail to load config file: %v", err)
	}

	HttpProxy = Cfg.MustValue("settings", "HTTP_PROXY")
	return nil
}