package web import ( "encoding/pem" "fmt" "log" "github.com/gin-gonic/gin" "github.com/jasinco/crtman/internal/store" ) func Listen(host string, port string) { r := gin.Default() r.GET("/api/rootca.pem", func(ctx *gin.Context) { ca_pem := pem.Block{ Type: "CERTIFICATE", Bytes: store.RootCA, } ctx.Data(200, "application/x-x509-ca-cert", pem.EncodeToMemory(&ca_pem)) }) r.GET("/api/ocsp/:req", ocsp_handling) r.POST("/api/ocsp", ocsp_handling) err := r.Run(fmt.Sprintf("%s:%s", host, port)) if err != nil { log.Fatal(err) } }