mirror of https://github.com/tidwall/tile38.git
Add endpoint option for sasl
This commit is contained in:
parent
7dddca165c
commit
aed3b1a95f
internal/endpoint
|
@ -64,6 +64,7 @@ type Endpoint struct {
|
||||||
Host string
|
Host string
|
||||||
Port int
|
Port int
|
||||||
TopicName string
|
TopicName string
|
||||||
|
SASL bool
|
||||||
TLS bool
|
TLS bool
|
||||||
CACertFile string
|
CACertFile string
|
||||||
CertFile string
|
CertFile string
|
||||||
|
@ -412,6 +413,8 @@ func parseEndpoint(s string) (Endpoint, error) {
|
||||||
endpoint.Kafka.CertFile = val[0]
|
endpoint.Kafka.CertFile = val[0]
|
||||||
case "key":
|
case "key":
|
||||||
endpoint.Kafka.KeyFile = val[0]
|
endpoint.Kafka.KeyFile = val[0]
|
||||||
|
case "sasl":
|
||||||
|
endpoint.Kafka.SASL, _ = strconv.ParseBool(val[0])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,7 +76,9 @@ func (conn *KafkaConn) Send(msg string) error {
|
||||||
}
|
}
|
||||||
cfg.Net.TLS.Enable = true
|
cfg.Net.TLS.Enable = true
|
||||||
cfg.Net.TLS.Config = tlsConfig
|
cfg.Net.TLS.Config = tlsConfig
|
||||||
} else {
|
}
|
||||||
|
|
||||||
|
if conn.ep.Kafka.SASL {
|
||||||
log.Debugf("building kafka sasl config")
|
log.Debugf("building kafka sasl config")
|
||||||
cfg.ClientID = "sasl_scram_client"
|
cfg.ClientID = "sasl_scram_client"
|
||||||
cfg.Net.SASL.Enable = true
|
cfg.Net.SASL.Enable = true
|
||||||
|
|
Loading…
Reference in New Issue