Documentation
¶
Overview ¶
Package clienttls turns declarative client-side TLS material — PEM from a file path or a base64-encoded value — into a *tls.Config. It is the shared loader behind the httpclient TLS options and the Redis cache client, and it never disables certificate verification: no InsecureSkipVerify escape hatch exists here.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Build ¶
Build loads m into a *tls.Config. prefix names the consumer's error namespace, as in secretfile.LoadPEM. Material-free input is legal and yields a verifying config over the system roots.
func HasAnyMaterial ¶
HasAnyMaterial reports whether m names any PEM piece. ServerName and MinVersion are deliberately excluded: they tune a connection, they do not stage material for one.
func HasClientCert ¶
HasClientCert reports whether any cert or key field is set. A CA-only Material is server authentication alone: it presents no client certificate.
Types ¶
type Material ¶
type Material struct {
CertFile string
CertValue string
KeyFile string
KeyValue string
CAFile string
CAValue string
ServerName string
MinVersion string
}
Material is the client-side TLS material: three PEM pieces, each from a file path or a base64-encoded value, plus the SNI override and the version floor. Every field is a comparable type so the structs embedding it stay comparable.
type Violation ¶
Violation names the Material field (relative key such as "cafile") that breaks a structural rule, with the message to report. Field is relative on purpose: each consumer owns its own key namespace and prefixes it.
func ValidateMaterial ¶
ValidateMaterial applies the structural rules that need no filesystem: material staged under a disabled block, a piece configured from two sources, a half client-certificate pair, and the min-version enum. It returns nil when the shape is valid — enabled with no material at all is valid, and yields a config verifying against the system roots.
Reading and parsing the PEM happens later, in Build.