mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-04-23 00:06:15 -04:00
fix(ipv4-range-expander): calculate correct for ip addresses where the first octet is lower than 128 (#405)
This commit is contained in:
parent
7aed9c56fd
commit
8c92d56318
3 changed files with 27 additions and 2 deletions
|
@ -40,12 +40,12 @@ function calculateCidr({ startIp, endIp }: { startIp: string; endIp: string }) {
|
|||
value: ipv4ToInt({ ip: startIp }).toString(),
|
||||
fromBase: 10,
|
||||
toBase: 2,
|
||||
});
|
||||
}).padStart(32, '0');
|
||||
const end = convertBase({
|
||||
value: ipv4ToInt({ ip: endIp }).toString(),
|
||||
fromBase: 10,
|
||||
toBase: 2,
|
||||
});
|
||||
}).padStart(32, '0');
|
||||
|
||||
const cidr = getCidr(start, end);
|
||||
if (cidr != null) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue