Skip to content

Commit

Permalink
Configurable read/write timeouts
Browse files Browse the repository at this point in the history
  • Loading branch information
Artyom Pervukhin committed Jul 16, 2016
1 parent cb3279b commit b99f9b4
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions leproxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,15 @@ func main() {
Conf string `flag:"map,file with host/backend mapping"`
Cache string `flag:"cache,path to letsencypt cache file"`
HSTS bool `flag:"hsts,add Strict-Transport-Security header"`

RTo time.Duration `flag:"rto,maximum duration before timing out read of the request"`
WTo time.Duration `flag:"wto,maximum duration before timing out write of the response"`
}{
Addr: ":https",
Conf: "mapping.yml",
Cache: "letsencrypt.cache",
RTo: time.Minute,
WTo: 5 * time.Minute,
}
autoflags.Define(&params)
flag.Parse()
Expand All @@ -47,6 +52,12 @@ func main() {
if err != nil {
log.Fatal(err)
}
if params.RTo > 0 {
srv.ReadTimeout = params.RTo
}
if params.WTo > 0 {
srv.WriteTimeout = params.WTo
}
log.Fatal(srv.ListenAndServeTLS("", ""))
}

Expand Down

0 comments on commit b99f9b4

Please sign in to comment.