aboutsummaryrefslogtreecommitdiff
path: root/flags.go
diff options
context:
space:
mode:
Diffstat (limited to 'flags.go')
-rw-r--r--flags.go14
1 files changed, 11 insertions, 3 deletions
diff --git a/flags.go b/flags.go
index 49bd3ff..1cf8b63 100644
--- a/flags.go
+++ b/flags.go
@@ -6,9 +6,13 @@ package main
import "flag"
var (
- listenAddr string
- destHost string
- secondary bool
+ listenAddr string
+ destHost string
+ secondary bool
+ readTimeout int
+ writeTimeout int
+ idleTimeout int
+ readHeaderTimeout int
)
// This init parses command line flags.
@@ -18,6 +22,10 @@ func init() {
flag.StringVar(&listenAddr, "listen", ":8081", "address to listen on")
flag.StringVar(&destHost, "upstream", "http://127.0.0.1:8080", "destination url base to proxy to")
flag.BoolVar(&secondary, "secondary", false, "trust X-Forwarded-For headers")
+ flag.IntVar(&readTimeout, "read-timeout", 0, "read timeout in seconds, 0 for no timeout")
+ flag.IntVar(&writeTimeout, "write-timeout", 0, "write timeout in seconds, 0 for no timeout")
+ flag.IntVar(&idleTimeout, "idle-timeout", 0, "idle timeout in seconds, 0 for no timeout")
+ flag.IntVar(&readHeaderTimeout, "read-header-timeout", 30, "read header timeout in seconds, 0 for no timeout")
flag.Parse()
global.NeedBitsReverse = 256 - global.NeedBits
}