mirror of
				https://github.com/go-micro/go-micro.git
				synced 2025-10-30 23:27:41 +02:00 
			
		
		
		
	support for tls on http plugin (#2126)
This commit is contained in:
		| @@ -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" | ||||
| } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user