aboutsummaryrefslogtreecommitdiff
path: root/route.go
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2016-03-31 16:27:26 +0200
committerDimitri Sokolyuk <demon@dim13.org>2016-03-31 16:27:26 +0200
commit3979e206469607aba15a1833d6bdafd07ed00283 (patch)
tree31d1b8febac6a9f806ff3e382a44b487e635dac2 /route.go
parent7cb7f7d4d90714d50331c68e97fc5169c4f67991 (diff)
Test TLS
Diffstat (limited to 'route.go')
-rw-r--r--route.go13
1 files changed, 10 insertions, 3 deletions
diff --git a/route.go b/route.go
index 5e1b806..83998fd 100644
--- a/route.go
+++ b/route.go
@@ -21,10 +21,17 @@ type route struct {
// GetCertificate returns certificate for SNI negotiation
func (r Route) GetCertificate(h *tls.ClientHelloInfo) (*tls.Certificate, error) {
- if route, ok := r[h.ServerName]; ok && route.Certificate != nil {
- return route.Certificate, nil
+ host := h.ServerName
+ if v, ok := r[host]; ok && v.Certificate != nil {
+ return v.Certificate, nil
}
- return nil, errors.New("no cert for " + h.ServerName)
+ // HACK search for certs with port speciefied
+ for k, v := range r {
+ if k[:len(host)] == host {
+ return v.Certificate, nil
+ }
+ }
+ return nil, errors.New("no cert for " + host)
}
// Save routes to persistent file