mirror of https://github.com/status-im/consul.git
tlsutil: un-ptr and document the manual struct
This commit is contained in:
parent
6289b68247
commit
1ba5acb284
|
@ -163,6 +163,8 @@ func (a autoTLS) caPems() []string {
|
||||||
return append(a.manualCAPems, a.connectCAPems...)
|
return append(a.manualCAPems, a.connectCAPems...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// manual stores the TLS CA and cert received from Configurator.Update which
|
||||||
|
// generally comes from the agent configuration.
|
||||||
type manual struct {
|
type manual struct {
|
||||||
caPems []string
|
caPems []string
|
||||||
cert *tls.Certificate
|
cert *tls.Certificate
|
||||||
|
@ -177,7 +179,7 @@ type Configurator struct {
|
||||||
lock sync.RWMutex
|
lock sync.RWMutex
|
||||||
base *Config
|
base *Config
|
||||||
autoTLS autoTLS
|
autoTLS autoTLS
|
||||||
manual *manual
|
manual manual
|
||||||
caPool *x509.CertPool
|
caPool *x509.CertPool
|
||||||
// peerDatacenterUseTLS is a map of DC name to a bool indicating if the DC
|
// peerDatacenterUseTLS is a map of DC name to a bool indicating if the DC
|
||||||
// uses TLS for RPC requests.
|
// uses TLS for RPC requests.
|
||||||
|
@ -202,7 +204,6 @@ func NewConfigurator(config Config, logger hclog.Logger) (*Configurator, error)
|
||||||
|
|
||||||
c := &Configurator{
|
c := &Configurator{
|
||||||
logger: logger.Named(logging.TLSUtil),
|
logger: logger.Named(logging.TLSUtil),
|
||||||
manual: &manual{},
|
|
||||||
peerDatacenterUseTLS: map[string]bool{},
|
peerDatacenterUseTLS: map[string]bool{},
|
||||||
}
|
}
|
||||||
err := c.Update(config)
|
err := c.Update(config)
|
||||||
|
|
|
@ -506,7 +506,7 @@ func TestConfigurator_ErrorPropagation(t *testing.T) {
|
||||||
variants = append(variants, variant{Config{TLSMinVersion: v}, false, false})
|
variants = append(variants, variant{Config{TLSMinVersion: v}, false, false})
|
||||||
}
|
}
|
||||||
|
|
||||||
c := Configurator{manual: &manual{}}
|
c := Configurator{}
|
||||||
for i, v := range variants {
|
for i, v := range variants {
|
||||||
info := fmt.Sprintf("case %d, config: %+v", i, v.config)
|
info := fmt.Sprintf("case %d, config: %+v", i, v.config)
|
||||||
_, err1 := NewConfigurator(v.config, nil)
|
_, err1 := NewConfigurator(v.config, nil)
|
||||||
|
|
Loading…
Reference in New Issue