Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

There are cases where I want to use keys other than the fixed ones. #5

Merged
merged 4 commits into from
Dec 24, 2023

Conversation

pyama86
Copy link
Contributor

@pyama86 pyama86 commented Dec 23, 2023

I've made adjustments because there are cases where I want to block not just based on the host, but also on IP for limiters of GET parameters and request paths.

Copy link
Member

@k1LoW k1LoW left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

We need to choose host or remote_addr, right?

base_limiter.go Outdated
@@ -58,3 +59,19 @@ func (l *BaseLimiter) isTargetExtensions(r *http.Request) bool {
}
return false
}
func validateKey(key string) error {
for _, k := range []string{"remote_addr", "host"} {
Copy link
Member

@k1LoW k1LoW Dec 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"remote_addr" and "host" may be const variables.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see.
I should to make constaiant variable host and remote_addr.

I will do afer cristmas..

@pyama86
Copy link
Contributor Author

pyama86 commented Dec 23, 2023

We need to choose host or remote_addr, right?.

Yes!!!
I think that you are always right!!!

base_limiter.go Outdated Show resolved Hide resolved
Co-authored-by: Ken’ichiro Oyama <[email protected]>
Copy link
Member

@k1LoW k1LoW left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thank you!!!

@pyama86 pyama86 merged commit 9748e10 into main Dec 24, 2023
3 checks passed
@pyama86 pyama86 deleted the support-select-key branch December 24, 2023 01:11
@github-actions github-actions bot mentioned this pull request Dec 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants