Access tls config

This commit is contained in:
Asim
2016-01-16 23:39:47 +00:00
parent f7c4304ac3
commit ae2ab911ed
4 changed files with 39 additions and 12 deletions

View File

@@ -144,11 +144,15 @@ func (h *httpBroker) start() error {
var err error
if h.opts.Secure {
cert, err := mls.Certificate(h.address)
if err != nil {
return err
config := h.opts.TLSConfig
if config == nil {
cert, err := mls.Certificate(h.address)
if err != nil {
return err
}
config = &tls.Config{Certificates: []tls.Certificate{cert}}
}
l, err = tls.Listen("tcp", h.address, &tls.Config{Certificates: []tls.Certificate{cert}})
l, err = tls.Listen("tcp", h.address, config)
} else {
l, err = net.Listen("tcp", h.address)
}