Closed cirosantilli closed 8 months ago
let me also suggest
sqlite> select ipmask('192.168.16.12/24');
255.255.255.0
sqlite> select ipmasktolen('255.255.254.0');
23
sqlite> select ipmatch('192.168.*','192.168.16.12');
true
sqlite> select ipmatch('192.168.*.12','192.168.16.12');
true
sqlite> select ipmatch('192.*.*.12','192.168.16.12');
true
sqlite> select ipmatch('192.*','192.168.16.12');
true
sqlite> select ipmatch('*.12','192.168.16.12');
true
sqlite> select ipmatch('192.168.1-17.12','192.168.16.12');
true
sqlite> select ipmatch('192.168.1-14.12','192.168.16.12');
false
sqlite> select ipmatch('192.150-168.1-17.11-12','192.168.16.12');
true
sqlite> select ipmatch('192.150-168.*.10','192.168.16.12');
false
Sorry, I have no plans to add new features at this time.
It would be good to add functions that convert IPv4 and IPv6 address to/from strings.
A use case I had is you get a .csv file with string IPs, but it is much more efficient to handle them as integer in DB.
E.g.:
would output:
At: https://stackoverflow.com/questions/7638238/sqlite-ip-address-storage/76520885#76520885 I show an implementation of str -> int, but would need to add the inverse and IPv6 support too.
Lazy to make a clean pull request here, but it's an idea.