Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
patapenka-alexey committed Mar 3, 2025
1 parent 67316ca commit 6b1ad99
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 29 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- `tt pack `: added TCM file packaging.
- `tt aeon connect`: add connection from the cluster config.
- `tt aeon connect`: add connection from the `app:insance_name`.
- `tt` can be built without linking to OpenSSL.

### Changed

### Fixed

- `tt connect`: return Lua parse error.
- `tt connect`: panic on render empty table.
- `tt` can be built without linking to OpenSSL.

## [2.8.0] - 2025-02-19

Expand Down
1 change: 1 addition & 0 deletions cli/cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ func collectTarantoolConfig(collectors libcluster.CollectorFactory,
if err != nil {
return nil, err
}

opts = append(opts, tarantoolOpts{
addr: addr,
dialer: dialer,
Expand Down
6 changes: 5 additions & 1 deletion lib/dial/dial.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@ import (
"github.com/tarantool/go-tarantool/v2"
)

// Dial creates new dialer according to the options.
func New(opts Opts) (tarantool.Dialer, error) {
transport := ConvertTransport(opts.Transport)
transport, err := Parse(opts.Transport)
if err != nil {
return nil, err
}

if transport == TransportDefault {
if opts.SslKeyFile != "" || opts.SslCaFile != "" || opts.SslCertFile != "" ||
Expand Down
27 changes: 0 additions & 27 deletions lib/dial/opts.go
Original file line number Diff line number Diff line change
@@ -1,32 +1,5 @@
package dial

// Transport is a type, with a restriction on the list of supported connection modes.
type Transport string

func (t Transport) String() string {
return string(t)
}

const (
TransportDefault Transport = ""
TransportPlain Transport = "plain"
TransportSSL Transport = "ssl"
TransportInvalid Transport = "invalid"
)

func ConvertTransport(tr string) Transport {
switch tr {
case "":
return TransportDefault
case "plain":
return TransportPlain
case "ssl":
return TransportSSL
default:
return TransportInvalid
}
}

type Opts struct {
Address string
User string
Expand Down
35 changes: 35 additions & 0 deletions lib/dial/transport.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package dial

import "fmt"

// Transport is a type, with a restriction on the list of supported connection modes.
type Transport string

func (t Transport) String() string {
return string(t)
}

const (
// TransportDefault used as default value.
TransportDefault Transport = ""
// TransportPlain used for insecure transport mode.
TransportPlain Transport = "plain"
// TransportSSL used for encrypted connection mode.
TransportSSL Transport = "ssl"
// TransportInvalid used to present invalid values.
TransportInvalid Transport = "invalid"
)

// Parse returns Transport type according to the input string.
func Parse(tr string) (Transport, error) {
switch tr {
case TransportDefault.String():
return TransportDefault, nil
case TransportPlain.String():
return TransportPlain, nil
case TransportSSL.String():
return TransportSSL, nil
default:
return TransportInvalid, fmt.Errorf("unknown Transport type: %s", tr)
}
}

0 comments on commit 6b1ad99

Please sign in to comment.