code: func getHTTPTransport(authConfig authtypes.AuthConfig, endpoint registry.APIEndpoint, repoName string, userAgent string) (http.RoundTripper, error) {
  	// get the http transport, this will be used in a client to upload manifest
  	base := &http.Transport{
  		Proxy: http.ProxyFromEnvironment,
  		Dial: (&net.Dialer{
  			Timeout:   30 * time.Second,
  			KeepAlive: 30 * time.Second,
  			DualStack: true,
  		}).Dial,
  		TLSHandshakeTimeout: 10 * time.Second,
  		TLSClientConfig:     endpoint.TLSConfig,
  		DisableKeepAlives:   true,
  	}
  
  	modifiers := registry.Headers(userAgent, http.Header{})
  	authTransport := transport.NewTransport(base, modifiers...)
  	challengeManager, confirmedV2, err := registry.PingV2Registry(endpoint.URL, authTransport)
  	if err != nil {
  		return nil, errors.Wrap(err, "error pinging v2 registry")
  	}
  	if !confirmedV2 {
  		return nil, fmt.Errorf("unsupported registry version")
  	}
  	if authConfig.RegistryToken != "" {
  		passThruTokenHandler := &existingTokenHandler{token: authConfig.RegistryToken}
  		modifiers = append(modifiers, auth.NewAuthorizer(challengeManager, passThruTokenHandler))
  	} else {
  		creds := registry.NewStaticCredentialStore(&authConfig)
  		tokenHandler := auth.NewTokenHandler(authTransport, creds, repoName, "push", "pull")
  		basicHandler := auth.NewBasicHandler(creds)
  		modifiers = append(modifiers, auth.NewAuthorizer(challengeManager, tokenHandler, basicHandler))
  	}
  	return transport.NewTransport(base, modifiers...), nil
  }
docs: // getHTTPTransport builds a transport for use in communicating with a registry