Documentation
¶
Overview ¶
Package tlsdialer provides a TLS dialer for go-tarantool.
It serves as an interlayer between go-tarantool and a pluggable TLS engine. TLSDialer satisfies the tarantool.Dialer interface; the TLS handshake itself is delegated to a Backend.
Backends ¶
The TLS engine is selected via TLSDialer.Backend, which must be set — the dialer links no engine itself. The cgo OpenSSL engine lives in its own package, github.com/tarantool/go-tlsdialer/v2/backend/openssl (openssl.New()); pass it, or any value implementing Backend, to plug in a TLS engine. Because this package imports no engine, importing it never pulls in cgo: a program opts into OpenSSL/cgo only by importing the openssl package itself. The dialer's Ssl* fields are translated into Opts and handed to the backend, so the same configuration drives every engine.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Backend ¶
type Backend interface {
DialTLS(ctx context.Context, network, address string, opts Opts) (net.Conn, error)
}
Backend establishes a TLS connection for the dialer. It is the swap point between TLS engines (the default is the cgo OpenSSL engine in the backend/openssl sub-package) and the extension point for plugging in a custom TLS engine via TLSDialer.Backend.
DialTLS dials network/address, completes the TLS handshake, and returns the established connection. The returned net.Conn owns all engine resources: its Close must release everything the handshake allocated.
type Opts ¶
type Opts struct {
// KeyFile is a path to a private SSL key file.
KeyFile string
// CertFile is a path to an SSL certificate file.
CertFile string
// CaFile is a path to a trusted certificate authorities (CA) file.
CaFile string
// Ciphers is a colon-separated (:) list of SSL cipher suites in OpenSSL
// cipher-list syntax. Empty means the backend's default selection.
Ciphers string
// Password is a password for decrypting the private SSL key file.
// Tried before PasswordFile.
Password string
// PasswordFile is a path to a file with one candidate password per line,
// each tried in order after Password.
PasswordFile string
}
Opts carries the TLS configuration extracted from an TLSDialer's Ssl* fields. It is passed to a Backend, which interprets the values using whatever TLS engine it wraps.
The vocabulary is intentionally OpenSSL/Tarantool-flavoured (file paths and an OpenSSL cipher-list string) to preserve drop-in compatibility with the upstream go-tlsdialer. Each Backend translates these into its own engine's configuration: the OpenSSL backend hands the paths and cipher string to a C *openssl.Ctx.
A self-configured custom Backend is free to ignore Opts entirely.
type TLSDialer ¶ added in v2.0.1
type TLSDialer struct {
// Address is an address to connect.
// It could be specified in following ways:
//
// - TCP connections (tcp://192.168.1.1:3013, tcp://my.host:3013,
// tcp:192.168.1.1:3013, tcp:my.host:3013, 192.168.1.1:3013, my.host:3013)
//
// - Unix socket, first '/' or '.' indicates Unix socket
// (unix:///abs/path/tt.sock, unix:path/tt.sock, /abs/path/tt.sock,
// ./rel/path/tt.sock, unix/:path/tt.sock)
Address string
// Auth is an authentication method.
Auth tarantool.Auth
// Username for logging in to Tarantool.
User string
// User password for logging in to Tarantool.
Password string
// RequiredProtocol contains minimal protocol version and
// list of protocol features that should be supported by
// Tarantool server. By default, there are no restrictions.
RequiredProtocolInfo tarantool.ProtocolInfo
// SslKeyFile is a path to a private SSL key file.
SslKeyFile string
// SslCertFile is a path to an SSL certificate file.
SslCertFile string
// SslCaFile is a path to a trusted certificate authorities (CA) file.
SslCaFile string
// SslCiphers is a colon-separated (:) list of SSL cipher suites the connection
// can use.
//
// The OpenSSL backend passes this list to OpenSSL verbatim. TLSv1.2 is
// required because other protocol versions don't support the GOST cipher.
//
// The gostls backend parses the same syntax itself and resolves every name
// against its own suite registry, so an unknown name is an error instead of
// being silently ignored.
//
// See also
//
// * https://www.openssl.org/docs/man1.1.1/man1/ciphers.html
SslCiphers string
// SslPassword is a password for decrypting the private SSL key file.
// The priority is as follows: try to decrypt with SslPassword, then
// try SslPasswordFile.
SslPassword string
// SslPasswordFile is a path to the list of passwords for decrypting
// the private SSL key file. The connection tries every line from the
// file as a password.
SslPasswordFile string
// Backend selects the TLS engine used for the handshake and must be set.
// Use openssl.New() from github.com/tarantool/go-tlsdialer/v2/backend/openssl
// for the cgo OpenSSL engine, or supply any value implementing
// Backend to plug in a custom TLS engine. Dial returns an error if
// Backend is nil.
Backend Backend
}
TLSDialer allows to use SSL transport for connection.
The TLS engine is provided via Backend, which must be set; e.g. Backend: openssl.New() after importing github.com/tarantool/go-tlsdialer/v2/backend/openssl (requires cgo).
Directories
¶
| Path | Synopsis |
|---|---|
|
Package backend groups the concrete TLS engine implementations that satisfy the go-tlsdialer Backend abstraction.
|
Package backend groups the concrete TLS engine implementations that satisfy the go-tlsdialer Backend abstraction. |
|
gostls
Package gostls provides the pure-Go gostls TLS 1.2 engine for the go-tlsdialer TLSDialer.
|
Package gostls provides the pure-Go gostls TLS 1.2 engine for the go-tlsdialer TLSDialer. |
|
openssl
Package openssl provides the cgo OpenSSL TLS engine for the go-tlsdialer TLSDialer.
|
Package openssl provides the cgo OpenSSL TLS engine for the go-tlsdialer TLSDialer. |