code: func NewV1Endpoint(index *registrytypes.IndexInfo, userAgent string, metaHeaders http.Header) (*V1Endpoint, error) {
  	tlsConfig, err := newTLSConfig(index.Name, index.Secure)
  	if err != nil {
  		return nil, err
  	}
  
  	endpoint, err := newV1EndpointFromStr(GetAuthConfigKey(index), tlsConfig, userAgent, metaHeaders)
  	if err != nil {
  		return nil, err
  	}
  
  	if err := validateEndpoint(endpoint); err != nil {
  		return nil, err
  	}
  
  	return endpoint, nil
  }
docs: // NewV1Endpoint parses the given address to return a registry endpoint.