k3s/vendor/github.com/rancher/kine/pkg/tls/config.go
Darren Shepherd a005219c5b Update vendor
2019-08-22 09:14:47 -07:00

32 lines
495 B
Go

package tls
import (
"crypto/tls"
"github.com/coreos/etcd/pkg/transport"
)
type Config struct {
CAFile string
CertFile string
KeyFile string
}
func (c Config) ClientConfig() (*tls.Config, error) {
if c.CertFile == "" && c.KeyFile == "" && c.CAFile == "" {
return nil, nil
}
info := &transport.TLSInfo{
CertFile: c.CertFile,
KeyFile: c.KeyFile,
CAFile: c.CAFile,
}
tlsConfig, err := info.ClientConfig()
if err != nil {
return nil, err
}
return tlsConfig, nil
}