forked from TrueCloudLab/certificates
Remove deprecated code
This commit is contained in:
parent
518b597535
commit
7dc61bf233
2 changed files with 6 additions and 19 deletions
|
@ -136,8 +136,10 @@ func TestBootstrap(t *testing.T) {
|
||||||
if !reflect.DeepEqual(got.endpoint, tt.want.endpoint) {
|
if !reflect.DeepEqual(got.endpoint, tt.want.endpoint) {
|
||||||
t.Errorf("Bootstrap() endpoint = %v, want %v", got.endpoint, tt.want.endpoint)
|
t.Errorf("Bootstrap() endpoint = %v, want %v", got.endpoint, tt.want.endpoint)
|
||||||
}
|
}
|
||||||
if !reflect.DeepEqual(got.certPool, tt.want.certPool) {
|
gotTR := got.client.Transport.(*http.Transport)
|
||||||
t.Errorf("Bootstrap() certPool = %v, want %v", got.certPool, tt.want.certPool)
|
wantTR := tt.want.client.Transport.(*http.Transport)
|
||||||
|
if !reflect.DeepEqual(gotTR.TLSClientConfig.RootCAs, wantTR.TLSClientConfig.RootCAs) {
|
||||||
|
t.Errorf("Bootstrap() certPool = %v, want %v", gotTR.TLSClientConfig.RootCAs, wantTR.TLSClientConfig.RootCAs)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
19
ca/client.go
19
ca/client.go
|
@ -23,7 +23,6 @@ import (
|
||||||
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/smallstep/certificates/api"
|
"github.com/smallstep/certificates/api"
|
||||||
"golang.org/x/net/http2"
|
|
||||||
"gopkg.in/square/go-jose.v2/jwt"
|
"gopkg.in/square/go-jose.v2/jwt"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -237,10 +236,8 @@ func WithProvisionerLimit(limit int) ProvisionerOption {
|
||||||
|
|
||||||
// Client implements an HTTP client for the CA server.
|
// Client implements an HTTP client for the CA server.
|
||||||
type Client struct {
|
type Client struct {
|
||||||
client *http.Client
|
client *http.Client
|
||||||
endpoint *url.URL
|
endpoint *url.URL
|
||||||
certPool *x509.CertPool
|
|
||||||
cachedSign *api.SignResponse
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewClient creates a new Client with the given endpoint and options.
|
// NewClient creates a new Client with the given endpoint and options.
|
||||||
|
@ -259,23 +256,11 @@ func NewClient(endpoint string, opts ...ClientOption) (*Client, error) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
var cp *x509.CertPool
|
|
||||||
switch tr := tr.(type) {
|
|
||||||
case *http.Transport:
|
|
||||||
if tr.TLSClientConfig != nil && tr.TLSClientConfig.RootCAs != nil {
|
|
||||||
cp = tr.TLSClientConfig.RootCAs
|
|
||||||
}
|
|
||||||
case *http2.Transport:
|
|
||||||
if tr.TLSClientConfig != nil && tr.TLSClientConfig.RootCAs != nil {
|
|
||||||
cp = tr.TLSClientConfig.RootCAs
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return &Client{
|
return &Client{
|
||||||
client: &http.Client{
|
client: &http.Client{
|
||||||
Transport: tr,
|
Transport: tr,
|
||||||
},
|
},
|
||||||
endpoint: u,
|
endpoint: u,
|
||||||
certPool: cp,
|
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue