Files
proxy/cmd/mock/main.go

32 lines
499 B
Go
Raw Normal View History

2025-03-05 18:12:26 +08:00
package main
import (
"net/http"
"time"
)
func main() {
mock()
// attack()
}
func mock() {
2025-03-06 14:35:21 +08:00
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
2025-03-08 10:59:31 +08:00
// waiting := rand.Intn(450) + 50
// time.Sleep(time.Duration(waiting) * time.Millisecond)
time.Sleep(200 * time.Millisecond)
w.Write([]byte("Hello World"))
})
2025-03-06 14:35:21 +08:00
serv := &http.Server{
Addr: ":8080",
Handler: nil,
}
serv.SetKeepAlivesEnabled(false)
err := serv.ListenAndServe()
if err != nil {
panic(err)
}
}