diff options
Diffstat (limited to 'main.go')
-rw-r--r-- | main.go | 15 |
1 files changed, 12 insertions, 3 deletions
@@ -271,11 +271,20 @@ func main() { log.Println("Started Geolocation Service") log.Printf("Listening on port %v...\n", *port) - pstr := ":" + strconv.Itoa(*port) + addr := ":" + strconv.Itoa(*port) + s := &http.Server{ + Addr: addr, + Handler: mux, + ReadTimeout: 1 * time.Second, + WriteTimeout: 1 * time.Second, + IdleTimeout: 30 * time.Second, + ReadHeaderTimeout: 2 * time.Second, + MaxHeaderBytes: 1 << 20, + } if *notls == true { - err = http.ListenAndServe(pstr, mux) + err = s.ListenAndServe() } else { - err = http.ListenAndServeTLS(pstr, *crt, *key, mux) + err = s.ListenAndServeTLS(*crt, *key) } if err != nil { |