From 6289b682478068d7a627b6c28b3d8e836822803c Mon Sep 17 00:00:00 2001 From: Daniel Nephin Date: Mon, 21 Jun 2021 12:29:07 -0400 Subject: [PATCH] tlsutil: document Configurator and some of its fields --- tlsutil/config.go | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/tlsutil/config.go b/tlsutil/config.go index 9b93bcc104..d9b20e2ab1 100644 --- a/tlsutil/config.go +++ b/tlsutil/config.go @@ -168,16 +168,20 @@ type manual struct { cert *tls.Certificate } -// Configurator holds a Config and is responsible for generating all the -// *tls.Config necessary for Consul. Except the one in the api package. +// Configurator provides tls.Config and net.Dial wrappers to enable TLS for +// clients and servers, for both HTTPS and RPC requests. +// Configurator receives an initial TLS configuration from agent configuration, +// and receives updates from config reloads, auto-encrypt, and auto-config. type Configurator struct { // lock synchronizes access to all fields on this struct except for logger and version. - lock sync.RWMutex - base *Config - autoTLS autoTLS - manual *manual + lock sync.RWMutex + base *Config + autoTLS autoTLS + manual *manual + caPool *x509.CertPool + // peerDatacenterUseTLS is a map of DC name to a bool indicating if the DC + // uses TLS for RPC requests. peerDatacenterUseTLS map[string]bool - caPool *x509.CertPool // logger is not protected by a lock. It must never be changed after // Configurator is created.