Ugh, WHAT!

This commit is contained in:
niten 2023-11-03 12:51:28 -07:00
parent e37fe381d5
commit 2d96202a58

View File

@ -65,15 +65,13 @@ in rec {
ipv4OnNetwork = ip: network: ipv4OnNetwork = ip: network:
let let
ip-int = ipv4ToInt ip; ip-int = ipv4ToInt ip;
net-min = networkMinIp network; netMin = networkMinIp network;
net-max = networkMaxIp network; netMax = networkMaxIp network;
in (ip-int >= (ipv4ToInt networkMinIp)) in (ip-int >= (ipv4ToInt netMin)) && (ip-int <= (ipv4ToInt netMax));
&& (ip-int <= (ipv4ToInt networkMaxIp));
getNetworkMask = network: toInt (elemAt (splitString "/" network) 1); getNetworkMask = network: toInt (elemAt (splitString "/" network) 1);
getNetworkBase = network: getNetworkBase = network:
assert (builtins.match ".+/[0-9]+" network) != null;
let let
ip = elemAt (splitString "/" network) 0; ip = elemAt (splitString "/" network) 0;
insignificantBits = 32 - (getNetworkMask network); insignificantBits = 32 - (getNetworkMask network);