connect

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2026 License: BSD-2-Clause Imports: 17 Imported by: 0

Documentation

Overview

Package connect provides utilities for connecting to storage backends.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNoEndpoint is returned when no endpoint is provided.
	ErrNoEndpoint = errors.New("at least one endpoint is required")
	// ErrSSLDisabled is returned when SSL is requested but support is disabled.
	ErrSSLDisabled = errors.New("SSL support is disabled")
	// ErrInvalidSSLConfig is returned when SSL configuration is invalid.
	ErrInvalidSSLConfig = errors.New("invalid SSL configuration")
)

Functions

This section is empty.

Types

type CleanupFunc

type CleanupFunc func()

CleanupFunc is a function type for cleaning up resources.

func NewEtcdStorage

func NewEtcdStorage(ctx context.Context, cfg Config) (storage.Storage, CleanupFunc, error)

NewEtcdStorage creates a new storage instance connected to an etcd cluster.

func NewStorage

func NewStorage(ctx context.Context, cfg Config) (storage.Storage, CleanupFunc, error)

NewStorage creates a new storage instance by trying to connect to etcd first, then TCS.

func NewTCSStorage

func NewTCSStorage(ctx context.Context, cfg Config) (storage.Storage, CleanupFunc, error)

NewTCSStorage creates a new storage instance connected to a Tarantool Cartridge Server (TCS).

type Config

type Config struct {
	// Endpoints is a list of storage endpoint addresses.
	Endpoints []string
	// Username is the username for authentication.
	Username string
	// Password is the password for authentication.
	Password string /* #nosec G117 */
	// SSL contains SSL/TLS configuration options.
	SSL SSLConfig
	// DialTimeout is the timeout for establishing connections.
	DialTimeout time.Duration
}

Config contains connection configuration options.

type SSLConfig

type SSLConfig struct {
	// Enable indicates whether SSL/TLS is enabled.
	Enable bool
	// CaFile is the path to the CA certificate file.
	CaFile string
	// CaPath is the path to a directory containing CA certificate files.
	CaPath string
	// CertFile is the path to the client certificate file.
	CertFile string
	// KeyFile is the path to the client private key file.
	KeyFile string
	// Ciphers is a colon-separated list of cipher suites in OpenSSL format.
	Ciphers string
	// Password is the password for decrypting the private key.
	Password string /* #nosec G117 */
	// PasswordFile is the path to a file containing the password for the private key.
	PasswordFile string
	// VerifyHost indicates whether to verify the server's hostname.
	VerifyHost bool
	// VerifyPeer indicates whether to verify the server's certificate.
	VerifyPeer bool
}

SSLConfig contains SSL/TLS configuration options.

Jump to

Keyboard shortcuts

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