This commit is contained in:
Lain Iwakura 2025-07-12 19:09:40 +03:00
parent f5c177c19e
commit dff228cdbb
No known key found for this signature in database
GPG Key ID: C7C18257F2ADC6F8

28
main.go
View File

@ -209,32 +209,14 @@ func main() {
wg.Add(1) wg.Add(1)
go func(p string) { go func(p string) {
defer wg.Done() defer wg.Done()
mux := http.NewServeMux()
mux.HandleFunc("/", handler)
mux.HandleFunc("/ws", wsHandler)
mux.HandleFunc("/status", statusHandler)
server := &http.Server{ server := &http.Server{
Addr: ":" + p, Addr: ":" + p,
Handler: http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { Handler: mux,
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("<html><body><h1>Not Found</h1></body></html>"))
}),
ReadTimeout: 30 * time.Second, ReadTimeout: 30 * time.Second,
WriteTimeout: 30 * time.Second, WriteTimeout: 30 * time.Second,
IdleTimeout: 60 * time.Second, IdleTimeout: 60 * time.Second,