// NewTransport returns a DC/OS transport implementation by leveraging a roundtripper for
// IAM configuration if passed with a pre-configured TLS configuration.
437551
func NewTransport(clientOptionFuncs ...OptionTransportFunc) (http.RoundTripper, error) {
	t := dcosTransport{}
	for _, opt := range clientOptionFuncs {
		if err := opt(&t); err != nil {
			return nil, err
		}
	}

	tr, err := configureTLS(t.CaCertificatePath)
	if err != nil {
		return nil, err
	}

	if len(t.IAMConfigPath) != 0 {
		withIAM, err := NewRoundTripper(
			tr,
			OptionReadIAMConfig(t.IAMConfigPath))
		if err != nil {
			return nil, err
		}
		return withIAM, nil
	}

	return tr, nil
}
467171
func NewTransaction(name string) (*Transaction, error) {
	params := transactionRequest{Name: name}
	req := NewJSON2Request("new-transaction", APICounter(), params)

	resp, err := walletRequest(req)
	if err != nil {
		return nil, err
	}
	if resp.Error != nil {
		return nil, resp.Error
	}

	tx := new(Transaction)
	if err := json.Unmarshal(resp.JSONResult(), tx); err != nil {
		return nil, err
	}
	return tx, nil
}
246739
func (t *CustomTransport) RoundTrip(request *http.Request) (*http.Response, error) {
	if len(t.Headers) != 0 {
		for header, value := range t.Headers {
			request.Header.Add(header, value)
		}
	}

	resp, err := t.Transport.RoundTrip(request)

	return resp, err
}
1075827
func QUICTransporter(config *QUICConfig) Transporter {
	if config == nil {
		config = &QUICConfig{}
	}
	return &quicTransporter{
		config:   config,
		sessions: make(map[string]*quicSession),
	}
}
262931
func (c *Configurator) MustRegisterTransport(t TransportSpec) {
	if err := c.RegisterTransport(t); err != nil {
		panic(err)
	}
}
1332864
func LoggedTransport(t *http.Transport, requestBody, responseBody, timing bool) http.RoundTripper {
	return &LoggingTransport{t, requestBody, responseBody, timing}
}
259067
func NewTransferEvent(snapshotch chan<- fab.EventSnapshot, errch chan<- error) *TransferEvent {
	return &TransferEvent{
		ErrCh:      errch,
		SnapshotCh: snapshotch,
	}
}
257914
func (r *Request) SetTransport(transport http.RoundTripper) *Request {
	r.setting.Transport = transport
	return r
}
716622
func NewThriftTransportWithMaxBufferSize(service *Service, timeout time.Duration, maxLength uint32) *ThriftTransport {
	return &ThriftTransport{
		WrappedFactory: thrift.NewTFramedTransportFactoryMaxLength(thrift.NewTTransportFactory(), maxLength),
		service:        service,
		randSource:     rand.New(rand.NewSource(time.Now().UnixNano())),
		Dialer: net.Dialer{
			Timeout: timeout,
		},
		logger: log.NewContext(service.stateLog).With(logkey.Protocol, "thrift"),
	}
}
1044235
func (tm *transactionManager) newTransaction(id string, q *query) *transaction {
	return &transaction{
		id:       id,
		query:    q,
		response: make(chan struct{}, tm.dht.Try+1),
	}
}
774639
func (t *Transferer) NewTransfer(conf *TransferConfig) (*storagetransfer.TransferJob, error) {
	job, err := conf.Job()
	if err != nil {
		return nil, err
	}

	return t.svc.Create(job).Do()
}
178699
func NewThriftTransport(service *Service, timeout time.Duration) *ThriftTransport {
	return NewThriftTransportWithMaxBufferSize(service, timeout, thrift.DEFAULT_MAX_LENGTH)
}
994206
func NewTranslator(apiKey string) translator.Translator {
	authenticator := newAuthenticator(apiKey)
	router := newRouter()

	return &api{
		lp: newLanguageProvider(authenticator, router),
		tp: newTranslationProvider(authenticator, router),
	}
}
473424
func NewHTTPSTransport(cc *tls.Config) *http.Transport {
	// this seems like a bad idea but was here in the previous version
	if cc != nil {
		cc.InsecureSkipVerify = true
	}

	tr := &http.Transport{
		Proxy: http.ProxyFromEnvironment,
		Dial: (&net.Dialer{
			Timeout:   30 * time.Second,
			KeepAlive: 30 * time.Second,
		}).Dial,
		TLSHandshakeTimeout: 10 * time.Second,
		TLSClientConfig:     cc,
		MaxIdleConnsPerHost: 25,
	}

	return tr
}
167777
func NewTransportHandle(name string, t envelope.Transport) (Handle, error) {
	client := api.NewPluginClient(multiplex.NewClient(
		"Plugin",
		envelope.NewClient(_proto, t),
	))

	handshake, err := client.Handshake(&api.HandshakeRequest{})
	if err != nil {
		return nil, errHandshakeFailed{Name: name, Reason: err}
	}

	if handshake.Name != name {
		return nil, errHandshakeFailed{
			Name:   name,
			Reason: errNameMismatch{Want: name, Got: handshake.Name},
		}
	}

	if handshake.APIVersion != api.APIVersion {
		return nil, errHandshakeFailed{
			Name:   name,
			Reason: errAPIVersionMismatch{Want: api.APIVersion, Got: handshake.APIVersion},
		}
	}

	features := make(map[api.Feature]struct{}, len(handshake.Features))
	for _, feature := range handshake.Features {
		features[feature] = struct{}{}
	}

	return &transportHandle{
		name:      name,
		Transport: t,
		Client:    client,
		Running:   atomic.NewBool(true),
		Features:  features,
	}, nil
}
422307
func NewTransferFolderArg(SharedFolderId string, ToDropboxId string) *TransferFolderArg {
	s := new(TransferFolderArg)
	s.SharedFolderId = SharedFolderId
	s.ToDropboxId = ToDropboxId
	return s
}
682539
func (p *Pool) NewTransaction() *Transaction {
	t := &Transaction{
		conn: p.NewConn(),
	}
	return t
}