initial commit

Signed-off-by: Ava Hahn <a.hahn@f5.com>
This commit is contained in:
Ava Hahn 2025-08-16 00:47:14 +00:00
commit 4ee7c0cc18
13 changed files with 582 additions and 0 deletions

32
keepalive-svc.go Executable file
View file

@ -0,0 +1,32 @@
package main
import (
"fmt"
"net"
"net/http"
"time"
)
type myHandler struct{
nreq int
}
func (h myHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
fmt.Printf("accepted request number %d", h.nreq)
fmt.Fprintf(w, "request number: %d", h.nreq)
}
func main() {
srv := &http.Server{
Addr: ":8080",
Handler: myHandler{nreq: 0},
ReadTimeout: 5 * time.Second,
WriteTimeout: 10 * time.Second,
IdleTimeout: 300 * time.Second,
ConnState: func(conn net.Conn, event http.ConnState) {
fmt.Printf("addr: %s, changed state to: %s", conn.RemoteAddr(), event.String())
},
}
srv.ListenAndServe()
}