forked from Fuyu/router
Add TLS version of Start
This commit is contained in:
parent
15df08f21b
commit
60f82143da
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user