Documentation
¶
Overview ¶
Package tlsconf turns the shared TLS file options into a tls.Config.
The four keys are ca_file, cert_file, key_file and tls_server_name. Every TLS protocol uses them the same way. ca_file replaces the system roots. cert_file and key_file are sent together when the server asks for a client certificate. The files are read when Apply runs, and the file bytes are not kept after the config is built.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Keys = []string{"ca_file", "cert_file", "key_file", "tls_server_name"}
Keys are the option names, in the order a "TLS is off" error reports them.
Functions ¶
Types ¶
type Files ¶
Files is the four options. Empty strings mean the option was not set.
func FromOptions ¶
FromOptions reads the four keys. A missing key and an empty value are the same.
func (Files) Apply ¶
Apply checks the options and fills cfg. tlsOn is false when the connection is plain text. insecure is true when the certificate will not be checked (-insecure, skip-verify, or a mode that skips verification). cfg must be a config no other goroutine is using. A nil cfg is only valid when nothing is set, or when TLS is off and Apply is reporting that.
On success the PEM bytes are discarded. cfg.RootCAs, when set, is only the certificates from ca_file.