Skip to content

Commit

Permalink
Package Socket:
Browse files Browse the repository at this point in the history
- client: fix TLS config for client
  • Loading branch information
nabbar committed Sep 6, 2024
1 parent 556cb36 commit 102d163
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 8 deletions.
6 changes: 2 additions & 4 deletions socket/client/tcp/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ type cli struct {
c *atomic.Value // net.Conn
}

func (o *cli) SetTLS(enable bool, config libtls.TLSConfig) error {
func (o *cli) SetTLS(enable bool, config libtls.TLSConfig, serverName string) error {
if !enable {
// #nosec
o.t.Store(&tlsCfg{
Expand All @@ -66,9 +66,7 @@ func (o *cli) SetTLS(enable bool, config libtls.TLSConfig) error {

if config == nil {
return fmt.Errorf("invalid tls config")
} else if l := config.GetCertificatePair(); len(l) < 1 {
return fmt.Errorf("invalid tls config, missing certificates pair")
} else if t := config.TlsConfig(""); t == nil {
} else if t := config.TlsConfig(serverName); t == nil {
return fmt.Errorf("invalid tls config")
} else {
o.t.Store(&tlsCfg{
Expand Down
2 changes: 1 addition & 1 deletion socket/client/udp/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ type cli struct {
c *atomic.Value // net.Conn
}

func (o *cli) SetTLS(enable bool, config libtls.TLSConfig) error {
func (o *cli) SetTLS(enable bool, config libtls.TLSConfig, serverName string) error {
return nil
}

Expand Down
2 changes: 1 addition & 1 deletion socket/client/unix/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ type cli struct {
c *atomic.Value // net.Conn
}

func (o *cli) SetTLS(enable bool, config libtls.TLSConfig) error {
func (o *cli) SetTLS(enable bool, config libtls.TLSConfig, serverName string) error {
return nil
}

Expand Down
2 changes: 1 addition & 1 deletion socket/client/unixgram/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ type cli struct {
c *atomic.Value // net.Conn
}

func (o *cli) SetTLS(enable bool, config libtls.TLSConfig) error {
func (o *cli) SetTLS(enable bool, config libtls.TLSConfig, serverName string) error {
return nil
}

Expand Down
2 changes: 1 addition & 1 deletion socket/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ type Server interface {
type Client interface {
io.ReadWriteCloser

SetTLS(enable bool, config libtls.TLSConfig) error
SetTLS(enable bool, config libtls.TLSConfig, serverName string) error

// RegisterFuncError registers a FuncError used to process errors during running process
// f FuncError
Expand Down

0 comments on commit 102d163

Please sign in to comment.