Skip to content

Commit 296e201

Browse files
committed
Add tls support
1 parent 78b4049 commit 296e201

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

kafka-ops.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
"gopkg.in/yaml.v2"
1313
"encoding/json"
1414
"errors"
15+
"crypto/tls"
1516
)
1617

1718
var (
@@ -148,6 +149,13 @@ func main() {
148149
os.Exit(1)
149150
}
150151
}
152+
if strings.HasSuffix(protocol, "_ssl") {
153+
config.Net.TLS.Enable = true
154+
tlsConfig := tls.Config{
155+
InsecureSkipVerify: true,
156+
}
157+
config.Net.TLS.Config = &tlsConfig
158+
}
151159

152160
admin, err := sarama.NewClusterAdmin(brokerAddrs, config)
153161
if err != nil {

0 commit comments

Comments
 (0)