code: func AuthTransport(base http.RoundTripper, authConfig *types.AuthConfig, alwaysSetBasicAuth bool) http.RoundTripper {
  	if base == nil {
  		base = http.DefaultTransport
  	}
  	return &authTransport{
  		RoundTripper:       base,
  		AuthConfig:         authConfig,
  		alwaysSetBasicAuth: alwaysSetBasicAuth,
  		modReq:             make(map[*http.Request]*http.Request),
  	}
  }
docs: // AuthTransport handles the auth layer when communicating with a v1 registry (private or official)
  //
  // For private v1 registries, set alwaysSetBasicAuth to true.
  //
  // For the official v1 registry, if there isn't already an Authorization header in the request,
  // but there is an X-Docker-Token header set to true, then Basic Auth will be used to set the Authorization header.
  // After sending the request with the provided base http.RoundTripper, if an X-Docker-Token header, representing
  // a token, is present in the response, then it gets cached and sent in the Authorization header of all subsequent
  // requests.
  //
  // If the server sends a token without the client having requested it, it is ignored.
  //
  // This RoundTripper also has a CancelRequest method important for correct timeout handling.