// Ping contacts a registry and returns the transport and URL of the registry or an error.
Ping contacts a registry and returns the transport and URL of the registry or an error.
// Ping contacts a registry and returns the transport and URL of the registry or an error .
func (c *Context) Ping(ctx gocontext.Context, registry *url.URL, insecure bool) (http.RoundTripper, *url.URL, error) {
	t := c.Transport
	if insecure && c.InsecureTransport != nil {
		t = c.InsecureTransport
	}
	src := *registry
	if len(src.Scheme) == 0 {
		src.Scheme = "https"
	}
	url, err := c.cachedPing(src)
	if err != nil {
		return nil, nil, err
	}
	if url != nil {
		return t, url, nil
	}
	redirect, err := c.ping(src, insecure, t)
	c.lock.Lock()
	defer c.lock.Unlock()
	c.pings[src] = err
	if err != nil {
		return nil, nil, err
	}
	if redirect != nil {
		c.redirect[src] = redirect
		src = *redirect
	}
	return t, &src, nil
}
func ( c * Context ) Ping ( ctx gocontext . Context , registry * url . URL , insecure bool ) ( http . RoundTripper , * url . URL , error ) { t := c . Transport if insecure && c . InsecureTransport != nil { t = c . InsecureTransport } src := * registry if len ( src . Scheme ) == 0 { src . Scheme = " " } url , err := c . cachedPing ( src ) if err != nil { return nil , nil , err } if url != nil { return t , url , nil } redirect , err := c . ping ( src , insecure , t ) c . lock . Lock ( ) defer c . lock . Unlock ( ) c . pings [ src ] = err if err != nil { return nil , nil , err } if redirect != nil { c . redirect [ src ] = redirect src = * redirect } return t , & src , nil }
Ping contacts a registry and returns the transport and URL of the registry or an error.
Ping contacts a registry and returns the transport and URL of the registry or an error .
// reused cached pings // follow redirects