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:
authorKamil Trzcinski <ayufan@ayufan.eu>2016-02-09 14:38:37 +0300
committerKamil Trzcinski <ayufan@ayufan.eu>2016-02-09 14:38:37 +0300
commit259af85e875293e9cd6061cf1058ea0cc2e83dcc (patch)
treecad3980bf191ce966fc91160e371851d5b419f7b /server.go
parent78de2cf5af7ba799590ec2c02c80276818d1aa36 (diff)
Add support for --listen-proxy
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{})