 Documentation
      ¶
      Documentation
      ¶
    
    
  
    
  
    Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type OpenSSLDialer ¶
type OpenSSLDialer 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.
	//
	// We don't provide a list of supported ciphers. This is what OpenSSL
	// does. The only limitation is usage of TLSv1.2 (because other protocol
	// versions don't seem to support the GOST cipher). To add additional
	// ciphers (GOST cipher), you must configure OpenSSL.
	//
	// 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
}
    OpenSSLDialer allows to use SSL transport for connection.
Example ¶
dialer := tlsdialer.OpenSSLDialer{
	Address:  "127.0.0.1:3014",
	User:     "test",
	Password: "test",
}
opts := tarantool.Opts{
	Timeout: 5 * time.Second,
}
// Start Tarantool instance with enabled ssl and set keys and credentials.
listen := "127.0.0.1:3014" + "?transport=ssl&"
listen += "ssl_key_file=testdata/localhost.key&"
listen += "ssl_cert_file=testdata/localhost.crt"
inst, err := test_helpers.StartTarantool(
	test_helpers.StartOpts{
		Dialer:       dialer,
		InitScript:   "testdata/config.lua",
		Listen:       listen,
		SslCertsDir:  "testdata",
		WaitStart:    100 * time.Millisecond,
		ConnectRetry: 10,
		RetryTimeout: 500 * time.Millisecond,
	},
)
if err != nil {
	fmt.Printf("Failed to create a Tarantool instance: %s", err)
	return
}
defer test_helpers.StopTarantool(inst)
ctx, cancel := context.WithTimeout(context.Background(), 500*time.Millisecond)
defer cancel()
conn, err := tarantool.Connect(ctx, dialer, opts)
if err != nil {
	fmt.Printf("Failed to create an example connection: %s", err)
	return
}
// Use the connection.
data, err := conn.Do(tarantool.NewPingRequest()).Get()
if err != nil {
	fmt.Printf("Error: %s", err)
} else {
	fmt.Printf("Data: %v", data)
}
Output: Data: []
 Click to show internal directories. 
   Click to hide internal directories.