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

Add XFF/Forwarded custom filter strategy? #1

Open
adam-p opened this issue Apr 14, 2022 · 0 comments
Open

Add XFF/Forwarded custom filter strategy? #1

adam-p opened this issue Apr 14, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@adam-p
Copy link
Contributor

adam-p commented Apr 14, 2022

It's possible that a user of the library may wish to use our X-Forwarded-For and Forwarded handling/parsers, but choose which IP to use in a different way (than "rightmost non-private", "trusted count", etc.). So they would like strategies like:

func NewLeftmostCustomStrategy(headerName string, filter func(ip string) bool) ...

func NewRightmostCustomStrategy(headerName string, filter func(ip string) bool) ...

Those would choose the left/rightmost IP for which filter returns true.

I don't want to add this just because someone "might" want them, but if anyone has any solid examples/use cases, please let us know here.

If we do add this, we might want to also export privateAndLocalRanges and/or isPrivateOrLocal. Those are likely to be needed by a custom filter. (Possibly other helpers, like goodIPAddr?)

@adam-p adam-p added the enhancement New feature or request label Apr 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant