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

Feature: Allow networks #8

Open
niccokunzmann opened this issue Sep 30, 2024 · 3 comments
Open

Feature: Allow networks #8

niccokunzmann opened this issue Sep 30, 2024 · 3 comments

Comments

@niccokunzmann
Copy link
Contributor

I would like to do something like this:

ALLOWED_HOSTS=192.168.0.*

So basically freeing up a network. The ip package has functionality to check that. I think, that would be nice.

@riad-azz
Copy link
Owner

Hi niccokunzmann once again!

Could you clarify what you mean by allowing a network like 192.168.0.*? Are you referring to allowing all IPs in the local network or allowing a dynamic range of IPs?

@niccokunzmann
Copy link
Contributor Author

niccokunzmann commented Sep 30, 2024

Hm, I could make this a bit clearer. I can use 192.168.0.1 for example, which would match 192.168.0.1/32 as a network with bit mask. I would like to allow e.g. all clients in a specific network to access the app.

This provides functionality for IPv4 and IPv6, parsing the strings and documented:
https://docs.python.org/3/library/ipaddress.html#ipaddress.ip_network

This is not a requirement for me but an idea of how this can be extended. It seems that not much needs changing for this.

@riad-azz
Copy link
Owner

I’m not sure if this is exactly what you were asking for, but I’ve added network support. Now, you can pass something like 192.168.0.1/32 to allow 192.168.0.1 or any other network of your choice.

Commit: 1e2a832

Usage example : Network Example

Lastly, sorry for the delay, I have been quite busy with work

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

No branches or pull requests

2 participants