Replace base64 encoding with random uuid
This commit is contained in:
parent
def5155aa6
commit
c4fc497646
2 changed files with 5 additions and 4 deletions
|
@ -342,8 +342,7 @@ var (
|
|||
|
||||
func buildWhitelistVariable(s string) string {
|
||||
if _, ok := whitelistVarMap[s]; !ok {
|
||||
str := base64.URLEncoding.EncodeToString([]byte(s))
|
||||
whitelistVarMap[s] = strings.Replace(str, "=", "", -1)
|
||||
whitelistVarMap[s] = fmt.Sprintf("whitelist_%v", uuid.New())
|
||||
}
|
||||
|
||||
return whitelistVarMap[s]
|
||||
|
|
|
@ -289,13 +289,15 @@ http {
|
|||
{{ end }}
|
||||
{{ end }}
|
||||
{{ if ne $location.RateLimit.Name "" }}
|
||||
geo ${{ buildWhitelistVariable $location.RateLimit.Name }}_whitelist {
|
||||
# Ratelimit {{ $location.RateLimit.Name }}
|
||||
geo $whitelist_{{ buildWhitelistVariable $location.RateLimit.Name }} {
|
||||
default 0;
|
||||
{{ range $ip := $location.RateLimit.Whitelist }}
|
||||
{{ $ip }} 1;{{ end }}
|
||||
}
|
||||
|
||||
map ${{ buildWhitelistVariable $location.RateLimit.Name }}_whitelist ${{ buildWhitelistVariable $location.RateLimit.Name }}_limit {
|
||||
# Ratelimit {{ $location.RateLimit.Name }}
|
||||
map $whitelist_{{ buildWhitelistVariable $location.RateLimit.Name }} ${{ buildWhitelistVariable $location.RateLimit.Name }}_limit {
|
||||
0 {{ $cfg.LimitConnZoneVariable }};
|
||||
1 "";
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue