This commit is contained in:
Lain Iwakura 2025-07-12 19:01:18 +03:00
parent 1ed87b4d3a
commit 9e234e9178
No known key found for this signature in database
GPG Key ID: C7C18257F2ADC6F8

21
main.go
View File

@ -59,7 +59,7 @@ func wsHandler(w http.ResponseWriter, r *http.Request) {
} else if buffer == "whoareu" { } else if buffer == "whoareu" {
conn.WriteJSON(map[string]string{"action": "redirect", "url": "https://t.me/systemxplore"}) conn.WriteJSON(map[string]string{"action": "redirect", "url": "https://t.me/systemxplore"})
buffer = "" buffer = ""
} else if buffer == "whoami" { } else if buffer == "whoami" {
conn.WriteJSON(map[string]string{"action": "redirect", "url": "https://t.me/systemxplore"}) conn.WriteJSON(map[string]string{"action": "redirect", "url": "https://t.me/systemxplore"})
buffer = "" buffer = ""
} else if buffer == "whoareyou" { } else if buffer == "whoareyou" {
@ -216,10 +216,23 @@ func main() {
server := &http.Server{ server := &http.Server{
Addr: ":" + p, Addr: ":" + p,
Handler: mux, Handler: http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
ReadTimeout: 30 * time.Second, 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("<html><body><h1>Not Found</h1></body></html>"))
}
}()
mux.ServeHTTP(w, r)
}),
ReadTimeout: 30 * time.Second,
WriteTimeout: 30 * time.Second, WriteTimeout: 30 * time.Second,
IdleTimeout: 60 * time.Second, IdleTimeout: 60 * time.Second,
} }
log.Printf("Сервер запущен на порту %s", p) log.Printf("Сервер запущен на порту %s", p)