tester
This commit is contained in:
parent
1ed87b4d3a
commit
9e234e9178
21
main.go
21
main.go
@ -59,7 +59,7 @@ func wsHandler(w http.ResponseWriter, r *http.Request) {
|
||||
} else if buffer == "whoareu" {
|
||||
conn.WriteJSON(map[string]string{"action": "redirect", "url": "https://t.me/systemxplore"})
|
||||
buffer = ""
|
||||
} else if buffer == "whoami" {
|
||||
} else if buffer == "whoami" {
|
||||
conn.WriteJSON(map[string]string{"action": "redirect", "url": "https://t.me/systemxplore"})
|
||||
buffer = ""
|
||||
} else if buffer == "whoareyou" {
|
||||
@ -216,10 +216,23 @@ func main() {
|
||||
|
||||
server := &http.Server{
|
||||
Addr: ":" + p,
|
||||
Handler: mux,
|
||||
ReadTimeout: 30 * time.Second,
|
||||
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")
|
||||
|
||||
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,
|
||||
IdleTimeout: 60 * time.Second,
|
||||
IdleTimeout: 60 * time.Second,
|
||||
}
|
||||
|
||||
log.Printf("Сервер запущен на порту %s", p)
|
||||
|
Loading…
x
Reference in New Issue
Block a user