Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-pages.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'server.go')
-rw-r--r--server.go11
1 files changed, 4 insertions, 7 deletions
diff --git a/server.go b/server.go
index 62647c89..4bd04496 100644
--- a/server.go
+++ b/server.go
@@ -6,12 +6,9 @@ import (
"net/http"
)
-type TLSHandler interface {
- http.Handler
- ServeTLS(*tls.ClientHelloInfo) (*tls.Certificate, error)
-}
+type TLSHandlerFunc func(*tls.ClientHelloInfo) (*tls.Certificate, error)
-func ListenAndServe(addr string, handler http.Handler) error {
+func ListenAndServe(addr string, handler http.HandlerFunc) error {
// create server
server := &http.Server{Addr: addr, Handler: handler}
@@ -25,11 +22,11 @@ func ListenAndServe(addr string, handler http.Handler) error {
return server.ListenAndServe()
}
-func ListenAndServeTLS(addr string, certFile, keyFile string, handler TLSHandler) error {
+func ListenAndServeTLS(addr string, certFile, keyFile string, handler http.HandlerFunc, tlsHandler TLSHandlerFunc) error {
// create server
server := &http.Server{Addr: addr, Handler: handler}
server.TLSConfig = &tls.Config{}
- server.TLSConfig.GetCertificate = handler.ServeTLS
+ server.TLSConfig.GetCertificate = tlsHandler
if *http2proto {
err := http2.ConfigureServer(server, &http2.Server{})