diff --git a/router.go b/router.go index dd8cfd7..7b50138 100644 --- a/router.go +++ b/router.go @@ -2,6 +2,7 @@ package router import ( "context" + "crypto/tls" "net/http" "reflect" "time" @@ -101,6 +102,13 @@ func (r *Router) Start(addr string) error { return r.server.ListenAndServe() } +func (r *Router) StartTLS(addr, certFile, keyFile string, conf *tls.Config) error { + httpr := r.getHttpr() + + r.server = &http.Server{Addr: addr, Handler: httpr, TLSConfig: conf} + return r.server.ListenAndServeTLS(certFile, keyFile) +} + // Stop stops the web server func (r *Router) Stop() error { if r.server == nil {