Skip to content

Commit f1b923e

Browse files
committed
kgo: add DialTLS option
Opts into TLS without requiring a tls.Config
1 parent 18e3c13 commit f1b923e

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

‎pkg/kgo/client.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,8 @@ func (cl *Client) OptValues(opt any) []any {
248248
return []any{cfg.dialFn}
249249
case namefn(DialTLSConfig):
250250
return []any{cfg.dialTLS}
251+
case namefn(DialTLS):
252+
return []any{cfg.dialTLS != nil}
251253
case namefn(SeedBrokers):
252254
return []any{cfg.seedBrokers}
253255
case namefn(MaxVersions):

‎pkg/kgo/config.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -642,6 +642,12 @@ func DialTLSConfig(c *tls.Config) Opt {
642642
return clientOpt{func(cfg *cfg) { cfg.dialTLS = c }}
643643
}
644644

645+
// DialTLS opts into dialing brokers with TLS. This is a shortcut for
646+
// DialTLSConfig with an empty config. See DialTLSConfig for more details.
647+
func DialTLS() Opt {
648+
return DialTLSConfig(new(tls.Config))
649+
}
650+
645651
// SeedBrokers sets the seed brokers for the client to use, overriding the
646652
// default 127.0.0.1:9092.
647653
//

0 commit comments

Comments
 (0)