Documentation
¶
Overview ¶
Package redistls provides TLS fixtures for Redis tests: a TLS-only in-memory Redis endpoint verified by a test CA, and on-disk certificates for running a real Redis server with TLS.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CACertPEM ¶
CACertPEM returns a PEM-encoded CA certificate for tests that only need valid certificate bytes.
func Start ¶
Start runs a TLS-only Redis endpoint and returns it together with the path of the CA certificate that verifies it.
func StartWithCertificates ¶
func StartWithCertificates(t *testing.T, certs *Certificates) *miniredis.Miniredis
StartWithCertificates runs a TLS-only Redis endpoint that presents the server certificate from certs.
Types ¶
type Certificates ¶
type Certificates struct {
// CACertFile is the CA a client must trust to complete the handshake.
CACertFile string
// ServerCertFile and ServerKeyFile are the server's certificate and key.
ServerCertFile string
ServerKeyFile string
// contains filtered or unexported fields
}
Certificates are PEM files for a private CA and a server certificate signed by it. The server certificate is valid only for the IP address 127.0.0.1 (no DNS names), so dialing the server as "localhost" must fail hostname verification.
func NewCertificates ¶
func NewCertificates(dir string) (*Certificates, error)
NewCertificates generates a private CA and a 127.0.0.1 server certificate and writes them to dir as ca.crt, server.crt and server.key (mode 0600).