mirror of
https://github.com/Monibuca/plugin-webtransport.git
synced 2025-12-24 11:51:00 +08:00
fix: use embed cert
This commit is contained in:
24
main.go
24
main.go
@@ -20,17 +20,21 @@ 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
|
||||
if c.CertFile != "" {
|
||||
_, 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
|
||||
if c.KeyFile != "" {
|
||||
_, 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) {
|
||||
|
||||
Reference in New Issue
Block a user