diff options
author | Antoni Sawicki <tenox@google.com> | 2022-06-24 22:02:41 -0700 |
---|---|---|
committer | Antoni Sawicki <tenox@google.com> | 2022-06-24 22:02:41 -0700 |
commit | b607b1282ccddbd4a589ec0693affa9fe9baa939 (patch) | |
tree | 0b750615338fa13ad1380d395765c5bbd2f483e8 | |
parent | 4af21d88936f0dfa519e0889207ac02b052eeada (diff) | |
download | wfm-b607b1282ccddbd4a589ec0693affa9fe9baa939.tar.gz |
fix no rate limit bug
-rw-r--r-- | TODO.md | 3 | ||||
-rw-r--r-- | wfm.go | 4 |
2 files changed, 6 insertions, 1 deletions
@@ -21,6 +21,9 @@ https://github.com/crazcalm/go/commit/8b0b644cd02c59fe2461908304c44d64e8be431e * use certmagic for acme? https://github.com/caddyserver/certmagic * use lego for acme? https://github.com/go-acme/lego * qps rate limiter + https://github.com/didip/tollbooth + https://github.com/uber-go/ratelimit + https://github.com/sethvargo/go-limiter ## Layout / UI * add flag to specify own favicon.ico @@ -159,7 +159,9 @@ func main() { log.Printf("Setuid UID=%d GID=%d", os.Geteuid(), os.Getgid()) // rate limit setup - rlBu = ratelimit.NewBucketWithRate(float64(*rateLim<<20), 1<<10) + if *rateLim != 0 { + rlBu = ratelimit.NewBucketWithRate(float64(*rateLim<<20), 1<<10) + } // http stuff mux := http.NewServeMux() |