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

Why a mix of CIDR and net range? #3

Open
benoitjpnet opened this issue Sep 16, 2023 · 6 comments
Open

Why a mix of CIDR and net range? #3

benoitjpnet opened this issue Sep 16, 2023 · 6 comments

Comments

@benoitjpnet
Copy link

Hi,

I'm curious about this decision to mix CIDR and net range notation. Is there a specific reason? It makes parsing the database a bit more difficult.

Thanks.

@ipapi-is
Copy link
Owner

Hey,

Will be done in the next release.

What format do you suggest?

@benoitjpnet
Copy link
Author

benoitjpnet commented Sep 16, 2023 via email

@ipapi-is
Copy link
Owner

CIDR doesn't work for all networks.

How would you represent the network

1.2.3.4 - 1.2.3.7 in CIDR format?

Kind regards, Nikolai

@benoitjpnet
Copy link
Author

benoitjpnet commented Sep 19, 2023

Well 1.2.3.4/30? From .4 to .7. (Not caring about network and broadcast address).
Maxmind use CIDR like this. If you then want network ranges, then you can convert with their tool.

e.g:
Screenshot_20230919_202749

@ipapi-is
Copy link
Owner

ipapi-is commented Sep 21, 2023

You are correct.

How do you represent 1.2.3.1 - 1.2.3.7 in CIDR?

Not possible with one CIDR address, you have to provide 3 CIDR ranges:

1.2.3.1/32
1.2.3.2/31
1.2.3.4/30

Conclusion:

I will probably use the following format to represent IP ranges (Using integers):

ipVersion,startIp,endIp
4,1246803551,1246803551
6,55838750780053364850524370207644844032,55838750780053364868971114281354395647

Alternative, I can use the following format:

ipVersion,startIp,endIp
4,84.246.248.128,84.246.248.191
4,84.246.248.192,84.246.248.255
6,2606:54c0:7680:5330::,2606:54c0:7680:5330:ffff:ffff:ffff:ffff

The problem with both of those formats is that they need considerably more space than CIDR format.

@acidvegas
Copy link

while it takes up more space, it is a consistent 2 variables, rather than breaking up a range into potentially more than 2 cidrs. but i do think the format of choice should be consistent.

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

3 participants