Add TLS version of Start

This commit is contained in:
Nise Void 2019-06-11 16:30:58 +02:00
parent 15df08f21b
commit 60f82143da
Signed by untrusted user: NiseVoid
GPG Key ID: FBA14AC83EA602F3

View File

@ -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 {