mirror of
https://github.com/go-micro/go-micro.git
synced 2025-03-17 20:28:06 +02:00
support for tls on http plugin (#2126)
This commit is contained in:
parent
f9f5e7422d
commit
0f0ace1a44
@ -2,6 +2,7 @@
|
||||
package http
|
||||
|
||||
import (
|
||||
"crypto/tls"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net"
|
||||
@ -236,7 +237,17 @@ func (h *httpServer) Start() error {
|
||||
hd := h.hd
|
||||
h.Unlock()
|
||||
|
||||
ln, err := net.Listen("tcp", opts.Address)
|
||||
var (
|
||||
ln net.Listener
|
||||
err error
|
||||
)
|
||||
|
||||
if opts.TLSConfig != nil {
|
||||
ln, err = tls.Listen("tcp", opts.Address, opts.TLSConfig)
|
||||
} else {
|
||||
ln, err = net.Listen("tcp", opts.Address)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -307,6 +318,9 @@ func (h *httpServer) Stop() error {
|
||||
}
|
||||
|
||||
func (h *httpServer) String() string {
|
||||
if h.opts.TLSConfig != nil {
|
||||
return "https"
|
||||
}
|
||||
return "http"
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user