ipapi-is / ipapi

Documentation for https://ipapi.is/ and repository for the Geolocation, ASN and Hosting Ranges databases.
https://ipapi.is/
86 stars 1 forks source link

Why a mix of CIDR and net range? #3

Open benoitjpnet opened 11 months ago

benoitjpnet commented 11 months ago

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 commented 11 months ago

Hey,

Will be done in the next release.

What format do you suggest?

benoitjpnet commented 11 months ago

CIDR looks good, that's what most software expect.

Thanks!

Sep 16, 2023 21:55:28 ipapi.is @.***>:

Hey,

Will be done in the next release.

What format do you suggest?

— Reply to this email directly, view it on GitHub[https://github.com/ipapi-is/ipapi/issues/3#issuecomment-1722224505], or unsubscribe[https://github.com/notifications/unsubscribe-auth/AAICI6P2WWZNJXCWVEJQ4TDX2WOTLANCNFSM6AAAAAA42REIBM]. You are receiving this because you authored the thread. [Tracking image][https://github.com/notifications/beacon/AAICI6MMTYUCTDJAL4KFB5LX2WOTLA5CNFSM6AAAAAA42REIBOWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTTGU4HXS.gif]

ipapi-is commented 11 months ago

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 commented 11 months ago

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 commented 11 months ago

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 commented 11 months ago

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.