2023-12-12 22:05:57 +00:00
|
|
|
package http
|
|
|
|
|
|
|
|
import (
|
2023-12-12 22:33:14 +00:00
|
|
|
"log"
|
2023-12-12 22:05:57 +00:00
|
|
|
"net/http"
|
|
|
|
)
|
|
|
|
|
|
|
|
func ServeCertificate() {
|
|
|
|
http.HandleFunc("/server.key", func(w http.ResponseWriter, r *http.Request) {
|
2023-12-12 22:33:14 +00:00
|
|
|
w.Header().Set("Content-Type", "application/octet-stream")
|
2023-12-12 22:05:57 +00:00
|
|
|
http.ServeFile(w, r, "/certs/server.key")
|
|
|
|
})
|
|
|
|
http.HandleFunc("/server.pem", func(w http.ResponseWriter, r *http.Request) {
|
2023-12-12 22:33:14 +00:00
|
|
|
w.Header().Set("Content-Type", "application/x-x509-ca-cert")
|
2023-12-12 22:05:57 +00:00
|
|
|
http.ServeFile(w, r, "/certs/server.pem")
|
|
|
|
})
|
2023-12-12 22:33:14 +00:00
|
|
|
log.Printf("Serving cert files on :9229\n")
|
2023-12-12 22:05:57 +00:00
|
|
|
http.ListenAndServe(":9229", nil)
|
|
|
|
}
|