Skip to content

Commit

Permalink
kgo: add DialTLS option
Browse files Browse the repository at this point in the history
Opts into TLS without requiring a tls.Config
  • Loading branch information
twmb committed Jun 3, 2023
1 parent 18e3c13 commit f1b923e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pkg/kgo/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,8 @@ func (cl *Client) OptValues(opt any) []any {
return []any{cfg.dialFn}
case namefn(DialTLSConfig):
return []any{cfg.dialTLS}
case namefn(DialTLS):
return []any{cfg.dialTLS != nil}
case namefn(SeedBrokers):
return []any{cfg.seedBrokers}
case namefn(MaxVersions):
Expand Down
6 changes: 6 additions & 0 deletions pkg/kgo/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,12 @@ func DialTLSConfig(c *tls.Config) Opt {
return clientOpt{func(cfg *cfg) { cfg.dialTLS = c }}
}

// DialTLS opts into dialing brokers with TLS. This is a shortcut for
// DialTLSConfig with an empty config. See DialTLSConfig for more details.
func DialTLS() Opt {
return DialTLSConfig(new(tls.Config))
}

// SeedBrokers sets the seed brokers for the client to use, overriding the
// default 127.0.0.1:9092.
//
Expand Down

0 comments on commit f1b923e

Please sign in to comment.