From 08800326dac5410cf924c35b1aa136ef776803c2 Mon Sep 17 00:00:00 2001 From: Lain Iwakura Date: Sat, 12 Jul 2025 01:02:29 +0300 Subject: [PATCH] updated --- main.go | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/main.go b/main.go index 516c743..30ba279 100644 --- a/main.go +++ b/main.go @@ -71,13 +71,10 @@ func wsHandler(w http.ResponseWriter, r *http.Request) { func handler(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "text/html; charset=utf-8") - - query := r.URL.Query().Get("q") - - if query == "lain" { - http.Redirect(w, r, "https://fauux.neocities.org", http.StatusFound) - return - } + w.Header().Set("Server", "0BSD_FOR_EVERYONE") + w.Header().Set("X-Powered-By", "0BSD_FOR_EVERYONE") + w.Header().Set("X-Frame-Options", "SAMEORIGIN") + w.Header().Set("X-Content-Type-Options", "nosniff") html := ` @@ -151,8 +148,17 @@ func main() { mux := http.NewServeMux() mux.HandleFunc("/", handler) mux.HandleFunc("/ws", wsHandler) + + server := &http.Server{ + Addr: ":" + p, + Handler: mux, + ReadTimeout: 30 * time.Second, + WriteTimeout: 30 * time.Second, + IdleTimeout: 60 * time.Second, + } + log.Printf("Сервер запущен на порту %s", p) - if err := http.ListenAndServe(":"+p, mux); err != nil { + if err := server.ListenAndServe(); err != nil { log.Printf("Ошибка на порту %s: %v", p, err) } }(port)