summaryrefslogtreecommitdiff
path: root/pkg/web/handlers.go
blob: b7675f5097794ca6a49e39475a94eb7caee24c17 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package web

import (
	"net/http"
)

type CertHandler struct {
	Cainfo caInfo
}

func NewCertHandler(caCrt, caKey string) CertHandler {
	ci := newCaInfo(caCrt, caKey)
	ch := CertHandler{ci}
	return ch
}

func (ch *CertHandler) CertResponder(w http.ResponseWriter, r *http.Request) {
	ch.Cainfo.CertWriter(w)
}

func HttpFileHandler(route string, path string) {
	http.HandleFunc(route, func(w http.ResponseWriter, r *http.Request) {
		http.ServeFile(w, r, path)
	})
}