aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2016-04-04 02:30:57 +0200
committerDimitri Sokolyuk <demon@dim13.org>2016-04-04 02:30:57 +0200
commite890a66d5729ba3e1df5f28759bc228575a9ef44 (patch)
tree667e1866b3bf62de481a68b95aa60b9c7e049980
parent16663e2524c0eea212bf5e9a0b3eccf5273c7fe2 (diff)
Cleanup
-rw-r--r--route.go8
-rw-r--r--server.go2
2 files changed, 4 insertions, 6 deletions
diff --git a/route.go b/route.go
index 04a488a..5f5d3ac 100644
--- a/route.go
+++ b/route.go
@@ -3,7 +3,6 @@ package goxy
import (
"crypto/tls"
"encoding/json"
- "errors"
"fmt"
"net/http"
"net/url"
@@ -26,12 +25,11 @@ func (r Route) String() string {
}
// GetCertificate returns certificate for SNI negotiation
-func (s SNI) GetCertificate(h *tls.ClientHelloInfo) (*tls.Certificate, error) {
- host := h.ServerName
- if v, ok := s[host]; ok {
+func (s SNI) getCertificate(h *tls.ClientHelloInfo) (*tls.Certificate, error) {
+ if v, ok := s[h.ServerName]; ok {
return v, nil
}
- return nil, errors.New("no cert for " + host)
+ return nil, fmt.Errorf("no cert for %q", h.ServerName)
}
func (r Routes) ServeHTTP(w http.ResponseWriter, _ *http.Request) {
diff --git a/server.go b/server.go
index 2122644..d55fb13 100644
--- a/server.go
+++ b/server.go
@@ -30,7 +30,7 @@ func NewServer(dataFile, listenWWW, listenTLS, listenRPC string) (*Server, error
rpcServer: http.Server{Addr: listenRPC},
}
server.tlsServer.TLSConfig = &tls.Config{
- GetCertificate: server.GetCertificate,
+ GetCertificate: server.getCertificate,
}
if dataFile != "" {
server.Load(dataFile)