local-ip.sh/http/server.go

20 lines
531 B
Go
Raw Normal View History

2023-12-12 22:05:57 +00:00
package http
import (
"log"
2023-12-12 22:05:57 +00:00
"net/http"
)
func ServeCertificate() {
http.HandleFunc("/server.key", func(w http.ResponseWriter, r *http.Request) {
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) {
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")
})
log.Printf("Serving cert files on :9229\n")
2023-12-12 22:05:57 +00:00
http.ListenAndServe(":9229", nil)
}