diff options
author | Christopher Speller <crspeller@gmail.com> | 2018-01-31 09:49:15 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-31 09:49:15 -0800 |
commit | 1262d254736229618582f0963c9c30c4e66efb98 (patch) | |
tree | c2375b6c6b143dc59c24d590eb59c5d49d17247e /model/config.go | |
parent | e0ee73ef9963ab398bcc6011795ad23e8e003147 (diff) | |
download | chat-1262d254736229618582f0963c9c30c4e66efb98.tar.gz chat-1262d254736229618582f0963c9c30c4e66efb98.tar.bz2 chat-1262d254736229618582f0963c9c30c4e66efb98.zip |
User based rate limiting (#8152)
Diffstat (limited to 'model/config.go')
-rw-r--r-- | model/config.go | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/model/config.go b/model/config.go index 525fc71ed..b7888ab13 100644 --- a/model/config.go +++ b/model/config.go @@ -802,7 +802,8 @@ type RateLimitSettings struct { PerSec *int MaxBurst *int MemoryStoreSize *int - VaryByRemoteAddr bool + VaryByRemoteAddr *bool + VaryByUser *bool VaryByHeader string } @@ -822,6 +823,14 @@ func (s *RateLimitSettings) SetDefaults() { if s.MemoryStoreSize == nil { s.MemoryStoreSize = NewInt(10000) } + + if s.VaryByRemoteAddr == nil { + s.VaryByRemoteAddr = NewBool(true) + } + + if s.VaryByUser == nil { + s.VaryByUser = NewBool(false) + } } type PrivacySettings struct { |