ipapi icon indicating copy to clipboard operation
ipapi copied to clipboard

Why a mix of CIDR and net range?

Open benoitjpnet opened this issue 2 years ago • 6 comments

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.

benoitjpnet avatar Sep 16 '23 01:09 benoitjpnet

Hey,

Will be done in the next release.

What format do you suggest?

ipapi-is avatar Sep 16 '23 12:09 ipapi-is

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]

benoitjpnet avatar Sep 16 '23 13:09 benoitjpnet

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

ipapi-is avatar Sep 17 '23 13:09 ipapi-is

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

benoitjpnet avatar Sep 19 '23 11:09 benoitjpnet

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.

ipapi-is avatar Sep 21 '23 15:09 ipapi-is

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.

acidvegas avatar Oct 04 '23 15:10 acidvegas