From dff228cdbb4557e2ec7824e990cb6d1cf5817309 Mon Sep 17 00:00:00 2001 From: Lain Iwakura Date: Sat, 12 Jul 2025 19:09:40 +0300 Subject: [PATCH] shit --- main.go | 30 ++++++------------------------ 1 file changed, 6 insertions(+), 24 deletions(-) diff --git a/main.go b/main.go index e72b336..035d57b 100644 --- a/main.go +++ b/main.go @@ -209,32 +209,14 @@ 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", "0BSD_FOR_EVERYONE") - w.Header().Set("X-Powered-By", "0BSD_FOR_EVERYONE") - - if r.Method == "GET" && r.URL.Path == "/" { - handler(w, r) - return - } - - 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

")) - }), + Addr: ":" + p, + Handler: mux, ReadTimeout: 30 * time.Second, WriteTimeout: 30 * time.Second, IdleTimeout: 60 * time.Second,