diff --git a/main.go b/main.go index 1eac336..5cf14d5 100644 --- a/main.go +++ b/main.go @@ -2,9 +2,11 @@ package webtransport import ( "net/http" + "os" "strconv" "github.com/quic-go/quic-go" + "go.uber.org/zap" . "m7s.live/engine/v4" ) @@ -17,6 +19,18 @@ type WebTransportConfig struct { func (c *WebTransportConfig) OnEvent(event any) { switch event.(type) { case FirstConfig: + _, err := os.Stat(c.CertFile) + if err != nil { + plugin.Error("need certfile", zap.Error(err)) + plugin.Disabled = true + return + } + _, err = os.Stat(c.KeyFile) + if err != nil { + plugin.Error("need keyfile", zap.Error(err)) + plugin.Disabled = true + return + } mux := http.NewServeMux() mux.HandleFunc("/play/", func(w http.ResponseWriter, r *http.Request) { streamPath := r.URL.Path[len("/play/"):]