// HTTPClient is a Client option that sets the http.Client used.
549240
func HTTPClient(client *http.Client) Option {
	return func(c *Client) error {
		// create dns service
		l, err := dns.New(client)
		if err != nil {
			return err
		}
		return DNSService(l)(c)
	}
}
32346
func (c *Context) NewClient() (*http.Client, error) {
	jar, err := c.NewCookieJar()
	if err != nil {
		return nil, err
	}
	client := &http.Client{
		Jar:       jar,
		Transport: http.DefaultTransport,
	}
	c.Client = client
	return client, nil
}
434447
func NewHttpClient(base string) (httpClient *HttpClient) {
	httpClient = new(HttpClient)
	httpClient.client = &http.Client{CheckRedirect: httpClient.checkRedirect}
	httpClient.Headers = make(map[string]string)
	httpClient.FollowRedirects = true

	if err := httpClient.SetBase(base); err != nil {
		log.Fatal(err)
	}

	return
}
574511
func NewClient(cfg ClientConfig) *http.Client {
	tr := &http.Transport{
		Proxy: http.ProxyFromEnvironment,
		DialContext: (&net.Dialer{
			Timeout:   cfg.Timeouts.Connect,
			KeepAlive: 30 * time.Second,
			DualStack: true,
		}).DialContext,
		MaxIdleConns:    100,
		IdleConnTimeout: cfg.Timeouts.IdleConnection,

		DisableKeepAlives:     !cfg.KeepAlive,
		TLSHandshakeTimeout:   cfg.Timeouts.TLSHandshake,
		ExpectContinueTimeout: cfg.Timeouts.ExpectContinue,
		ResponseHeaderTimeout: cfg.Timeouts.ResponseHeader,
	}

	return &http.Client{
		Transport: tr,
	}
}
580173
func NewClient(endpoint string) (*Client, error) {
	u, err := parseEndpoint(endpoint)
	if err != nil {
		return nil, err
	}

	return &Client{
		HTTPClient:  &http.Client{Timeout: time.Duration(5 * time.Second)},
		endpoint:    endpoint,
		endpointURL: u,
	}, nil
}
779954
func NewClient(opts ClientOpts) *Client {
	if opts.HTTPClient == nil {
		opts.HTTPClient = &http.Client{}
	}

	return &Client{
		token:      opts.Token,
		baseURL:    opts.BaseURL,
		httpClient: opts.HTTPClient,
		userAgent:  opts.UserAgent,
	}
}
514521
func (s *state) HTTPClient() (*httprequest.Client, error) {
	baseURL, err := s.apiEndpoint("/", "")
	if err != nil {
		return nil, errors.Trace(err)
	}
	return s.httpClient(baseURL)
}
252117
func NewClient(host string, client *http.Client) access.AccessClient {
	return access.NewAccessPRPCClient(&prpc.Client{
		Host: host,
		C:    client,
	})
}
1277347
func WithHttpClient(client httpClient) func(rpc *EthRPC) {
	return func(rpc *EthRPC) {
		rpc.client = client
	}
}
850891
func (c *Config) Client(ctx context.Context) *http.Client {
	return oauth2.NewClient(ctx, c.TokenSource(ctx))
}
1341192
func WithHttpClient(c *http.Client) Option {
	return func(s *Settings) error {
		if c == nil {
			return errInvalidHttpClient
		}
		s.client = c
		return nil
	}
}
121111
func defaultHTTPClient() (*http.Client, error) {
	urand, err := earlyrand.UrandomReader()
	if err != nil {
		return nil, err
	}

	tlsConfig := tls.Config{
		Rand: urand,
	}
	transport := http.Transport{
		ResponseHeaderTimeout: time.Duration(defaultHttpResponseHeaderTimeout) * time.Second,
		Dial: (&net.Dialer{
			Timeout:   30 * time.Second,
			KeepAlive: 30 * time.Second,
			Resolver: &net.Resolver{
				PreferGo: true,
			},
		}).Dial,
		TLSClientConfig:     &tlsConfig,
		TLSHandshakeTimeout: 10 * time.Second,
	}
	client := http.Client{
		Transport: &transport,
	}
	return &client, nil
}
1227127
func HTTPClient(transport http.RoundTripper) *http.Client {
	return &http.Client{
		Transport:     transport,
		CheckRedirect: addRequiredHeadersToRedirectedRequests,
	}
}
104553
func (c *ApiextensionsClient) RESTClient() rest.Interface {
	if c == nil {
		return nil
	}
	return c.restClient
}
1083492
func generateHttpClient(cfg *Configuration, httpClient *http.Client) *http.Client {
	if httpClient == nil {
		httpClient = http.DefaultClient
		if strings.HasPrefix(cfg.Server, "https") && cfg.SkipSslCheck {
			httpClient.Transport = &http.Transport{
				TLSClientConfig: &tls.Config{InsecureSkipVerify: cfg.SkipSslCheck},
			}
		}
	}
	return httpClient
}
1244341
func HTTPClientDoer(hc *http.Client) Doer {
	return doFunc(func(_ context.Context, req *http.Request) (*http.Response, error) {
		return hc.Do(req)
	})
}
1189753
func (r *Resource) SetClient(c *http.Client) {
	r.Api.Client = c
}