1
0
mirror of https://github.com/regclient/regclient.git synced 2025-04-17 11:37:11 +03:00
regclient/ping.go
Brandon Mitchell 0a514c3e2d
Updating Ping method
- Adds a struct to the return so headers can be inspected.
- Puts Ping into the scheme interface.
- Adds an ocidir implementation to verify directory is accessible.
- Fixes some http/auth handling.
- Warns on `regctl registry config` and `login` of Ping failure.

Signed-off-by: Brandon Mitchell <git@bmitch.net>
2023-11-08 19:41:19 -05:00

19 lines
390 B
Go

package regclient
import (
"context"
"github.com/regclient/regclient/types/ping"
"github.com/regclient/regclient/types/ref"
)
// Ping verifies access to a registry or equivalent.
func (rc *RegClient) Ping(ctx context.Context, r ref.Ref) (ping.Result, error) {
schemeAPI, err := rc.schemeGet(r.Scheme)
if err != nil {
return ping.Result{}, err
}
return schemeAPI.Ping(ctx, r)
}