shit
This commit is contained in:
parent
f5c177c19e
commit
dff228cdbb
28
main.go
28
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("<html><body><h1>Not Found</h1></body></html>"))
|
||||
}),
|
||||
Handler: mux,
|
||||
ReadTimeout: 30 * time.Second,
|
||||
WriteTimeout: 30 * time.Second,
|
||||
IdleTimeout: 60 * time.Second,
|
||||
|
Loading…
x
Reference in New Issue
Block a user