serve wildcard certificate files

This commit is contained in:
m5r 2023-12-12 23:05:57 +01:00
parent 18932d3873
commit c639bddaeb
No known key found for this signature in database
GPG Key ID: 5BC847276DD5DDEA
2 changed files with 19 additions and 1 deletions

15
http/server.go Normal file
View File

@ -0,0 +1,15 @@
package http
import (
"net/http"
)
func ServeCertificate() {
http.HandleFunc("/server.key", func(w http.ResponseWriter, r *http.Request) {
http.ServeFile(w, r, "/certs/server.key")
})
http.HandleFunc("/server.pem", func(w http.ResponseWriter, r *http.Request) {
http.ServeFile(w, r, "/certs/server.pem")
})
http.ListenAndServe(":9229", nil)
}

View File

@ -6,6 +6,7 @@ import (
"time"
"local-ip.sh/certs"
"local-ip.sh/http"
"local-ip.sh/xip"
)
@ -15,7 +16,7 @@ const (
)
func main() {
var port = flag.Int("port", 53, "port the DNS server should bind to")
port := flag.Int("port", 53, "port the DNS server should bind to")
flag.Parse()
n := xip.NewXip(zone, strings.Split(nameservers, ","), *port)
@ -34,5 +35,7 @@ func main() {
}
}()
go http.ServeCertificate()
n.StartServer()
}