Open Wall1e opened 2 years ago
same issue
same issue
func NewRESTClientForHost(u, username, password string, opts config.Options) (RESTClient, error) { if !strings.HasSuffix(u, v2URLSuffix) { u += v2URLSuffix } harborURL, err := url.Parse(u) if err != nil { return nil, err } //构建客户端时, InsecureSkipVerify==true ,临时使用
authInfo := runtimeclient.BasicAuth(username, password)
if harborURL.Scheme == "https" {
var optsTLS runtimeclient.TLSClientOptions
optsTLS.InsecureSkipVerify = true
client, err := runtimeclient.TLSClient(optsTLS)
if err != nil {
return nil, err
}
v2SwaggerClient := v2client.New(runtimeclient.NewWithClient(harborURL.Host, harborURL.Path, []string{harborURL.Scheme}, client), strfmt.Default)
return NewRESTClient(v2SwaggerClient, opts, authInfo), nil
} else {
v2SwaggerClient := v2client.New(runtimeclient.New(harborURL.Host, harborURL.Path, []string{harborURL.Scheme}), strfmt.Default)
return NewRESTClient(v2SwaggerClient, opts, authInfo), nil
}
}
@wdt1988520 How to use it? Specifically, modify the source file of that version Looking forward for your response, thank you
how to make InsecureSkipVerify==true