From f5c177c19eb3f0e810cabbd82e507446a922bb05 Mon Sep 17 00:00:00 2001 From: Lain Iwakura Date: Sat, 12 Jul 2025 19:06:38 +0300 Subject: [PATCH] update --- main.go | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/main.go b/main.go index 99bd2c1..e72b336 100644 --- a/main.go +++ b/main.go @@ -209,26 +209,31 @@ func main() { wg.Add(1) go func(p string) { defer wg.Done() - mux := http.NewServeMux() - mux.HandleFunc("/", handler) - mux.HandleFunc("/ws", wsHandler) - mux.HandleFunc("/status", statusHandler) server := &http.Server{ Addr: ":" + p, Handler: http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.Header().Set("Server", "Apache/2.4.41 (Ubuntu)") - w.Header().Set("X-Powered-By", "PHP/7.4.3") + w.Header().Set("Server", "0BSD_FOR_EVERYONE") + w.Header().Set("X-Powered-By", "0BSD_FOR_EVERYONE") - defer func() { - if r := recover(); r != nil { - w.Header().Set("Content-Type", "text/html; charset=utf-8") - w.WriteHeader(404) - w.Write([]byte("

Not Found

")) - } - }() + if r.Method == "GET" && r.URL.Path == "/" { + handler(w, r) + return + } - mux.ServeHTTP(w, r) + if r.URL.Path == "/ws" { + wsHandler(w, r) + return + } + + if r.URL.Path == "/status" { + statusHandler(w, r) + return + } + + w.Header().Set("Content-Type", "text/html; charset=utf-8") + w.WriteHeader(404) + w.Write([]byte("

Not Found

")) }), ReadTimeout: 30 * time.Second, WriteTimeout: 30 * time.Second,