// NewCryptoSetupClient creates a new crypto setup for the client
555683
func NewCryptoSetupClient(
	initialStream io.Writer,
	handshakeStream io.Writer,
	oneRTTStream io.Writer,
	connID protocol.ConnectionID,
	remoteAddr net.Addr,
	tp *TransportParameters,
	handleParams func([]byte),
	tlsConf *tls.Config,
	logger utils.Logger,
) (CryptoSetup, <-chan struct{} /* ClientHello written */, error) {
	cs, clientHelloWritten, err := newCryptoSetup(
		initialStream,
		handshakeStream,
		oneRTTStream,
		connID,
		tp,
		handleParams,
		tlsConf,
		logger,
		protocol.PerspectiveClient,
	)
	if err != nil {
		return nil, nil, err
	}
	cs.conn = qtls.Client(newConn(remoteAddr), cs.tlsConf)
	return cs, clientHelloWritten, nil
}
1211563
func NewRSAPKCSKeyEncrypt(alg jwa.KeyEncryptionAlgorithm, pubkey *rsa.PublicKey) (*RSAPKCSKeyEncrypt, error) {
	switch alg {
	case jwa.RSA1_5:
	default:
		return nil, errors.Wrap(ErrUnsupportedAlgorithm, "invalid RSA PKCS encrypt algorithm")
	}

	return &RSAPKCSKeyEncrypt{
		alg:    alg,
		pubkey: pubkey,
	}, nil
}
508579
func NewECSClient(accessKeyId, accessKeySecret string, regionID common.Region) *Client {
	return NewECSClientWithSecurityToken(accessKeyId, accessKeySecret, "", regionID)
}
84037
func (s *HsmClientCertificate) SetHsmClientCertificatePublicKey(v string) *HsmClientCertificate {
	s.HsmClientCertificatePublicKey = &v
	return s
}
1328768
func NewJSONRPCClient(remote string) *JSONRPCClient {
	address, client := makeHTTPClient(remote)
	return &JSONRPCClient{
		address: address,
		client:  client,
	}
}
252104
func NewFxEchoYARPCClient(name string, options ...protobuf.ClientOption) interface{} {
	return func(params FxEchoYARPCClientParams) FxEchoYARPCClientResult {
		return FxEchoYARPCClientResult{
			Client: NewEchoYARPCClient(params.Provider.ClientConfig(name), options...),
		}
	}
}
731198
func NewKeyClient(addr, port string, creds *Credentials, key *Key) *Client {
	return &Client{
		addr:        addr,
		port:        port,
		useAgent:    false,
		credentials: creds,
		key:         key,
	}
}
850316
func NewClientToken(uri, token string) Client {
	config := new(oauth2.Config)
	auther := config.Client(oauth2.NoContext, &oauth2.Token{AccessToken: token})
	return &client{client: auther, base: uri, token: token}
}
112425
func NewPGPDecrypt(g *libkb.GlobalContext, arg *PGPDecryptArg) *PGPDecrypt {
	return &PGPDecrypt{
		arg:          arg,
		Contextified: libkb.NewContextified(g),
	}
}
1052652
func NewPubControlClient(uri string) *PubControlClient {
    // This is basically the same as the default in Go 1.6, but with these changes:
    // Timeout: 30s -> 10s
    // TLSHandshakeTimeout: 10s -> 7s
    // MaxIdleConnsPerHost: 2 -> 100
    transport := &http.Transport{
        Proxy: http.ProxyFromEnvironment,
        Dial: (&net.Dialer{
            Timeout:   10 * time.Second,
            KeepAlive: 30 * time.Second,
        }).Dial,
        TLSHandshakeTimeout:   7 * time.Second,
        ExpectContinueTimeout: 1 * time.Second,
        MaxIdleConnsPerHost: 100,
    }

    newPcc := new(PubControlClient)
    newPcc.uri = uri
    newPcc.lock = &sync.Mutex{}
    newPcc.pubCall = pubCall
    newPcc.publish = publish
    newPcc.makeHttpRequest = makeHttpRequest
    newPcc.httpClient = &http.Client{Transport: transport, Timeout: 15 * time.Second}
    return newPcc
}
859860
func NewPGPEncrypt(g *libkb.GlobalContext, arg *PGPEncryptArg) *PGPEncrypt {
	return &PGPEncrypt{
		arg:          arg,
		Contextified: libkb.NewContextified(g),
	}
}
205425
func NewPublicKey(key interface{}) (PublicKey, error) {
	switch key := key.(type) {
	case *rsa.PublicKey:
		return (*rsaPublicKey)(key), nil
	case *ecdsa.PublicKey:
		if !supportedEllipticCurve(key.Curve) {
			return nil, errors.New("ssh: only P-256, P-384 and P-521 EC keys are supported.")
		}
		return (*ecdsaPublicKey)(key), nil
	case *dsa.PublicKey:
		return (*dsaPublicKey)(key), nil
	default:
		return nil, fmt.Errorf("ssh: unsupported key type %T", key)
	}
}
272120
func NewClient(p protocol.Protocol, t Transport) Client {
	return client{p: p, t: t}
}
534960
func NewCMSClient(accessKeyId, accessKeySecret string) *CMSClient {
	endpoint := os.Getenv("CMS_ENDPOINT")
	if endpoint == "" {
		endpoint = CMSDefaultEndpoint
	}
	return NewClientWithEndpoint(endpoint, accessKeyId, accessKeySecret)
}
1200588
func NewHTTPUClient() (*HTTPUClient, error) {
	conn, err := net.ListenPacket("udp", ":0")
	if err != nil {
		return nil, err
	}
	return &HTTPUClient{conn: conn}, nil
}
162393
func NewWithCustomHttpClient(apiKey, apiSecret string, httpClient *http.Client) *Bittrex {
	client := NewClientWithCustomHttpConfig(apiKey, apiSecret, httpClient)
	return &Bittrex{client}
}
278603
func NewHTTPClient(ctx context.Context, opt ...cloud.ClientOption) (*http.Client, string, error) {
	var o opts.DialOpt
	for _, opt := range opt {
		opt.Resolve(&o)
	}
	if o.GRPCClient != nil {
		return nil, "", errors.New("unsupported GRPC base transport specified")
	}
	// TODO(djd): Wrap all http.Clients with appropriate internal version to add
	// UserAgent header and prepend correct endpoint.
	if o.HTTPClient != nil {
		return o.HTTPClient, o.Endpoint, nil
	}
	if o.TokenSource == nil {
		var err error
		o.TokenSource, err = google.DefaultTokenSource(ctx, o.Scopes...)
		if err != nil {
			return nil, "", fmt.Errorf("google.DefaultTokenSource: %v", err)
		}
	}
	return oauth2.NewClient(ctx, o.TokenSource), o.Endpoint, nil
}