dialkit

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2026 License: MIT Imports: 6 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package dialkit is what the dial packages of the kinds of segment store share: the TLS configuration of a connection, the class of a failed dial, and the bounds and timeouts of a connection. It names no client library, so that every kind (redisdial, valkeydial) uses the same code and no kind imports another.

Index

Constants

View Source
const (
	// DefaultDialBound is the bound of one dial when timeouts.connect is unset: the default dial timeout of go-redis and
	// valkey-go.
	DefaultDialBound = 5 * time.Second
	// DefaultReadBound is the default read timeout of go-redis.
	DefaultReadBound = 3 * time.Second
)

Variables

View Source
var (
	// ErrCertificate is the class of a dial that failed because the certificate of the store was not verified (a CA that
	// did not sign it, a name that does not match, an expired certificate).
	ErrCertificate = errors.New("tls: the certificate of the store was not verified")

	// ErrNoCertificate is returned for a CA bundle file that holds no certificate.
	ErrNoCertificate = errors.New("no certificate in the file")
)

Functions

func Bound

Bound is the duration setting d, or def when it is unset or not positive.

func DialClass

func DialClass(err, unavailable error) error

DialClass reduces the error of a dial to its class, so that no address or certificate text reaches a log line: a certificate that was not verified is ErrCertificate, anything else is unavailable, the sentinel that the provider of the kind uses for a store that cannot be reached.

func Duration

func Duration(d *bootstrap.Duration) time.Duration

Duration is the value of a duration setting, zero when it is unset.

func LookupTimeout

func LookupTimeout(d *bootstrap.Duration) time.Duration

LookupTimeout is the timeout of one lookup call: the setting of the connection, 100ms when unset.

func TLSConfig

func TLSConfig(cfg *bootstrap.StoreTLS, secrets bootstrap.LoadOptions) (*tls.Config, error)

TLSConfig is the TLS configuration of a connection that asks for TLS (see TLSEnabled). Its error is about the CA bundle file (a file that cannot be read, or ErrNoCertificate): the caller says so ("tls.caBundleFile: ...").

func TLSEnabled

func TLSEnabled(cfg *bootstrap.StoreTLS) bool

TLSEnabled reports whether the connection asks for TLS.

Types

This section is empty.

Jump to

Keyboard shortcuts

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