dbtls

package
v0.38.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 11, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrUnknownSSLMode is returned for an SSLMode value outside the supported set.
	ErrUnknownSSLMode = errors.New("unknown ssl mode")
	// ErrNoRootCert is returned when an ssl_root_cert file contains no usable
	// PEM certificates.
	ErrNoRootCert = errors.New("ssl root cert contains no valid PEM certificates")
	// ErrNoPeerCert is returned when the server completes a handshake without
	// presenting any certificate (only reachable in the verify modes).
	ErrNoPeerCert = errors.New("server presented no certificates")
)

Functions

func Config

func Config(mode config.SSLMode, rootCertPath, serverName string) (*tls.Config, error)

Config translates a config.SSLMode into a *tls.Config for a network database driver. A nil result means TLS is disabled and the caller should connect over plaintext. serverName is the host used for verify-full hostname matching and may be empty for the non-verifying modes.

  • disable (and the empty default): nil, nil — plaintext.
  • require: encryption only, no certificate or hostname verification.
  • verify-ca: verify the certificate chains to a trusted CA, skip hostname.
  • verify-full: verify the CA chain and that the certificate matches serverName.

rootCertPath optionally points at a PEM CA bundle used by the verify modes; when empty the host system pool is used.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL